Skip to content

Commit

Permalink
Merge branch 'development' into dependabot
Browse files Browse the repository at this point in the history
  • Loading branch information
AMLattanzi authored Sep 19, 2024
2 parents dfb7675 + 373cdfd commit 1eba85a
Show file tree
Hide file tree
Showing 10 changed files with 208 additions and 71 deletions.
194 changes: 150 additions & 44 deletions Source/BoundaryConditions/ERF_FillPatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,48 +120,110 @@ ERF::FillPatch (int lev, Real time,
Vector<MultiFab*> cmf = {&vars_old[lev-1][Vars::cons], &vars_new[lev-1][Vars::cons]};
MultiFab& mf_c = *mfs_vel[Vars::cons];
mapper = &cell_cons_interp;
FillPatchTwoLevels(mf_c, time, cmf, ctime, fmf, ftime,

// Impose physical bc's on coarse data (note time and 0 are not used)
(*physbcs_cons[lev-1])(vars_old[lev-1][Vars::cons],0,mf_c.nComp(),ngvect_cons,time,BCVars::cons_bc);
(*physbcs_cons[lev-1])(vars_new[lev-1][Vars::cons],0,mf_c.nComp(),ngvect_cons,time,BCVars::cons_bc);

// Make sure internal ghost cells are filled as well
vars_old[lev-1][Vars::cons].FillBoundary(geom[lev-1].periodicity());
vars_new[lev-1][Vars::cons].FillBoundary(geom[lev-1].periodicity());

// Call FillPatch which ASSUMES that all ghost cells have already been filled
FillPatchTwoLevels(mf_c, ngvect_cons, IntVect(0,0,0),
time, cmf, ctime, fmf, ftime,
0, 0, mf_c.nComp(), geom[lev-1], geom[lev],
*physbcs_cons[lev-1], BCVars::cons_bc,
*physbcs_cons[lev ], BCVars::cons_bc,
refRatio(lev-1), mapper, domain_bcs_type, BCVars::cons_bc);
refRatio(lev-1), mapper, domain_bcs_type,
BCVars::cons_bc);

if (!cons_only) {
// Impose physical bc's on fine data
(*physbcs_cons[lev])(mf_c,0,mf_c.nComp(),ngvect_cons,time,BCVars::cons_bc);

if (!cons_only)
{
mapper = &face_cons_linear_interp;

MultiFab& mf_u = *mfs_vel[Vars::xvel];
MultiFab& mf_v = *mfs_vel[Vars::yvel];
MultiFab& mf_w = *mfs_vel[Vars::zvel];

// **********************************************************************

// Impose physical bc's on coarse data (note time and 0 are not used)
(*physbcs_u[lev-1])(vars_old[lev-1][Vars::xvel],0,1,ngvect_vels,time,BCVars::xvel_bc);
(*physbcs_u[lev-1])(vars_new[lev-1][Vars::xvel],0,1,ngvect_vels,time,BCVars::xvel_bc);

// Make sure internal ghost cells are filled as well
vars_old[lev-1][Vars::xvel].FillBoundary(geom[lev-1].periodicity());
vars_new[lev-1][Vars::xvel].FillBoundary(geom[lev-1].periodicity());

fmf = {&vars_old[lev ][Vars::xvel], &vars_new[lev ][Vars::xvel]};
cmf = {&vars_old[lev-1][Vars::xvel], &vars_new[lev-1][Vars::xvel]};
FillPatchTwoLevels(mf_u, time, cmf, ctime, fmf, ftime,

// Call FillPatch which ASSUMES that all ghost cells have already been filled
FillPatchTwoLevels(mf_u, ngvect_vels, IntVect(0,0,0),
time, cmf, ctime, fmf, ftime,
0, 0, 1, geom[lev-1], geom[lev],
*physbcs_u[lev-1], BCVars::xvel_bc,
*physbcs_u[lev ], BCVars::xvel_bc,
refRatio(lev-1), mapper, domain_bcs_type, BCVars::xvel_bc);
refRatio(lev-1), mapper, domain_bcs_type,
BCVars::xvel_bc);

// Impose physical bc's on fine data
(*physbcs_u[lev])(vars_new[lev][Vars::xvel],0,mf_u.nComp(),ngvect_vels,time,BCVars::xvel_bc);

// **********************************************************************

// Impose physical bc's on coarse data (note time and 0 are not used)
(*physbcs_v[lev-1])(vars_old[lev-1][Vars::yvel],0,1,ngvect_vels,time,BCVars::yvel_bc);
(*physbcs_v[lev-1])(vars_new[lev-1][Vars::yvel],0,1,ngvect_vels,time,BCVars::yvel_bc);

// Make sure internal ghost cells are filled as well
vars_old[lev-1][Vars::yvel].FillBoundary(geom[lev-1].periodicity());
vars_new[lev-1][Vars::yvel].FillBoundary(geom[lev-1].periodicity());

MultiFab& mf_v = *mfs_vel[Vars::yvel];
fmf = {&vars_old[lev ][Vars::yvel], &vars_new[lev ][Vars::yvel]};
cmf = {&vars_old[lev-1][Vars::yvel], &vars_new[lev-1][Vars::yvel]};
FillPatchTwoLevels(mf_v, time, cmf, ctime, fmf, ftime,

// Call FillPatch which ASSUMES that all ghost cells have already been filled
FillPatchTwoLevels(mf_v, ngvect_vels, IntVect(0,0,0),
time, cmf, ctime, fmf, ftime,
0, 0, 1, geom[lev-1], geom[lev],
*physbcs_v[lev-1], BCVars::yvel_bc,
*physbcs_v[lev ], BCVars::yvel_bc,
refRatio(lev-1), mapper, domain_bcs_type, BCVars::yvel_bc);
refRatio(lev-1), mapper, domain_bcs_type,
BCVars::yvel_bc);

// Impose physical bc's on fine data
(*physbcs_v[lev])(vars_new[lev][Vars::yvel],0,1,ngvect_vels,time,BCVars::yvel_bc);

// **********************************************************************

// Impose physical bc's on coarse data (note time and 0 are not used)
(*physbcs_w[lev-1])(vars_old[lev-1][Vars::zvel],
vars_old[lev-1][Vars::xvel],
vars_old[lev-1][Vars::yvel],
ngvect_vels,time,BCVars::zvel_bc);
(*physbcs_w[lev-1])(vars_new[lev-1][Vars::zvel],
vars_new[lev-1][Vars::xvel],
vars_new[lev-1][Vars::yvel],
ngvect_vels,time,BCVars::zvel_bc);

// Make sure internal ghost cells are filled as well
vars_old[lev-1][Vars::zvel].FillBoundary(geom[lev-1].periodicity());
vars_new[lev-1][Vars::zvel].FillBoundary(geom[lev-1].periodicity());

// We note there is an issue here -- we use the no-terrain version to fill the physical
// bcs of the coarse data used to interpolate. We later fix the fine data with the
// correct bcs but if there was an error due to the interpolation with the wrong bcs,
// we will not necessarily be able to fix that.
MultiFab& mf_w = *mfs_vel[Vars::zvel];
fmf = {&vars_old[lev ][Vars::zvel], &vars_new[lev ][Vars::zvel]};
cmf = {&vars_old[lev-1][Vars::zvel], &vars_new[lev-1][Vars::zvel]};
FillPatchTwoLevels(mf_w, time, cmf, ctime, fmf, ftime,

// Call FillPatch which ASSUMES that all ghost cells have already been filled
FillPatchTwoLevels(mf_w, ngvect_vels, IntVect(0,0,0),
time, cmf, ctime, fmf, ftime,
0, 0, 1, geom[lev-1], geom[lev],
*physbcs_w_no_terrain[lev-1], BCVars::zvel_bc,
*physbcs_w_no_terrain[lev ], BCVars::zvel_bc,
refRatio(lev-1), mapper, domain_bcs_type, BCVars::zvel_bc);
refRatio(lev-1), mapper, domain_bcs_type,
BCVars::zvel_bc);


// Impose physical bc's on fine data -- note the u and v have been filled above
(*physbcs_w[lev])(*mfs_vel[Vars::zvel],*mfs_vel[Vars::xvel],*mfs_vel[Vars::yvel],
ngvect_vels,time,BCVars::zvel_bc);

} // !cons_only
} // lev > 0

Expand Down Expand Up @@ -355,34 +417,78 @@ ERF::FillIntermediatePatch (int lev, Real time,
// NOTE: This will only fill velocity from coarse grid *outside* the fine grids
// unlike the FillSet calls above which filled momenta on the coarse/fine bdy
//
Vector<MultiFab*> fmf = {&mf};
Vector<MultiFab*> fmf = {&mf,&mf};
Vector<MultiFab*> cmf = {&vars_old[lev-1][var_idx], &vars_new[lev-1][var_idx]};
Vector<Real> ctime = {t_old[lev-1], t_new[lev-1]};
Vector<Real> ftime = {time,time};

if (var_idx == Vars::cons) {
FillPatchTwoLevels(mf, time, cmf, ctime, fmf, {time},
icomp, icomp, ncomp, geom[lev-1], geom[lev],
*physbcs_cons[lev-1], BCVars::cons_bc,
*physbcs_cons[lev ], BCVars::cons_bc,
refRatio(lev-1), mapper, domain_bcs_type, bccomp);
// Impose physical bc's on coarse data (note time and 0 are not used)
(*physbcs_cons[lev-1])(vars_old[lev-1][Vars::cons],0,ncomp,ngvect,time,BCVars::cons_bc);
(*physbcs_cons[lev-1])(vars_new[lev-1][Vars::cons],0,ncomp,ngvect,time,BCVars::cons_bc);

// Call FillPatch which ASSUMES that all ghost cells have already been filled
FillPatchTwoLevels(mf, ngvect, IntVect(0,0,0),
time, cmf, ctime, fmf, ftime,
0, 0, ncomp, geom[lev-1], geom[lev],
refRatio(lev-1), mapper, domain_bcs_type,
bccomp);

// Impose physical bc's on fine data
(*physbcs_cons[lev])(mf,0,ncomp,ngvect,time,BCVars::cons_bc);

} else if (var_idx == Vars::xvel) {
FillPatchTwoLevels(mf, time, cmf, ctime, fmf, {time},
icomp, icomp, ncomp, geom[lev-1], geom[lev],
*physbcs_u[lev-1], BCVars::xvel_bc,
*physbcs_u[lev ], BCVars::xvel_bc,
refRatio(lev-1), mapper, domain_bcs_type, bccomp);

// Impose physical bc's on coarse data (note time and 0 are not used)
(*physbcs_u[lev-1])(vars_old[lev-1][Vars::xvel],0,1,ngvect,time,BCVars::xvel_bc);
(*physbcs_u[lev-1])(vars_new[lev-1][Vars::xvel],0,1,ngvect,time,BCVars::xvel_bc);

// Call FillPatch which ASSUMES that all ghost cells have already been filled
FillPatchTwoLevels(mf, ngvect, IntVect(0,0,0),
time, cmf, ctime, fmf, ftime,
0, 0, ncomp, geom[lev-1], geom[lev],
refRatio(lev-1), mapper, domain_bcs_type,
bccomp);

// Impose physical bc's on fine data
(*physbcs_u[lev])(mf,0,1,ngvect,time,BCVars::xvel_bc);

} else if (var_idx == Vars::yvel) {
FillPatchTwoLevels(mf, time, cmf, ctime, fmf, {time},
icomp, icomp, ncomp, geom[lev-1], geom[lev],
*physbcs_v[lev-1], BCVars::yvel_bc,
*physbcs_v[lev ], BCVars::yvel_bc,
refRatio(lev-1), mapper, domain_bcs_type, bccomp);

// Impose physical bc's on coarse data (note time and 0 are not used)
(*physbcs_v[lev-1])(vars_old[lev-1][Vars::yvel],0,1,ngvect,time,BCVars::yvel_bc);
(*physbcs_v[lev-1])(vars_new[lev-1][Vars::yvel],0,1,ngvect,time,BCVars::yvel_bc);

// Call FillPatch which ASSUMES that all ghost cells have already been filled
FillPatchTwoLevels(mf, ngvect, IntVect(0,0,0),
time, cmf, ctime, fmf, ftime,
0, 0, 1, geom[lev-1], geom[lev],
refRatio(lev-1), mapper, domain_bcs_type,
bccomp);

// Impose physical bc's on fine data
(*physbcs_v[lev])(mf,0,1,ngvect,time,BCVars::yvel_bc);

} else if (var_idx == Vars::zvel) {
FillPatchTwoLevels(mf, time, cmf, ctime, fmf, {time},
icomp, icomp, ncomp, geom[lev-1], geom[lev],
*physbcs_w_no_terrain[lev-1], BCVars::zvel_bc,
*physbcs_w_no_terrain[lev ], BCVars::zvel_bc,
refRatio(lev-1), mapper, domain_bcs_type, bccomp);

// Impose physical bc's on coarse data (note time and 0 are not used)
(*physbcs_w[lev-1])(vars_old[lev-1][Vars::zvel],
vars_old[lev-1][Vars::xvel],
vars_old[lev-1][Vars::yvel],
ngvect,time,BCVars::zvel_bc);
(*physbcs_w[lev-1])(vars_new[lev-1][Vars::zvel],
vars_new[lev-1][Vars::xvel],
vars_new[lev-1][Vars::yvel],
ngvect,time,BCVars::zvel_bc);

// Call FillPatch which ASSUMES that all ghost cells have already been filled
FillPatchTwoLevels(mf, ngvect, IntVect(0,0,0),
time, cmf, ctime, fmf, ftime,
0, 0, 1, geom[lev-1], geom[lev],
refRatio(lev-1), mapper, domain_bcs_type,
bccomp);

// Impose physical bc's on fine data
(*physbcs_w[lev])(*mfs_vel[Vars::zvel],*mfs_vel[Vars::xvel],*mfs_vel[Vars::yvel],
ngvect,time,BCVars::zvel_bc);
}
Expand Down
6 changes: 4 additions & 2 deletions Source/ERF_make_new_arrays.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,8 @@ ERF::init_zphys (int lev, Real time)
IntVect(0,0,0), // do not fill ghost cells outside the domain
*z_phys_nd[lev-1], 0, 0, 1,
geom[lev-1], geom[lev],
refRatio(lev-1), &node_bilinear_interp, domain_bcs_type);
refRatio(lev-1), &node_bilinear_interp,
domain_bcs_type, BCVars::cons_bc);

// This recomputes the fine values using the bottom terrain at the fine resolution,
// and also fills values of z_phys_nd outside the domain
Expand Down Expand Up @@ -503,7 +504,8 @@ ERF::remake_zphys (int lev, std::unique_ptr<MultiFab>& temp_zphys_nd)
IntVect(0,0,0), // do not fill ghost cells outside the domain
*z_phys_nd[lev-1], 0, 0, 1,
geom[lev-1], geom[lev],
refRatio(lev-1), &node_bilinear_interp, domain_bcs_type);
refRatio(lev-1), &node_bilinear_interp,
domain_bcs_type, BCVars::cons_bc);

// This recomputes the fine values using the bottom terrain at the fine resolution,
// and also fills values of z_phys_nd outside the domain
Expand Down
3 changes: 2 additions & 1 deletion Source/ERF_make_new_level.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,8 @@ ERF::MakeNewLevelFromCoarse (int lev, Real time, const BoxArray& ba,
IntVect(0,0,0), // do not fill ghost cells outside the domain
base_state[lev-1], 0, 0, 3,
geom[lev-1], geom[lev],
refRatio(lev-1), &cell_cons_interp, domain_bcs_type);
refRatio(lev-1), &cell_cons_interp,
domain_bcs_type, BCVars::cons_bc);

initHSE(lev);

Expand Down
3 changes: 2 additions & 1 deletion Source/Initialization/ERF_init_from_input_sounding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ ERF::init_from_input_sounding (int lev)
IntVect(0,0,0), // do not fill ghost cells outside the domain
base_state[lev-1], 0, 0, 3,
geom[lev-1], geom[lev],
refRatio(lev-1), &cell_cons_interp, domain_bcs_type);
refRatio(lev-1), &cell_cons_interp,
domain_bcs_type, BCVars::cons_bc);
}
}

Expand Down
2 changes: 2 additions & 0 deletions Source/Radiation/ERF_Radiation.H
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ class Radiation {
std::string moisture_type = "None";
bool has_qmoist;

amrex::Vector<int> rank_offsets;

// Specified uniform angle for radiation
amrex::Real uniform_angle = 78.463;

Expand Down
Loading

0 comments on commit 1eba85a

Please sign in to comment.