Skip to content

Commit

Permalink
Read THERMO variables from TDRP file (mmbell#85)
Browse files Browse the repository at this point in the history
* add thermo variables to TDRP fiel

* read in the namelist variables required by thermo

* fix some typos and add missing code

* fix segmentation fault issue and read in thermo params correctly

* Added notes to remember TODO items.

---------

Co-authored-by: johnmauff <dennis@ucar.edu>
  • Loading branch information
sjsprecious and johnmauff authored Jul 31, 2024
1 parent 159bb35 commit 9402615
Show file tree
Hide file tree
Showing 8 changed files with 501 additions and 4 deletions.
3 changes: 1 addition & 2 deletions ncar_scripts/TDRP/beltrami.tdrp
Original file line number Diff line number Diff line change
Expand Up @@ -1233,5 +1233,4 @@ j_max_wavenumber = { -1, -1 };
// Type: float
// 1D array - variable length.

k_max_wavenumber = { -1, -1 };

k_max_wavenumber = { -1, -1 };
113 changes: 113 additions & 0 deletions ncar_scripts/TDRP/beltramiTR.tdrp
Original file line number Diff line number Diff line change
Expand Up @@ -1235,3 +1235,116 @@ j_max_wavenumber = { -1, -1 };

k_max_wavenumber = { -1, -1 };

//======================================================================
//
// VARIABLES NEEDED BY THERMO.
//
//======================================================================

///////////// i_pip_bcL ///////////////////////////////
//
// Type: int

i_pip_bcL = -1;

///////////// i_pip_bcR ///////////////////////////////
//
// Type: int

i_pip_bcR = -1;

///////////// i_thetarhop_bcL ///////////////////////////////
//
// Type: int

i_thetarhop_bcL = -1;

///////////// i_thetarhop_bcR ///////////////////////////////
//
// Type: int

i_thetarhop_bcR = -1;

///////////// i_ftheta_bcL ///////////////////////////////
//
// Type: int

i_ftheta_bcL = -1;

///////////// i_ftheta_bcR ///////////////////////////////
//
// Type: int

i_ftheta_bcR = -1;

///////////// j_pip_bcL ///////////////////////////////
//
// Type: int

j_pip_bcL = -1;

///////////// j_pip_bcR ///////////////////////////////
//
// Type: int

j_pip_bcR = -1;

///////////// j_thetarhop_bcL ///////////////////////////////
//
// Type: int

j_thetarhop_bcL = -1;

///////////// j_thetarhop_bcR ///////////////////////////////
//
// Type: int

j_thetarhop_bcR = -1;

///////////// j_ftheta_bcL ///////////////////////////////
//
// Type: int

j_ftheta_bcL = -1;

///////////// j_ftheta_bcR ///////////////////////////////
//
// Type: int

j_ftheta_bcR = -1;

///////////// k_pip_bcL ///////////////////////////////
//
// Type: int

k_pip_bcL = -1;

///////////// k_pip_bcR ///////////////////////////////
//
// Type: int

k_pip_bcR = -1;

///////////// k_thetarhop_bcL ///////////////////////////////
//
// Type: int

k_thetarhop_bcL = -1;

///////////// k_thetarhop_bcR ///////////////////////////////
//
// Type: int

k_thetarhop_bcR = -1;

///////////// k_ftheta_bcL ///////////////////////////////
//
// Type: int

k_ftheta_bcL = -1;

///////////// k_ftheta_bcR ///////////////////////////////
//
// Type: int

k_ftheta_bcR = -1;
22 changes: 22 additions & 0 deletions src/Args.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,5 +308,27 @@ bool Args::paramsToHash(HashMap *configHash) {
CONFIG_INSERT_FLOAT_ARRAY(neumann_v_weight, iter);
CONFIG_INSERT_FLOAT_ARRAY(dirichlet_w_weight, iter);
}
// arguments required by THERMO
CONFIG_INSERT_INT(i_pip_bcL);
CONFIG_INSERT_INT(i_pip_bcR);
CONFIG_INSERT_INT(i_thetarhop_bcL);
CONFIG_INSERT_INT(i_thetarhop_bcR);
CONFIG_INSERT_INT(i_ftheta_bcL);
CONFIG_INSERT_INT(i_ftheta_bcR);

CONFIG_INSERT_INT(j_pip_bcL);
CONFIG_INSERT_INT(j_pip_bcR);
CONFIG_INSERT_INT(j_thetarhop_bcL);
CONFIG_INSERT_INT(j_thetarhop_bcR);
CONFIG_INSERT_INT(j_ftheta_bcL);
CONFIG_INSERT_INT(j_ftheta_bcR);

CONFIG_INSERT_INT(k_pip_bcL);
CONFIG_INSERT_INT(k_pip_bcR);
CONFIG_INSERT_INT(k_thetarhop_bcL);
CONFIG_INSERT_INT(k_thetarhop_bcR);
CONFIG_INSERT_INT(k_ftheta_bcL);
CONFIG_INSERT_INT(k_ftheta_bcR);

return true;
}
2 changes: 2 additions & 0 deletions src/CostFunction3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ void CostFunction3D::initialize(HashMap* config,
dataPath = (*configHash)["data_directory"];
outputPath = (*configHash)["output_directory"];

//JMD TODO: Need to plug in the Thermo boundary conditions here.
//JMD Currently this is only the wind boundary condidtions.
// Horizontal boundary conditions
iBCL[0] = bcHash[(*configHash)["i_rhou_bcL"]];
iBCR[0] = bcHash[(*configHash)["i_rhou_bcR"]];
Expand Down
210 changes: 210 additions & 0 deletions src/Params.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2999,7 +2999,217 @@
tt->array_vals[0].f = -1;
tt->array_vals[1].f = -1;
tt++;

// Parameter 'Comment 15'

memset(tt, 0, sizeof(TDRPtable));
tt->ptype = COMMENT_TYPE;
tt->param_name = tdrpStrDup("Comment 15");
tt->comment_hdr = tdrpStrDup("VARIABLES NEEDED BY THERMO");
tt->comment_text = tdrpStrDup("");
tt++;

// Parameter 'i_pip_bcL'
// ctype is 'int'

memset(tt, 0, sizeof(TDRPtable));
tt->ptype = INT_TYPE;
tt->param_name = tdrpStrDup("i_pip_bcL");
tt->descr = tdrpStrDup("");
tt->help = tdrpStrDup("");
tt->val_offset = (char *) &i_pip_bcL - &_start_;
tt->single_val.i = -999;
tt++;

// Parameter 'i_pip_bcR'
// ctype is 'int'
memset(tt, 0, sizeof(TDRPtable));
tt->ptype = INT_TYPE;
tt->param_name = tdrpStrDup("i_pip_bcR");
tt->descr = tdrpStrDup("");
tt->help = tdrpStrDup("");
tt->val_offset = (char *) &i_pip_bcR - &_start_;
tt->single_val.i = -999;
tt++;

// Parameter 'i_thetarhop_bcL'
// ctype is 'int'
memset(tt, 0, sizeof(TDRPtable));
tt->ptype = INT_TYPE;
tt->param_name = tdrpStrDup("i_thetarhop_bcL");
tt->descr = tdrpStrDup("");
tt->help = tdrpStrDup("");
tt->val_offset = (char *) &i_thetarhop_bcL - &_start_;
tt->single_val.i = -999;
tt++;

// Parameter 'i_thetarhop_bcR'
// ctype is 'int'
memset(tt, 0, sizeof(TDRPtable));
tt->ptype = INT_TYPE;
tt->param_name = tdrpStrDup("i_thetarhop_bcR");
tt->descr = tdrpStrDup("");
tt->help = tdrpStrDup("");
tt->val_offset = (char *) &i_thetarhop_bcR - &_start_;
tt->single_val.i = -999;
tt++;

// Parameter 'i_ftheta_bcL'
// ctype is 'int'
memset(tt, 0, sizeof(TDRPtable));
tt->ptype = INT_TYPE;
tt->param_name = tdrpStrDup("i_ftheta_bcL");
tt->descr = tdrpStrDup("");
tt->help = tdrpStrDup("");
tt->val_offset = (char *) &i_ftheta_bcL - &_start_;
tt->single_val.i = -999;
tt++;

// Parameter 'i_ftheta_bcR'
// ctype is 'int'
memset(tt, 0, sizeof(TDRPtable));
tt->ptype = INT_TYPE;
tt->param_name = tdrpStrDup("i_ftheta_bcR");
tt->descr = tdrpStrDup("");
tt->help = tdrpStrDup("");
tt->val_offset = (char *) &i_ftheta_bcR - &_start_;
tt->single_val.i = -999;
tt++;

// Parameter 'j_pip_bcL'
// ctype is 'int'

memset(tt, 0, sizeof(TDRPtable));
tt->ptype = INT_TYPE;
tt->param_name = tdrpStrDup("j_pip_bcL");
tt->descr = tdrpStrDup("");
tt->help = tdrpStrDup("");
tt->val_offset = (char *) &j_pip_bcL - &_start_;
tt->single_val.i = -999;
tt++;

// Parameter 'j_pip_bcR'
// ctype is 'int'
memset(tt, 0, sizeof(TDRPtable));
tt->ptype = INT_TYPE;
tt->param_name = tdrpStrDup("j_pip_bcR");
tt->descr = tdrpStrDup("");
tt->help = tdrpStrDup("");
tt->val_offset = (char *) &j_pip_bcR - &_start_;
tt->single_val.i = -999;
tt++;

// Parameter 'j_thetarhop_bcL'
// ctype is 'int'
memset(tt, 0, sizeof(TDRPtable));
tt->ptype = INT_TYPE;
tt->param_name = tdrpStrDup("j_thetarhop_bcL");
tt->descr = tdrpStrDup("");
tt->help = tdrpStrDup("");
tt->val_offset = (char *) &j_thetarhop_bcL - &_start_;
tt->single_val.i = -999;
tt++;

// Parameter 'j_thetarhop_bcR'
// ctype is 'int'
memset(tt, 0, sizeof(TDRPtable));
tt->ptype = INT_TYPE;
tt->param_name = tdrpStrDup("j_thetarhop_bcR");
tt->descr = tdrpStrDup("");
tt->help = tdrpStrDup("");
tt->val_offset = (char *) &j_thetarhop_bcR - &_start_;
tt->single_val.i = -999;
tt++;

// Parameter 'j_ftheta_bcL'
// ctype is 'int'
memset(tt, 0, sizeof(TDRPtable));
tt->ptype = INT_TYPE;
tt->param_name = tdrpStrDup("j_ftheta_bcL");
tt->descr = tdrpStrDup("");
tt->help = tdrpStrDup("");
tt->val_offset = (char *) &j_ftheta_bcL - &_start_;
tt->single_val.i = -999;
tt++;

// Parameter 'j_ftheta_bcR'
// ctype is 'int'
memset(tt, 0, sizeof(TDRPtable));
tt->ptype = INT_TYPE;
tt->param_name = tdrpStrDup("j_ftheta_bcR");
tt->descr = tdrpStrDup("");
tt->help = tdrpStrDup("");
tt->val_offset = (char *) &j_ftheta_bcR - &_start_;
tt->single_val.i = -999;
tt++;

// Parameter 'k_pip_bcL'
// ctype is 'int'

memset(tt, 0, sizeof(TDRPtable));
tt->ptype = INT_TYPE;
tt->param_name = tdrpStrDup("k_pip_bcL");
tt->descr = tdrpStrDup("");
tt->help = tdrpStrDup("");
tt->val_offset = (char *) &k_pip_bcL - &_start_;
tt->single_val.i = -999;
tt++;

// Parameter 'k_pip_bcR'
// ctype is 'int'
memset(tt, 0, sizeof(TDRPtable));
tt->ptype = INT_TYPE;
tt->param_name = tdrpStrDup("k_pip_bcR");
tt->descr = tdrpStrDup("");
tt->help = tdrpStrDup("");
tt->val_offset = (char *) &k_pip_bcR - &_start_;
tt->single_val.i = -999;
tt++;

// Parameter 'k_thetarhop_bcL'
// ctype is 'int'
memset(tt, 0, sizeof(TDRPtable));
tt->ptype = INT_TYPE;
tt->param_name = tdrpStrDup("k_thetarhop_bcL");
tt->descr = tdrpStrDup("");
tt->help = tdrpStrDup("");
tt->val_offset = (char *) &k_thetarhop_bcL - &_start_;
tt->single_val.i = -999;
tt++;

// Parameter 'k_thetarhop_bcR'
// ctype is 'int'
memset(tt, 0, sizeof(TDRPtable));
tt->ptype = INT_TYPE;
tt->param_name = tdrpStrDup("k_thetarhop_bcR");
tt->descr = tdrpStrDup("");
tt->help = tdrpStrDup("");
tt->val_offset = (char *) &k_thetarhop_bcR - &_start_;
tt->single_val.i = -999;
tt++;

// Parameter 'k_ftheta_bcL'
// ctype is 'int'
memset(tt, 0, sizeof(TDRPtable));
tt->ptype = INT_TYPE;
tt->param_name = tdrpStrDup("k_ftheta_bcL");
tt->descr = tdrpStrDup("");
tt->help = tdrpStrDup("");
tt->val_offset = (char *) &k_ftheta_bcL - &_start_;
tt->single_val.i = -999;
tt++;

// Parameter 'k_ftheta_bcR'
// ctype is 'int'
memset(tt, 0, sizeof(TDRPtable));
tt->ptype = INT_TYPE;
tt->param_name = tdrpStrDup("k_ftheta_bcR");
tt->descr = tdrpStrDup("");
tt->help = tdrpStrDup("");
tt->val_offset = (char *) &k_ftheta_bcR - &_start_;
tt->single_val.i = -999;
tt++;

// trailing entry has param_name set to NULL

tt->param_name = NULL;
Expand Down
Loading

0 comments on commit 9402615

Please sign in to comment.