Skip to content

Commit

Permalink
Changes required for coupling with AMR-Wind (#1431)
Browse files Browse the repository at this point in the history
* changes to set up coupling with AMR-Wind

* fix to read BCs for multiblock

* commented out extraneous plotting of plot/check files

* use new compile time ifndef to comment out code when coupling with an external class

* remove plot/checkfile writing at the end of Evolve_MB that creates extraneous files

---------

Co-authored-by: Ann Almgren <[email protected]>
  • Loading branch information
mukul1992 and asalmgren authored Feb 10, 2024
1 parent a054824 commit 285409c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 19 deletions.
4 changes: 4 additions & 0 deletions Source/ERF.H
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,10 @@ public:
// Advance a block specified number of time steps
void Evolve_MB (int MBstep, int max_block_step);

// get the current time values
amrex::Real get_t_old() {return t_old[0];}
amrex::Real get_t_new() {return t_new[0];}

// Set parmparse prefix for MultiBlock
void SetParmParsePrefix (std::string name) { pp_prefix = name; }

Expand Down
22 changes: 4 additions & 18 deletions Source/ERF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -496,11 +496,13 @@ ERF::InitData ()
InitFromScratch(time);

#ifdef ERF_USE_MULTIBLOCK
#ifndef ERF_MB_EXTERN // enter only if multiblock does not involve an external class
// Multiblock: hook to set BL & comms once ba/dm are known
if(domain_p[0].bigEnd(0) < 500 ) {
m_mbc->SetBoxLists();
m_mbc->SetBlockCommMetaData();
}
#endif
#endif

if (solverChoice.use_terrain) {
Expand Down Expand Up @@ -1684,12 +1686,14 @@ ERF::Evolve_MB (int MBstep, int max_block_step)
int iteration = 1;
timeStep(lev, cur_time, iteration);

#ifndef ERF_MB_EXTERN
// DEBUG
// Multiblock: hook for erf2 to fill from erf1
if(domain_p[0].bigEnd(0) < 500) {
for (int var_idx = 0; var_idx < Vars::NumTypes; ++var_idx)
m_mbc->FillPatchBlocks(var_idx,var_idx);
}
#endif

cur_time += dt[0];

Expand Down Expand Up @@ -1730,23 +1734,5 @@ ERF::Evolve_MB (int MBstep, int max_block_step)
if (cur_time >= stop_time - 1.e-6*dt[0]) break;
}

if (plot_int_1 > 0 && istep[0] > last_plot_file_step_1) {
WritePlotFile(1,plot_var_names_1);
}
if (plot_int_2 > 0 && istep[0] > last_plot_file_step_2) {
WritePlotFile(2,plot_var_names_2);
}

if (check_int > 0 && istep[0] > last_check_file_step) {
#ifdef ERF_USE_NETCDF
if (check_type == "netcdf") {
WriteNCCheckpointFile();
}
#endif
if (check_type == "native") {
WriteCheckpointFile();
}
}

}
#endif
8 changes: 7 additions & 1 deletion Source/Initialization/ERF_init_bcs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,13 @@ void ERF::init_bcs ()
m_bc_neumann_vals[BCVars::yvel_bc][ori] = 0.0;
m_bc_neumann_vals[BCVars::zvel_bc][ori] = 0.0;

ParmParse pp(bcid);
std::string pp_text;
if (pp_prefix == "erf") {
pp_text = bcid;
} else {
pp_text = pp_prefix + "." + bcid;
}
ParmParse pp(pp_text);
std::string bc_type_in = "null";
pp.query("type", bc_type_in);
//if (pp.query("type", bc_type_in))
Expand Down

0 comments on commit 285409c

Please sign in to comment.