Skip to content

Commit

Permalink
Renamed function nnoncons as n_nonconservative_terms
Browse files Browse the repository at this point in the history
  • Loading branch information
amrueda committed Oct 24, 2023
1 parent c7dd7f5 commit 7910993
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
7 changes: 3 additions & 4 deletions src/equations/equations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,10 @@ The return value will be `True()` or `False()` to allow dispatching on the retur
"""
have_nonconservative_terms(::AbstractEquations) = False()
"""
nnoncons(equations)
Number of nonconservative terms for a particular equation. The default is 0 and
it must be defined for each nonconservative equation independently.
n_nonconservative_terms(equations)
Number of nonconservative terms in the form local * symmetric for a particular equation.
"""
nnoncons(::AbstractEquations) = 0
function n_nonconservative_terms(::AbstractEquations) end
have_constant_speed(::AbstractEquations) = False()

default_analysis_errors(::AbstractEquations) = (:l2_error, :linf_error)
Expand Down
2 changes: 1 addition & 1 deletion src/equations/ideal_glm_mhd_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function IdealGlmMhdEquations2D(gamma; initial_c_h = convert(typeof(gamma), NaN)
end

have_nonconservative_terms(::IdealGlmMhdEquations2D) = True()
nnoncons(::IdealGlmMhdEquations2D) = 2
n_nonconservative_terms(::IdealGlmMhdEquations2D) = 2

function varnames(::typeof(cons2cons), ::IdealGlmMhdEquations2D)
("rho", "rho_v1", "rho_v2", "rho_v3", "rho_e", "B1", "B2", "B3", "psi")
Expand Down
18 changes: 9 additions & 9 deletions src/solvers/dgsem_tree/dg_2d_subcell_limiters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@ function create_cache(mesh::TreeMesh{2}, equations,
flux_temp_threaded = A3d[A3d(undef, nvariables(equations), nnodes(dg), nnodes(dg))
for _ in 1:Threads.nthreads()]
flux_nonconservative_temp_threaded = A4d[A4d(undef, nvariables(equations),
nnoncons(equations),
n_nonconservative_terms(equations),
nnodes(dg), nnodes(dg))
for _ in 1:Threads.nthreads()]
fhat_temp_threaded = A3d[A3d(undef, nvariables(equations), nnodes(dg),
nnodes(dg))
for _ in 1:Threads.nthreads()]
fhat_nonconservative_temp_threaded = A4d[A4d(undef, nvariables(equations),
nnoncons(equations),
n_nonconservative_terms(equations),
nnodes(dg), nnodes(dg))
for _ in 1:Threads.nthreads()]

phi_threaded = A4d[A4d(undef, nvariables(equations),
nnoncons(equations),
n_nonconservative_terms(equations),
nnodes(dg), nnodes(dg))
for _ in 1:Threads.nthreads()]

Expand Down Expand Up @@ -253,7 +253,7 @@ end
equations, dg, i, j)
multiply_add_to_node_vars!(flux_temp, derivative_split[ii, i], flux1,
equations, dg, ii, j)
for noncons in 1:nnoncons(equations)
for noncons in 1:n_nonconservative_terms(equations)
# We multiply by 0.5 because that is done in other parts of Trixi
flux1_noncons = volume_flux_noncons(u_node, u_node_ii, 1, equations,
NonConservativeSymmetric(), noncons)
Expand Down Expand Up @@ -281,7 +281,7 @@ end
# Compute local contribution to non-conservative flux
for j in eachnode(dg), i in eachnode(dg)
u_local = get_node_vars(u, equations, dg, i, j, element)
for noncons in 1:nnoncons(equations)
for noncons in 1:n_nonconservative_terms(equations)
set_node_vars!(phi,
volume_flux_noncons(u_local, 1, equations,
NonConservativeLocal(), noncons),
Expand All @@ -298,7 +298,7 @@ end
fhat1_R[v, i + 1, j] = value
end
# Nonconservative part
for noncons in 1:nnoncons(equations), v in eachvariable(equations)
for noncons in 1:n_nonconservative_terms(equations), v in eachvariable(equations)
value = fhat_noncons_temp[v, noncons, i, j] +
weights[i] * flux_noncons_temp[v, noncons, i, j]
fhat_noncons_temp[v, noncons, i + 1, j] = value
Expand All @@ -322,7 +322,7 @@ end
equations, dg, i, j)
multiply_add_to_node_vars!(flux_temp, derivative_split[jj, j], flux2,
equations, dg, i, jj)
for noncons in 1:nnoncons(equations)
for noncons in 1:n_nonconservative_terms(equations)
# We multiply by 0.5 because that is done in other parts of Trixi
flux2_noncons = volume_flux_noncons(u_node, u_node_jj, 2, equations,
NonConservativeSymmetric(), noncons)
Expand Down Expand Up @@ -350,7 +350,7 @@ end
# Compute local contribution to non-conservative flux
for j in eachnode(dg), i in eachnode(dg)
u_local = get_node_vars(u, equations, dg, i, j, element)
for noncons in 1:nnoncons(equations)
for noncons in 1:n_nonconservative_terms(equations)
set_node_vars!(phi,
volume_flux_noncons(u_local, 2, equations,
NonConservativeLocal(), noncons),
Expand All @@ -367,7 +367,7 @@ end
fhat2_R[v, i, j + 1] = value
end
# Nonconservative part
for noncons in 1:nnoncons(equations), v in eachvariable(equations)
for noncons in 1:n_nonconservative_terms(equations), v in eachvariable(equations)
value = fhat_noncons_temp[v, noncons, i, j] +
weights[j] * flux_noncons_temp[v, noncons, i, j]
fhat_noncons_temp[v, noncons, i, j + 1] = value
Expand Down

0 comments on commit 7910993

Please sign in to comment.