Skip to content

Commit 084af37

Browse files
enable incompressible to work with multilevel but only OneWay coupling (erf-model#1612)
* enable incompressible to work with multilevel but only OneWay coupling * code cleanup in ERF_slow_rhs_pre and ERF_slow_rhs_inc * add file to cmake * more changes to sync inc with pre --------- Co-authored-by: Aaron M. Lattanzi <[email protected]>
1 parent 17472ad commit 084af37

17 files changed

+777
-948
lines changed

CMake/BuildERFExe.cmake

+1
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ function(build_erf_lib erf_lib_name)
165165
${SRC_DIR}/TimeIntegration/ERF_advance_lsm.cpp
166166
${SRC_DIR}/TimeIntegration/ERF_advance_radiation.cpp
167167
${SRC_DIR}/TimeIntegration/ERF_make_fast_coeffs.cpp
168+
${SRC_DIR}/TimeIntegration/ERF_make_tau_terms.cpp
168169
${SRC_DIR}/TimeIntegration/ERF_slow_rhs_pre.cpp
169170
${SRC_DIR}/TimeIntegration/ERF_slow_rhs_post.cpp
170171
${SRC_DIR}/TimeIntegration/ERF_fast_rhs_N.cpp

Exec/Make.ERF

+1
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ endif
177177

178178
ifeq ($(USE_POISSON_SOLVE), TRUE)
179179
DEFINES += -DERF_USE_POISSON_SOLVE
180+
USERSuffix += .INC
180181
endif
181182

182183
ifeq ($(USE_PARTICLES), TRUE)

Source/ERF.H

+11-5
Original file line numberDiff line numberDiff line change
@@ -123,17 +123,16 @@ public:
123123

124124
#ifdef ERF_USE_POISSON_SOLVE
125125
// Project the velocities to be divergence-free
126-
void project_velocities ( amrex::Vector<amrex::MultiFab >& vars);
127-
void project_velocities (int lev_min, int lev_max, amrex::Vector<amrex::Vector<amrex::MultiFab>>& vars);
126+
void project_velocities (int lev, amrex::Real dt, amrex::Vector<amrex::MultiFab >& vars, amrex::MultiFab& p);
127+
128+
// Project the velocities to be divergence-free with a thin body
129+
void project_velocities_tb (int lev, amrex::Real dt, amrex::Vector<amrex::MultiFab >& vars, amrex::MultiFab& p);
128130

129131
// Define the projection bc's based on the domain bc types
130132
amrex::Array<amrex::LinOpBCType,AMREX_SPACEDIM>
131133
get_projection_bc (amrex::Orientation::Side side) const noexcept;
132134
bool projection_has_dirichlet (amrex::Array<amrex::LinOpBCType,AMREX_SPACEDIM> bcs) const;
133135

134-
// Project the velocities to be divergence-free with a thin body
135-
void project_velocities_tb ( amrex::Vector<amrex::MultiFab >& vars, const amrex::Real dt);
136-
void project_velocities_tb (amrex::Vector<amrex::Vector<amrex::MultiFab>>& vars, const amrex::Real dt);
137136
#endif
138137

139138
// Init (NOT restart or regrid)
@@ -605,6 +604,10 @@ private:
605604
#endif
606605
amrex::Vector<std::unique_ptr<MRISplitIntegrator<amrex::Vector<amrex::MultiFab> > > > mri_integrator_mem;
607606

607+
#ifdef ERF_USE_POISSON_SOLVE
608+
amrex::Vector<amrex::MultiFab> pp_inc;
609+
#endif
610+
608611
// Vector over levels of routines to impose physical boundary conditions
609612
amrex::Vector<std::unique_ptr<ERFPhysBCFunct_cons>> physbcs_cons;
610613
amrex::Vector<std::unique_ptr<ERFPhysBCFunct_u>> physbcs_u;
@@ -840,6 +843,9 @@ private:
840843
#endif
841844

842845
static int verbose;
846+
#ifdef ERF_USE_POISSON_SOLVE
847+
static int mg_verbose;
848+
#endif
843849

844850
// Diagnostic output interval
845851
static int sum_interval;

Source/ERF.cpp

+17-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ int ERF::fixed_mri_dt_ratio = 0;
3838

3939
// Dictate verbosity in screen output
4040
int ERF::verbose = 0;
41+
#ifdef ERF_USE_POISSON_SOLVE
42+
int ERF::mg_verbose = 0;
43+
#endif
4144

4245
// Frequency of diagnostic output
4346
int ERF::sum_interval = -1;
@@ -182,6 +185,11 @@ ERF::ERF ()
182185
vars_new.resize(nlevs_max);
183186
vars_old.resize(nlevs_max);
184187

188+
#ifdef ERF_USE_POISSON_SOLVE
189+
pp_inc.resize(nlevs_max);
190+
#endif
191+
192+
185193
rU_new.resize(nlevs_max);
186194
rV_new.resize(nlevs_max);
187195
rW_new.resize(nlevs_max);
@@ -819,7 +827,12 @@ ERF::InitData ()
819827
// Note -- this projection is only defined for no terrain
820828
if (solverChoice.project_initial_velocity) {
821829
AMREX_ALWAYS_ASSERT(solverChoice.use_terrain == 0);
822-
project_velocities(0, finest_level, vars_new);
830+
Real dummy_dt = 1.0;
831+
for (int lev = 0; lev <= finest_level; ++lev)
832+
{
833+
project_velocities(lev, dummy_dt, vars_new[lev], pp_inc[lev]);
834+
pp_inc[lev].setVal(0.);
835+
}
823836
}
824837
}
825838
#endif
@@ -1228,6 +1241,9 @@ ERF::ReadParameters ()
12281241

12291242
// Verbosity
12301243
pp.query("v", verbose);
1244+
#ifdef ERF_USE_POISSON_SOLVE
1245+
pp.query("mg_v", mg_verbose);
1246+
#endif
12311247

12321248
// Frequency of diagnostic output
12331249
pp.query("sum_interval", sum_interval);

Source/ERF_make_new_arrays.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,11 @@ ERF::init_stuff (int lev, const BoxArray& ba, const DistributionMapping& dm,
141141
lev_new[Vars::zvel].define(convert(ba, IntVect(0,0,1)), dm, 1, IntVect(ngrow_vels,ngrow_vels,0));
142142
lev_old[Vars::zvel].define(convert(ba, IntVect(0,0,1)), dm, 1, IntVect(ngrow_vels,ngrow_vels,0));
143143

144+
#ifdef ERF_USE_POISSON_SOLVE
145+
pp_inc[lev].define(ba, dm, 1, 1);
146+
pp_inc[lev].setVal(0.0);
147+
#endif
148+
144149
// ********************************************************************************************
145150
// These are just used for scratch in the time integrator but we might as well define them here
146151
// ********************************************************************************************

Source/ERF_make_new_level.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,10 @@ ERF::ClearLevel (int lev)
499499
rW_new[lev].clear();
500500
rW_old[lev].clear();
501501

502+
#ifdef ERF_USE_POISSON_SOLVE
503+
pp_inc[lev].clear();
504+
#endif
505+
502506
// Clears the integrator memory
503507
mri_integrator_mem[lev].reset();
504508

Source/IO/Plotfile.cpp

+7-9
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,7 @@ ERF::setPlotVariables (const std::string& pp_plot_var_names, Vector<std::string>
8080
}
8181
#endif
8282

83-
#ifdef ERF_USE_EB
84-
if (containerHasElement(plot_var_names, "volfrac")) {
85-
tmp_plot_names.push_back("volfrac");
86-
}
87-
#endif
88-
8983
plot_var_names = tmp_plot_names;
90-
91-
for (int i=0; i<plot_var_names.size(); i++) {
92-
}
9384
}
9485

9586
void
@@ -1040,6 +1031,13 @@ ERF::WritePlotFile (int which, Vector<std::string> plot_var_names)
10401031
}
10411032
#endif
10421033

1034+
#ifdef ERF_USE_POISSON_SOLVE
1035+
if (containerHasElement(plot_var_names, "pp_inc")) {
1036+
MultiFab::Copy(mf[lev], pp_inc[lev], 0, mf_comp, 1, 0);
1037+
mf_comp += 1;
1038+
}
1039+
#endif
1040+
10431041
#ifdef ERF_COMPUTE_ERROR
10441042
// Next, check for error in velocities and if desired, output them -- note we output none or all, not just some
10451043
if (containerHasElement(plot_var_names, "xvel_err") ||

0 commit comments

Comments
 (0)