• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

trixi-framework / Trixi.jl / 21638916092

03 Feb 2026 04:42PM UTC coverage: 25.939% (-71.1%) from 97.034%
21638916092

Pull #2754

github

web-flow
Merge ee9b4b1c0 into ead0db32a
Pull Request #2754: `VolumeIntegralAdaptive` with `IndicatorEntropyChange`

0 of 83 new or added lines in 6 files covered. (0.0%)

31545 existing lines in 536 files now uncovered.

11563 of 44578 relevant lines covered (25.94%)

469675.74 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/examples/tree_2d_dgsem/elixir_euler_vortex_mortar_split.jl
1
using OrdinaryDiffEqLowStorageRK
2
using Trixi
3

4
###############################################################################
5
# semidiscretization of the compressible Euler equations
6

7
equations = CompressibleEulerEquations2D(1.4)
8

9
"""
10
    initial_condition_isentropic_vortex(x, t, equations::CompressibleEulerEquations2D)
11

12
The classical isentropic vortex test case of
13
- Chi-Wang Shu (1997)
14
  Essentially Non-Oscillatory and Weighted Essentially Non-Oscillatory
15
  Schemes for Hyperbolic Conservation Laws
16
  [NASA/CR-97-206253](https://ntrs.nasa.gov/citations/19980007543)
17
"""
UNCOV
18
function initial_condition_isentropic_vortex(x, t, equations::CompressibleEulerEquations2D)
×
19
    # needs appropriate mesh size, e.g. [-10,-10]x[10,10]
20
    # for error convergence: make sure that the end time is such that the vortex is back at the initial state!!
21
    # for the current velocity and domain size: t_end should be a multiple of 20s
22
    # initial center of the vortex
UNCOV
23
    RealT = eltype(x)
×
UNCOV
24
    inicenter = SVector(0, 0)
×
25
    # size and strength of the vortex
UNCOV
26
    iniamplitude = 5
×
27
    # base flow
UNCOV
28
    rho = 1
×
UNCOV
29
    v1 = 1
×
UNCOV
30
    v2 = 1
×
UNCOV
31
    vel = SVector(v1, v2)
×
UNCOV
32
    p = convert(RealT, 25)
×
UNCOV
33
    rt = p / rho                  # ideal gas equation
×
UNCOV
34
    t_loc = 0
×
UNCOV
35
    cent = inicenter + vel * t_loc      # advection of center
×
36
    # ATTENTION: handle periodic BC, but only for v1 = v2 = 1.0 (!!!!)
UNCOV
37
    cent = x - cent # distance to center point
×
38
    # cent = cross(iniaxis, cent) # distance to axis, tangent vector, length r
39
    # cross product with iniaxis = [0, 0, 1]
UNCOV
40
    cent = SVector(-cent[2], cent[1])
×
UNCOV
41
    r2 = cent[1]^2 + cent[2]^2
×
UNCOV
42
    du = iniamplitude / (2 * convert(RealT, pi)) * exp(0.5f0 * (1 - r2)) # vel. perturbation
×
UNCOV
43
    dtemp = -(equations.gamma - 1) / (2 * equations.gamma * rt) * du^2 # isentropic
×
UNCOV
44
    rho = rho * (1 + dtemp)^(1 / (equations.gamma - 1))
×
UNCOV
45
    vel = vel + du * cent
×
UNCOV
46
    v1, v2 = vel
×
UNCOV
47
    p = p * (1 + dtemp)^(equations.gamma / (equations.gamma - 1))
×
UNCOV
48
    prim = SVector(rho, v1, v2, p)
×
UNCOV
49
    return prim2cons(prim, equations)
×
50
end
51
initial_condition = initial_condition_isentropic_vortex
52

53
volume_flux = flux_shima_etal
54
# Up to version 0.13.0, `max_abs_speed_naive` was used as the default wave speed estimate of
55
# `const flux_lax_friedrichs = FluxLaxFriedrichs(), i.e., `FluxLaxFriedrichs(max_abs_speed = max_abs_speed_naive)`.
56
# In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`.
57
# Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`.
58
# To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`.
59
# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the 
60
# `StepsizeCallback` (CFL-Condition) and less diffusion.
61
solver = DGSEM(polydeg = 3, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive),
62
               volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
63

64
coordinates_min = (-10.0, -10.0)
65
coordinates_max = (10.0, 10.0)
66
refinement_patches = ((type = "box", coordinates_min = (0.0, -10.0),
67
                       coordinates_max = (10.0, 10.0)),)
68
mesh = TreeMesh(coordinates_min, coordinates_max,
69
                initial_refinement_level = 4,
70
                refinement_patches = refinement_patches,
71
                n_cells_max = 10_000)
72

73
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
74

75
###############################################################################
76
# ODE solvers, callbacks etc.
77

78
tspan = (0.0, 1.0)
79
ode = semidiscretize(semi, tspan)
80

81
summary_callback = SummaryCallback()
82

83
analysis_interval = 100
84
analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
85
                                     save_analysis = true,
86
                                     extra_analysis_errors = (:conservation_error,),
87
                                     extra_analysis_integrals = (entropy, energy_total,
88
                                                                 energy_kinetic,
89
                                                                 energy_internal))
90

91
alive_callback = AliveCallback(analysis_interval = analysis_interval)
92

93
save_solution = SaveSolutionCallback(interval = 100,
94
                                     save_initial_solution = true,
95
                                     save_final_solution = true,
96
                                     solution_variables = cons2prim)
97

98
stepsize_callback = StepsizeCallback(cfl = 1.4)
99

100
callbacks = CallbackSet(summary_callback,
101
                        analysis_callback, alive_callback,
102
                        save_solution,
103
                        stepsize_callback)
104

105
###############################################################################
106
# run the simulation
107

108
sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false);
109
            dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
110
            ode_default_options()..., callback = callbacks);
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc