diff --git a/Docs/sphinx_documentation/source/InputsCheckpoint.rst b/Docs/sphinx_documentation/source/InputsCheckpoint.rst index 13bae0e4..d0bb1e50 100644 --- a/Docs/sphinx_documentation/source/InputsCheckpoint.rst +++ b/Docs/sphinx_documentation/source/InputsCheckpoint.rst @@ -5,14 +5,18 @@ Checkpoint/Restart The following inputs must be preceded by "amr" and control checkpoint/restart. -+------------------+-----------------------------------------------------------------------+-------------+-----------+ -| | Description | Type | Default | -+==================+=======================================================================+=============+===========+ -| restart | If present, then the name of file to restart from | String | None | -+------------------+-----------------------------------------------------------------------+-------------+-----------+ -| check_int | Frequency of checkpoint output; | Int | -1 | -| | if -1 then no checkpoints will be written | | | -+------------------+-----------------------------------------------------------------------+-------------+-----------+ -| check_file | Prefix to use for checkpoint output | String | chk | -+------------------+-----------------------------------------------------------------------+-------------+-----------+ ++---------------------+-----------------------------------------------------------------------+-------------+-----------+ +| | Description | Type | Default | ++=====================+=======================================================================+=============+===========+ +| restart | If present, then the name of file to restart from | String | None | ++---------------------+-----------------------------------------------------------------------+-------------+-----------+ +| plotfile_on_restart | Write a plotfile before taking a time step | bool | false | ++---------------------+-----------------------------------------------------------------------+-------------+-----------+ +| regrid_on_restart | Create new grids, including level 0, on restart | bool | false | ++---------------------+-----------------------------------------------------------------------+-------------+-----------+ +| check_int | Frequency of checkpoint output; | Int | -1 | +| | if -1 then no checkpoints will be written | | | ++---------------------+-----------------------------------------------------------------------+-------------+-----------+ +| check_file | Prefix to use for checkpoint output | String | chk | ++---------------------+-----------------------------------------------------------------------+-------------+-----------+ diff --git a/Docs/sphinx_documentation/source/InputsTimeStepping.rst b/Docs/sphinx_documentation/source/InputsTimeStepping.rst index 3fb6c3a2..6c7e8596 100644 --- a/Docs/sphinx_documentation/source/InputsTimeStepping.rst +++ b/Docs/sphinx_documentation/source/InputsTimeStepping.rst @@ -28,6 +28,10 @@ The inputs below must be preceded by "incflo." +----------------------+-----------------------------------------------------------------------+-------------+--------------+ | cfl | CFL constraint (dt < cfl * dx / u) if fixed_dt not > 0 | Real | 0.5 | +----------------------+-----------------------------------------------------------------------+-------------+--------------+ +| dt_change_max | maximum percentage dt can increase | Real | 1.1 | ++----------------------+-----------------------------------------------------------------------+-------------+--------------+ +| init_shrink | reduce the initial time step by this safety factor | Real | 0.1 | ++----------------------+-----------------------------------------------------------------------+-------------+--------------+ Setting the Time Step --------------------- 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/incflo_apply_predictor.cpp b/src/incflo_apply_predictor.cpp index 077a1e22..ca161c24 100644 --- a/src/incflo_apply_predictor.cpp +++ b/src/incflo_apply_predictor.cpp @@ -63,7 +63,7 @@ using namespace amrex; // // vel = u** - dt * grad p / rho^nph // -// It is assumed that the ghost cels of the old data have been filled and +// It is assumed that the ghost cells of the old data have been filled and // the old and new data are the same in valid region. // void incflo::ApplyPredictor (bool incremental_projection) @@ -139,6 +139,7 @@ void incflo::ApplyPredictor (bool incremental_projection) // ************************************************************************************* // Compute explicit viscous term + // Note that for !advect_momentum, this actually computes divtau / rho // ************************************************************************************* if (need_divtau() || use_tensor_correction ) { @@ -160,7 +161,7 @@ void incflo::ApplyPredictor (bool incremental_projection) // ************************************************************************************* bool include_pressure_gradient = !(m_use_mac_phi_in_godunov); compute_vel_forces(GetVecOfPtrs(vel_forces), get_velocity_old_const(), - get_density_old_const(), get_tracer_old_const(), get_tracer_new_const(), + get_density_old_const(), get_tracer_old_const(), get_tracer_old_const(), include_pressure_gradient); compute_MAC_projected_velocities(get_velocity_old_const(), get_density_old_const(), AMREX_D_DECL(GetVecOfPtrs(u_mac), GetVecOfPtrs(v_mac), diff --git a/src/incflo_compute_dt.cpp b/src/incflo_compute_dt.cpp index a07c0277..db3df0a0 100644 --- a/src/incflo_compute_dt.cpp +++ b/src/incflo_compute_dt.cpp @@ -229,7 +229,7 @@ void incflo::ComputeDt (int initialization, bool explicit_diffusion) dt_new = Real(0.5) * m_dt; } - // Don't let the timestep grow by more than 10% per step + // Don't let the timestep grow by more than m_dt_change_max per step // unless the previous time step was unduly shrunk to match m_plot_per_exact Real allowed_change_factor = m_dt_change_max; if( (m_dt > Real(0.0)) && !(m_plot_per_exact > 0 && m_last_plt == m_nstep && m_nstep > 0) ) 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); + } } /***************************************************************************