Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
huiyuxie committed Oct 10, 2024
1 parent e69cfab commit 40b4095
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 44 deletions.
31 changes: 9 additions & 22 deletions src/equations/compressible_euler_multicomponent_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -202,28 +202,15 @@ function initial_condition_weak_blast_wave(x, t,
r = abs(x_norm)
cos_phi = x_norm > 0 ? 1 : -1

# Hardcode to `Float32` and `Float64`` for GPU compatibility
if RealT == Float32
prim_rho = SVector{ncomponents(equations), RealT}(r > 0.5f0 ?
2^(i - 1) * (1.0f0 - 2) /
(1 -
2^ncomponents(equations)) :
2^(i - 1) * (1.0f0 - 2) /
(1 -
2^ncomponents(equations)) *
Float32(1.1691)
for i in eachcomponent(equations))
elseif RealT == Float64
prim_rho = SVector{ncomponents(equations), RealT}(r > 0.5 ?
2^(i - 1) * (1 - 2) /
(1 -
2^ncomponents(equations)) :
2^(i - 1) * (1 - 2) /
(1 -
2^ncomponents(equations)) *
1.1691
for i in eachcomponent(equations))
end
prim_rho = SVector{ncomponents(equations), real(equations)}(r > 0.5f0 ?
2^(i - 1) * (1 - 2) /
(1.0f0 -
2^ncomponents(equations)) :
2^(i - 1) * (1 - 2) /
(1.0f0 -
2^ncomponents(equations)) *
RealT(1.1691)
for i in eachcomponent(equations))

v1 = r > 0.5f0 ? zero(RealT) : convert(RealT, 0.1882) * cos_phi
p = r > 0.5f0 ? one(RealT) : convert(RealT, 1.245)
Expand Down
31 changes: 9 additions & 22 deletions src/equations/compressible_euler_multicomponent_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -220,28 +220,15 @@ function initial_condition_weak_blast_wave(x, t,
phi = atan(y_norm, x_norm)
sin_phi, cos_phi = sincos(phi)

# Hardcode to `Float32` and `Float64`` for GPU compatibility
if RealT == Float32
prim_rho = SVector{ncomponents(equations), RealT}(r > 0.5f0 ?
2^(i - 1) * (1.0f0 - 2) /
(1 -
2^ncomponents(equations)) :
2^(i - 1) * (1.0f0 - 2) /
(1 -
2^ncomponents(equations)) *
Float32(1.1691)
for i in eachcomponent(equations))
elseif RealT == Float64
prim_rho = SVector{ncomponents(equations), RealT}(r > 0.5 ?
2^(i - 1) * (1 - 2) /
(1 -
2^ncomponents(equations)) :
2^(i - 1) * (1 - 2) /
(1 -
2^ncomponents(equations)) *
1.1691
for i in eachcomponent(equations))
end
prim_rho = SVector{ncomponents(equations), real(equations)}(r > 0.5f0 ?
2^(i - 1) * (1 - 2) /
(1.0f0 -
2^ncomponents(equations)) :
2^(i - 1) * (1 - 2) /
(1.0f0 -
2^ncomponents(equations)) *
RealT(1.1691)
for i in eachcomponent(equations))

v1 = r > 0.5f0 ? zero(RealT) : convert(RealT, 0.1882) * cos_phi
v2 = r > 0.5f0 ? zero(RealT) : convert(RealT, 0.1882) * sin_phi
Expand Down

0 comments on commit 40b4095

Please sign in to comment.