From 1d34de6d5d83ddd6f7865448c973cfdea6db7a77 Mon Sep 17 00:00:00 2001 From: cgilet Date: Thu, 16 May 2024 12:10:56 -0400 Subject: [PATCH] Add runtime option to regrid on restart --- src/incflo.H | 1 + src/setup/init.cpp | 1 + src/utilities/io.cpp | 22 +++++++++++++--------- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/incflo.H b/src/incflo.H index 73891cb5..16061dba 100644 --- a/src/incflo.H +++ b/src/incflo.H @@ -520,6 +520,7 @@ private: std::string m_tag_file; bool m_plotfile_on_restart = false; + bool m_regrid_on_restart = false; amrex::Vector tag_region_lo; amrex::Vector tag_region_hi; diff --git a/src/setup/init.cpp b/src/setup/init.cpp index c0fff1cf..b307df41 100644 --- a/src/setup/init.cpp +++ b/src/setup/init.cpp @@ -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); diff --git a/src/utilities/io.cpp b/src/utilities/io.cpp index e000d203..8b6aee32 100644 --- a/src/utilities/io.cpp +++ b/src/utilities/io.cpp @@ -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); + } } /***************************************************************************