Skip to content

Commit

Permalink
No need to read/write qmoist to chk file now.
Browse files Browse the repository at this point in the history
  • Loading branch information
AMLattanzi committed Dec 19, 2023
1 parent 252d7e2 commit fdeda76
Showing 1 changed file with 2 additions and 25 deletions.
27 changes: 2 additions & 25 deletions Source/IO/Checkpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,20 +128,8 @@ ERF::WriteCheckpointFile () const
MultiFab::Copy(zvel,vars_new[lev][Vars::zvel],0,0,1,0);
VisMF::Write(zvel, amrex::MultiFabFileFullPrefix(lev, checkpointname, "Level_", "ZFace"));

IntVect ng;
if (solverChoice.moisture_type != MoistureType::None) {
for (int mvar(0); mvar<qmoist[lev].size(); ++mvar) {
// We must read and write qmoist with ghost cells because we don't directly impose BCs on these vars
ng = qmoist[lev][mvar]->nGrowVect();
int nvar = qmoist[lev][mvar]->nComp();
MultiFab moist_vars(grids[lev],dmap[lev],nvar,ng);
MultiFab::Copy(moist_vars,*(qmoist[lev][mvar]),0,0,nvar,ng);
VisMF::Write(moist_vars, amrex::MultiFabFileFullPrefix(lev, checkpointname, "Level_", "MoistVars"));
}
}

// Note that we write the ghost cells of the base state (unlike above)
ng = base_state[lev].nGrowVect();
IntVect ng = base_state[lev].nGrowVect();
MultiFab base(grids[lev],dmap[lev],base_state[lev].nComp(),ng);
MultiFab::Copy(base,base_state[lev],0,0,base.nComp(),ng);
VisMF::Write(base, amrex::MultiFabFileFullPrefix(lev, checkpointname, "Level_", "BaseState"));
Expand Down Expand Up @@ -339,19 +327,8 @@ ERF::ReadCheckpointFile ()
VisMF::Read(zvel, amrex::MultiFabFileFullPrefix(lev, restart_chkfile, "Level_", "ZFace"));
MultiFab::Copy(vars_new[lev][Vars::zvel],zvel,0,0,1,0);

IntVect ng;
if (solverChoice.moisture_type != MoistureType::None) {
for (int mvar(0); mvar<qmoist[lev].size(); ++mvar) {
ng = qmoist[lev][mvar]->nGrowVect();
int nvar = qmoist[lev][mvar]->nComp();
MultiFab moist_vars(grids[lev],dmap[lev],nvar,ng);
VisMF::Read(moist_vars, amrex::MultiFabFileFullPrefix(lev, restart_chkfile, "Level_", "MoistVars"));
MultiFab::Copy(*(qmoist[lev][mvar]),moist_vars,0,0,nvar,ng);
}
}

// Note that we read the ghost cells of the base state (unlike above)
ng = base_state[lev].nGrowVect();
IntVect ng = base_state[lev].nGrowVect();
MultiFab base(grids[lev],dmap[lev],base_state[lev].nComp(),ng);
VisMF::Read(base, amrex::MultiFabFileFullPrefix(lev, restart_chkfile, "Level_", "BaseState"));
MultiFab::Copy(base_state[lev],base,0,0,base.nComp(),ng);
Expand Down

0 comments on commit fdeda76

Please sign in to comment.