Skip to content

Commit

Permalink
Add runtime option to regrid on restart
Browse files Browse the repository at this point in the history
  • Loading branch information
cgilet committed May 16, 2024
1 parent 0a40f11 commit 1d34de6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/incflo.H
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ private:
std::string m_tag_file;

bool m_plotfile_on_restart = false;
bool m_regrid_on_restart = false;

amrex::Vector<amrex::Real> tag_region_lo;
amrex::Vector<amrex::Real> tag_region_hi;
Expand Down
1 change: 1 addition & 0 deletions src/setup/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ void incflo::ReadIOParameters()
pp.query("restart", m_restart_file);

pp.query("plotfile_on_restart", m_plotfile_on_restart);
pp.query("regrid_on_restart", m_regrid_on_restart);

pp.query("plot_file", m_plot_file);
pp.query("plot_int" , m_plot_int);
Expand Down
22 changes: 13 additions & 9 deletions src/utilities/io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,17 +188,21 @@ void incflo::ReadCheckpointFile()
Geom(lev).isPeriodic()));
}

for(int lev = 0; lev <= finest_level; ++lev)
{
// read in level 'lev' BoxArray from Header
BoxArray ba;
ba.readFrom(is);
GotoNextLine(is);
if ( m_regrid_on_restart ) {
MakeNewGrids(m_cur_time);
} else {
for(int lev = 0; lev <= finest_level; ++lev)
{
// read in level 'lev' BoxArray from Header
BoxArray ba;
ba.readFrom(is);
GotoNextLine(is);

// Create distribution mapping
DistributionMapping dm{ba, ParallelDescriptor::NProcs()};
// Create distribution mapping
DistributionMapping dm{ba, ParallelDescriptor::NProcs()};

MakeNewLevelFromScratch(lev, m_cur_time, ba, dm);
MakeNewLevelFromScratch(lev, m_cur_time, ba, dm);
}
}

/***************************************************************************
Expand Down

0 comments on commit 1d34de6

Please sign in to comment.