Skip to content

Commit

Permalink
implement max_abs_speed_naive
Browse files Browse the repository at this point in the history
  • Loading branch information
benegee committed Feb 26, 2024
1 parent 393e69e commit ce6b975
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/equations/compressible_euler_multicomponent_abstract_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,36 @@ end
λ_max = max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr)
end

@inline function max_abs_speed_naive(u_ll, u_rr, normal_direction::AbstractVector,
equations::AbstractCompressibleEulerMulticomponentEquations{2})

rho_v1_ll, rho_v2_ll = u_ll
rho_v1_rr, rho_v2_rr = u_rr

# Get the density and gas gamma
rho_ll = density(u_ll, equations)
rho_rr = density(u_rr, equations)
gamma_ll = totalgamma(u_ll, equations)
gamma_rr = totalgamma(u_rr, equations)

# Calculate normal velocities and sound speed
v1_ll = rho_v1_ll / rho_ll
v2_ll = rho_v2_ll / rho_ll
v1_rr = rho_v1_rr / rho_rr
v2_rr = rho_v2_rr / rho_rr

v_ll = (v1_ll * normal_direction[1] + v2_ll * normal_direction[2])
v_rr = (v1_rr * normal_direction[1] + v2_rr * normal_direction[2])

# Compute the sound speeds on the left and right
p_ll = pressure(u_ll, equations)
c_ll = sqrt(gamma_ll * p_ll / rho_ll)
p_rr = pressure(u_rr, equations)
c_rr = sqrt(gamma_rr * p_rr / rho_rr)

λ_max = max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr)
end

@inline function max_abs_speeds(u,
equations::AbstractCompressibleEulerMulticomponentEquations{2})
rho_v1, rho_v2 = u
Expand Down

0 comments on commit ce6b975

Please sign in to comment.