Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent infinite loop in initial AMR #1890

Merged
merged 2 commits into from
Mar 26, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
ranocha marked this conversation as resolved.
Show resolved Hide resolved
@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
Loading