|
| 1 | +# This test case is used to compute convergence rates via a linearized solution. |
| 2 | +# The setup follows the approach commonly adopted in benchmark studies; therefore, |
| 3 | +# a fixed CFL number is employed. |
| 4 | +# |
| 5 | +# References: |
| 6 | +# - Michael Baldauf and Slavko Brdar (2013): |
| 7 | +# "An analytic solution for linear gravity waves in a channel as a test |
| 8 | +# for numerical models using the non-hydrostatic, compressible Euler equations" |
| 9 | +# Q. J. R. Meteorol. Soc., DOI: 10.1002/qj.2105 |
| 10 | +# https://doi.org/10.1002/qj.2105 |
| 11 | +# |
| 12 | +# - Maciej Waruszewski, Jeremy E. Kozdon, Lucas C. Wilcox, Thomas H. Gibson, |
| 13 | +# and Francis X. Giraldo (2022): |
| 14 | +# "Entropy stable discontinuous Galerkin methods for balance laws |
| 15 | +# in non-conservative form: Applications to the Euler equations with gravity" |
| 16 | +# JCP, DOI: 10.1016/j.jcp.2022.111507 |
| 17 | +# https://doi.org/10.1016/j.jcp.2022.111507 |
| 18 | +# |
| 19 | +# - Marco Artiano, Oswald Knoth, Peter Spichtinger, Hendrik Ranocha (2025): |
| 20 | +# "Structure-Preserving High-Order Methods for the Compressible Euler Equations |
| 21 | +# in Potential Temperature Formulation for Atmospheric Flows" |
| 22 | +# https://arxiv.org/abs/2509.10311 |
| 23 | + |
| 24 | +using OrdinaryDiffEqSSPRK |
| 25 | +using Trixi, TrixiAtmo |
| 26 | + |
| 27 | +""" |
| 28 | + initial_condition_gravity_waves(x, t, |
| 29 | + equations::CompressibleEulerEnergyEquationsWithGravity2D) |
| 30 | +
|
| 31 | +Test cases for linearized analytical solution by |
| 32 | +- Baldauf, Michael and Brdar, Slavko (2013) |
| 33 | + An analytic solution for linear gravity waves in a channel as a test |
| 34 | + for numerical models using the non-hydrostatic, compressible {E}uler equations |
| 35 | + [DOI: 10.1002/qj.2105] (https://doi.org/10.1002/qj.2105) |
| 36 | +""" |
| 37 | +function initial_condition_gravity_waves(x, t, |
| 38 | + equations::CompressibleEulerInternalEnergyEquationsWithGravity2D) |
| 39 | + g = equations.g |
| 40 | + c_p = equations.c_p |
| 41 | + c_v = equations.c_v |
| 42 | + # center of perturbation |
| 43 | + x_c = 100_000.0 |
| 44 | + a = 5_000 |
| 45 | + H = 10_000 |
| 46 | + R = c_p - c_v # gas constant (dry air) |
| 47 | + T0 = 250 |
| 48 | + delta = g / (R * T0) |
| 49 | + DeltaT = 0.001 |
| 50 | + Tb = DeltaT * sinpi(x[2] / H) * exp(-(x[1] - x_c)^2 / a^2) |
| 51 | + ps = 100_000 # reference pressure |
| 52 | + rhos = ps / (T0 * R) |
| 53 | + rho_b = rhos * (-Tb / T0) |
| 54 | + p = ps * exp(-delta * x[2]) |
| 55 | + rho = rhos * exp(-delta * x[2]) + rho_b * exp(-0.5 * delta * x[2]) |
| 56 | + v1 = 20 |
| 57 | + v2 = 0 |
| 58 | + return prim2cons(SVector(rho, v1, v2, p, g * x[2]), equations) |
| 59 | +end |
| 60 | + |
| 61 | +equations = CompressibleEulerInternalEnergyEquationsWithGravity2D(c_p = 1004, |
| 62 | + c_v = 717, |
| 63 | + gravity = 9.81) |
| 64 | + |
| 65 | +surface_flux = (flux_conservative_es, flux_nonconservative_es) |
| 66 | +volume_flux = (flux_conservative_etec, flux_nonconservative_etec) |
| 67 | +polydeg = 3 |
| 68 | +solver = DGSEM(polydeg = polydeg, surface_flux = surface_flux, |
| 69 | + volume_integral = VolumeIntegralFluxDifferencing(volume_flux)) |
| 70 | + |
| 71 | +boundary_conditions = (; |
| 72 | + y_neg = boundary_condition_slip_wall, |
| 73 | + y_pos = boundary_condition_slip_wall) |
| 74 | + |
| 75 | +coordinates_min = (0.0, 0.0) |
| 76 | +coordinates_max = (300_000.0, 10_000.0) |
| 77 | +trees_per_dimension = (60, 8) |
| 78 | + |
| 79 | +mesh = P4estMesh(trees_per_dimension, polydeg = polydeg, |
| 80 | + coordinates_min = coordinates_min, coordinates_max = coordinates_max, |
| 81 | + periodicity = (true, false)) |
| 82 | + |
| 83 | +initial_condition = initial_condition_gravity_waves |
| 84 | +semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, |
| 85 | + boundary_conditions = boundary_conditions) |
| 86 | +tspan = (0.0, 1800.0) |
| 87 | +ode = semidiscretize(semi, tspan) |
| 88 | + |
| 89 | +summary_callback = SummaryCallback() |
| 90 | + |
| 91 | +analysis_interval = 10000 |
| 92 | +analysis_callback = AnalysisCallback(semi, interval = analysis_interval, |
| 93 | + extra_analysis_integrals = (entropy,)) |
| 94 | + |
| 95 | +alive_callback = AliveCallback(analysis_interval = analysis_interval) |
| 96 | + |
| 97 | +stepsize_callback = StepsizeCallback(cfl = 1.0) |
| 98 | + |
| 99 | +callbacks = CallbackSet(summary_callback, |
| 100 | + analysis_callback, |
| 101 | + alive_callback, |
| 102 | + stepsize_callback) |
| 103 | + |
| 104 | +sol = solve(ode, |
| 105 | + SSPRK43(thread = Trixi.True()); |
| 106 | + maxiters = 1.0e7, |
| 107 | + dt = 1e-1, # solve needs some value here but it will be overwritten by the stepsize_callback |
| 108 | + save_everystep = false, callback = callbacks, adaptive = false) |
0 commit comments