Path: blob/main/test/test_mpi_p4est_parabolic_2d.jl
5582 views
module TestExamplesMPIP4estMesh2DParabolic12using Test3using Trixi45include("test_trixi.jl")67EXAMPLES_DIR = joinpath(examples_dir(), "p4est_2d_dgsem")89@testset "P4estMesh MPI 2D Parabolic" begin10@trixi_testset "P4estMesh2D: elixir_navierstokes_lid_driven_cavity.jl" begin11@test_trixi_include(joinpath(EXAMPLES_DIR,12"elixir_navierstokes_lid_driven_cavity.jl"),13initial_refinement_level=2, tspan=(0.0, 0.5),14l2=[150.00028716166408816073,160.08101204560401647,170.02099595625377768,180.0500814975414329519],20linf=[210.014804500261322406,220.9513271652357098,230.7223919625994717,241.484690733100478625])26# Ensure that we do not have excessive memory allocations27# (e.g., from type instabilities)28@test_allocations(Trixi.rhs!, semi, sol, 1500)29@test_allocations(Trixi.rhs_parabolic!, semi, sol, 1500)30end3132@trixi_testset "P4estMesh2D: elixir_navierstokes_convergence_nonperiodic.jl" begin33@test_trixi_include(joinpath(EXAMPLES_DIR,34"elixir_navierstokes_convergence_nonperiodic.jl"),35initial_refinement_level=1, tspan=(0.0, 0.2),36l2=[370.0004036496258545996,380.0005869762480189079,390.0009148853742181908,400.001198419153276454341],42linf=[430.0024993634989209923,440.009487866203496731,450.004505829506103787,460.01163490275355449947])48# Ensure that we do not have excessive memory allocations49# (e.g., from type instabilities)50@test_allocations(Trixi.rhs!, semi, sol, 1500)51@test_allocations(Trixi.rhs_parabolic!, semi, sol, 1500)52end5354@trixi_testset "P4estMesh2D: elixir_advection_diffusion_nonperiodic_curved.jl" begin55@test_trixi_include(joinpath(EXAMPLES_DIR,56"elixir_advection_diffusion_nonperiodic_curved.jl"),57trees_per_dimension=(1, 1), initial_refinement_level=2,58tspan=(0.0, 0.5),59l2=[0.00919917034843865],60linf=[0.14186297438393505])61# Ensure that we do not have excessive memory allocations62# (e.g., from type instabilities)63@test_allocations(Trixi.rhs!, semi, sol, 1500)64@test_allocations(Trixi.rhs_parabolic!, semi, sol, 1500)65end6667@trixi_testset "P4estMesh2D: elixir_advection_diffusion_periodic.jl" begin68@test_trixi_include(joinpath(EXAMPLES_DIR,69"elixir_advection_diffusion_periodic.jl"),70trees_per_dimension=(1, 1), initial_refinement_level=2,71tspan=(0.0, 0.5),72l2=[0.0023754695605828443],73linf=[0.008154128363741964])74# Ensure that we do not have excessive memory allocations75# (e.g., from type instabilities)76@test_allocations(Trixi.rhs!, semi, sol, 1500)77@test_allocations(Trixi.rhs_parabolic!, semi, sol, 1500)78end7980@trixi_testset "elixir_navierstokes_NACA0012airfoil_mach08.jl" begin81@test_trixi_include(joinpath(EXAMPLES_DIR,82"elixir_navierstokes_NACA0012airfoil_mach08.jl"),83l2=[0.000186486564226516,840.0005076712323400374,850.00038074588984354107,860.002128177239782089],87linf=[0.5153387072802718,881.199362305026636,890.9077214424040279,905.666071182328691], tspan=(0.0, 0.001),91initial_refinement_level=0)9293u_ode = copy(sol.u[end])94du_ode = zero(u_ode) # Just a placeholder in this case9596u = Trixi.wrap_array(u_ode, semi)97du = Trixi.wrap_array(du_ode, semi)9899drag_p = Trixi.analyze(drag_coefficient, du, u, tspan[2], mesh, equations, solver,100semi.cache, semi)101lift_p = Trixi.analyze(lift_coefficient, du, u, tspan[2], mesh, equations, solver,102semi.cache, semi)103104drag_f = Trixi.analyze(drag_coefficient_shear_force, du, u, tspan[2], mesh,105equations, equations_parabolic, solver,106semi.cache, semi, semi.cache_parabolic)107lift_f = Trixi.analyze(lift_coefficient_shear_force, du, u, tspan[2], mesh,108equations, equations_parabolic, solver,109semi.cache, semi, semi.cache_parabolic)110111@test isapprox(drag_p, 0.17963843913309516, atol = 1e-13)112@test isapprox(lift_p, 0.26462588007949367, atol = 1e-13)113114@test isapprox(drag_f, 1.5427441885921553, atol = 1e-13)115@test isapprox(lift_f, 0.005621910087395724, atol = 1e-13)116117# Ensure that we do not have excessive memory allocations118# (e.g., from type instabilities)119# We move these tests here to avoid modifying values used120# to compute the drag/lift coefficients above.121@test_allocations(Trixi.rhs!, semi, sol, 1500)122@test_allocations(Trixi.rhs_parabolic!, semi, sol, 1500)123end124125@trixi_testset "P4estMesh2D: elixir_advection_diffusion_amr_inverted_index.jl" begin126#Test that the mpi parabolic solver works for inverted node indexing from external mesh files.127@test_trixi_include(joinpath(EXAMPLES_DIR,128"elixir_advection_diffusion_amr_inverted_index.jl"),129tspan=(0.0, 0.5),130l2=[0.1717677505262361],131linf=[1.9925134228101835],132atol=1e-8,133rtol=1e-8)134# Ensure that we do not have excessive memory allocations135@test_allocations(Trixi.rhs!, semi, sol, 1500)136@test_allocations(Trixi.rhs_parabolic!, semi, sol, 1500)137end138end139end # module140141142