Skip to content

Commit

Permalink
Update src/equations/compressible_euler_quasi_1d.jl
Browse files Browse the repository at this point in the history
Co-authored-by: Jesse Chan <[email protected]>
  • Loading branch information
KrisshChawla and jlchan authored Nov 25, 2023
1 parent 582078a commit 8190208
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/equations/compressible_euler_quasi_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -325,16 +325,24 @@ end
return cons2prim(SVector(a_rho, a_rho_v1, a_e) / a, CompressibleEulerEquations1D(equations.gamma))
end

# Convert conservative variables to entropy
@inline function cons2entropy(u, equations::CompressibleEulerEquationsQuasi1D)
# The entropy for the quasi-1D compressible Euler equations is the entropy for the
# 1D compressible Euler equations scaled by the channel width `a`.
@inline function entropy(u, equations::CompressibleEulerEquationsQuasi1D)
a_rho, a_rho_v1, a_e, a = u
q = cons2entropy(u, CompressibleEulerEquations1D(equations.gamma))

w1 = q[1] - log(a)
w2 = q[2]
w3 = q[3]
return a * entropy(SVector(a_rho, a_rho_v1, a_e) / a, CompressibleEulerEquations1D(equations.gamma))
end

return SVector(w1, w2, w3, a)
# Convert conservative variables to entropy. The entropy variables for the
# quasi-1D compressible Euler equations are identical to the entropy variables
# for the standard Euler equations for an appropriate definition of `entropy`.
@inline function cons2entropy(u, equations::CompressibleEulerEquationsQuasi1D)
a_rho, a_rho_v1, a_e, a = u
w = cons2entropy(SVector(a_rho, a_rho_v1, a_e) / a, CompressibleEulerEquations1D(equations.gamma))

# we follow the convention for other spatially-varying equations such as
# `ShallowWaterEquations1D` and return the spatially varying coefficient
# `a` as the final entropy variable.
return SVector(w[1], w[2], w[3], a)
end

# Convert primitive to conservative variables
Expand Down

0 comments on commit 8190208

Please sign in to comment.