Skip to content

Commit

Permalink
fix CNS convergence elixir and add to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jlchan committed Jun 19, 2023
1 parent e35c77d commit dbddf85
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
20 changes: 5 additions & 15 deletions examples/p4est_2d_dgsem/elixir_navierstokes_convergence.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,11 @@ solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs,
coordinates_min = (-1.0, -1.0) # minimum coordinates (min(x), min(y))
coordinates_max = ( 1.0, 1.0) # maximum coordinates (max(x), max(y))

# Create a uniformly refined mesh with periodic boundaries
mesh = TreeMesh(coordinates_min, coordinates_max,
initial_refinement_level=4,
periodicity=(true, true),
n_cells_max=30_000) # set maximum capacity of tree data structure

trees_per_dimension = (4, 4)
mesh = P4estMesh(trees_per_dimension,
polydeg=3, initial_refinement_level=2,
coordinates_min=coordinates_min, coordinates_max=coordinates_max,
periodicity=true)
periodicity=(true, false))

# Note: the initial condition cannot be specialized to `CompressibleNavierStokesDiffusion2D`
# since it is called by both the parabolic solver (which passes in `CompressibleNavierStokesDiffusion2D`)
Expand Down Expand Up @@ -181,16 +175,12 @@ heat_bc_top_bottom = Adiabatic((x, t, equations) -> 0.0)
boundary_condition_top_bottom = BoundaryConditionNavierStokesWall(velocity_bc_top_bottom, heat_bc_top_bottom)

# define inviscid boundary conditions
boundary_conditions = (; x_neg = boundary_condition_periodic,
x_pos = boundary_condition_periodic,
y_neg = boundary_condition_slip_wall,
y_pos = boundary_condition_slip_wall)
boundary_conditions = Dict(:y_neg => boundary_condition_slip_wall,
:y_pos => boundary_condition_slip_wall)

# define viscous boundary conditions
boundary_conditions_parabolic = (; x_neg = boundary_condition_periodic,
x_pos = boundary_condition_periodic,
y_neg = boundary_condition_top_bottom,
y_pos = boundary_condition_top_bottom)
boundary_conditions_parabolic = Dict(:y_neg => boundary_condition_top_bottom,
:y_pos => boundary_condition_top_bottom)

semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), initial_condition, solver;
boundary_conditions=(boundary_conditions, boundary_conditions_parabolic),
Expand Down
8 changes: 8 additions & 0 deletions test/test_parabolic_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,14 @@ isdir(outdir) && rm(outdir, recursive=true)
)
end

@trixi_testset "P4estMesh2D: elixir_navierstokes_convergence.jl" begin
@test_trixi_include(joinpath(examples_dir(), "p4est_2d_dgsem", "elixir_navierstokes_convergence.jl"),
initial_refinement_level = 2, tspan=(0.0, 0.5),
l2 = [4.2852610204634015e-6, 2.0679143814141558e-5, 1.4336134288439704e-5, 7.800744943199459e-6],
linf = [3.570853695711307e-5, 0.00034481633921521794, 8.593188464759635e-5, 0.00010656913331352769]
)
end

@trixi_testset "P4estMesh2D: elixir_navierstokes_lid_driven_cavity.jl" begin
@test_trixi_include(joinpath(examples_dir(), "p4est_2d_dgsem", "elixir_navierstokes_lid_driven_cavity.jl"),
initial_refinement_level = 2, tspan=(0.0, 0.5),
Expand Down

0 comments on commit dbddf85

Please sign in to comment.