Skip to content

Commit

Permalink
Make the maxiumum dt change between time steps a runtime variable. (#100
Browse files Browse the repository at this point in the history
)
  • Loading branch information
cgilet authored May 13, 2024
1 parent 011b26a commit 0a40f11
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/incflo.H
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ private:
amrex::Real m_cfl = amrex::Real(0.5);
amrex::Real m_fixed_dt = amrex::Real(-1.);
amrex::Real m_init_shrink = amrex::Real(0.1);
amrex::Real m_dt_change_max = amrex::Real(1.1);

// Initial projection / iterations
bool m_do_initial_proj = true;
Expand Down
2 changes: 1 addition & 1 deletion src/incflo_compute_dt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ void incflo::ComputeDt (int initialization, bool explicit_diffusion)

// Don't let the timestep grow by more than 10% per step
// unless the previous time step was unduly shrunk to match m_plot_per_exact
Real allowed_change_factor = Real(1.1);
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) )
{
dt_new = amrex::min(dt_new, allowed_change_factor * m_prev_dt);
Expand Down
6 changes: 6 additions & 0 deletions src/setup/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ void incflo::ReadParameters ()
amrex::Abort("We require m_init_shrink <= 1.0");
}

// This limits dt growth per time step
pp.query("dt_change_max", m_dt_change_max);
if ( m_dt_change_max < 1.0 || m_dt_change_max > 1.1 ) {
amrex::Abort("We require 1. < dt_change_max <= 1.1");
}

// Physics
pp.queryarr("delp", m_delp, 0, AMREX_SPACEDIM);
pp.queryarr("gravity", m_gravity, 0, AMREX_SPACEDIM);
Expand Down

0 comments on commit 0a40f11

Please sign in to comment.