Skip to content

Commit

Permalink
abort initial AMR loop after 10 iterations
Browse files Browse the repository at this point in the history
  • Loading branch information
benegee committed Mar 25, 2024
1 parent 18aaae9 commit 9c93540
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 9c93540

Please sign in to comment.