Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix issues from last commit #1339

Merged
merged 2 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Source/BoundaryConditions/ERF_FillPatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ ERF::FillPatch (int lev, Real time, const Vector<MultiFab*>& mfs, bool fillset)

#ifdef ERF_USE_NETCDF
// We call this here because it is an ERF routine
if (init_type == "real" && lev==0) fill_from_wrfbdy(mfs,time);
if (init_type == "metgrid" && lev==0) fill_from_metgrid(mfs,time);
if (init_type == "real" && lev==0) fill_from_wrfbdy (mfs,time,false,0,ncomp_cons);
if (init_type == "metgrid" && lev==0) fill_from_metgrid(mfs,time,false,0,ncomp_cons);
#endif

if (m_r2d) fill_from_bndryregs(mfs,time);
Expand Down
4 changes: 2 additions & 2 deletions Source/ERF.H
Original file line number Diff line number Diff line change
Expand Up @@ -302,12 +302,12 @@ public:
#ifdef ERF_USE_NETCDF
void fill_from_wrfbdy (const amrex::Vector<amrex::MultiFab*>& mfs,
amrex::Real time,
bool cons_only = false,
bool cons_only,
int icomp_cons,
int ncomp_cons);
void fill_from_metgrid (const amrex::Vector<amrex::MultiFab*>& mfs,
amrex::Real time,
bool cons_only = false,
bool cons_only,
int icomp_cons,
int ncomp_cons);
#endif
Expand Down
24 changes: 12 additions & 12 deletions Source/IO/NCCheckpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ ERF::WriteNCCheckpointFile () const
// Here we make copies of the MultiFab with no ghost cells
for (int lev = 0; lev <= finest_level; ++lev) {

MultiFab cons(grids[lev],dmap[lev],Cons::NumVars,0);
MultiFab::Copy(cons,vars_new[lev][Vars::cons],0,0,Cons::NumVars,0);
int nc_cons = vars_new[lev][Vars::cons].nComp();
MultiFab cons(grids[lev],dmap[lev],nc_cons,0);
MultiFab::Copy(cons,vars_new[lev][Vars::cons],0,0,nc_cons,0);
WriteNCMultiFab(cons, amrex::MultiFabFileFullPrefix(lev, checkpointname, "Level_", "Cell"));

MultiFab xvel(convert(grids[lev],IntVect(1,0,0)),dmap[lev],1,0);
Expand Down Expand Up @@ -138,8 +139,10 @@ ERF::ReadNCCheckpointFile ()
const std::string nstep_name = "num_istep";
const std::string ntime_name = "num_newtime";

const int nvar = static_cast<int>(ncf.dim(nvar_name).len());
AMREX_ALWAYS_ASSERT(nvar == Cons::NumVars);
const int nvar = static_cast<int>(ncf.dim(nvar_name).len());
const int nc_cons = vars_new[0][Vars::cons].nComp();

AMREX_ALWAYS_ASSERT(nvar == nc_cons);

const int ndt = static_cast<int>(ncf.dim(ndt_name).len());
const int nstep = static_cast<int>(ncf.dim(nstep_name).len());
Expand Down Expand Up @@ -190,14 +193,11 @@ ERF::ReadNCCheckpointFile ()
SetBoxArray(lev, ba);
SetDistributionMap(lev, dm);

// build MultiFab data
int ncomp = Cons::NumVars;

auto& lev_old = vars_old[lev];
auto& lev_new = vars_new[lev];

lev_new[Vars::cons].define(grids[lev], dmap[lev], ncomp, ngrow_state);
lev_old[Vars::cons].define(grids[lev], dmap[lev], ncomp, ngrow_state);
lev_new[Vars::cons].define(grids[lev], dmap[lev], nc_cons, ngrow_state);
lev_old[Vars::cons].define(grids[lev], dmap[lev], nc_cons, ngrow_state);

//!don: get the ghost cells right here
lev_new[Vars::xvel].define(convert(grids[lev], IntVect(1,0,0)), dmap[lev], 1, ngrow_vels);
Expand All @@ -214,9 +214,9 @@ ERF::ReadNCCheckpointFile ()
for (int lev = 0; lev <= finest_level; ++lev)
{

MultiFab cons(grids[lev],dmap[lev],Cons::NumVars,0);
MultiFab cons(grids[lev],dmap[lev],nc_cons,0);
WriteNCMultiFab(cons, amrex::MultiFabFileFullPrefix(lev, restart_chkfile, "Level_", "Cell"));
MultiFab::Copy(vars_new[lev][Vars::cons],cons,0,0,Cons::NumVars,0);
MultiFab::Copy(vars_new[lev][Vars::cons],cons,0,0,nc_cons,0);

MultiFab xvel(convert(grids[lev],IntVect(1,0,0)),dmap[lev],1,0);
WriteNCMultiFab(xvel, amrex::MultiFabFileFullPrefix(lev, restart_chkfile, "Level_", "Cell"));
Expand All @@ -231,7 +231,7 @@ ERF::ReadNCCheckpointFile ()
MultiFab::Copy(vars_new[lev][Vars::zvel],zvel,0,0,1,0);

// Copy from new into old just in case
MultiFab::Copy(vars_old[lev][Vars::cons],vars_new[lev][Vars::cons],0,0,Cons::NumVars,0);
MultiFab::Copy(vars_old[lev][Vars::cons],vars_new[lev][Vars::cons],0,0,nc_cons,0);
MultiFab::Copy(vars_old[lev][Vars::xvel],vars_new[lev][Vars::xvel],0,0,1,0);
MultiFab::Copy(vars_old[lev][Vars::yvel],vars_new[lev][Vars::yvel],0,0,1,0);
MultiFab::Copy(vars_old[lev][Vars::zvel],vars_new[lev][Vars::zvel],0,0,1,0);
Expand Down
9 changes: 5 additions & 4 deletions Source/TimeIntegration/ERF_slow_rhs_post.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ void erf_slow_rhs_post (int level, int finest_level,

int ncomp = S_data[IntVar::cons].nComp();

int start_comp;
int num_comp;

for ( MFIter mfi(S_data[IntVar::cons],TilingIfNotGPU()); mfi.isValid(); ++mfi) {

const Box& tbx = mfi.tilebox();
Expand Down Expand Up @@ -272,8 +275,6 @@ void erf_slow_rhs_post (int level, int finest_level,
vert_adv_type = EfficientAdvType(nrk,ac.dryscal_vert_adv_type);
}

int start_comp;
int num_comp;
if (l_use_deardorff) {
start_comp = RhoKE_comp;
num_comp = 1;
Expand Down Expand Up @@ -393,14 +394,14 @@ void erf_slow_rhs_post (int level, int finest_level,
}
#if defined(ERF_USE_NETCDF)
if (solverChoice.moisture_type != MoistureType::None)
{
// Zero moist RHS in set region
if (moist_zero) {
Box bx_xlo, bx_xhi, bx_ylo, bx_yhi;
compute_interior_ghost_bxs_xy(tbx, domain, width, 0,
bx_xlo, bx_xhi,
bx_ylo, bx_yhi);
int icomp;
icomp = RhoQ1_comp;
int icomp = RhoQ1_comp;
wrfbdy_zero_rhs_in_set_region(icomp, 1, bx_xlo, bx_xhi, bx_ylo, bx_yhi, cell_rhs);
} // moist_zero
} // moisture_type
Expand Down
Loading