Skip to content

Commit

Permalink
Add test for supersonic flow
Browse files Browse the repository at this point in the history
  • Loading branch information
bennibolm committed Dec 4, 2023
1 parent fd89f41 commit 147479b
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 25 deletions.
1 change: 0 additions & 1 deletion examples/p4est_2d_dgsem/elixir_euler_double_mach.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

using OrdinaryDiffEq
using Trixi
using LinearAlgebra: norm # for use in get_boundary_outer_state

###############################################################################
# semidiscretization of the compressible Euler equations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ end
@inline function Trixi.get_boundary_outer_state(u_inner, cache, t,
boundary_condition::typeof(boundary_condition_supersonic_inflow),
normal_direction::AbstractVector, direction,
equations,
dg, indices...)
mesh::P4estMesh{2}, equations, dg,
indices...)
x = Trixi.get_node_coords(cache.elements.node_coordinates, equations, dg, indices...)

return initial_condition_mach3_flow(x, t, equations)
Expand All @@ -71,8 +71,8 @@ end

@inline function Trixi.get_boundary_outer_state(u_inner, cache, t,
boundary_condition::typeof(boundary_condition_outflow),
orientation_or_normal, direction, equations,
dg, indices...)
orientation_or_normal, direction,
mesh::P4estMesh{2}, equations, dg, indices...)
return u_inner
end

Expand All @@ -95,14 +95,10 @@ volume_flux = flux_ranocha
polydeg = 3
basis = LobattoLegendreBasis(polydeg)
limiter_idp = SubcellLimiterIDP(equations, basis;
local_minmax_variables_cons = ["rho"],
positivity_variables_cons = ["rho"],
positivity_variables_nonlinear = [pressure],
positivity_correction_factor = 0.5,
spec_entropy = true,
bar_states = false,
max_iterations_newton = 1000,
newton_tolerances = (1.0e-14, 1.0e-15))
spec_entropy = false,
bar_states = false)
volume_integral = VolumeIntegralSubcellLimiting(limiter_idp;
volume_flux_dg = volume_flux,
volume_flux_fv = surface_flux)
Expand All @@ -115,7 +111,7 @@ isfile(default_mesh_file) ||
default_mesh_file)
mesh_file = default_mesh_file

mesh = P4estMesh{2}(mesh_file, initial_refinement_level = 1)
mesh = P4estMesh{2}(mesh_file, initial_refinement_level = 0)

semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
boundary_conditions = boundary_conditions)
Expand Down
1 change: 0 additions & 1 deletion examples/structured_2d_dgsem/elixir_euler_double_mach.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

using OrdinaryDiffEq
using Trixi
using LinearAlgebra: norm # for use in get_boundary_outer_state

###############################################################################
# semidiscretization of the compressible Euler equations
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

using OrdinaryDiffEq
using Trixi
using LinearAlgebra: norm # for use in get_boundary_outer_state

###############################################################################
# semidiscretization of the compressible Euler equations
Expand Down
49 changes: 38 additions & 11 deletions test/test_p4est_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -364,29 +364,28 @@ end
end

@trixi_testset "elixir_euler_double_mach.jl" begin
# Same results as for StructuredMesh with initial_refinement_level=2
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_double_mach.jl"),
l2=[
0.87417841433288,
6.669726935171785,
3.4980245896465387,
76.33557073534843,
0.8741784143331414,
6.669726935141086,
3.4980245896042237,
76.33557073504075,
],
linf=[
11.428353671462515,
142.73486852796972,
38.91639544578682,
1651.7541392659086,
11.428353668952052,
142.73486850872337,
38.91639544604301,
1651.7541390872523,
],
initial_refinement_level=2,
initial_refinement_level=1,
tspan=(0.0, 0.05))
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
let
t = sol.t[end]
u_ode = sol.u[end]
du_ode = similar(u_ode)
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 10000
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 15000
end
end

Expand Down Expand Up @@ -418,6 +417,34 @@ end
end
end

@trixi_testset "elixir_euler_supersonic_cylinder_sc_subcell.jl" begin
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_supersonic_cylinder_sc_subcell.jl"),
l2=[
0.01733051773398731,
0.038254257166961285,
0.018157981470786955,
0.12176639664229769,
],
linf=[
1.3534563960399795,
2.861333164923601,
2.248472479406512,
9.797432332463623,
],
tspan=(0.0, 0.001),
skip_coverage=true)
if @isdefined sol # Skipped in coverage run
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
let
t = sol.t[end]
u_ode = sol.u[end]
du_ode = similar(u_ode)
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 15000
end
end
end

@trixi_testset "elixir_eulergravity_convergence.jl" begin
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_eulergravity_convergence.jl"),
l2=[
Expand Down

0 comments on commit 147479b

Please sign in to comment.