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

trixi-framework / Trixi.jl / 13302866255

13 Feb 2025 07:49AM UTC coverage: 87.189% (-9.7%) from 96.883%
13302866255

push

github

web-flow
Add 1d version of `flux_hllc` with `normal::AbstractVector`  (#2276)

* add 1d hllc flux with normal::AbstractVector argument

* add test for 1D hllc flux with normal::AbstractVector

* accomodate non-unit normals

* format

---------

Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>

34416 of 39473 relevant lines covered (87.19%)

24489942.95 hits per line

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

77.78
/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
85✔
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)
51✔
64
    print(io, "boundary_condition_periodic")
51✔
65
end
66

67
struct BoundaryConditionDoNothing end
19✔
68

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

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

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

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

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

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

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

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

121
function Base.show(io::IO, ::BoundaryConditionDoNothing)
×
122
    print(io, "boundary_condition_do_nothing")
×
123
end
124
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