Skip to content

Commit

Permalink
Make rain accumulation work with restart (#1526)
Browse files Browse the repository at this point in the history
Co-authored-by: Mahesh Natarajan <[email protected]>
  • Loading branch information
nataraj2 and Mahesh Natarajan authored Mar 23, 2024
1 parent 45bdcfe commit 513861d
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Source/IO/Checkpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,16 @@ ERF::WriteCheckpointFile () const
VisMF::Write(z_height, MultiFabFileFullPrefix(lev, checkpointname, "Level_", "Z_Phys_nd"));
}

// We must read and write qmoist with ghost cells because we don't directly impose BCs on these vars
// Write the precipitation accumulation component only
if (solverChoice.moisture_type == MoistureType::Kessler) {
ng = qmoist[lev][0]->nGrowVect();
int nvar = 1;
MultiFab moist_vars(grids[lev],dmap[lev],nvar,ng);
MultiFab::Copy(moist_vars,*(qmoist[lev][0]),0,0,nvar,ng);
VisMF::Write(moist_vars, amrex::MultiFabFileFullPrefix(lev, checkpointname, "Level_", "MoistVars"));
}

if (solverChoice.lsm_type != LandSurfaceType::None) {
for (int mvar(0); mvar<lsm_data[lev].size(); ++mvar) {
BoxArray ba = lsm_data[lev][mvar]->boxArray();
Expand Down Expand Up @@ -356,6 +366,15 @@ ERF::ReadCheckpointFile ()
update_terrain_arrays(lev, t_new[lev]);
}

// Read in the precipitation accumulation component
if (solverChoice.moisture_type == MoistureType::Kessler) {
ng = qmoist[lev][0]->nGrowVect();
int nvar = 1;
MultiFab moist_vars(grids[lev],dmap[lev],nvar,ng);
VisMF::Read(moist_vars, amrex::MultiFabFileFullPrefix(lev, restart_chkfile, "Level_", "MoistVars"));
MultiFab::Copy(*(qmoist[lev][0]),moist_vars,0,0,nvar,ng);
}

if (solverChoice.lsm_type != LandSurfaceType::None) {
for (int mvar(0); mvar<lsm_data[lev].size(); ++mvar) {
BoxArray ba = lsm_data[lev][mvar]->boxArray();
Expand Down

0 comments on commit 513861d

Please sign in to comment.