[1D] Reset timestep after grid refinement
This addresses a performance issue where many failed timesteps would be taken after adding new grid points. These failed timesteps are slow because they require additional Jacobian re-evaluations. It is more efficient to preemptively reduce the time step after adding new grid points. Resolves Issue 155.
This commit is contained in:
parent
255896715c
commit
2326b07c68
1 changed files with 5 additions and 0 deletions
|
|
@ -365,6 +365,11 @@ void Sim1D::solve(int loglevel, bool refine_grid)
|
|||
|
||||
if (refine_grid) {
|
||||
new_points = refine(loglevel);
|
||||
if (new_points) {
|
||||
// If the grid has changed, preemptively reduce the timestep
|
||||
// to avoid multiple successive failed time steps.
|
||||
dt = m_tstep;
|
||||
}
|
||||
if (new_points && loglevel > 6) {
|
||||
save("debug_sim1d.xml", "debug", "After regridding");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue