Skip to content

Commit f3e8878

Browse files
authored
Fix (#2112)
1 parent 362f7bd commit f3e8878

File tree

4 files changed

+28
-34
lines changed

4 files changed

+28
-34
lines changed

src/equations/compressible_euler_multicomponent_1d.jl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,9 @@ function initial_condition_convergence_test(x, t,
136136
rho = ini
137137

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

145144
prim1 = rho * v1

src/equations/compressible_euler_multicomponent_2d.jl

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,9 @@ function initial_condition_convergence_test(x, t,
141141
rho = ini
142142

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

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

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

194192
du1 = tmp5

src/equations/ideal_glm_mhd_multicomponent_1d.jl

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,10 @@ function initial_condition_convergence_test(x, t,
8989
# domain must be set to [0, 1], γ = 5/3
9090

9191
RealT = eltype(x)
92-
rho = 1
93-
prim_rho = SVector{ncomponents(equations), real(equations)}(2^(i - 1) * (1 - 2) /
94-
(1 -
95-
2^ncomponents(equations)) *
96-
rho
92+
rho = one(RealT)
93+
prim_rho = SVector{ncomponents(equations), real(equations)}(2^(i - 1) * (1 - 2) *
94+
rho / (1 -
95+
2^ncomponents(equations))
9796
for i in eachcomponent(equations))
9897
v1 = 0
9998
# TODO: sincospi
@@ -132,16 +131,16 @@ function initial_condition_weak_blast_wave(x, t,
132131
if r > 0.5f0
133132
rho = one(RealT)
134133
prim_rho = SVector{ncomponents(equations), real(equations)}(2^(i - 1) *
135-
(1 - 2) / (1 -
136-
2^ncomponents(equations)) *
137-
rho
134+
(1 - 2) * rho /
135+
(1 -
136+
2^ncomponents(equations))
138137
for i in eachcomponent(equations))
139138
else
140139
rho = convert(RealT, 1.1691)
141140
prim_rho = SVector{ncomponents(equations), real(equations)}(2^(i - 1) *
142-
(1 - 2) / (1 -
143-
2^ncomponents(equations)) *
144-
rho
141+
(1 - 2) * rho /
142+
(1 -
143+
2^ncomponents(equations))
145144
for i in eachcomponent(equations))
146145
end
147146
v1 = r > 0.5f0 ? zero(RealT) : convert(RealT, 0.1882) * cos(phi)

src/equations/ideal_glm_mhd_multicomponent_2d.jl

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,10 @@ function initial_condition_convergence_test(x, t,
114114
alpha = 0.25f0 * convert(RealT, pi)
115115
x_perp = x[1] * cos(alpha) + x[2] * sin(alpha)
116116
B_perp = convert(RealT, 0.1) * sinpi(2 * x_perp)
117-
rho = 1
118-
prim_rho = SVector{ncomponents(equations), real(equations)}(2^(i - 1) * (1 - 2) /
119-
(1 -
120-
2^ncomponents(equations)) *
121-
rho
117+
rho = one(RealT)
118+
prim_rho = SVector{ncomponents(equations), real(equations)}(2^(i - 1) * (1 - 2) *
119+
rho / (1 -
120+
2^ncomponents(equations))
122121
for i in eachcomponent(equations))
123122

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

158157
prim_rho = SVector{ncomponents(equations), real(equations)}(r > 0.5f0 ?
159158
2^(i - 1) * (1 - 2) /
159+
(RealT(1) -
160+
2^ncomponents(equations)) :
161+
2^(i - 1) * (1 - 2) *
162+
RealT(1.1691) /
160163
(1 -
161-
2^ncomponents(equations)) *
162-
one(RealT) :
163-
2^(i - 1) * (1 - 2) /
164-
(1 -
165-
2^ncomponents(equations)) *
166-
convert(RealT, 1.1691)
164+
2^ncomponents(equations))
167165
for i in eachcomponent(equations))
168166

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

0 commit comments

Comments
 (0)