Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type stability of self-defined functions from examples #2122

Merged
merged 2 commits into from
Oct 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading