Skip to content

Commit

Permalink
abort initial AMR loop after 10 iterations (#1890)
Browse files Browse the repository at this point in the history
Co-authored-by: Hendrik Ranocha <[email protected]>
  • Loading branch information
benegee and ranocha authored Mar 26, 2024
1 parent d86a0f4 commit cd6fdaa
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/callbacks_step/amr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,18 @@ function initialize!(cb::DiscreteCallback{Condition, Affect!}, u, t,
# iterate until mesh does not change anymore
has_changed = amr_callback(integrator,
only_refine = amr_callback.adapt_initial_condition_only_refine)
iterations = 1
while has_changed
compute_coefficients!(integrator.u, t, semi)
u_modified!(integrator, true)
has_changed = amr_callback(integrator,
only_refine = amr_callback.adapt_initial_condition_only_refine)
iterations = iterations + 1
if iterations > 10
@warn "AMR for initial condition did not settle within 10 iterations!\n" *
"Consider adjusting thresholds or setting `adapt_initial_condition_only_refine`."
break
end
end
end

Expand Down

0 comments on commit cd6fdaa

Please sign in to comment.