Skip to content

Commit fbfc60b

Browse files
committed
re-add naive version
1 parent aeaae41 commit fbfc60b

File tree

3 files changed

+27
-6
lines changed

3 files changed

+27
-6
lines changed

src/equations/covariant_advection.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ end
110110
end
111111

112112
# Maximum contravariant wave speed with respect to specific basis vector
113-
@inline function Trixi.max_abs_speed_naive(u_ll, u_rr, aux_vars_ll, aux_vars_rr,
114-
orientation::Integer,
115-
equations::CovariantLinearAdvectionEquation2D)
113+
@inline function Trixi.max_abs_speed(u_ll, u_rr, aux_vars_ll, aux_vars_rr,
114+
orientation::Integer,
115+
equations::CovariantLinearAdvectionEquation2D)
116116
vcon_ll = velocity_contravariant(u_ll, equations) # Contravariant components on left side
117117
vcon_rr = velocity_contravariant(u_rr, equations) # Contravariant components on right side
118118
return max(abs(vcon_ll[orientation]), abs(vcon_rr[orientation]))

src/equations/covariant_shallow_water.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,9 @@ end
217217
end
218218

219219
# Maximum wave speed along the normal direction in reference space
220-
@inline function Trixi.max_abs_speed_naive(u_ll, u_rr, aux_vars_ll, aux_vars_rr,
221-
orientation,
222-
equations::AbstractCovariantShallowWaterEquations2D)
220+
@inline function Trixi.max_abs_speed(u_ll, u_rr, aux_vars_ll, aux_vars_rr,
221+
orientation,
222+
equations::AbstractCovariantShallowWaterEquations2D)
223223
# Geometric variables
224224
Gcon_ll = metric_contravariant(aux_vars_ll, equations)
225225
Gcon_rr = metric_contravariant(aux_vars_rr, equations)

src/equations/shallow_water_3d.jl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,27 @@ function clean_solution_lagrange_multiplier!(u, equations::ShallowWaterEquations
386386
u[4] -= normal_direction[3] * x_dot_div_f
387387
end
388388

389+
@inline function Trixi.max_abs_speed_naive(u_ll, u_rr, normal_direction::AbstractVector,
390+
equations::ShallowWaterEquations3D)
391+
# Extract and compute the velocities in the normal direction
392+
v1_ll, v2_ll, v3_ll = velocity(u_ll, equations)
393+
v1_rr, v2_rr, v3_rr = velocity(u_rr, equations)
394+
v_ll = v1_ll * normal_direction[1] + v2_ll * normal_direction[2] +
395+
v3_ll * normal_direction[3]
396+
v_rr = v1_rr * normal_direction[1] + v2_rr * normal_direction[2] +
397+
v3_rr * normal_direction[3]
398+
399+
# Compute the wave celerity on the left and right
400+
h_ll = waterheight(u_ll, equations)
401+
h_rr = waterheight(u_rr, equations)
402+
403+
c_ll = sqrt(max(equations.gravity * h_ll, 0.0f0))
404+
c_rr = sqrt(max(equations.gravity * h_rr, 0.0f0))
405+
406+
# The normal velocities are already scaled by the norm
407+
return max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr) * norm(normal_direction)
408+
end
409+
389410
@inline function Trixi.max_abs_speed(u_ll, u_rr, normal_direction::AbstractVector,
390411
equations::ShallowWaterEquations3D)
391412
# Extract and compute the velocities in the normal direction

0 commit comments

Comments
 (0)