From 41df28657c176f9fd0168de8ebc23db77df5acae Mon Sep 17 00:00:00 2001 From: Florian Atteneder <florian.atteneder@uni-jena.de> Date: Wed, 25 Sep 2024 08:11:19 +0000 Subject: [PATCH] GRHD: More parameters for convex hull limiter (https://git.tpi.uni-jena.de/dg/dg1d.jl/-/merge_requests/227) Follow up to !225 This adds two more parameters to the `GRHD` section: - `limiter_tci_method`: the `TCI` method with which we sense smoothness of the conserved variables - `limiter_tci_threshold`: the threshold value above an indicator value of the `TCI` triggers the limiter --- src/GRHD/GRHD.jl | 13 +++++++++++++ src/GRHD/callbacks.jl | 10 +++++----- src/GRHD/setup.jl | 7 ++++++- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/GRHD/GRHD.jl b/src/GRHD/GRHD.jl index 8fdfe091..9f9ebe1d 100644 --- a/src/GRHD/GRHD.jl +++ b/src/GRHD/GRHD.jl @@ -342,6 +342,19 @@ dg1d.@parameters GRHD begin limiter_tci_log_D = false @check limiter_tci_log_D isa Bool + """ + The TCI method with which the triggering of the limiter is controlled. + """ + limiter_tci_method = "mda" + @check limiter_tci_method in [ "mda" ] + + """ + TCIs provide an indicator value in the range [0,1]. + `limiter_tci_threshold` controls above which which value the limiter should activate. + """ + limiter_tci_threshold = 0.9 + @check 0 < limiter_tci_threshold ≤ 1 + end diff --git a/src/GRHD/callbacks.jl b/src/GRHD/callbacks.jl index 10db122a..593fc651 100644 --- a/src/GRHD/callbacks.jl +++ b/src/GRHD/callbacks.jl @@ -573,7 +573,7 @@ function callback_limiter(env, P::Project{:spherical1d}, mesh::Mesh1d{<:DGElemen broadcast_volume!(impose_atmosphere_spherical1d, P.equation, mesh) - @unpack limiter_tci_log_D, limiter_limit_log_D = P.prms + @unpack limiter_tci_log_D, limiter_limit_log_D, limiter_tci, limiter_tci_threshold = P.prms if limiter_tci_log_D || limiter_limit_log_D @. log_D = log(D) @@ -582,13 +582,13 @@ function callback_limiter(env, P::Project{:spherical1d}, mesh::Mesh1d{<:DGElemen K = mesh.tree.dims[1] dg1d.enter(P.prms.workspace) do tmp_flag = dg1d.borrow(P.prms.workspace, length(flag)) - TCI.compute_indicator!(tmp_flag, limiter_tci_log_D ? log_D : D, P.tci) + TCI.compute_indicator!(tmp_flag, limiter_tci_log_D ? log_D : D, limiter_tci) for (i,f) in enumerate(tmp_flag) - flag[i] = f > 0.9 + flag[i] = f > limiter_tci_threshold end - TCI.compute_indicator!(tmp_flag, Sr, P.tci) + TCI.compute_indicator!(tmp_flag, Sr, limiter_tci) for (i,f) in enumerate(tmp_flag) - flag[i] = max(flag[i], f > 0.9) + flag[i] = max(flag[i], f > limiter_tci_threshold) end tmp_flag .= (flag .+ flag[end:-1:1])./2 flag .= tmp_flag diff --git a/src/GRHD/setup.jl b/src/GRHD/setup.jl index 7638364e..973f8434 100644 --- a/src/GRHD/setup.jl +++ b/src/GRHD/setup.jl @@ -43,6 +43,11 @@ function Project(env::Environment, prms) limiter = prms["GRHD"]["limiter"] limiter_limit_log_D = prms["GRHD"]["limiter_limit_log_D"] limiter_tci_log_D = prms["GRHD"]["limiter_tci_log_D"] + limiter_tci_method = prms["GRHD"]["limiter_tci_method"] + limiter_tci_threshold = prms["GRHD"]["limiter_tci_threshold"] + limiter_tci_prms = dg1d.parameters(:TCI) + limiter_tci_prms["method"] = limiter_tci_method + limiter_tci = TCI.make_TCI(env.mesh, limiter_tci_prms) freeze_vars = Symbol.(prms["GRHD"]["freeze_vars"]) fv_numerical_flux = prms["GRHD"]["fv_numerical_flux"] id = prms["GRHD"]["id"] @@ -68,7 +73,7 @@ function Project(env::Environment, prms) c2p_set_atmosphere_on_failure, c2p_enforce_causal_atm, c2p_enforce_atm, av_drag, av_sensor_abslog_D, problem, freeze_vars, V_bspline, invV_bspline, workspace, dt_min_grid_spacing, - limiter, limiter_limit_log_D, limiter_tci_log_D, + limiter, limiter_limit_log_D, limiter_tci_log_D, limiter_tci, limiter_tci_threshold, id, bc, hrsc, fv_numerical_flux) # construct Project -- GitLab