From 54237d37f702a5769d7081a802145b3099b0a4ba Mon Sep 17 00:00:00 2001 From: Huiyu Xie Date: Mon, 21 Oct 2024 18:40:46 -1000 Subject: [PATCH] Type stability of self-defined functions from examples (#2122) Co-authored-by: Hendrik Ranocha --- .../elixir_euler_blast_wave_entropy_bounded.jl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/tree_1d_dgsem/elixir_euler_blast_wave_entropy_bounded.jl b/examples/tree_1d_dgsem/elixir_euler_blast_wave_entropy_bounded.jl index fa81defb6ca..1bd589a368f 100644 --- a/examples/tree_1d_dgsem/elixir_euler_blast_wave_entropy_bounded.jl +++ b/examples/tree_1d_dgsem/elixir_euler_blast_wave_entropy_bounded.jl @@ -18,7 +18,8 @@ A medium blast wave taken from function initial_condition_blast_wave(x, t, equations::CompressibleEulerEquations1D) # Modified From Hennemann & Gassner JCP paper 2020 (Sec. 6.3) -> "medium blast wave" # Set up polar coordinates - inicenter = SVector(0.0) + RealT = eltype(x) + inicenter = SVector(0) x_norm = x[1] - inicenter[1] r = abs(x_norm) # The following code is equivalent to @@ -28,9 +29,9 @@ function initial_condition_blast_wave(x, t, equations::CompressibleEulerEquation cos_phi = x_norm > 0 ? one(x_norm) : -one(x_norm) # Calculate primitive variables - rho = r > 0.5 ? 1.0 : 1.1691 - v1 = r > 0.5 ? 0.0 : 0.1882 * cos_phi - p = r > 0.5 ? 1.0E-3 : 1.245 + rho = r > 0.5f0 ? one(RealT) : RealT(1.1691) + v1 = r > 0.5f0 ? zero(RealT) : RealT(0.1882) * cos_phi + p = r > 0.5f0 ? RealT(1.0E-3) : RealT(1.245) return prim2cons(SVector(rho, v1, p), equations) end