Skip to content
Snippets Groups Projects
Commit 54071f65 authored by Florian Atteneder's avatar Florian Atteneder
Browse files

GRHD: add toggle to allow AV to sense based on the log10 of the variable...

GRHD: add toggle to allow AV to sense based on the log10 of the variable (!190)

Adds a new parameter to the `GRHD` section:
- `av_sensor_logabs_D`: If `true` apply the AV sensor to `log(|D|)`, otherwise use `D`, where `D` is the state variable for the rest-mass density (including the volume factor).
parent 22ea568b
No related branches found
No related tags found
1 merge request!190GRHD: add toggle to allow AV to sense based on the log10 of the variable
Pipeline #7051 passed
......@@ -132,6 +132,13 @@ dg1d.@parameters GRHD begin
av_drag = 0.0
@check 0.0 <= av_drag <= 1.0
"""
If `true` apply the AV sensor to `log(|D|)`, otherwise use `D`,
where `D` is the state variable for the rest-mass density (including the volume factor).
"""
av_sensor_abslog_D = false
@check av_mda_abslog_D isa Bool
"""
For testing purposes.
"""
......
......@@ -331,24 +331,26 @@ function compute_hrsc(P, equation, mesh, hrsc::HRSC.AbstractArtificialViscosity)
@unpack max_v, v, ρ, ϵ, v, p, r = get_static_variables(mesh)
@unpack mu, tmp_mu, cellmax_v = get_cell_variables(mesh)
@unpack t, tm1 = get_global_variables(mesh)
@unpack av_sensor_abslog_D = P.prms
@unpack av_u = get_static_variables(mesh)
if formulation(P) === :doublecartoon
@unpack rD = get_dynamic_variables(mesh)
@unpack abslog_rD = get_static_variables(mesh)
@. abslog_rD = log10.(abs.(rD))
if av_sensor_abslog_D
@. av_u = log10(abs(rD))
else
@. av_u = rD
end
fill!(tmp_mu, 0.0)
HRSC.compute_viscosity!(
mu, tmp_mu,
(abslog_rD,), cellmax_v,
hrsc)
HRSC.compute_viscosity!(mu, av_u, cellmax_v, hrsc)
elseif formulation(P) === :spherical1d
@unpack D = get_dynamic_variables(mesh)
@unpack abslog_D = get_static_variables(mesh)
@. abslog_D = log10.(abs.(D))
if av_sensor_abslog_D
@. av_u = log10(abs(D))
else
@. av_u = D
end
fill!(tmp_mu, 0.0)
HRSC.compute_viscosity!(
mu, tmp_mu,
(abslog_D,), cellmax_v,
hrsc)
HRSC.compute_viscosity!(mu, av_u, cellmax_v, hrsc)
else
TODO(formulation(P))
end
......
......@@ -27,6 +27,7 @@ function Project(env::Environment, prms)
end
av_drag = prms["GRHD"]["av_drag"]
av_sensor_abslog_D = Bool(prms["GRHD"]["av_sensor_abslog_D"])
slope_limiter_method = Symbol(prms["GRHD"]["slope_limiter_method"])
slope_limiter_tvb_M = prms["GRHD"]["slope_limiter_tvb_M"]
c2p_dynamic_atm = prms["GRHD"]["c2p_dynamic_atm"]
......@@ -46,7 +47,7 @@ function Project(env::Environment, prms)
bernstein, slope_limiter_method, slope_limiter_tvb_M,
c2p_dynamic_atm, atm_evolve,
c2p_set_atmosphere_on_failure, c2p_enforce_causal_atm, c2p_enforce_atm,
av_drag, problem, freeze_vars,
av_drag, av_sensor_abslog_D, problem, freeze_vars,
id, bc, hrsc, fv_numerical_flux)
# construct Project
......@@ -509,7 +510,7 @@ end
function register_hrsc!(mesh, P::Project{:valencia1d}, hrsc::HRSC.AbstractArtificialViscosity)
register_variables!(mesh,
static_variablenames = (:ldg_rD, :ldg_rSr, :ldg_rτ,
:abslog_D, :abslog_τ),
:av_u),
bdry_variablenames = (:bdry_ldg_rD, :bdry_ldg_rSr, :bdry_ldg_rτ,
:bdry_smoothed_mu,
:bdry_rhs_rD, :bdry_rhs_rSr, :bdry_rhs_rτ),
......@@ -525,7 +526,7 @@ end
function register_hrsc!(mesh, P::Project{:spherical1d}, hrsc::HRSC.AbstractArtificialViscosity)
register_variables!(mesh,
static_variablenames = (:ldg_D, :ldg_Sr, :ldg_τ,
:abslog_D, :abslog_τ),
:av_u),
bdry_variablenames = (:bdry_ldg_D, :bdry_ldg_Sr, :bdry_ldg_τ,
:bdry_smoothed_mu,
:bdry_rhs_D, :bdry_rhs_Sr, :bdry_rhs_τ),
......@@ -541,7 +542,7 @@ end
function register_hrsc!(mesh, P::Project{:doublecartoon}, hrsc::HRSC.AbstractArtificialViscosity)
register_variables!(mesh,
static_variablenames = (:ldg_rD, :ldg_rSx, :ldg_rτ,
:abslog_rD),
:av_u),
bdry_variablenames = (:bdry_ldg_rD, :bdry_ldg_rSx, :bdry_ldg_rτ,
:bdry_smoothed_mu,
:bdry_rhs_rD, :bdry_rhs_rSx, :bdry_rhs_rτ),
......
......@@ -10,6 +10,7 @@ variables0d_analyze_error = ["ρ", "D"]
variables1d_analyze_error = ["ρ", "D"]
analyze_error_reference_solution = "bondi_accretion"
c2p_enforce_causal_atm = false
av_sensor_abslog_D = true
[Mesh]
range = [ 1.8, 20.0 ]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment