From 487d08dbbdbe5b45620276f3aff1d364144c7758 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Fri, 27 Oct 2023 10:06:23 +0200 Subject: [PATCH 01/19] HLLE CEE 2D3D NonCartesian Meshes --- src/equations/compressible_euler_2d.jl | 90 +++++++++++++++++++++++ src/equations/compressible_euler_3d.jl | 99 ++++++++++++++++++++++++++ test/test_p4est_2d.jl | 16 +++++ test/test_p4est_3d.jl | 16 +++++ test/test_unit.jl | 4 +- 5 files changed, 223 insertions(+), 2 deletions(-) diff --git a/src/equations/compressible_euler_2d.jl b/src/equations/compressible_euler_2d.jl index 27b92f41953..c3c7be5366f 100644 --- a/src/equations/compressible_euler_2d.jl +++ b/src/equations/compressible_euler_2d.jl @@ -1341,6 +1341,96 @@ function flux_hlle(u_ll, u_rr, orientation::Integer, return SVector(f1, f2, f3, f4) end +""" + flux_hlle(u_ll, u_rr, normal_direction, equations::CompressibleEulerEquations2D) + +Computes the HLLE (Harten-Lax-van Leer-Einfeldt) flux for the compressible Euler equations. +Special estimates of the signal velocites and linearization of the Riemann problem developed +by Einfeldt to ensure that the internal energy and density remain positive during the computation +of the numerical flux. + +- Bernd Einfeldt (1988) + On Godunov-type methods for gas dynamics. + [DOI: 10.1137/0725021](https://doi.org/10.1137/0725021) +- Bernd Einfeldt, Claus-Dieter Munz, Philip L. Roe and Björn Sjögreen (1991) + On Godunov-type methods near low densities. + [DOI: 10.1016/0021-9991(91)90211-3](https://doi.org/10.1016/0021-9991(91)90211-3) +""" +function flux_hlle(u_ll, u_rr, normal_direction::AbstractVector, + equations::CompressibleEulerEquations2D) + # Calculate primitive variables, enthalpy and speed of sound + rho_ll, v1_ll, v2_ll, p_ll = cons2prim(u_ll, equations) + rho_rr, v1_rr, v2_rr, p_rr = cons2prim(u_rr, equations) + + v_dot_n_ll = v1_ll * normal_direction[1] + v2_ll * normal_direction[2] + v_dot_n_rr = v1_rr * normal_direction[1] + v2_rr * normal_direction[2] + + norm_ = norm(normal_direction) + + # `u_ll[4]` is total energy `rho_e_ll` on the left + H_ll = (u_ll[4] + p_ll) / rho_ll + c_ll = sqrt(equations.gamma * p_ll / rho_ll) * norm_ + + # `u_rr[4]` is total energy `rho_e_rr` on the right + H_rr = (u_rr[4] + p_rr) / rho_rr + c_rr = sqrt(equations.gamma * p_rr / rho_rr) * norm_ + + # Compute Roe averages + sqrt_rho_ll = sqrt(rho_ll) + sqrt_rho_rr = sqrt(rho_rr) + inv_sum_sqrt_rho = inv(sqrt_rho_ll + sqrt_rho_rr) + + v1_roe = (sqrt_rho_ll * v1_ll + sqrt_rho_rr * v1_rr) * inv_sum_sqrt_rho + v2_roe = (sqrt_rho_ll * v2_ll + sqrt_rho_rr * v2_rr) * inv_sum_sqrt_rho + v_roe = v1_roe * normal_direction[1] + v2_roe * normal_direction[2] + v_roe_mag = (v1_roe * normal_direction[1])^2 + (v2_roe * normal_direction[2])^2 + + H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) * inv_sum_sqrt_rho + c_roe = sqrt((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) * norm_ + + # Compute convenience constant for positivity preservation, see + # https://doi.org/10.1016/0021-9991(91)90211-3 + beta = sqrt(0.5 * (equations.gamma - 1) / equations.gamma) + + # Estimate the edges of the Riemann fan (with positivity conservation) + SsL = min(v_roe - c_roe, v_dot_n_ll - beta * c_ll, zero(v_roe)) + SsR = max(v_roe + c_roe, v_dot_n_rr + beta * c_rr, zero(v_roe)) + + if SsL >= 0.0 && SsR > 0.0 + # Positive supersonic speed + f_ll = flux(u_ll, normal_direction, equations) + + f1 = f_ll[1] + f2 = f_ll[2] + f3 = f_ll[3] + f4 = f_ll[4] + elseif SsR <= 0.0 && SsL < 0.0 + # Negative supersonic speed + f_rr = flux(u_rr, normal_direction, equations) + + f1 = f_rr[1] + f2 = f_rr[2] + f3 = f_rr[3] + f4 = f_rr[4] + else + # Subsonic case + # Compute left and right fluxes + f_ll = flux(u_ll, normal_direction, equations) + f_rr = flux(u_rr, normal_direction, equations) + + f1 = (SsR * f_ll[1] - SsL * f_rr[1] + SsL * SsR * (u_rr[1] - u_ll[1])) / + (SsR - SsL) + f2 = (SsR * f_ll[2] - SsL * f_rr[2] + SsL * SsR * (u_rr[2] - u_ll[2])) / + (SsR - SsL) + f3 = (SsR * f_ll[3] - SsL * f_rr[3] + SsL * SsR * (u_rr[3] - u_ll[3])) / + (SsR - SsL) + f4 = (SsR * f_ll[4] - SsL * f_rr[4] + SsL * SsR * (u_rr[4] - u_ll[4])) / + (SsR - SsL) + end + + return SVector(f1, f2, f3, f4) +end + @inline function max_abs_speeds(u, equations::CompressibleEulerEquations2D) rho, v1, v2, p = cons2prim(u, equations) c = sqrt(equations.gamma * p / rho) diff --git a/src/equations/compressible_euler_3d.jl b/src/equations/compressible_euler_3d.jl index 7f25bde31fd..855091ec3a2 100644 --- a/src/equations/compressible_euler_3d.jl +++ b/src/equations/compressible_euler_3d.jl @@ -1418,6 +1418,105 @@ function flux_hlle(u_ll, u_rr, orientation::Integer, return SVector(f1, f2, f3, f4, f5) end +""" + flux_hlle(u_ll, u_rr, normal_direction, equations::CompressibleEulerEquations3D) + +Computes the HLLE (Harten-Lax-van Leer-Einfeldt) flux for the compressible Euler equations. +Special estimates of the signal velocites and linearization of the Riemann problem developed +by Einfeldt to ensure that the internal energy and density remain positive during the computation +of the numerical flux. + +- Bernd Einfeldt (1988) + On Godunov-type methods for gas dynamics. + [DOI: 10.1137/0725021](https://doi.org/10.1137/0725021) +- Bernd Einfeldt, Claus-Dieter Munz, Philip L. Roe and Björn Sjögreen (1991) + On Godunov-type methods near low densities. + [DOI: 10.1016/0021-9991(91)90211-3](https://doi.org/10.1016/0021-9991(91)90211-3) +""" +function flux_hlle(u_ll, u_rr, normal_direction::AbstractVector, + equations::CompressibleEulerEquations3D) + # Calculate primitive variables, enthalpy and speed of sound + rho_ll, v1_ll, v2_ll, v3_ll, p_ll = cons2prim(u_ll, equations) + rho_rr, v1_rr, v2_rr, v3_rr, p_rr = cons2prim(u_rr, equations) + + v_dot_n_ll = v1_ll * normal_direction[1] + v2_ll * normal_direction[2] + + v3_ll * normal_direction[3] + v_dot_n_rr = v1_rr * normal_direction[1] + v2_rr * normal_direction[2] + + v3_rr * normal_direction[3] + + norm_ = norm(normal_direction) + + # `u_ll[5]` is total energy `rho_e_ll` on the left + H_ll = (u_ll[5] + p_ll) / rho_ll + c_ll = sqrt(equations.gamma * p_ll / rho_ll) * norm_ + + # `u_rr[5]` is total energy `rho_e_rr` on the right + H_rr = (u_rr[5] + p_rr) / rho_rr + c_rr = sqrt(equations.gamma * p_rr / rho_rr) * norm_ + + # Compute Roe averages + sqrt_rho_ll = sqrt(rho_ll) + sqrt_rho_rr = sqrt(rho_rr) + inv_sum_sqrt_rho = inv(sqrt_rho_ll + sqrt_rho_rr) + + v1_roe = (sqrt_rho_ll * v1_ll + sqrt_rho_rr * v1_rr) * inv_sum_sqrt_rho + v2_roe = (sqrt_rho_ll * v2_ll + sqrt_rho_rr * v2_rr) * inv_sum_sqrt_rho + v3_roe = (sqrt_rho_ll * v3_ll + sqrt_rho_rr * v3_rr) * inv_sum_sqrt_rho + v_roe = v1_roe * normal_direction[1] + v2_roe * normal_direction[2] + + v3_roe * normal_direction[3] + v_roe_mag = v1_roe^2 + v2_roe^2 + v3_roe^2 + + H_roe = (sqrt_rho_ll * H_ll + sqrt_rho_rr * H_rr) * inv_sum_sqrt_rho + c_roe = sqrt((equations.gamma - 1) * (H_roe - 0.5 * v_roe_mag)) * norm_ + + # Compute convenience constant for positivity preservation, see + # https://doi.org/10.1016/0021-9991(91)90211-3 + beta = sqrt(0.5 * (equations.gamma - 1) / equations.gamma) + + # Estimate the edges of the Riemann fan (with positivity conservation) + SsL = min(v_roe - c_roe, v_dot_n_ll - beta * c_ll, zero(v_roe)) + SsR = max(v_roe + c_roe, v_dot_n_rr + beta * c_rr, zero(v_roe)) + + if SsL >= 0.0 && SsR > 0.0 + # Positive supersonic speed + f_ll = flux(u_ll, normal_direction, equations) + + f1 = f_ll[1] + f2 = f_ll[2] + f3 = f_ll[3] + f4 = f_ll[4] + f5 = f_ll[5] + elseif SsR <= 0.0 && SsL < 0.0 + # Negative supersonic speed + f_rr = flux(u_rr, normal_direction, equations) + + f1 = f_rr[1] + f2 = f_rr[2] + f3 = f_rr[3] + f4 = f_rr[4] + f5 = f_rr[5] + else + # Subsonic case + # Compute left and right fluxes + f_ll = flux(u_ll, normal_direction, equations) + f_rr = flux(u_rr, normal_direction, equations) + + f1 = (SsR * f_ll[1] - SsL * f_rr[1] + SsL * SsR * (u_rr[1] - u_ll[1])) / + (SsR - SsL) + f2 = (SsR * f_ll[2] - SsL * f_rr[2] + SsL * SsR * (u_rr[2] - u_ll[2])) / + (SsR - SsL) + f3 = (SsR * f_ll[3] - SsL * f_rr[3] + SsL * SsR * (u_rr[3] - u_ll[3])) / + (SsR - SsL) + f4 = (SsR * f_ll[4] - SsL * f_rr[4] + SsL * SsR * (u_rr[4] - u_ll[4])) / + (SsR - SsL) + f5 = (SsR * f_ll[5] - SsL * f_rr[5] + SsL * SsR * (u_rr[5] - u_ll[5])) / + (SsR - SsL) + end + + return SVector(f1, f2, f3, f4, f5) +end + + @inline function max_abs_speeds(u, equations::CompressibleEulerEquations3D) rho, v1, v2, v3, p = cons2prim(u, equations) c = sqrt(equations.gamma * p / rho) diff --git a/test/test_p4est_2d.jl b/test/test_p4est_2d.jl index 5baa090c8d7..eb4ff3bc7d7 100644 --- a/test/test_p4est_2d.jl +++ b/test/test_p4est_2d.jl @@ -160,6 +160,22 @@ isdir(outdir) && rm(outdir, recursive=true) end end + @trixi_testset "elixir_euler_sedov.jl HLLE" begin + @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_sedov.jl"), + l2 = [0.411541263324004, 0.2558929632770186, 0.2558929632770193, 1.298715766843915], + linf = [1.3457201726152221, 1.3138961427140758, 1.313896142714079, 6.293305112638921], + surface_flux = flux_hlle, + tspan = (0.0, 0.3)) + # 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)) < 1000 + end + end + @trixi_testset "elixir_euler_blast_wave_amr.jl" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_blast_wave_amr.jl"), l2 = [6.32183914e-01, 3.86914231e-01, 3.86869171e-01, 1.06575688e+00], diff --git a/test/test_p4est_3d.jl b/test/test_p4est_3d.jl index 370f864b5aa..47105ec11ed 100644 --- a/test/test_p4est_3d.jl +++ b/test/test_p4est_3d.jl @@ -207,6 +207,22 @@ isdir(outdir) && rm(outdir, recursive=true) end end + @trixi_testset "elixir_euler_sedov.jl HLLE" begin + @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_sedov.jl"), + l2 = [0.09946224487902565, 0.04863386374672001, 0.048633863746720116, 0.04863386374672032, 0.3751015774232693], + linf = [0.789241521871487, 0.42046970270100276, 0.42046970270100276, 0.4204697027010028, 4.730877375538398], + tspan = (0.0, 0.3), + surface_flux = flux_hlle) + # 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)) < 1000 + end + end + @trixi_testset "elixir_euler_source_terms_nonconforming_earth.jl" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_source_terms_nonconforming_earth.jl"), l2 = [6.040180337738628e-6, 5.4254175153621895e-6, 5.677698851333843e-6, 5.8017136892469794e-6, 1.3637854615117974e-5], diff --git a/test/test_unit.jl b/test/test_unit.jl index 5c5291c2430..1fac9ec752b 100644 --- a/test/test_unit.jl +++ b/test/test_unit.jl @@ -875,7 +875,7 @@ isdir(outdir) && rm(outdir, recursive=true) SVector(-1.2, 0.3)] for normal_direction in normal_directions - @test flux_hll(u, u, normal_direction, equations) ≈ flux(u, normal_direction, equations) + @test flux_hlle(u, u, normal_direction, equations) ≈ flux(u, normal_direction, equations) end equations = CompressibleEulerEquations3D(1.4) @@ -893,7 +893,7 @@ isdir(outdir) && rm(outdir, recursive=true) SVector(-1.2, 0.3, 1.4)] for normal_direction in normal_directions - @test flux_hll(u, u, normal_direction, equations) ≈ flux(u, normal_direction, equations) + @test flux_hlle(u, u, normal_direction, equations) ≈ flux(u, normal_direction, equations) end end From 653e2ccb1aa9761cba4809ea7d58432c55acf84b Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Fri, 27 Oct 2023 10:09:43 +0200 Subject: [PATCH 02/19] format --- src/equations/compressible_euler_2d.jl | 2 +- src/equations/compressible_euler_3d.jl | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/equations/compressible_euler_2d.jl b/src/equations/compressible_euler_2d.jl index c3c7be5366f..3b71a9b097f 100644 --- a/src/equations/compressible_euler_2d.jl +++ b/src/equations/compressible_euler_2d.jl @@ -1379,7 +1379,7 @@ function flux_hlle(u_ll, u_rr, normal_direction::AbstractVector, sqrt_rho_ll = sqrt(rho_ll) sqrt_rho_rr = sqrt(rho_rr) inv_sum_sqrt_rho = inv(sqrt_rho_ll + sqrt_rho_rr) - + v1_roe = (sqrt_rho_ll * v1_ll + sqrt_rho_rr * v1_rr) * inv_sum_sqrt_rho v2_roe = (sqrt_rho_ll * v2_ll + sqrt_rho_rr * v2_rr) * inv_sum_sqrt_rho v_roe = v1_roe * normal_direction[1] + v2_roe * normal_direction[2] diff --git a/src/equations/compressible_euler_3d.jl b/src/equations/compressible_euler_3d.jl index 855091ec3a2..492727e7e5f 100644 --- a/src/equations/compressible_euler_3d.jl +++ b/src/equations/compressible_euler_3d.jl @@ -1462,7 +1462,7 @@ function flux_hlle(u_ll, u_rr, normal_direction::AbstractVector, v1_roe = (sqrt_rho_ll * v1_ll + sqrt_rho_rr * v1_rr) * inv_sum_sqrt_rho v2_roe = (sqrt_rho_ll * v2_ll + sqrt_rho_rr * v2_rr) * inv_sum_sqrt_rho v3_roe = (sqrt_rho_ll * v3_ll + sqrt_rho_rr * v3_rr) * inv_sum_sqrt_rho - v_roe = v1_roe * normal_direction[1] + v2_roe * normal_direction[2] + + v_roe = v1_roe * normal_direction[1] + v2_roe * normal_direction[2] + v3_roe * normal_direction[3] v_roe_mag = v1_roe^2 + v2_roe^2 + v3_roe^2 @@ -1516,7 +1516,6 @@ function flux_hlle(u_ll, u_rr, normal_direction::AbstractVector, return SVector(f1, f2, f3, f4, f5) end - @inline function max_abs_speeds(u, equations::CompressibleEulerEquations3D) rho, v1, v2, v3, p = cons2prim(u, equations) c = sqrt(equations.gamma * p / rho) From fd8a922f844703adeafb1f035ecaf6b9f1210899 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Mon, 30 Oct 2023 17:22:42 +0100 Subject: [PATCH 03/19] hlle via hll --- src/equations/compressible_euler_1d.jl | 34 +---------- src/equations/compressible_euler_2d.jl | 76 ++--------------------- src/equations/compressible_euler_3d.jl | 84 ++------------------------ 3 files changed, 15 insertions(+), 179 deletions(-) diff --git a/src/equations/compressible_euler_1d.jl b/src/equations/compressible_euler_1d.jl index 9204989e8be..dede521e825 100644 --- a/src/equations/compressible_euler_1d.jl +++ b/src/equations/compressible_euler_1d.jl @@ -808,7 +808,7 @@ function flux_hllc(u_ll, u_rr, orientation::Integer, end """ - flux_hlle(u_ll, u_rr, orientation, equations::CompressibleEulerEquations1D) + min_max_speed_einfeldt(u_ll, u_rr, orientation, equations::CompressibleEulerEquations1D) Computes the HLLE (Harten-Lax-van Leer-Einfeldt) flux for the compressible Euler equations. Special estimates of the signal velocites and linearization of the Riemann problem developed @@ -825,7 +825,7 @@ Compactly summarized: Numerical methods for conservation laws and related equations. [Link](https://metaphor.ethz.ch/x/2019/hs/401-4671-00L/literature/mishra_hyperbolic_pdes.pdf) """ -function flux_hlle(u_ll, u_rr, orientation::Integer, +function min_max_speed_einfeldt(u_ll, u_rr, orientation::Integer, equations::CompressibleEulerEquations1D) # Calculate primitive variables, enthalpy and speed of sound rho_ll, v_ll, p_ll = cons2prim(u_ll, equations) @@ -858,35 +858,7 @@ function flux_hlle(u_ll, u_rr, orientation::Integer, SsL = min(v_roe - c_roe, v_ll - beta * c_ll, zero(v_roe)) SsR = max(v_roe + c_roe, v_rr + beta * c_rr, zero(v_roe)) - if SsL >= 0.0 && SsR > 0.0 - # Positive supersonic speed - f_ll = flux(u_ll, orientation, equations) - - f1 = f_ll[1] - f2 = f_ll[2] - f3 = f_ll[3] - elseif SsR <= 0.0 && SsL < 0.0 - # Negative supersonic speed - f_rr = flux(u_rr, orientation, equations) - - f1 = f_rr[1] - f2 = f_rr[2] - f3 = f_rr[3] - else - # Subsonic case - # Compute left and right fluxes - f_ll = flux(u_ll, orientation, equations) - f_rr = flux(u_rr, orientation, equations) - - f1 = (SsR * f_ll[1] - SsL * f_rr[1] + SsL * SsR * (u_rr[1] - u_ll[1])) / - (SsR - SsL) - f2 = (SsR * f_ll[2] - SsL * f_rr[2] + SsL * SsR * (u_rr[2] - u_ll[2])) / - (SsR - SsL) - f3 = (SsR * f_ll[3] - SsL * f_rr[3] + SsL * SsR * (u_rr[3] - u_ll[3])) / - (SsR - SsL) - end - - return SVector(f1, f2, f3) + return SsL, SsR end @inline function max_abs_speeds(u, equations::CompressibleEulerEquations1D) diff --git a/src/equations/compressible_euler_2d.jl b/src/equations/compressible_euler_2d.jl index 3b71a9b097f..13e2c302e89 100644 --- a/src/equations/compressible_euler_2d.jl +++ b/src/equations/compressible_euler_2d.jl @@ -1253,7 +1253,7 @@ function flux_hllc(u_ll, u_rr, orientation::Integer, end """ - flux_hlle(u_ll, u_rr, orientation, equations::CompressibleEulerEquations2D) + min_max_speed_einfeldt(u_ll, u_rr, orientation, equations::CompressibleEulerEquations2D) Computes the HLLE (Harten-Lax-van Leer-Einfeldt) flux for the compressible Euler equations. Special estimates of the signal velocites and linearization of the Riemann problem developed @@ -1267,7 +1267,7 @@ of the numerical flux. On Godunov-type methods near low densities. [DOI: 10.1016/0021-9991(91)90211-3](https://doi.org/10.1016/0021-9991(91)90211-3) """ -function flux_hlle(u_ll, u_rr, orientation::Integer, +function min_max_speed_einfeldt(u_ll, u_rr, orientation::Integer, equations::CompressibleEulerEquations2D) # Calculate primitive variables, enthalpy and speed of sound rho_ll, v1_ll, v2_ll, p_ll = cons2prim(u_ll, equations) @@ -1306,43 +1306,11 @@ function flux_hlle(u_ll, u_rr, orientation::Integer, SsR = max(v2_roe + c_roe, v2_rr + beta * c_rr, zero(v2_roe)) end - if SsL >= 0.0 && SsR > 0.0 - # Positive supersonic speed - f_ll = flux(u_ll, orientation, equations) - - f1 = f_ll[1] - f2 = f_ll[2] - f3 = f_ll[3] - f4 = f_ll[4] - elseif SsR <= 0.0 && SsL < 0.0 - # Negative supersonic speed - f_rr = flux(u_rr, orientation, equations) - - f1 = f_rr[1] - f2 = f_rr[2] - f3 = f_rr[3] - f4 = f_rr[4] - else - # Subsonic case - # Compute left and right fluxes - f_ll = flux(u_ll, orientation, equations) - f_rr = flux(u_rr, orientation, equations) - - f1 = (SsR * f_ll[1] - SsL * f_rr[1] + SsL * SsR * (u_rr[1] - u_ll[1])) / - (SsR - SsL) - f2 = (SsR * f_ll[2] - SsL * f_rr[2] + SsL * SsR * (u_rr[2] - u_ll[2])) / - (SsR - SsL) - f3 = (SsR * f_ll[3] - SsL * f_rr[3] + SsL * SsR * (u_rr[3] - u_ll[3])) / - (SsR - SsL) - f4 = (SsR * f_ll[4] - SsL * f_rr[4] + SsL * SsR * (u_rr[4] - u_ll[4])) / - (SsR - SsL) - end - - return SVector(f1, f2, f3, f4) + return SsL, SsR end """ - flux_hlle(u_ll, u_rr, normal_direction, equations::CompressibleEulerEquations2D) + min_max_speed_einfeldt(u_ll, u_rr, normal_direction, equations::CompressibleEulerEquations2D) Computes the HLLE (Harten-Lax-van Leer-Einfeldt) flux for the compressible Euler equations. Special estimates of the signal velocites and linearization of the Riemann problem developed @@ -1356,7 +1324,7 @@ of the numerical flux. On Godunov-type methods near low densities. [DOI: 10.1016/0021-9991(91)90211-3](https://doi.org/10.1016/0021-9991(91)90211-3) """ -function flux_hlle(u_ll, u_rr, normal_direction::AbstractVector, +function min_max_speed_einfeldt(u_ll, u_rr, normal_direction::AbstractVector, equations::CompressibleEulerEquations2D) # Calculate primitive variables, enthalpy and speed of sound rho_ll, v1_ll, v2_ll, p_ll = cons2prim(u_ll, equations) @@ -1396,39 +1364,7 @@ function flux_hlle(u_ll, u_rr, normal_direction::AbstractVector, SsL = min(v_roe - c_roe, v_dot_n_ll - beta * c_ll, zero(v_roe)) SsR = max(v_roe + c_roe, v_dot_n_rr + beta * c_rr, zero(v_roe)) - if SsL >= 0.0 && SsR > 0.0 - # Positive supersonic speed - f_ll = flux(u_ll, normal_direction, equations) - - f1 = f_ll[1] - f2 = f_ll[2] - f3 = f_ll[3] - f4 = f_ll[4] - elseif SsR <= 0.0 && SsL < 0.0 - # Negative supersonic speed - f_rr = flux(u_rr, normal_direction, equations) - - f1 = f_rr[1] - f2 = f_rr[2] - f3 = f_rr[3] - f4 = f_rr[4] - else - # Subsonic case - # Compute left and right fluxes - f_ll = flux(u_ll, normal_direction, equations) - f_rr = flux(u_rr, normal_direction, equations) - - f1 = (SsR * f_ll[1] - SsL * f_rr[1] + SsL * SsR * (u_rr[1] - u_ll[1])) / - (SsR - SsL) - f2 = (SsR * f_ll[2] - SsL * f_rr[2] + SsL * SsR * (u_rr[2] - u_ll[2])) / - (SsR - SsL) - f3 = (SsR * f_ll[3] - SsL * f_rr[3] + SsL * SsR * (u_rr[3] - u_ll[3])) / - (SsR - SsL) - f4 = (SsR * f_ll[4] - SsL * f_rr[4] + SsL * SsR * (u_rr[4] - u_ll[4])) / - (SsR - SsL) - end - - return SVector(f1, f2, f3, f4) + return SsL, SsR end @inline function max_abs_speeds(u, equations::CompressibleEulerEquations2D) diff --git a/src/equations/compressible_euler_3d.jl b/src/equations/compressible_euler_3d.jl index 492727e7e5f..6de75347116 100644 --- a/src/equations/compressible_euler_3d.jl +++ b/src/equations/compressible_euler_3d.jl @@ -1322,7 +1322,7 @@ function flux_hllc(u_ll, u_rr, orientation::Integer, end """ - flux_hlle(u_ll, u_rr, orientation, equations::CompressibleEulerEquations3D) + min_max_speed_einfeldtmin_max_speed_einfeldt(u_ll, u_rr, orientation, equations::CompressibleEulerEquations3D) Computes the HLLE (Harten-Lax-van Leer-Einfeldt) flux for the compressible Euler equations. Special estimates of the signal velocites and linearization of the Riemann problem developed @@ -1336,7 +1336,7 @@ of the numerical flux. On Godunov-type methods near low densities. [DOI: 10.1016/0021-9991(91)90211-3](https://doi.org/10.1016/0021-9991(91)90211-3) """ -function flux_hlle(u_ll, u_rr, orientation::Integer, +function min_max_speed_einfeldt(u_ll, u_rr, orientation::Integer, equations::CompressibleEulerEquations3D) # Calculate primitive variables, enthalpy and speed of sound rho_ll, v1_ll, v2_ll, v3_ll, p_ll = cons2prim(u_ll, equations) @@ -1379,47 +1379,11 @@ function flux_hlle(u_ll, u_rr, orientation::Integer, SsR = max(v3_roe + c_roe, v3_rr + beta * c_rr, zero(v3_roe)) end - if SsL >= 0.0 && SsR > 0.0 - # Positive supersonic speed - f_ll = flux(u_ll, orientation, equations) - - f1 = f_ll[1] - f2 = f_ll[2] - f3 = f_ll[3] - f4 = f_ll[4] - f5 = f_ll[5] - elseif SsR <= 0.0 && SsL < 0.0 - # Negative supersonic speed - f_rr = flux(u_rr, orientation, equations) - - f1 = f_rr[1] - f2 = f_rr[2] - f3 = f_rr[3] - f4 = f_rr[4] - f5 = f_rr[5] - else - # Subsonic case - # Compute left and right fluxes - f_ll = flux(u_ll, orientation, equations) - f_rr = flux(u_rr, orientation, equations) - - f1 = (SsR * f_ll[1] - SsL * f_rr[1] + SsL * SsR * (u_rr[1] - u_ll[1])) / - (SsR - SsL) - f2 = (SsR * f_ll[2] - SsL * f_rr[2] + SsL * SsR * (u_rr[2] - u_ll[2])) / - (SsR - SsL) - f3 = (SsR * f_ll[3] - SsL * f_rr[3] + SsL * SsR * (u_rr[3] - u_ll[3])) / - (SsR - SsL) - f4 = (SsR * f_ll[4] - SsL * f_rr[4] + SsL * SsR * (u_rr[4] - u_ll[4])) / - (SsR - SsL) - f5 = (SsR * f_ll[5] - SsL * f_rr[5] + SsL * SsR * (u_rr[5] - u_ll[5])) / - (SsR - SsL) - end - - return SVector(f1, f2, f3, f4, f5) + return SsL, SsR end """ - flux_hlle(u_ll, u_rr, normal_direction, equations::CompressibleEulerEquations3D) + min_max_speed_einfeldt(u_ll, u_rr, normal_direction, equations::CompressibleEulerEquations3D) Computes the HLLE (Harten-Lax-van Leer-Einfeldt) flux for the compressible Euler equations. Special estimates of the signal velocites and linearization of the Riemann problem developed @@ -1433,7 +1397,7 @@ of the numerical flux. On Godunov-type methods near low densities. [DOI: 10.1016/0021-9991(91)90211-3](https://doi.org/10.1016/0021-9991(91)90211-3) """ -function flux_hlle(u_ll, u_rr, normal_direction::AbstractVector, +function min_max_speed_einfeldt(u_ll, u_rr, normal_direction::AbstractVector, equations::CompressibleEulerEquations3D) # Calculate primitive variables, enthalpy and speed of sound rho_ll, v1_ll, v2_ll, v3_ll, p_ll = cons2prim(u_ll, equations) @@ -1477,43 +1441,7 @@ function flux_hlle(u_ll, u_rr, normal_direction::AbstractVector, SsL = min(v_roe - c_roe, v_dot_n_ll - beta * c_ll, zero(v_roe)) SsR = max(v_roe + c_roe, v_dot_n_rr + beta * c_rr, zero(v_roe)) - if SsL >= 0.0 && SsR > 0.0 - # Positive supersonic speed - f_ll = flux(u_ll, normal_direction, equations) - - f1 = f_ll[1] - f2 = f_ll[2] - f3 = f_ll[3] - f4 = f_ll[4] - f5 = f_ll[5] - elseif SsR <= 0.0 && SsL < 0.0 - # Negative supersonic speed - f_rr = flux(u_rr, normal_direction, equations) - - f1 = f_rr[1] - f2 = f_rr[2] - f3 = f_rr[3] - f4 = f_rr[4] - f5 = f_rr[5] - else - # Subsonic case - # Compute left and right fluxes - f_ll = flux(u_ll, normal_direction, equations) - f_rr = flux(u_rr, normal_direction, equations) - - f1 = (SsR * f_ll[1] - SsL * f_rr[1] + SsL * SsR * (u_rr[1] - u_ll[1])) / - (SsR - SsL) - f2 = (SsR * f_ll[2] - SsL * f_rr[2] + SsL * SsR * (u_rr[2] - u_ll[2])) / - (SsR - SsL) - f3 = (SsR * f_ll[3] - SsL * f_rr[3] + SsL * SsR * (u_rr[3] - u_ll[3])) / - (SsR - SsL) - f4 = (SsR * f_ll[4] - SsL * f_rr[4] + SsL * SsR * (u_rr[4] - u_ll[4])) / - (SsR - SsL) - f5 = (SsR * f_ll[5] - SsL * f_rr[5] + SsL * SsR * (u_rr[5] - u_ll[5])) / - (SsR - SsL) - end - - return SVector(f1, f2, f3, f4, f5) + return SsL, SsR end @inline function max_abs_speeds(u, equations::CompressibleEulerEquations3D) From 8dbe9b3ea6281da2244a163c410a92746500b376 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Mon, 30 Oct 2023 17:22:47 +0100 Subject: [PATCH 04/19] format test --- test/test_unit.jl | 1358 ++++++++++++++++++++++++--------------------- 1 file changed, 716 insertions(+), 642 deletions(-) diff --git a/test/test_unit.jl b/test/test_unit.jl index 1fac9ec752b..a8f791ea1bc 100644 --- a/test/test_unit.jl +++ b/test/test_unit.jl @@ -7,396 +7,408 @@ include("test_trixi.jl") # Start with a clean environment: remove Trixi.jl output directory if it exists outdir = "out" -isdir(outdir) && rm(outdir, recursive=true) +isdir(outdir) && rm(outdir, recursive = true) # Run various unit (= non-elixir-triggered) tests @testset "Unit tests" begin - @timed_testset "SerialTree" begin +#! format: noindent + +@timed_testset "SerialTree" begin @testset "constructors" begin - @test_nowarn Trixi.SerialTree(Val(1), 10, 0.0, 1.0) + @test_nowarn Trixi.SerialTree(Val(1), 10, 0.0, 1.0) end @testset "helper functions" begin - t = Trixi.SerialTree(Val(1), 10, 0.0, 1.0) - @test_nowarn display(t) - @test Trixi.ndims(t) == 1 - @test Trixi.has_any_neighbor(t, 1, 1) == true - @test Trixi.isperiodic(t, 1) == true - @test Trixi.n_children_per_cell(t) == 2 - @test Trixi.n_directions(t) == 2 + t = Trixi.SerialTree(Val(1), 10, 0.0, 1.0) + @test_nowarn display(t) + @test Trixi.ndims(t) == 1 + @test Trixi.has_any_neighbor(t, 1, 1) == true + @test Trixi.isperiodic(t, 1) == true + @test Trixi.n_children_per_cell(t) == 2 + @test Trixi.n_directions(t) == 2 end @testset "refine!/coarsen!" begin - t = Trixi.SerialTree(Val(1), 10, 0.0, 1.0) - @test Trixi.refine!(t) == [1] - @test Trixi.coarsen!(t) == [1] - @test Trixi.refine!(t) == [1] - @test Trixi.coarsen!(t, 1) == [1] - @test Trixi.coarsen!(t) == Int[] # Coarsen twice to check degenerate case of single-cell tree - @test Trixi.refine!(t) == [1] - @test Trixi.refine!(t) == [2,3] - @test Trixi.coarsen_box!(t, [-0.5], [0.0]) == [2] - @test Trixi.coarsen_box!(t, 0.0, 0.5) == [3] - @test isnothing(Trixi.reset_data_structures!(t)) - end - end - - @timed_testset "ParallelTree" begin + t = Trixi.SerialTree(Val(1), 10, 0.0, 1.0) + @test Trixi.refine!(t) == [1] + @test Trixi.coarsen!(t) == [1] + @test Trixi.refine!(t) == [1] + @test Trixi.coarsen!(t, 1) == [1] + @test Trixi.coarsen!(t) == Int[] # Coarsen twice to check degenerate case of single-cell tree + @test Trixi.refine!(t) == [1] + @test Trixi.refine!(t) == [2, 3] + @test Trixi.coarsen_box!(t, [-0.5], [0.0]) == [2] + @test Trixi.coarsen_box!(t, 0.0, 0.5) == [3] + @test isnothing(Trixi.reset_data_structures!(t)) + end +end + +@timed_testset "ParallelTree" begin @testset "constructors" begin - @test_nowarn Trixi.ParallelTree(Val(1), 10, 0.0, 1.0) + @test_nowarn Trixi.ParallelTree(Val(1), 10, 0.0, 1.0) end @testset "helper functions" begin - t = Trixi.ParallelTree(Val(1), 10, 0.0, 1.0) - @test isnothing(display(t)) - @test isnothing(Trixi.reset_data_structures!(t)) + t = Trixi.ParallelTree(Val(1), 10, 0.0, 1.0) + @test isnothing(display(t)) + @test isnothing(Trixi.reset_data_structures!(t)) end - end +end - @timed_testset "TreeMesh" begin +@timed_testset "TreeMesh" begin @testset "constructors" begin - @test TreeMesh{1, Trixi.SerialTree{1}}(1, 5.0, 2.0) isa TreeMesh + @test TreeMesh{1, Trixi.SerialTree{1}}(1, 5.0, 2.0) isa TreeMesh end - end +end - @timed_testset "ParallelTreeMesh" begin +@timed_testset "ParallelTreeMesh" begin @testset "partition!" begin - @testset "mpi_nranks() = 2" begin - Trixi.mpi_nranks() = 2 - let - @test Trixi.mpi_nranks() == 2 - - mesh = TreeMesh{2, Trixi.ParallelTree{2}}(30, (0.0, 0.0), 1) - # Refine twice - Trixi.refine!(mesh.tree) - Trixi.refine!(mesh.tree) - - # allow_coarsening = true - Trixi.partition!(mesh) - # Use parent for OffsetArray - @test parent(mesh.n_cells_by_rank) == [11, 10] - @test mesh.tree.mpi_ranks[1:21] == - [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] - @test parent(mesh.first_cell_by_rank) == [1, 12] - - # allow_coarsening = false - Trixi.partition!(mesh; allow_coarsening=false) - @test parent(mesh.n_cells_by_rank) == [11, 10] - @test mesh.tree.mpi_ranks[1:21] == - [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] - @test parent(mesh.first_cell_by_rank) == [1, 12] + @testset "mpi_nranks() = 2" begin + Trixi.mpi_nranks() = 2 + let + @test Trixi.mpi_nranks() == 2 + + mesh = TreeMesh{2, Trixi.ParallelTree{2}}(30, (0.0, 0.0), 1) + # Refine twice + Trixi.refine!(mesh.tree) + Trixi.refine!(mesh.tree) + + # allow_coarsening = true + Trixi.partition!(mesh) + # Use parent for OffsetArray + @test parent(mesh.n_cells_by_rank) == [11, 10] + @test mesh.tree.mpi_ranks[1:21] == + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] + @test parent(mesh.first_cell_by_rank) == [1, 12] + + # allow_coarsening = false + Trixi.partition!(mesh; allow_coarsening = false) + @test parent(mesh.n_cells_by_rank) == [11, 10] + @test mesh.tree.mpi_ranks[1:21] == + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] + @test parent(mesh.first_cell_by_rank) == [1, 12] + end + Trixi.mpi_nranks() = Trixi.MPI_SIZE[] # restore the original behavior end - Trixi.mpi_nranks() = Trixi.MPI_SIZE[] # restore the original behavior - end - - @testset "mpi_nranks() = 3" begin - Trixi.mpi_nranks() = 3 - let - @test Trixi.mpi_nranks() == 3 - - mesh = TreeMesh{2, Trixi.ParallelTree{2}}(100, (0.0, 0.0), 1) - # Refine twice - Trixi.refine!(mesh.tree) - Trixi.refine!(mesh.tree) - - # allow_coarsening = true - Trixi.partition!(mesh) - # Use parent for OffsetArray - @test parent(mesh.n_cells_by_rank) == [11, 5, 5] - @test mesh.tree.mpi_ranks[1:21] == - [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2] - @test parent(mesh.first_cell_by_rank) == [1, 12, 17] - - # allow_coarsening = false - Trixi.partition!(mesh; allow_coarsening=false) - @test parent(mesh.n_cells_by_rank) == [9, 6, 6] - @test mesh.tree.mpi_ranks[1:21] == - [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2] - @test parent(mesh.first_cell_by_rank) == [1, 10, 16] + + @testset "mpi_nranks() = 3" begin + Trixi.mpi_nranks() = 3 + let + @test Trixi.mpi_nranks() == 3 + + mesh = TreeMesh{2, Trixi.ParallelTree{2}}(100, (0.0, 0.0), 1) + # Refine twice + Trixi.refine!(mesh.tree) + Trixi.refine!(mesh.tree) + + # allow_coarsening = true + Trixi.partition!(mesh) + # Use parent for OffsetArray + @test parent(mesh.n_cells_by_rank) == [11, 5, 5] + @test mesh.tree.mpi_ranks[1:21] == + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2] + @test parent(mesh.first_cell_by_rank) == [1, 12, 17] + + # allow_coarsening = false + Trixi.partition!(mesh; allow_coarsening = false) + @test parent(mesh.n_cells_by_rank) == [9, 6, 6] + @test mesh.tree.mpi_ranks[1:21] == + [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2] + @test parent(mesh.first_cell_by_rank) == [1, 10, 16] + end + Trixi.mpi_nranks() = Trixi.MPI_SIZE[] # restore the original behavior end - Trixi.mpi_nranks() = Trixi.MPI_SIZE[] # restore the original behavior - end - - @testset "mpi_nranks() = 9" begin - Trixi.mpi_nranks() = 9 - let - @test Trixi.mpi_nranks() == 9 - - mesh = TreeMesh{2, Trixi.ParallelTree{2}}(1000, (0.0, 0.0), 1) - # Refine twice - Trixi.refine!(mesh.tree) - Trixi.refine!(mesh.tree) - Trixi.refine!(mesh.tree) - Trixi.refine!(mesh.tree) - - # allow_coarsening = true - Trixi.partition!(mesh) - # Use parent for OffsetArray - @test parent(mesh.n_cells_by_rank) == [44, 37, 38, 37, 37, 37, 38, 37, 36] - @test parent(mesh.first_cell_by_rank) == [1, 45, 82, 120, 157, 194, 231, 269, 306] + + @testset "mpi_nranks() = 9" begin + Trixi.mpi_nranks() = 9 + let + @test Trixi.mpi_nranks() == 9 + + mesh = TreeMesh{2, Trixi.ParallelTree{2}}(1000, (0.0, 0.0), 1) + # Refine twice + Trixi.refine!(mesh.tree) + Trixi.refine!(mesh.tree) + Trixi.refine!(mesh.tree) + Trixi.refine!(mesh.tree) + + # allow_coarsening = true + Trixi.partition!(mesh) + # Use parent for OffsetArray + @test parent(mesh.n_cells_by_rank) == + [44, 37, 38, 37, 37, 37, 38, 37, 36] + @test parent(mesh.first_cell_by_rank) == + [1, 45, 82, 120, 157, 194, 231, 269, 306] + end + Trixi.mpi_nranks() = Trixi.MPI_SIZE[] # restore the original behavior end - Trixi.mpi_nranks() = Trixi.MPI_SIZE[] # restore the original behavior - end - - @testset "mpi_nranks() = 3 non-uniform" begin - Trixi.mpi_nranks() = 3 - let - @test Trixi.mpi_nranks() == 3 - - mesh = TreeMesh{2, Trixi.ParallelTree{2}}(100, (0.0, 0.0), 1) - # Refine whole tree - Trixi.refine!(mesh.tree) - # Refine left leaf - Trixi.refine!(mesh.tree, [2]) - - # allow_coarsening = true - Trixi.partition!(mesh) - # Use parent for OffsetArray - @test parent(mesh.n_cells_by_rank) == [6, 1, 2] - @test mesh.tree.mpi_ranks[1:9] == [0, 0, 0, 0, 0, 0, 1, 2, 2] - @test parent(mesh.first_cell_by_rank) == [1, 7, 8] - - # allow_coarsening = false - Trixi.partition!(mesh; allow_coarsening=false) - @test parent(mesh.n_cells_by_rank) == [5, 2, 2] - @test mesh.tree.mpi_ranks[1:9] == [0, 0, 0, 0, 0, 1, 1, 2, 2] - @test parent(mesh.first_cell_by_rank) == [1, 6, 8] + + @testset "mpi_nranks() = 3 non-uniform" begin + Trixi.mpi_nranks() = 3 + let + @test Trixi.mpi_nranks() == 3 + + mesh = TreeMesh{2, Trixi.ParallelTree{2}}(100, (0.0, 0.0), 1) + # Refine whole tree + Trixi.refine!(mesh.tree) + # Refine left leaf + Trixi.refine!(mesh.tree, [2]) + + # allow_coarsening = true + Trixi.partition!(mesh) + # Use parent for OffsetArray + @test parent(mesh.n_cells_by_rank) == [6, 1, 2] + @test mesh.tree.mpi_ranks[1:9] == [0, 0, 0, 0, 0, 0, 1, 2, 2] + @test parent(mesh.first_cell_by_rank) == [1, 7, 8] + + # allow_coarsening = false + Trixi.partition!(mesh; allow_coarsening = false) + @test parent(mesh.n_cells_by_rank) == [5, 2, 2] + @test mesh.tree.mpi_ranks[1:9] == [0, 0, 0, 0, 0, 1, 1, 2, 2] + @test parent(mesh.first_cell_by_rank) == [1, 6, 8] + end + Trixi.mpi_nranks() = Trixi.MPI_SIZE[] # restore the original behavior end - Trixi.mpi_nranks() = Trixi.MPI_SIZE[] # restore the original behavior - end - @testset "not enough ranks" begin - Trixi.mpi_nranks() = 3 - let - @test Trixi.mpi_nranks() == 3 + @testset "not enough ranks" begin + Trixi.mpi_nranks() = 3 + let + @test Trixi.mpi_nranks() == 3 - mesh = TreeMesh{2, Trixi.ParallelTree{2}}(100, (0.0, 0.0), 1) + mesh = TreeMesh{2, Trixi.ParallelTree{2}}(100, (0.0, 0.0), 1) - # Only one leaf - @test_throws AssertionError( - "Too many ranks to properly partition the mesh!") Trixi.partition!(mesh) + # Only one leaf + @test_throws AssertionError("Too many ranks to properly partition the mesh!") Trixi.partition!(mesh) - # Refine to 4 leaves - Trixi.refine!(mesh.tree) + # Refine to 4 leaves + Trixi.refine!(mesh.tree) - # All four leaves will need to be on one rank to allow coarsening - @test_throws AssertionError( - "Too many ranks to properly partition the mesh!") Trixi.partition!(mesh) - @test_nowarn Trixi.partition!(mesh; allow_coarsening=false) + # All four leaves will need to be on one rank to allow coarsening + @test_throws AssertionError("Too many ranks to properly partition the mesh!") Trixi.partition!(mesh) + @test_nowarn Trixi.partition!(mesh; allow_coarsening = false) + end + Trixi.mpi_nranks() = Trixi.MPI_SIZE[] # restore the original behavior end - Trixi.mpi_nranks() = Trixi.MPI_SIZE[] # restore the original behavior - end end - end +end - @timed_testset "curved mesh" begin +@timed_testset "curved mesh" begin @testset "calc_jacobian_matrix" begin - @testset "identity map" begin - basis = LobattoLegendreBasis(5) - nodes = Trixi.get_nodes(basis) - jacobian_matrix = Array{Float64, 5}(undef, 2, 2, 6, 6, 1) - - node_coordinates = Array{Float64, 4}(undef, 2, 6, 6, 1) - node_coordinates[1, :, :, 1] .= [nodes[i] for i in 1:6, j in 1:6] - node_coordinates[2, :, :, 1] .= [nodes[j] for i in 1:6, j in 1:6] - expected = zeros(2, 2, 6, 6, 1) - expected[1, 1, :, :, 1] .= 1 - expected[2, 2, :, :, 1] .= 1 - @test Trixi.calc_jacobian_matrix!(jacobian_matrix, 1, node_coordinates, basis) ≈ expected - end - - @testset "maximum exact polydeg" begin - basis = LobattoLegendreBasis(3) - nodes = Trixi.get_nodes(basis) - jacobian_matrix = Array{Float64, 5}(undef, 2, 2, 4, 4, 1) - - # f(x, y) = [x^3, xy^2] - node_coordinates = Array{Float64, 4}(undef, 2, 4, 4, 1) - node_coordinates[1, :, :, 1] .= [nodes[i]^3 for i in 1:4, j in 1:4] - node_coordinates[2, :, :, 1] .= [nodes[i] * nodes[j]^2 for i in 1:4, j in 1:4] - - # Df(x, y) = [3x^2 0; - # y^2 2xy] - expected = zeros(2, 2, 4, 4, 1) - expected[1, 1, :, :, 1] .= [3 * nodes[i]^2 for i in 1:4, j in 1:4] - expected[2, 1, :, :, 1] .= [nodes[j]^2 for i in 1:4, j in 1:4] - expected[2, 2, :, :, 1] .= [2 * nodes[i] * nodes[j] for i in 1:4, j in 1:4] - @test Trixi.calc_jacobian_matrix!(jacobian_matrix, 1, node_coordinates, basis) ≈ expected - end - end - end - - @timed_testset "interpolation" begin + @testset "identity map" begin + basis = LobattoLegendreBasis(5) + nodes = Trixi.get_nodes(basis) + jacobian_matrix = Array{Float64, 5}(undef, 2, 2, 6, 6, 1) + + node_coordinates = Array{Float64, 4}(undef, 2, 6, 6, 1) + node_coordinates[1, :, :, 1] .= [nodes[i] for i in 1:6, j in 1:6] + node_coordinates[2, :, :, 1] .= [nodes[j] for i in 1:6, j in 1:6] + expected = zeros(2, 2, 6, 6, 1) + expected[1, 1, :, :, 1] .= 1 + expected[2, 2, :, :, 1] .= 1 + @test Trixi.calc_jacobian_matrix!(jacobian_matrix, 1, node_coordinates, + basis) ≈ expected + end + + @testset "maximum exact polydeg" begin + basis = LobattoLegendreBasis(3) + nodes = Trixi.get_nodes(basis) + jacobian_matrix = Array{Float64, 5}(undef, 2, 2, 4, 4, 1) + + # f(x, y) = [x^3, xy^2] + node_coordinates = Array{Float64, 4}(undef, 2, 4, 4, 1) + node_coordinates[1, :, :, 1] .= [nodes[i]^3 for i in 1:4, j in 1:4] + node_coordinates[2, :, :, 1] .= [nodes[i] * nodes[j]^2 + for i in 1:4, j in 1:4] + + # Df(x, y) = [3x^2 0; + # y^2 2xy] + expected = zeros(2, 2, 4, 4, 1) + expected[1, 1, :, :, 1] .= [3 * nodes[i]^2 for i in 1:4, j in 1:4] + expected[2, 1, :, :, 1] .= [nodes[j]^2 for i in 1:4, j in 1:4] + expected[2, 2, :, :, 1] .= [2 * nodes[i] * nodes[j] for i in 1:4, j in 1:4] + @test Trixi.calc_jacobian_matrix!(jacobian_matrix, 1, node_coordinates, + basis) ≈ expected + end + end +end + +@timed_testset "interpolation" begin @testset "nodes and weights" begin - @test Trixi.gauss_nodes_weights(1) == ([0.0], [2.0]) + @test Trixi.gauss_nodes_weights(1) == ([0.0], [2.0]) end @testset "multiply_dimensionwise" begin - nodes_in = [0.0, 0.5, 1.0] - nodes_out = [0.0, 1/3, 2/3, 1.0] - matrix = Trixi.polynomial_interpolation_matrix(nodes_in, nodes_out) - data_in = [3.0 4.5 6.0] - @test isapprox(Trixi.multiply_dimensionwise(matrix, data_in), [3.0 4.0 5.0 6.0]) - - n_vars = 3 - size_in = 2 - size_out = 3 - matrix = randn(size_out, size_in) - # 1D - data_in = randn(n_vars, size_in) - data_out = Trixi.multiply_dimensionwise_naive(matrix, data_in) - @test isapprox(data_out, Trixi.multiply_dimensionwise(matrix, data_in)) - # 2D - data_in = randn(n_vars, size_in, size_in) - data_out = Trixi.multiply_dimensionwise_naive(matrix, data_in) - @test isapprox(data_out, Trixi.multiply_dimensionwise(matrix, data_in)) - # 3D - data_in = randn(n_vars, size_in, size_in, size_in) - data_out = Trixi.multiply_dimensionwise_naive(matrix, data_in) - @test isapprox(data_out, Trixi.multiply_dimensionwise(matrix, data_in)) - end - end - - @timed_testset "L2 projection" begin + nodes_in = [0.0, 0.5, 1.0] + nodes_out = [0.0, 1 / 3, 2 / 3, 1.0] + matrix = Trixi.polynomial_interpolation_matrix(nodes_in, nodes_out) + data_in = [3.0 4.5 6.0] + @test isapprox(Trixi.multiply_dimensionwise(matrix, data_in), [3.0 4.0 5.0 6.0]) + + n_vars = 3 + size_in = 2 + size_out = 3 + matrix = randn(size_out, size_in) + # 1D + data_in = randn(n_vars, size_in) + data_out = Trixi.multiply_dimensionwise_naive(matrix, data_in) + @test isapprox(data_out, Trixi.multiply_dimensionwise(matrix, data_in)) + # 2D + data_in = randn(n_vars, size_in, size_in) + data_out = Trixi.multiply_dimensionwise_naive(matrix, data_in) + @test isapprox(data_out, Trixi.multiply_dimensionwise(matrix, data_in)) + # 3D + data_in = randn(n_vars, size_in, size_in, size_in) + data_out = Trixi.multiply_dimensionwise_naive(matrix, data_in) + @test isapprox(data_out, Trixi.multiply_dimensionwise(matrix, data_in)) + end +end + +@timed_testset "L2 projection" begin @testset "calc_reverse_upper for LGL" begin - @test isapprox(Trixi.calc_reverse_upper(2, Val(:gauss_lobatto)), [[0.25, 0.25] [0.0, 0.5]]) + @test isapprox(Trixi.calc_reverse_upper(2, Val(:gauss_lobatto)), + [[0.25, 0.25] [0.0, 0.5]]) end @testset "calc_reverse_lower for LGL" begin - @test isapprox(Trixi.calc_reverse_lower(2, Val(:gauss_lobatto)), [[0.5, 0.0] [0.25, 0.25]]) + @test isapprox(Trixi.calc_reverse_lower(2, Val(:gauss_lobatto)), + [[0.5, 0.0] [0.25, 0.25]]) end - end +end - @testset "containers" begin +@testset "containers" begin # Set up mock container mutable struct MyContainer <: Trixi.AbstractContainer - data::Vector{Int} - capacity::Int - length::Int - dummy::Int + data::Vector{Int} + capacity::Int + length::Int + dummy::Int end function MyContainer(data, capacity) - c = MyContainer(Vector{Int}(undef, capacity+1), capacity, length(data), capacity+1) - c.data[1:length(data)] .= data - return c + c = MyContainer(Vector{Int}(undef, capacity + 1), capacity, length(data), + capacity + 1) + c.data[1:length(data)] .= data + return c end MyContainer(data::AbstractArray) = MyContainer(data, length(data)) Trixi.invalidate!(c::MyContainer, first, last) = (c.data[first:last] .= 0; c) - function Trixi.raw_copy!(target::MyContainer, source::MyContainer, first, last, destination) - Trixi.copy_data!(target.data, source.data, first, last, destination) - return target + function Trixi.raw_copy!(target::MyContainer, source::MyContainer, first, last, + destination) + Trixi.copy_data!(target.data, source.data, first, last, destination) + return target end Trixi.move_connectivity!(c::MyContainer, first, last, destination) = c Trixi.delete_connectivity!(c::MyContainer, first, last) = c - Trixi.reset_data_structures!(c::MyContainer) = (c.data = Vector{Int}(undef, c.capacity+1); c) + Trixi.reset_data_structures!(c::MyContainer) = (c.data = Vector{Int}(undef, + c.capacity + 1); + c) function Base.:(==)(c1::MyContainer, c2::MyContainer) - return (c1.capacity == c2.capacity && - c1.length == c2.length && - c1.dummy == c2.dummy && - c1.data[1:c1.length] == c2.data[1:c2.length]) + return (c1.capacity == c2.capacity && + c1.length == c2.length && + c1.dummy == c2.dummy && + c1.data[1:(c1.length)] == c2.data[1:(c2.length)]) end @testset "size" begin - c = MyContainer([1, 2, 3]) - @test size(c) == (3,) + c = MyContainer([1, 2, 3]) + @test size(c) == (3,) end @testset "resize!" begin - c = MyContainer([1, 2, 3]) - @test length(resize!(c, 2)) == 2 + c = MyContainer([1, 2, 3]) + @test length(resize!(c, 2)) == 2 end @testset "copy!" begin - c1 = MyContainer([1, 2, 3]) - c2 = MyContainer([4, 5]) - @test Trixi.copy!(c1, c2, 2, 1, 2) == MyContainer([1, 2, 3]) # no-op + c1 = MyContainer([1, 2, 3]) + c2 = MyContainer([4, 5]) + @test Trixi.copy!(c1, c2, 2, 1, 2) == MyContainer([1, 2, 3]) # no-op - c1 = MyContainer([1, 2, 3]) - c2 = MyContainer([4, 5]) - @test Trixi.copy!(c1, c2, 1, 2, 2) == MyContainer([1, 4, 5]) + c1 = MyContainer([1, 2, 3]) + c2 = MyContainer([4, 5]) + @test Trixi.copy!(c1, c2, 1, 2, 2) == MyContainer([1, 4, 5]) - c1 = MyContainer([1, 2, 3]) - @test Trixi.copy!(c1, c2, 1, 2) == MyContainer([1, 4, 3]) + c1 = MyContainer([1, 2, 3]) + @test Trixi.copy!(c1, c2, 1, 2) == MyContainer([1, 4, 3]) - c1 = MyContainer([1, 2, 3]) - @test Trixi.copy!(c1, 2, 3, 1) == MyContainer([2, 3, 3]) + c1 = MyContainer([1, 2, 3]) + @test Trixi.copy!(c1, 2, 3, 1) == MyContainer([2, 3, 3]) - c1 = MyContainer([1, 2, 3]) - @test Trixi.copy!(c1, 1, 3) == MyContainer([1, 2, 1]) + c1 = MyContainer([1, 2, 3]) + @test Trixi.copy!(c1, 1, 3) == MyContainer([1, 2, 1]) end @testset "move!" begin - c = MyContainer([1, 2, 3]) - @test Trixi.move!(c, 1, 1) == MyContainer([1, 2, 3]) # no-op + c = MyContainer([1, 2, 3]) + @test Trixi.move!(c, 1, 1) == MyContainer([1, 2, 3]) # no-op - c = MyContainer([1, 2, 3]) - @test Trixi.move!(c, 1, 2) == MyContainer([0, 1, 3]) + c = MyContainer([1, 2, 3]) + @test Trixi.move!(c, 1, 2) == MyContainer([0, 1, 3]) end @testset "swap!" begin - c = MyContainer([1,2]) - @test Trixi.swap!(c, 1, 1) == MyContainer([1, 2]) # no-op + c = MyContainer([1, 2]) + @test Trixi.swap!(c, 1, 1) == MyContainer([1, 2]) # no-op - c = MyContainer([1,2]) - @test Trixi.swap!(c, 1, 2) == MyContainer([2,1]) + c = MyContainer([1, 2]) + @test Trixi.swap!(c, 1, 2) == MyContainer([2, 1]) end @testset "erase!" begin - c = MyContainer([1, 2]) - @test Trixi.erase!(c, 2, 1) == MyContainer([1, 2]) # no-op + c = MyContainer([1, 2]) + @test Trixi.erase!(c, 2, 1) == MyContainer([1, 2]) # no-op - c = MyContainer([1, 2]) - @test Trixi.erase!(c, 1) == MyContainer([0, 2]) + c = MyContainer([1, 2]) + @test Trixi.erase!(c, 1) == MyContainer([0, 2]) end @testset "remove_shift!" begin - c = MyContainer([1, 2, 3, 4]) - @test Trixi.remove_shift!(c, 2, 1) == MyContainer([1, 2, 3, 4]) # no-op + c = MyContainer([1, 2, 3, 4]) + @test Trixi.remove_shift!(c, 2, 1) == MyContainer([1, 2, 3, 4]) # no-op - c = MyContainer([1, 2, 3, 4]) - @test Trixi.remove_shift!(c, 2, 2) == MyContainer([1, 3, 4], 4) + c = MyContainer([1, 2, 3, 4]) + @test Trixi.remove_shift!(c, 2, 2) == MyContainer([1, 3, 4], 4) - c = MyContainer([1, 2, 3, 4]) - @test Trixi.remove_shift!(c, 2) == MyContainer([1, 3, 4], 4) + c = MyContainer([1, 2, 3, 4]) + @test Trixi.remove_shift!(c, 2) == MyContainer([1, 3, 4], 4) end @testset "remove_fill!" begin - c = MyContainer([1, 2, 3, 4]) - @test Trixi.remove_fill!(c, 2, 1) == MyContainer([1, 2, 3, 4]) # no-op + c = MyContainer([1, 2, 3, 4]) + @test Trixi.remove_fill!(c, 2, 1) == MyContainer([1, 2, 3, 4]) # no-op - c = MyContainer([1, 2, 3, 4]) - @test Trixi.remove_fill!(c, 2, 2) == MyContainer([1, 4, 3], 4) + c = MyContainer([1, 2, 3, 4]) + @test Trixi.remove_fill!(c, 2, 2) == MyContainer([1, 4, 3], 4) end @testset "reset!" begin - c = MyContainer([1, 2, 3]) - @test Trixi.reset!(c, 2) == MyContainer(Int[], 2) + c = MyContainer([1, 2, 3]) + @test Trixi.reset!(c, 2) == MyContainer(Int[], 2) end - end +end - @timed_testset "example elixirs" begin +@timed_testset "example elixirs" begin @test basename(examples_dir()) == "examples" @test !isempty(get_examples()) @test endswith(default_example(), "elixir_advection_basic.jl") - end +end - @timed_testset "HLL flux with vanishing wave speed estimates (#502)" begin +@timed_testset "HLL flux with vanishing wave speed estimates (#502)" begin equations = CompressibleEulerEquations1D(1.4) u = SVector(1.0, 0.0, 0.0) @test !any(isnan, flux_hll(u, u, 1, equations)) - end +end - @timed_testset "DG L2 mortar container debug output" begin +@timed_testset "DG L2 mortar container debug output" begin c2d = Trixi.L2MortarContainer2D{Float64}(1, 1, 1) @test isnothing(display(c2d)) c3d = Trixi.L2MortarContainer3D{Float64}(1, 1, 1) @test isnothing(display(c3d)) - end +end - @timed_testset "Printing indicators/controllers" begin +@timed_testset "Printing indicators/controllers" begin # OBS! Constructing indicators/controllers using the parameters below doesn't make sense. It's # just useful to run basic tests of `show` methods. - c = ControllerThreeLevelCombined(1, 2, 3, 10.0, 11.0, 12.0, "primary", "secondary", "cache") + c = ControllerThreeLevelCombined(1, 2, 3, 10.0, 11.0, 12.0, "primary", "secondary", + "cache") @test_nowarn show(stdout, c) indicator_hg = IndicatorHennemannGassner(1.0, 0.0, true, "variable", "cache") @@ -406,194 +418,208 @@ isdir(outdir) && rm(outdir, recursive=true) @test_nowarn show(stdout, limiter_idp) # TODO: TrixiShallowWater: move unit test - indicator_hg_swe = IndicatorHennemannGassnerShallowWater(1.0, 0.0, true, "variable", "cache") + indicator_hg_swe = IndicatorHennemannGassnerShallowWater(1.0, 0.0, true, "variable", + "cache") @test_nowarn show(stdout, indicator_hg_swe) - indicator_loehner = IndicatorLöhner(1.0, "variable", (; cache=nothing)) + indicator_loehner = IndicatorLöhner(1.0, "variable", (; cache = nothing)) @test_nowarn show(stdout, indicator_loehner) - indicator_max = IndicatorMax("variable", (; cache=nothing)) + indicator_max = IndicatorMax("variable", (; cache = nothing)) @test_nowarn show(stdout, indicator_max) equations = CompressibleEulerEquations2D(1.4) basis = LobattoLegendreBasis(3) - indicator_neuralnetwork = IndicatorNeuralNetwork( - equations, basis, indicator_type=NeuralNetworkPerssonPeraire(), variable=density, - network=nothing) + indicator_neuralnetwork = IndicatorNeuralNetwork(equations, basis, + indicator_type = NeuralNetworkPerssonPeraire(), + variable = density, + network = nothing) @test_nowarn show(stdout, indicator_neuralnetwork) - end +end - @timed_testset "LBM 2D constructor" begin +@timed_testset "LBM 2D constructor" begin # Neither Mach number nor velocity set - @test_throws ErrorException LatticeBoltzmannEquations2D(Ma=nothing, Re=1000) + @test_throws ErrorException LatticeBoltzmannEquations2D(Ma = nothing, Re = 1000) # Both Mach number and velocity set - @test_throws ErrorException LatticeBoltzmannEquations2D(Ma=0.1, Re=1000, u0=1) + @test_throws ErrorException LatticeBoltzmannEquations2D(Ma = 0.1, Re = 1000, u0 = 1) # Neither Reynolds number nor viscosity set - @test_throws ErrorException LatticeBoltzmannEquations2D(Ma=0.1, Re=nothing) + @test_throws ErrorException LatticeBoltzmannEquations2D(Ma = 0.1, Re = nothing) # Both Reynolds number and viscosity set - @test_throws ErrorException LatticeBoltzmannEquations2D(Ma=0.1, Re=1000, nu=1) + @test_throws ErrorException LatticeBoltzmannEquations2D(Ma = 0.1, Re = 1000, nu = 1) # No non-dimensional values set - @test LatticeBoltzmannEquations2D(Ma=nothing, Re=nothing, u0=1, nu=1) isa LatticeBoltzmannEquations2D - end + @test LatticeBoltzmannEquations2D(Ma = nothing, Re = nothing, u0 = 1, nu = 1) isa + LatticeBoltzmannEquations2D +end - @timed_testset "LBM 3D constructor" begin +@timed_testset "LBM 3D constructor" begin # Neither Mach number nor velocity set - @test_throws ErrorException LatticeBoltzmannEquations3D(Ma=nothing, Re=1000) + @test_throws ErrorException LatticeBoltzmannEquations3D(Ma = nothing, Re = 1000) # Both Mach number and velocity set - @test_throws ErrorException LatticeBoltzmannEquations3D(Ma=0.1, Re=1000, u0=1) + @test_throws ErrorException LatticeBoltzmannEquations3D(Ma = 0.1, Re = 1000, u0 = 1) # Neither Reynolds number nor viscosity set - @test_throws ErrorException LatticeBoltzmannEquations3D(Ma=0.1, Re=nothing) + @test_throws ErrorException LatticeBoltzmannEquations3D(Ma = 0.1, Re = nothing) # Both Reynolds number and viscosity set - @test_throws ErrorException LatticeBoltzmannEquations3D(Ma=0.1, Re=1000, nu=1) + @test_throws ErrorException LatticeBoltzmannEquations3D(Ma = 0.1, Re = 1000, nu = 1) # No non-dimensional values set - @test LatticeBoltzmannEquations3D(Ma=nothing, Re=nothing, u0=1, nu=1) isa LatticeBoltzmannEquations3D - end + @test LatticeBoltzmannEquations3D(Ma = nothing, Re = nothing, u0 = 1, nu = 1) isa + LatticeBoltzmannEquations3D +end - @timed_testset "LBM 2D functions" begin +@timed_testset "LBM 2D functions" begin # Set up LBM struct and dummy distribution - equation = LatticeBoltzmannEquations2D(Ma=0.1, Re=1000) + equation = LatticeBoltzmannEquations2D(Ma = 0.1, Re = 1000) u = Trixi.equilibrium_distribution(1, 2, 3, equation) # Component-wise velocity @test isapprox(Trixi.velocity(u, 1, equation), 2) @test isapprox(Trixi.velocity(u, 2, equation), 3) - end +end - @timed_testset "LBM 3D functions" begin +@timed_testset "LBM 3D functions" begin # Set up LBM struct and dummy distribution - equation = LatticeBoltzmannEquations3D(Ma=0.1, Re=1000) + equation = LatticeBoltzmannEquations3D(Ma = 0.1, Re = 1000) u = Trixi.equilibrium_distribution(1, 2, 3, 4, equation) # Component-wise velocity @test isapprox(velocity(u, 1, equation), 2) @test isapprox(velocity(u, 2, equation), 3) @test isapprox(velocity(u, 3, equation), 4) - end +end - @timed_testset "LBMCollisionCallback" begin +@timed_testset "LBMCollisionCallback" begin # Printing of LBM collision callback callback = LBMCollisionCallback() @test_nowarn show(stdout, callback) println() @test_nowarn show(stdout, "text/plain", callback) println() - end +end - @timed_testset "Acoustic perturbation 2D varnames" begin +@timed_testset "Acoustic perturbation 2D varnames" begin v_mean_global = (0.0, 0.0) c_mean_global = 1.0 rho_mean_global = 1.0 - equations = AcousticPerturbationEquations2D(v_mean_global, c_mean_global, rho_mean_global) + equations = AcousticPerturbationEquations2D(v_mean_global, c_mean_global, + rho_mean_global) - @test Trixi.varnames(cons2state, equations) == ("v1_prime", "v2_prime", "p_prime_scaled") - @test Trixi.varnames(cons2mean, equations) == ("v1_mean", "v2_mean", "c_mean", "rho_mean") - end + @test Trixi.varnames(cons2state, equations) == + ("v1_prime", "v2_prime", "p_prime_scaled") + @test Trixi.varnames(cons2mean, equations) == + ("v1_mean", "v2_mean", "c_mean", "rho_mean") +end - @timed_testset "Euler conversion between conservative/entropy variables" begin +@timed_testset "Euler conversion between conservative/entropy variables" begin rho, v1, v2, v3, p = 1.0, 0.1, 0.2, 0.3, 2.0 let equations = CompressibleEulerEquations1D(1.4) - cons_vars = prim2cons(SVector(rho, v1, p),equations) - entropy_vars = cons2entropy(cons_vars, equations) - @test cons_vars ≈ entropy2cons(entropy_vars, equations) + cons_vars = prim2cons(SVector(rho, v1, p), equations) + entropy_vars = cons2entropy(cons_vars, equations) + @test cons_vars ≈ entropy2cons(entropy_vars, equations) - # test tuple args - cons_vars = prim2cons((rho, v1, p),equations) - entropy_vars = cons2entropy(cons_vars, equations) - @test cons_vars ≈ entropy2cons(entropy_vars, equations) + # test tuple args + cons_vars = prim2cons((rho, v1, p), equations) + entropy_vars = cons2entropy(cons_vars, equations) + @test cons_vars ≈ entropy2cons(entropy_vars, equations) end let equations = CompressibleEulerEquations2D(1.4) - cons_vars = prim2cons(SVector(rho,v1,v2,p),equations) - entropy_vars = cons2entropy(cons_vars,equations) - @test cons_vars ≈ entropy2cons(entropy_vars,equations) + cons_vars = prim2cons(SVector(rho, v1, v2, p), equations) + entropy_vars = cons2entropy(cons_vars, equations) + @test cons_vars ≈ entropy2cons(entropy_vars, equations) - # test tuple args - cons_vars = prim2cons((rho, v1, v2, p), equations) - entropy_vars = cons2entropy(cons_vars, equations) - @test cons_vars ≈ entropy2cons(entropy_vars, equations) + # test tuple args + cons_vars = prim2cons((rho, v1, v2, p), equations) + entropy_vars = cons2entropy(cons_vars, equations) + @test cons_vars ≈ entropy2cons(entropy_vars, equations) end let equations = CompressibleEulerEquations3D(1.4) - cons_vars = prim2cons(SVector(rho,v1,v2,v3,p),equations) - entropy_vars = cons2entropy(cons_vars,equations) - @test cons_vars ≈ entropy2cons(entropy_vars,equations) + cons_vars = prim2cons(SVector(rho, v1, v2, v3, p), equations) + entropy_vars = cons2entropy(cons_vars, equations) + @test cons_vars ≈ entropy2cons(entropy_vars, equations) - # test tuple args - cons_vars = prim2cons((rho, v1, v2, v3, p), equations) - entropy_vars = cons2entropy(cons_vars, equations) - @test cons_vars ≈ entropy2cons(entropy_vars, equations) + # test tuple args + cons_vars = prim2cons((rho, v1, v2, v3, p), equations) + entropy_vars = cons2entropy(cons_vars, equations) + @test cons_vars ≈ entropy2cons(entropy_vars, equations) end - end +end - @timed_testset "Shallow water conversion between conservative/entropy variables" begin +@timed_testset "Shallow water conversion between conservative/entropy variables" begin H, v1, v2, b = 3.5, 0.25, 0.1, 0.4 - let equations = ShallowWaterEquations1D(gravity_constant=9.8) - cons_vars = prim2cons(SVector(H, v1, b),equations) - entropy_vars = cons2entropy(cons_vars,equations) - @test cons_vars ≈ entropy2cons(entropy_vars,equations) + let equations = ShallowWaterEquations1D(gravity_constant = 9.8) + cons_vars = prim2cons(SVector(H, v1, b), equations) + entropy_vars = cons2entropy(cons_vars, equations) + @test cons_vars ≈ entropy2cons(entropy_vars, equations) - total_energy = energy_total(cons_vars, equations) - @test total_energy ≈ entropy(cons_vars, equations) + total_energy = energy_total(cons_vars, equations) + @test total_energy ≈ entropy(cons_vars, equations) - # test tuple args - cons_vars = prim2cons((H, v1, b), equations) - entropy_vars = cons2entropy(cons_vars, equations) - @test cons_vars ≈ entropy2cons(entropy_vars, equations) + # test tuple args + cons_vars = prim2cons((H, v1, b), equations) + entropy_vars = cons2entropy(cons_vars, equations) + @test cons_vars ≈ entropy2cons(entropy_vars, equations) end - let equations = ShallowWaterEquations2D(gravity_constant=9.8) - cons_vars = prim2cons(SVector(H,v1,v2,b),equations) - entropy_vars = cons2entropy(cons_vars,equations) - @test cons_vars ≈ entropy2cons(entropy_vars,equations) + let equations = ShallowWaterEquations2D(gravity_constant = 9.8) + cons_vars = prim2cons(SVector(H, v1, v2, b), equations) + entropy_vars = cons2entropy(cons_vars, equations) + @test cons_vars ≈ entropy2cons(entropy_vars, equations) - total_energy = energy_total(cons_vars, equations) - @test total_energy ≈ entropy(cons_vars, equations) + total_energy = energy_total(cons_vars, equations) + @test total_energy ≈ entropy(cons_vars, equations) - # test tuple args - cons_vars = prim2cons((H, v1, v2, b), equations) - entropy_vars = cons2entropy(cons_vars, equations) - @test cons_vars ≈ entropy2cons(entropy_vars, equations) + # test tuple args + cons_vars = prim2cons((H, v1, v2, b), equations) + entropy_vars = cons2entropy(cons_vars, equations) + @test cons_vars ≈ entropy2cons(entropy_vars, equations) end - end +end - @timed_testset "boundary_condition_do_nothing" begin +@timed_testset "boundary_condition_do_nothing" begin rho, v1, v2, p = 1.0, 0.1, 0.2, 0.3, 2.0 let equations = CompressibleEulerEquations2D(1.4) - u = prim2cons(SVector(rho, v1, v2, p), equations) - x = SVector(1.0, 2.0) - t = 0.5 - surface_flux = flux_lax_friedrichs - - outward_direction = SVector(0.2, -0.3) - @test flux(u, outward_direction, equations) ≈ boundary_condition_do_nothing(u, outward_direction, x, t, surface_flux, equations) - - orientation = 2 - direction = 4 - @test flux(u, orientation, equations) ≈ boundary_condition_do_nothing(u, orientation, direction, x, t, surface_flux, equations) + u = prim2cons(SVector(rho, v1, v2, p), equations) + x = SVector(1.0, 2.0) + t = 0.5 + surface_flux = flux_lax_friedrichs + + outward_direction = SVector(0.2, -0.3) + @test flux(u, outward_direction, equations) ≈ + boundary_condition_do_nothing(u, outward_direction, x, t, surface_flux, + equations) + + orientation = 2 + direction = 4 + @test flux(u, orientation, equations) ≈ + boundary_condition_do_nothing(u, orientation, direction, x, t, + surface_flux, equations) end - end +end - @timed_testset "TimeSeriesCallback" begin +@timed_testset "TimeSeriesCallback" begin @test_nowarn_mod trixi_include(@__MODULE__, - joinpath(examples_dir(), "tree_2d_dgsem", "elixir_acoustics_gaussian_source.jl"), - tspan=(0, 0.05)) + joinpath(examples_dir(), "tree_2d_dgsem", + "elixir_acoustics_gaussian_source.jl"), + tspan = (0, 0.05)) point_data_1 = time_series.affect!.point_data[1] - @test all(isapprox.(point_data_1[1:7], [-2.4417734981719132e-5, -3.4296207289200194e-5, - 0.0018130846385739788, -0.5, 0.25, 1.0, 1.0])) - @test_throws DimensionMismatch Trixi.get_elements_by_coordinates!([1, 2], rand(2, 4), mesh, + @test all(isapprox.(point_data_1[1:7], + [-2.4417734981719132e-5, -3.4296207289200194e-5, + 0.0018130846385739788, -0.5, 0.25, 1.0, 1.0])) + @test_throws DimensionMismatch Trixi.get_elements_by_coordinates!([1, 2], + rand(2, 4), mesh, solver, nothing) @test_nowarn show(stdout, time_series) - @test_throws ArgumentError TimeSeriesCallback(semi, [(1.0, 1.0)]; interval=-1) + @test_throws ArgumentError TimeSeriesCallback(semi, [(1.0, 1.0)]; interval = -1) @test_throws ArgumentError TimeSeriesCallback(semi, [1.0 1.0 1.0; 2.0 2.0 2.0]) - end +end - @timed_testset "Consistency check for HLL flux (naive): CEE" begin +@timed_testset "Consistency check for HLL flux (naive): CEE" begin flux_hll = FluxHLL(min_max_speed_naive) # Set up equations and dummy conservative variables state @@ -602,7 +628,7 @@ isdir(outdir) && rm(outdir, recursive=true) orientations = [1] for orientation in orientations - @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) + @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) end equations = CompressibleEulerEquations2D(1.4) @@ -610,7 +636,7 @@ isdir(outdir) && rm(outdir, recursive=true) orientations = [1, 2] for orientation in orientations - @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) + @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) end equations = CompressibleEulerEquations3D(1.4) @@ -618,11 +644,11 @@ isdir(outdir) && rm(outdir, recursive=true) orientations = [1, 2, 3] for orientation in orientations - @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) + @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) end - end +end - @timed_testset "Consistency check for HLL flux (naive): LEE" begin +@timed_testset "Consistency check for HLL flux (naive): LEE" begin flux_hll = FluxHLL(min_max_speed_naive) equations = LinearizedEulerEquations2D(SVector(1.0, 1.0), 1.0, 1.0) @@ -630,87 +656,91 @@ isdir(outdir) && rm(outdir, recursive=true) orientations = [1, 2] for orientation in orientations - @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) + @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) end normal_directions = [SVector(1.0, 0.0), - SVector(0.0, 1.0), - SVector(0.5, -0.5), - SVector(-1.2, 0.3)] + SVector(0.0, 1.0), + SVector(0.5, -0.5), + SVector(-1.2, 0.3)] for normal_direction in normal_directions - @test flux_hll(u, u, normal_direction, equations) ≈ flux(u, normal_direction, equations) + @test flux_hll(u, u, normal_direction, equations) ≈ + flux(u, normal_direction, equations) end - end +end - @timed_testset "Consistency check for HLL flux (naive): SWE" begin +@timed_testset "Consistency check for HLL flux (naive): SWE" begin flux_hll = FluxHLL(min_max_speed_naive) - equations = ShallowWaterEquations1D(gravity_constant=9.81) + equations = ShallowWaterEquations1D(gravity_constant = 9.81) u = SVector(1, 0.5, 0.0) @test flux_hll(u, u, 1, equations) ≈ flux(u, 1, equations) - equations = ShallowWaterEquations2D(gravity_constant=9.81) + equations = ShallowWaterEquations2D(gravity_constant = 9.81) normal_directions = [SVector(1.0, 0.0), - SVector(0.0, 1.0), - SVector(0.5, -0.5), - SVector(-1.2, 0.3)] + SVector(0.0, 1.0), + SVector(0.5, -0.5), + SVector(-1.2, 0.3)] u = SVector(1, 0.5, 0.5, 0.0) for normal_direction in normal_directions - @test flux_hll(u, u, normal_direction, equations) ≈ flux(u, normal_direction, equations) + @test flux_hll(u, u, normal_direction, equations) ≈ + flux(u, normal_direction, equations) end - end +end - @timed_testset "Consistency check for HLL flux (naive): MHD" begin +@timed_testset "Consistency check for HLL flux (naive): MHD" begin flux_hll = FluxHLL(min_max_speed_naive) equations = IdealGlmMhdEquations1D(1.4) u_values = [SVector(1.0, 0.4, -0.5, 0.1, 1.0, 0.1, -0.2, 0.1), - SVector(1.5, -0.2, 0.1, 0.2, 5.0, -0.1, 0.1, 0.2),] + SVector(1.5, -0.2, 0.1, 0.2, 5.0, -0.1, 0.1, 0.2)] for u in u_values - @test flux_hll(u, u, 1, equations) ≈ flux(u, 1, equations) + @test flux_hll(u, u, 1, equations) ≈ flux(u, 1, equations) end - equations = IdealGlmMhdEquations2D(1.4, 5.0 #= c_h =#) + equations = IdealGlmMhdEquations2D(1.4, 5.0) #= c_h =# normal_directions = [SVector(1.0, 0.0), - SVector(0.0, 1.0), - SVector(0.5, -0.5), - SVector(-1.2, 0.3)] + SVector(0.0, 1.0), + SVector(0.5, -0.5), + SVector(-1.2, 0.3)] orientations = [1, 2] u_values = [SVector(1.0, 0.4, -0.5, 0.1, 1.0, 0.1, -0.2, 0.1, 0.0), - SVector(1.5, -0.2, 0.1, 0.2, 5.0, -0.1, 0.1, 0.2, 0.2),] + SVector(1.5, -0.2, 0.1, 0.2, 5.0, -0.1, 0.1, 0.2, 0.2)] for u in u_values, orientation in orientations - @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) + @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) end for u in u_values, normal_direction in normal_directions - @test flux_hll(u, u, normal_direction, equations) ≈ flux(u, normal_direction, equations) + @test flux_hll(u, u, normal_direction, equations) ≈ + flux(u, normal_direction, equations) end - equations = IdealGlmMhdEquations3D(1.4, 5.0 #= c_h =#) + equations = IdealGlmMhdEquations3D(1.4, 5.0) #= c_h =# normal_directions = [SVector(1.0, 0.0, 0.0), - SVector(0.0, 1.0, 0.0), - SVector(0.0, 0.0, 1.0), - SVector(0.5, -0.5, 0.2), - SVector(-1.2, 0.3, 1.4)] + SVector(0.0, 1.0, 0.0), + SVector(0.0, 0.0, 1.0), + SVector(0.5, -0.5, 0.2), + SVector(-1.2, 0.3, 1.4)] orientations = [1, 2, 3] u_values = [SVector(1.0, 0.4, -0.5, 0.1, 1.0, 0.1, -0.2, 0.1, 0.0), - SVector(1.5, -0.2, 0.1, 0.2, 5.0, -0.1, 0.1, 0.2, 0.2),] + SVector(1.5, -0.2, 0.1, 0.2, 5.0, -0.1, 0.1, 0.2, 0.2)] for u in u_values, orientation in orientations - @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) + @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) end for u in u_values, normal_direction in normal_directions - @test flux_hll(u, u, normal_direction, equations) ≈ flux(u, normal_direction, equations) + @test flux_hll(u, u, normal_direction, equations) ≈ + flux(u, normal_direction, equations) end - end +end - @timed_testset "Consistency check for HLL flux with Davis wave speed estimates: CEE" begin +@timed_testset "Consistency check for HLL flux with Davis wave speed estimates: CEE" begin flux_hll = FluxHLL(min_max_speed_davis) # Set up equations and dummy conservative variables state @@ -719,7 +749,7 @@ isdir(outdir) && rm(outdir, recursive=true) orientations = [1] for orientation in orientations - @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) + @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) end equations = CompressibleEulerEquations2D(1.4) @@ -727,16 +757,17 @@ isdir(outdir) && rm(outdir, recursive=true) orientations = [1, 2] for orientation in orientations - @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) + @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) end normal_directions = [SVector(1.0, 0.0), - SVector(0.0, 1.0), - SVector(0.5, -0.5), - SVector(-1.2, 0.3)] + SVector(0.0, 1.0), + SVector(0.5, -0.5), + SVector(-1.2, 0.3)] for normal_direction in normal_directions - @test flux_hll(u, u, normal_direction, equations) ≈ flux(u, normal_direction, equations) + @test flux_hll(u, u, normal_direction, equations) ≈ + flux(u, normal_direction, equations) end equations = CompressibleEulerEquations3D(1.4) @@ -744,21 +775,22 @@ isdir(outdir) && rm(outdir, recursive=true) orientations = [1, 2, 3] for orientation in orientations - @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) + @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) end normal_directions = [SVector(1.0, 0.0, 0.0), - SVector(0.0, 1.0, 0.0), - SVector(0.0, 0.0, 1.0), - SVector(0.5, -0.5, 0.2), - SVector(-1.2, 0.3, 1.4)] + SVector(0.0, 1.0, 0.0), + SVector(0.0, 0.0, 1.0), + SVector(0.5, -0.5, 0.2), + SVector(-1.2, 0.3, 1.4)] for normal_direction in normal_directions - @test flux_hll(u, u, normal_direction, equations) ≈ flux(u, normal_direction, equations) + @test flux_hll(u, u, normal_direction, equations) ≈ + flux(u, normal_direction, equations) end - end +end - @timed_testset "Consistency check for HLL flux with Davis wave speed estimates: LEE" begin +@timed_testset "Consistency check for HLL flux with Davis wave speed estimates: LEE" begin flux_hll = FluxHLL(min_max_speed_davis) equations = LinearizedEulerEquations2D(SVector(1.0, 1.0), 1.0, 1.0) @@ -766,99 +798,103 @@ isdir(outdir) && rm(outdir, recursive=true) orientations = [1, 2] for orientation in orientations - @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) + @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) end normal_directions = [SVector(1.0, 0.0), - SVector(0.0, 1.0), - SVector(0.5, -0.5), - SVector(-1.2, 0.3)] + SVector(0.0, 1.0), + SVector(0.5, -0.5), + SVector(-1.2, 0.3)] for normal_direction in normal_directions - @test flux_hll(u, u, normal_direction, equations) ≈ flux(u, normal_direction, equations) + @test flux_hll(u, u, normal_direction, equations) ≈ + flux(u, normal_direction, equations) end - end +end - @timed_testset "Consistency check for HLL flux with Davis wave speed estimates: SWE" begin +@timed_testset "Consistency check for HLL flux with Davis wave speed estimates: SWE" begin flux_hll = FluxHLL(min_max_speed_davis) - equations = ShallowWaterEquations1D(gravity_constant=9.81) + equations = ShallowWaterEquations1D(gravity_constant = 9.81) u = SVector(1, 0.5, 0.0) @test flux_hll(u, u, 1, equations) ≈ flux(u, 1, equations) - equations = ShallowWaterEquations2D(gravity_constant=9.81) + equations = ShallowWaterEquations2D(gravity_constant = 9.81) normal_directions = [SVector(1.0, 0.0), - SVector(0.0, 1.0), - SVector(0.5, -0.5), - SVector(-1.2, 0.3)] + SVector(0.0, 1.0), + SVector(0.5, -0.5), + SVector(-1.2, 0.3)] u = SVector(1, 0.5, 0.5, 0.0) for normal_direction in normal_directions - @test flux_hll(u, u, normal_direction, equations) ≈ flux(u, normal_direction, equations) + @test flux_hll(u, u, normal_direction, equations) ≈ + flux(u, normal_direction, equations) end orientations = [1, 2] for orientation in orientations - @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) + @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) end - end +end - @timed_testset "Consistency check for HLL flux with Davis wave speed estimates: MHD" begin +@timed_testset "Consistency check for HLL flux with Davis wave speed estimates: MHD" begin flux_hll = FluxHLL(min_max_speed_davis) equations = IdealGlmMhdEquations1D(1.4) u_values = [SVector(1.0, 0.4, -0.5, 0.1, 1.0, 0.1, -0.2, 0.1), - SVector(1.5, -0.2, 0.1, 0.2, 5.0, -0.1, 0.1, 0.2),] + SVector(1.5, -0.2, 0.1, 0.2, 5.0, -0.1, 0.1, 0.2)] for u in u_values - @test flux_hll(u, u, 1, equations) ≈ flux(u, 1, equations) + @test flux_hll(u, u, 1, equations) ≈ flux(u, 1, equations) end - equations = IdealGlmMhdEquations2D(1.4, 5.0 #= c_h =#) + equations = IdealGlmMhdEquations2D(1.4, 5.0) #= c_h =# normal_directions = [SVector(1.0, 0.0), - SVector(0.0, 1.0), - SVector(0.5, -0.5), - SVector(-1.2, 0.3)] + SVector(0.0, 1.0), + SVector(0.5, -0.5), + SVector(-1.2, 0.3)] orientations = [1, 2] u_values = [SVector(1.0, 0.4, -0.5, 0.1, 1.0, 0.1, -0.2, 0.1, 0.0), - SVector(1.5, -0.2, 0.1, 0.2, 5.0, -0.1, 0.1, 0.2, 0.2),] + SVector(1.5, -0.2, 0.1, 0.2, 5.0, -0.1, 0.1, 0.2, 0.2)] for u in u_values, orientation in orientations - @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) + @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) end for u in u_values, normal_direction in normal_directions - @test flux_hll(u, u, normal_direction, equations) ≈ flux(u, normal_direction, equations) + @test flux_hll(u, u, normal_direction, equations) ≈ + flux(u, normal_direction, equations) end - equations = IdealGlmMhdEquations3D(1.4, 5.0 #= c_h =#) + equations = IdealGlmMhdEquations3D(1.4, 5.0) #= c_h =# normal_directions = [SVector(1.0, 0.0, 0.0), - SVector(0.0, 1.0, 0.0), - SVector(0.0, 0.0, 1.0), - SVector(0.5, -0.5, 0.2), - SVector(-1.2, 0.3, 1.4)] + SVector(0.0, 1.0, 0.0), + SVector(0.0, 0.0, 1.0), + SVector(0.5, -0.5, 0.2), + SVector(-1.2, 0.3, 1.4)] orientations = [1, 2, 3] u_values = [SVector(1.0, 0.4, -0.5, 0.1, 1.0, 0.1, -0.2, 0.1, 0.0), - SVector(1.5, -0.2, 0.1, 0.2, 5.0, -0.1, 0.1, 0.2, 0.2),] + SVector(1.5, -0.2, 0.1, 0.2, 5.0, -0.1, 0.1, 0.2, 0.2)] for u in u_values, orientation in orientations - @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) + @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) end for u in u_values, normal_direction in normal_directions - @test flux_hll(u, u, normal_direction, equations) ≈ flux(u, normal_direction, equations) + @test flux_hll(u, u, normal_direction, equations) ≈ + flux(u, normal_direction, equations) end - end +end - @timed_testset "Consistency check for HLLE flux: CEE" begin +@timed_testset "Consistency check for HLLE flux: CEE" begin # Set up equations and dummy conservative variables state equations = CompressibleEulerEquations1D(1.4) u = SVector(1.1, 2.34, 5.5) orientations = [1] for orientation in orientations - @test flux_hlle(u, u, orientation, equations) ≈ flux(u, orientation, equations) + @test flux_hlle(u, u, orientation, equations) ≈ flux(u, orientation, equations) end equations = CompressibleEulerEquations2D(1.4) @@ -866,16 +902,17 @@ isdir(outdir) && rm(outdir, recursive=true) orientations = [1, 2] for orientation in orientations - @test flux_hlle(u, u, orientation, equations) ≈ flux(u, orientation, equations) + @test flux_hlle(u, u, orientation, equations) ≈ flux(u, orientation, equations) end normal_directions = [SVector(1.0, 0.0), - SVector(0.0, 1.0), - SVector(0.5, -0.5), - SVector(-1.2, 0.3)] + SVector(0.0, 1.0), + SVector(0.5, -0.5), + SVector(-1.2, 0.3)] for normal_direction in normal_directions - @test flux_hlle(u, u, normal_direction, equations) ≈ flux(u, normal_direction, equations) + @test flux_hll(u, u, normal_direction, equations) ≈ + flux(u, normal_direction, equations) end equations = CompressibleEulerEquations3D(1.4) @@ -883,97 +920,101 @@ isdir(outdir) && rm(outdir, recursive=true) orientations = [1, 2, 3] for orientation in orientations - @test flux_hlle(u, u, orientation, equations) ≈ flux(u, orientation, equations) + @test flux_hlle(u, u, orientation, equations) ≈ flux(u, orientation, equations) end normal_directions = [SVector(1.0, 0.0, 0.0), - SVector(0.0, 1.0, 0.0), - SVector(0.0, 0.0, 1.0), - SVector(0.5, -0.5, 0.2), - SVector(-1.2, 0.3, 1.4)] + SVector(0.0, 1.0, 0.0), + SVector(0.0, 0.0, 1.0), + SVector(0.5, -0.5, 0.2), + SVector(-1.2, 0.3, 1.4)] for normal_direction in normal_directions - @test flux_hlle(u, u, normal_direction, equations) ≈ flux(u, normal_direction, equations) + @test flux_hll(u, u, normal_direction, equations) ≈ + flux(u, normal_direction, equations) end - end +end - @timed_testset "Consistency check for HLLE flux: SWE" begin +@timed_testset "Consistency check for HLLE flux: SWE" begin # Test HLL flux with min_max_speed_einfeldt flux_hll = FluxHLL(min_max_speed_einfeldt) - equations = ShallowWaterEquations1D(gravity_constant=9.81) + equations = ShallowWaterEquations1D(gravity_constant = 9.81) u = SVector(1, 0.5, 0.0) @test flux_hll(u, u, 1, equations) ≈ flux(u, 1, equations) - equations = ShallowWaterEquations2D(gravity_constant=9.81) + equations = ShallowWaterEquations2D(gravity_constant = 9.81) normal_directions = [SVector(1.0, 0.0), - SVector(0.0, 1.0), - SVector(0.5, -0.5), - SVector(-1.2, 0.3)] + SVector(0.0, 1.0), + SVector(0.5, -0.5), + SVector(-1.2, 0.3)] orientations = [1, 2] u = SVector(1, 0.5, 0.5, 0.0) for orientation in orientations - @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) + @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) end for normal_direction in normal_directions - @test flux_hll(u, u, normal_direction, equations) ≈ flux(u, normal_direction, equations) + @test flux_hll(u, u, normal_direction, equations) ≈ + flux(u, normal_direction, equations) end - end +end - @timed_testset "Consistency check for HLLE flux: MHD" begin +@timed_testset "Consistency check for HLLE flux: MHD" begin # Test HLL flux with min_max_speed_einfeldt flux_hll = FluxHLL(min_max_speed_naive) equations = IdealGlmMhdEquations1D(1.4) u_values = [SVector(1.0, 0.4, -0.5, 0.1, 1.0, 0.1, -0.2, 0.1), - SVector(1.5, -0.2, 0.1, 0.2, 5.0, -0.1, 0.1, 0.2),] + SVector(1.5, -0.2, 0.1, 0.2, 5.0, -0.1, 0.1, 0.2)] for u in u_values - @test flux_hll(u, u, 1, equations) ≈ flux(u, 1, equations) + @test flux_hll(u, u, 1, equations) ≈ flux(u, 1, equations) end - equations = IdealGlmMhdEquations2D(1.4, 5.0 #= c_h =#) + equations = IdealGlmMhdEquations2D(1.4, 5.0) #= c_h =# normal_directions = [SVector(1.0, 0.0), - SVector(0.0, 1.0), - SVector(0.5, -0.5), - SVector(-1.2, 0.3)] + SVector(0.0, 1.0), + SVector(0.5, -0.5), + SVector(-1.2, 0.3)] orientations = [1, 2] u_values = [SVector(1.0, 0.4, -0.5, 0.1, 1.0, 0.1, -0.2, 0.1, 0.0), - SVector(1.5, -0.2, 0.1, 0.2, 5.0, -0.1, 0.1, 0.2, 0.2),] + SVector(1.5, -0.2, 0.1, 0.2, 5.0, -0.1, 0.1, 0.2, 0.2)] for u in u_values, orientation in orientations - @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) + @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) end for u in u_values, normal_direction in normal_directions - @test flux_hll(u, u, normal_direction, equations) ≈ flux(u, normal_direction, equations) + @test flux_hll(u, u, normal_direction, equations) ≈ + flux(u, normal_direction, equations) end - equations = IdealGlmMhdEquations3D(1.4, 5.0 #= c_h =#) + equations = IdealGlmMhdEquations3D(1.4, 5.0) #= c_h =# normal_directions = [SVector(1.0, 0.0, 0.0), - SVector(0.0, 1.0, 0.0), - SVector(0.0, 0.0, 1.0), - SVector(0.5, -0.5, 0.2), - SVector(-1.2, 0.3, 1.4)] + SVector(0.0, 1.0, 0.0), + SVector(0.0, 0.0, 1.0), + SVector(0.5, -0.5, 0.2), + SVector(-1.2, 0.3, 1.4)] orientations = [1, 2, 3] u_values = [SVector(1.0, 0.4, -0.5, 0.1, 1.0, 0.1, -0.2, 0.1, 0.0), - SVector(1.5, -0.2, 0.1, 0.2, 5.0, -0.1, 0.1, 0.2, 0.2),] + SVector(1.5, -0.2, 0.1, 0.2, 5.0, -0.1, 0.1, 0.2, 0.2)] for u in u_values, orientation in orientations - @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) + @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) end for u in u_values, normal_direction in normal_directions - @test flux_hll(u, u, normal_direction, equations) ≈ flux(u, normal_direction, equations) + @test flux_hll(u, u, normal_direction, equations) ≈ + flux(u, normal_direction, equations) end - end +end - @timed_testset "Consistency check for Godunov flux" begin +@timed_testset "Consistency check for Godunov flux" begin # Set up equations and dummy conservative variables state # Burgers' Equation @@ -982,7 +1023,7 @@ isdir(outdir) && rm(outdir, recursive=true) orientations = [1] for orientation in orientations, u in u_values - @test flux_godunov(u, u, orientation, equation) ≈ flux(u, orientation, equation) + @test flux_godunov(u, u, orientation, equation) ≈ flux(u, orientation, equation) end # Linear Advection 1D @@ -991,7 +1032,7 @@ isdir(outdir) && rm(outdir, recursive=true) orientations = [1] for orientation in orientations - @test flux_godunov(u, u, orientation, equation) ≈ flux(u, orientation, equation) + @test flux_godunov(u, u, orientation, equation) ≈ flux(u, orientation, equation) end # Linear Advection 2D @@ -1000,16 +1041,17 @@ isdir(outdir) && rm(outdir, recursive=true) orientations = [1, 2] for orientation in orientations - @test flux_godunov(u, u, orientation, equation) ≈ flux(u, orientation, equation) + @test flux_godunov(u, u, orientation, equation) ≈ flux(u, orientation, equation) end normal_directions = [SVector(1.0, 0.0), - SVector(0.0, 1.0), - SVector(0.5, -0.5), - SVector(-1.2, 0.3)] + SVector(0.0, 1.0), + SVector(0.5, -0.5), + SVector(-1.2, 0.3)] for normal_direction in normal_directions - @test flux_godunov(u, u, normal_direction, equation) ≈ flux(u, normal_direction, equation) + @test flux_godunov(u, u, normal_direction, equation) ≈ + flux(u, normal_direction, equation) end # Linear Advection 3D @@ -1018,48 +1060,52 @@ isdir(outdir) && rm(outdir, recursive=true) orientations = [1, 2, 3] for orientation in orientations - @test flux_godunov(u, u, orientation, equation) ≈ flux(u, orientation, equation) + @test flux_godunov(u, u, orientation, equation) ≈ flux(u, orientation, equation) end normal_directions = [SVector(1.0, 0.0, 0.0), - SVector(0.0, 1.0, 0.0), - SVector(0.0, 0.0, 1.0), - SVector(0.5, -0.5, 0.2), - SVector(-1.2, 0.3, 1.4)] + SVector(0.0, 1.0, 0.0), + SVector(0.0, 0.0, 1.0), + SVector(0.5, -0.5, 0.2), + SVector(-1.2, 0.3, 1.4)] for normal_direction in normal_directions - @test flux_godunov(u, u, normal_direction, equation) ≈ flux(u, normal_direction, equation) + @test flux_godunov(u, u, normal_direction, equation) ≈ + flux(u, normal_direction, equation) end # Linearized Euler 2D - equation = LinearizedEulerEquations2D(v_mean_global=(0.5, -0.7), c_mean_global=1.1, - rho_mean_global=1.2) + equation = LinearizedEulerEquations2D(v_mean_global = (0.5, -0.7), + c_mean_global = 1.1, + rho_mean_global = 1.2) u_values = [SVector(1.0, 0.5, -0.7, 1.0), - SVector(1.5, -0.2, 0.1, 5.0),] + SVector(1.5, -0.2, 0.1, 5.0)] orientations = [1, 2] for orientation in orientations, u in u_values - @test flux_godunov(u, u, orientation, equation) ≈ flux(u, orientation, equation) + @test flux_godunov(u, u, orientation, equation) ≈ flux(u, orientation, equation) end normal_directions = [SVector(1.0, 0.0), - SVector(0.0, 1.0), - SVector(0.5, -0.5), - SVector(-1.2, 0.3)] + SVector(0.0, 1.0), + SVector(0.5, -0.5), + SVector(-1.2, 0.3)] for normal_direction in normal_directions, u in u_values - @test flux_godunov(u, u, normal_direction, equation) ≈ flux(u, normal_direction, equation) + @test flux_godunov(u, u, normal_direction, equation) ≈ + flux(u, normal_direction, equation) end - end +end - @timed_testset "Consistency check for Engquist-Osher flux" begin +@timed_testset "Consistency check for Engquist-Osher flux" begin # Set up equations and dummy conservative variables state equation = InviscidBurgersEquation1D() u_values = [SVector(42.0), SVector(-42.0)] orientations = [1] for orientation in orientations, u in u_values - @test Trixi.flux_engquist_osher(u, u, orientation, equation) ≈ flux(u, orientation, equation) + @test Trixi.flux_engquist_osher(u, u, orientation, equation) ≈ + flux(u, orientation, equation) end equation = LinearScalarAdvectionEquation1D(-4.2) @@ -1067,11 +1113,12 @@ isdir(outdir) && rm(outdir, recursive=true) orientations = [1] for orientation in orientations - @test Trixi.flux_engquist_osher(u, u, orientation, equation) ≈ flux(u, orientation, equation) + @test Trixi.flux_engquist_osher(u, u, orientation, equation) ≈ + flux(u, orientation, equation) end - end +end - @testset "Equivalent Fluxes" begin +@testset "Equivalent Fluxes" begin # Set up equations and dummy conservative variables state # Burgers' Equation @@ -1080,7 +1127,8 @@ isdir(outdir) && rm(outdir, recursive=true) orientations = [1] for orientation in orientations, u in u_values - @test flux_godunov(0.75*u, u, orientation, equation) ≈ Trixi.flux_engquist_osher(0.75*u, u, orientation, equation) + @test flux_godunov(0.75 * u, u, orientation, equation) ≈ + Trixi.flux_engquist_osher(0.75 * u, u, orientation, equation) end # Linear Advection 1D @@ -1089,8 +1137,10 @@ isdir(outdir) && rm(outdir, recursive=true) orientations = [1] for orientation in orientations - @test flux_godunov(0.5*u, u, orientation, equation) ≈ flux_lax_friedrichs(0.5*u, u, orientation, equation) - @test flux_godunov(2*u, u, orientation, equation) ≈ Trixi.flux_engquist_osher(2*u, u, orientation, equation) + @test flux_godunov(0.5 * u, u, orientation, equation) ≈ + flux_lax_friedrichs(0.5 * u, u, orientation, equation) + @test flux_godunov(2 * u, u, orientation, equation) ≈ + Trixi.flux_engquist_osher(2 * u, u, orientation, equation) end # Linear Advection 2D @@ -1099,16 +1149,18 @@ isdir(outdir) && rm(outdir, recursive=true) orientations = [1, 2] for orientation in orientations - @test flux_godunov(0.25*u, u, orientation, equation) ≈ flux_lax_friedrichs(0.25*u, u, orientation, equation) + @test flux_godunov(0.25 * u, u, orientation, equation) ≈ + flux_lax_friedrichs(0.25 * u, u, orientation, equation) end normal_directions = [SVector(1.0, 0.0), - SVector(0.0, 1.0), - SVector(0.5, -0.5), - SVector(-1.2, 0.3)] + SVector(0.0, 1.0), + SVector(0.5, -0.5), + SVector(-1.2, 0.3)] for normal_direction in normal_directions - @test flux_godunov(3*u, u, normal_direction, equation) ≈ flux_lax_friedrichs(3*u, u, normal_direction, equation) + @test flux_godunov(3 * u, u, normal_direction, equation) ≈ + flux_lax_friedrichs(3 * u, u, normal_direction, equation) end # Linear Advection 3D @@ -1117,113 +1169,137 @@ isdir(outdir) && rm(outdir, recursive=true) orientations = [1, 2, 3] for orientation in orientations - @test flux_godunov(1.5*u, u, orientation, equation) ≈ flux_lax_friedrichs(1.5*u, u, orientation, equation) + @test flux_godunov(1.5 * u, u, orientation, equation) ≈ + flux_lax_friedrichs(1.5 * u, u, orientation, equation) end normal_directions = [SVector(1.0, 0.0, 0.0), - SVector(0.0, 1.0, 0.0), - SVector(0.0, 0.0, 1.0), - SVector(0.5, -0.5, 0.2), - SVector(-1.2, 0.3, 1.4)] + SVector(0.0, 1.0, 0.0), + SVector(0.0, 0.0, 1.0), + SVector(0.5, -0.5, 0.2), + SVector(-1.2, 0.3, 1.4)] for normal_direction in normal_directions - @test flux_godunov(1.3*u, u, normal_direction, equation) ≈ flux_lax_friedrichs(1.3*u, u, normal_direction, equation) + @test flux_godunov(1.3 * u, u, normal_direction, equation) ≈ + flux_lax_friedrichs(1.3 * u, u, normal_direction, equation) end - end +end - @testset "FluxRotated vs. direct implementation" begin +@testset "FluxRotated vs. direct implementation" begin @timed_testset "CompressibleEulerEquations2D" begin - equations = CompressibleEulerEquations2D(1.4) - normal_directions = [SVector(1.0, 0.0), - SVector(0.0, 1.0), - SVector(0.5, -0.5), - SVector(-1.2, 0.3)] - u_values = [SVector(1.0, 0.5, -0.7, 1.0), - SVector(1.5, -0.2, 0.1, 5.0),] - fluxes = [flux_central, flux_ranocha, flux_shima_etal, flux_kennedy_gruber, - flux_hll, FluxHLL(min_max_speed_davis)] - - for f_std in fluxes - f_rot = FluxRotated(f_std) - for u_ll in u_values, u_rr in u_values, normal_direction in normal_directions - @test f_rot(u_ll, u_rr, normal_direction, equations) ≈ f_std(u_ll, u_rr, normal_direction, equations) + equations = CompressibleEulerEquations2D(1.4) + normal_directions = [SVector(1.0, 0.0), + SVector(0.0, 1.0), + SVector(0.5, -0.5), + SVector(-1.2, 0.3)] + u_values = [SVector(1.0, 0.5, -0.7, 1.0), + SVector(1.5, -0.2, 0.1, 5.0)] + fluxes = [flux_central, flux_ranocha, flux_shima_etal, flux_kennedy_gruber, + flux_hll, FluxHLL(min_max_speed_davis)] + + for f_std in fluxes + f_rot = FluxRotated(f_std) + for u_ll in u_values, u_rr in u_values, + normal_direction in normal_directions + + @test f_rot(u_ll, u_rr, normal_direction, equations) ≈ + f_std(u_ll, u_rr, normal_direction, equations) + end end - end end @timed_testset "CompressibleEulerEquations3D" begin - equations = CompressibleEulerEquations3D(1.4) - normal_directions = [SVector(1.0, 0.0, 0.0), - SVector(0.0, 1.0, 0.0), - SVector(0.0, 0.0, 1.0), - SVector(0.5, -0.5, 0.2), - SVector(-1.2, 0.3, 1.4)] - u_values = [SVector(1.0, 0.5, -0.7, 0.1, 1.0), - SVector(1.5, -0.2, 0.1, 0.2, 5.0),] - fluxes = [flux_central, flux_ranocha, flux_shima_etal, flux_kennedy_gruber, FluxLMARS(340), - flux_hll, FluxHLL(min_max_speed_davis)] - - for f_std in fluxes - f_rot = FluxRotated(f_std) - for u_ll in u_values, u_rr in u_values, normal_direction in normal_directions - @test f_rot(u_ll, u_rr, normal_direction, equations) ≈ f_std(u_ll, u_rr, normal_direction, equations) + equations = CompressibleEulerEquations3D(1.4) + normal_directions = [SVector(1.0, 0.0, 0.0), + SVector(0.0, 1.0, 0.0), + SVector(0.0, 0.0, 1.0), + SVector(0.5, -0.5, 0.2), + SVector(-1.2, 0.3, 1.4)] + u_values = [SVector(1.0, 0.5, -0.7, 0.1, 1.0), + SVector(1.5, -0.2, 0.1, 0.2, 5.0)] + fluxes = [flux_central, flux_ranocha, flux_shima_etal, flux_kennedy_gruber, + FluxLMARS(340), + flux_hll, FluxHLL(min_max_speed_davis)] + + for f_std in fluxes + f_rot = FluxRotated(f_std) + for u_ll in u_values, u_rr in u_values, + normal_direction in normal_directions + + @test f_rot(u_ll, u_rr, normal_direction, equations) ≈ + f_std(u_ll, u_rr, normal_direction, equations) + end end - end end @timed_testset "ShallowWaterEquations2D" begin - equations = ShallowWaterEquations2D(gravity_constant=9.81) - normal_directions = [SVector(1.0, 0.0), - SVector(0.0, 1.0), - SVector(0.5, -0.5), - SVector(-1.2, 0.3)] - - u = SVector(1, 0.5, 0.5, 0.0) + equations = ShallowWaterEquations2D(gravity_constant = 9.81) + normal_directions = [SVector(1.0, 0.0), + SVector(0.0, 1.0), + SVector(0.5, -0.5), + SVector(-1.2, 0.3)] - fluxes = [flux_central, flux_fjordholm_etal, flux_wintermeyer_etal, - flux_hll, FluxHLL(min_max_speed_davis), FluxHLL(min_max_speed_einfeldt)] + u = SVector(1, 0.5, 0.5, 0.0) + fluxes = [flux_central, flux_fjordholm_etal, flux_wintermeyer_etal, + flux_hll, FluxHLL(min_max_speed_davis), FluxHLL(min_max_speed_einfeldt)] end @timed_testset "IdealGlmMhdEquations2D" begin - equations = IdealGlmMhdEquations2D(1.4, 5.0 #= c_h =#) - normal_directions = [SVector(1.0, 0.0), - SVector(0.0, 1.0), - SVector(0.5, -0.5), - SVector(-1.2, 0.3)] - u_values = [SVector(1.0, 0.4, -0.5, 0.1, 1.0, 0.1, -0.2, 0.1, 0.0), - SVector(1.5, -0.2, 0.1, 0.2, 5.0, -0.1, 0.1, 0.2, 0.2),] - fluxes = [flux_central, flux_hindenlang_gassner, flux_hll, FluxHLL(min_max_speed_davis)] - - for f_std in fluxes - f_rot = FluxRotated(f_std) - for u_ll in u_values, u_rr in u_values, normal_direction in normal_directions - @test f_rot(u_ll, u_rr, normal_direction, equations) ≈ f_std(u_ll, u_rr, normal_direction, equations) + equations = IdealGlmMhdEquations2D(1.4, 5.0) #= c_h =# + normal_directions = [SVector(1.0, 0.0), + SVector(0.0, 1.0), + SVector(0.5, -0.5), + SVector(-1.2, 0.3)] + u_values = [SVector(1.0, 0.4, -0.5, 0.1, 1.0, 0.1, -0.2, 0.1, 0.0), + SVector(1.5, -0.2, 0.1, 0.2, 5.0, -0.1, 0.1, 0.2, 0.2)] + fluxes = [ + flux_central, + flux_hindenlang_gassner, + flux_hll, + FluxHLL(min_max_speed_davis), + ] + + for f_std in fluxes + f_rot = FluxRotated(f_std) + for u_ll in u_values, u_rr in u_values, + normal_direction in normal_directions + + @test f_rot(u_ll, u_rr, normal_direction, equations) ≈ + f_std(u_ll, u_rr, normal_direction, equations) + end end - end end @timed_testset "IdealGlmMhdEquations3D" begin - equations = IdealGlmMhdEquations3D(1.4, 5.0 #= c_h =#) - normal_directions = [SVector(1.0, 0.0, 0.0), - SVector(0.0, 1.0, 0.0), - SVector(0.0, 0.0, 1.0), - SVector(0.5, -0.5, 0.2), - SVector(-1.2, 0.3, 1.4)] - u_values = [SVector(1.0, 0.4, -0.5, 0.1, 1.0, 0.1, -0.2, 0.1, 0.0), - SVector(1.5, -0.2, 0.1, 0.2, 5.0, -0.1, 0.1, 0.2, 0.2),] - fluxes = [flux_central, flux_hindenlang_gassner, flux_hll, FluxHLL(min_max_speed_davis)] - - for f_std in fluxes - f_rot = FluxRotated(f_std) - for u_ll in u_values, u_rr in u_values, normal_direction in normal_directions - @test f_rot(u_ll, u_rr, normal_direction, equations) ≈ f_std(u_ll, u_rr, normal_direction, equations) + equations = IdealGlmMhdEquations3D(1.4, 5.0) #= c_h =# + normal_directions = [SVector(1.0, 0.0, 0.0), + SVector(0.0, 1.0, 0.0), + SVector(0.0, 0.0, 1.0), + SVector(0.5, -0.5, 0.2), + SVector(-1.2, 0.3, 1.4)] + u_values = [SVector(1.0, 0.4, -0.5, 0.1, 1.0, 0.1, -0.2, 0.1, 0.0), + SVector(1.5, -0.2, 0.1, 0.2, 5.0, -0.1, 0.1, 0.2, 0.2)] + fluxes = [ + flux_central, + flux_hindenlang_gassner, + flux_hll, + FluxHLL(min_max_speed_davis), + ] + + for f_std in fluxes + f_rot = FluxRotated(f_std) + for u_ll in u_values, u_rr in u_values, + normal_direction in normal_directions + + @test f_rot(u_ll, u_rr, normal_direction, equations) ≈ + f_std(u_ll, u_rr, normal_direction, equations) + end end - end end - end +end - @testset "SimpleKronecker" begin +@testset "SimpleKronecker" begin N = 3 NDIMS = 2 @@ -1240,30 +1316,28 @@ isdir(outdir) && rm(outdir, recursive=true) Trixi.mul!(b, V, x) Trixi.mul!(b_kron, V_kron, x) @test b ≈ b_kron - end +end - @testset "SummationByPartsOperators + StartUpDG" begin - dg = DGMulti(polydeg = 3, element_type = Quad(), - approximation_type = derivative_operator( - SummationByPartsOperators.MattssonNordström2004(), - derivative_order=1, accuracy_order=4, - xmin=0.0, xmax=1.0, N=10)) +@testset "SummationByPartsOperators + StartUpDG" begin + global D = derivative_operator(SummationByPartsOperators.MattssonNordström2004(), + derivative_order = 1, + accuracy_order = 4, + xmin = 0.0, xmax = 1.0, + N = 10) + dg = DGMulti(polydeg = 3, element_type = Quad(), approximation_type = D) @test StartUpDG.inverse_trace_constant(dg.basis) ≈ 50.8235294117647 - end +end - @testset "1D non-periodic DGMultiMesh" begin +@testset "1D non-periodic DGMultiMesh" begin # checks whether or not boundary faces are initialized correctly for DGMultiMesh in 1D dg = DGMulti(polydeg = 1, element_type = Line(), approximation_type = Polynomial(), surface_integral = SurfaceIntegralWeakForm(flux_central), volume_integral = VolumeIntegralFluxDifferencing(flux_central)) - mesh = DGMultiMesh(dg, cells_per_dimension=(1,), periodicity=false) + mesh = DGMultiMesh(dg, cells_per_dimension = (1,), periodicity = false) @test mesh.boundary_faces[:entire_boundary] == [1, 2] - end - +end end - - -end #module +end #module \ No newline at end of file From 0f8dd92012d1f6038762e91070d5fe80d4feca2b Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Mon, 30 Oct 2023 17:24:57 +0100 Subject: [PATCH 05/19] format test --- test/test_p4est_2d.jl | 701 +++++++++++++++++++++++------------------ test/test_p4est_3d.jl | 706 +++++++++++++++++++++++++----------------- 2 files changed, 823 insertions(+), 584 deletions(-) diff --git a/test/test_p4est_2d.jl b/test/test_p4est_2d.jl index eb4ff3bc7d7..36365b3eec1 100644 --- a/test/test_p4est_2d.jl +++ b/test/test_p4est_2d.jl @@ -9,342 +9,455 @@ EXAMPLES_DIR = joinpath(examples_dir(), "p4est_2d_dgsem") # Start with a clean environment: remove Trixi.jl output directory if it exists outdir = "out" -isdir(outdir) && rm(outdir, recursive=true) +isdir(outdir) && rm(outdir, recursive = true) @testset "P4estMesh2D" begin - @trixi_testset "elixir_advection_basic.jl" begin +#! format: noindent + +@trixi_testset "elixir_advection_basic.jl" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_basic.jl"), - # Expected errors are exactly the same as with TreeMesh! - l2 = [8.311947673061856e-6], - linf = [6.627000273229378e-5]) - # 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)) < 1000 - end - end + # Expected errors are exactly the same as with TreeMesh! + l2=[8.311947673061856e-6], + linf=[6.627000273229378e-5]) + # 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)) < 1000 + end +end - @trixi_testset "elixir_advection_nonconforming_flag.jl" begin - @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_nonconforming_flag.jl"), - l2 = [3.198940059144588e-5], - linf = [0.00030636069494005547]) - # 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)) < 1000 - end - end +@trixi_testset "elixir_advection_nonconforming_flag.jl" begin + @test_trixi_include(joinpath(EXAMPLES_DIR, + "elixir_advection_nonconforming_flag.jl"), + l2=[3.198940059144588e-5], + linf=[0.00030636069494005547]) + # 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)) < 1000 + end +end - @trixi_testset "elixir_advection_unstructured_flag.jl" begin +@trixi_testset "elixir_advection_unstructured_flag.jl" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_unstructured_flag.jl"), - l2 = [0.0005379687442422346], - linf = [0.007438525029884735]) - # 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)) < 1000 - end - end + l2=[0.0005379687442422346], + linf=[0.007438525029884735]) + # 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)) < 1000 + end +end - @trixi_testset "elixir_advection_amr_solution_independent.jl" begin - @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_amr_solution_independent.jl"), - # Expected errors are exactly the same as with StructuredMesh! - l2 = [4.949660644033807e-5], - linf = [0.0004867846262313763], - coverage_override = (maxiters=6,)) - # 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)) < 1000 - end - end +@trixi_testset "elixir_advection_amr_solution_independent.jl" begin + @test_trixi_include(joinpath(EXAMPLES_DIR, + "elixir_advection_amr_solution_independent.jl"), + # Expected errors are exactly the same as with StructuredMesh! + l2=[4.949660644033807e-5], + linf=[0.0004867846262313763], + coverage_override=(maxiters = 6,)) + # 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)) < 1000 + end +end - @trixi_testset "elixir_advection_amr_unstructured_flag.jl" begin - @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_amr_unstructured_flag.jl"), - l2 = [0.0012766060609964525], - linf = [0.01750280631586159], - coverage_override = (maxiters=6,)) - # 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)) < 1000 - end - end +@trixi_testset "elixir_advection_amr_unstructured_flag.jl" begin + @test_trixi_include(joinpath(EXAMPLES_DIR, + "elixir_advection_amr_unstructured_flag.jl"), + l2=[0.0012766060609964525], + linf=[0.01750280631586159], + coverage_override=(maxiters = 6,)) + # 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)) < 1000 + end +end - @trixi_testset "elixir_advection_restart.jl" begin +@trixi_testset "elixir_advection_restart.jl" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_restart.jl"), - l2 = [4.507575525876275e-6], - linf = [6.21489667023134e-5]) - # 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)) < 1000 - end - end + l2=[4.507575525876275e-6], + linf=[6.21489667023134e-5]) + # 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)) < 1000 + end +end - @trixi_testset "elixir_euler_source_terms_nonconforming_unstructured_flag.jl" begin - @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_source_terms_nonconforming_unstructured_flag.jl"), - l2 = [0.0034516244508588046, 0.0023420334036925493, 0.0024261923964557187, 0.004731710454271893], - linf = [0.04155789011775046, 0.024772109862748914, 0.03759938693042297, 0.08039824959535657]) - # 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)) < 1000 +@trixi_testset "elixir_euler_source_terms_nonconforming_unstructured_flag.jl" begin + @test_trixi_include(joinpath(EXAMPLES_DIR, + "elixir_euler_source_terms_nonconforming_unstructured_flag.jl"), + l2=[ + 0.0034516244508588046, + 0.0023420334036925493, + 0.0024261923964557187, + 0.004731710454271893, + ], + linf=[ + 0.04155789011775046, + 0.024772109862748914, + 0.03759938693042297, + 0.08039824959535657, + ]) + # 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)) < 1000 end - end +end - @trixi_testset "elixir_euler_free_stream.jl" begin +@trixi_testset "elixir_euler_free_stream.jl" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_free_stream.jl"), - l2 = [2.063350241405049e-15, 1.8571016296925367e-14, 3.1769447886391905e-14, 1.4104095258528071e-14], - linf = [1.9539925233402755e-14, 2e-12, 4.8e-12, 4e-12], - atol = 2.0e-12, # required to make CI tests pass on macOS - ) - # 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)) < 1000 + l2=[ + 2.063350241405049e-15, + 1.8571016296925367e-14, + 3.1769447886391905e-14, + 1.4104095258528071e-14, + ], + linf=[1.9539925233402755e-14, 2e-12, 4.8e-12, 4e-12], + atol=2.0e-12,) + # 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)) < 1000 end - end +end - @trixi_testset "elixir_euler_shockcapturing_ec.jl" begin +@trixi_testset "elixir_euler_shockcapturing_ec.jl" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_shockcapturing_ec.jl"), - l2 = [9.53984675e-02, 1.05633455e-01, 1.05636158e-01, 3.50747237e-01], - linf = [2.94357464e-01, 4.07893014e-01, 3.97334516e-01, 1.08142520e+00], - tspan = (0.0, 1.0)) - # 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)) < 1000 - end - end - - @trixi_testset "elixir_euler_sedov.jl" begin - @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_sedov.jl"), - l2 = [3.76149952e-01, 2.46970327e-01, 2.46970327e-01, 1.28889042e+00], - linf = [1.22139001e+00, 1.17742626e+00, 1.17742626e+00, 6.20638482e+00], - tspan = (0.0, 0.3)) - # 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)) < 1000 - end - end + l2=[ + 9.53984675e-02, + 1.05633455e-01, + 1.05636158e-01, + 3.50747237e-01, + ], + linf=[ + 2.94357464e-01, + 4.07893014e-01, + 3.97334516e-01, + 1.08142520e+00, + ], + tspan=(0.0, 1.0)) + # 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)) < 1000 + end +end - @trixi_testset "elixir_euler_sedov.jl HLLE" begin +@trixi_testset "elixir_euler_sedov.jl" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_sedov.jl"), - l2 = [0.411541263324004, 0.2558929632770186, 0.2558929632770193, 1.298715766843915], - linf = [1.3457201726152221, 1.3138961427140758, 1.313896142714079, 6.293305112638921], - surface_flux = flux_hlle, - tspan = (0.0, 0.3)) - # 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)) < 1000 - end - end + l2=[ + 3.76149952e-01, + 2.46970327e-01, + 2.46970327e-01, + 1.28889042e+00, + ], + linf=[ + 1.22139001e+00, + 1.17742626e+00, + 1.17742626e+00, + 6.20638482e+00, + ], + tspan=(0.0, 0.3)) + # 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)) < 1000 + end +end - @trixi_testset "elixir_euler_blast_wave_amr.jl" begin +@trixi_testset "elixir_euler_blast_wave_amr.jl" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_blast_wave_amr.jl"), - l2 = [6.32183914e-01, 3.86914231e-01, 3.86869171e-01, 1.06575688e+00], - linf = [2.76020890e+00, 2.32659890e+00, 2.32580837e+00, 2.15778188e+00], - tspan = (0.0, 0.3), - coverage_override = (maxiters=6,)) - # 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)) < 1000 - end - end + l2=[ + 6.32183914e-01, + 3.86914231e-01, + 3.86869171e-01, + 1.06575688e+00, + ], + linf=[ + 2.76020890e+00, + 2.32659890e+00, + 2.32580837e+00, + 2.15778188e+00, + ], + tspan=(0.0, 0.3), + coverage_override=(maxiters = 6,)) + # 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)) < 1000 + end +end - @trixi_testset "elixir_euler_wall_bc_amr.jl" begin +@trixi_testset "elixir_euler_wall_bc_amr.jl" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_wall_bc_amr.jl"), - l2 = [0.020291447969983396, 0.017479614254319948, 0.011387644425613437, 0.0514420126021293], - linf = [0.3582779022370579, 0.32073537890751663, 0.221818049107692, 0.9209559420400415], - tspan = (0.0, 0.15)) - # 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)) < 1000 - end - end + l2=[ + 0.020291447969983396, + 0.017479614254319948, + 0.011387644425613437, + 0.0514420126021293, + ], + linf=[ + 0.3582779022370579, + 0.32073537890751663, + 0.221818049107692, + 0.9209559420400415, + ], + tspan=(0.0, 0.15)) + # 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)) < 1000 + end +end - @trixi_testset "elixir_euler_forward_step_amr.jl" begin +@trixi_testset "elixir_euler_forward_step_amr.jl" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_forward_step_amr.jl"), - l2 = [0.004194875320833303, 0.003785140699353966, 0.0013696609105790351, 0.03265268616046424], - linf = [2.0585399781442852, 2.213428805506876, 3.862362410419163, 17.75187237459251], - tspan = (0.0, 0.0001), - rtol = 1.0e-7, - 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)) < 1000 + l2=[ + 0.004194875320833303, + 0.003785140699353966, + 0.0013696609105790351, + 0.03265268616046424, + ], + linf=[ + 2.0585399781442852, + 2.213428805506876, + 3.862362410419163, + 17.75187237459251, + ], + tspan=(0.0, 0.0001), + rtol=1.0e-7, + 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)) < 1000 end - end - end + end +end - @trixi_testset "elixir_euler_double_mach_amr.jl" begin +@trixi_testset "elixir_euler_double_mach_amr.jl" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_double_mach_amr.jl"), - l2 = [0.051359355290192046, 0.4266034859911273, 0.2438304855475594, 4.11487176105527], - linf = [6.902000373057003, 53.95714139820832, 24.241610279839758, 561.0630401858057], - tspan = (0.0, 0.0001), - 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)) < 1000 + l2=[ + 0.051359355290192046, + 0.4266034859911273, + 0.2438304855475594, + 4.11487176105527, + ], + linf=[ + 6.902000373057003, + 53.95714139820832, + 24.241610279839758, + 561.0630401858057, + ], + tspan=(0.0, 0.0001), + 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)) < 1000 end - end - end + end +end - @trixi_testset "elixir_euler_supersonic_cylinder.jl" begin +@trixi_testset "elixir_euler_supersonic_cylinder.jl" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_supersonic_cylinder.jl"), - l2 = [0.026798021911954406, 0.05118546368109259, 0.03206703583774831, 0.19680026567208672], - linf = [3.653905721692421, 4.285035711361009, 6.8544353186357645, 31.748244912257533], - 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)) < 1000 + l2=[ + 0.026798021911954406, + 0.05118546368109259, + 0.03206703583774831, + 0.19680026567208672, + ], + linf=[ + 3.653905721692421, + 4.285035711361009, + 6.8544353186357645, + 31.748244912257533, + ], + 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)) < 1000 end - end - end + end +end - @trixi_testset "elixir_eulergravity_convergence.jl" begin +@trixi_testset "elixir_eulergravity_convergence.jl" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_eulergravity_convergence.jl"), - l2 = [0.00024871265138964204, 0.0003370077102132591, 0.0003370077102131964, 0.0007231525513793697], - linf = [0.0015813032944647087, 0.0020494288423820173, 0.0020494288423824614, 0.004793821195083758], - tspan = (0.0, 0.1)) - # 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)) < 1000 - end - end + l2=[ + 0.00024871265138964204, + 0.0003370077102132591, + 0.0003370077102131964, + 0.0007231525513793697, + ], + linf=[ + 0.0015813032944647087, + 0.0020494288423820173, + 0.0020494288423824614, + 0.004793821195083758, + ], + tspan=(0.0, 0.1)) + # 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)) < 1000 + end +end - @trixi_testset "elixir_shallowwater_source_terms.jl" begin +@trixi_testset "elixir_shallowwater_source_terms.jl" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_shallowwater_source_terms.jl"), - l2 = [9.168126407325352e-5, 0.0009795410115453788, 0.002546408320320785, 3.941189812642317e-6], - linf = [0.0009903782521019089, 0.0059752684687262025, 0.010941106525454103, 1.2129488214718265e-5], - tspan = (0.0, 0.1)) - # 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)) < 1000 - end - end + l2=[ + 9.168126407325352e-5, + 0.0009795410115453788, + 0.002546408320320785, + 3.941189812642317e-6, + ], + linf=[ + 0.0009903782521019089, + 0.0059752684687262025, + 0.010941106525454103, + 1.2129488214718265e-5, + ], + tspan=(0.0, 0.1)) + # 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)) < 1000 + end +end - @trixi_testset "elixir_mhd_alfven_wave.jl" begin +@trixi_testset "elixir_mhd_alfven_wave.jl" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_mhd_alfven_wave.jl"), - l2 = [1.0513414461545583e-5, 1.0517900957166411e-6, 1.0517900957304043e-6, 1.511816606372376e-6, - 1.0443997728645063e-6, 7.879639064990798e-7, 7.879639065049896e-7, 1.0628631669056271e-6, - 4.3382328912336153e-7], - linf = [4.255466285174592e-5, 1.0029706745823264e-5, 1.0029706747467781e-5, 1.2122265939010224e-5, - 5.4791097160444835e-6, 5.18922042269665e-6, 5.189220422141538e-6, 9.552667261422676e-6, - 1.4237578427628152e-6]) - # 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)) < 1000 - end - end + l2=[1.0513414461545583e-5, 1.0517900957166411e-6, + 1.0517900957304043e-6, 1.511816606372376e-6, + 1.0443997728645063e-6, 7.879639064990798e-7, + 7.879639065049896e-7, 1.0628631669056271e-6, + 4.3382328912336153e-7], + linf=[4.255466285174592e-5, 1.0029706745823264e-5, + 1.0029706747467781e-5, 1.2122265939010224e-5, + 5.4791097160444835e-6, 5.18922042269665e-6, + 5.189220422141538e-6, 9.552667261422676e-6, + 1.4237578427628152e-6]) + # 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)) < 1000 + end +end - @trixi_testset "elixir_mhd_rotor.jl" begin +@trixi_testset "elixir_mhd_rotor.jl" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_mhd_rotor.jl"), - l2 = [0.4552084651735862, 0.8918048264575757, 0.832471223081887, 0.0, - 0.9801264164951583, 0.10475690769435382, 0.1555132409149897, 0.0, - 2.0597079362763556e-5], - linf = [10.194181233788775, 18.25472397868819, 10.031307436191334, 0.0, - 19.647239392277378, 1.3938810140985936, 1.8724965294853084, 0.0, - 0.0016290067532561904], - tspan = (0.0, 0.02)) - # 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)) < 1000 - end - end + l2=[0.4552084651735862, 0.8918048264575757, 0.832471223081887, + 0.0, + 0.9801264164951583, 0.10475690769435382, 0.1555132409149897, + 0.0, + 2.0597079362763556e-5], + linf=[10.194181233788775, 18.25472397868819, 10.031307436191334, + 0.0, + 19.647239392277378, 1.3938810140985936, 1.8724965294853084, + 0.0, + 0.0016290067532561904], + tspan=(0.0, 0.02)) + # 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)) < 1000 + end +end - @trixi_testset "elixir_linearizedeuler_gaussian_source.jl" begin - @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_linearizedeuler_gaussian_source.jl"), - l2 = [0.006047938590548741, 0.0040953286019907035, 0.004222698522497298, 0.006269492499336128], - linf = [0.06386175207349379, 0.0378926444850457, 0.041759728067967065, 0.06430136016259067]) - # 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)) < 1000 - end - end +@trixi_testset "elixir_linearizedeuler_gaussian_source.jl" begin + @test_trixi_include(joinpath(EXAMPLES_DIR, + "elixir_linearizedeuler_gaussian_source.jl"), + l2=[ + 0.006047938590548741, + 0.0040953286019907035, + 0.004222698522497298, + 0.006269492499336128, + ], + linf=[ + 0.06386175207349379, + 0.0378926444850457, + 0.041759728067967065, + 0.06430136016259067, + ]) + # 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)) < 1000 + end +end end # Clean up afterwards: delete Trixi.jl output directory -@test_nowarn rm(outdir, recursive=true) +@test_nowarn rm(outdir, recursive = true) -end # module +end # module \ No newline at end of file diff --git a/test/test_p4est_3d.jl b/test/test_p4est_3d.jl index 47105ec11ed..8dda9f2fa9d 100644 --- a/test/test_p4est_3d.jl +++ b/test/test_p4est_3d.jl @@ -9,327 +9,453 @@ EXAMPLES_DIR = joinpath(examples_dir(), "p4est_3d_dgsem") # Start with a clean environment: remove Trixi.jl output directory if it exists outdir = "out" -isdir(outdir) && rm(outdir, recursive=true) +isdir(outdir) && rm(outdir, recursive = true) @testset "P4estMesh3D" begin - @trixi_testset "elixir_advection_basic.jl" begin +#! format: noindent + +@trixi_testset "elixir_advection_basic.jl" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_basic.jl"), - # Expected errors are exactly the same as with TreeMesh! - l2 = [0.00016263963870641478], - linf = [0.0014537194925779984]) - # 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)) < 1000 - end - end + # Expected errors are exactly the same as with TreeMesh! + l2=[0.00016263963870641478], + linf=[0.0014537194925779984]) + # 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)) < 1000 + end +end - @trixi_testset "elixir_advection_unstructured_curved.jl" begin - @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_unstructured_curved.jl"), - l2 = [0.0004750004258546538], - linf = [0.026527551737137167]) - # 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)) < 1000 - end - end +@trixi_testset "elixir_advection_unstructured_curved.jl" begin + @test_trixi_include(joinpath(EXAMPLES_DIR, + "elixir_advection_unstructured_curved.jl"), + l2=[0.0004750004258546538], + linf=[0.026527551737137167]) + # 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)) < 1000 + end +end - @trixi_testset "elixir_advection_nonconforming.jl" begin +@trixi_testset "elixir_advection_nonconforming.jl" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_nonconforming.jl"), - l2 = [0.00253595715323843], - linf = [0.016486952252155795]) - # 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)) < 1000 - end - end + l2=[0.00253595715323843], + linf=[0.016486952252155795]) + # 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)) < 1000 + end +end - @trixi_testset "elixir_advection_amr.jl" begin +@trixi_testset "elixir_advection_amr.jl" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_amr.jl"), - # Expected errors are exactly the same as with TreeMesh! - l2 = [9.773852895157622e-6], - linf = [0.0005853874124926162], - coverage_override = (maxiters=6, initial_refinement_level=1, base_level=1, med_level=2, max_level=3)) - # 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)) < 1000 - end - end + # Expected errors are exactly the same as with TreeMesh! + l2=[9.773852895157622e-6], + linf=[0.0005853874124926162], + coverage_override=(maxiters = 6, initial_refinement_level = 1, + base_level = 1, med_level = 2, max_level = 3)) + # 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)) < 1000 + end +end - @trixi_testset "elixir_advection_amr_unstructured_curved.jl" begin - @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_amr_unstructured_curved.jl"), - l2 = [1.6236411810065552e-5], - linf = [0.0010554006923731395], - tspan = (0.0, 1.0), - coverage_override = (maxiters=6, initial_refinement_level=0, base_level=0, med_level=1, max_level=2)) - # 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)) < 1000 - end - end +@trixi_testset "elixir_advection_amr_unstructured_curved.jl" begin + @test_trixi_include(joinpath(EXAMPLES_DIR, + "elixir_advection_amr_unstructured_curved.jl"), + l2=[1.6236411810065552e-5], + linf=[0.0010554006923731395], + tspan=(0.0, 1.0), + coverage_override=(maxiters = 6, initial_refinement_level = 0, + base_level = 0, med_level = 1, max_level = 2)) + # 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)) < 1000 + end +end - @trixi_testset "elixir_advection_cubed_sphere.jl" begin +@trixi_testset "elixir_advection_cubed_sphere.jl" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_cubed_sphere.jl"), - l2 = [0.002006918015656413], - linf = [0.027655117058380085]) - # 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)) < 1000 - end - end + l2=[0.002006918015656413], + linf=[0.027655117058380085]) + # 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)) < 1000 + end +end - @trixi_testset "elixir_advection_restart.jl" begin +@trixi_testset "elixir_advection_restart.jl" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_restart.jl"), - l2 = [0.002590388934758452], - linf = [0.01840757696885409]) - # 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)) < 1000 - end - end + l2=[0.002590388934758452], + linf=[0.01840757696885409]) + # 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)) < 1000 + end +end - @trixi_testset "elixir_euler_source_terms_nonconforming_unstructured_curved.jl" begin - @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_source_terms_nonconforming_unstructured_curved.jl"), - l2 = [4.070355207909268e-5, 4.4993257426833716e-5, 5.10588457841744e-5, 5.102840924036687e-5, 0.00019986264001630542], - linf = [0.0016987332417202072, 0.003622956808262634, 0.002029576258317789, 0.0024206977281964193, 0.008526972236273522], - tspan = (0.0, 0.01)) - # 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)) < 1000 - end - end +@trixi_testset "elixir_euler_source_terms_nonconforming_unstructured_curved.jl" begin + @test_trixi_include(joinpath(EXAMPLES_DIR, + "elixir_euler_source_terms_nonconforming_unstructured_curved.jl"), + l2=[ + 4.070355207909268e-5, + 4.4993257426833716e-5, + 5.10588457841744e-5, + 5.102840924036687e-5, + 0.00019986264001630542, + ], + linf=[ + 0.0016987332417202072, + 0.003622956808262634, + 0.002029576258317789, + 0.0024206977281964193, + 0.008526972236273522, + ], + tspan=(0.0, 0.01)) + # 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)) < 1000 + end +end - @trixi_testset "elixir_euler_source_terms_nonperiodic.jl" begin - @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_source_terms_nonperiodic.jl"), - l2 = [0.0015106060984283647, 0.0014733349038567685, 0.00147333490385685, 0.001473334903856929, 0.0028149479453087093], - linf = [0.008070806335238156, 0.009007245083113125, 0.009007245083121784, 0.009007245083102688, 0.01562861968368434], - tspan = (0.0, 1.0)) - # 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)) < 1000 - end - end +@trixi_testset "elixir_euler_source_terms_nonperiodic.jl" begin + @test_trixi_include(joinpath(EXAMPLES_DIR, + "elixir_euler_source_terms_nonperiodic.jl"), + l2=[ + 0.0015106060984283647, + 0.0014733349038567685, + 0.00147333490385685, + 0.001473334903856929, + 0.0028149479453087093, + ], + linf=[ + 0.008070806335238156, + 0.009007245083113125, + 0.009007245083121784, + 0.009007245083102688, + 0.01562861968368434, + ], + tspan=(0.0, 1.0)) + # 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)) < 1000 + end +end - @trixi_testset "elixir_euler_free_stream.jl" begin +@trixi_testset "elixir_euler_free_stream.jl" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_free_stream.jl"), - l2 = [5.162664597942288e-15, 1.941857343642486e-14, 2.0232366394187278e-14, 2.3381518645408552e-14, 7.083114561232324e-14], - linf = [7.269740365245525e-13, 3.289868377720495e-12, 4.440087186807773e-12, 3.8686831516088205e-12, 9.412914891981927e-12], - tspan = (0.0, 0.03)) - # 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)) < 1000 - end - end + l2=[ + 5.162664597942288e-15, + 1.941857343642486e-14, + 2.0232366394187278e-14, + 2.3381518645408552e-14, + 7.083114561232324e-14, + ], + linf=[ + 7.269740365245525e-13, + 3.289868377720495e-12, + 4.440087186807773e-12, + 3.8686831516088205e-12, + 9.412914891981927e-12, + ], + tspan=(0.0, 0.03)) + # 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)) < 1000 + end +end - @trixi_testset "elixir_euler_free_stream_extruded.jl" begin +@trixi_testset "elixir_euler_free_stream_extruded.jl" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_free_stream_extruded.jl"), - l2 = [8.444868392439035e-16, 4.889826056731442e-15, 2.2921260987087585e-15, 4.268460455702414e-15, 1.1356712092620279e-14], - linf = [7.749356711883593e-14, 2.8792246364872653e-13, 1.1121659149182506e-13, 3.3228975127030935e-13, 9.592326932761353e-13], - tspan=(0.0, 0.1)) - # 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)) < 1000 - end - end + l2=[ + 8.444868392439035e-16, + 4.889826056731442e-15, + 2.2921260987087585e-15, + 4.268460455702414e-15, + 1.1356712092620279e-14, + ], + linf=[ + 7.749356711883593e-14, + 2.8792246364872653e-13, + 1.1121659149182506e-13, + 3.3228975127030935e-13, + 9.592326932761353e-13, + ], + tspan=(0.0, 0.1)) + # 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)) < 1000 + end +end - @trixi_testset "elixir_euler_ec.jl" begin +@trixi_testset "elixir_euler_ec.jl" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_ec.jl"), - l2 = [0.010380390326164493, 0.006192950051354618, 0.005970674274073704, 0.005965831290564327, 0.02628875593094754], - linf = [0.3326911600075694, 0.2824952141320467, 0.41401037398065543, 0.45574161423218573, 0.8099577682187109], - tspan = (0.0, 0.2), - coverage_override = (polydeg=3,)) # Prevent long compile time in CI - # 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)) < 1000 - end - end - - @trixi_testset "elixir_euler_sedov.jl" begin - @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_sedov.jl"), - l2 = [7.82070951e-02, 4.33260474e-02, 4.33260474e-02, 4.33260474e-02, 3.75260911e-01], - linf = [7.45329845e-01, 3.21754792e-01, 3.21754792e-01, 3.21754792e-01, 4.76151527e+00], - tspan = (0.0, 0.3), - coverage_override = (polydeg=3,)) # Prevent long compile time in CI - # 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)) < 1000 - end - end + l2=[ + 0.010380390326164493, + 0.006192950051354618, + 0.005970674274073704, + 0.005965831290564327, + 0.02628875593094754, + ], + linf=[ + 0.3326911600075694, + 0.2824952141320467, + 0.41401037398065543, + 0.45574161423218573, + 0.8099577682187109, + ], + tspan=(0.0, 0.2), + coverage_override=(polydeg = 3,)) # Prevent long compile time in CI + # 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)) < 1000 + end +end - @trixi_testset "elixir_euler_sedov.jl HLLE" begin +@trixi_testset "elixir_euler_sedov.jl" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_sedov.jl"), - l2 = [0.09946224487902565, 0.04863386374672001, 0.048633863746720116, 0.04863386374672032, 0.3751015774232693], - linf = [0.789241521871487, 0.42046970270100276, 0.42046970270100276, 0.4204697027010028, 4.730877375538398], - tspan = (0.0, 0.3), - surface_flux = flux_hlle) - # 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)) < 1000 - end - end + l2=[ + 7.82070951e-02, + 4.33260474e-02, + 4.33260474e-02, + 4.33260474e-02, + 3.75260911e-01, + ], + linf=[ + 7.45329845e-01, + 3.21754792e-01, + 3.21754792e-01, + 3.21754792e-01, + 4.76151527e+00, + ], + tspan=(0.0, 0.3), + coverage_override=(polydeg = 3,)) # Prevent long compile time in CI + # 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)) < 1000 + end +end - @trixi_testset "elixir_euler_source_terms_nonconforming_earth.jl" begin - @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_source_terms_nonconforming_earth.jl"), - l2 = [6.040180337738628e-6, 5.4254175153621895e-6, 5.677698851333843e-6, 5.8017136892469794e-6, 1.3637854615117974e-5], - linf = [0.00013996924184311865, 0.00013681539559939893, 0.00013681539539733834, 0.00013681539541021692, 0.00016833038543762058], - # Decrease tolerance of adaptive time stepping to get similar results across different systems - abstol=1.0e-11, reltol=1.0e-11, - coverage_override = (trees_per_cube_face=(1, 1), polydeg=3)) # Prevent long compile time in CI - # 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)) < 1000 - end - end +@trixi_testset "elixir_euler_source_terms_nonconforming_earth.jl" begin + @test_trixi_include(joinpath(EXAMPLES_DIR, + "elixir_euler_source_terms_nonconforming_earth.jl"), + l2=[ + 6.040180337738628e-6, + 5.4254175153621895e-6, + 5.677698851333843e-6, + 5.8017136892469794e-6, + 1.3637854615117974e-5, + ], + linf=[ + 0.00013996924184311865, + 0.00013681539559939893, + 0.00013681539539733834, + 0.00013681539541021692, + 0.00016833038543762058, + ], + # Decrease tolerance of adaptive time stepping to get similar results across different systems + abstol=1.0e-11, reltol=1.0e-11, + coverage_override=(trees_per_cube_face = (1, 1), polydeg = 3)) # Prevent long compile time in CI + # 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)) < 1000 + end +end - @trixi_testset "elixir_euler_circular_wind_nonconforming.jl" begin - @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_circular_wind_nonconforming.jl"), - l2 = [1.573832094977477e-7, 3.863090659429634e-5, 3.867293305754584e-5, 3.686550296950078e-5, 0.05508968493733932], - linf = [2.2695202613887133e-6, 0.0005314968179916946, 0.0005314969614147458, 0.0005130280733059617, 0.7944959432352334], - tspan = (0.0, 2e2), - coverage_override = (trees_per_cube_face=(1, 1), polydeg=3)) # Prevent long compile time in CI - # 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)) < 1000 - end - end +@trixi_testset "elixir_euler_circular_wind_nonconforming.jl" begin + @test_trixi_include(joinpath(EXAMPLES_DIR, + "elixir_euler_circular_wind_nonconforming.jl"), + l2=[ + 1.573832094977477e-7, + 3.863090659429634e-5, + 3.867293305754584e-5, + 3.686550296950078e-5, + 0.05508968493733932, + ], + linf=[ + 2.2695202613887133e-6, + 0.0005314968179916946, + 0.0005314969614147458, + 0.0005130280733059617, + 0.7944959432352334, + ], + tspan=(0.0, 2e2), + coverage_override=(trees_per_cube_face = (1, 1), polydeg = 3)) # Prevent long compile time in CI + # 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)) < 1000 + end +end - @trixi_testset "elixir_euler_baroclinic_instability.jl" begin - @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_baroclinic_instability.jl"), - l2 = [6.725065410642336e-7, 0.00021710117340245454, 0.000438679759422352, 0.00020836356588024185, 0.07602006689579247], - linf = [1.9101671995258585e-5, 0.029803626911022396, 0.04847630924006063, 0.022001371349740104, 4.847761006938526], - tspan = (0.0, 1e2), - # Decrease tolerance of adaptive time stepping to get similar results across different systems - abstol=1.0e-9, reltol=1.0e-9, - coverage_override = (trees_per_cube_face=(1, 1), polydeg=3)) # Prevent long compile time in CI - # 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)) < 1000 - end - end +@trixi_testset "elixir_euler_baroclinic_instability.jl" begin + @test_trixi_include(joinpath(EXAMPLES_DIR, + "elixir_euler_baroclinic_instability.jl"), + l2=[ + 6.725065410642336e-7, + 0.00021710117340245454, + 0.000438679759422352, + 0.00020836356588024185, + 0.07602006689579247, + ], + linf=[ + 1.9101671995258585e-5, + 0.029803626911022396, + 0.04847630924006063, + 0.022001371349740104, + 4.847761006938526, + ], + tspan=(0.0, 1e2), + # Decrease tolerance of adaptive time stepping to get similar results across different systems + abstol=1.0e-9, reltol=1.0e-9, + coverage_override=(trees_per_cube_face = (1, 1), polydeg = 3)) # Prevent long compile time in CI + # 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)) < 1000 + end +end - @trixi_testset "elixir_euler_source_terms_nonperiodic_hohqmesh.jl" begin - @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_source_terms_nonperiodic_hohqmesh.jl"), - l2 = [0.0042023406458005464, 0.004122532789279737, 0.0042448149597303616, 0.0036361316700401765, 0.007389845952982495], - linf = [0.04530610539892499, 0.02765695110527666, 0.05670295599308606, 0.048396544302230504, 0.1154589758186293]) - # 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)) < 1000 - end - end +@trixi_testset "elixir_euler_source_terms_nonperiodic_hohqmesh.jl" begin + @test_trixi_include(joinpath(EXAMPLES_DIR, + "elixir_euler_source_terms_nonperiodic_hohqmesh.jl"), + l2=[ + 0.0042023406458005464, + 0.004122532789279737, + 0.0042448149597303616, + 0.0036361316700401765, + 0.007389845952982495, + ], + linf=[ + 0.04530610539892499, + 0.02765695110527666, + 0.05670295599308606, + 0.048396544302230504, + 0.1154589758186293, + ]) + # 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)) < 1000 + end +end - @trixi_testset "elixir_mhd_alfven_wave_nonconforming.jl" begin - @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_mhd_alfven_wave_nonconforming.jl"), - l2 = [0.00019018725889431733, 0.0006523517707148006, 0.0002401595437705759, 0.0007796920661427565, - 0.0007095787460334334, 0.0006558819731628876, 0.0003565026134076906, 0.0007904654548841712, - 9.437300326448332e-7], - linf = [0.0012482306861187897, 0.006408776208178299, 0.0016845452099629663, 0.0068711236542984555, - 0.004626581522263695, 0.006614624811393632, 0.0030068344747734566, 0.008277825749754025, - 1.3475027166309006e-5], - tspan = (0.0, 0.25), - coverage_override = (trees_per_dimension=(1, 1, 1),)) - # 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)) < 1000 - end - end +@trixi_testset "elixir_mhd_alfven_wave_nonconforming.jl" begin + @test_trixi_include(joinpath(EXAMPLES_DIR, + "elixir_mhd_alfven_wave_nonconforming.jl"), + l2=[0.00019018725889431733, 0.0006523517707148006, + 0.0002401595437705759, 0.0007796920661427565, + 0.0007095787460334334, 0.0006558819731628876, + 0.0003565026134076906, 0.0007904654548841712, + 9.437300326448332e-7], + linf=[0.0012482306861187897, 0.006408776208178299, + 0.0016845452099629663, 0.0068711236542984555, + 0.004626581522263695, 0.006614624811393632, + 0.0030068344747734566, 0.008277825749754025, + 1.3475027166309006e-5], + tspan=(0.0, 0.25), + coverage_override=(trees_per_dimension = (1, 1, 1),)) + # 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)) < 1000 + end +end - @trixi_testset "elixir_mhd_shockcapturing_amr.jl" begin +@trixi_testset "elixir_mhd_shockcapturing_amr.jl" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_mhd_shockcapturing_amr.jl"), - l2 = [0.006298541670176575, 0.0064368506652601265, 0.007108729762852636, 0.006530420607206385, - 0.02061185869237284, 0.005562033787605515, 0.007571716276627825, 0.005571862660453231, - 3.909755063709152e-6], - linf = [0.20904054009050665, 0.18622917151105936, 0.2347957890323218, 0.19432508025509926, - 0.6858860133405615, 0.15172116633332622, 0.22432820727833747, 0.16805989780225183, - 0.000535219040687628], - tspan = (0.0, 0.04), - coverage_override = (maxiters=6, initial_refinement_level=1, base_level=1, max_level=2)) - # 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)) < 1000 - end - end + l2=[0.006298541670176575, 0.0064368506652601265, + 0.007108729762852636, 0.006530420607206385, + 0.02061185869237284, 0.005562033787605515, + 0.007571716276627825, 0.005571862660453231, + 3.909755063709152e-6], + linf=[0.20904054009050665, 0.18622917151105936, + 0.2347957890323218, 0.19432508025509926, + 0.6858860133405615, 0.15172116633332622, + 0.22432820727833747, 0.16805989780225183, + 0.000535219040687628], + tspan=(0.0, 0.04), + coverage_override=(maxiters = 6, initial_refinement_level = 1, + base_level = 1, max_level = 2)) + # 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)) < 1000 + end +end end # Clean up afterwards: delete Trixi.jl output directory -@test_nowarn rm(outdir, recursive=true) +@test_nowarn rm(outdir, recursive = true) -end # module +end # module \ No newline at end of file From aca8cb75b8163b905a4c6de4b0139dd6c3ed2bd0 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Mon, 30 Oct 2023 17:40:36 +0100 Subject: [PATCH 06/19] format --- src/equations/compressible_euler_1d.jl | 2 +- src/equations/compressible_euler_2d.jl | 4 ++-- src/equations/compressible_euler_3d.jl | 4 ++-- test/test_p4est_2d.jl | 28 +++++++++++++++++++++++- test/test_p4est_3d.jl | 30 +++++++++++++++++++++++++- test/test_tree_1d_euler.jl | 16 ++++++++++++++ test/test_tree_2d_euler.jl | 26 ++++++++++++++++++++++ test/test_tree_3d_euler.jl | 28 ++++++++++++++++++++++++ test/test_unit.jl | 9 +++++--- 9 files changed, 137 insertions(+), 10 deletions(-) diff --git a/src/equations/compressible_euler_1d.jl b/src/equations/compressible_euler_1d.jl index dede521e825..1b76d716119 100644 --- a/src/equations/compressible_euler_1d.jl +++ b/src/equations/compressible_euler_1d.jl @@ -826,7 +826,7 @@ Compactly summarized: [Link](https://metaphor.ethz.ch/x/2019/hs/401-4671-00L/literature/mishra_hyperbolic_pdes.pdf) """ function min_max_speed_einfeldt(u_ll, u_rr, orientation::Integer, - equations::CompressibleEulerEquations1D) + equations::CompressibleEulerEquations1D) # Calculate primitive variables, enthalpy and speed of sound rho_ll, v_ll, p_ll = cons2prim(u_ll, equations) rho_rr, v_rr, p_rr = cons2prim(u_rr, equations) diff --git a/src/equations/compressible_euler_2d.jl b/src/equations/compressible_euler_2d.jl index 13e2c302e89..3b266f5f7be 100644 --- a/src/equations/compressible_euler_2d.jl +++ b/src/equations/compressible_euler_2d.jl @@ -1268,7 +1268,7 @@ of the numerical flux. [DOI: 10.1016/0021-9991(91)90211-3](https://doi.org/10.1016/0021-9991(91)90211-3) """ function min_max_speed_einfeldt(u_ll, u_rr, orientation::Integer, - equations::CompressibleEulerEquations2D) + equations::CompressibleEulerEquations2D) # Calculate primitive variables, enthalpy and speed of sound rho_ll, v1_ll, v2_ll, p_ll = cons2prim(u_ll, equations) rho_rr, v1_rr, v2_rr, p_rr = cons2prim(u_rr, equations) @@ -1325,7 +1325,7 @@ of the numerical flux. [DOI: 10.1016/0021-9991(91)90211-3](https://doi.org/10.1016/0021-9991(91)90211-3) """ function min_max_speed_einfeldt(u_ll, u_rr, normal_direction::AbstractVector, - equations::CompressibleEulerEquations2D) + equations::CompressibleEulerEquations2D) # Calculate primitive variables, enthalpy and speed of sound rho_ll, v1_ll, v2_ll, p_ll = cons2prim(u_ll, equations) rho_rr, v1_rr, v2_rr, p_rr = cons2prim(u_rr, equations) diff --git a/src/equations/compressible_euler_3d.jl b/src/equations/compressible_euler_3d.jl index 6de75347116..1267fa9f34b 100644 --- a/src/equations/compressible_euler_3d.jl +++ b/src/equations/compressible_euler_3d.jl @@ -1337,7 +1337,7 @@ of the numerical flux. [DOI: 10.1016/0021-9991(91)90211-3](https://doi.org/10.1016/0021-9991(91)90211-3) """ function min_max_speed_einfeldt(u_ll, u_rr, orientation::Integer, - equations::CompressibleEulerEquations3D) + equations::CompressibleEulerEquations3D) # Calculate primitive variables, enthalpy and speed of sound rho_ll, v1_ll, v2_ll, v3_ll, p_ll = cons2prim(u_ll, equations) rho_rr, v1_rr, v2_rr, v3_rr, p_rr = cons2prim(u_rr, equations) @@ -1398,7 +1398,7 @@ of the numerical flux. [DOI: 10.1016/0021-9991(91)90211-3](https://doi.org/10.1016/0021-9991(91)90211-3) """ function min_max_speed_einfeldt(u_ll, u_rr, normal_direction::AbstractVector, - equations::CompressibleEulerEquations3D) + equations::CompressibleEulerEquations3D) # Calculate primitive variables, enthalpy and speed of sound rho_ll, v1_ll, v2_ll, v3_ll, p_ll = cons2prim(u_ll, equations) rho_rr, v1_rr, v2_rr, v3_rr, p_rr = cons2prim(u_rr, equations) diff --git a/test/test_p4est_2d.jl b/test/test_p4est_2d.jl index 36365b3eec1..4e58c35f075 100644 --- a/test/test_p4est_2d.jl +++ b/test/test_p4est_2d.jl @@ -200,6 +200,32 @@ end end end +@trixi_testset "elixir_euler_sedov.jl (HLLE)" begin + @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_sedov.jl"), + l2=[ + 0.411541263324004, + 0.2558929632770186, + 0.2558929632770193, + 1.298715766843915, + ], + linf=[ + 1.3457201726152221, + 1.3138961427140758, + 1.313896142714079, + 6.293305112638921, + ], + surface_flux=FluxHLL(min_max_speed_einfeldt), + tspan=(0.0, 0.3)) + # 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)) < 1000 + end +end + @trixi_testset "elixir_euler_blast_wave_amr.jl" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_blast_wave_amr.jl"), l2=[ @@ -460,4 +486,4 @@ end # Clean up afterwards: delete Trixi.jl output directory @test_nowarn rm(outdir, recursive = true) -end # module \ No newline at end of file +end # module diff --git a/test/test_p4est_3d.jl b/test/test_p4est_3d.jl index 8dda9f2fa9d..e7408daa4ea 100644 --- a/test/test_p4est_3d.jl +++ b/test/test_p4est_3d.jl @@ -287,6 +287,34 @@ end end end +@trixi_testset "elixir_euler_sedov.jl (HLLE)" begin + @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_sedov.jl"), + l2=[ + 0.09946224487902565, + 0.04863386374672001, + 0.048633863746720116, + 0.04863386374672032, + 0.3751015774232693, + ], + linf=[ + 0.789241521871487, + 0.42046970270100276, + 0.42046970270100276, + 0.4204697027010028, + 4.730877375538398, + ], + tspan=(0.0, 0.3), + surface_flux=FluxHLL(min_max_speed_einfeldt)) + # 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)) < 1000 + end +end + @trixi_testset "elixir_euler_source_terms_nonconforming_earth.jl" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_source_terms_nonconforming_earth.jl"), @@ -458,4 +486,4 @@ end # Clean up afterwards: delete Trixi.jl output directory @test_nowarn rm(outdir, recursive = true) -end # module \ No newline at end of file +end # module diff --git a/test/test_tree_1d_euler.jl b/test/test_tree_1d_euler.jl index f01124509cb..9d7022700bc 100644 --- a/test/test_tree_1d_euler.jl +++ b/test/test_tree_1d_euler.jl @@ -281,6 +281,22 @@ end end end +@trixi_testset "elixir_euler_sedov_blast_wave.jl (HLLE)" begin + @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_sedov_blast_wave.jl"), + l2=[0.6442208390304879, 0.508817280068289, 0.9482809853033687], + linf=[3.007059066482486, 2.4678899558345506, 2.3952311739389787], + tspan=(0.0, 0.5), + surface_flux=FluxHLL(min_max_speed_einfeldt)) + # 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)) < 1000 + end +end + @trixi_testset "elixir_euler_sedov_blast_wave_pure_fv.jl" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_sedov_blast_wave_pure_fv.jl"), diff --git a/test/test_tree_2d_euler.jl b/test/test_tree_2d_euler.jl index af7c5d8324c..8d9c796ecf2 100644 --- a/test/test_tree_2d_euler.jl +++ b/test/test_tree_2d_euler.jl @@ -422,6 +422,32 @@ end end end +@trixi_testset "elixir_euler_sedov_blast_wave.jl (HLLE)" begin + @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_sedov_blast_wave.jl"), + l2=[ + 0.35267160519013807, + 0.17218307108369638, + 0.17218308329362564, + 0.6236143065592946, + ], + linf=[ + 2.7748404581629016, + 1.828111132651005, + 1.8281111866225315, + 6.24263754517303, + ], + tspan=(0.0, 0.5), + surface_flux=FluxHLL(min_max_speed_einfeldt)) + # 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)) < 1000 + end +end + @trixi_testset "elixir_euler_sedov_blast_wave_neuralnetwork_perssonperaire.jl" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_sedov_blast_wave_neuralnetwork_perssonperaire.jl"), diff --git a/test/test_tree_3d_euler.jl b/test/test_tree_3d_euler.jl index d96dcff3977..434a5af9785 100644 --- a/test/test_tree_3d_euler.jl +++ b/test/test_tree_3d_euler.jl @@ -473,6 +473,34 @@ end @test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000 end end + +@trixi_testset "elixir_euler_sedov_blast_wave.jl (HLLE)" begin + @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_sedov_blast_wave.jl"), + l2=[ + 0.0007871241159752619, + 0.0037168004033428146, + 0.0037168004033428094, + 0.0037168004033428514, + 0.011119869089205635, + ], + linf=[ + 0.13982864363612468, + 0.786004687738243, + 0.786004687738243, + 0.7860046877382431, + 1.7082524045150382, + ], + tspan=(0.0, 0.01), + surface_flux=FluxHLL(min_max_speed_einfeldt)) + # 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)) < 1000 + end +end end end # module diff --git a/test/test_unit.jl b/test/test_unit.jl index 5422db7a66d..bcafb0d849b 100644 --- a/test/test_unit.jl +++ b/test/test_unit.jl @@ -892,9 +892,12 @@ end equations = CompressibleEulerEquations1D(1.4) u = SVector(1.1, 2.34, 5.5) + # Test HLL flux with min_max_speed_einfeldt + flux_hll = FluxHLL(min_max_speed_einfeldt) + orientations = [1] for orientation in orientations - @test flux_hlle(u, u, orientation, equations) ≈ flux(u, orientation, equations) + @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) end equations = CompressibleEulerEquations2D(1.4) @@ -902,7 +905,7 @@ end orientations = [1, 2] for orientation in orientations - @test flux_hlle(u, u, orientation, equations) ≈ flux(u, orientation, equations) + @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) end normal_directions = [SVector(1.0, 0.0), @@ -920,7 +923,7 @@ end orientations = [1, 2, 3] for orientation in orientations - @test flux_hlle(u, u, orientation, equations) ≈ flux(u, orientation, equations) + @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) end normal_directions = [SVector(1.0, 0.0, 0.0), From 6e10fa5298dbe768369542f4a5fdf328f3e50a02 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Mon, 30 Oct 2023 18:10:55 +0100 Subject: [PATCH 07/19] do not export hlle --- src/Trixi.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Trixi.jl b/src/Trixi.jl index 5cb3cf0a9fe..08961c74f20 100644 --- a/src/Trixi.jl +++ b/src/Trixi.jl @@ -159,7 +159,7 @@ export LaplaceDiffusion1D, LaplaceDiffusion2D, LaplaceDiffusion3D, export GradientVariablesPrimitive, GradientVariablesEntropy -export flux, flux_central, flux_lax_friedrichs, flux_hll, flux_hllc, flux_hlle, +export flux, flux_central, flux_lax_friedrichs, flux_hll, flux_hllc, flux_godunov, flux_chandrashekar, flux_ranocha, flux_derigs_etal, flux_hindenlang_gassner, flux_nonconservative_powell, From 7d089e5129a15db9626a3eb23a77909c3d5dce10 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Tue, 31 Oct 2023 08:44:57 +0100 Subject: [PATCH 08/19] Correct test vals --- test/test_tree_2d_euler.jl | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/test_tree_2d_euler.jl b/test/test_tree_2d_euler.jl index 8d9c796ecf2..1191193d5e1 100644 --- a/test/test_tree_2d_euler.jl +++ b/test/test_tree_2d_euler.jl @@ -425,16 +425,16 @@ end @trixi_testset "elixir_euler_sedov_blast_wave.jl (HLLE)" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_sedov_blast_wave.jl"), l2=[ - 0.35267160519013807, - 0.17218307108369638, - 0.17218308329362564, - 0.6236143065592946, + 0.3526715976977786, + 0.17218306514429005, + 0.1721830825298843, + 0.6236143054619037, ], linf=[ - 2.7748404581629016, - 1.828111132651005, - 1.8281111866225315, - 6.24263754517303, + 2.77484045816607, + 1.8281110252781547, + 1.8281111639570162, + 6.24263735888126, ], tspan=(0.0, 0.5), surface_flux=FluxHLL(min_max_speed_einfeldt)) From c60f434dc63603223b447dd62204cee558d4345b Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Tue, 31 Oct 2023 10:57:21 +0100 Subject: [PATCH 09/19] test values CI --- test/test_tree_2d_euler.jl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/test_tree_2d_euler.jl b/test/test_tree_2d_euler.jl index 1191193d5e1..60c8eab55fd 100644 --- a/test/test_tree_2d_euler.jl +++ b/test/test_tree_2d_euler.jl @@ -425,15 +425,15 @@ end @trixi_testset "elixir_euler_sedov_blast_wave.jl (HLLE)" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_sedov_blast_wave.jl"), l2=[ - 0.3526715976977786, - 0.17218306514429005, - 0.1721830825298843, + 0.35267163994805895, + 0.17218309942728624, + 0.1721830927297762, 0.6236143054619037, ], linf=[ 2.77484045816607, - 1.8281110252781547, - 1.8281111639570162, + 1.8281111797832708, + 1.8281111060830213, 6.24263735888126, ], tspan=(0.0, 0.5), From c11d0080de0f77fa4eb4f2dd4d3a367931c137c1 Mon Sep 17 00:00:00 2001 From: Daniel Doehring Date: Tue, 31 Oct 2023 14:46:30 +0100 Subject: [PATCH 10/19] Update src/equations/compressible_euler_2d.jl Co-authored-by: Hendrik Ranocha --- src/equations/compressible_euler_2d.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/equations/compressible_euler_2d.jl b/src/equations/compressible_euler_2d.jl index 3b266f5f7be..bd57117fafe 100644 --- a/src/equations/compressible_euler_2d.jl +++ b/src/equations/compressible_euler_2d.jl @@ -1324,7 +1324,7 @@ of the numerical flux. On Godunov-type methods near low densities. [DOI: 10.1016/0021-9991(91)90211-3](https://doi.org/10.1016/0021-9991(91)90211-3) """ -function min_max_speed_einfeldt(u_ll, u_rr, normal_direction::AbstractVector, +@inline function min_max_speed_einfeldt(u_ll, u_rr, normal_direction::AbstractVector, equations::CompressibleEulerEquations2D) # Calculate primitive variables, enthalpy and speed of sound rho_ll, v1_ll, v2_ll, p_ll = cons2prim(u_ll, equations) From ad17e0e9fd88c3f4360296df9530422ad37761a2 Mon Sep 17 00:00:00 2001 From: Daniel Doehring Date: Tue, 31 Oct 2023 14:47:03 +0100 Subject: [PATCH 11/19] Update src/equations/compressible_euler_1d.jl Co-authored-by: Hendrik Ranocha --- src/equations/compressible_euler_1d.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/equations/compressible_euler_1d.jl b/src/equations/compressible_euler_1d.jl index 1b76d716119..6df1f8c8c6d 100644 --- a/src/equations/compressible_euler_1d.jl +++ b/src/equations/compressible_euler_1d.jl @@ -825,7 +825,7 @@ Compactly summarized: Numerical methods for conservation laws and related equations. [Link](https://metaphor.ethz.ch/x/2019/hs/401-4671-00L/literature/mishra_hyperbolic_pdes.pdf) """ -function min_max_speed_einfeldt(u_ll, u_rr, orientation::Integer, +@inline function min_max_speed_einfeldt(u_ll, u_rr, orientation::Integer, equations::CompressibleEulerEquations1D) # Calculate primitive variables, enthalpy and speed of sound rho_ll, v_ll, p_ll = cons2prim(u_ll, equations) From 2bb19d07a6edf2cc655b236fd2f3399ae1c36fbe Mon Sep 17 00:00:00 2001 From: Daniel Doehring Date: Tue, 31 Oct 2023 14:47:17 +0100 Subject: [PATCH 12/19] Update src/equations/compressible_euler_2d.jl Co-authored-by: Hendrik Ranocha --- src/equations/compressible_euler_2d.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/equations/compressible_euler_2d.jl b/src/equations/compressible_euler_2d.jl index bd57117fafe..040fb7bef32 100644 --- a/src/equations/compressible_euler_2d.jl +++ b/src/equations/compressible_euler_2d.jl @@ -1267,7 +1267,7 @@ of the numerical flux. On Godunov-type methods near low densities. [DOI: 10.1016/0021-9991(91)90211-3](https://doi.org/10.1016/0021-9991(91)90211-3) """ -function min_max_speed_einfeldt(u_ll, u_rr, orientation::Integer, +@inline function min_max_speed_einfeldt(u_ll, u_rr, orientation::Integer, equations::CompressibleEulerEquations2D) # Calculate primitive variables, enthalpy and speed of sound rho_ll, v1_ll, v2_ll, p_ll = cons2prim(u_ll, equations) From 3825ce105e960efe175533329dc0053dbd233fa0 Mon Sep 17 00:00:00 2001 From: Daniel Doehring Date: Tue, 31 Oct 2023 14:47:34 +0100 Subject: [PATCH 13/19] Update src/equations/compressible_euler_3d.jl Co-authored-by: Hendrik Ranocha --- src/equations/compressible_euler_3d.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/equations/compressible_euler_3d.jl b/src/equations/compressible_euler_3d.jl index 1267fa9f34b..41eced5823f 100644 --- a/src/equations/compressible_euler_3d.jl +++ b/src/equations/compressible_euler_3d.jl @@ -1336,7 +1336,7 @@ of the numerical flux. On Godunov-type methods near low densities. [DOI: 10.1016/0021-9991(91)90211-3](https://doi.org/10.1016/0021-9991(91)90211-3) """ -function min_max_speed_einfeldt(u_ll, u_rr, orientation::Integer, +@inline function min_max_speed_einfeldt(u_ll, u_rr, orientation::Integer, equations::CompressibleEulerEquations3D) # Calculate primitive variables, enthalpy and speed of sound rho_ll, v1_ll, v2_ll, v3_ll, p_ll = cons2prim(u_ll, equations) From 2a08efaadc1375ba04e005cff07d1a3ba34aa897 Mon Sep 17 00:00:00 2001 From: Daniel Doehring Date: Tue, 31 Oct 2023 14:47:54 +0100 Subject: [PATCH 14/19] Update src/equations/compressible_euler_3d.jl Co-authored-by: Hendrik Ranocha --- src/equations/compressible_euler_3d.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/equations/compressible_euler_3d.jl b/src/equations/compressible_euler_3d.jl index 41eced5823f..678476ce459 100644 --- a/src/equations/compressible_euler_3d.jl +++ b/src/equations/compressible_euler_3d.jl @@ -1397,7 +1397,7 @@ of the numerical flux. On Godunov-type methods near low densities. [DOI: 10.1016/0021-9991(91)90211-3](https://doi.org/10.1016/0021-9991(91)90211-3) """ -function min_max_speed_einfeldt(u_ll, u_rr, normal_direction::AbstractVector, +@inline function min_max_speed_einfeldt(u_ll, u_rr, normal_direction::AbstractVector, equations::CompressibleEulerEquations3D) # Calculate primitive variables, enthalpy and speed of sound rho_ll, v1_ll, v2_ll, v3_ll, p_ll = cons2prim(u_ll, equations) From a0c0221bdb85b1beb6b77fba489ebb7410219f7d Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Tue, 31 Oct 2023 15:13:47 +0100 Subject: [PATCH 15/19] apply suggestions --- src/Trixi.jl | 2 +- src/equations/compressible_euler_1d.jl | 2 +- src/equations/compressible_euler_2d.jl | 4 +-- src/equations/compressible_euler_3d.jl | 4 +-- src/equations/numerical_fluxes.jl | 7 +++++ test/test_p4est_2d.jl | 2 +- test/test_p4est_3d.jl | 2 +- test/test_tree_1d_euler.jl | 2 +- test/test_tree_2d_euler.jl | 2 +- test/test_tree_3d_euler.jl | 2 +- test/test_unit.jl | 37 ++++++++++---------------- 11 files changed, 32 insertions(+), 34 deletions(-) diff --git a/src/Trixi.jl b/src/Trixi.jl index 7f5a2eb8f89..97d518d5b78 100644 --- a/src/Trixi.jl +++ b/src/Trixi.jl @@ -159,7 +159,7 @@ export LaplaceDiffusion1D, LaplaceDiffusion2D, LaplaceDiffusion3D, export GradientVariablesPrimitive, GradientVariablesEntropy -export flux, flux_central, flux_lax_friedrichs, flux_hll, flux_hllc, +export flux, flux_central, flux_lax_friedrichs, flux_hll, flux_hllc, flux_hlle, flux_godunov, flux_chandrashekar, flux_ranocha, flux_derigs_etal, flux_hindenlang_gassner, flux_nonconservative_powell, flux_nonconservative_powell_local_symmetric, diff --git a/src/equations/compressible_euler_1d.jl b/src/equations/compressible_euler_1d.jl index 6df1f8c8c6d..05c38ce791d 100644 --- a/src/equations/compressible_euler_1d.jl +++ b/src/equations/compressible_euler_1d.jl @@ -826,7 +826,7 @@ Compactly summarized: [Link](https://metaphor.ethz.ch/x/2019/hs/401-4671-00L/literature/mishra_hyperbolic_pdes.pdf) """ @inline function min_max_speed_einfeldt(u_ll, u_rr, orientation::Integer, - equations::CompressibleEulerEquations1D) + equations::CompressibleEulerEquations1D) # Calculate primitive variables, enthalpy and speed of sound rho_ll, v_ll, p_ll = cons2prim(u_ll, equations) rho_rr, v_rr, p_rr = cons2prim(u_rr, equations) diff --git a/src/equations/compressible_euler_2d.jl b/src/equations/compressible_euler_2d.jl index 040fb7bef32..6c8f2e1e848 100644 --- a/src/equations/compressible_euler_2d.jl +++ b/src/equations/compressible_euler_2d.jl @@ -1268,7 +1268,7 @@ of the numerical flux. [DOI: 10.1016/0021-9991(91)90211-3](https://doi.org/10.1016/0021-9991(91)90211-3) """ @inline function min_max_speed_einfeldt(u_ll, u_rr, orientation::Integer, - equations::CompressibleEulerEquations2D) + equations::CompressibleEulerEquations2D) # Calculate primitive variables, enthalpy and speed of sound rho_ll, v1_ll, v2_ll, p_ll = cons2prim(u_ll, equations) rho_rr, v1_rr, v2_rr, p_rr = cons2prim(u_rr, equations) @@ -1325,7 +1325,7 @@ of the numerical flux. [DOI: 10.1016/0021-9991(91)90211-3](https://doi.org/10.1016/0021-9991(91)90211-3) """ @inline function min_max_speed_einfeldt(u_ll, u_rr, normal_direction::AbstractVector, - equations::CompressibleEulerEquations2D) + equations::CompressibleEulerEquations2D) # Calculate primitive variables, enthalpy and speed of sound rho_ll, v1_ll, v2_ll, p_ll = cons2prim(u_ll, equations) rho_rr, v1_rr, v2_rr, p_rr = cons2prim(u_rr, equations) diff --git a/src/equations/compressible_euler_3d.jl b/src/equations/compressible_euler_3d.jl index 678476ce459..6372cd07798 100644 --- a/src/equations/compressible_euler_3d.jl +++ b/src/equations/compressible_euler_3d.jl @@ -1337,7 +1337,7 @@ of the numerical flux. [DOI: 10.1016/0021-9991(91)90211-3](https://doi.org/10.1016/0021-9991(91)90211-3) """ @inline function min_max_speed_einfeldt(u_ll, u_rr, orientation::Integer, - equations::CompressibleEulerEquations3D) + equations::CompressibleEulerEquations3D) # Calculate primitive variables, enthalpy and speed of sound rho_ll, v1_ll, v2_ll, v3_ll, p_ll = cons2prim(u_ll, equations) rho_rr, v1_rr, v2_rr, v3_rr, p_rr = cons2prim(u_rr, equations) @@ -1398,7 +1398,7 @@ of the numerical flux. [DOI: 10.1016/0021-9991(91)90211-3](https://doi.org/10.1016/0021-9991(91)90211-3) """ @inline function min_max_speed_einfeldt(u_ll, u_rr, normal_direction::AbstractVector, - equations::CompressibleEulerEquations3D) + equations::CompressibleEulerEquations3D) # Calculate primitive variables, enthalpy and speed of sound rho_ll, v1_ll, v2_ll, v3_ll, p_ll = cons2prim(u_ll, equations) rho_rr, v1_rr, v2_rr, v3_rr, p_rr = cons2prim(u_rr, equations) diff --git a/src/equations/numerical_fluxes.jl b/src/equations/numerical_fluxes.jl index 87010275f2c..44c536e9a89 100644 --- a/src/equations/numerical_fluxes.jl +++ b/src/equations/numerical_fluxes.jl @@ -304,6 +304,13 @@ See [`FluxHLL`](@ref). """ const flux_hll = FluxHLL() +""" + flux_hlle + +See [`min_max_speed_einfeldt`](@ref). +""" +const flux_hlle = FluxHLL(min_max_speed_einfeldt) + # TODO: TrixiShallowWater: move the chen_noelle flux structure to the new package # An empty version of the `min_max_speed_chen_noelle` function is declared here diff --git a/test/test_p4est_2d.jl b/test/test_p4est_2d.jl index 4e58c35f075..546e5bff8a6 100644 --- a/test/test_p4est_2d.jl +++ b/test/test_p4est_2d.jl @@ -214,7 +214,7 @@ end 1.313896142714079, 6.293305112638921, ], - surface_flux=FluxHLL(min_max_speed_einfeldt), + surface_flux=flux_hlle, tspan=(0.0, 0.3)) # Ensure that we do not have excessive memory allocations # (e.g., from type instabilities) diff --git a/test/test_p4est_3d.jl b/test/test_p4est_3d.jl index e7408daa4ea..81d831eade3 100644 --- a/test/test_p4est_3d.jl +++ b/test/test_p4est_3d.jl @@ -304,7 +304,7 @@ end 4.730877375538398, ], tspan=(0.0, 0.3), - surface_flux=FluxHLL(min_max_speed_einfeldt)) + surface_flux=flux_hlles) # Ensure that we do not have excessive memory allocations # (e.g., from type instabilities) let diff --git a/test/test_tree_1d_euler.jl b/test/test_tree_1d_euler.jl index 9d7022700bc..62afc5baee3 100644 --- a/test/test_tree_1d_euler.jl +++ b/test/test_tree_1d_euler.jl @@ -286,7 +286,7 @@ end l2=[0.6442208390304879, 0.508817280068289, 0.9482809853033687], linf=[3.007059066482486, 2.4678899558345506, 2.3952311739389787], tspan=(0.0, 0.5), - surface_flux=FluxHLL(min_max_speed_einfeldt)) + surface_flux=flux_hlle) # Ensure that we do not have excessive memory allocations # (e.g., from type instabilities) let diff --git a/test/test_tree_2d_euler.jl b/test/test_tree_2d_euler.jl index 60c8eab55fd..2452f058197 100644 --- a/test/test_tree_2d_euler.jl +++ b/test/test_tree_2d_euler.jl @@ -437,7 +437,7 @@ end 6.24263735888126, ], tspan=(0.0, 0.5), - surface_flux=FluxHLL(min_max_speed_einfeldt)) + surface_flux=flux_hlle) # Ensure that we do not have excessive memory allocations # (e.g., from type instabilities) let diff --git a/test/test_tree_3d_euler.jl b/test/test_tree_3d_euler.jl index 434a5af9785..02e657e001a 100644 --- a/test/test_tree_3d_euler.jl +++ b/test/test_tree_3d_euler.jl @@ -491,7 +491,7 @@ end 1.7082524045150382, ], tspan=(0.0, 0.01), - surface_flux=FluxHLL(min_max_speed_einfeldt)) + surface_flux=flux_hlle) # Ensure that we do not have excessive memory allocations # (e.g., from type instabilities) let diff --git a/test/test_unit.jl b/test/test_unit.jl index bcafb0d849b..de52178943e 100644 --- a/test/test_unit.jl +++ b/test/test_unit.jl @@ -892,12 +892,9 @@ end equations = CompressibleEulerEquations1D(1.4) u = SVector(1.1, 2.34, 5.5) - # Test HLL flux with min_max_speed_einfeldt - flux_hll = FluxHLL(min_max_speed_einfeldt) - orientations = [1] for orientation in orientations - @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) + @test flux_hlle(u, u, orientation, equations) ≈ flux(u, orientation, equations) end equations = CompressibleEulerEquations2D(1.4) @@ -905,7 +902,7 @@ end orientations = [1, 2] for orientation in orientations - @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) + @test flux_hlle(u, u, orientation, equations) ≈ flux(u, orientation, equations) end normal_directions = [SVector(1.0, 0.0), @@ -914,7 +911,7 @@ end SVector(-1.2, 0.3)] for normal_direction in normal_directions - @test flux_hll(u, u, normal_direction, equations) ≈ + @test flux_hlle(u, u, normal_direction, equations) ≈ flux(u, normal_direction, equations) end @@ -923,7 +920,7 @@ end orientations = [1, 2, 3] for orientation in orientations - @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) + @test flux_hlle(u, u, orientation, equations) ≈ flux(u, orientation, equations) end normal_directions = [SVector(1.0, 0.0, 0.0), @@ -933,18 +930,15 @@ end SVector(-1.2, 0.3, 1.4)] for normal_direction in normal_directions - @test flux_hll(u, u, normal_direction, equations) ≈ + @test flux_hlle(u, u, normal_direction, equations) ≈ flux(u, normal_direction, equations) end end @timed_testset "Consistency check for HLLE flux: SWE" begin - # Test HLL flux with min_max_speed_einfeldt - flux_hll = FluxHLL(min_max_speed_einfeldt) - equations = ShallowWaterEquations1D(gravity_constant = 9.81) u = SVector(1, 0.5, 0.0) - @test flux_hll(u, u, 1, equations) ≈ flux(u, 1, equations) + @test flux_hlle(u, u, 1, equations) ≈ flux(u, 1, equations) equations = ShallowWaterEquations2D(gravity_constant = 9.81) normal_directions = [SVector(1.0, 0.0), @@ -956,25 +950,22 @@ end u = SVector(1, 0.5, 0.5, 0.0) for orientation in orientations - @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) + @test flux_hlle(u, u, orientation, equations) ≈ flux(u, orientation, equations) end for normal_direction in normal_directions - @test flux_hll(u, u, normal_direction, equations) ≈ + @test flux_hlle(u, u, normal_direction, equations) ≈ flux(u, normal_direction, equations) end end @timed_testset "Consistency check for HLLE flux: MHD" begin - # Test HLL flux with min_max_speed_einfeldt - flux_hll = FluxHLL(min_max_speed_naive) - equations = IdealGlmMhdEquations1D(1.4) u_values = [SVector(1.0, 0.4, -0.5, 0.1, 1.0, 0.1, -0.2, 0.1), SVector(1.5, -0.2, 0.1, 0.2, 5.0, -0.1, 0.1, 0.2)] for u in u_values - @test flux_hll(u, u, 1, equations) ≈ flux(u, 1, equations) + @test flux_hlle(u, u, 1, equations) ≈ flux(u, 1, equations) end equations = IdealGlmMhdEquations2D(1.4, 5.0) #= c_h =# @@ -988,11 +979,11 @@ end SVector(1.5, -0.2, 0.1, 0.2, 5.0, -0.1, 0.1, 0.2, 0.2)] for u in u_values, orientation in orientations - @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) + @test flux_hlle(u, u, orientation, equations) ≈ flux(u, orientation, equations) end for u in u_values, normal_direction in normal_directions - @test flux_hll(u, u, normal_direction, equations) ≈ + @test flux_hlle(u, u, normal_direction, equations) ≈ flux(u, normal_direction, equations) end @@ -1008,11 +999,11 @@ end SVector(1.5, -0.2, 0.1, 0.2, 5.0, -0.1, 0.1, 0.2, 0.2)] for u in u_values, orientation in orientations - @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) + @test flux_hlle(u, u, orientation, equations) ≈ flux(u, orientation, equations) end for u in u_values, normal_direction in normal_directions - @test flux_hll(u, u, normal_direction, equations) ≈ + @test flux_hlle(u, u, normal_direction, equations) ≈ flux(u, normal_direction, equations) end end @@ -1245,7 +1236,7 @@ end u = SVector(1, 0.5, 0.5, 0.0) fluxes = [flux_central, flux_fjordholm_etal, flux_wintermeyer_etal, - flux_hll, FluxHLL(min_max_speed_davis), FluxHLL(min_max_speed_einfeldt)] + flux_hll, FluxHLL(min_max_speed_davis), flux_hlle] end @timed_testset "IdealGlmMhdEquations2D" begin From fb3dfc9f043301ffa5a135777c5c5b44ab7652ff Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Tue, 31 Oct 2023 15:18:27 +0100 Subject: [PATCH 16/19] additional sentence --- src/equations/numerical_fluxes.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/equations/numerical_fluxes.jl b/src/equations/numerical_fluxes.jl index 44c536e9a89..71782644b17 100644 --- a/src/equations/numerical_fluxes.jl +++ b/src/equations/numerical_fluxes.jl @@ -308,6 +308,7 @@ const flux_hll = FluxHLL() flux_hlle See [`min_max_speed_einfeldt`](@ref). +This is a [`FluxHLL`](@ref)-type two-wave solver with special estimates of the wave speeds. """ const flux_hlle = FluxHLL(min_max_speed_einfeldt) From 81bd303571c221849d11d36d9acb62f058c3ac8d Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Tue, 31 Oct 2023 15:20:18 +0100 Subject: [PATCH 17/19] Fix typo --- src/equations/compressible_euler_3d.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/equations/compressible_euler_3d.jl b/src/equations/compressible_euler_3d.jl index 6372cd07798..fc56f58025b 100644 --- a/src/equations/compressible_euler_3d.jl +++ b/src/equations/compressible_euler_3d.jl @@ -1322,7 +1322,7 @@ function flux_hllc(u_ll, u_rr, orientation::Integer, end """ - min_max_speed_einfeldtmin_max_speed_einfeldt(u_ll, u_rr, orientation, equations::CompressibleEulerEquations3D) + min_max_speed_einfeldt(u_ll, u_rr, orientation, equations::CompressibleEulerEquations3D) Computes the HLLE (Harten-Lax-van Leer-Einfeldt) flux for the compressible Euler equations. Special estimates of the signal velocites and linearization of the Riemann problem developed From d35503f2faf8a4a2fdcf30cb41a1541493fd24fc Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Tue, 31 Oct 2023 16:10:34 +0100 Subject: [PATCH 18/19] typos --- test/test_p4est_3d.jl | 2 +- test/test_unit.jl | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/test/test_p4est_3d.jl b/test/test_p4est_3d.jl index 81d831eade3..346c61c7448 100644 --- a/test/test_p4est_3d.jl +++ b/test/test_p4est_3d.jl @@ -304,7 +304,7 @@ end 4.730877375538398, ], tspan=(0.0, 0.3), - surface_flux=flux_hlles) + surface_flux=flux_hlle) # Ensure that we do not have excessive memory allocations # (e.g., from type instabilities) let diff --git a/test/test_unit.jl b/test/test_unit.jl index de52178943e..a73dfab5504 100644 --- a/test/test_unit.jl +++ b/test/test_unit.jl @@ -960,12 +960,14 @@ end end @timed_testset "Consistency check for HLLE flux: MHD" begin + # Note: min_max_speed_naive for MHD is essentially min_max_speed_einfeldt + equations = IdealGlmMhdEquations1D(1.4) u_values = [SVector(1.0, 0.4, -0.5, 0.1, 1.0, 0.1, -0.2, 0.1), SVector(1.5, -0.2, 0.1, 0.2, 5.0, -0.1, 0.1, 0.2)] for u in u_values - @test flux_hlle(u, u, 1, equations) ≈ flux(u, 1, equations) + @test flux_hll(u, u, 1, equations) ≈ flux(u, 1, equations) end equations = IdealGlmMhdEquations2D(1.4, 5.0) #= c_h =# @@ -979,11 +981,11 @@ end SVector(1.5, -0.2, 0.1, 0.2, 5.0, -0.1, 0.1, 0.2, 0.2)] for u in u_values, orientation in orientations - @test flux_hlle(u, u, orientation, equations) ≈ flux(u, orientation, equations) + @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) end for u in u_values, normal_direction in normal_directions - @test flux_hlle(u, u, normal_direction, equations) ≈ + @test flux_hll(u, u, normal_direction, equations) ≈ flux(u, normal_direction, equations) end @@ -999,11 +1001,11 @@ end SVector(1.5, -0.2, 0.1, 0.2, 5.0, -0.1, 0.1, 0.2, 0.2)] for u in u_values, orientation in orientations - @test flux_hlle(u, u, orientation, equations) ≈ flux(u, orientation, equations) + @test flux_hll(u, u, orientation, equations) ≈ flux(u, orientation, equations) end for u in u_values, normal_direction in normal_directions - @test flux_hlle(u, u, normal_direction, equations) ≈ + @test flux_hll(u, u, normal_direction, equations) ≈ flux(u, normal_direction, equations) end end From 1fc62b9f0ae58b838865244c0921d4d72949513c Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Tue, 31 Oct 2023 16:12:09 +0100 Subject: [PATCH 19/19] correct test vals --- test/test_tree_2d_euler.jl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/test_tree_2d_euler.jl b/test/test_tree_2d_euler.jl index 2452f058197..db36cb7d79f 100644 --- a/test/test_tree_2d_euler.jl +++ b/test/test_tree_2d_euler.jl @@ -425,15 +425,15 @@ end @trixi_testset "elixir_euler_sedov_blast_wave.jl (HLLE)" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_sedov_blast_wave.jl"), l2=[ - 0.35267163994805895, - 0.17218309942728624, - 0.1721830927297762, + 0.35267161504176747, + 0.17218309138797958, + 0.17218307467125854, 0.6236143054619037, ], linf=[ 2.77484045816607, - 1.8281111797832708, - 1.8281111060830213, + 1.8281111268370718, + 1.8281110470490887, 6.24263735888126, ], tspan=(0.0, 0.5),