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

trixi-framework / Trixi.jl / 23497404996

24 Mar 2026 03:22PM UTC coverage: 87.222% (-9.8%) from 97.047%
23497404996

push

github

web-flow
Refactor DGMulti by consolidating functionality into `local_flux_differencing!` (#2857)

* Refactoring shock capturing for DGMulti

* formatting

* Refactor local_flux_differencing! to eliminate LazyMatrixLinearCombo

Dense conservative path now uses a per-pair loop with a single flux call
using normal direction n_ij = geometric_matrix * ref_entries, replacing
the dimension-by-dimension LazyMatrixLinearCombo + hadamard_sum! approach.
Sparse non-conservative path replaces LazyMatrixLinearCombo((Q,),(0.5,))
with 0.5 * normal_direction. Removes build_lazy_physical_derivative,
LazyMatrixLinearCombo, and the now-unused hadamard_sum! overloads.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* formatting

* Restore hadamard_sum! overload for NonAffine curved meshes

The per-pair normal-averaging overload for AbstractVector{<:AbstractVector}
was accidentally removed. On NonAffine meshes, get_contravariant_vector
returns an SVector of per-node array views; this overload averages the
normals at nodes i and j before calling the volume flux.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Fix sbp.jl FD-SBP volume integral after hadamard_sum! cleanup

The single-thread branch was calling hadamard_sum! with a plain
SparseMatrixCSC (dg.basis.Drst[dim]), which matched the now-deleted
dense overload. Replace the call with an inlined symmetric sparse loop
identical in structure to the multithreaded branch, using -vals[id] to
recover A[i,j] from the stored A[j,i] (skew-symmetry of periodic D).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Restore upper-triangular comment in hadamard_sum! NonAffine overload

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* move `flux_differencing_kernel!` directly into volume_integral_kernel!

* add alpha=true to allow for accumulation in volume_integral_kernel!

* move `low_order_flux_differencing!` into `volume_integral_kernel!`

* comments

* move hadamard_sum functionality into l... (continued)

136 of 137 new or added lines in 5 files covered. (99.27%)

4688 existing lines in 151 files now uncovered.

41229 of 47269 relevant lines covered (87.22%)

34581006.27 hits per line

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

75.0
/src/basic_types.jl
1
# By default, Julia/LLVM does not use fused multiply-add operations (FMAs).
2
# Since these FMAs can increase the performance of many numerical algorithms,
3
# we need to opt-in explicitly.
4
# See https://ranocha.de/blog/Optimizing_EC_Trixi for further details.
5
@muladd begin
6
#! format: noindent
7

8
# abstract supertype of specific semidiscretizations such as
9
# - SemidiscretizationHyperbolic for hyperbolic conservation laws
10
# - SemidiscretizationEulerGravity for Euler with self-gravity
11
abstract type AbstractSemidiscretization end
12

13
"""
14
    AbstractEquations{NDIMS, NVARS}
15

16
An abstract supertype of specific equations such as the compressible Euler equations.
17
The type parameters encode the number of spatial dimensions (`NDIMS`) and the
18
number of primary variables (`NVARS`) of the physics model.
19
"""
20
abstract type AbstractEquations{NDIMS, NVARS} end
21

22
"""
23
    AbstractMesh{NDIMS}
24

25
An abstract supertype of specific mesh types such as `TreeMesh` or `StructuredMesh`.
26
The type parameters encode the number of spatial dimensions (`NDIMS`).
27
"""
28
abstract type AbstractMesh{NDIMS} end
29

30
# abstract supertype of specific SBP bases such as a Lobatto-Legendre nodal basis
31
abstract type AbstractBasisSBP{RealT <: Real} end
32

33
# abstract supertype of mortar methods, e.g. using L² projections
34
abstract type AbstractMortar{RealT <: Real} end
35

36
# abstract supertype of mortar methods using L² projection
37
# which will be specialized for different SBP bases
38
abstract type AbstractMortarL2{RealT <: Real} <: AbstractMortar{RealT} end
39

40
# abstract supertype of functionality related to the analysis of
41
# numerical solutions, e.g. the calculation of errors
42
abstract type SolutionAnalyzer{RealT <: Real} end
43

44
# abstract supertype of grid-transfer methods used for AMR,
45
# e.g. refinement and coarsening based on L² projections
46
abstract type AdaptorAMR{RealT <: Real} end
47

48
# abstract supertype of AMR grid-transfer operations using L² projections
49
# which will be specialized for different SBP bases
50
abstract type AdaptorL2{RealT <: Real} <: AdaptorAMR{RealT} end
51

52
# TODO: Taal decide, which abstract types shall be defined here?
53

54
struct BoundaryConditionPeriodic end
48✔
55

56
"""
57
    boundary_condition_periodic = Trixi.BoundaryConditionPeriodic()
58

59
A singleton struct indicating periodic boundary conditions.
60
"""
61
const boundary_condition_periodic = BoundaryConditionPeriodic()
62

63
function Base.show(io::IO, ::BoundaryConditionPeriodic)
59✔
64
    print(io, "boundary_condition_periodic")
59✔
65
    return nothing
59✔
66
end
67

68
struct BoundaryConditionDoNothing end
48✔
69

70
# This version can be called by hyperbolic solvers on logically Cartesian meshes
71
@inline function (::BoundaryConditionDoNothing)(u_inner,
33,973,734✔
72
                                                orientation_or_normal_direction,
73
                                                direction::Integer, x, t, surface_flux,
74
                                                equations)
75
    return flux(u_inner, orientation_or_normal_direction, equations)
33,975,526✔
76
end
77

78
# This version can be called by hyperbolic solvers on logically Cartesian meshes
UNCOV
79
@inline function (::BoundaryConditionDoNothing)(u_inner,
×
80
                                                orientation_or_normal_direction,
81
                                                direction::Integer, x, t,
82
                                                surface_flux_functions::Tuple,
83
                                                equations)
UNCOV
84
    surface_flux_function, nonconservative_flux_function = surface_flux_functions
×
UNCOV
85
    return surface_flux_function(u_inner, u_inner,
×
86
                                 orientation_or_normal_direction, equations),
87
           nonconservative_flux_function(u_inner, u_inner,
88
                                         orientation_or_normal_direction, equations)
89
end
90

91
# This version can be called by hyperbolic solvers on unstructured, curved meshes
92
@inline function (::BoundaryConditionDoNothing)(u_inner,
11,106,048✔
93
                                                outward_direction::AbstractVector,
94
                                                x, t, surface_flux, equations)
95
    return flux(u_inner, outward_direction, equations)
11,106,048✔
96
end
97

98
# Version for equations involving nonconservative fluxes
99
@inline function (::BoundaryConditionDoNothing)(u_inner,
2,304✔
100
                                                outward_direction::AbstractVector,
101
                                                x, t, surface_flux_functions::Tuple,
102
                                                equations)
103
    surface_flux_function, nonconservative_flux_function = surface_flux_functions
2,304✔
104

105
    return surface_flux_function(u_inner, u_inner, outward_direction, equations),
2,304✔
106
           nonconservative_flux_function(u_inner, u_inner, outward_direction,
107
                                         equations)
108
end
109

110
# This version can be called by parabolic solvers
UNCOV
111
@inline function (::BoundaryConditionDoNothing)(inner_flux_or_state, other_args...)
×
UNCOV
112
    return inner_flux_or_state
×
113
end
114

115
"""
116
    boundary_condition_do_nothing = Trixi.BoundaryConditionDoNothing()
117

118
Imposing no boundary condition just evaluates the flux at the inner state.
119
"""
120
const boundary_condition_do_nothing = BoundaryConditionDoNothing()
121

122
function Base.show(io::IO, ::BoundaryConditionDoNothing)
4✔
123
    print(io, "boundary_condition_do_nothing")
4✔
124
    return nothing
4✔
125
end
126
end # @muladd
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