Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
huiyuxie committed Oct 14, 2024
1 parent cdd552f commit e1abd95
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 34 deletions.
7 changes: 3 additions & 4 deletions src/equations/compressible_euler_multicomponent_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,9 @@ function initial_condition_convergence_test(x, t,
rho = ini

# Here we compute an arbitrary number of different rhos. (one rho is double the next rho while the sum of all rhos is 1)
prim_rho = SVector{ncomponents(equations), real(equations)}(2^(i - 1) * (1 - 2) /
(1 -
2^ncomponents(equations)) *
rho
prim_rho = SVector{ncomponents(equations), real(equations)}(2^(i - 1) * (1 - 2) *
rho / (1 -
2^ncomponents(equations))
for i in eachcomponent(equations))

prim1 = rho * v1
Expand Down
14 changes: 6 additions & 8 deletions src/equations/compressible_euler_multicomponent_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,9 @@ function initial_condition_convergence_test(x, t,
rho = ini

# Here we compute an arbitrary number of different rhos. (one rho is double the next rho while the sum of all rhos is 1)
prim_rho = SVector{ncomponents(equations), real(equations)}(2^(i - 1) * (1 - 2) /
(1 -
2^ncomponents(equations)) *
rho
prim_rho = SVector{ncomponents(equations), real(equations)}(2^(i - 1) * (1 - 2) *
rho / (1 -
2^ncomponents(equations))
for i in eachcomponent(equations))

prim1 = rho * v1
Expand Down Expand Up @@ -185,10 +184,9 @@ Source terms used for convergence tests in combination with
tmp6 = tmp2 + c

# Here we compute an arbitrary number of different rhos. (one rho is double the next rho while the sum of all rhos is 1
du_rho = SVector{ncomponents(equations), real(equations)}(2^(i - 1) * (1 - 2) /
(1 -
2^ncomponents(equations)) *
tmp1
du_rho = SVector{ncomponents(equations), real(equations)}(2^(i - 1) * (1 - 2) *
tmp1 / (1 -
2^ncomponents(equations))
for i in eachcomponent(equations))

du1 = tmp5
Expand Down
21 changes: 10 additions & 11 deletions src/equations/ideal_glm_mhd_multicomponent_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,10 @@ function initial_condition_convergence_test(x, t,
# domain must be set to [0, 1], γ = 5/3

RealT = eltype(x)
rho = 1
prim_rho = SVector{ncomponents(equations), real(equations)}(2^(i - 1) * (1 - 2) /
(1 -
2^ncomponents(equations)) *
rho
rho = one(RealT)
prim_rho = SVector{ncomponents(equations), real(equations)}(2^(i - 1) * (1 - 2) *
rho / (1 -
2^ncomponents(equations))
for i in eachcomponent(equations))
v1 = 0
# TODO: sincospi
Expand Down Expand Up @@ -132,16 +131,16 @@ function initial_condition_weak_blast_wave(x, t,
if r > 0.5f0
rho = one(RealT)
prim_rho = SVector{ncomponents(equations), real(equations)}(2^(i - 1) *
(1 - 2) / (1 -
2^ncomponents(equations)) *
rho
(1 - 2) * rho /
(1 -
2^ncomponents(equations))
for i in eachcomponent(equations))
else
rho = convert(RealT, 1.1691)
prim_rho = SVector{ncomponents(equations), real(equations)}(2^(i - 1) *
(1 - 2) / (1 -
2^ncomponents(equations)) *
rho
(1 - 2) * rho /
(1 -
2^ncomponents(equations))
for i in eachcomponent(equations))
end
v1 = r > 0.5f0 ? zero(RealT) : convert(RealT, 0.1882) * cos(phi)
Expand Down
20 changes: 9 additions & 11 deletions src/equations/ideal_glm_mhd_multicomponent_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,10 @@ function initial_condition_convergence_test(x, t,
alpha = 0.25f0 * convert(RealT, pi)
x_perp = x[1] * cos(alpha) + x[2] * sin(alpha)
B_perp = convert(RealT, 0.1) * sinpi(2 * x_perp)
rho = 1
prim_rho = SVector{ncomponents(equations), real(equations)}(2^(i - 1) * (1 - 2) /
(1 -
2^ncomponents(equations)) *
rho
rho = one(RealT)
prim_rho = SVector{ncomponents(equations), real(equations)}(2^(i - 1) * (1 - 2) *
rho / (1 -
2^ncomponents(equations))
for i in eachcomponent(equations))

v1 = -B_perp * sin(alpha)
Expand Down Expand Up @@ -157,13 +156,12 @@ function initial_condition_weak_blast_wave(x, t,

prim_rho = SVector{ncomponents(equations), real(equations)}(r > 0.5f0 ?
2^(i - 1) * (1 - 2) /
(RealT(1) -
2^ncomponents(equations)) :
2^(i - 1) * (1 - 2) *
RealT(1.1691) /
(1 -
2^ncomponents(equations)) *
one(RealT) :
2^(i - 1) * (1 - 2) /
(1 -
2^ncomponents(equations)) *
convert(RealT, 1.1691)
2^ncomponents(equations))
for i in eachcomponent(equations))

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

0 comments on commit e1abd95

Please sign in to comment.