Skip to content

Commit 6a34d24

Browse files
committed
increase coverage
1 parent 20c125b commit 6a34d24

File tree

3 files changed

+34
-101
lines changed

3 files changed

+34
-101
lines changed

src/equations/compressible_euler_potential_temperature_3d.jl

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -37,32 +37,6 @@ varnames(::typeof(cons2prim),
3737
"v3",
3838
"p1")
3939

40-
@inline function boundary_condition_slip_wall(u_inner, orientation,
41-
direction, x, t,
42-
surface_flux_function,
43-
equations::CompressibleEulerPotentialTemperatureEquations3D)
44-
45-
## get the appropriate normal vector from the orientation
46-
if orientation == 1
47-
u_boundary = SVector(u_inner[1], -u_inner[2], u_inner[3], u_inner[4],
48-
u_inner[5])
49-
elseif orientation == 2
50-
u_boundary = SVector(u_inner[1], u_inner[2], -u_inner[3], u_inner[4],
51-
u_inner[5])
52-
else
53-
u_boundary = SVector(u_inner[1], u_inner[2], u_inner[3], -u_inner[4],
54-
u_inner[5])
55-
end
56-
# Calculate boundary flux
57-
if iseven(direction) # u_inner is "left" of boundary, u_boundary is "right" of boundary
58-
flux = surface_flux_function(u_inner, u_boundary, orientation, equations)
59-
else # u_boundary is "left" of boundary, u_inner is "right" of boundary
60-
flux = surface_flux_function(u_boundary, u_inner, orientation, equations)
61-
end
62-
63-
return flux
64-
end
65-
6640
# Calculate 1D flux for a single point in the normal direction
6741
# Note, this directional vector is not normalized
6842
@inline function flux(u, normal_direction::AbstractVector,
@@ -84,36 +58,6 @@ end
8458
return SVector(f1, f2, f3, f4, f5)
8559
end
8660

87-
# Calculate 1D flux for a single point
88-
@inline function flux(u, orientation::Integer,
89-
equations::CompressibleEulerPotentialTemperatureEquations3D)
90-
rho, rho_v1, rho_v2, rho_v3, rho_theta = u
91-
v1 = rho_v1 / rho
92-
v2 = rho_v2 / rho
93-
v3 = rho_v3 / rho
94-
p = pressure(u, equations)
95-
if orientation == 1
96-
f1 = rho_v1
97-
f2 = rho_v1 * v1 + p
98-
f3 = rho_v1 * v2
99-
f4 = rho_v1 * v3
100-
f5 = rho_theta * v1
101-
elseif orientation == 2
102-
f1 = rho_v2
103-
f2 = rho_v2 * v1
104-
f3 = rho_v2 * v2 + p
105-
f4 = rho_v2 * v3
106-
f5 = rho_theta * v2
107-
else
108-
f1 = rho_v3
109-
f2 = rho_v3 * v1
110-
f3 = rho_v3 * v2
111-
f4 = rho_v3 * v3 + p
112-
f5 = rho_theta * v3
113-
end
114-
return SVector(f1, f2, f3, f4, f5)
115-
end
116-
11761
# Low Mach number approximate Riemann solver (LMARS) from
11862
# X. Chen, N. Andronova, B. Van Leer, J. E. Penner, J. P. Boyd, C. Jablonowski, S.
11963
# Lin, A Control-Volume Model of the Compressible Euler Equations with a Vertical Lagrangian

src/equations/compressible_euler_potential_temperature_gravity_3d.jl

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -86,36 +86,6 @@ end
8686
return SVector(f1, f2, f3, f4, f5, zero(eltype(u)))
8787
end
8888

89-
# Calculate 1D flux for a single point
90-
@inline function flux(u, orientation::Integer,
91-
equations::CompressibleEulerPotentialTemperatureEquationsWithGravity3D)
92-
rho, rho_v1, rho_v2, rho_v3, rho_theta = u
93-
v1 = rho_v1 / rho
94-
v2 = rho_v2 / rho
95-
v3 = rho_v3 / rho
96-
p = pressure(u, equations)
97-
if orientation == 1
98-
f1 = rho_v1
99-
f2 = rho_v1 * v1 + p
100-
f3 = rho_v1 * v2
101-
f4 = rho_v1 * v3
102-
f5 = rho_theta * v1
103-
elseif orientation == 2
104-
f1 = rho_v2
105-
f2 = rho_v2 * v1
106-
f3 = rho_v2 * v2 + p
107-
f4 = rho_v2 * v3
108-
f5 = rho_theta * v2
109-
else
110-
f1 = rho_v3
111-
f2 = rho_v3 * v1
112-
f3 = rho_v3 * v2
113-
f4 = rho_v3 * v3 + p
114-
f5 = rho_theta * v3
115-
end
116-
return SVector(f1, f2, f3, f4, f5, zero(eltype(u)))
117-
end
118-
11989
"""
12090
flux_nonconservative_waruzewski_etal(u_ll, u_rr,
12191
normal_direction::AbstractVector,

test/test_type.jl

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -112,17 +112,19 @@ isdir(outdir) && rm(outdir, recursive = true)
112112

113113
normal_direction = SVector(one(RealT), one(RealT))
114114
surface_flux_function = flux_lax_friedrichs
115-
orientation = 1
115+
orientations = [1, 2]
116116
directions = [1, 2]
117117

118-
for direction in directions
118+
for direction in directions, orientation in orientations
119119
@test eltype(@inferred boundary_condition_slip_wall(u_inner, orientation,
120120
direction,
121121
x, t,
122122
surface_flux_function,
123-
equations)) ==
124-
RealT
123+
equations)) == RealT
124+
@test typeof(@inferred max_abs_speed_naive(u_ll, u_rr, orientation,
125+
equations)) == RealT
125126
end
127+
126128
@test eltype(@inferred flux(u, normal_direction, equations)) == RealT
127129
@test eltype(@inferred flux_ec(u_ll, u_rr, normal_direction, equations)) ==
128130
RealT
@@ -141,6 +143,8 @@ isdir(outdir) && rm(outdir, recursive = true)
141143
@test eltype(@inferred Trixi.max_abs_speeds(u, equations)) == RealT
142144
@test typeof(@inferred max_abs_speed_naive(u_ll, u_rr, normal_direction,
143145
equations)) == RealT
146+
@test typeof(@inferred max_abs_speed(u_ll, u_rr, normal_direction,
147+
equations)) == RealT
144148
end
145149
end
146150

@@ -157,16 +161,20 @@ isdir(outdir) && rm(outdir, recursive = true)
157161

158162
normal_direction = SVector(one(RealT), one(RealT))
159163
surface_flux_function = (flux_lax_friedrichs, flux_zero)
160-
orientation = 1
164+
orientations = [1, 2]
161165
directions = [1, 2]
162166

163-
for direction in directions
167+
for direction in directions, orientation in orientations
164168
@test eltype(@inferred boundary_condition_slip_wall(u_inner, orientation,
165169
direction,
166170
x, t,
167171
surface_flux_function,
168172
equations)) ==
169173
SVector{5, RealT}
174+
@test typeof(@inferred max_abs_speed_naive(u_ll, u_rr, orientation,
175+
equations)) == RealT
176+
@test typeof(@inferred max_abs_speed(u_ll, u_rr, orientation,
177+
equations)) == RealT
170178
end
171179
@test eltype(@inferred flux(u, normal_direction, equations)) == RealT
172180
@test eltype(@inferred flux_ec(u_ll, u_rr, normal_direction, equations)) ==
@@ -186,6 +194,8 @@ isdir(outdir) && rm(outdir, recursive = true)
186194
@test eltype(@inferred Trixi.max_abs_speeds(u, equations)) == RealT
187195
@test typeof(@inferred max_abs_speed_naive(u_ll, u_rr, normal_direction,
188196
equations)) == RealT
197+
@test typeof(@inferred max_abs_speed(u_ll, u_rr, normal_direction,
198+
equations)) == RealT
189199
end
190200
end
191201

@@ -200,16 +210,13 @@ isdir(outdir) && rm(outdir, recursive = true)
200210
one(RealT), one(RealT))
201211

202212
surface_flux_function = flux_lax_friedrichs
203-
orientation = 1
204-
directions = [1, 2]
213+
orientations = [1, 2, 3]
205214

206-
for direction in directions
207-
@test eltype(@inferred boundary_condition_slip_wall(u_inner, orientation,
208-
direction,
209-
x, t,
210-
surface_flux_function,
211-
equations)) ==
212-
RealT
215+
for orientation in orientations
216+
@test typeof(@inferred max_abs_speed_naive(u_ll, u_rr, orientation,
217+
equations)) == RealT
218+
@test typeof(@inferred max_abs_speed(u_ll, u_rr, orientation,
219+
equations)) == RealT
213220
end
214221
normal_direction = SVector(one(RealT), one(RealT), one(RealT))
215222
@test eltype(@inferred flux(u, normal_direction, equations)) == RealT
@@ -230,6 +237,8 @@ isdir(outdir) && rm(outdir, recursive = true)
230237
@test eltype(@inferred Trixi.max_abs_speeds(u, equations)) == RealT
231238
@test typeof(@inferred max_abs_speed_naive(u_ll, u_rr, normal_direction,
232239
equations)) == RealT
240+
@test typeof(@inferred max_abs_speed(u_ll, u_rr, normal_direction,
241+
equations)) == RealT
233242
end
234243
end
235244
@timed_testset "Compressible Euler Potential Temperature With Gravity 3D" begin
@@ -245,6 +254,14 @@ isdir(outdir) && rm(outdir, recursive = true)
245254

246255
normal_direction = SVector(one(RealT), one(RealT), one(RealT))
247256

257+
orientations = [1, 2, 3]
258+
259+
for orientation in orientations
260+
@test typeof(@inferred max_abs_speed_naive(u_ll, u_rr, orientation,
261+
equations)) == RealT
262+
@test typeof(@inferred max_abs_speed(u_ll, u_rr, orientation,
263+
equations)) == RealT
264+
end
248265
@test eltype(@inferred flux(u, normal_direction, equations)) == RealT
249266
@test eltype(@inferred flux_ec(u_ll, u_rr, normal_direction, equations)) ==
250267
RealT
@@ -262,6 +279,8 @@ isdir(outdir) && rm(outdir, recursive = true)
262279
@test eltype(@inferred Trixi.max_abs_speeds(u, equations)) == RealT
263280
@test typeof(@inferred max_abs_speed_naive(u_ll, u_rr, normal_direction,
264281
equations)) == RealT
282+
@test typeof(@inferred max_abs_speed(u_ll, u_rr, normal_direction,
283+
equations)) == RealT
265284
end
266285
end
267286

0 commit comments

Comments
 (0)