Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
bennibolm committed Oct 22, 2023
1 parent 603d0f0 commit 999b856
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 17 deletions.
5 changes: 3 additions & 2 deletions src/callbacks_stage/subcell_bounds_check.jl
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,9 @@ end
idp_bounds_delta[Symbol(string(v), "_min")][2])
end
for variable in limiter.positivity_variables_nonlinear
println("$(variable):\n- positivity: ",
idp_bounds_delta[Symbol("$(variable)_min")])
variable_string = string(variable)
println(variable_string * ":\n- positivity: ",
idp_bounds_delta[Symbol(variable_string, "_min")][2])
end
end
println(""^100 * "\n")
Expand Down
42 changes: 27 additions & 15 deletions src/callbacks_stage/subcell_bounds_check_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,19 @@
end
deviation[2] = max(deviation[2], deviation[1])
end
for variable in limiter.positivity_variables_nonlinear
key = Symbol(string(variable), "_min")
deviation = idp_bounds_delta[key]
for element in eachelement(solver, cache), j in eachnode(solver),
i in eachnode(solver)

var = variable(get_node_vars(u, equations, solver, i, j, element),
equations)
deviation[1] = max(deviation[1],
variable_bounds[key][i, j, element] - var)
end
deviation[2] = max(deviation[2], deviation[1])
end
end
if save_errors
# Print to output file
Expand All @@ -77,24 +90,23 @@
if local_minmax
for v in limiter.local_minmax_variables_cons
v_string = string(v)
key_min = Symbol(v_string, "_min")
key_max = Symbol(v_string, "_max")
print(f, ", ", idp_bounds_delta[key_min][1],
idp_bounds_delta[key_max][1])
print(f, ", ", idp_bounds_delta[Symbol(v_string, "_min")][1],
idp_bounds_delta[Symbol(v_string, "_max")][1])
end
end
if math_entropy
key = :math_entropy_max
print(f, ", ", idp_bounds_delta[key][1])
if spec_entropy
print(f, ", ", idp_bounds_delta[:spec_entropy_min][1])
end
if math_entropy
key = :math_entropy_max
print(f, ", ", idp_bounds_delta[key][1])
print(f, ", ", idp_bounds_delta[:math_entropy_max][1])
end
if positivity
for v in limiter.positivity_variables_cons
key = Symbol(string(v), "_min")
print(f, ", ", idp_bounds_delta[key][1])
print(f, ", ", idp_bounds_delta[Symbol(string(v), "_min")][1])
end
for variable in limiter.positivity_variables_nonlinear
print(f, ", ",
idp_bounds_delta[Symbol(string(variable), "_min")][1])
end
end
println(f)
Expand All @@ -111,10 +123,10 @@ end
@inline function check_bounds(u, mesh::AbstractMesh{2}, equations, solver, cache,
limiter::SubcellLimiterMCL,
time, iter, output_directory, save_errors)
@unpack var_min, var_max = limiter.cache.subcell_limiter_coefficients
@unpack bar_states1, bar_states2, lambda1, lambda2 = limiter.cache.container_bar_states
@unpack idp_bounds_delta = limiter.cache
@unpack antidiffusive_flux1, antidiffusive_flux2 = cache.antidiffusive_fluxes
(; var_min, var_max) = limiter.cache.subcell_limiter_coefficients
(; bar_states1, bar_states2, lambda1, lambda2) = limiter.cache.container_bar_states
(; idp_bounds_delta) = limiter.cache
(; antidiffusive_flux1, antidiffusive_flux2) = cache.antidiffusive_fluxes

# TODO: Revise Bounds Check for MCL

Expand Down

0 comments on commit 999b856

Please sign in to comment.