• 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/t8code_2d_dgsem/elixir_euler_source_terms_nonconforming_unstructured_flag.jl
1
using OrdinaryDiffEqLowStorageRK
2
using Trixi
3

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

7
equations = CompressibleEulerEquations2D(1.4)
8

9
initial_condition = initial_condition_convergence_test
10

11
source_terms = source_terms_convergence_test
12

13
# BCs must be passed as Dict
14
boundary_condition = BoundaryConditionDirichlet(initial_condition)
15
boundary_conditions = Dict(:all => boundary_condition)
16

17
# Up to version 0.13.0, `max_abs_speed_naive` was used as the default wave speed estimate of
18
# `const flux_lax_friedrichs = FluxLaxFriedrichs(), i.e., `FluxLaxFriedrichs(max_abs_speed = max_abs_speed_naive)`.
19
# In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`.
20
# Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`.
21
# To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`.
22
# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the 
23
# `StepsizeCallback` (CFL-Condition) and less diffusion.
24
solver = DGSEM(polydeg = 3, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive))
25

26
# Deformed rectangle that looks like a waving flag,
27
# lower and upper faces are sinus curves, left and right are vertical lines.
UNCOV
28
f1(s) = SVector(-1.0, s - 1.0)
×
UNCOV
29
f2(s) = SVector(1.0, s + 1.0)
×
UNCOV
30
f3(s) = SVector(s, -1.0 + sin(0.5 * pi * s))
×
UNCOV
31
f4(s) = SVector(s, 1.0 + sin(0.5 * pi * s))
×
32
faces = (f1, f2, f3, f4)
33

34
Trixi.validate_faces(faces)
35
mapping_flag = Trixi.transfinite_mapping(faces)
36

37
# Get the uncurved mesh from a file (downloads the file if not available locally)
38
# Unstructured mesh with 24 cells of the square domain [-1, 1]^n
39
mesh_file = Trixi.download("https://gist.githubusercontent.com/efaulhaber/63ff2ea224409e55ee8423b3a33e316a/raw/7db58af7446d1479753ae718930741c47a3b79b7/square_unstructured_2.inp",
40
                           joinpath(@__DIR__, "square_unstructured_2.inp"))
41

42
mesh = T8codeMesh(mesh_file, 2; polydeg = 3,
43
                  mapping = mapping_flag,
44
                  initial_refinement_level = 1)
45

UNCOV
46
function adapt_callback(forest, ltreeid, eclass_scheme, lelemntid, elements, is_family,
×
47
                        user_data)
UNCOV
48
    vertex = Vector{Cdouble}(undef, 3)
×
49

UNCOV
50
    Trixi.t8_element_vertex_reference_coords(eclass_scheme, elements[1], 0, pointer(vertex))
×
51

UNCOV
52
    level = Trixi.t8_element_level(eclass_scheme, elements[1])
×
53

54
    # TODO: Make this condition more general.
UNCOV
55
    if vertex[1] < 1e-8 && vertex[2] < 1e-8 && level < 2
×
56
        # return true (refine)
UNCOV
57
        return 1
×
58
    else
59
        # return false (don't refine)
UNCOV
60
        return 0
×
61
    end
62
end
63

64
Trixi.adapt!(mesh, adapt_callback)
65

66
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
67
                                    source_terms = source_terms,
68
                                    boundary_conditions = boundary_conditions)
69

70
###############################################################################
71
# ODE solvers, callbacks etc.
72

73
tspan = (0.0, 1.0)
74
ode = semidiscretize(semi, tspan)
75

76
summary_callback = SummaryCallback()
77

78
analysis_interval = 100
79
analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
80

81
alive_callback = AliveCallback(analysis_interval = analysis_interval)
82

83
save_restart = SaveRestartCallback(interval = 100,
84
                                   save_final_restart = true)
85

86
save_solution = SaveSolutionCallback(interval = 100,
87
                                     save_initial_solution = true,
88
                                     save_final_solution = true,
89
                                     solution_variables = cons2prim)
90

91
stepsize_callback = StepsizeCallback(cfl = 0.8)
92

93
callbacks = CallbackSet(summary_callback,
94
                        analysis_callback, alive_callback,
95
                        save_restart, save_solution,
96
                        stepsize_callback)
97
###############################################################################
98
# run the simulation
99

100
sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false);
101
            dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
102
            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