Skip to content

Commit 54237d3

Browse files
huiyuxieranocha
andauthored
Type stability of self-defined functions from examples (trixi-framework#2122)
Co-authored-by: Hendrik Ranocha <[email protected]>
1 parent a8967c6 commit 54237d3

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

examples/tree_1d_dgsem/elixir_euler_blast_wave_entropy_bounded.jl

+5-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ A medium blast wave taken from
1818
function initial_condition_blast_wave(x, t, equations::CompressibleEulerEquations1D)
1919
# Modified From Hennemann & Gassner JCP paper 2020 (Sec. 6.3) -> "medium blast wave"
2020
# Set up polar coordinates
21-
inicenter = SVector(0.0)
21+
RealT = eltype(x)
22+
inicenter = SVector(0)
2223
x_norm = x[1] - inicenter[1]
2324
r = abs(x_norm)
2425
# The following code is equivalent to
@@ -28,9 +29,9 @@ function initial_condition_blast_wave(x, t, equations::CompressibleEulerEquation
2829
cos_phi = x_norm > 0 ? one(x_norm) : -one(x_norm)
2930

3031
# Calculate primitive variables
31-
rho = r > 0.5 ? 1.0 : 1.1691
32-
v1 = r > 0.5 ? 0.0 : 0.1882 * cos_phi
33-
p = r > 0.5 ? 1.0E-3 : 1.245
32+
rho = r > 0.5f0 ? one(RealT) : RealT(1.1691)
33+
v1 = r > 0.5f0 ? zero(RealT) : RealT(0.1882) * cos_phi
34+
p = r > 0.5f0 ? RealT(1.0E-3) : RealT(1.245)
3435

3536
return prim2cons(SVector(rho, v1, p), equations)
3637
end

0 commit comments

Comments
 (0)