Trixi.jl API
Trixi.Trixi
— ModuleTrixi
Trixi.jl is a numerical simulation framework for hyperbolic conservation laws. A key objective for the framework is to be useful to both scientists and students. Therefore, next to having an extensible design with a fast implementation, Trixi.jl is focused on being easy to use for new or inexperienced users, including the installation and postprocessing procedures.
To get started, run your first simulation with Trixi.jl using
trixi_include(default_example())
See also: trixi-framework/Trixi.jl
Trixi.boundary_condition_do_nothing
— Constantboundary_condition_do_nothing = Trixi.BoundaryConditionDoNothing()
Imposing no boundary condition just evaluates the flux at the inner state.
Trixi.boundary_condition_periodic
— Constantboundary_condition_periodic = Trixi.BoundaryConditionPeriodic()
A singleton struct indicating periodic boundary conditions.
Trixi.flux_hll
— Constantflux_hll
See FluxHLL
.
Trixi.flux_hlle
— Constantflux_hlle
See min_max_speed_einfeldt
. This is a FluxHLL
-type two-wave solver with special estimates of the wave speeds.
Trixi.flux_lax_friedrichs
— Constantflux_lax_friedrichs
See FluxLaxFriedrichs
.
Trixi.AMRCallback
— TypeAMRCallback(semi, controller [,adaptor=AdaptorAMR(semi)];
interval,
adapt_initial_condition=true,
adapt_initial_condition_only_refine=true,
dynamic_load_balancing=true)
Performs adaptive mesh refinement (AMR) every interval
time steps for a given semidiscretization semi
using the chosen controller
.
Trixi.AbstractEquations
— TypeAbstractEquations{NDIMS, NVARS}
An abstract supertype of specific equations such as the compressible Euler equations. The type parameters encode the number of spatial dimensions (NDIMS
) and the number of primary variables (NVARS
) of the physics model.
Trixi.AbstractMesh
— TypeAbstractMesh{NDIMS}
An abstract supertype of specific mesh types such as TreeMesh
or StructuredMesh
. The type parameters encode the number of spatial dimensions (NDIMS
).
Trixi.AcousticPerturbationEquations2D
— TypeAcousticPerturbationEquations2D(v_mean_global, c_mean_global, rho_mean_global)
Acoustic perturbation equations (APE) in two space dimensions. The equations are given by
\[\begin{aligned} \frac{\partial\mathbf{v'}}{\partial t} + \nabla (\bar{\mathbf{v}}\cdot\mathbf{v'}) + \nabla\left( \frac{\bar{c}^2 \tilde{p}'}{\bar{\rho}} \right) &= 0 \\ \frac{\partial \tilde{p}'}{\partial t} + \nabla\cdot (\bar{\rho} \mathbf{v'} + \bar{\mathbf{v}} \tilde{p}') &= 0. \end{aligned}\]
The bar $\bar{(\cdot)}$ indicates time-averaged quantities. The unknowns of the APE are the perturbed velocities $\mathbf{v'} = (v_1', v_2')^T$ and the scaled perturbed pressure $\tilde{p}' = \frac{p'}{\bar{c}^2}$, where $p'$ denotes the perturbed pressure and the perturbed variables are defined by $\phi' = \phi - \bar{\phi}$.
In addition to the unknowns, Trixi.jl currently stores the mean values in the state vector, i.e. the state vector used internally is given by
\[\mathbf{u} = \begin{pmatrix} v_1' \\ v_2' \\ \tilde{p}' \\ \bar{v}_1 \\ \bar{v}_2 \\ \bar{c} \\ \bar{\rho} \end{pmatrix}.\]
This affects the implementation and use of these equations in various ways:
- The flux values corresponding to the mean values must be zero.
- The mean values have to be considered when defining initial conditions, boundary conditions or source terms.
AnalysisCallback
analyzes these variables too.- Trixi.jl's visualization tools will visualize the mean values by default.
The constructor accepts a 2-tuple v_mean_global
and scalars c_mean_global
and rho_mean_global
which can be used to make the definition of initial conditions for problems with constant mean flow more flexible. These values are ignored if the mean values are defined internally in an initial condition.
The equations are based on the APE-4 system introduced in the following paper:
- Roland Ewert and Wolfgang Schröder (2003) Acoustic perturbation equations based on flow decomposition via source filtering DOI: 10.1016/S0021-9991(03)00168-2
Trixi.Adiabatic
— Typestruct Adiabatic
Used to create a no-slip boundary condition with BoundaryConditionNavierStokesWall
. The field boundary_value_normal_flux_function
should be a function with signature boundary_value_normal_flux_function(x, t, equations)
and return a scalar value for the normal heat flux at point x
and time t
.
Trixi.AliveCallback
— TypeAliveCallback(analysis_interval=0, alive_interval=analysis_interval÷10)
Inexpensive callback showing that a simulation is still running by printing some information such as the current time to the screen every alive_interval
time steps. If analysis_interval ≂̸ 0
, the output is omitted every analysis_interval
time steps.
Trixi.AnalysisCallback
— TypeAnalysisCallback(semi; interval=0,
save_analysis=false,
output_directory="out",
analysis_filename="analysis.dat",
extra_analysis_errors=Symbol[],
extra_analysis_integrals=())
Analyze a numerical solution every interval
time steps and print the results to the screen. If save_analysis
, the results are also saved in joinpath(output_directory, analysis_filename)
.
Additional errors can be computed, e.g. by passing extra_analysis_errors = (:l2_error_primitive, :linf_error_primitive)
or extra_analysis_errors = (:conservation_error,)
.
If you want to omit the computation (to safe compute-time) of the default_analysis_errors
, specify analysis_errors = Symbol[]
. Note: default_analysis_errors
are :l2_error
and :linf_error
for all equations. If you want to compute extra_analysis_errors
such as :conservation_error
solely, i.e., without :l2_error, :linf_error
you need to specify analysis_errors = [:conservation_error]
instead of extra_analysis_errors = [:conservation_error]
.
Further scalar functions func
in extra_analysis_integrals
are applied to the numerical solution and integrated over the computational domain. Some examples for this are entropy
, energy_kinetic
, energy_internal
, and energy_total
. You can also write your own function with the same signature as the examples listed above and pass it via extra_analysis_integrals
. See the developer comments about Trixi.analyze
, Trixi.pretty_form_utf
, and Trixi.pretty_form_ascii
for further information on how to create custom analysis quantities.
In addition, the analysis callback records and outputs a number of quantities that are useful for evaluating the computational performance, such as the total runtime, the performance index (time/DOF/rhs!), the time spent in garbage collection (GC), or the current memory usage (alloc'd memory).
Trixi.AnalysisCallbackCoupled
— TypeAnalysisCallbackCoupled(semi, callbacks...)
Combine multiple analysis callbacks for coupled simulations with a SemidiscretizationCoupled
. For each coupled system, an indididual AnalysisCallback
must be created and passed to the AnalysisCallbackCoupled
in order, i.e., in the same sequence as the indidvidual semidiscretizations are stored in the SemidiscretizationCoupled
.
This is an experimental feature and can change any time.
Trixi.AnalysisSurfaceIntegral
— TypeAnalysisSurfaceIntegral{Variable, NBoundaries}(semi,
boundary_symbols::NTuple{NBoundaries, Symbol},
variable)
This struct is used to compute the surface integral of a quantity of interest variable
alongside the boundary/boundaries associated with particular name(s) given in boundary_symbol
or boundary_symbols
. For instance, this can be used to compute the lift LiftCoefficientPressure
or drag coefficient DragCoefficientPressure
of e.g. an airfoil with the boundary name :Airfoil
in 2D.
boundary_symbols::NTuple{NBoundaries, Symbol}
: Name(s) of the boundary/boundaries where the quantity of interest is computedvariable::Variable
: Quantity of interest, like lift or drag
Trixi.AveragingCallback
— TypeAveragingCallback(semi::SemidiscretizationHyperbolic, tspan; output_directory="out",
filename="averaging.h5")
This callback is experimental and may change in any future release.
A callback that averages the flow field described by semi
which must be a semidiscretization of the compressible Euler equations in two dimensions. The callback records the mean velocity, mean speed of sound, mean density, and mean vorticity for each node over the time interval given by tspan
and stores the results in an HDF5 file filename
in the directory output_directory
. Note that this callback does not support adaptive mesh refinement (AMRCallback
).
Trixi.BoundaryConditionCoupled
— TypeBoundaryConditionCoupled(other_semi_index, indices, uEltype, coupling_converter)
Boundary condition to glue two meshes together. Solution values at the boundary of another mesh will be used as boundary values. This requires the use of SemidiscretizationCoupled
. The other mesh is specified by other_semi_index
, which is the index of the mesh in the tuple of semidiscretizations.
Note that the elements and nodes of the two meshes at the coupled boundary must coincide. This is currently only implemented for StructuredMesh
.
Arguments
other_semi_index
: the index inSemidiscretizationCoupled
of the semidiscretization from which the values are copiedindices::Tuple
: node/cell indices at the boundary of the mesh in the other semidiscretization. See examples below.uEltype::Type
: element type of solutioncoupling_converter::CouplingConverter
: function to call for converting the solution state of one system to the other system
Examples
# Connect the left boundary of mesh 2 to our boundary such that our positive
# boundary direction will match the positive y direction of the other boundary
BoundaryConditionCoupled(2, (:begin, :i), Float64, fun)
# Connect the same two boundaries oppositely oriented
BoundaryConditionCoupled(2, (:begin, :i_backwards), Float64, fun)
# Using this as y_neg boundary will connect `our_cells[i, 1, j]` to `other_cells[j, end-i, end]`
BoundaryConditionCoupled(2, (:j, :i_backwards, :end), Float64, fun)
This is an experimental feature and can change any time.
Trixi.BoundaryConditionDirichlet
— TypeBoundaryConditionDirichlet(boundary_value_function)
Create a Dirichlet boundary condition that uses the function boundary_value_function
to specify the values at the boundary. This can be used to create a boundary condition that specifies exact boundary values by passing the exact solution of the equation. The passed boundary value function will be called with the same arguments as an initial condition function is called, i.e., as
boundary_value_function(x, t, equations)
where x
specifies the coordinates, t
is the current time, and equation
is the corresponding system of equations.
Examples
julia> BoundaryConditionDirichlet(initial_condition_convergence_test)
Trixi.BoundaryConditionNavierStokesWall
— Typestruct BoundaryConditionNavierStokesWall
Creates a wall-type boundary conditions for the compressible Navier-Stokes equations. The fields boundary_condition_velocity
and boundary_condition_heat_flux
are intended to be boundary condition types such as the NoSlip
velocity boundary condition and the Adiabatic
or Isothermal
heat boundary condition.
Trixi.BoundaryConditionNeumann
— TypeBoundaryConditionNeumann(boundary_normal_flux_function)
Similar to BoundaryConditionDirichlet
, but creates a Neumann boundary condition for parabolic equations that uses the function boundary_normal_flux_function
to specify the values of the normal flux at the boundary. The passed boundary value function will be called with the same arguments as an initial condition function is called, i.e., as
boundary_normal_flux_function(x, t, equations)
where x
specifies the coordinates, t
is the current time, and equation
is the corresponding system of equations.
Trixi.BoundsCheckCallback
— TypeBoundsCheckCallback(; output_directory="out", save_errors=false, interval=1)
Subcell limiting techniques with SubcellLimiterIDP
are constructed to adhere certain local or global bounds. To make sure that these bounds are actually met, this callback calculates the maximum deviation from the bounds. The maximum deviation per applied bound is printed to the screen at the end of the simulation. For more insights, when setting save_errors=true
the occurring errors are exported every interval
time steps during the simulation. Then, the maximum deviations since the last export are saved in "output_directory
/deviations.txt". The BoundsCheckCallback
has to be applied as a stage callback for the SSPRK time integration scheme.
For SubcellLimiterIDP
, the solution is corrected in the a posteriori correction stage SubcellLimiterIDPCorrection
. So, to check the final solution, this bounds check callback must be called after the correction stage.
Trixi.CarpenterKennedy2N43
— Type CarpenterKennedy2N43()
Carpenter, Kennedy (1994) Third order 2N storage RK schemes with error control
Trixi.CarpenterKennedy2N54
— TypeCarpenterKennedy2N54()
The following structures and methods provide a minimal implementation of the low-storage explicit Runge-Kutta method of
Carpenter, Kennedy (1994) Fourth order 2N storage RK schemes, Solution 3
using the same interface as OrdinaryDiffEq.jl.
Trixi.CompressibleEulerEquations1D
— TypeCompressibleEulerEquations1D(gamma)
The compressible Euler equations
\[\frac{\partial}{\partial t} \begin{pmatrix} \rho \\ \rho v_1 \\ \rho e \end{pmatrix} + \frac{\partial}{\partial x} \begin{pmatrix} \rho v_1 \\ \rho v_1^2 + p \\ (\rho e +p) v_1 \end{pmatrix} = \begin{pmatrix} 0 \\ 0 \\ 0 \end{pmatrix}\]
for an ideal gas with ratio of specific heats gamma
in one space dimension. Here, $\rho$ is the density, $v_1$ the velocity, $e$ the specific total energy rather than specific internal energy, and
\[p = (\gamma - 1) \left( \rho e - \frac{1}{2} \rho v_1^2 \right)\]
the pressure.
Trixi.CompressibleEulerEquations2D
— TypeCompressibleEulerEquations2D(gamma)
The compressible Euler equations
\[\frac{\partial}{\partial t} \begin{pmatrix} \rho \\ \rho v_1 \\ \rho v_2 \\ \rho e \end{pmatrix} + \frac{\partial}{\partial x} \begin{pmatrix} \rho v_1 \\ \rho v_1^2 + p \\ \rho v_1 v_2 \\ (\rho e +p) v_1 \end{pmatrix} + \frac{\partial}{\partial y} \begin{pmatrix} \rho v_2 \\ \rho v_1 v_2 \\ \rho v_2^2 + p \\ (\rho e +p) v_2 \end{pmatrix} = \begin{pmatrix} 0 \\ 0 \\ 0 \\ 0 \end{pmatrix}\]
for an ideal gas with ratio of specific heats gamma
in two space dimensions. Here, $\rho$ is the density, $v_1$, $v_2$ the velocities, $e$ the specific total energy rather than specific internal energy, and
\[p = (\gamma - 1) \left( \rho e - \frac{1}{2} \rho (v_1^2+v_2^2) \right)\]
the pressure.
Trixi.CompressibleEulerEquations3D
— TypeCompressibleEulerEquations3D(gamma)
The compressible Euler equations
\[\frac{\partial}{\partial t} \begin{pmatrix} \rho \\ \rho v_1 \\ \rho v_2 \\ \rho v_3 \\ \rho e \end{pmatrix} + \frac{\partial}{\partial x} \begin{pmatrix} \rho v_1 \\ \rho v_1^2 + p \\ \rho v_1 v_2 \\ \rho v_1 v_3 \\ ( \rho e +p) v_1 \end{pmatrix} + \frac{\partial}{\partial y} \begin{pmatrix} \rho v_2 \\ \rho v_1 v_2 \\ \rho v_2^2 + p \\ \rho v_1 v_3 \\ ( \rho e +p) v_2 \end{pmatrix} + \frac{\partial}{\partial z} \begin{pmatrix} \rho v_3 \\ \rho v_1 v_3 \\ \rho v_2 v_3 \\ \rho v_3^2 + p \\ ( \rho e +p) v_3 \end{pmatrix} = \begin{pmatrix} 0 \\ 0 \\ 0 \\ 0 \\ 0 \end{pmatrix}\]
for an ideal gas with ratio of specific heats gamma
in three space dimensions. Here, $\rho$ is the density, $v_1$, $v_2$, $v_3$ the velocities, $e$ the specific total energy rather than specific internal energy, and
\[p = (\gamma - 1) \left( \rho e - \frac{1}{2} \rho (v_1^2+v_2^2+v_3^2) \right)\]
the pressure.
Trixi.CompressibleEulerEquationsQuasi1D
— TypeCompressibleEulerEquationsQuasi1D(gamma)
The quasi-1d compressible Euler equations (see Chan et al. DOI: 10.48550/arXiv.2307.12089 for details)
\[\frac{\partial}{\partial t} \begin{pmatrix} a \rho \\ a \rho v_1 \\ a e \end{pmatrix} + \frac{\partial}{\partial x} \begin{pmatrix} a \rho v_1 \\ a \rho v_1^2 \\ a v_1 (e +p) \end{pmatrix} + a \frac{\partial}{\partial x} \begin{pmatrix} 0 \\ p \\ 0 \end{pmatrix} = \begin{pmatrix} 0 \\ 0 \\ 0 \end{pmatrix}\]
for an ideal gas with ratio of specific heats gamma
in one space dimension. Here, $\rho$ is the density, $v_1$ the velocity, $e$ the specific total energy rather than specific internal energy, $a$ the (possibly) variable nozzle width, and
\[p = (\gamma - 1) \left( e - \frac{1}{2} \rho v_1^2 \right)\]
the pressure.
The nozzle width function $a(x)$ is set inside the initial condition routine for a particular problem setup. To test the conservative form of the compressible Euler equations one can set the nozzle width variable $a$ to one.
In addition to the unknowns, Trixi.jl currently stores the nozzle width values at the approximation points despite being fixed in time. This affects the implementation and use of these equations in various ways:
- The flux values corresponding to the nozzle width must be zero.
- The nozzle width values must be included when defining initial conditions, boundary conditions or source terms.
AnalysisCallback
analyzes this variable.- Trixi.jl's visualization tools will visualize the nozzle width by default.
Trixi.CompressibleEulerMulticomponentEquations1D
— TypeCompressibleEulerMulticomponentEquations1D(; gammas, gas_constants)
Multicomponent version of the compressible Euler equations
\[\frac{\partial}{\partial t} \begin{pmatrix} \rho v_1 \\ \rho e \\ \rho_1 \\ \rho_2 \\ \vdots \\ \rho_{n} \end{pmatrix} + \frac{\partial}{\partial x} \begin{pmatrix} \rho v_1^2 + p \\ (\rho e +p) v_1 \\ \rho_1 v_1 \\ \rho_2 v_1 \\ \vdots \\ \rho_{n} v_1 \end{pmatrix} = \begin{pmatrix} 0 \\ 0 \\ 0 \\ 0 \\ \vdots \\ 0 \end{pmatrix}\]
for calorically perfect gas in one space dimension. Here, $\rho_i$ is the density of component $i$, $\rho=\sum_{i=1}^n\rho_i$ the sum of the individual $\rho_i$, $v_1$ the velocity, $e$ the specific total energy rather than specific internal energy, and
\[p = (\gamma - 1) \left( \rho e - \frac{1}{2} \rho v_1^2 \right)\]
the pressure,
\[\gamma=\frac{\sum_{i=1}^n\rho_i C_{v,i}\gamma_i}{\sum_{i=1}^n\rho_i C_{v,i}}\]
total heat capacity ratio, $\gamma_i$ heat capacity ratio of component $i$,
\[C_{v,i}=\frac{R}{\gamma_i-1}\]
specific heat capacity at constant volume of component $i$.
In case of more than one component, the specific heat ratios gammas
and the gas constants gas_constants
should be passed as tuples, e.g., gammas=(1.4, 1.667)
.
The remaining variables like the specific heats at constant volume cv
or the specific heats at constant pressure cp
are then calculated considering a calorically perfect gas.
Trixi.CompressibleEulerMulticomponentEquations2D
— TypeCompressibleEulerMulticomponentEquations2D(; gammas, gas_constants)
Multicomponent version of the compressible Euler equations
\[\frac{\partial}{\partial t} \begin{pmatrix} \rho v_1 \\ \rho v_2 \\ \rho e \\ \rho_1 \\ \rho_2 \\ \vdots \\ \rho_{n} \end{pmatrix} + \frac{\partial}{\partial x} \begin{pmatrix} \rho v_1^2 + p \\ \rho v_1 v_2 \\ ( \rho e +p) v_1 \\ \rho_1 v_1 \\ \rho_2 v_1 \\ \vdots \\ \rho_{n} v_1 \end{pmatrix} + \frac{\partial}{\partial y} \begin{pmatrix} \rho v_1 v_2 \\ \rho v_2^2 + p \\ ( \rho e +p) v_2 \\ \rho_1 v_2 \\ \rho_2 v_2 \\ \vdots \\ \rho_{n} v_2 \end{pmatrix} = \begin{pmatrix} 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ \vdots \\ 0 \end{pmatrix}\]
for calorically perfect gas in two space dimensions. Here, $\rho_i$ is the density of component $i$, $\rho=\sum_{i=1}^n\rho_i$ the sum of the individual $\rho_i$, $v_1$, $v_2$ the velocities, $e$ the specific total energy rather than specific internal energy, and
\[p = (\gamma - 1) \left( \rho e - \frac{1}{2} \rho (v_1^2 + v_2^2) \right)\]
the pressure,
\[\gamma=\frac{\sum_{i=1}^n\rho_i C_{v,i}\gamma_i}{\sum_{i=1}^n\rho_i C_{v,i}}\]
total heat capacity ratio, $\gamma_i$ heat capacity ratio of component $i$,
\[C_{v,i}=\frac{R}{\gamma_i-1}\]
specific heat capacity at constant volume of component $i$.
In case of more than one component, the specific heat ratios gammas
and the gas constants gas_constants
in [kJ/(kg*K)] should be passed as tuples, e.g., gammas=(1.4, 1.667)
.
The remaining variables like the specific heats at constant volume cv
or the specific heats at constant pressure cp
are then calculated considering a calorically perfect gas.
Trixi.CompressibleNavierStokesDiffusion1D
— TypeCompressibleNavierStokesDiffusion1D(equations; mu, Pr,
gradient_variables=GradientVariablesPrimitive())
Contains the diffusion (i.e. parabolic) terms applied to mass, momenta, and total energy together with the advective terms from the CompressibleEulerEquations1D
.
equations
: instance of theCompressibleEulerEquations1D
mu
: dynamic viscosity,Pr
: Prandtl number,gradient_variables
: which variables the gradients are taken with respect to. Defaults toGradientVariablesPrimitive()
.
Fluid properties such as the dynamic viscosity $\mu$ can be provided in any consistent unit system, e.g., [$\mu$] = kg m⁻¹ s⁻¹. The viscosity $\mu$ may be a constant or a function of the current state, e.g., depending on temperature (Sutherland's law): $\mu = \mu(T)$. In the latter case, the function mu
needs to have the signature mu(u, equations)
.
The particular form of the compressible Navier-Stokes implemented is
\[\frac{\partial}{\partial t} \begin{pmatrix} \rho \\ \rho v \\ \rho e \end{pmatrix} + \frac{\partial}{\partial x} \begin{pmatrix} \rho v \\ \rho v^2 + p \\ (\rho e + p) v \end{pmatrix} = \frac{\partial}{\partial x} \begin{pmatrix} 0 \\ \tau \\ \tau v - q \end{pmatrix}\]
where the system is closed with the ideal gas assumption giving
\[p = (\gamma - 1) \left( \rho e - \frac{1}{2} \rho v^2 \right)\]
as the pressure. The value of the adiabatic constant gamma
is taken from the CompressibleEulerEquations1D
. The terms on the right hand side of the system above are built from the viscous stress
\[\tau = \mu \frac{\partial}{\partial x} v\]
where the heat flux is
\[q = -\kappa \frac{\partial}{\partial x} \left(T\right),\quad T = \frac{p}{R\rho}\]
where $T$ is the temperature and $\kappa$ is the thermal conductivity for Fick's law. Under the assumption that the gas has a constant Prandtl number, the thermal conductivity is
\[\kappa = \frac{\gamma \mu R}{(\gamma - 1)\textrm{Pr}}.\]
From this combination of temperature $T$ and thermal conductivity $\kappa$ we see that the gas constant R
cancels and the heat flux becomes
\[q = -\kappa \frac{\partial}{\partial x} \left(T\right) = -\frac{\gamma \mu}{(\gamma - 1)\textrm{Pr}} \frac{\partial}{\partial x} \left(\frac{p}{\rho}\right)\]
which is the form implemented below in the flux
function.
In one spatial dimensions we require gradients for two quantities, e.g., primitive quantities
\[\frac{\partial}{\partial x} v,\, \frac{\partial}{\partial x} T\]
or the entropy variables
\[\frac{\partial}{\partial x} w_2,\, \frac{\partial}{\partial x} w_3\]
where
\[w_2 = \frac{\rho v1}{p},\, w_3 = -\frac{\rho}{p}\]
Trixi.CompressibleNavierStokesDiffusion2D
— TypeCompressibleNavierStokesDiffusion2D(equations; mu, Pr,
gradient_variables=GradientVariablesPrimitive())
Contains the diffusion (i.e. parabolic) terms applied to mass, momenta, and total energy together with the advective terms from the CompressibleEulerEquations2D
.
equations
: instance of theCompressibleEulerEquations2D
mu
: dynamic viscosity,Pr
: Prandtl number,gradient_variables
: which variables the gradients are taken with respect to. Defaults toGradientVariablesPrimitive()
.
Fluid properties such as the dynamic viscosity $\mu$ can be provided in any consistent unit system, e.g., [$\mu$] = kg m⁻¹ s⁻¹. The viscosity $\mu$ may be a constant or a function of the current state, e.g., depending on temperature (Sutherland's law): $\mu = \mu(T)$. In the latter case, the function mu
needs to have the signature mu(u, equations)
.
The particular form of the compressible Navier-Stokes implemented is
\[\frac{\partial}{\partial t} \begin{pmatrix} \rho \\ \rho \mathbf{v} \\ \rho e \end{pmatrix} + \nabla \cdot \begin{pmatrix} \rho \mathbf{v} \\ \rho \mathbf{v}\mathbf{v}^T + p \underline{I} \\ (\rho e + p) \mathbf{v} \end{pmatrix} = \nabla \cdot \begin{pmatrix} 0 \\ \underline{\tau} \\ \underline{\tau}\mathbf{v} - \mathbf{q} \end{pmatrix}\]
where the system is closed with the ideal gas assumption giving
\[p = (\gamma - 1) \left( \rho e - \frac{1}{2} \rho (v_1^2+v_2^2) \right)\]
as the pressure. The value of the adiabatic constant gamma
is taken from the CompressibleEulerEquations2D
. The terms on the right hand side of the system above are built from the viscous stress tensor
\[\underline{\tau} = \mu \left(\nabla\mathbf{v} + \left(\nabla\mathbf{v}\right)^T\right) - \frac{2}{3} \mu \left(\nabla\cdot\mathbf{v}\right)\underline{I}\]
where $\underline{I}$ is the $2\times 2$ identity matrix and the heat flux is
\[\mathbf{q} = -\kappa\nabla\left(T\right),\quad T = \frac{p}{R\rho}\]
where $T$ is the temperature and $\kappa$ is the thermal conductivity for Fick's law. Under the assumption that the gas has a constant Prandtl number, the thermal conductivity is
\[\kappa = \frac{\gamma \mu R}{(\gamma - 1)\textrm{Pr}}.\]
From this combination of temperature $T$ and thermal conductivity $\kappa$ we see that the gas constant R
cancels and the heat flux becomes
\[\mathbf{q} = -\kappa\nabla\left(T\right) = -\frac{\gamma \mu}{(\gamma - 1)\textrm{Pr}}\nabla\left(\frac{p}{\rho}\right)\]
which is the form implemented below in the flux
function.
In two spatial dimensions we require gradients for three quantities, e.g., primitive quantities
\[\nabla v_1,\, \nabla v_2,\, \nabla T\]
or the entropy variables
\[\nabla w_2,\, \nabla w_3,\, \nabla w_4\]
where
\[w_2 = \frac{\rho v_1}{p},\, w_3 = \frac{\rho v_2}{p},\, w_4 = -\frac{\rho}{p}\]
Trixi.CompressibleNavierStokesDiffusion3D
— TypeCompressibleNavierStokesDiffusion3D(equations; mu, Pr,
gradient_variables=GradientVariablesPrimitive())
Contains the diffusion (i.e. parabolic) terms applied to mass, momenta, and total energy together with the advective terms from the CompressibleEulerEquations3D
.
equations
: instance of theCompressibleEulerEquations3D
mu
: dynamic viscosity,Pr
: Prandtl number,gradient_variables
: which variables the gradients are taken with respect to. Defaults toGradientVariablesPrimitive()
.
Fluid properties such as the dynamic viscosity $\mu$ can be provided in any consistent unit system, e.g., [$\mu$] = kg m⁻¹ s⁻¹. The viscosity $\mu$ may be a constant or a function of the current state, e.g., depending on temperature (Sutherland's law): $\mu = \mu(T)$. In the latter case, the function mu
needs to have the signature mu(u, equations)
.
The particular form of the compressible Navier-Stokes implemented is
\[\frac{\partial}{\partial t} \begin{pmatrix} \rho \\ \rho \mathbf{v} \\ \rho e \end{pmatrix} + \nabla \cdot \begin{pmatrix} \rho \mathbf{v} \\ \rho \mathbf{v}\mathbf{v}^T + p \underline{I} \\ (\rho e + p) \mathbf{v} \end{pmatrix} = \nabla \cdot \begin{pmatrix} 0 \\ \underline{\tau} \\ \underline{\tau}\mathbf{v} - \mathbf{q} \end{pmatrix}\]
where the system is closed with the ideal gas assumption giving
\[p = (\gamma - 1) \left( \rho e - \frac{1}{2} \rho (v_1^2+v_2^2+v_3^2) \right)\]
as the pressure. The value of the adiabatic constant gamma
is taken from the CompressibleEulerEquations2D
. The terms on the right hand side of the system above are built from the viscous stress tensor
\[\underline{\tau} = \mu \left(\nabla\mathbf{v} + \left(\nabla\mathbf{v}\right)^T\right) - \frac{2}{3} \mu \left(\nabla\cdot\mathbf{v}\right)\underline{I}\]
where $\underline{I}$ is the $3\times 3$ identity matrix and the heat flux is
\[\mathbf{q} = -\kappa\nabla\left(T\right),\quad T = \frac{p}{R\rho}\]
where $T$ is the temperature and $\kappa$ is the thermal conductivity for Fick's law. Under the assumption that the gas has a constant Prandtl number, the thermal conductivity is
\[\kappa = \frac{\gamma \mu R}{(\gamma - 1)\textrm{Pr}}.\]
From this combination of temperature $T$ and thermal conductivity $\kappa$ we see that the gas constant R
cancels and the heat flux becomes
\[\mathbf{q} = -\kappa\nabla\left(T\right) = -\frac{\gamma \mu}{(\gamma - 1)\textrm{Pr}}\nabla\left(\frac{p}{\rho}\right)\]
which is the form implemented below in the flux
function.
In two spatial dimensions we require gradients for three quantities, e.g., primitive quantities
\[\nabla v_1,\, \nabla v_2,\, \nabla v_3,\, \nabla T\]
or the entropy variables
\[\nabla w_2,\, \nabla w_3,\, \nabla w_4\, \nabla w_5\]
where
\[w_2 = \frac{\rho v_1}{p},\, w_3 = \frac{\rho v_2}{p},\, w_4 = \frac{\rho v_3}{p},\, w_5 = -\frac{\rho}{p}\]
Trixi.ControllerThreeLevel
— TypeControllerThreeLevel(semi, indicator; base_level=1,
med_level=base_level, med_threshold=0.0,
max_level=base_level, max_threshold=1.0)
An AMR controller based on three levels (in descending order of precedence):
- set the target level to
max_level
ifindicator > max_threshold
- set the target level to
med_level
ifindicator > med_threshold
; ifmed_level < 0
, set the target level to the current level - set the target level to
base_level
otherwise
Trixi.ControllerThreeLevelCombined
— TypeControllerThreeLevelCombined(semi, indicator_primary, indicator_secondary;
base_level=1,
med_level=base_level, med_threshold=0.0,
max_level=base_level, max_threshold=1.0,
max_threshold_secondary=1.0)
An AMR controller based on three levels (in descending order of precedence):
- set the target level to
max_level
ifindicator_primary > max_threshold
- set the target level to
med_level
ifindicator_primary > med_threshold
; ifmed_level < 0
, set the target level to the current level - set the target level to
base_level
otherwise
If indicator_secondary >= max_threshold_secondary
, set the target level to max_level
.
Trixi.DG
— TypeDG(; basis, mortar, surface_integral, volume_integral)
Create a discontinuous Galerkin method. If basis isa LobattoLegendreBasis
, this creates a DGSEM
.
Trixi.DGMulti
— MethodDGMulti(approximation_type::AbstractDerivativeOperator;
element_type::AbstractElemShape,
surface_flux=flux_central,
surface_integral=SurfaceIntegralWeakForm(surface_flux),
volume_integral=VolumeIntegralWeakForm(),
kwargs...)
Create a summation by parts (SBP) discretization on the given element_type
using a tensor product structure based on the 1D SBP derivative operator passed as approximation_type
.
For more info, see the documentations of StartUpDG.jl and SummationByPartsOperators.jl.
Trixi.DGMulti
— MethodDGMulti(; polydeg::Integer,
element_type::AbstractElemShape,
approximation_type=Polynomial(),
surface_flux=flux_central,
surface_integral=SurfaceIntegralWeakForm(surface_flux),
volume_integral=VolumeIntegralWeakForm(),
RefElemData_kwargs...)
Create a discontinuous Galerkin method which uses
- approximations of polynomial degree
polydeg
- element type
element_type
(Tri()
,Quad()
,Tet()
, andHex()
currently supported)
Optional:
approximation_type
(default isPolynomial()
;SBP()
also supported forTri()
,Quad()
, andHex()
element types).RefElemData_kwargs
are additional keyword arguments forRefElemData
, such asquad_rule_vol
. For more info, see the StartUpDG.jl docs.
Trixi.DGMultiMesh
— TypeDGMultiMesh{NDIMS, ...}
DGMultiMesh
describes a mesh type which wraps StartUpDG.MeshData
and boundary_faces
in a dispatchable type. This is intended to store geometric data and connectivities for any type of mesh (Cartesian, affine, curved, structured/unstructured).
Trixi.DGMultiMesh
— MethodDGMultiMesh(dg::DGMulti{2, Tri}, triangulateIO, boundary_dict::Dict{Symbol, Int})
dg::DGMulti
contains information associated with to the reference element (e.g., quadrature, basis evaluation, differentiation, etc).triangulateIO
is aTriangulateIO
mesh representationboundary_dict
is aDict{Symbol, Int}
which associates each integerTriangulateIO
boundary tag with aSymbol
.
Trixi.DGMultiMesh
— MethodDGMultiMesh(dg::DGMulti)
Constructs a single-element DGMultiMesh
for a single periodic element given a DGMulti with approximation_type
set to a periodic (finite difference) SBP operator from SummationByPartsOperators.jl.
Trixi.DGMultiMesh
— MethodDGMultiMesh(dg::DGMulti{NDIMS}, vertex_coordinates, EToV;
is_on_boundary=nothing,
periodicity=ntuple(_->false, NDIMS)) where {NDIMS}
dg::DGMulti
contains information associated with to the reference element (e.g., quadrature, basis evaluation, differentiation, etc).vertex_coordinates
is a tuple of vectors containing x,y,... components of the vertex coordinatesEToV
is a 2D array containing element-to-vertex connectivities for each elementis_on_boundary
specifies boundary using aDict{Symbol, <:Function}
periodicity
is a tuple of booleans specifying if the domain is periodictrue
/false
in the (x,y,z) direction.
Trixi.DGMultiMesh
— MethodDGMultiMesh(dg::DGMulti{NDIMS}, cells_per_dimension, mapping;
is_on_boundary=nothing,
periodicity=ntuple(_ -> false, NDIMS), kwargs...) where {NDIMS}
Constructs a Curved()
DGMultiMesh
with element type dg.basis.element_type
.
mapping
is a function which maps from a reference [-1, 1]^NDIMS domain to a mapped domain, e.g.,xy = mapping(x, y)
in 2D.is_on_boundary
specifies boundary using aDict{Symbol, <:Function}
periodicity
is a tuple ofBool
s specifying periodicity =true
/false
in the (x,y,z) direction.
Trixi.DGMultiMesh
— MethodDGMultiMesh(dg::DGMulti, cells_per_dimension;
coordinates_min=(-1.0, -1.0), coordinates_max=(1.0, 1.0),
is_on_boundary=nothing,
periodicity=ntuple(_ -> false, NDIMS))
Constructs a Cartesian DGMultiMesh
with element type dg.basis.element_type
. The domain is the tensor product of the intervals [coordinates_min[i], coordinates_max[i]]
.
is_on_boundary
specifies boundary using aDict{Symbol, <:Function}
periodicity
is a tuple ofBool
s specifying periodicity =true
/false
in the (x,y,z) direction.
Trixi.DGMultiMesh
— MethodDGMultiMesh(dg::DGMulti, filename::String)
dg::DGMulti
contains information associated with the reference element (e.g., quadrature, basis evaluation, differentiation, etc).filename
is a path specifying a.mesh
file generated by HOHQMesh.
Trixi.DGSEM
— TypeDGSEM(; RealT=Float64, polydeg::Integer,
surface_flux=flux_central,
surface_integral=SurfaceIntegralWeakForm(surface_flux),
volume_integral=VolumeIntegralWeakForm(),
mortar=MortarL2(basis))
Create a discontinuous Galerkin spectral element method (DGSEM) using a LobattoLegendreBasis
with polynomials of degree polydeg
.
Trixi.DissipationGlobalLaxFriedrichs
— TypeDissipationGlobalLaxFriedrichs(λ)
Create a global Lax-Friedrichs dissipation operator with dissipation coefficient λ
.
Trixi.DissipationLocalLaxFriedrichs
— TypeDissipationLocalLaxFriedrichs(max_abs_speed=max_abs_speed_naive)
Create a local Lax-Friedrichs dissipation operator where the maximum absolute wave speed is estimated as max_abs_speed(u_ll, u_rr, orientation_or_normal_direction, equations)
, defaulting to max_abs_speed_naive
.
Trixi.DragCoefficientPressure
— MethodDragCoefficientPressure(aoa, rhoinf, uinf, linf)
Compute the drag coefficient
\[C_{D,p} \coloneqq \frac{\oint_{\partial \Omega} p \boldsymbol n \cdot \psi_D \, \mathrm{d} S} {0.5 \rho_{\infty} U_{\infty}^2 L_{\infty}}\]
based on the pressure distribution along a boundary. Supposed to be used in conjunction with AnalysisSurfaceIntegral
which stores the boundary information and semidiscretization.
aoa::Real
: Angle of attack in radians (for airfoils etc.)rhoinf::Real
: Free-stream densityuinf::Real
: Free-stream velocitylinf::Real
: Reference length of geometry (e.g. airfoil chord length)
Trixi.DragCoefficientShearStress
— MethodDragCoefficientShearStress(aoa, rhoinf, uinf, linf)
Compute the drag coefficient
\[C_{D,f} \coloneqq \frac{\oint_{\partial \Omega} \boldsymbol \tau_w \cdot \psi_D \, \mathrm{d} S} {0.5 \rho_{\infty} U_{\infty}^2 L_{\infty}}\]
based on the wall shear stress vector $\tau_w$ along a boundary. Supposed to be used in conjunction with AnalysisSurfaceIntegral
which stores the boundary information and semidiscretization.
aoa::Real
: Angle of attack in radians (for airfoils etc.)rhoinf::Real
: Free-stream densityuinf::Real
: Free-stream velocitylinf::Real
: Reference length of geometry (e.g. airfoil chord length)
Trixi.EntropyBoundedLimiter
— MethodEntropyBoundedLimiter{RealT <: Real}(; exp_entropy_decrease_max = 1f-13)
Entropy-bounded limiter by
- Lv, Ihme (2015) Entropy-bounded discontinuous Galerkin scheme for Euler equations doi: 10.1016/j.jcp.2015.04.026
This is an ideal-gas specific limiter that bounds the (unphysical) decrease of the thermodynamic entropy per element from one time step (or Runge-Kutta stage) to the next. The parameter exp_entropy_decrease_max
is the maximum allowed exponentiated entropy decrease per element at each element's node.
In the original version of the paper, this value is set to zero to ensure that the entropy does not decrease, i.e., guarantee entropy stability in the sense of
- Tadmor (1986) A minimum entropy principle in the gas dynamics equations doi: 10.1016/0168-9274(86)90029-2
This, however, leads in general to very diffusive solutions for timesteps violating a CFL condition (Lemma 3 in Lv, Ihme (2015)) which is required for entropy stability in the mean values. Since most practical simulations will employ a significantly larger timestep, one can relax the strict entropy increase requirement by setting exp_entropy_decrease_max
to a negative value. The limiter acts if the exponentiated entropy decrease on an element is larger than exp_entropy_decrease_max
. This means that if the change in exponentiated entropy lies below exp_entropy_decrease_max
(i.e., larger in absolute value) the limiter takes action. The choice of the tolerated exponentiated entropy decrease is a problem-specific parameter which balances the trade-off between accuracy and stability.
Trixi.EulerAcousticsCouplingCallback
— TypeEulerAcousticsCouplingCallback
This callback is experimental and may change in any future release.
A callback that couples the acoustic perturbation equations and compressible Euler equations. Must be used in conjunction with SemidiscretizationEulerAcoustics
. This callback manages the flow solver - which is always one time step ahead of the acoustics solver - and calculates the acoustic source term after each time step. The linearized Lamb vector is used as the source term, i.e.
\[\mathbf{s} = -(\mathbf{\omega'} \times \bar{\mathbf{v}} + \bar{\mathbf{\omega}} \times \mathbf{v'}),\]
where $\mathbf{v}$ denotes the velocity, $\mathbf{\omega}$ denotes the vorticity, the bar $\bar{(\cdot)}$ indicates time-averaged quantities (see AveragingCallback
) and prime $(\cdot)'$ denotes perturbed quantities defined by $\phi' = \phi - \bar{\phi}$. Note that the perturbed quantities here are based entirely on the pure flow solution and should not be confused with the state variables of the acoustic perturbation equations.
In addition, this callback manages the time step size for both solvers and initializes the mean values of the acoustic perturbation equations using results obtained with the AveragingCallback
.
- Michael Schlottke-Lakemper (2017) A direct-hybrid method for aeroacoustic analysis DOI: 10.18154/RWTH-2017-04082
Trixi.EulerAcousticsCouplingCallback
— MethodEulerAcousticsCouplingCallback(ode_euler, averaging_file::AbstractString, alg,
cfl_acoustics::Real, cfl_euler::Real; kwargs...)
This callback is experimental and may change in any future release.
Creates an EulerAcousticsCouplingCallback
based on the pure flow ODEProblem
given by ode_euler
. Creates an integrator using the time integration method alg
and the keyword arguments to solve ode_euler
(consult the OrdinaryDiffEq documentation for further information). Manages the step size for both solvers by using the minimum of the maximum step size obtained with CFL numbers cfl_acoustics
for the acoustics solver and cfl_euler
for and flow solver, respectively. The mean values for the acoustic perturbation equations are read from averaging_file
(see AveragingCallback
).
Trixi.EulerAcousticsCouplingCallback
— MethodEulerAcousticsCouplingCallback(ode_euler,
averaging_callback::DiscreteCallback{<:Any, <:AveragingCallback},
alg, cfl_acoustics::Real, cfl_euler::Real; kwargs...)
This callback is experimental and may change in any future release.
Creates an EulerAcousticsCouplingCallback
based on the pure flow ODEProblem
given by ode_euler
. Creates an integrator using the time integration method alg
and the keyword arguments to solve ode_euler
(consult the OrdinaryDiffEq documentation for further information). Manages the step size for both solvers by using the minimum of the maximum step size obtained with CFL numbers cfl_acoustics
for the acoustics solver and cfl_euler
for and flow solver, respectively. The mean values for the acoustic perturbation equations are read from averaging_callback
(see AveragingCallback
).
Trixi.FDSBP
— TypeFDSBP(D_SBP; surface_integral, volume_integral)
Specialization of DG
methods that uses general summation by parts (SBP) operators from SummationByPartsOperators.jl. In particular, this includes classical finite difference (FD) SBP methods. These methods have the same structure as classical DG methods - local operations on elements with connectivity through interfaces without imposing any continuity constraints.
D_SBP
is an SBP derivative operator from SummationByPartsOperators.jl. The other arguments have the same meaning as in DG
or DGSEM
.
This is an experimental feature and may change in future releases.
Trixi.FluxHLL
— TypeFluxHLL(min_max_speed=min_max_speed_davis)
Create an HLL (Harten, Lax, van Leer) numerical flux where the minimum and maximum wave speeds are estimated as λ_min, λ_max = min_max_speed(u_ll, u_rr, orientation_or_normal_direction, equations)
, defaulting to min_max_speed_davis
. Original paper:
- Amiram Harten, Peter D. Lax, Bram van Leer (1983) On Upstream Differencing and Godunov-Type Schemes for Hyperbolic Conservation Laws DOI: 10.1137/1025002
Trixi.FluxHydrostaticReconstruction
— TypeFluxHydrostaticReconstruction(numerical_flux, hydrostatic_reconstruction)
This numerical flux is experimental and may change in any future release.
Allow for some kind of hydrostatic reconstruction of the solution state prior to the surface flux computation. This is a particular strategy to ensure that the method remains well-balanced for the shallow water equations, see ShallowWaterEquations1D
or ShallowWaterEquations2D
.
For example, the hydrostatic reconstruction from Audusse et al. is implemented in one and two spatial dimensions, see hydrostatic_reconstruction_audusse_etal
or the original paper
- Emmanuel Audusse, François Bouchut, Marie-Odile Bristeau, Rupert Klein, and Benoit Perthame (2004) A fast and stable well-balanced scheme with hydrostatic reconstruction for shallow water flows DOI: 10.1137/S1064827503431090
Other hydrostatic reconstruction techniques are available, particularly to handle wet / dry fronts. A good overview of the development and application of hydrostatic reconstruction can be found in
- Guoxian Chen and Sebastian Noelle A unified surface-gradient and hydrostatic reconstruction scheme for the shallow water equations (2021) RWTH Aachen preprint
- Andreas Buttinger-Kreuzhuber, Zsolt Horváth, Sebastian Noelle, Günter Blöschl and Jürgen Waser (2019) A fast second-order shallow water scheme on two-dimensional structured grids over abrupt topography DOI: 10.1016/j.advwatres.2019.03.010
Trixi.FluxLMARS
— TypeFluxLMARS(c)(u_ll, u_rr, orientation_or_normal_direction,
equations::CompressibleEulerEquations2D)
Low Mach number approximate Riemann solver (LMARS) for atmospheric flows using an estimate c
of the speed of sound.
References:
- Xi Chen et al. (2013) A Control-Volume Model of the Compressible Euler Equations with a Vertical Lagrangian Coordinate DOI: 10.1175/MWR-D-12-00129.1
Trixi.FluxLMARS
— MethodFluxLMARS(c)(u_ll, u_rr, orientation_or_normal_direction,
equations::CompressibleEulerEquations3D)
Low Mach number approximate Riemann solver (LMARS) for atmospheric flows using an estimate c
of the speed of sound.
References:
- Xi Chen et al. (2013) A Control-Volume Model of the Compressible Euler Equations with a Vertical Lagrangian Coordinate DOI: 10.1175/MWR-D-12-00129.1
Trixi.FluxLaxFriedrichs
— TypeFluxLaxFriedrichs(max_abs_speed=max_abs_speed_naive)
Local Lax-Friedrichs (Rusanov) flux with maximum wave speed estimate provided by max_abs_speed
, cf. DissipationLocalLaxFriedrichs
and max_abs_speed_naive
.
Trixi.FluxPlusDissipation
— TypeFluxPlusDissipation(numerical_flux, dissipation)
Combine a numerical_flux
with a dissipation
operator to create a new numerical flux.
Trixi.FluxRotated
— TypeFluxRotated(numerical_flux)
Compute a numerical_flux
flux in direction of a normal vector by rotating the solution, computing the numerical flux in x-direction, and rotating the calculated flux back.
Requires a rotationally invariant equation with equation-specific functions rotate_to_x
and rotate_from_x
.
Trixi.FluxUpwind
— TypeFluxUpwind(splitting)
A numerical flux f(u_left, u_right) = f⁺(u_left) + f⁻(u_right)
based on flux vector splitting.
The SurfaceIntegralUpwind
with a given splitting
is equivalent to the SurfaceIntegralStrongForm
with FluxUpwind(splitting)
as numerical flux (up to floating point differences). Note, that SurfaceIntegralUpwind
is only available on TreeMesh
.
This is an experimental feature and may change in future releases.
Trixi.GlmSpeedCallback
— TypeGlmSpeedCallback(; glm_scale=0.5, cfl, semi_indices=())
Update the divergence cleaning wave speed c_h
according to the time step computed in StepsizeCallback
for the ideal GLM-MHD equations. The cfl
number should be set to the same value as for the time step size calculation. The glm_scale
ensures that the GLM wave speed is lower than the fastest physical waves in the MHD solution and should thus be set to a value within the interval [0,1]. Note that glm_scale = 0
deactivates the divergence cleaning.
In case of coupled semidiscretizations, specify for which semi_index
, i.e. index of the semidiscretization, the divergence cleaning should be applied. See also SemidiscretizationCoupled
. Note: SemidiscretizationCoupled
and all related features are considered experimental and may change at any time.
Trixi.GradientVariablesPrimitive
— TypeGradientVariablesPrimitive
and GradientVariablesEntropy
are gradient variable type parameters for CompressibleNavierStokesDiffusion1D
. By default, the gradient variables are set to be GradientVariablesPrimitive
. Specifying GradientVariablesEntropy
instead uses the entropy variable formulation from
- Hughes, Mallet, Franca (1986) A new finite element formulation for computational fluid dynamics: I. Symmetric forms of the compressible Euler and Navier-Stokes equations and the second law of thermodynamics. https://doi.org/10.1016/0045-7825(86)90127-1
Under GradientVariablesEntropy
, the Navier-Stokes discretization is provably entropy stable.
Trixi.HypDiffN3Erk3Sstar52
— TypeHypDiffN3Erk3Sstar52()
Five stage, second-order accurate explicit Runge-Kutta scheme with stability region optimized for the hyperbolic diffusion equation with LLF flux and polynomials of degree polydeg=3.
Trixi.HyperbolicDiffusionEquations1D
— TypeHyperbolicDiffusionEquations1D
The linear hyperbolic diffusion equations in one space dimension. A description of this system can be found in Sec. 2.5 of the book
- Masatsuka (2013) I Do Like CFD, Too: Vol 1. Freely available at http://www.cfdbooks.com/
Further analysis can be found in the paper
- Nishikawa (2007) A first-order system approach for diffusion equation. I: Second-order residual-distribution schemes DOI: 10.1016/j.jcp.2007.07.029
Trixi.HyperbolicDiffusionEquations2D
— TypeHyperbolicDiffusionEquations2D
The linear hyperbolic diffusion equations in two space dimensions. A description of this system can be found in Sec. 2.5 of the book "I Do Like CFD, Too: Vol 1". The book is freely available at http://www.cfdbooks.com/ and further analysis can be found in the paper by Nishikawa DOI: 10.1016/j.jcp.2007.07.029
Trixi.HyperbolicDiffusionEquations3D
— TypeHyperbolicDiffusionEquations3D
The linear hyperbolic diffusion equations in three space dimensions. A description of this system can be found in Sec. 2.5 of the book "I Do Like CFD, Too: Vol 1". The book is freely available at http://www.cfdbooks.com/ and further analysis can be found in the paper by Nishikawa DOI: 10.1016/j.jcp.2007.07.029
Trixi.IdealGlmMhdEquations1D
— TypeIdealGlmMhdEquations1D(gamma)
The ideal compressible GLM-MHD equations for an ideal gas with ratio of specific heats gamma
in one space dimension.
There is no divergence cleaning variable psi
because the divergence-free constraint is satisfied trivially in one spatial dimension.
Trixi.IdealGlmMhdEquations2D
— TypeIdealGlmMhdEquations2D(gamma)
The ideal compressible GLM-MHD equations for an ideal gas with ratio of specific heats gamma
in two space dimensions.
Trixi.IdealGlmMhdEquations3D
— TypeIdealGlmMhdEquations3D(gamma)
The ideal compressible GLM-MHD equations for an ideal gas with ratio of specific heats gamma
in three space dimensions.
Trixi.IdealGlmMhdMulticomponentEquations1D
— TypeIdealGlmMhdMulticomponentEquations1D
The ideal compressible multicomponent GLM-MHD equations in one space dimension.
Trixi.IdealGlmMhdMulticomponentEquations2D
— TypeIdealGlmMhdMulticomponentEquations2D
The ideal compressible multicomponent GLM-MHD equations in two space dimensions.
Trixi.IndicatorHennemannGassner
— TypeIndicatorHennemannGassner(equations::AbstractEquations, basis;
alpha_max=0.5,
alpha_min=0.001,
alpha_smooth=true,
variable)
IndicatorHennemannGassner(semi::AbstractSemidiscretization;
alpha_max=0.5,
alpha_min=0.001,
alpha_smooth=true,
variable)
Indicator used for shock-capturing (when passing the equations
and the basis
) or adaptive mesh refinement (AMR, when passing the semi
).
See also VolumeIntegralShockCapturingHG
.
References
- Hennemann, Gassner (2020) "A provably entropy stable subcell shock capturing approach for high order split form DG" arXiv: 2008.12044
Trixi.IndicatorLöhner
— TypeIndicatorLöhner (equivalent to IndicatorLoehner)
IndicatorLöhner(equations::AbstractEquations, basis;
f_wave=0.2, variable)
IndicatorLöhner(semi::AbstractSemidiscretization;
f_wave=0.2, variable)
AMR indicator adapted from a FEM indicator by Löhner (1987), also used in the FLASH code as standard AMR indicator. The indicator estimates a weighted second derivative of a specified variable locally.
When constructed to be used for AMR, pass the semi
. Pass the equations
, and basis
if this indicator should be used for shock capturing.
References
- Löhner (1987) "An adaptive finite element scheme for transient problems in CFD" doi: 10.1016/0045-7825(87)90098-3
- https://flash.rochester.edu/site/flashcode/usersupport/flash4ug_4p62/node59.html#SECTION05163100000000000000
Trixi.IndicatorMax
— TypeIndicatorMax(equations::AbstractEquations, basis; variable)
IndicatorMax(semi::AbstractSemidiscretization; variable)
A simple indicator returning the maximum of variable
in an element. When constructed to be used for AMR, pass the semi
. Pass the equations
, and basis
if this indicator should be used for shock capturing.
Trixi.InviscidBurgersEquation1D
— TypeInviscidBurgersEquation1D
The inviscid Burgers' equation
\[\partial_t u + \frac{1}{2} \partial_1 u^2 = 0\]
in one space dimension.
Trixi.Isothermal
— Typestruct Isothermal
Used to create a no-slip boundary condition with BoundaryConditionNavierStokesWall
. The field boundary_value_function
should be a function with signature boundary_value_function(x, t, equations)
and return a scalar value for the temperature at point x
and time t
.
Trixi.LaplaceDiffusion1D
— TypeLaplaceDiffusion1D(diffusivity, equations)
LaplaceDiffusion1D
represents a scalar diffusion term $\nabla \cdot (\kappa\nabla u))$ with diffusivity $\kappa$ applied to each solution component defined by equations
.
Trixi.LaplaceDiffusion2D
— TypeLaplaceDiffusion2D(diffusivity, equations)
LaplaceDiffusion2D
represents a scalar diffusion term $\nabla \cdot (\kappa\nabla u))$ with diffusivity $\kappa$ applied to each solution component defined by equations
.
Trixi.LaplaceDiffusion3D
— TypeLaplaceDiffusion3D(diffusivity, equations)
LaplaceDiffusion3D
represents a scalar diffusion term $\nabla \cdot (\kappa\nabla u))$ with diffusivity $\kappa$ applied to each solution component defined by equations
.
Trixi.LatticeBoltzmannEquations2D
— TypeLatticeBoltzmannEquations2D(; Ma, Re, collision_op=collision_bgk,
c=1, L=1, rho0=1, u0=nothing, nu=nothing)
The Lattice-Boltzmann equations
\[\partial_t u_\alpha + v_{\alpha,1} \partial_1 u_\alpha + v_{\alpha,2} \partial_2 u_\alpha = 0\]
in two space dimensions for the D2Q9 scheme.
The characteristic Mach number and Reynolds numbers are specified as Ma
and Re
. By the default, the collision operator collision_op
is set to the BGK model. c
, L
, and rho0
specify the mean thermal molecular velocity, the characteristic length, and the reference density, respectively. They can usually be left to the default values. If desired, instead of the Mach number, one can set the macroscopic reference velocity u0
directly (Ma
needs to be set to nothing
in this case). Likewise, instead of the Reynolds number one can specify the kinematic viscosity nu
directly (in this case, Re
needs to be set to nothing
).
The nine discrete velocity directions of the D2Q9 scheme are sorted as follows [4]:
6 2 5 y
┌───┼───┐ │
│ │ │
3 ┼ 9 ┼ 1 ──── x
│ │ ╱
└───┼───┘ ╱
7 4 8 z
Note that usually the velocities are numbered from 0
to 8
, where 0
corresponds to the zero velocity. Due to Julia using 1-based indexing, here we use indices from 1
to 9
, where 1
through 8
correspond to the velocity directions in [4] and 9
is the zero velocity.
The corresponding opposite directions are:
- 1 ←→ 3
- 2 ←→ 4
- 3 ←→ 1
- 4 ←→ 2
- 5 ←→ 7
- 6 ←→ 8
- 7 ←→ 5
- 8 ←→ 6
- 9 ←→ 9
The main sources for the base implementation were
- Misun Min, Taehun Lee, A spectral-element discontinuous Galerkin lattice Boltzmann method for nearly incompressible flows, J Comput Phys 230(1), 2011 doi:10.1016/j.jcp.2010.09.024
- Karsten Golly, Anwendung der Lattice-Boltzmann Discontinuous Galerkin Spectral Element Method (LB-DGSEM) auf laminare und turbulente nahezu inkompressible Strömungen im dreidimensionalen Raum, Master Thesis, University of Cologne, 2018.
- Dieter Hänel, Molekulare Gasdynamik, Springer-Verlag Berlin Heidelberg, 2004 doi:10.1007/3-540-35047-0
- Dieter Krüger et al., The Lattice Boltzmann Method, Springer International Publishing, 2017 doi:10.1007/978-3-319-44649-3
Trixi.LatticeBoltzmannEquations3D
— TypeLatticeBoltzmannEquations3D(; Ma, Re, collision_op=collision_bgk,
c=1, L=1, rho0=1, u0=nothing, nu=nothing)
The Lattice-Boltzmann equations
\[\partial_t u_\alpha + v_{\alpha,1} \partial_1 u_\alpha + v_{\alpha,2} \partial_2 u_\alpha + v_{\alpha,3} \partial_3 u_\alpha = 0\]
in three space dimensions for the D3Q27 scheme.
The characteristic Mach number and Reynolds numbers are specified as Ma
and Re
. By the default, the collision operator collision_op
is set to the BGK model. c
, L
, and rho0
specify the mean thermal molecular velocity, the characteristic length, and the reference density, respectively. They can usually be left to the default values. If desired, instead of the Mach number, one can set the macroscopic reference velocity u0
directly (Ma
needs to be set to nothing
in this case). Likewise, instead of the Reynolds number one can specify the kinematic viscosity nu
directly (in this case, Re
needs to be set to nothing
).
The twenty-seven discrete velocity directions of the D3Q27 scheme are sorted as follows [4]:
- plane at
z = -1
:24 17 21 y ┌───┼───┐ │ │ │ │ 10 ┼ 6 ┼ 15 ──── x │ │ ╱ └───┼───┘ ╱ 20 12 26 z
- plane at
z = 0
:14 3 7 y ┌───┼───┐ │ │ │ │ 2 ┼ 27 ┼ 1 ──── x │ │ ╱ └───┼───┘ ╱ 8 4 13 z
- plane at
z = +1
:25 11 19 y ┌───┼───┐ │ │ │ │ 16 ┼ 5 ┼ 9 ──── x │ │ ╱ └───┼───┘ ╱ 22 18 23 z
Note that usually the velocities are numbered from 0
to 26
, where 0
corresponds to the zero velocity. Due to Julia using 1-based indexing, here we use indices from 1
to 27
, where 1
through 26
correspond to the velocity directions in [4] and 27
is the zero velocity.
The corresponding opposite directions are:
- 1 ←→ 2
- 2 ←→ 1
- 3 ←→ 4
- 4 ←→ 3
- 5 ←→ 6
- 6 ←→ 5
- 7 ←→ 8
- 8 ←→ 7
- 9 ←→ 10
- 10 ←→ 9
- 11 ←→ 12
- 12 ←→ 11
- 13 ←→ 14
- 14 ←→ 13
- 15 ←→ 16
- 16 ←→ 15
- 17 ←→ 18
- 18 ←→ 17
- 19 ←→ 20
- 20 ←→ 19
- 21 ←→ 22
- 22 ←→ 21
- 23 ←→ 24
- 24 ←→ 23
- 25 ←→ 26
- 26 ←→ 25
- 27 ←→ 27
The main sources for the base implementation were
- Misun Min, Taehun Lee, A spectral-element discontinuous Galerkin lattice Boltzmann method for nearly incompressible flows, J Comput Phys 230(1), 2011 doi:10.1016/j.jcp.2010.09.024
- Karsten Golly, Anwendung der Lattice-Boltzmann Discontinuous Galerkin Spectral Element Method (LB-DGSEM) auf laminare und turbulente nahezu inkompressible Strömungen im dreidimensionalen Raum, Master Thesis, University of Cologne, 2018.
- Dieter Hänel, Molekulare Gasdynamik, Springer-Verlag Berlin Heidelberg, 2004 doi:10.1007/3-540-35047-0
- Dieter Krüger et al., The Lattice Boltzmann Method, Springer International Publishing, 2017 doi:10.1007/978-3-319-44649-3
Trixi.LiftCoefficientPressure
— MethodLiftCoefficientPressure(aoa, rhoinf, uinf, linf)
Compute the lift coefficient
\[C_{L,p} \coloneqq \frac{\oint_{\partial \Omega} p \boldsymbol n \cdot \psi_L \, \mathrm{d} S} {0.5 \rho_{\infty} U_{\infty}^2 L_{\infty}}\]
based on the pressure distribution along a boundary. Supposed to be used in conjunction with AnalysisSurfaceIntegral
which stores the boundary information and semidiscretization.
aoa::Real
: Angle of attack in radians (for airfoils etc.)rhoinf::Real
: Free-stream densityuinf::Real
: Free-stream velocitylinf::Real
: Reference length of geometry (e.g. airfoil chord length)
Trixi.LiftCoefficientShearStress
— MethodLiftCoefficientShearStress(aoa, rhoinf, uinf, linf)
Compute the lift coefficient
\[C_{L,f} \coloneqq \frac{\oint_{\partial \Omega} \boldsymbol \tau_w \cdot \psi_L \, \mathrm{d} S} {0.5 \rho_{\infty} U_{\infty}^2 L_{\infty}}\]
based on the wall shear stress vector $\tau_w$ along a boundary. Supposed to be used in conjunction with AnalysisSurfaceIntegral
which stores the boundary information and semidiscretization.
aoa::Real
: Angle of attack in radians (for airfoils etc.)rhoinf::Real
: Free-stream densityuinf::Real
: Free-stream velocitylinf::Real
: Reference length of geometry (e.g. airfoil chord length)
Trixi.LinearScalarAdvectionEquation1D
— TypeLinearScalarAdvectionEquation1D
The linear scalar advection equation
\[\partial_t u + a \partial_1 u = 0\]
in one space dimension with constant velocity a
.
Trixi.LinearScalarAdvectionEquation2D
— TypeLinearScalarAdvectionEquation2D
The linear scalar advection equation
\[\partial_t u + a_1 \partial_1 u + a_2 \partial_2 u = 0\]
in two space dimensions with constant velocity a
.
Trixi.LinearScalarAdvectionEquation3D
— TypeLinearScalarAdvectionEquation3D
The linear scalar advection equation
\[\partial_t u + a_1 \partial_1 u + a_2 \partial_2 u + a_3 \partial_3 u = 0\]
in three space dimensions with constant velocity a
.
Trixi.LinearizedEulerEquations1D
— TypeLinearizedEulerEquations1D(v_mean_global, c_mean_global, rho_mean_global)
Linearized Euler equations in one space dimension. The equations are given by
\[\partial_t \begin{pmatrix} \rho' \\ v_1' \\ p' \end{pmatrix} + \partial_x \begin{pmatrix} \bar{\rho} v_1' + \bar{v_1} \rho ' \\ \bar{v_1} v_1' + \frac{p'}{\bar{\rho}} \\ \bar{v_1} p' + c^2 \bar{\rho} v_1' \end{pmatrix} = \begin{pmatrix} 0 \\ 0 \\ 0 \end{pmatrix}\]
The bar $\bar{(\cdot)}$ indicates uniform mean flow variables and $c$ is the speed of sound. The unknowns are the perturbation quantities of the acoustic velocity $v_1'$, the pressure $p'$ and the density $\rho'$.
Trixi.LinearizedEulerEquations2D
— TypeLinearizedEulerEquations2D(v_mean_global, c_mean_global, rho_mean_global)
Linearized Euler equations in two space dimensions. The equations are given by
\[\partial_t \begin{pmatrix} \rho' \\ v_1' \\ v_2' \\ p' \end{pmatrix} + \partial_x \begin{pmatrix} \bar{\rho} v_1' + \bar{v_1} \rho ' \\ \bar{v_1} v_1' + \frac{p'}{\bar{\rho}} \\ \bar{v_1} v_2' \\ \bar{v_1} p' + c^2 \bar{\rho} v_1' \end{pmatrix} + \partial_y \begin{pmatrix} \bar{\rho} v_2' + \bar{v_2} \rho ' \\ \bar{v_2} v_1' \\ \bar{v_2} v_2' + \frac{p'}{\bar{\rho}} \\ \bar{v_2} p' + c^2 \bar{\rho} v_2' \end{pmatrix} = \begin{pmatrix} 0 \\ 0 \\ 0 \\ 0 \end{pmatrix}\]
The bar $\bar{(\cdot)}$ indicates uniform mean flow variables and $c$ is the speed of sound. The unknowns are the acoustic velocities $v' = (v_1', v_2')$, the pressure $p'$ and the density $\rho'$.
Trixi.LinearizedEulerEquations3D
— TypeLinearizedEulerEquations3D(v_mean_global, c_mean_global, rho_mean_global)
Linearized Euler equations in three space dimensions. The equations are given by
\[\partial_t \begin{pmatrix} \rho' \\ v_1' \\ v_2' \\ v_3' \\ p' \end{pmatrix} + \partial_x \begin{pmatrix} \bar{\rho} v_1' + \bar{v_1} \rho ' \\ \bar{v_1} v_1' + \frac{p'}{\bar{\rho}} \\ \bar{v_1} v_2' \\ \bar{v_1} v_3' \\ \bar{v_1} p' + c^2 \bar{\rho} v_1' \end{pmatrix} + \partial_y \begin{pmatrix} \bar{\rho} v_2' + \bar{v_2} \rho ' \\ \bar{v_2} v_1' \\ \bar{v_2} v_2' + \frac{p'}{\bar{\rho}} \\ \bar{v_2} v_3' \\ \bar{v_2} p' + c^2 \bar{\rho} v_2' \end{pmatrix} + \partial_z \begin{pmatrix} \bar{\rho} v_3' + \bar{v_3} \rho ' \\ \bar{v_3} v_1' \\ \bar{v_3} v_2' \\ \bar{v_3} v_3' + \frac{p'}{\bar{\rho}} \\ \bar{v_3} p' + c^2 \bar{\rho} v_3' \end{pmatrix} = \begin{pmatrix} 0 \\ 0 \\ 0 \\ 0 \\ 0 \end{pmatrix}\]
The bar $\bar{(\cdot)}$ indicates uniform mean flow variables and $c$ is the speed of sound. The unknowns are the acoustic velocities $v' = (v_1', v_2, v_3')$, the pressure $p'$ and the density $\rho'$.
Trixi.LobattoLegendreBasis
— TypeLobattoLegendreBasis([RealT=Float64,] polydeg::Integer)
Create a nodal Lobatto-Legendre basis for polynomials of degree polydeg
.
For the special case polydeg=0
the DG method reduces to a finite volume method. Therefore, this function sets the center point of the cell as single node. This exceptional case is currently only supported for TreeMesh!
Trixi.MaxwellEquations1D
— TypeMaxwellEquations1D(c = 299_792_458.0)
The Maxwell equations of electro dynamics
\[\frac{\partial}{\partial t} \begin{pmatrix} E \\ B \end{pmatrix} + \frac{\partial}{\partial x} \begin{pmatrix} c^2 B \\ E \end{pmatrix} = \begin{pmatrix} 0 \\ 0 \end{pmatrix}\]
in one dimension with speed of light c = 299792458 m/s
(in vacuum). In one dimension the Maxwell equations reduce to a wave equation. The orthogonal magnetic (e.g.B_y
) and electric field (E_z
) propagate as waves through the domain in x
-direction. For reference, see
e.g. p.15 of Numerical Methods for Conservation Laws: From Analysis to Algorithms https://doi.org/10.1137/1.9781611975109
or equation (1) in https://inria.hal.science/hal-01720293/document
Trixi.NoSlip
— Typestruct NoSlip
Use to create a no-slip boundary condition with BoundaryConditionNavierStokesWall
. The field boundary_value_function
should be a function with signature boundary_value_function(x, t, equations)
and should return a SVector{NDIMS}
whose entries are the velocity vector at a point x
and time t
.
Trixi.NonConservativeLocal
— TypeNonConservativeLocal()
Struct used for multiple dispatch on non-conservative flux functions in the format of "local * symmetric". When the argument nonconservative_type
is of type NonConservativeLocal
, the function returns the local part of the non-conservative term.
Trixi.NonConservativeSymmetric
— TypeNonConservativeSymmetric()
Struct used for multiple dispatch on non-conservative flux functions in the format of "local * symmetric". When the argument nonconservative_type
is of type NonConservativeSymmetric
, the function returns the symmetric part of the non-conservative term.
Trixi.P4estMesh
— TypeP4estMesh{NDIMS, NDIMS_AMBIENT} <: AbstractMesh{NDIMS}
An unstructured curved mesh based on trees that uses the C library p4est
to manage trees and mesh refinement.
The parameter NDIMS
denotes the dimension of the spatial domain or manifold represented by the mesh itself, while NDIMS_AMBIENT
denotes the dimension of the ambient space in which the mesh is embedded. For example, the type P4estMesh{3, 3}
corresponds to a standard mesh for a three-dimensional volume, whereas P4estMesh{2, 3}
corresponds to a mesh for a two-dimensional surface or shell in three-dimensional space.
The use of NDIMS != NDIMS_AMBIENT
is an experimental feature and may change in future releases.
Trixi.P4estMesh
— MethodP4estMesh(trees_per_dimension; polydeg,
mapping=nothing, faces=nothing, coordinates_min=nothing, coordinates_max=nothing,
RealT=Float64, initial_refinement_level=0, periodicity=true, unsaved_changes=true,
p4est_partition_allow_for_coarsening=true)
Create a structured curved P4estMesh
of the specified size.
There are three ways to map the mesh to the physical domain.
- Define a
mapping
that maps the hypercube[-1, 1]^n
. - Specify a
Tuple
faces
of functions that parametrize each face. - Create a rectangular mesh by specifying
coordinates_min
andcoordinates_max
.
Non-periodic boundaries will be called :x_neg
, :x_pos
, :y_neg
, :y_pos
, :z_neg
, :z_pos
.
Arguments
trees_per_dimension::NTupleE{NDIMS, Int}
: the number of trees in each dimension.polydeg::Integer
: polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree.mapping
: a function ofNDIMS
variables to describe the mapping that transforms the reference mesh ([-1, 1]^n
) to the physical domain. Use only one ofmapping
,faces
andcoordinates_min
/coordinates_max
.faces::NTuple{2*NDIMS}
: a tuple of2 * NDIMS
functions that describe the faces of the domain. Each function must takeNDIMS-1
arguments.faces[1]
describes the face onto which the face in negative x-direction of the unit hypercube is mapped. The face in positive x-direction of the unit hypercube will be mapped onto the face described byfaces[2]
.faces[3:4]
describe the faces in positive and negative y-direction respectively (in 2D and 3D).faces[5:6]
describe the faces in positive and negative z-direction respectively (in 3D). Use only one ofmapping
,faces
andcoordinates_min
/coordinates_max
.coordinates_min
: vector or tuple of the coordinates of the corner in the negative direction of each dimension to create a rectangular mesh. Use only one ofmapping
,faces
andcoordinates_min
/coordinates_max
.coordinates_max
: vector or tuple of the coordinates of the corner in the positive direction of each dimension to create a rectangular mesh. Use only one ofmapping
,faces
andcoordinates_min
/coordinates_max
.RealT::Type
: the type that should be used for coordinates.initial_refinement_level::Integer
: refine the mesh uniformly to this level before the simulation starts.periodicity
: either aBool
deciding if all of the boundaries are periodic or anNTuple{NDIMS, Bool}
deciding for each dimension if the boundaries in this dimension are periodic.unsaved_changes::Bool
: if set totrue
, the mesh will be saved to a mesh file.p4est_partition_allow_for_coarsening::Bool
: Must betrue
when using AMR to make mesh adaptivity independent of domain partitioning. Should befalse
for static meshes to permit more fine-grained partitioning.
Trixi.P4estMesh
— MethodP4estMesh{NDIMS}(meshfile::String;
mapping=nothing, polydeg=1, RealT=Float64,
initial_refinement_level=0, unsaved_changes=true,
p4est_partition_allow_for_coarsening=true,
boundary_symbols = nothing)
Main mesh constructor for the P4estMesh
that imports an unstructured, conforming mesh from an Abaqus mesh file (.inp
). Each element of the conforming mesh parsed from the meshfile
is created as a p4est
tree datatype.
To create a curved unstructured mesh P4estMesh
two strategies are available:
p4est_mesh_from_hohqmesh_abaqus
: High-order, curved boundary information created byHOHQMesh.jl
is available in themeshfile
. The mesh polynomial degreepolydeg
of the boundaries is provided from themeshfile
. The computation of the mapped tree coordinates is done with transfinite interpolation with linear blending similar toUnstructuredMesh2D
. Boundary name information is also parsed from themeshfile
such that different boundary conditions can be set at each named boundary on a given tree.p4est_mesh_from_standard_abaqus
: By default, withmapping=nothing
andpolydeg=1
, this creates a straight-sided from the information parsed from themeshfile
. If a mapping function is specified then it computes the mapped tree coordinates via polynomial interpolants with degreepolydeg
. The mesh created by this function will only have one boundary:all
ifboundary_symbols
is not specified. Ifboundary_symbols
is specified the mesh file will be parsed for nodesets defining the boundary nodes from which boundary edges (2D) and faces (3D) will be assigned.
Note that the mapping
and polydeg
keyword arguments are only used by the p4est_mesh_from_standard_abaqus
function. The p4est_mesh_from_hohqmesh_abaqus
function obtains the mesh polydeg
directly from the meshfile
and constructs the transfinite mapping internally.
The particular strategy is selected according to the header present in the meshfile
where the constructor checks whether or not the meshfile
was created with HOHQMesh.jl. If the Abaqus file header is not present in the meshfile
then the P4estMesh
is created with the function p4est_mesh_from_standard_abaqus
.
The default keyword argument initial_refinement_level=0
corresponds to a forest where the number of trees is the same as the number of elements in the original meshfile
. Increasing the initial_refinement_level
allows one to uniformly refine the base mesh given in the meshfile
to create a forest with more trees before the simulation begins. For example, if a two-dimensional base mesh contains 25 elements then setting initial_refinement_level=1
creates an initial forest of 2^2 * 25 = 100
trees.
Arguments
meshfile::String
: an uncurved Abaqus mesh file that can be imported byp4est
.mapping
: a function ofNDIMS
variables to describe the mapping that transforms the imported mesh to the physical domain. Usenothing
for the identity map.polydeg::Integer
: polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree. The default of1
creates an uncurved geometry. Use a higher value if the mapping will curve the imported uncurved mesh.RealT::Type
: the type that should be used for coordinates.initial_refinement_level::Integer
: refine the mesh uniformly to this level before the simulation starts.unsaved_changes::Bool
: if set totrue
, the mesh will be saved to a mesh file.p4est_partition_allow_for_coarsening::Bool
: Must betrue
when using AMR to make mesh adaptivity independent of domain partitioning. Should befalse
for static meshes to permit more fine-grained partitioning.boundary_symbols::Vector{Symbol}
: A vector of symbols that correspond to the boundary names in themeshfile
. Ifnothing
is passed then all boundaries are named:all
.
Trixi.PairedExplicitRK2
— TypePairedExplicitRK2(num_stages, base_path_monomial_coeffs::AbstractString, dt_opt = nothing,
bS = 1.0, cS = 0.5)
PairedExplicitRK2(num_stages, tspan, semi::AbstractSemidiscretization;
verbose = false, bS = 1.0, cS = 0.5)
PairedExplicitRK2(num_stages, tspan, eig_vals::Vector{ComplexF64};
verbose = false, bS = 1.0, cS = 0.5)
Parameters:
- `num_stages` (`Int`): Number of stages in the PERK method.
- `base_path_monomial_coeffs` (`AbstractString`): Path to a file containing
monomial coefficients of the stability polynomial of PERK method.
The coefficients should be stored in a text file at `joinpath(base_path_monomial_coeffs, "gamma_$(num_stages).txt")` and separated by line breaks.
- `dt_opt` (`Float64`, optional): Optimal time step size for the simulation setup. Can be `nothing` if it is unknown.
In this case the optimal CFL number cannot be computed and the [`StepsizeCallback`](@ref) cannot be used.
- `tspan`: Time span of the simulation.
- `semi` (`AbstractSemidiscretization`): Semidiscretization setup.
- `eig_vals` (`Vector{ComplexF64}`): Eigenvalues of the Jacobian of the right-hand side (rhs) of the ODEProblem after the
equation has been semidiscretized.
- `verbose` (`Bool`, optional): Verbosity flag, default is false.
- `bS` (`Float64`, optional): Value of b in the Butcher tableau at b_s, when
s is the number of stages, default is 1.0.
- `cS` (`Float64`, optional): Value of c in the Butcher tableau at c_s, when
s is the number of stages, default is 0.5.
The following structures and methods provide a minimal implementation of the second-order paired explicit Runge-Kutta (PERK) method optimized for a certain simulation setup (PDE, IC & BC, Riemann Solver, DG Solver).
- Brian Vermeire (2019). Paired explicit Runge-Kutta schemes for stiff systems of equations DOI: 10.1016/j.jcp.2019.05.014
Note: To use this integrator, the user must import the Convex
and ECOS
packages.
Trixi.PairedExplicitRK3
— TypePairedExplicitRK3(num_stages, base_path_a_coeffs::AbstractString, dt_opt = nothing;
cS2 = 1.0f0)
PairedExplicitRK3(num_stages, tspan, semi::AbstractSemidiscretization;
verbose = false, cS2 = 1.0f0)
PairedExplicitRK3(num_stages, tspan, eig_vals::Vector{ComplexF64};
verbose = false, cS2 = 1.0f0)
Parameters:
- `num_stages` (`Int`): Number of stages in the paired explicit Runge-Kutta (P-ERK) method.
- `base_path_a_coeffs` (`AbstractString`): Path to a file containing some coefficients in the A-matrix in
the Butcher tableau of the Runge Kutta method.
The matrix should be stored in a text file at `joinpath(base_path_a_coeffs, "a_$(num_stages).txt")` and separated by line breaks.
- `dt_opt` (`Float64`, optional): Optimal time step size for the simulation setup. Can be `nothing` if it is unknown.
In this case the optimal CFL number cannot be computed and the [`StepsizeCallback`](@ref) cannot be used.
- `tspan`: Time span of the simulation.
- `semi` (`AbstractSemidiscretization`): Semidiscretization setup.
- `eig_vals` (`Vector{ComplexF64}`): Eigenvalues of the Jacobian of the right-hand side (rhs) of the ODEProblem after the
equation has been semidiscretized.
- `verbose` (`Bool`, optional): Verbosity flag, default is false.
- `cS2` (`Float64`, optional): Value of c in the Butcher tableau at c_{s-2}, when
s is the number of stages, default is 1.0f0.
The following structures and methods provide an implementation of the third-order paired explicit Runge-Kutta (P-ERK) method optimized for a certain simulation setup (PDE, IC & BC, Riemann Solver, DG Solver). The original paper is
- Nasab, Vermeire (2022)
Third-order Paired Explicit Runge-Kutta schemes for stiff systems of equations DOI: 10.1016/j.jcp.2022.111470 While the changes to SSPRK33 base-scheme are described in
- Doehring, Schlottke-Lakemper, Gassner, Torrilhon (2024)
Multirate Time-Integration based on Dynamic ODE Partitioning through Adaptively Refined Meshes for Compressible Fluid Dynamics DOI: 10.1016/j.jcp.2024.113223
Note: To use this integrator, the user must import the Convex
, ECOS
, and NLsolve
packages.
Trixi.ParametersEulerGravity
— TypeParametersEulerGravity(; background_density=0.0,
gravitational_constant=1.0,
cfl=1.0,
resid_tol=1.0e-4,
n_iterations_max=10^4,
timestep_gravity=timestep_gravity_erk52_3Sstar!)
Set up parameters for the gravitational part of a SemidiscretizationEulerGravity
.
Trixi.ParsaniKetchesonDeconinck3Sstar32
— TypeParsaniKetchesonDeconinck3Sstar32()
Parsani, Ketcheson, Deconinck (2013) Optimized explicit RK schemes for the spectral difference method applied to wave propagation problems DOI: 10.1137/120885899
Trixi.ParsaniKetchesonDeconinck3Sstar94
— TypeParsaniKetchesonDeconinck3Sstar94()
Parsani, Ketcheson, Deconinck (2013) Optimized explicit RK schemes for the spectral difference method applied to wave propagation problems DOI: 10.1137/120885899
Trixi.PerformanceCounter
— TypePerformanceCounter()
A PerformanceCounter
can be used to track the runtime performance of some calls. Add a new runtime measurement via put!(counter, runtime)
and get the averaged runtime of all measurements added so far via take!(counter)
, resetting the counter
.
Trixi.PerformanceCounterList
— TypePerformanceCounterList{N}()
A PerformanceCounterList{N}
can be used to track the runtime performance of calls to multiple functions, adding them up. Add a new runtime measurement via put!(counter.counters[i], runtime)
and get the averaged runtime of all measurements added so far via take!(counter)
, resetting the counter
.
Trixi.PlotData1D
— TypePlotData1D
Holds all relevant data for creating 1D plots of multiple solution variables and to visualize the mesh.
This is an experimental feature and may change in future releases.
Trixi.PlotData1D
— MethodPlotData1D(u, semi [or mesh, equations, solver, cache];
solution_variables=nothing, nvisnodes=nothing)
Create a new PlotData1D
object that can be used for visualizing 1D DGSEM solution data array u
with Plots.jl
. All relevant geometrical information is extracted from the semidiscretization semi
. By default, the primitive variables (if existent) or the conservative variables (otherwise) from the solution are used for plotting. This can be changed by passing an appropriate conversion function to solution_variables
.
nvisnodes
specifies the number of visualization nodes to be used. If it is nothing
, twice the number of solution DG nodes are used for visualization, and if set to 0
, exactly the number of nodes in the DG elements are used.
When visualizing data from a two-dimensional simulation, a 1D slice is extracted for plotting. slice
specifies the axis along which the slice is extracted and may be :x
, or :y
. The slice position is specified by a point
that lies on it, which defaults to (0.0, 0.0)
. Both of these values are ignored when visualizing 1D data. This applies analogously to three-dimensional simulations, where slice
may be :xy
, :xz
, or :yz
.
Another way to visualize 2D/3D data is by creating a plot along a given curve. This is done with the keyword argument curve
. It can be set to a list of 2D/3D points which define the curve. When using curve
any other input from slice
or point
will be ignored.
This is an experimental feature and may change in future releases.
Trixi.PlotData1D
— MethodPlotData1D(sol; kwargs...)
Create a PlotData1D
object from a solution object created by either OrdinaryDiffEq.solve!
(which returns a SciMLBase.ODESolution
) or Trixi.jl's own solve!
(which returns a TimeIntegratorSolution
).
This is an experimental feature and may change in future releases.
Trixi.PlotData2DCartesian
— TypePlotData2D
Holds all relevant data for creating 2D plots of multiple solution variables and to visualize the mesh.
This is an experimental feature and may change in future releases.
Trixi.PolytropicEulerEquations2D
— TypePolytropicEulerEquations2D(gamma, kappa)
The polytropic Euler equations
\[\frac{\partial}{\partial t} \begin{pmatrix} \rho \\ \rho v_1 \\ \rho v_2 \end{pmatrix} + \frac{\partial}{\partial x} \begin{pmatrix} \rho v_1 \\ \rho v_1^2 + \kappa\rho^\gamma \\ \rho v_1 v_2 \end{pmatrix} + \frac{\partial}{\partial y} \begin{pmatrix} \rho v_2 \\ \rho v_1 v_2 \\ \rho v_2^2 + \kappa\rho^\gamma \end{pmatrix} = \begin{pmatrix} 0 \\ 0 \\ 0 \end{pmatrix}\]
for an ideal gas with ratio of specific heats gamma
in two space dimensions. Here, $\rho$ is the density and $v_1$ andv_2
the velocities and
\[p = \kappa\rho^\gamma\]
the pressure, which we replaced using this relation.
Trixi.PositivityPreservingLimiterZhangShu
— TypePositivityPreservingLimiterZhangShu(; threshold, variables)
The fully-discrete positivity-preserving limiter of
- Zhang, Shu (2011) Maximum-principle-satisfying and positivity-preserving high-order schemes for conservation laws: survey and new developments doi: 10.1098/rspa.2011.0153
The limiter is applied to all scalar variables
in their given order using the associated thresholds
to determine the minimal acceptable values. The order of the variables
is important and might have a strong influence on the robustness.
Trixi.SaveRestartCallback
— TypeSaveRestartCallback(; interval=0,
save_final_restart=true,
output_directory="out")
Save the current numerical solution in a restart file every interval
time steps.
Trixi.SaveSolutionCallback
— TypeSaveSolutionCallback(; interval::Integer=0,
dt=nothing,
save_initial_solution=true,
save_final_solution=true,
output_directory="out",
solution_variables=cons2prim)
Save the current numerical solution in regular intervals. Either pass interval
to save every interval
time steps or pass dt
to save in intervals of dt
in terms of integration time by adding additional (shortened) time steps where necessary (note that this may change the solution). solution_variables
can be any callable that converts the conservative variables at a single point to a set of solution variables. The first parameter passed to solution_variables
will be the set of conservative variables and the second parameter is the equation struct.
Trixi.SemidiscretizationCoupled
— TypeSemidiscretizationCoupled
A struct used to bundle multiple semidiscretizations. semidiscretize
will return an ODEProblem
that synchronizes time steps between the semidiscretizations. Each call of rhs!
will call rhs!
for each semidiscretization individually. The semidiscretizations can be coupled by gluing meshes together using BoundaryConditionCoupled
.
This is an experimental feature and can change any time.
Trixi.SemidiscretizationCoupled
— MethodSemidiscretizationCoupled(semis...)
Create a coupled semidiscretization that consists of the semidiscretizations passed as arguments.
Trixi.SemidiscretizationEulerAcoustics
— TypeSemidiscretizationEulerAcoustics(semi_acoustics::SemiAcoustics, semi_euler::SemiEuler;
source_region=x->true, weights=x->1.0)
This semidiscretization is experimental and may change in any future release.
Construct a semidiscretization of the acoustic perturbation equations that is coupled with the compressible Euler equations via source terms for the perturbed velocity. Both semidiscretizations have to use the same mesh and solvers with a shared basis. The coupling region is described by a function source_region
that maps the coordinates of a single node to true
or false
depending on whether the point lies within the coupling region or not. A weighting function weights
that maps coordinates to weights is applied to the acoustic source terms. Note that this semidiscretization should be used in conjunction with EulerAcousticsCouplingCallback
and only works in two dimensions.
Trixi.SemidiscretizationEulerGravity
— TypeSemidiscretizationEulerGravity
A struct containing everything needed to describe a spatial semidiscretization of a the compressible Euler equations with self-gravity, reformulating the Poisson equation for the gravitational potential as steady-state problem of the hyperblic diffusion equations.
- Michael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) "A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics" arXiv: 2008.10593
Trixi.SemidiscretizationEulerGravity
— MethodSemidiscretizationEulerGravity(semi_euler::SemiEuler, semi_gravity::SemiGravity, parameters)
Construct a semidiscretization of the compressible Euler equations with self-gravity. parameters
should be given as ParametersEulerGravity
.
Trixi.SemidiscretizationHyperbolic
— TypeSemidiscretizationHyperbolic
A struct containing everything needed to describe a spatial semidiscretization of a hyperbolic conservation law.
Trixi.SemidiscretizationHyperbolic
— MethodSemidiscretizationHyperbolic(mesh, equations, initial_condition, solver;
source_terms=nothing,
boundary_conditions=boundary_condition_periodic,
RealT=real(solver),
uEltype=RealT,
initial_cache=NamedTuple())
Construct a semidiscretization of a hyperbolic PDE.
Trixi.SemidiscretizationHyperbolicParabolic
— TypeSemidiscretizationHyperbolicParabolic
A struct containing everything needed to describe a spatial semidiscretization of a mixed hyperbolic-parabolic conservation law.
Trixi.SemidiscretizationHyperbolicParabolic
— MethodSemidiscretizationHyperbolicParabolic(mesh, both_equations, initial_condition, solver;
solver_parabolic=default_parabolic_solver(),
source_terms=nothing,
both_boundary_conditions=(boundary_condition_periodic, boundary_condition_periodic),
RealT=real(solver),
uEltype=RealT,
both_initial_caches=(NamedTuple(), NamedTuple()))
Construct a semidiscretization of a hyperbolic-parabolic PDE.
Trixi.ShallowWaterEquations1D
— TypeShallowWaterEquations1D(; gravity, H0 = 0)
Shallow water equations (SWE) in one space dimension. The equations are given by
\[\begin{aligned} \frac{\partial h}{\partial t} + \frac{\partial}{\partial x}(h v) &= 0 \\ \frac{\partial}{\partial t}(h v) + \frac{\partial}{\partial x}\left(h v^2 + \frac{g}{2}h^2\right) + g h \frac{\partial b}{\partial x} &= 0 \end{aligned}\]
The unknown quantities of the SWE are the water height $h$ and the velocity $v$. The gravitational constant is denoted by g
and the (possibly) variable bottom topography function $b(x)$. Conservative variable water height $h$ is measured from the bottom topography $b$, therefore one also defines the total water height as $H = h + b$.
The additional quantity $H_0$ is also available to store a reference value for the total water height that is useful to set initial conditions or test the "lake-at-rest" well-balancedness.
The bottom topography function $b(x)$ is set inside the initial condition routine for a particular problem setup. To test the conservative form of the SWE one can set the bottom topography variable b
to zero.
In addition to the unknowns, Trixi.jl currently stores the bottom topography values at the approximation points despite being fixed in time. This is done for convenience of computing the bottom topography gradients on the fly during the approximation as well as computing auxiliary quantities like the total water height $H$ or the entropy variables. This affects the implementation and use of these equations in various ways:
- The flux values corresponding to the bottom topography must be zero.
- The bottom topography values must be included when defining initial conditions, boundary conditions or source terms.
AnalysisCallback
analyzes this variable.- Trixi.jl's visualization tools will visualize the bottom topography by default.
References for the SWE are many but a good introduction is available in Chapter 13 of the book:
- Randall J. LeVeque (2002) Finite Volume Methods for Hyperbolic Problems DOI: 10.1017/CBO9780511791253
Trixi.ShallowWaterEquations2D
— TypeShallowWaterEquations2D(; gravity, H0 = 0)
Shallow water equations (SWE) in two space dimensions. The equations are given by
\[\begin{aligned} \frac{\partial h}{\partial t} + \frac{\partial}{\partial x}(h v_1) + \frac{\partial}{\partial y}(h v_2) &= 0 \\ \frac{\partial}{\partial t}(h v_1) + \frac{\partial}{\partial x}\left(h v_1^2 + \frac{g}{2}h^2\right) + \frac{\partial}{\partial y}(h v_1 v_2) + g h \frac{\partial b}{\partial x} &= 0 \\ \frac{\partial}{\partial t}(h v_2) + \frac{\partial}{\partial x}(h v_1 v_2) + \frac{\partial}{\partial y}\left(h v_2^2 + \frac{g}{2}h^2\right) + g h \frac{\partial b}{\partial y} &= 0. \end{aligned}\]
The unknown quantities of the SWE are the water height $h$ and the velocities $\mathbf{v} = (v_1, v_2)^T$. The gravitational constant is denoted by g
and the (possibly) variable bottom topography function $b(x,y)$. Conservative variable water height $h$ is measured from the bottom topography $b$, therefore one also defines the total water height as $H = h + b$.
The additional quantity $H_0$ is also available to store a reference value for the total water height that is useful to set initial conditions or test the "lake-at-rest" well-balancedness.
The bottom topography function $b(x,y)$ is set inside the initial condition routine for a particular problem setup. To test the conservative form of the SWE one can set the bottom topography variable b
to zero.
In addition to the unknowns, Trixi.jl currently stores the bottom topography values at the approximation points despite being fixed in time. This is done for convenience of computing the bottom topography gradients on the fly during the approximation as well as computing auxiliary quantities like the total water height $H$ or the entropy variables. This affects the implementation and use of these equations in various ways:
- The flux values corresponding to the bottom topography must be zero.
- The bottom topography values must be included when defining initial conditions, boundary conditions or source terms.
AnalysisCallback
analyzes this variable.- Trixi.jl's visualization tools will visualize the bottom topography by default.
References for the SWE are many but a good introduction is available in Chapter 13 of the book:
- Randall J. LeVeque (2002) Finite Volume Methods for Hyperbolic Problems DOI: 10.1017/CBO9780511791253
Trixi.ShallowWaterEquationsQuasi1D
— TypeShallowWaterEquationsQuasi1D(; gravity, H0 = 0, threshold_limiter = nothing threshold_wet = nothing)
The quasi-1D shallow water equations (SWE). The equations are given by
\[\begin{aligned} \frac{\partial}{\partial t}(a h) + \frac{\partial}{\partial x}(a h v) &= 0 \\ \frac{\partial}{\partial t}(a h v) + \frac{\partial}{\partial x}(a h v^2) + g a h \frac{\partial}{\partial x}(h + b) &= 0 \end{aligned}\]
The unknown quantities of the Quasi-1D SWE are the water height $h$ and the scaled velocity $v$. The gravitational constant is denoted by g
, the (possibly) variable bottom topography function $b(x)$, and (possibly) variable channel width $a(x)$. The water height $h$ is measured from the bottom topography $b$, therefore one also defines the total water height as $H = h + b$.
The additional quantity $H_0$ is also available to store a reference value for the total water height that is useful to set initial conditions or test the "lake-at-rest" well-balancedness.
The bottom topography function $b(x)$ and channel width $a(x)$ are set inside the initial condition routine for a particular problem setup. To test the conservative form of the SWE one can set the bottom topography variable b
to zero and $a$ to one.
In addition to the unknowns, Trixi.jl currently stores the bottom topography and channel width values at the approximation points despite being fixed in time. This is done for convenience of computing the bottom topography gradients on the fly during the approximation as well as computing auxiliary quantities like the total water height $H$ or the entropy variables. This affects the implementation and use of these equations in various ways:
- The flux values corresponding to the bottom topography and channel width must be zero.
- The bottom topography and channel width values must be included when defining initial conditions, boundary conditions or source terms.
AnalysisCallback
analyzes this variable.- Trixi.jl's visualization tools will visualize the bottom topography and channel width by default.
Trixi.SimpleSSPRK33
— TypeSimpleSSPRK33(; stage_callbacks=())
The third-order SSP Runge-Kutta method of Shu and Osher.
References
- Shu, Osher (1988) "Efficient Implementation of Essentially Non-oscillatory Shock-Capturing Schemes" (Eq. 2.18) DOI: 10.1016/0021-9991(88)90177-5
Trixi.SteadyStateCallback
— TypeSteadyStateCallback(; abstol=1.0e-8, reltol=1.0e-6)
Terminates the integration when the residual_steady_state(du, equations)
falls below the threshold specified by abstol, reltol
.
Trixi.StepsizeCallback
— TypeStepsizeCallback(; cfl=1.0)
Set the time step size according to a CFL condition with CFL number cfl
if the time integration method isn't adaptive itself.
Trixi.StructuredMesh
— TypeStructuredMesh{NDIMS} <: AbstractMesh{NDIMS}
A structured curved mesh.
Different numbers of cells per dimension are possible and arbitrary functions can be used as domain faces.
Trixi.StructuredMesh
— MethodStructuredMesh(cells_per_dimension, coordinates_min, coordinates_max; periodicity=true)
Create a StructuredMesh that represents a uncurved structured mesh with a rectangular domain.
Arguments
cells_per_dimension::NTuple{NDIMS, Int}
: the number of cells in each dimension.coordinates_min::NTuple{NDIMS, RealT}
: coordinate of the corner in the negative direction of each dimension.coordinates_max::NTuple{NDIMS, RealT}
: coordinate of the corner in the positive direction of each dimension.periodicity
: either aBool
deciding if all of the boundaries are periodic or anNTuple{NDIMS, Bool}
deciding for each dimension if the boundaries in this dimension are periodic.
Trixi.StructuredMesh
— MethodStructuredMesh(cells_per_dimension, mapping;
RealT=Float64,
unsaved_changes=true,
mapping_as_string=mapping2string(mapping, length(cells_per_dimension), RealT=RealT))
Create a StructuredMesh of the given size and shape that uses RealT
as coordinate type.
Arguments
cells_per_dimension::NTupleE{NDIMS, Int}
: the number of cells in each dimension.mapping
: a function ofNDIMS
variables to describe the mapping, which transforms the reference mesh to the physical domain. If nomapping_as_string
is defined, this function must be defined with the namemapping
to allow for restarts. This will be changed in the future, see https://github.com/trixi-framework/Trixi.jl/issues/541.RealT::Type
: the type that should be used for coordinates.periodicity
: either aBool
deciding if all of the boundaries are periodic or anNTuple{NDIMS, Bool}
deciding for each dimension if the boundaries in this dimension are periodic.unsaved_changes::Bool
: if set totrue
, the mesh will be saved to a mesh file.mapping_as_string::String
: the code that defines themapping
. IfCodeTracking
can't find the function definition, it can be passed directly here. The code string must define the mapping function with the namemapping
. This will be changed in the future, see https://github.com/trixi-framework/Trixi.jl/issues/541.
Trixi.StructuredMesh
— MethodStructuredMesh(cells_per_dimension, faces; RealT=Float64, unsaved_changes=true, faces_as_string=faces2string(faces))
Create a StructuredMesh of the given size and shape that uses RealT
as coordinate type.
Arguments
cells_per_dimension::NTupleE{NDIMS, Int}
: the number of cells in each dimension.faces::NTuple{2*NDIMS}
: a tuple of2 * NDIMS
functions that describe the faces of the domain. Each function must takeNDIMS-1
arguments.faces[1]
describes the face onto which the face in negative x-direction of the unit hypercube is mapped. The face in positive x-direction of the unit hypercube will be mapped onto the face described byfaces[2]
.faces[3:4]
describe the faces in positive and negative y-direction respectively (in 2D and 3D).faces[5:6]
describe the faces in positive and negative z-direction respectively (in 3D).RealT::Type
: the type that should be used for coordinates.periodicity
: either aBool
deciding if all of the boundaries are periodic or anNTuple{NDIMS, Bool}
deciding for each dimension if the boundaries in this dimension are periodic.
Trixi.StructuredMeshView
— TypeStructuredMeshView{NDIMS, RealT <: Real} <: AbstractMesh{NDIMS}
A view on a structured curved mesh.
Trixi.StructuredMeshView
— MethodStructuredMeshView(parent; indices_min, indices_max)
Create a StructuredMeshView on a StructuredMesh parent.
Arguments
parent
: the parent StructuredMesh.indices_min
: starting indices of the parent mesh.indices_max
: ending indices of the parent mesh.
Trixi.SubcellLimiterIDP
— TypeSubcellLimiterIDP(equations::AbstractEquations, basis;
local_twosided_variables_cons = String[],
positivity_variables_cons = String[],
positivity_variables_nonlinear = [],
positivity_correction_factor = 0.1,
local_onesided_variables_nonlinear = [],
max_iterations_newton = 10,
newton_tolerances = (1.0e-12, 1.0e-14),
gamma_constant_newton = 2 * ndims(equations))
Subcell invariant domain preserving (IDP) limiting used with VolumeIntegralSubcellLimiting
including:
- Local two-sided Zalesak-type limiting for conservative variables (
local_twosided_variables_cons
) - Positivity limiting for conservative variables (
positivity_variables_cons
) and nonlinear variables
(positivity_variables_nonlinear
)
- Local one-sided limiting for nonlinear variables, e.g.
entropy_guermond_etal
andentropy_math
with local_onesided_variables_nonlinear
To use these three limiting options use the following structure:
***Conservative variables*** to be limited are passed as a vector of strings, e.g. local_twosided_variables_cons = ["rho"]
and positivity_variables_cons = ["rho"]
. For ***nonlinear variables***, the wanted variable functions are passed within a vector: To ensure positivity use a plain vector including the desired variables, e.g. positivity_variables_nonlinear = [pressure]
. For local one-sided limiting pass the variable function combined with the requested bound (min
or max
) as a tuple. For instance, to impose a lower local bound on the modified specific entropy by Guermond et al. use local_onesided_variables_nonlinear = [(Trixi.entropy_guermond_etal, min)]
.
The bounds are calculated using the low-order FV solution. The positivity limiter uses positivity_correction_factor
such that u^new >= positivity_correction_factor * u^FV
. Local and global limiting of nonlinear variables uses a Newton-bisection method with a maximum of max_iterations_newton
iterations, relative and absolute tolerances of newton_tolerances
and a provisional update constant gamma_constant_newton
(gamma_constant_newton>=2*d
, where d = #dimensions
). See equation (20) of Pazner (2020) and equation (30) of Rueda-Ramírez et al. (2022).
This limiter and the correction callback SubcellLimiterIDPCorrection
only work together. Without the callback, no correction takes place, leading to a standard low-order FV scheme.
References
- Rueda-Ramírez, Pazner, Gassner (2022) Subcell Limiting Strategies for Discontinuous Galerkin Spectral Element Methods DOI: 10.1016/j.compfluid.2022.105627
- Pazner (2020) Sparse invariant domain preserving discontinuous Galerkin methods with subcell convex limiting DOI: 10.1016/j.cma.2021.113876
Trixi.SubcellLimiterIDPCorrection
— TypeSubcellLimiterIDPCorrection()
Perform antidiffusive correction stage for the a posteriori IDP limiter SubcellLimiterIDP
called with VolumeIntegralSubcellLimiting
.
This callback and the actual limiter SubcellLimiterIDP
only work together. This is not a replacement but a necessary addition.
References
- Rueda-Ramírez, Pazner, Gassner (2022) Subcell Limiting Strategies for Discontinuous Galerkin Spectral Element Methods DOI: 10.1016/j.compfluid.2022.105627
- Pazner (2020) Sparse invariant domain preserving discontinuous Galerkin methods with subcell convex limiting DOI: 10.1016/j.cma.2021.113876
Trixi.SurfaceIntegralStrongForm
— TypeSurfaceIntegralStrongForm(surface_flux=flux_central)
The classical strong form surface integral type for FD/DG methods.
See also VolumeIntegralStrongForm
.
Trixi.SurfaceIntegralUpwind
— TypeSurfaceIntegralUpwind(splitting)
Couple elements with upwind simultaneous approximation terms (SATs) that use a particular flux splitting
, e.g., splitting_steger_warming
.
See also VolumeIntegralUpwind
.
This is an experimental feature and may change in future releases.
Trixi.SurfaceIntegralWeakForm
— TypeSurfaceIntegralWeakForm(surface_flux=flux_central)
The classical weak form surface integral type for DG methods as explained in standard textbooks.
See also VolumeIntegralWeakForm
.
References
- Kopriva (2009) Implementing Spectral Methods for Partial Differential Equations: Algorithms for Scientists and Engineers doi: 10.1007/978-90-481-2261-5
- Hesthaven, Warburton (2007) Nodal Discontinuous Galerkin Methods: Algorithms, Analysis, and Applications doi: 10.1007/978-0-387-72067-8
Trixi.T8codeMesh
— TypeT8codeMesh{NDIMS} <: AbstractMesh{NDIMS}
An unstructured curved mesh based on trees that uses the C library 't8code' to manage trees and mesh refinement.
Trixi.T8codeMesh
— MethodT8codeMesh(trees_per_dimension; polydeg, mapping=identity,
RealT=Float64, initial_refinement_level=0, periodicity=true)
Create a structured potentially curved 'T8codeMesh' of the specified size.
Non-periodic boundaries will be called ':xneg', ':xpos', ':yneg', ':ypos', ':zneg', ':zpos'.
Arguments
- 'treesperdimension::NTupleE{NDIMS, Int}': the number of trees in each dimension.
- 'polydeg::Integer': polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree.
mapping
: a function ofNDIMS
variables to describe the mapping that transforms the reference mesh ([-1, 1]^n
) to the physical domain. Use only one ofmapping
,faces
andcoordinates_min
/coordinates_max
.faces::NTuple{2*NDIMS}
: a tuple of2 * NDIMS
functions that describe the faces of the domain. Each function must takeNDIMS-1
arguments.faces[1]
describes the face onto which the face in negative x-direction of the unit hypercube is mapped. The face in positive x-direction of the unit hypercube will be mapped onto the face described byfaces[2]
.faces[3:4]
describe the faces in positive and negative y-direction respectively (in 2D and 3D).faces[5:6]
describe the faces in positive and negative z-direction respectively (in 3D). Use only one ofmapping
,faces
andcoordinates_min
/coordinates_max
.coordinates_min
: vector or tuple of the coordinates of the corner in the negative direction of each dimension to create a rectangular mesh. Use only one ofmapping
,faces
andcoordinates_min
/coordinates_max
.coordinates_max
: vector or tuple of the coordinates of the corner in the positive direction of each dimension to create a rectangular mesh. Use only one ofmapping
,faces
andcoordinates_min
/coordinates_max
.- 'RealT::Type': the type that should be used for coordinates.
- 'initialrefinementlevel::Integer': refine the mesh uniformly to this level before the simulation starts.
- 'periodicity': either a 'Bool' deciding if all of the boundaries are periodic or an 'NTuple{NDIMS, Bool}' deciding for each dimension if the boundaries in this dimension are periodic.
Trixi.T8codeMesh
— MethodT8codeMesh(conn::Ptr{p4est_connectivity}; kwargs...)
Main mesh constructor for the T8codeMesh
that imports an unstructured, conforming mesh from a p4est_connectivity
data structure.
Arguments
conn::Ptr{p4est_connectivity}
: Pointer to a P4est connectivity object.mapping
: a function ofNDIMS
variables to describe the mapping that transforms the imported mesh to the physical domain. Usenothing
for the identity map.polydeg::Integer
: polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree. The default of1
creates an uncurved geometry. Use a higher value if the mapping will curve the imported uncurved mesh.RealT::Type
: the type that should be used for coordinates.initial_refinement_level::Integer
: refine the mesh uniformly to this level before the simulation starts.
Trixi.T8codeMesh
— MethodT8codeMesh(conn::Ptr{p8est_connectivity}; kwargs...)
Main mesh constructor for the T8codeMesh
that imports an unstructured, conforming mesh from a p4est_connectivity
data structure.
Arguments
conn::Ptr{p4est_connectivity}
: Pointer to a P4est connectivity object.mapping
: a function ofNDIMS
variables to describe the mapping that transforms the imported mesh to the physical domain. Usenothing
for the identity map.polydeg::Integer
: polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree. The default of1
creates an uncurved geometry. Use a higher value if the mapping will curve the imported uncurved mesh.RealT::Type
: the type that should be used for coordinates.initial_refinement_level::Integer
: refine the mesh uniformly to this level before the simulation starts.
Trixi.T8codeMesh
— MethodT8codeMesh(cmesh::Ptr{t8_cmesh},
mapping=nothing, polydeg=1, RealT=Float64,
initial_refinement_level=0)
Main mesh constructor for the T8codeMesh
that imports an unstructured, conforming mesh from a t8_cmesh
data structure.
Arguments
cmesh::Ptr{t8_cmesh}
: Pointer to a cmesh object.mapping
: a function ofNDIMS
variables to describe the mapping that transforms the imported mesh to the physical domain. Usenothing
for the identity map.polydeg::Integer
: polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree. The default of1
creates an uncurved geometry. Use a higher value if the mapping will curve the imported uncurved mesh.RealT::Type
: the type that should be used for coordinates.initial_refinement_level::Integer
: refine the mesh uniformly to this level before the simulation starts.
Trixi.T8codeMesh
— MethodT8codeMesh(meshfile::String, NDIMS; kwargs...)
Main mesh constructor for the T8codeMesh
that imports an unstructured, conforming mesh from either a Gmsh mesh file (.msh
) or Abaqus mesh file (.inp
) which is determined by the file extension.
Arguments
filepath::String
: path to a Gmsh or Abaqus mesh file.ndims
: Mesh file dimension:2
or3
.
Optional Keyword Arguments
mapping
: A function ofNDIMS
variables to describe the mapping that transforms the imported mesh to the physical domain. Usenothing
for the identity map.polydeg::Integer
: Polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree. The default of1
creates an uncurved geometry. Use a higher value if the mapping will curve the imported uncurved mesh.RealT::Type
: The type that should be used for coordinates.initial_refinement_level::Integer
: Refine the mesh uniformly to this level before the simulation starts.
Trixi.T8codeMesh
— MethodT8codeMesh{NDIMS, RealT}(forest, boundary_names; polydeg = 1, mapping = nothing)
Main mesh constructor for the T8codeMesh
wrapping around a given t8code forest
object. This constructor is typically called by other T8codeMesh
constructors.
Arguments
forest
: Pointer to a t8code forest.boundary_names
: List of boundary names.polydeg::Integer
: Polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree.mapping
: A function ofNDIMS
variables to describe the mapping that transforms the imported mesh to the physical domain. Usenothing
for the identity map.
Trixi.T8codeMesh
— MethodT8codeMesh(meshfile::AbaqusFile{NDIMS};
mapping=nothing, polydeg=1, RealT=Float64,
initial_refinement_level=0, unsaved_changes=true,
boundary_symbols = nothing)
Main mesh constructor for the T8codeMesh
that imports an unstructured, conforming mesh from an Abaqus mesh file (.inp
).
To create a curved unstructured T8codeMesh
two strategies are available:
HOHQMesh Abaqus
: High-order, curved boundary information created byHOHQMesh.jl
is available in themeshfile
. The mesh polynomial degreepolydeg
of the boundaries is provided from themeshfile
. The computation of the mapped tree coordinates is done with transfinite interpolation with linear blending similar toUnstructuredMesh2D
. Boundary name information is also parsed from themeshfile
such that different boundary conditions can be set at each named boundary on a given tree.Standard Abaqus
: By default, withmapping=nothing
andpolydeg=1
, this creates a straight-sided mesh from the information parsed from themeshfile
. If a mapping function is specified then it computes the mapped tree coordinates via polynomial interpolants with degreepolydeg
. The mesh created by this function will only have one boundary:all
ifboundary_symbols
is not specified. Ifboundary_symbols
is specified the mesh file will be parsed for nodesets defining the boundary nodes from which boundary edges (2D) and faces (3D) will be assigned.
Note that the mapping
and polydeg
keyword arguments are only used by the HOHQMesh Abaqus
option. The Standard Abaqus
routine obtains the mesh polydeg
directly from the meshfile
and constructs the transfinite mapping internally.
The particular strategy is selected according to the header present in the meshfile
where the constructor checks whether or not the meshfile
was created with HOHQMesh.jl. If the Abaqus file header is not present in the meshfile
then the T8codeMesh
is created by Standard Abaqus
.
The default keyword argument initial_refinement_level=0
corresponds to a forest where the number of trees is the same as the number of elements in the original meshfile
. Increasing the initial_refinement_level
allows one to uniformly refine the base mesh given in the meshfile
to create a forest with more trees before the simulation begins. For example, if a two-dimensional base mesh contains 25 elements then setting initial_refinement_level=1
creates an initial forest of 2^2 * 25 = 100
trees.
Arguments
meshfile::AbaqusFile{NDIMS}
: Abaqus mesh file object of dimension NDIMS and givenpath
to the file.
Optional Keyword Arguments
mapping
: A function ofNDIMS
variables to describe the mapping that transforms the imported mesh to the physical domain. Usenothing
for the identity map.polydeg::Integer
: Polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree. The default of1
creates an uncurved geometry. Use a higher value if the mapping will curve the imported uncurved mesh.RealT::Type
: The type that should be used for coordinates.initial_refinement_level::Integer
: Refine the mesh uniformly to this level before the simulation starts.boundary_symbols::Vector{Symbol}
: A vector of symbols that correspond to the boundary names in themeshfile
. Ifnothing
is passed then all boundaries are named:all
.
Trixi.T8codeMesh
— MethodT8codeMesh(meshfile::GmshFile{NDIMS}; kwargs...)
Main mesh constructor for the T8codeMesh
that imports an unstructured, conforming mesh from a Gmsh mesh file (.msh
).
Arguments
meshfile::GmshFile{NDIMS}
: Gmsh mesh file object of dimension NDIMS and givepath
to the file.
Optional Keyword Arguments
mapping
: A function ofNDIMS
variables to describe the mapping that transforms the imported mesh to the physical domain. Usenothing
for the identity map.polydeg::Integer
: Polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree. The default of1
creates an uncurved geometry. Use a higher value if the mapping will curve the imported uncurved mesh.RealT::Type
: The type that should be used for coordinates.initial_refinement_level::Integer
: Refine the mesh uniformly to this level before the simulation starts.
Trixi.TimeSeriesCallback
— TypeTimeSeriesCallback(semi, point_coordinates;
interval=1, solution_variables=cons2cons,
output_directory="out", filename="time_series.h5",
RealT=real(solver), uEltype=eltype(cache.elements))
Create a callback that records point-wise data at points given in point_coordinates
every interval
time steps. The point coordinates are to be specified either as a vector of coordinate tuples or as a two-dimensional array where the first dimension is the point number and the second dimension is the coordinate dimension. By default, the conservative variables are recorded, but this can be controlled by passing a different conversion function to solution_variables
.
After the last time step, the results are stored in an HDF5 file filename
in directory output_directory
.
The real data type RealT
and data type for solution variables uEltype
default to the respective types used in the solver and the cache.
Currently this callback is only implemented for TreeMesh
and UnstructuredMesh2D
.
Trixi.TrafficFlowLWREquations1D
— TypeTrafficFlowLWREquations1D
The classic Lighthill-Witham Richards (LWR) model for 1D traffic flow. The car density is denoted by $u \in [0, 1]$ and the maximum possible speed (e.g. due to speed limits) is $v_{\text{max}}$.
\[\partial_t u + v_{\text{max}} \partial_1 [u (1 - u)] = 0\]
For more details see e.g. Section 11.1 of
- Randall LeVeque (2002)
Finite Volume Methods for Hyperbolic Problems DOI: 10.1017/CBO9780511791253
Trixi.TreeMesh
— TypeTreeMesh{NDIMS} <: AbstractMesh{NDIMS}
A Cartesian mesh based on trees of hypercubes to support adaptive mesh refinement.
Trixi.UnstructuredMesh2D
— TypeUnstructuredMesh2D <: AbstractMesh{2}
An unstructured (possibly curved) quadrilateral mesh.
UnstructuredMesh2D(filename; RealT=Float64, periodicity=false)
All mesh information, neighbour coupling, and boundary curve information is read in from a mesh file filename
.
Trixi.UnstructuredSortedBoundaryTypes
— TypeUnstructuredSortedBoundaryTypes
General container to sort the boundary conditions by type and name for some unstructured meshes/solvers. It stores a set of global indices for each boundary condition type and name to expedite computation during the call to calc_boundary_flux!
. The original dictionary form of the boundary conditions set by the user in the elixir file is also stored for printing.
Trixi.ViscousFormulationBassiRebay1
— TypeViscousFormulationBassiRebay1()
The classical BR1 flux from
- F. Bassi, S. Rebay (1997) A High-Order Accurate Discontinuous Finite Element Method for the Numerical Solution of the Compressible Navier-Stokes Equations DOI: 10.1006/jcph.1996.5572
Trixi.ViscousFormulationLocalDG
— TypeViscousFormulationLocalDG(penalty_parameter)
The local DG (LDG) flux from "The Local Discontinuous Galerkin Method for Time-Dependent Convection-Diffusion Systems" by Cockburn and Shu (1998).
Note that, since this implementation does not involve the parabolic "upwinding" vector, the LDG solver is equivalent to ViscousFormulationBassiRebay1
with an LDG-type penalization.
- Cockburn and Shu (1998). The Local Discontinuous Galerkin Method for Time-Dependent Convection-Diffusion Systems DOI: 10.1137/S0036142997316712
Trixi.VisualizationCallback
— MethodVisualizationCallback(; interval=0,
solution_variables=cons2prim,
variable_names=[],
show_mesh=false,
plot_data_creator=PlotData2D,
plot_creator=show_plot,
plot_arguments...)
Create a callback that visualizes results during a simulation, also known as in-situ visualization.
This is an experimental feature and may change in any future releases.
The interval
specifies the number of time step iterations after which a new plot is generated. The available variables to plot are configured with the solution_variables
parameter, which acts the same way as for the SaveSolutionCallback
. The variables to be actually plotted can be selected by providing a single string or a list of strings to variable_names
, and if show_mesh
is true
, an additional plot with the mesh will be generated.
To customize the generated figure, plot_data_creator
allows to use different plot data types. With plot_creator
you can further specify an own function to visualize results, which must support the same interface as the default implementation show_plot
. All remaining keyword arguments are collected and passed as additional arguments to the plotting command.
Trixi.VolumeIntegralFluxDifferencing
— TypeVolumeIntegralFluxDifferencing(volume_flux)
Volume integral type for DG methods based on SBP operators and flux differencing using a symmetric two-point volume_flux
. This volume_flux
needs to satisfy the interface of numerical fluxes in Trixi.jl.
References
- LeFloch, Mercier, Rohde (2002) Fully Discrete, Entropy Conservative Schemes of Arbitrary Order doi: 10.1137/S003614290240069X
- Fisher, Carpenter (2013) High-order entropy stable finite difference schemes for nonlinear conservation laws: Finite domains doi: 10.1016/j.jcp.2013.06.014
- Hendrik Ranocha (2017) Comparison of Some Entropy Conservative Numerical Fluxes for the Euler Equations arXiv: 1701.02264 doi: 10.1007/s10915-017-0618-1
- Chen, Shu (2017) Entropy stable high order discontinuous Galerkin methods with suitable quadrature rules for hyperbolic conservation laws doi: 10.1016/j.jcp.2017.05.025
Trixi.VolumeIntegralPureLGLFiniteVolume
— TypeVolumeIntegralPureLGLFiniteVolume(volume_flux_fv)
A volume integral that only uses the subcell finite volume schemes of the VolumeIntegralShockCapturingHG
.
This gives a formally O(1)-accurate finite volume scheme on an LGL-type subcell mesh (LGL = Legendre-Gauss-Lobatto).
This is an experimental feature and may change in future releases.
References
- Hennemann, Gassner (2020) "A provably entropy stable subcell shock capturing approach for high order split form DG" arXiv: 2008.12044
Trixi.VolumeIntegralShockCapturingHG
— TypeVolumeIntegralShockCapturingHG(indicator; volume_flux_dg=flux_central,
volume_flux_fv=flux_lax_friedrichs)
Shock-capturing volume integral type for DG methods using a convex blending of the finite volume method with numerical flux volume_flux_fv
and the VolumeIntegralFluxDifferencing
with volume flux volume_flux_dg
. The amount of blending is determined by the indicator
, e.g., IndicatorHennemannGassner
.
References
- Hennemann, Gassner (2020) "A provably entropy stable subcell shock capturing approach for high order split form DG" arXiv: 2008.12044
Trixi.VolumeIntegralStrongForm
— TypeVolumeIntegralStrongForm()
The classical strong form volume integral type for FD/DG methods.
Trixi.VolumeIntegralSubcellLimiting
— TypeVolumeIntegralSubcellLimiting(limiter;
volume_flux_dg, volume_flux_fv)
A subcell limiting volume integral type for DG methods based on subcell blending approaches with a low-order FV method. Used with limiter SubcellLimiterIDP
.
Subcell limiting methods are not fully functional on non-conforming meshes. This is mainly because the implementation assumes that low- and high-order schemes have the same surface terms, which is not guaranteed for non-conforming meshes. The low-order scheme with a high-order mortar is not invariant domain preserving.
Trixi.VolumeIntegralUpwind
— TypeVolumeIntegralUpwind(splitting)
Specialized volume integral for finite difference summation-by-parts (FDSBP) solvers. Can be used together with the upwind SBP operators of Mattsson (2017) implemented in SummationByPartsOperators.jl. The splitting
controls the discretization.
See also splitting_steger_warming
, splitting_lax_friedrichs
, splitting_vanleer_haenel
.
References
- Mattsson (2017) Diagonal-norm upwind SBP operators doi: 10.1016/j.jcp.2017.01.042
This is an experimental feature and may change in future releases.
Trixi.VolumeIntegralWeakForm
— TypeVolumeIntegralWeakForm()
The classical weak form volume integral type for DG methods as explained in standard textbooks.
References
- Kopriva (2009) Implementing Spectral Methods for Partial Differential Equations: Algorithms for Scientists and Engineers doi: 10.1007/978-90-481-2261-5
- Hesthaven, Warburton (2007) Nodal Discontinuous Galerkin Methods: Algorithms, Analysis, and Applications doi: 10.1007/978-0-387-72067-8
VolumeIntegralWeakForm()
is only implemented for conserved terms as non-conservative terms should always be discretized in conjunction with a flux-splitting scheme, see VolumeIntegralFluxDifferencing
. This treatment is required to achieve, e.g., entropy-stability or well-balancedness.
Base.getindex
— MethodBase.getindex(pd::AbstractPlotData, variable_name)
Extract a single variable variable_name
from pd
for plotting with Plots.plot
.
This is an experimental feature and may change in future releases.
Base.resize!
— Methodresize!(c::AbstractContainer, new_length) -> AbstractContainer
Resize c
to contain new_length
elements. If new_length
is smaller than the current container length, the first new_length
elements will be retained. If new_length
is larger, the new elements are invalidated.
PolynomialBases.compute_coefficients!
— Methodcompute_coefficients!(u_ode, func, t, semi::AbstractSemidiscretization)
Same as compute_coefficients
but stores the result in u_ode
.
PolynomialBases.compute_coefficients
— Methodcompute_coefficients(func, t, semi::AbstractSemidiscretization)
Compute the discrete coefficients of the continuous function func
at time t
associated with the semidiscretization semi
. For example, the discrete coefficients of func
for a discontinuous Galerkin spectral element method (DGSEM
) are the values of func
at the Lobatto-Legendre nodes. Similarly, a classical finite difference method will use the values of func
at the nodes of the grid assoociated with the semidiscretization semi
.
For semidiscretizations semi
associated with an initial condition, func
can be omitted to use the given initial condition at time t
.
PolynomialBases.integrate
— Methodintegrate(f, u, basis::LobattoLegendreBasis)
Map the function f
to the coefficients u
and integrate with respect to the quadrature rule given by basis
.
PolynomialBases.integrate
— Methodintegrate([func=(u_node,equations)->u_node,] u_ode, semi::AbstractSemidiscretization; normalize=true)
Call func(u_node, equations)
for each vector of nodal variables u_node
in u_ode
and integrate the result using a quadrature associated with the semidiscretization semi
.
If normalize
is true, the result is divided by the total volume of the computational domain.
SciMLBase.add_tstop!
— Methodadd_tstop!(integrator::AbstractPairedExplicitRKIntegrator, t)
Add a time stop during the time integration process. This function is called after the periodic SaveSolutionCallback to specify the next stop to save the solution.
SciMLBase.add_tstop!
— Methodadd_tstop!(integrator::SimpleIntegratorSSP, t)
Add a time stop during the time integration process. This function is called after the periodic SaveSolutionCallback to specify the next stop to save the solution.
SummationByPartsOperators.semidiscretize
— Methodsemidiscretize(semi::SemidiscretizationHyperbolicParabolic, tspan)
Wrap the semidiscretization semi
as a split ODE problem in the time interval tspan
that can be passed to solve
from the SciML ecosystem. The parabolic right-hand side is the first function of the split ODE problem and will be used by default by the implicit part of IMEX methods from the SciML ecosystem.
SummationByPartsOperators.semidiscretize
— Methodsemidiscretize(semi::AbstractSemidiscretization, tspan, restart_file::AbstractString)
Wrap the semidiscretization semi
as an ODE problem in the time interval tspan
that can be passed to solve
from the SciML ecosystem. The initial condition etc. is taken from the restart_file
.
SummationByPartsOperators.semidiscretize
— Methodsemidiscretize(semi::AbstractSemidiscretization, tspan)
Wrap the semidiscretization semi
as an ODE problem in the time interval tspan
that can be passed to solve
from the SciML ecosystem.
Trixi.DGMultiBasis
— MethodDGMultiBasis(element_type, polydeg; approximation_type = Polynomial(), kwargs...)
Constructs a basis for DGMulti solvers. Returns a "StartUpDG.RefElemData" object. The kwargs
arguments are additional keyword arguments for RefElemData
, such as quad_rule_vol
. These are the same as the RefElemData_kwargs
used in DGMulti
. For more info, see the StartUpDG.jl docs.
Trixi.LBMCollisionCallback
— MethodLBMCollisionCallback()
Apply the Lattice-Boltzmann method (LBM) collision operator before each time step. See LatticeBoltzmannEquations2D
for further details.
Trixi.P4estMeshCubedSphere
— MethodP4estMeshCubedSphere(trees_per_face_dimension, layers, inner_radius, thickness;
polydeg, RealT=Float64,
initial_refinement_level=0, unsaved_changes=true,
p4est_partition_allow_for_coarsening=true)
Build a "Cubed Sphere" mesh as P4estMesh
with 6 * trees_per_face_dimension^2 * layers
trees.
The mesh will have two boundaries, :inside
and :outside
.
Arguments
trees_per_face_dimension::Integer
: the number of trees in the first two local dimensions of each face.layers::Integer
: the number of trees in the third local dimension of each face, i.e., the number of layers of the sphere.inner_radius::Integer
: the inner radius of the sphere.thickness::Integer
: the thickness of the sphere. The outer radius will beinner_radius + thickness
.polydeg::Integer
: polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree.RealT::Type
: the type that should be used for coordinates.initial_refinement_level::Integer
: refine the mesh uniformly to this level before the simulation starts.unsaved_changes::Bool
: if set totrue
, the mesh will be saved to a mesh file.p4est_partition_allow_for_coarsening::Bool
: Must betrue
when using AMR to make mesh adaptivity independent of domain partitioning. Should befalse
for static meshes to permit more fine-grained partitioning.
Trixi.PlotData2D
— MethodPlotData2D(u, semi [or mesh, equations, solver, cache];
solution_variables=nothing,
grid_lines=true, max_supported_level=11, nvisnodes=nothing,
slice=:xy, point=(0.0, 0.0, 0.0))
Create a new PlotData2D
object that can be used for visualizing 2D/3D DGSEM solution data array u
with Plots.jl
. All relevant geometrical information is extracted from the semidiscretization semi
. By default, the primitive variables (if existent) or the conservative variables (otherwise) from the solution are used for plotting. This can be changed by passing an appropriate conversion function to solution_variables
.
If grid_lines
is true
, also extract grid vertices for visualizing the mesh. The output resolution is indirectly set via max_supported_level
: all data is interpolated to 2^max_supported_level
uniformly distributed points in each spatial direction, also setting the maximum allowed refinement level in the solution. nvisnodes
specifies the number of visualization nodes to be used. If it is nothing
, twice the number of solution DG nodes are used for visualization, and if set to 0
, exactly the number of nodes in the DG elements are used.
When visualizing data from a three-dimensional simulation, a 2D slice is extracted for plotting. slice
specifies the plane that is being sliced and may be :xy
, :xz
, or :yz
. The slice position is specified by a point
that lies on it, which defaults to (0.0, 0.0, 0.0)
. Both of these values are ignored when visualizing 2D data.
This is an experimental feature and may change in future releases.
Examples
julia> using Trixi, Plots
julia> trixi_include(default_example())
[...]
julia> pd = PlotData2D(sol)
PlotData2D(...)
julia> plot(pd) # To plot all available variables
julia> plot(pd["scalar"]) # To plot only a single variable
julia> plot!(getmesh(pd)) # To add grid lines to the plot
Trixi.PlotData2D
— MethodPlotData2D(sol; kwargs...)
Create a PlotData2D
object from a solution object created by either OrdinaryDiffEq.solve!
(which returns a SciMLBase.ODESolution
) or Trixi.jl's own solve!
(which returns a TimeIntegratorSolution
).
This is an experimental feature and may change in future releases.
Trixi.ScalarPlotData2D
— MethodScalarPlotData2D(u, semi::AbstractSemidiscretization; kwargs...)
Returns an PlotData2DTriangulated
object which is used to visualize a single scalar field. u
should be an array whose entries correspond to values of the scalar field at nodal points.
Trixi.SummaryCallback
— FunctionSummaryCallback()
Create and return a callback that prints a human-readable summary of the simulation setup at the beginning of a simulation and then resets the timer. When the returned callback is executed directly, the current timer values are shown.
Trixi.TrivialCallback
— MethodTrivialCallback()
A callback that does nothing. This can be useful to disable some callbacks easily via trixi_include
.
Trixi.adapt!
— MethodTrixi.adapt!(mesh::T8codeMesh, adapt_callback; kwargs...)
Adapt a T8codeMesh
according to a user-defined adapt_callback
.
Arguments
mesh::T8codeMesh
: Initialized mesh object.adapt_callback
: A user-defined callback which tells the adaption routines if an element should be refined, coarsened or stay unchanged.The expected callback signature is as follows:
`adapt_callback(forest, ltreeid, eclass_scheme, lelemntid, elements, is_family, user_data)` # Arguments - `forest`: Pointer to the analyzed forest. - `ltreeid`: Local index of the current tree where the analyzed elements are part of. - `eclass_scheme`: Element class of `elements`. - `lelemntid`: Local index of the first element in `elements`. - `elements`: Array of elements. If consecutive elements form a family they are passed together, otherwise `elements` consists of just one element. - `is_family`: Boolean signifying if `elements` represents a family or not. - `user_data`: Void pointer to some arbitrary user data. Default value is `C_NULL`. # Returns -1 : Coarsen family of elements. 0 : Stay unchanged. 1 : Refine element.
kwargs
:recursive = true
: Adapt the forest recursively. If true the caller must ensure that the callback returns 0 for every analyzed element at some point to stop the recursion.balance = true
: Make sure the adapted forest is 2^(NDIMS-1):1 balanced.partition = true
: Partition the forest to redistribute elements evenly among MPI ranks.ghost = true
: Create a ghost layer for MPI data exchange.user_data = C_NULL
: Pointer to some arbitrary user-defined data.
Trixi.adapt_to_mesh_level!
— Methodadapt_to_mesh_level!(u_ode, semi, level)
adapt_to_mesh_level!(sol::Trixi.TrixiODESolution, level)
Like adapt_to_mesh_level
, but modifies the solution and parts of the semidiscretization (mesh and caches) in place.
Trixi.adapt_to_mesh_level
— Methodadapt_to_mesh_level(u_ode, semi, level)
adapt_to_mesh_level(sol::Trixi.TrixiODESolution, level)
Use the regular adaptive mesh refinement routines to adaptively refine/coarsen the solution u_ode
with semidiscretization semi
towards a uniformly refined grid with refinement level level
. The solution and semidiscretization are copied such that the original objects remain unaltered.
A convenience method accepts an ODE solution object, from which solution and semidiscretization are extracted as needed.
See also: adapt_to_mesh_level!
Trixi.balance!
— MethodTrixi.balance!(mesh::T8codeMesh)
Balance a T8codeMesh
to ensure 2^(NDIMS-1):1 face neighbors.
Trixi.barycentric_weights
— Methodbarycentric_weights(nodes)
Calculate the barycentric weights for a given node distribution, i.e.,
\[w_j = \frac{1}{ \prod_{k \neq j} \left( x_j - x_k \right ) }\]
For details, see (especially Section 3)
- Jean-Paul Berrut and Lloyd N. Trefethen (2004). Barycentric Lagrange Interpolation. DOI:10.1137/S0036144502417715
Trixi.boundary_condition_linear_x
— Methodboundary_condition_linear_x(u_inner, orientation, direction, x, t,
surface_flux_function,
equation::LinearScalarAdvectionEquation1D)
Boundary conditions for initial_condition_linear_x
.
Trixi.boundary_condition_linear_x
— Methodboundary_condition_linear_x(u_inner, orientation, direction, x, t,
surface_flux_function,
equation::LinearScalarAdvectionEquation2D)
Boundary conditions for initial_condition_linear_x
.
Trixi.boundary_condition_linear_x_y
— Methodboundary_condition_linear_x_y(u_inner, orientation, direction, x, t,
surface_flux_function,
equation::LinearScalarAdvectionEquation2D)
Boundary conditions for initial_condition_linear_x_y
.
Trixi.boundary_condition_linear_y
— Methodboundary_condition_linear_y(u_inner, orientation, direction, x, t,
surface_flux_function,
equation::LinearScalarAdvectionEquation2D)
Boundary conditions for initial_condition_linear_y
.
Trixi.boundary_condition_linear_z
— Methodboundary_condition_linear_z(u_inner, orientation, direction, x, t,
surface_flux_function,
equation::LinearScalarAdvectionEquation1D)
Boundary conditions for boundary_condition_linear_z
.
Trixi.boundary_condition_noslip_wall
— Methodboundary_condition_noslip_wall(u_inner, orientation, direction, x, t,
surface_flux_function,
equations::LatticeBoltzmannEquations2D)
No-slip wall boundary condition using the bounce-back approach.
Trixi.boundary_condition_poisson_nonperiodic
— Methodboundary_condition_poisson_nonperiodic(u_inner, orientation, direction, x, t,
surface_flux_function,
equations::HyperbolicDiffusionEquations1D)
Boundary conditions used for convergence tests in combination with initial_condition_poisson_nonperiodic
and source_terms_poisson_nonperiodic
.
Trixi.boundary_condition_slip_wall
— Methodboundary_condition_slip_wall(u_inner, normal_direction, x, t, surface_flux_function,
equations::AcousticPerturbationEquations2D)
Use an orthogonal projection of the perturbed velocities to zero out the normal velocity while retaining the possibility of a tangential velocity in the boundary state. Further details are available in the paper:
- Marcus Bauer, Jürgen Dierke and Roland Ewert (2011) Application of a discontinuous Galerkin method to discretize acoustic perturbation equations DOI: 10.2514/1.J050333
Trixi.boundary_condition_slip_wall
— Methodboundary_condition_slip_wall(u_inner, normal_direction, direction, x, t,
surface_flux_function, equations::CompressibleEulerEquations2D)
Should be used together with StructuredMesh
.
Trixi.boundary_condition_slip_wall
— Methodboundary_condition_slip_wall(u_inner, normal_direction, direction, x, t,
surface_flux_function, equations::CompressibleEulerEquations3D)
Should be used together with StructuredMesh
.
Trixi.boundary_condition_slip_wall
— Methodboundary_condition_slip_wall(u_inner, normal_direction, x, t, surface_flux_function,
equations::CompressibleEulerEquations2D)
Determine the boundary numerical surface flux for a slip wall condition. Imposes a zero normal velocity at the wall. Density is taken from the internal solution state and pressure is computed as an exact solution of a 1D Riemann problem. Further details about this boundary state are available in the paper:
- J. J. W. van der Vegt and H. van der Ven (2002) Slip flow boundary conditions in discontinuous Galerkin discretizations of the Euler equations of gas dynamics PDF
Details about the 1D pressure Riemann solution can be found in Section 6.3.3 of the book
- Eleuterio F. Toro (2009) Riemann Solvers and Numerical Methods for Fluid Dynamics: A Practical Introduction 3rd edition DOI: 10.1007/b79761
Should be used together with UnstructuredMesh2D
.
Trixi.boundary_condition_slip_wall
— Methodboundary_condition_slip_wall(u_inner, normal_direction, x, t, surface_flux_function,
equations::CompressibleEulerEquations3D)
Determine the boundary numerical surface flux for a slip wall condition. Imposes a zero normal velocity at the wall. Density is taken from the internal solution state and pressure is computed as an exact solution of a 1D Riemann problem. Further details about this boundary state are available in the paper:
- J. J. W. van der Vegt and H. van der Ven (2002) Slip flow boundary conditions in discontinuous Galerkin discretizations of the Euler equations of gas dynamics PDF
Details about the 1D pressure Riemann solution can be found in Section 6.3.3 of the book
- Eleuterio F. Toro (2009) Riemann Solvers and Numerical Methods for Fluid Dynamics: A Practical Introduction 3rd edition DOI: 10.1007/b79761
Trixi.boundary_condition_slip_wall
— Methodboundary_condition_slip_wall(u_inner, normal_direction, x, t, surface_flux_function,
equations::ShallowWaterEquations2D)
Create a boundary state by reflecting the normal velocity component and keep the tangential velocity component unchanged. The boundary water height is taken from the internal value. For details see Section 9.2.5 of the book:
- Eleuterio F. Toro (2001) Shock-Capturing Methods for Free-Surface Shallow Flows 1st edition ISBN 0471987662
Trixi.boundary_condition_slip_wall
— Methodboundary_condition_slip_wall(u_inner, orientation, direction, x, t,
surface_flux_function, equations::CompressibleEulerEquations1D)
Determine the boundary numerical surface flux for a slip wall condition. Imposes a zero normal velocity at the wall. Density is taken from the internal solution state and pressure is computed as an exact solution of a 1D Riemann problem. Further details about this boundary state are available in the paper:
Trixi.boundary_condition_slip_wall
— Methodboundary_condition_slip_wall(u_inner, orientation, direction, x, t,
surface_flux_function, equations::CompressibleEulerEquations2D)
Should be used together with TreeMesh
.
Trixi.boundary_condition_slip_wall
— Methodboundary_condition_slip_wall(u_inner, orientation, direction, x, t,
surface_flux_function, equations::CompressibleEulerEquations3D)
Should be used together with TreeMesh
.
Trixi.boundary_condition_slip_wall
— Methodboundary_condition_slip_wall(u_inner, orientation_or_normal, x, t, surface_flux_function,
equations::ShallowWaterEquations1D)
Create a boundary state by reflecting the normal velocity component and keep the tangential velocity component unchanged. The boundary water height is taken from the internal value.
For details see Section 9.2.5 of the book:
- Eleuterio F. Toro (2001) Shock-Capturing Methods for Free-Surface Shallow Flows 1st edition ISBN 0471987662
Trixi.boundary_condition_slip_wall
— Methodboundary_condition_slip_wall(u_inner, orientation, direction, x, t,
surface_flux_function, equations::ShallowWaterEquations2D)
Should be used together with TreeMesh
.
Trixi.boundary_condition_wall
— Methodboundary_condition_wall(u_inner, orientation, direction, x, t, surface_flux_function,
equations::AcousticPerturbationEquations2D)
Boundary conditions for a solid wall.
Trixi.boundary_condition_wall
— Methodboundary_condition_wall(u_inner, orientation, direction, x, t, surface_flux_function,
equations::LinearizedEulerEquations1D)
Boundary conditions for a solid wall.
Trixi.boundary_condition_wall
— Methodboundary_condition_wall(u_inner, orientation, direction, x, t, surface_flux_function,
equations::LinearizedEulerEquations2D)
Boundary conditions for a solid wall.
Trixi.boundary_condition_wall
— Methodboundary_condition_wall(u_inner, orientation, direction, x, t, surface_flux_function,
equations::LinearizedEulerEquations3D)
Boundary conditions for a solid wall.
Trixi.calc_error_norms
— Methodcalc_error_norms([func=(u_node,equations)->u_node,] u_ode, t, analyzer, semi::AbstractSemidiscretization, cache_analysis)
Calculate discrete L2 and L∞ error norms of func
applied to each nodal variable u_node
in u_ode
. If no exact solution is available, "errors" are calculated using some reference state and can be useful for regression tests.
Trixi.calc_fast_wavespeed_roe
— Methodcalc_fast_wavespeed_roe(u_ll, u_rr, direction, equations::IdealGlmMhdEquations1D)
Compute the fast magnetoacoustic wave speed using Roe averages as given by
- Cargo and Gallice (1997) Roe Matrices for Ideal MHD and Systematic Construction of Roe Matrices for Systems of Conservation Laws DOI: 10.1006/jcph.1997.5773
Trixi.calc_fast_wavespeed_roe
— Methodcalc_fast_wavespeed_roe(u_ll, u_rr, orientation_or_normal_direction, equations::IdealGlmMhdEquations2D)
Compute the fast magnetoacoustic wave speed using Roe averages as given by
- Cargo and Gallice (1997) Roe Matrices for Ideal MHD and Systematic Construction of Roe Matrices for Systems of Conservation Laws DOI: 10.1006/jcph.1997.5773
Trixi.calc_fast_wavespeed_roe
— Methodcalc_fast_wavespeed_roe(u_ll, u_rr, orientation_or_normal_direction, equations::IdealGlmMhdEquations3D)
Compute the fast magnetoacoustic wave speed using Roe averages as given by
- Cargo and Gallice (1997) Roe Matrices for Ideal MHD and Systematic Construction of Roe Matrices for Systems of Conservation Laws DOI: 10.1006/jcph.1997.5773
Trixi.calc_wavespeed_roe
— Methodcalc_wavespeed_roe(u_ll, u_rr, direction::Integer,
equations::ShallowWaterEquations1D)
Calculate Roe-averaged velocity v_roe
and wavespeed c_roe = sqrt{g * h_roe}
See for instance equation (62) in
- Paul A. Ullrich, Christiane Jablonowski, and Bram van Leer (2010) High-order finite-volume methods for the shallow-water equations on the sphere DOI: 10.1016/j.jcp.2010.04.044
Or equation (9.17) in this lecture notes.
Trixi.calc_wavespeed_roe
— Methodcalc_wavespeed_roe(u_ll, u_rr, direction::Integer,
equations::ShallowWaterEquations2D)
Calculate Roe-averaged velocity v_roe
and wavespeed c_roe = sqrt{g * h_roe}
depending on direction. See for instance equation (62) in
- Paul A. Ullrich, Christiane Jablonowski, and Bram van Leer (2010) High-order finite-volume methods for the shallow-water equations on the sphere DOI: 10.1016/j.jcp.2010.04.044
Or this slides, slides 8 and 9.
Trixi.calculate_cfl
— Methodcalculate_cfl(ode_algorithm::AbstractPairedExplicitRK, ode)
This function computes the CFL number once using the initial condition of the problem and the optimal timestep (dt_opt
) from the ODE algorithm.
Trixi.collision_bgk
— Methodcollision_bgk(u, dt, equations::LatticeBoltzmannEquations2D)
Collision operator for the Bhatnagar, Gross, and Krook (BGK) model.
Trixi.collision_bgk
— Methodcollision_bgk(u, dt, equations::LatticeBoltzmannEquations3D)
Collision operator for the Bhatnagar, Gross, and Krook (BGK) model.
Trixi.cons2cons
— Methodcons2cons(u, equations)
Return the conserved variables u
. While this function is as trivial as identity
, it is also as useful.
Trixi.cons2entropy
— Functioncons2entropy(u, equations)
Convert the conserved variables u
to the entropy variables for a given set of equations
with chosen standard entropy
.
u
is a vector type of the correct length nvariables(equations)
. Notice the function doesn't include any error checks for the purpose of efficiency, so please make sure your input is correct. The inverse conversion is performed by entropy2cons
.
Trixi.cons2prim
— Functioncons2prim(u, equations)
Convert the conserved variables u
to the primitive variables for a given set of equations
. u
is a vector type of the correct length nvariables(equations)
. Notice the function doesn't include any error checks for the purpose of efficiency, so please make sure your input is correct. The inverse conversion is performed by prim2cons
.
Trixi.convergence_test
— Methodconvergence_test([mod::Module=Main,] elixir::AbstractString, iterations; kwargs...)
Run iterations
Trixi.jl simulations using the setup given in elixir
and compute the experimental order of convergence (EOC) in the $L^2$ and $L^\infty$ norm. In each iteration, the resolution of the respective mesh will be doubled. Additional keyword arguments kwargs...
and the optional module mod
are passed directly to trixi_include
.
This function assumes that the spatial resolution is set via the keywords initial_refinement_level
(an integer) or cells_per_dimension
(a tuple of integers, one per spatial dimension).
Trixi.default_analysis_errors
— Methoddefault_analysis_errors(equations)
Default analysis errors (:l2_error
and :linf_error
) used by the AnalysisCallback
.
Trixi.default_analysis_integrals
— Methoddefault_analysis_integrals(equations)
Default analysis integrals used by the AnalysisCallback
.
Trixi.default_example
— Methoddefault_example()
Return the path to an example elixir that can be used to quickly see Trixi.jl in action on a TreeMesh
. See also examples_dir
and get_examples
.
Trixi.default_example_unstructured
— Methoddefault_example_unstructured()
Return the path to an example elixir that can be used to quickly see Trixi.jl in action on an UnstructuredMesh2D
. This simulation is run on the example curved, unstructured mesh given in the Trixi.jl documentation regarding unstructured meshes.
Trixi.density
— Methoddensity(p::Real, equations::LatticeBoltzmannEquations2D)
density(u, equations::LatticeBoltzmannEquations2D)
Calculate the macroscopic density from the pressure p
or the particle distribution functions u
.
Trixi.density
— Methoddensity(p::Real, equations::LatticeBoltzmannEquations3D)
density(u, equations::LatticeBoltzmannEquations3D)
Calculate the macroscopic density from the pressure p
or the particle distribution functions u
.
Trixi.download
— MethodTrixi.download(src_url, file_path)
Download a file from given src_url
to given file_path
if file_path
is not already a file. This function just returns file_path
. This is a small wrapper of Downloads.download(src_url, file_path)
that avoids race conditions when multiple MPI ranks are used.
Trixi.dynamic_viscosity
— Methoddynamic_viscosity(u, equations)
Wrapper for the dynamic viscosity that calls dynamic_viscosity(u, equations.mu, equations)
, which dispatches on the type of equations.mu
. For constant equations.mu
, i.e., equations.mu
is of Real
-type it is returned directly. In all other cases, equations.mu
is assumed to be a function with arguments u
and equations
and is called with these arguments.
Trixi.each_dof_global
— Methodeach_dof_global(mesh::DGMultiMesh, dg::DGMulti, other_args...)
Return an iterator over the indices that specify the location in relevant data structures for the degrees of freedom (DOF) in dg
. In particular, not the DOFs themselves are returned.
Trixi.each_face_node
— Methodeach_face_node(mesh::DGMultiMesh, dg::DGMulti, other_args...)
Return an iterator over the indices that specify the location in relevant data structures for the face nodes in dg
. In particular, not the face_nodes themselves are returned.
Trixi.each_face_node_global
— Methodeach_face_node_global(mesh::DGMultiMesh, dg::DGMulti, other_args...)
Return an iterator over the indices that specify the location in relevant data structures for the face nodes in mesh
. In particular, not the face nodes themselves are returned.
Trixi.each_quad_node
— Methodeach_quad_node(mesh::DGMultiMesh, dg::DGMulti, other_args...)
Return an iterator over the indices that specify the location in relevant data structures for the quadrature nodes in dg
. In particular, not the quadrature nodes themselves are returned.
Trixi.each_quad_node_global
— Methodeach_quad_node_global(mesh::DGMultiMesh, dg::DGMulti, other_args...)
Return an iterator over the indices that specify the location in relevant data structures for the global quadrature nodes in mesh
. In particular, not the quadrature nodes themselves are returned.
Trixi.eachboundary
— Methodeachboundary(dg::DG, cache)
Return an iterator over the indices that specify the location in relevant data structures for the boundaries in cache
. In particular, not the boundaries themselves are returned.
Trixi.eachcomponent
— Methodeachcomponent(equations::AbstractCompressibleEulerMulticomponentEquations)
Return an iterator over the indices that specify the location in relevant data structures for the components in AbstractCompressibleEulerMulticomponentEquations
. In particular, not the components themselves are returned.
Trixi.eachcomponent
— Methodeachcomponent(equations::AbstractIdealGlmMhdMulticomponentEquations)
Return an iterator over the indices that specify the location in relevant data structures for the components in AbstractIdealGlmMhdMulticomponentEquations
. In particular, not the components themselves are returned.
Trixi.eachdim
— Methodeachdim(mesh)
Return an iterator over the indices that specify the location in relevant data structures for the dimensions in AbstractTree
. In particular, not the dimensions themselves are returned.
Trixi.eachdirection
— Methodeachdirection(tree::AbstractTree)
Return an iterator over the indices that specify the location in relevant data structures for the directions in AbstractTree
. In particular, not the directions themselves are returned.
Trixi.eachelement
— Methodeachelement(dg::DG, cache)
Return an iterator over the indices that specify the location in relevant data structures for the elements in cache
. In particular, not the elements themselves are returned.
Trixi.eachelement
— Methodeachelement(mesh::DGMultiMesh, dg::DGMulti, other_args...)
Return an iterator over the indices that specify the location in relevant data structures for the elements in mesh
. In particular, not the elements themselves are returned.
Trixi.eachelement
— Methodeachelement(elements::ElementContainer1D)
Return an iterator over the indices that specify the location in relevant data structures for the elements in elements
. In particular, not the elements themselves are returned.
Trixi.eachelement
— Methodeachelement(elements::ElementContainer2D)
Return an iterator over the indices that specify the location in relevant data structures for the elements in elements
. In particular, not the elements themselves are returned.
Trixi.eachelement
— Methodeachelement(elements::ElementContainer3D)
Return an iterator over the indices that specify the location in relevant data structures for the elements in elements
. In particular, not the elements themselves are returned.
Trixi.eachelement
— Methodeachelement(elements::UnstructuredElementContainer2D)
Return an iterator over the indices that specify the location in relevant data structures for the elements in elements
. In particular, not the elements themselves are returned.
Trixi.eachinterface
— Methodeachinterface(dg::DG, cache)
Return an iterator over the indices that specify the location in relevant data structures for the interfaces in cache
. In particular, not the interfaces themselves are returned.
Trixi.eachmortar
— Methodeachmortar(dg::DG, cache)
Return an iterator over the indices that specify the location in relevant data structures for the mortars in cache
. In particular, not the mortars themselves are returned.
Trixi.eachmpiinterface
— Methodeachmpiinterface(dg::DG, cache)
Return an iterator over the indices that specify the location in relevant data structures for the MPI interfaces in cache
. In particular, not the interfaces themselves are returned.
Trixi.eachmpimortar
— Methodeachmpimortar(dg::DG, cache)
Return an iterator over the indices that specify the location in relevant data structures for the MPI mortars in cache
. In particular, not the mortars themselves are returned.
Trixi.eachnode
— Methodeachnode(dg::DG)
Return an iterator over the indices that specify the location in relevant data structures for the nodes in dg
. In particular, not the nodes themselves are returned.
Trixi.eachnode
— Methodeachnode(basis::LobattoLegendreBasis)
Return an iterator over the indices that specify the location in relevant data structures for the nodes in basis
. In particular, not the nodes themselves are returned.
Trixi.eachnode
— Methodeachnode(analyzer::LobattoLegendreAnalyzer)
Return an iterator over the indices that specify the location in relevant data structures for the nodes in analyzer
. In particular, not the nodes themselves are returned.
Trixi.eachvariable
— Methodeachvariable(equations::AbstractEquations)
Return an iterator over the indices that specify the location in relevant data structures for the variables in equations
. In particular, not the variables themselves are returned.
Trixi.energy_internal
— Functionenergy_internal(u, equations)
Return the internal energy of the conserved variables u
for a given set of equations
, e.g., the CompressibleEulerEquations2D
.
u
is a vector of the conserved variables at a single node, i.e., a vector of the correct length nvariables(equations)
.
Trixi.energy_kinetic
— Functionenergy_kinetic(u, equations)
Return the kinetic energy of the conserved variables u
for a given set of equations
, e.g., the CompressibleEulerEquations2D
.
u
is a vector of the conserved variables at a single node, i.e., a vector of the correct length nvariables(equations)
.
Trixi.energy_total
— Functionenergy_total(u, equations)
Return the total energy of the conserved variables u
for a given set of equations
, e.g., the CompressibleEulerEquations2D
.
u
is a vector of the conserved variables at a single node, i.e., a vector of the correct length nvariables(equations)
.
Trixi.entropy
— Functionentropy(u, equations)
Return the chosen entropy of the conserved variables u
for a given set of equations
.
u
is a vector of the conserved variables at a single node, i.e., a vector of the correct length nvariables(equations)
.
Trixi.entropy2cons
— Functionentropy2cons(w, equations)
Convert the entropy variables w
based on a standard entropy
to the conserved variables for a given set of equations
. u
is a vector type of the correct length nvariables(equations)
. Notice the function doesn't include any error checks for the purpose of efficiency, so please make sure your input is correct. The inverse conversion is performed by cons2entropy
.
Trixi.entropy_guermond_etal
— Methodentropy_guermond_etal(u, equations::CompressibleEulerEquations2D)
Calculate the modified specific entropy of Guermond et al. (2019):
\[s_0 = p * \rho^{-\gamma} / (\gamma-1).\]
Note: This is not the "conventional" specific entropy $s = ln(p / \rho^\gamma)$.
- Guermond at al. (2019) Invariant domain preserving discretization-independent schemes and convex limiting for hyperbolic systems. DOI: 10.1016/j.cma.2018.11.036
Trixi.equilibrium_distribution
— Methodequilibrium_distribution(alpha, rho, v1, v2, v3, equations::LatticeBoltzmannEquations3D)
Calculate the local equilibrium distribution for the distribution function with index alpha
and given the macroscopic state defined by rho
, v1
, v2
, v3
.
Trixi.equilibrium_distribution
— Methodequilibrium_distribution(alpha, rho, v1, v2, equations::LatticeBoltzmannEquations2D)
Calculate the local equilibrium distribution for the distribution function with index alpha
and given the macroscopic state defined by rho
, v1
, v2
.
Trixi.examples_dir
— Methodexamples_dir()
Return the directory where the example files provided with Trixi.jl are located. If Trixi.jl is installed as a regular package (with ]add Trixi
), these files are read-only and should not be modified. To find out which files are available, use, e.g., readdir
:
Examples
readdir(examples_dir())
Trixi.flux
— Functionflux(u, orientation_or_normal, equations)
Given the conservative variables u
, calculate the (physical) flux in Cartesian direction orientation::Integer
or in arbitrary direction normal::AbstractVector
for the corresponding set of governing equations
. orientation
is 1
, 2
, and 3
for the x-, y-, and z-directions, respectively.
Trixi.flux
— Methodflux(u, normal_direction::AbstractVector, equations::AbstractEquations{1})
Enables calling flux
with a non-integer argument normal_direction
for one-dimensional equations. Returns the value of flux(u, 1, equations)
scaled by normal_direction[1]
.
Trixi.flux_central
— Methodflux_central(u_ll, u_rr, orientation_or_normal_direction, equations::AbstractEquations)
The classical central numerical flux f((u_ll) + f(u_rr)) / 2
. When this flux is used as volume flux, the discretization is equivalent to the classical weak form DG method (except floating point errors).
Trixi.flux_chan_etal
— Method@inline function fluxchanetal(ull, urr, orientation::Integer, equations::CompressibleEulerEquationsQuasi1D)
Conservative (symmetric) part of the entropy conservative flux for quasi 1D compressible Euler equations split form. This flux is a generalization of flux_ranocha
for CompressibleEulerEquations1D
. Further details are available in the paper:
- Jesse Chan, Khemraj Shukla, Xinhui Wu, Ruofeng Liu, Prani Nalluri (2023) High order entropy stable schemes for the quasi-one-dimensional shallow water and compressible Euler equations DOI: 10.48550/arXiv.2307.12089
Trixi.flux_chan_etal
— Methodflux_chan_etal(u_ll, u_rr, orientation,
equations::ShallowWaterEquationsQuasi1D)
Total energy conservative (mathematical entropy for quasi 1D shallow water equations) split form. When the bottom topography is nonzero this scheme will be well-balanced when used as a volume_flux
. The surface_flux
should still use, e.g., FluxPlusDissipation(flux_chan_etal, DissipationLocalLaxFriedrichs())
.
Further details are available in the paper:
- Jesse Chan, Khemraj Shukla, Xinhui Wu, Ruofeng Liu, Prani Nalluri (2023) High order entropy stable schemes for the quasi-one-dimensional shallow water and compressible Euler equations DOI: 10.48550/arXiv.2307.12089
Trixi.flux_chandrashekar
— Methodflux_chandrashekar(u_ll, u_rr, orientation, equations::CompressibleEulerEquations1D)
Entropy conserving two-point flux by
- Chandrashekar (2013) Kinetic Energy Preserving and Entropy Stable Finite Volume Schemes for Compressible Euler and Navier-Stokes Equations DOI: 10.4208/cicp.170712.010313a
Trixi.flux_chandrashekar
— Methodflux_chandrashekar(u_ll, u_rr, orientation_or_normal_direction, equations::CompressibleEulerEquations2D)
Entropy conserving two-point flux by
- Chandrashekar (2013) Kinetic Energy Preserving and Entropy Stable Finite Volume Schemes for Compressible Euler and Navier-Stokes Equations DOI: 10.4208/cicp.170712.010313a
Trixi.flux_chandrashekar
— Methodflux_chandrashekar(u_ll, u_rr, orientation_or_normal_direction, equations::CompressibleEulerEquations3D)
Entropy conserving two-point flux by
- Chandrashekar (2013) Kinetic Energy Preserving and Entropy Stable Finite Volume Schemes for Compressible Euler and Navier-Stokes Equations DOI: 10.4208/cicp.170712.010313a
Trixi.flux_chandrashekar
— Methodflux_chandrashekar(u_ll, u_rr, orientation, equations::CompressibleEulerMulticomponentEquations1D)
Entropy conserving two-point flux by
- Ayoub Gouasmi, Karthik Duraisamy (2020) "Formulation of Entropy-Stable schemes for the multicomponent compressible Euler equations" arXiv:1904.00972v3 [math.NA] 4 Feb 2020
Trixi.flux_chandrashekar
— Methodflux_chandrashekar(u_ll, u_rr, orientation, equations::CompressibleEulerMulticomponentEquations2D)
Adaption of the entropy conserving two-point flux by
- Ayoub Gouasmi, Karthik Duraisamy (2020) "Formulation of Entropy-Stable schemes for the multicomponent compressible Euler equations" arXiv:1904.00972v3 [math.NA] 4 Feb 2020
Trixi.flux_derigs_etal
— Methodflux_derigs_etal(u_ll, u_rr, orientation, equations::IdealGlmMhdEquations1D)
Entropy conserving two-point flux by
- Derigs et al. (2018) Ideal GLM-MHD: About the entropy consistent nine-wave magnetic field divergence diminishing ideal magnetohydrodynamics equations DOI: 10.1016/j.jcp.2018.03.002
Trixi.flux_derigs_etal
— Methodflux_derigs_etal(u_ll, u_rr, orientation, equations::IdealGlmMhdEquations2D)
Entropy conserving two-point flux by
- Derigs et al. (2018) Ideal GLM-MHD: About the entropy consistent nine-wave magnetic field divergence diminishing ideal magnetohydrodynamics equations DOI: 10.1016/j.jcp.2018.03.002
Trixi.flux_derigs_etal
— Methodflux_derigs_etal(u_ll, u_rr, orientation, equations::IdealGlmMhdEquations3D)
Entropy conserving two-point flux by
- Derigs et al. (2018) Ideal GLM-MHD: About the entropy consistent nine-wave magnetic field divergence diminishing ideal magnetohydrodynamics equations DOI: 10.1016/j.jcp.2018.03.002
Trixi.flux_derigs_etal
— Methodflux_derigs_etal(u_ll, u_rr, orientation, equations::IdealGlmMhdEquations1D)
Entropy conserving two-point flux adapted by
- Derigs et al. (2018) Ideal GLM-MHD: About the entropy consistent nine-wave magnetic field divergence diminishing ideal magnetohydrodynamics equations for multicomponent DOI: 10.1016/j.jcp.2018.03.002
Trixi.flux_derigs_etal
— Methodflux_derigs_etal(u_ll, u_rr, orientation, equations::IdealGlmMhdMulticomponentEquations2D)
Entropy conserving two-point flux adapted by
- Derigs et al. (2018) Ideal GLM-MHD: About the entropy consistent nine-wave magnetic field divergence diminishing ideal magnetohydrodynamics equations for multicomponent DOI: 10.1016/j.jcp.2018.03.002
Trixi.flux_fjordholm_etal
— Methodflux_fjordholm_etal(u_ll, u_rr, orientation,
equations::ShallowWaterEquations1D)
Total energy conservative (mathematical entropy for shallow water equations). When the bottom topography is nonzero this should only be used as a surface flux otherwise the scheme will not be well-balanced. For well-balancedness in the volume flux use flux_wintermeyer_etal
.
Details are available in Eq. (4.1) in the paper:
- Ulrik S. Fjordholm, Siddhartha Mishr and Eitan Tadmor (2011) Well-balanced and energy stable schemes for the shallow water equations with discontinuous topography DOI: 10.1016/j.jcp.2011.03.042
Trixi.flux_fjordholm_etal
— Methodflux_fjordholm_etal(u_ll, u_rr, orientation_or_normal_direction,
equations::ShallowWaterEquations2D)
Total energy conservative (mathematical entropy for shallow water equations). When the bottom topography is nonzero this should only be used as a surface flux otherwise the scheme will not be well-balanced. For well-balancedness in the volume flux use flux_wintermeyer_etal
.
Details are available in Eq. (4.1) in the paper:
- Ulrik S. Fjordholm, Siddhartha Mishr and Eitan Tadmor (2011) Well-balanced and energy stable schemes for the shallow water equations with discontinuous topography DOI: 10.1016/j.jcp.2011.03.042
Trixi.flux_godunov
— Methodflux_godunov(u_ll, u_rr, orientation_or_normal_direction,
equations::LinearizedEulerEquations2D)
An upwind flux for the linearized Euler equations based on diagonalization of the physical flux matrix. Given the physical flux $Au$, $A=T \Lambda T^{-1}$ with $\Lambda$ being a diagonal matrix that holds the eigenvalues of $A$, decompose $\Lambda = \Lambda^+ + \Lambda^-$ where $\Lambda^+$ and $\Lambda^-$ are diagonal matrices holding the positive and negative eigenvalues of $A$, respectively. Then for left and right states $u_L, u_R$, the numerical flux calculated by this function is given by $A^+ u_L + A^- u_R$ where $A^{\pm} = T \Lambda^{\pm} T^{-1}$.
The diagonalization of the flux matrix can be found in
- R. F. Warming, Richard M. Beam and B. J. Hyett (1975) Diagonalization and simultaneous symmetrization of the gas-dynamic matrices DOI: 10.1090/S0025-5718-1975-0388967-5
Trixi.flux_hindenlang_gassner
— Methodflux_hindenlang_gassner(u_ll, u_rr, orientation_or_normal_direction,
equations::IdealGlmMhdEquations1D)
Entropy conserving and kinetic energy preserving two-point flux of Hindenlang and Gassner (2019), extending flux_ranocha
to the MHD equations.
References
- Florian Hindenlang, Gregor Gassner (2019) A new entropy conservative two-point flux for ideal MHD equations derived from first principles. Presented at HONOM 2019: European workshop on high order numerical methods for evolutionary PDEs, theory and applications
- Hendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig
- Hendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018
Trixi.flux_hindenlang_gassner
— Methodflux_hindenlang_gassner(u_ll, u_rr, orientation_or_normal_direction,
equations::IdealGlmMhdEquations2D)
Entropy conserving and kinetic energy preserving two-point flux of Hindenlang and Gassner (2019), extending flux_ranocha
to the MHD equations.
References
- Florian Hindenlang, Gregor Gassner (2019) A new entropy conservative two-point flux for ideal MHD equations derived from first principles. Presented at HONOM 2019: European workshop on high order numerical methods for evolutionary PDEs, theory and applications
- Hendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig
- Hendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018
Trixi.flux_hindenlang_gassner
— Methodflux_hindenlang_gassner(u_ll, u_rr, orientation_or_normal_direction,
equations::IdealGlmMhdEquations3D)
Entropy conserving and kinetic energy preserving two-point flux of Hindenlang and Gassner (2019), extending flux_ranocha
to the MHD equations.
References
- Florian Hindenlang, Gregor Gassner (2019) A new entropy conservative two-point flux for ideal MHD equations derived from first principles. Presented at HONOM 2019: European workshop on high order numerical methods for evolutionary PDEs, theory and applications
- Hendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig
- Hendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018
Trixi.flux_hindenlang_gassner
— Methodflux_hindenlang_gassner(u_ll, u_rr, orientation_or_normal_direction,
equations::IdealGlmMhdMulticomponentEquations1D)
Adaption of the entropy conserving and kinetic energy preserving two-point flux of Hindenlang (2019), extending flux_ranocha
to the MHD equations.
References
- Florian Hindenlang, Gregor Gassner (2019) A new entropy conservative two-point flux for ideal MHD equations derived from first principles. Presented at HONOM 2019: European workshop on high order numerical methods for evolutionary PDEs, theory and applications
- Hendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig
- Hendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018
Trixi.flux_hindenlang_gassner
— Methodflux_hindenlang_gassner(u_ll, u_rr, orientation_or_normal_direction,
equations::IdealGlmMhdMulticomponentEquations2D)
Adaption of the entropy conserving and kinetic energy preserving two-point flux of Hindenlang (2019), extending flux_ranocha
to the MHD equations.
References
- Florian Hindenlang, Gregor Gassner (2019) A new entropy conservative two-point flux for ideal MHD equations derived from first principles. Presented at HONOM 2019: European workshop on high order numerical methods for evolutionary PDEs, theory and applications
- Hendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig
- Hendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018
Trixi.flux_hllc
— Methodflux_hllc(u_ll, u_rr, orientation, equations::CompressibleEulerEquations1D)
Computes the HLLC flux (HLL with Contact) for compressible Euler equations developed by E.F. Toro Lecture slides Signal speeds: DOI: 10.1137/S1064827593260140
Trixi.flux_hllc
— Methodflux_hllc(u_ll, u_rr, orientation_or_normal_direction, equations::CompressibleEulerEquations2D)
Computes the HLLC flux (HLL with Contact) for compressible Euler equations developed by E.F. Toro Lecture slides Signal speeds: DOI: 10.1137/S1064827593260140
Trixi.flux_hllc
— Methodflux_hllc(u_ll, u_rr, orientation_or_normal_direction, equations::CompressibleEulerEquations3D)
Computes the HLLC flux (HLL with Contact) for compressible Euler equations developed by E.F. Toro Lecture slides Signal speeds: DOI: 10.1137/S1064827593260140
Trixi.flux_hllc
— Methodflux_hllc(u_ll, u_rr, orientation, equations::IdealGlmMhdEquations1D)
- Li (2005)
An HLLC Riemann solver for magneto-hydrodynamics DOI: 10.1016/j.jcp.2004.08.020.
Trixi.flux_kennedy_gruber
— Methodflux_kennedy_gruber(u_ll, u_rr, orientation, equations::CompressibleEulerEquations1D)
Kinetic energy preserving two-point flux by
- Kennedy and Gruber (2008) Reduced aliasing formulations of the convective terms within the Navier-Stokes equations for a compressible fluid DOI: 10.1016/j.jcp.2007.09.020
Trixi.flux_kennedy_gruber
— Methodflux_kennedy_gruber(u_ll, u_rr, orientation_or_normal_direction,
equations::CompressibleEulerEquations2D)
Kinetic energy preserving two-point flux by
- Kennedy and Gruber (2008) Reduced aliasing formulations of the convective terms within the Navier-Stokes equations for a compressible fluid DOI: 10.1016/j.jcp.2007.09.020
Trixi.flux_kennedy_gruber
— Methodflux_kennedy_gruber(u_ll, u_rr, orientation_or_normal_direction,
equations::CompressibleEulerEquations3D)
Kinetic energy preserving two-point flux by
- Kennedy and Gruber (2008) Reduced aliasing formulations of the convective terms within the Navier-Stokes equations for a compressible fluid DOI: 10.1016/j.jcp.2007.09.020
Trixi.flux_nonconservative_audusse_etal
— Methodflux_nonconservative_audusse_etal(u_ll, u_rr, orientation::Integer,
equations::ShallowWaterEquations1D)
Non-symmetric two-point surface flux that discretizes the nonconservative (source) term. The discretization uses the hydrostatic_reconstruction_audusse_etal
on the conservative variables.
This hydrostatic reconstruction ensures that the finite volume numerical fluxes remain well-balanced for discontinuous bottom topographies ShallowWaterEquations1D
. Should be used together with FluxHydrostaticReconstruction
and hydrostatic_reconstruction_audusse_etal
in the surface flux to ensure consistency.
Further details on the hydrostatic reconstruction and its motivation can be found in
- Emmanuel Audusse, François Bouchut, Marie-Odile Bristeau, Rupert Klein, and Benoit Perthame (2004) A fast and stable well-balanced scheme with hydrostatic reconstruction for shallow water flows DOI: 10.1137/S1064827503431090
Trixi.flux_nonconservative_audusse_etal
— Methodflux_nonconservative_audusse_etal(u_ll, u_rr, orientation::Integer,
equations::ShallowWaterEquations2D)
flux_nonconservative_audusse_etal(u_ll, u_rr,
normal_direction::AbstractVector,
equations::ShallowWaterEquations2D)
Non-symmetric two-point surface flux that discretizes the nonconservative (source) term. The discretization uses the hydrostatic_reconstruction_audusse_etal
on the conservative variables.
This hydrostatic reconstruction ensures that the finite volume numerical fluxes remain well-balanced for discontinuous bottom topographies ShallowWaterEquations2D
. Should be used together with FluxHydrostaticReconstruction
and hydrostatic_reconstruction_audusse_etal
in the surface flux to ensure consistency.
Further details for the hydrostatic reconstruction and its motivation can be found in
- Emmanuel Audusse, François Bouchut, Marie-Odile Bristeau, Rupert Klein, and Benoit Perthame (2004) A fast and stable well-balanced scheme with hydrostatic reconstruction for shallow water flows DOI: 10.1137/S1064827503431090
Trixi.flux_nonconservative_chan_etal
— Methodflux_nonconservative_chan_etal(u_ll, u_rr, orientation::Integer,
equations::CompressibleEulerEquationsQuasi1D)
flux_nonconservative_chan_etal(u_ll, u_rr, normal_direction,
equations::CompressibleEulerEquationsQuasi1D)
flux_nonconservative_chan_etal(u_ll, u_rr, normal_ll, normal_rr,
equations::CompressibleEulerEquationsQuasi1D)
Non-symmetric two-point volume flux discretizing the nonconservative (source) term that contains the gradient of the pressure CompressibleEulerEquationsQuasi1D
and the nozzle width.
Further details are available in the paper:
- Jesse Chan, Khemraj Shukla, Xinhui Wu, Ruofeng Liu, Prani Nalluri (2023) High order entropy stable schemes for the quasi-one-dimensional shallow water and compressible Euler equations DOI: 10.48550/arXiv.2307.12089
Trixi.flux_nonconservative_chan_etal
— Methodflux_nonconservative_chan_etal(u_ll, u_rr, orientation::Integer,
equations::ShallowWaterEquationsQuasi1D)
flux_nonconservative_chan_etal(u_ll, u_rr, normal_direction::AbstractVector,
equations::ShallowWaterEquationsQuasi1D)
flux_nonconservative_chan_etal(u_ll, u_rr,
normal_ll::AbstractVector, normal_rr::AbstractVector,
equations::ShallowWaterEquationsQuasi1D)
Non-symmetric two-point volume flux discretizing the nonconservative (source) term that contains the gradient of the bottom topography ShallowWaterEquationsQuasi1D
and the channel width.
Further details are available in the paper:
- Jesse Chan, Khemraj Shukla, Xinhui Wu, Ruofeng Liu, Prani Nalluri (2023) High order entropy stable schemes for the quasi-one-dimensional shallow water and compressible Euler equations DOI: 10.48550/arXiv.2307.12089
Trixi.flux_nonconservative_fjordholm_etal
— Methodflux_nonconservative_fjordholm_etal(u_ll, u_rr, orientation::Integer,
equations::ShallowWaterEquations1D)
Non-symmetric two-point surface flux discretizing the nonconservative (source) term of that contains the gradient of the bottom topography ShallowWaterEquations1D
.
This flux can be used together with flux_fjordholm_etal
at interfaces to ensure entropy conservation and well-balancedness.
Further details for the original finite volume formulation are available in
- Ulrik S. Fjordholm, Siddhartha Mishr and Eitan Tadmor (2011) Well-balanced and energy stable schemes for the shallow water equations with discontinuous topography DOI: 10.1016/j.jcp.2011.03.042
and for curvilinear 2D case in the paper:
- Niklas Wintermeyer, Andrew R. Winters, Gregor J. Gassner and David A. Kopriva (2017) An entropy stable nodal discontinuous Galerkin method for the two dimensional shallow water equations on unstructured curvilinear meshes with discontinuous bathymetry DOI: 10.1016/j.jcp.2017.03.036
Trixi.flux_nonconservative_fjordholm_etal
— Methodflux_nonconservative_fjordholm_etal(u_ll, u_rr, orientation::Integer,
equations::ShallowWaterEquations2D)
flux_nonconservative_fjordholm_etal(u_ll, u_rr,
normal_direction::AbstractVector,
equations::ShallowWaterEquations2D)
Non-symmetric two-point surface flux discretizing the nonconservative (source) term of that contains the gradient of the bottom topography ShallowWaterEquations2D
.
This flux can be used together with flux_fjordholm_etal
at interfaces to ensure entropy conservation and well-balancedness.
Further details for the original finite volume formulation are available in
- Ulrik S. Fjordholm, Siddhartha Mishr and Eitan Tadmor (2011) Well-balanced and energy stable schemes for the shallow water equations with discontinuous topography DOI: 10.1016/j.jcp.2011.03.042
and for curvilinear 2D case in the paper:
- Niklas Wintermeyer, Andrew R. Winters, Gregor J. Gassner and David A. Kopriva (2017) An entropy stable nodal discontinuous Galerkin method for the two dimensional shallow water equations on unstructured curvilinear meshes with discontinuous bathymetry DOI: 10.1016/j.jcp.2017.03.036
Trixi.flux_nonconservative_powell
— Methodflux_nonconservative_powell(u_ll, u_rr, orientation::Integer,
equations::IdealGlmMhdEquations2D)
flux_nonconservative_powell(u_ll, u_rr,
normal_direction::AbstractVector,
equations::IdealGlmMhdEquations2D)
Non-symmetric two-point flux discretizing the nonconservative (source) term of Powell and the Galilean nonconservative term associated with the GLM multiplier of the IdealGlmMhdEquations2D
.
On curvilinear meshes, the implementation differs from the reference since we use the averaged normal direction for the metrics dealiasing.
References
- Marvin Bohm, Andrew R.Winters, Gregor J. Gassner, Dominik Derigs, Florian Hindenlang, Joachim Saur An entropy stable nodal discontinuous Galerkin method for the resistive MHD equations. Part I: Theory and numerical verification DOI: 10.1016/j.jcp.2018.06.027
Trixi.flux_nonconservative_powell
— Methodflux_nonconservative_powell(u_ll, u_rr, orientation::Integer,
equations::IdealGlmMhdEquations3D)
flux_nonconservative_powell(u_ll, u_rr,
normal_direction::AbstractVector,
equations::IdealGlmMhdEquations3D)
Non-symmetric two-point flux discretizing the nonconservative (source) term of Powell and the Galilean nonconservative term associated with the GLM multiplier of the IdealGlmMhdEquations3D
.
On curvilinear meshes, the implementation differs from the reference since we use the averaged normal direction for the metrics dealiasing.
References
- Marvin Bohm, Andrew R.Winters, Gregor J. Gassner, Dominik Derigs, Florian Hindenlang, Joachim Saur An entropy stable nodal discontinuous Galerkin method for the resistive MHD equations. Part I: Theory and numerical verification DOI: 10.1016/j.jcp.2018.06.027
Trixi.flux_nonconservative_powell
— Methodflux_nonconservative_powell(u_ll, u_rr, orientation::Integer,
equations::IdealGlmMhdMulticomponentEquations2D)
Non-symmetric two-point flux discretizing the nonconservative (source) term of Powell and the Galilean nonconservative term associated with the GLM multiplier of the IdealGlmMhdMulticomponentEquations2D
.
References
- Marvin Bohm, Andrew R.Winters, Gregor J. Gassner, Dominik Derigs, Florian Hindenlang, Joachim Saur An entropy stable nodal discontinuous Galerkin method for the resistive MHD equations. Part I: Theory and numerical verification DOI: 10.1016/j.jcp.2018.06.027
Trixi.flux_nonconservative_powell_local_symmetric
— Methodflux_nonconservative_powell_local_symmetric(u_ll, orientation::Integer,
equations::IdealGlmMhdEquations2D,
nonconservative_type::NonConservativeSymmetric,
nonconservative_term::Integer)
Symmetric part of the Powell and GLM non-conservative terms. Needed for the calculation of the non-conservative staggered "fluxes" for subcell limiting. See, e.g.,
- Rueda-Ramírez, Gassner (2023). A Flux-Differencing Formula for Split-Form Summation By Parts Discretizations of Non-Conservative Systems. https://arxiv.org/pdf/2211.14009.pdf.
This function is used to compute the subcell fluxes in dg2dsubcell_limiters.jl.
Trixi.flux_nonconservative_powell_local_symmetric
— Methodflux_nonconservative_powell_local_symmetric(u_ll, u_rr,
orientation::Integer,
equations::IdealGlmMhdEquations2D)
Non-symmetric two-point flux discretizing the nonconservative (source) term of Powell and the Galilean nonconservative term associated with the GLM multiplier of the IdealGlmMhdEquations2D
.
This implementation uses a non-conservative term that can be written as the product of local and symmetric parts. It is equivalent to the non-conservative flux of Bohm et al. flux_nonconservative_powell
for conforming meshes but it yields different results on non-conforming meshes(!). On curvilinear meshes this formulation applies the local normal direction compared to the averaged one used in flux_nonconservative_powell
.
The two other flux functions with the same name return either the local or symmetric portion of the non-conservative flux based on the type of the nonconservativetype argument, employing multiple dispatch. They are used to compute the subcell fluxes in dg2dsubcelllimiters.jl.
References
- Rueda-Ramírez, Gassner (2023). A Flux-Differencing Formula for Split-Form Summation By Parts Discretizations of Non-Conservative Systems. https://arxiv.org/pdf/2211.14009.pdf.
Trixi.flux_nonconservative_powell_local_symmetric
— Methodflux_nonconservative_powell_local_symmetric(u_ll, orientation::Integer,
equations::IdealGlmMhdEquations2D,
nonconservative_type::NonConservativeLocal,
nonconservative_term::Integer)
Local part of the Powell and GLM non-conservative terms. Needed for the calculation of the non-conservative staggered "fluxes" for subcell limiting. See, e.g.,
- Rueda-Ramírez, Gassner (2023). A Flux-Differencing Formula for Split-Form Summation By Parts Discretizations of Non-Conservative Systems. https://arxiv.org/pdf/2211.14009.pdf.
This function is used to compute the subcell fluxes in dg2dsubcell_limiters.jl.
Trixi.flux_nonconservative_wintermeyer_etal
— Methodflux_nonconservative_wintermeyer_etal(u_ll, u_rr, orientation::Integer,
equations::ShallowWaterEquations1D)
Non-symmetric two-point volume flux discretizing the nonconservative (source) term that contains the gradient of the bottom topography ShallowWaterEquations1D
.
Gives entropy conservation and well-balancedness on both the volume and surface when combined with flux_wintermeyer_etal
.
Further details are available in the papers:
- Niklas Wintermeyer, Andrew R. Winters, Gregor J. Gassner and David A. Kopriva (2017) An entropy stable nodal discontinuous Galerkin method for the two dimensional shallow water equations on unstructured curvilinear meshes with discontinuous bathymetry DOI: 10.1016/j.jcp.2017.03.036
- Patrick Ersing, Andrew R. Winters (2023) An entropy stable discontinuous Galerkin method for the two-layer shallow water equations on curvilinear meshes DOI: 10.48550/arXiv.2306.12699
Trixi.flux_nonconservative_wintermeyer_etal
— Methodflux_nonconservative_wintermeyer_etal(u_ll, u_rr, orientation::Integer,
equations::ShallowWaterEquations2D)
flux_nonconservative_wintermeyer_etal(u_ll, u_rr,
normal_direction::AbstractVector,
equations::ShallowWaterEquations2D)
Non-symmetric two-point volume flux discretizing the nonconservative (source) term that contains the gradient of the bottom topography ShallowWaterEquations2D
.
For the surface_flux
either flux_wintermeyer_etal
or flux_fjordholm_etal
can be used to ensure well-balancedness and entropy conservation.
Further details are available in the papers:
- Niklas Wintermeyer, Andrew R. Winters, Gregor J. Gassner and David A. Kopriva (2017) An entropy stable nodal discontinuous Galerkin method for the two dimensional shallow water equations on unstructured curvilinear meshes with discontinuous bathymetry DOI: 10.1016/j.jcp.2017.03.036
- Patrick Ersing, Andrew R. Winters (2023) An entropy stable discontinuous Galerkin method for the two-layer shallow water equations on curvilinear meshes DOI: 10.48550/arXiv.2306.12699
Trixi.flux_ranocha
— Methodflux_ranocha(u_ll, u_rr, orientation_or_normal_direction, equations::CompressibleEulerEquations1D)
Entropy conserving and kinetic energy preserving two-point flux by
- Hendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig
See also
- Hendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018
Trixi.flux_ranocha
— Methodflux_ranocha(u_ll, u_rr, orientation_or_normal_direction,
equations::CompressibleEulerEquations2D)
Entropy conserving and kinetic energy preserving two-point flux by
- Hendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig
See also
- Hendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018
Trixi.flux_ranocha
— Methodflux_ranocha(u_ll, u_rr, orientation_or_normal_direction,
equations::CompressibleEulerEquations3D)
Entropy conserving and kinetic energy preserving two-point flux by
- Hendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig
See also
- Hendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018
Trixi.flux_ranocha
— Methodflux_ranocha(u_ll, u_rr, orientation_or_normal_direction,
equations::CompressibleEulerMulticomponentEquations1D)
Adaption of the entropy conserving and kinetic energy preserving two-point flux by
- Hendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig
See also
- Hendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018
Trixi.flux_ranocha
— Methodflux_ranocha(u_ll, u_rr, orientation_or_normal_direction,
equations::CompressibleEulerMulticomponentEquations2D)
Adaption of the entropy conserving and kinetic energy preserving two-point flux by
- Hendrik Ranocha (2018) Generalised Summation-by-Parts Operators and Entropy Stability of Numerical Methods for Hyperbolic Balance Laws PhD thesis, TU Braunschweig
See also
- Hendrik Ranocha (2020) Entropy Conserving and Kinetic Energy Preserving Numerical Methods for the Euler Equations Using Summation-by-Parts Operators Proceedings of ICOSAHOM 2018
Trixi.flux_ranocha_turbo
— Methodflux_ranocha_turbo(u_ll, u_rr, orientation_or_normal_direction, equations)
Equivalent to flux_ranocha
except that it may use specialized methods, e.g., when used with VolumeIntegralFluxDifferencing
. These specialized methods may enable better use of SIMD instructions to increase runtime efficiency on modern hardware.
Trixi.flux_shima_etal
— Methodflux_shima_etal(u_ll, u_rr, orientation, equations::CompressibleEulerEquations1D)
This flux is is a modification of the original kinetic energy preserving two-point flux by
- Yuichi Kuya, Kosuke Totani and Soshi Kawai (2018) Kinetic energy and entropy preserving schemes for compressible flows by split convective forms DOI: 10.1016/j.jcp.2018.08.058
The modification is in the energy flux to guarantee pressure equilibrium and was developed by
- Nao Shima, Yuichi Kuya, Yoshiharu Tamaki, Soshi Kawai (JCP 2020) Preventing spurious pressure oscillations in split convective form discretizations for compressible flows DOI: 10.1016/j.jcp.2020.110060
Trixi.flux_shima_etal
— Methodflux_shima_etal(u_ll, u_rr, orientation_or_normal_direction,
equations::CompressibleEulerEquations2D)
This flux is is a modification of the original kinetic energy preserving two-point flux by
- Yuichi Kuya, Kosuke Totani and Soshi Kawai (2018) Kinetic energy and entropy preserving schemes for compressible flows by split convective forms DOI: 10.1016/j.jcp.2018.08.058
The modification is in the energy flux to guarantee pressure equilibrium and was developed by
- Nao Shima, Yuichi Kuya, Yoshiharu Tamaki, Soshi Kawai (JCP 2020) Preventing spurious pressure oscillations in split convective form discretizations for compressible flows DOI: 10.1016/j.jcp.2020.110060
Trixi.flux_shima_etal
— Methodflux_shima_etal(u_ll, u_rr, orientation_or_normal_direction,
equations::CompressibleEulerEquations3D)
This flux is is a modification of the original kinetic energy preserving two-point flux by
- Yuichi Kuya, Kosuke Totani and Soshi Kawai (2018) Kinetic energy and entropy preserving schemes for compressible flows by split convective forms DOI: 10.1016/j.jcp.2018.08.058
The modification is in the energy flux to guarantee pressure equilibrium and was developed by
- Nao Shima, Yuichi Kuya, Yoshiharu Tamaki, Soshi Kawai (JCP 2020) Preventing spurious pressure oscillations in split convective form discretizations for compressible flows DOI: 10.1016/j.jcp.2020.110060
Trixi.flux_shima_etal_turbo
— Methodflux_shima_etal_turbo(u_ll, u_rr, orientation_or_normal_direction, equations)
Equivalent to flux_shima_etal
except that it may use specialized methods, e.g., when used with VolumeIntegralFluxDifferencing
. These specialized methods may enable better use of SIMD instructions to increase runtime efficiency on modern hardware.
Trixi.flux_wintermeyer_etal
— Methodflux_wintermeyer_etal(u_ll, u_rr, orientation,
equations::ShallowWaterEquations1D)
Total energy conservative (mathematical entropy for shallow water equations) split form. When the bottom topography is nonzero this scheme will be well-balanced when used as a volume_flux
. For the surface_flux
either flux_wintermeyer_etal
or flux_fjordholm_etal
can be used to ensure well-balancedness and entropy conservation.
Further details are available in Theorem 1 of the paper:
- Niklas Wintermeyer, Andrew R. Winters, Gregor J. Gassner and David A. Kopriva (2017) An entropy stable nodal discontinuous Galerkin method for the two dimensional shallow water equations on unstructured curvilinear meshes with discontinuous bathymetry DOI: 10.1016/j.jcp.2017.03.036
Trixi.flux_wintermeyer_etal
— Methodflux_wintermeyer_etal(u_ll, u_rr, orientation_or_normal_direction,
equations::ShallowWaterEquations2D)
Total energy conservative (mathematical entropy for shallow water equations) split form. When the bottom topography is nonzero this scheme will be well-balanced when used as a volume_flux
. For the surface_flux
either flux_wintermeyer_etal
or flux_fjordholm_etal
can be used to ensure well-balancedness and entropy conservation.
Further details are available in Theorem 1 of the paper:
- Niklas Wintermeyer, Andrew R. Winters, Gregor J. Gassner and David A. Kopriva (2017) An entropy stable nodal discontinuous Galerkin method for the two dimensional shallow water equations on unstructured curvilinear meshes with discontinuous bathymetry DOI: 10.1016/j.jcp.2017.03.036
Trixi.flux_winters_etal
— Methodflux_winters_etal(u_ll, u_rr, orientation_or_normal_direction,
equations::PolytropicEulerEquations2D)
Entropy conserving two-point flux for isothermal or polytropic gases. Requires a special weighted Stolarsky mean for the evaluation of the density denoted here as stolarsky_mean
. Note, for isothermal gases where gamma = 1
this stolarsky_mean
becomes the ln_mean
.
For details see Section 3.2 of the following reference
- Andrew R. Winters, Christof Czernik, Moritz B. Schily & Gregor J. Gassner (2020) Entropy stable numerical approximations for the isothermal and polytropic Euler equations DOI: 10.1007/s10543-019-00789-w
Trixi.gauss_nodes_weights
— Methodgauss_nodes_weights(n_nodes::Integer)
Computes nodes $x_j$ and weights $w_j$ for the Gauss-Legendre quadrature. This implements algorithm 23 "LegendreGaussNodesAndWeights" from the book
- David A. Kopriva, (2009). Implementing spectral methods for partial differential equations: Algorithms for scientists and engineers. DOI:10.1007/978-90-481-2261-5
Trixi.get_boundary_outer_state
— Methodget_boundary_outer_state(u_inner, t,
boundary_condition::BoundaryConditionDirichlet,
orientation_or_normal, direction,
equations, dg, cache, indices...)
For subcell limiting, the calculation of local bounds for non-periodic domains requires the boundary outer state. This function returns the boundary value for BoundaryConditionDirichlet
at time t
and for node with spatial indices indices
at the boundary with orientation_or_normal
and direction
.
Should be used together with TreeMesh
or StructuredMesh
.
This is an experimental feature and may change in future releases.
Trixi.get_examples
— Methodget_examples()
Return a list of all example elixirs that are provided by Trixi.jl. See also examples_dir
and default_example
.
Trixi.get_name
— Methodget_name(x)
Returns a name of x
ready for pretty printing. By default, return string(y)
if x isa Val{y}
and return string(x)
otherwise.
Examples
julia> Trixi.get_name("test")
"test"
julia> Trixi.get_name(Val(:test))
"test"
Trixi.get_name
— Methodget_name(equations::AbstractEquations)
Returns the canonical, human-readable name for the given system of equations.
Examples
julia> Trixi.get_name(CompressibleEulerEquations1D(1.4))
"CompressibleEulerEquations1D"
Trixi.getmesh
— Methodgetmesh(pd::AbstractPlotData)
Extract grid lines from pd
for plotting with Plots.plot
.
This is an experimental feature and may change in future releases.
Trixi.global_mean_vars
— Methodglobal_mean_vars(equations::AcousticPerturbationEquations2D)
Returns the global mean variables stored in equations
. This makes it easier to define flexible initial conditions for problems with constant mean flow.
Trixi.have_nonconservative_terms
— Methodhave_nonconservative_terms(equations)
Trait function determining whether equations
represent a conservation law with or without nonconservative terms. Classical conservation laws such as the CompressibleEulerEquations2D
do not have nonconservative terms. The ShallowWaterEquations2D
with non-constant bottom topography are an example of equations with nonconservative terms. The return value will be True()
or False()
to allow dispatching on the return type.
Trixi.hydrostatic_reconstruction_audusse_etal
— Methodhydrostatic_reconstruction_audusse_etal(u_ll, u_rr, orientation::Integer,
equations::ShallowWaterEquations1D)
A particular type of hydrostatic reconstruction on the water height to guarantee well-balancedness for a general bottom topography ShallowWaterEquations1D
. The reconstructed solution states u_ll_star
and u_rr_star
variables are then used to evaluate the surface numerical flux at the interface. Use in combination with the generic numerical flux routine FluxHydrostaticReconstruction
.
Further details on this hydrostatic reconstruction and its motivation can be found in
- Emmanuel Audusse, François Bouchut, Marie-Odile Bristeau, Rupert Klein, and Benoit Perthame (2004) A fast and stable well-balanced scheme with hydrostatic reconstruction for shallow water flows DOI: 10.1137/S1064827503431090
Trixi.hydrostatic_reconstruction_audusse_etal
— Methodhydrostatic_reconstruction_audusse_etal(u_ll, u_rr, orientation_or_normal_direction,
equations::ShallowWaterEquations2D)
A particular type of hydrostatic reconstruction on the water height to guarantee well-balancedness for a general bottom topography ShallowWaterEquations2D
. The reconstructed solution states u_ll_star
and u_rr_star
variables are used to evaluate the surface numerical flux at the interface. Use in combination with the generic numerical flux routine FluxHydrostaticReconstruction
.
Further details for the hydrostatic reconstruction and its motivation can be found in
- Emmanuel Audusse, François Bouchut, Marie-Odile Bristeau, Rupert Klein, and Benoit Perthame (2004) A fast and stable well-balanced scheme with hydrostatic reconstruction for shallow water flows DOI: 10.1137/S1064827503431090
Trixi.init_mpi
— Methodinit_mpi()
Initialize MPI by calling MPI.Initialized()
. The function will check if MPI is already initialized and if yes, do nothing, thus it is safe to call it multiple times.
Trixi.init_p4est
— Methodinit_p4est()
Initialize p4est
by calling p4est_init
and setting the log level to SC_LP_ERROR
. This function will check if p4est
is already initialized and if yes, do nothing, thus it is safe to call it multiple times.
Trixi.init_t8code
— Methodinit_t8code()
Initialize t8code
by calling sc_init
, p4est_init
, and t8_init
while setting the log level to SC_LP_ERROR
. This function will check if t8code
is already initialized and if yes, do nothing, thus it is safe to call it multiple times.
Trixi.initial_condition_constant
— Methodinitial_condition_constant(x, t, equations::AcousticPerturbationEquations2D)
A constant initial condition where the state variables are zero and the mean flow is constant. Uses the global mean values from equations
.
Trixi.initial_condition_constant
— Methodinitial_condition_constant(x, t, equations::CompressibleEulerEquations1D)
A constant initial condition to test free-stream preservation.
Trixi.initial_condition_constant
— Methodinitial_condition_constant(x, t, equations::CompressibleEulerEquations2D)
A constant initial condition to test free-stream preservation.
Trixi.initial_condition_constant
— Methodinitial_condition_constant(x, t, equations::CompressibleEulerEquations3D)
A constant initial condition to test free-stream preservation.
Trixi.initial_condition_constant
— Methodinitial_condition_constant(x, t, equations::IdealGlmMhdEquations1D)
A constant initial condition to test free-stream preservation.
Trixi.initial_condition_constant
— Methodinitial_condition_constant(x, t, equations::IdealGlmMhdEquations2D)
A constant initial condition to test free-stream preservation.
Trixi.initial_condition_constant
— Methodinitial_condition_constant(x, t, equations::IdealGlmMhdEquations3D)
A constant initial condition to test free-stream preservation.
Trixi.initial_condition_constant
— Methodinitial_condition_constant(x, t, equations::InviscidBurgersEquation1D)
A constant initial condition to test free-stream preservation.
Trixi.initial_condition_constant
— Methodinitial_condition_constant(x, t, equations::LatticeBoltzmannEquations2D)
A constant initial condition to test free-stream preservation.
Trixi.initial_condition_constant
— Methodinitial_condition_constant(x, t, equations::LatticeBoltzmannEquations3D)
A constant initial condition to test free-stream preservation.
Trixi.initial_condition_constant
— Methodinitial_condition_constant(x, t, equations::LinearScalarAdvectionEquation1D)
A constant initial condition to test free-stream preservation.
Trixi.initial_condition_constant
— Methodinitial_condition_constant(x, t, equations::LinearScalarAdvectionEquation2D)
A constant initial condition to test free-stream preservation.
Trixi.initial_condition_constant
— Methodinitial_condition_constant(x, t, equations::LinearScalarAdvectionEquation1D)
A constant initial condition to test free-stream preservation.
Trixi.initial_condition_convergence_test
— Methodinitial_condition_convergence_test(x, t, equations::AcousticPerturbationEquations2D)
A smooth initial condition used for convergence tests in combination with source_terms_convergence_test
. Uses the global mean values from equations
.
Trixi.initial_condition_convergence_test
— Methodinitial_condition_convergence_test(x, t, equations::CompressibleEulerEquations1D)
A smooth initial condition used for convergence tests in combination with source_terms_convergence_test
(and BoundaryConditionDirichlet(initial_condition_convergence_test)
in non-periodic domains).
Trixi.initial_condition_convergence_test
— Methodinitial_condition_convergence_test(x, t, equations::CompressibleEulerEquations2D)
A smooth initial condition used for convergence tests in combination with source_terms_convergence_test
(and BoundaryConditionDirichlet(initial_condition_convergence_test)
in non-periodic domains).
Trixi.initial_condition_convergence_test
— Methodinitial_condition_convergence_test(x, t, equations::CompressibleEulerEquations3D)
A smooth initial condition used for convergence tests in combination with source_terms_convergence_test
.
Trixi.initial_condition_convergence_test
— Methodinitial_condition_convergence_test(x, t, equations::CompressibleEulerEquationsQuasi1D)
A smooth initial condition used for convergence tests in combination with source_terms_convergence_test
(and BoundaryConditionDirichlet(initial_condition_convergence_test)
in non-periodic domains).
Trixi.initial_condition_convergence_test
— Methodinitial_condition_convergence_test(x, t, equations::CompressibleEulerMulticomponentEquations1D)
A smooth initial condition used for convergence tests in combination with source_terms_convergence_test
(and BoundaryConditionDirichlet(initial_condition_convergence_test)
in non-periodic domains).
Trixi.initial_condition_convergence_test
— Methodinitial_condition_convergence_test(x, t, equations::CompressibleEulerMulticomponentEquations2D)
A smooth initial condition used for convergence tests in combination with source_terms_convergence_test
(and BoundaryConditionDirichlet(initial_condition_convergence_test)
in non-periodic domains).
Trixi.initial_condition_convergence_test
— Methodinitial_condition_convergence_test(x, t, equations::IdealGlmMhdEquations1D)
An Alfvén wave as smooth initial condition used for convergence tests.
Trixi.initial_condition_convergence_test
— Methodinitial_condition_convergence_test(x, t, equations::IdealGlmMhdEquations2D)
An Alfvén wave as smooth initial condition used for convergence tests.
Trixi.initial_condition_convergence_test
— Methodinitial_condition_convergence_test(x, t, equations::IdealGlmMhdEquations3D)
An Alfvén wave as smooth initial condition used for convergence tests.
Trixi.initial_condition_convergence_test
— Methodinitial_condition_convergence_test(x, t, equations::IdealGlmMhdMulticomponentEquations1D)
An Alfvén wave as smooth initial condition used for convergence tests.
Trixi.initial_condition_convergence_test
— Methodinitial_condition_convergence_test(x, t, equations::IdealGlmMhdMulticomponentEquations2D)
An Alfvén wave as smooth initial condition used for convergence tests.
Trixi.initial_condition_convergence_test
— Methodinitial_condition_convergence_test(x, t, equations::InviscidBurgersEquation1D)
A smooth initial condition used for convergence tests.
Trixi.initial_condition_convergence_test
— Methodinitial_condition_convergence_test(x, t, equations::LinearScalarAdvectionEquation1D)
A smooth initial condition used for convergence tests (in combination with BoundaryConditionDirichlet(initial_condition_convergence_test)
in non-periodic domains).
Trixi.initial_condition_convergence_test
— Methodinitial_condition_convergence_test(x, t, equations::LinearScalarAdvectionEquation2D)
A smooth initial condition used for convergence tests.
Trixi.initial_condition_convergence_test
— Methodinitial_condition_convergence_test(x, t, equations::LinearScalarAdvectionEquation1D)
A smooth initial condition used for convergence tests.
Trixi.initial_condition_convergence_test
— Methodinitial_condition_convergence_test(x, t, equations::LinearizedEulerEquations1D)
A smooth initial condition used for convergence tests.
Trixi.initial_condition_convergence_test
— Methodinitial_condition_convergence_test(x, t, equations::LinearizedEulerEquations2D)
A smooth initial condition used for convergence tests.
Trixi.initial_condition_convergence_test
— Methodinitial_condition_convergence_test(x, t, equations::LinearizedEulerEquations3D)
A smooth initial condition used for convergence tests.
Trixi.initial_condition_convergence_test
— Methodinitial_condition_convergence_test(x, t, equations::MaxwellEquations1D)
A smooth initial condition used for convergence tests.
Trixi.initial_condition_convergence_test
— Methodinitial_condition_convergence_test(x, t, equations::PolytropicEulerEquations2D)
Manufactured smooth initial condition used for convergence tests in combination with source_terms_convergence_test
.
Trixi.initial_condition_convergence_test
— Methodinitial_condition_convergence_test(x, t, equations::ShallowWaterEquations1D)
A smooth initial condition used for convergence tests in combination with source_terms_convergence_test
(and BoundaryConditionDirichlet(initial_condition_convergence_test)
in non-periodic domains).
Trixi.initial_condition_convergence_test
— Methodinitial_condition_convergence_test(x, t, equations::ShallowWaterEquations2D)
A smooth initial condition used for convergence tests in combination with source_terms_convergence_test
(and BoundaryConditionDirichlet(initial_condition_convergence_test)
in non-periodic domains).
Trixi.initial_condition_convergence_test
— Methodinitial_condition_convergence_test(x, t, equations::ShallowWaterEquationsQuasi1D)
A smooth initial condition used for convergence tests in combination with source_terms_convergence_test
(and BoundaryConditionDirichlet(initial_condition_convergence_test)
in non-periodic domains).
Trixi.initial_condition_convergence_test
— Methodinitial_condition_convergence_test(x, t, equations::TrafficFlowLWREquations1D)
A smooth initial condition used for convergence tests.
Trixi.initial_condition_density_wave
— Methodinitial_condition_density_wave(x, t, equations::CompressibleEulerEquations1D)
A sine wave in the density with constant velocity and pressure; reduces the compressible Euler equations to the linear advection equations. This setup is the test case for stability of EC fluxes from paper
- Gregor J. Gassner, Magnus Svärd, Florian J. Hindenlang (2020) Stability issues of entropy-stable and/or split-form high-order schemes arXiv: 2007.09026
with the following parameters
- domain [-1, 1]
- mesh = 4x4
- polydeg = 5
Trixi.initial_condition_density_wave
— Methodinitial_condition_density_wave(x, t, equations::CompressibleEulerEquations2D)
A sine wave in the density with constant velocity and pressure; reduces the compressible Euler equations to the linear advection equations. This setup is the test case for stability of EC fluxes from paper
- Gregor J. Gassner, Magnus Svärd, Florian J. Hindenlang (2020) Stability issues of entropy-stable and/or split-form high-order schemes arXiv: 2007.09026
with the following parameters
- domain [-1, 1]
- mesh = 4x4
- polydeg = 5
Trixi.initial_condition_eoc_test_coupled_euler_gravity
— Methodinitial_condition_eoc_test_coupled_euler_gravity(x, t, equations::CompressibleEulerEquations1D)
One dimensional variant of the setup used for convergence tests of the Euler equations with self-gravity from
- Michael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593
There is no additional source term necessary for the manufactured solution in one spatial dimension. Thus, source_terms_eoc_test_coupled_euler_gravity
is not present there.
Trixi.initial_condition_eoc_test_coupled_euler_gravity
— Methodinitial_condition_eoc_test_coupled_euler_gravity(x, t, equations::CompressibleEulerEquations2D)
Setup used for convergence tests of the Euler equations with self-gravity used in
- Michael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593
in combination with source_terms_eoc_test_coupled_euler_gravity
or source_terms_eoc_test_euler
.
Trixi.initial_condition_eoc_test_coupled_euler_gravity
— Methodinitial_condition_eoc_test_coupled_euler_gravity(x, t, equations::CompressibleEulerEquations3D)
Setup used for convergence tests of the Euler equations with self-gravity used in
- Michael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593
in combination with source_terms_eoc_test_coupled_euler_gravity
or source_terms_eoc_test_euler
.
Trixi.initial_condition_eoc_test_coupled_euler_gravity
— Methodinitial_condition_eoc_test_coupled_euler_gravity(x, t, equations::HyperbolicDiffusionEquations1D)
Setup used for convergence tests of the Euler equations with self-gravity used in
- Michael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593
in combination with source_terms_harmonic
.
Trixi.initial_condition_eoc_test_coupled_euler_gravity
— Methodinitial_condition_eoc_test_coupled_euler_gravity(x, t, equations::HyperbolicDiffusionEquations2D)
Setup used for convergence tests of the Euler equations with self-gravity used in
- Michael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593
in combination with source_terms_harmonic
.
Trixi.initial_condition_eoc_test_coupled_euler_gravity
— Methodinitial_condition_eoc_test_coupled_euler_gravity(x, t, equations::HyperbolicDiffusionEquations3D)
Setup used for convergence tests of the Euler equations with self-gravity used in
- Michael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593
in combination with source_terms_harmonic
.
Trixi.initial_condition_gauss
— Methodinitial_condition_gauss(x, t, equations::AcousticPerturbationEquations2D)
A Gaussian pulse in a constant mean flow. Uses the global mean values from equations
.
Trixi.initial_condition_gauss
— Methodinitial_condition_gauss(x, t, equations::LinearScalarAdvectionEquation1D)
A Gaussian pulse used together with BoundaryConditionDirichlet(initial_condition_gauss)
.
Trixi.initial_condition_gauss
— Methodinitial_condition_gauss(x, t, equation::LinearScalarAdvectionEquation2D)
A Gaussian pulse used together with BoundaryConditionDirichlet(initial_condition_gauss)
.
Trixi.initial_condition_gauss
— Methodinitial_condition_gauss(x, t, equations::LinearScalarAdvectionEquation1D)
A Gaussian pulse.
Trixi.initial_condition_linear_x
— Methodinitial_condition_linear_x(x, t, equations::LinearScalarAdvectionEquation1D)
A linear function of x[1]
used together with boundary_condition_linear_x
.
Trixi.initial_condition_linear_x
— Methodinitial_condition_linear_x(x, t, equations::LinearScalarAdvectionEquation2D)
A linear function of x[1]
used together with boundary_condition_linear_x
.
Trixi.initial_condition_linear_x_y
— Methodinitial_condition_linear_x_y(x, t, equations::LinearScalarAdvectionEquation2D)
A linear function of x[1] + x[2]
used together with boundary_condition_linear_x_y
.
Trixi.initial_condition_linear_y
— Methodinitial_condition_linear_y(x, t, equations::LinearScalarAdvectionEquation2D)
A linear function of x[1]
used together with boundary_condition_linear_y
.
Trixi.initial_condition_linear_z
— Methodinitial_condition_linear_z(x, t, equations::LinearScalarAdvectionEquation1D)
A linear function of x[3]
used together with boundary_condition_linear_z
.
Trixi.initial_condition_poisson_nonperiodic
— Methodinitial_condition_poisson_nonperiodic(x, t, equations::HyperbolicDiffusionEquations1D)
A non-priodic smooth initial condition. Can be used for convergence tests in combination with source_terms_poisson_nonperiodic
and boundary_condition_poisson_nonperiodic
.
The solution is periodic but the initial guess is not.
Trixi.initial_condition_sin
— Methodinitial_condition_sin(x, t, equations::LinearScalarAdvectionEquation1D)
A sine wave in the conserved variable.
Trixi.initial_condition_sin
— Methodinitial_condition_sin(x, t, equations::LinearScalarAdvectionEquation1D)
A sine wave in the conserved variable.
Trixi.initial_condition_sin_sin
— Methodinitial_condition_sin_sin(x, t, equations::LinearScalarAdvectionEquation2D)
A sine wave in the conserved variable.
Trixi.initial_condition_weak_blast_wave
— Methodinitial_condition_weak_blast_wave(x, t, equations::CompressibleEulerEquations1D)
A weak blast wave taken from
- Sebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044
Trixi.initial_condition_weak_blast_wave
— Methodinitial_condition_weak_blast_wave(x, t, equations::CompressibleEulerEquations2D)
A weak blast wave taken from
- Sebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044
Trixi.initial_condition_weak_blast_wave
— Methodinitial_condition_weak_blast_wave(x, t, equations::CompressibleEulerEquations3D)
A weak blast wave taken from
- Sebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044
Trixi.initial_condition_weak_blast_wave
— Methodinitial_condition_weak_blast_wave(x, t, equations::CompressibleEulerMulticomponentEquations1D)
A for multicomponent adapted weak blast wave adapted to multicomponent and taken from
- Sebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044
Trixi.initial_condition_weak_blast_wave
— Methodinitial_condition_weak_blast_wave(x, t, equations::CompressibleEulerMulticomponentEquations2D)
A for multicomponent adapted weak blast wave taken from
- Sebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044
Trixi.initial_condition_weak_blast_wave
— Methodinitial_condition_weak_blast_wave(x, t, equations::IdealGlmMhdEquations1D)
A weak blast wave adapted from
- Sebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044
Trixi.initial_condition_weak_blast_wave
— Methodinitial_condition_weak_blast_wave(x, t, equations::IdealGlmMhdEquations2D)
A weak blast wave adapted from
- Sebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044
Trixi.initial_condition_weak_blast_wave
— Methodinitial_condition_weak_blast_wave(x, t, equations::IdealGlmMhdEquations3D)
A weak blast wave adapted from
- Sebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044
Trixi.initial_condition_weak_blast_wave
— Methodinitial_condition_weak_blast_wave(x, t, equations::IdealGlmMhdMulticomponentEquations1D)
A weak blast wave adapted from
- Sebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044
Trixi.initial_condition_weak_blast_wave
— Methodinitial_condition_weak_blast_wave(x, t, equations::IdealGlmMhdMulticomponentEquations2D)
A weak blast wave adapted from
- Sebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044
Trixi.initial_condition_weak_blast_wave
— Methodinitial_condition_weak_blast_wave(x, t, equations::PolytropicEulerEquations2D)
A weak blast wave adapted from
- Sebastian Hennemann, Gregor J. Gassner (2020) A provably entropy stable subcell shock capturing approach for high order split form DG arXiv: 2008.12044
Trixi.initial_condition_weak_blast_wave
— Methodinitial_condition_weak_blast_wave(x, t, equations::ShallowWaterEquations1D)
A weak blast wave discontinuity useful for testing, e.g., total energy conservation. Note for the shallow water equations to the total energy acts as a mathematical entropy function.
Trixi.initial_condition_weak_blast_wave
— Methodinitial_condition_weak_blast_wave(x, t, equations::ShallowWaterEquations2D)
A weak blast wave discontinuity useful for testing, e.g., total energy conservation. Note for the shallow water equations to the total energy acts as a mathematical entropy function.
Trixi.integrate_via_indices
— Methodintegrate_via_indices(func, u_ode, semi::AbstractSemidiscretization, args...; normalize=true)
Call func(u, i..., element, equations, solver, args...)
for all nodal indices i..., element
and integrate the result using a quadrature associated with the semidiscretization semi
.
If normalize
is true, the result is divided by the total volume of the computational domain.
Trixi.inv_ln_mean
— MethodTrixi.inv_ln_mean(x::Real, y::Real)
Compute the inverse 1 / ln_mean(x, y)
of the logarithmic mean ln_mean
.
This function may be used to increase performance where the inverse of the logarithmic mean is needed, by replacing a (slow) division by a (fast) multiplication.
Trixi.jacobian_ad_forward
— Methodjacobian_ad_forward(semi::AbstractSemidiscretization;
t0=zero(real(semi)),
u0_ode=compute_coefficients(t0, semi))
Uses the right-hand side operator of the semidiscretization semi
and forward mode automatic differentiation to compute the Jacobian J
of the semidiscretization semi
at state u0_ode
.
Trixi.jacobian_fd
— Methodjacobian_fd(semi::AbstractSemidiscretization;
t0=zero(real(semi)),
u0_ode=compute_coefficients(t0, semi))
Uses the right-hand side operator of the semidiscretization semi
and simple second order finite difference to compute the Jacobian J
of the semidiscretization semi
at state u0_ode
.
Trixi.lagrange_interpolating_polynomials
— Methodlagrange_interpolating_polynomials(x, nodes, wbary)
Calculate Lagrange polynomials for a given node distribution with associated barycentric weights wbary
at a given point x
on the reference interval $[-1, 1]$.
This returns all $l_j(x)$, i.e., the Lagrange polynomials for each node $x_j$. Thus, to obtain the interpolating polynomial $p(x)$ at $x$, one has to multiply the Lagrange polynomials with the nodal values $u_j$ and sum them up: $p(x) = \sum_{j=1}^{n} u_j l_j(x)$.
For details, see e.g. Section 2 of
- Jean-Paul Berrut and Lloyd N. Trefethen (2004). Barycentric Lagrange Interpolation. DOI:10.1137/S0036144502417715
Trixi.legendre_polynomial_and_derivative
— Methodlegendre_polynomial_and_derivative(N::Int, x::Real)
Computes the Legendre polynomial of degree N
and its derivative at x
. This implements algorithm 22 "LegendrePolynomialAndDerivative" from the book
- David A. Kopriva, (2009). Implementing spectral methods for partial differential equations: Algorithms for scientists and engineers. DOI:10.1007/978-90-481-2261-5
Trixi.linear_structure
— Methodlinear_structure(semi::AbstractSemidiscretization;
t0=zero(real(semi)))
Wraps the right-hand side operator of the semidiscretization semi
at time t0
as an affine-linear operator given by a linear operator A
and a vector b
.
Trixi.ln_mean
— MethodTrixi.ln_mean(x::Real, y::Real)
Compute the logarithmic mean
ln_mean(x, y) = (y - x) / (log(y) - log(x)) = (y - x) / log(y / x)
Problem: The formula above has a removable singularity at x == y
. Thus, some care must be taken to implement it correctly without problems or loss of accuracy when x ≈ y
. Here, we use the approach proposed by Ismail and Roe (2009). Set ξ = y / x. Then, we have
(y - x) / log(y / x) = (x + y) / log(ξ) * (ξ - 1) / (ξ + 1)
Set f = (ξ - 1) / (ξ + 1) = (y - x) / (x + y). Then, we use the expansion
log(ξ) = 2 * f * (1 + f^2 / 3 + f^4 / 5 + f^6 / 7) + O(ξ^9)
Inserting the first few terms of this expansion yields
(y - x) / log(ξ) ≈ (x + y) * f / (2 * f * (1 + f^2 / 3 + f^4 / 5 + f^6 / 7))
= (x + y) / (2 + 2/3 * f^2 + 2/5 * f^4 + 2/7 * f^6)
Since divisions are usually more expensive on modern hardware than multiplications (Agner Fog), we try to avoid computing two divisions. Thus, we use
f^2 = (y - x)^2 / (x + y)^2
= (x * (x - 2 * y) + y * y) / (x * (x + 2 * y) + y * y)
Given ε = 1.0e-4, we use the following algorithm.
if f^2 < ε
# use the expansion above
else
# use the direct formula (y - x) / log(y / x)
end
References
- Ismail, Roe (2009). Affordable, entropy-consistent Euler flux functions II: Entropy production at shocks. DOI: 10.1016/j.jcp.2009.04.021
- Agner Fog. Lists of instruction latencies, throughputs and micro-operation breakdowns for Intel, AMD, and VIA CPUs. https://www.agner.org/optimize/instruction_tables.pdf
Trixi.load_adaptive_time_integrator!
— Methodload_adaptive_time_integrator!(integrator, restart_file::AbstractString)
Load the context information for time integrators with error-based step size control saved in a restart_file
.
Trixi.load_dt
— Methodload_dt(restart_file::AbstractString)
Load the time step size (dt
in OrdinaryDiffEq.jl) saved in a restart_file
.
Trixi.load_mesh
— Methodload_mesh(restart_file::AbstractString; n_cells_max)
Load the mesh from the restart_file
.
Trixi.load_time
— Methodload_time(restart_file::AbstractString)
Load the time saved in a restart_file
.
Trixi.load_timestep!
— Methodload_timestep!(integrator, restart_file::AbstractString)
Load the time step number saved in a restart_file
and assign it to both the time step number and and the number of accepted steps (iter
and stats.naccept
in OrdinaryDiffEq.jl, respectively) in integrator
.
Trixi.load_timestep
— Methodload_timestep(restart_file::AbstractString)
Load the time step number (iter
in OrdinaryDiffEq.jl) saved in a restart_file
.
Trixi.max
— MethodTrixi.max(x, y, ...)
Return the maximum of the arguments. See also the maximum
function to take the maximum element from a collection.
This version in Trixi.jl is semantically equivalent to Base.max
but may be implemented differently. In particular, it may avoid potentially expensive checks necessary in the presence of NaN
s (or signed zeros).
Examples
julia> max(2, 5, 1)
5
Trixi.max_abs_speed_naive
— Functionmax_abs_speed_naive(u_ll, u_rr, orientation::Integer, equations)
max_abs_speed_naive(u_ll, u_rr, normal_direction::AbstractVector, equations)
Simple and fast estimate of the maximal wave speed of the Riemann problem with left and right states u_ll, u_rr
, based only on the local wave speeds associated to u_ll
and u_rr
.
For non-integer arguments normal_direction
in one dimension, max_abs_speed_naive
returns abs(normal_direction[1]) * max_abs_speed_naive(u_ll, u_rr, 1, equations)
.
Trixi.min
— MethodTrixi.min(x, y, ...)
Return the minimum of the arguments. See also the minimum
function to take the minimum element from a collection.
This version in Trixi.jl is semantically equivalent to Base.min
but may be implemented differently. In particular, it may avoid potentially expensive checks necessary in the presence of NaN
s (or signed zeros).
Examples
julia> min(2, 5, 1)
1
Trixi.min_max_speed_davis
— Functionmin_max_speed_davis(u_ll, u_rr, orientation::Integer, equations)
min_max_speed_davis(u_ll, u_rr, normal_direction::AbstractVector, equations)
Simple and fast estimates of the minimal and maximal wave speed of the Riemann problem with left and right states u_ll, u_rr
, usually based only on the local wave speeds associated to u_ll
and u_rr
.
- S.F. Davis (1988) Simplified Second-Order Godunov-Type Methods DOI: 10.1137/0909030
See eq. (10.38) from
- Eleuterio F. Toro (2009) Riemann Solvers and Numerical Methods for Fluid Dynamics: A Practical Introduction DOI: 10.1007/b79761
See also FluxHLL
, min_max_speed_naive
, min_max_speed_einfeldt
.
Trixi.min_max_speed_einfeldt
— Functionmin_max_speed_einfeldt(u_ll, u_rr, orientation::Integer, equations)
min_max_speed_einfeldt(u_ll, u_rr, normal_direction::AbstractVector, equations)
More advanced mininmal and maximal wave speed computation based on
- Bernd Einfeldt (1988) On Godunov-type methods for gas dynamics. DOI: 10.1137/0725021
- Bernd Einfeldt, Claus-Dieter Munz, Philip L. Roe and Björn Sjögreen (1991) On Godunov-type methods near low densities. DOI: 10.1016/0021-9991(91)90211-3
originally developed for the compressible Euler equations. A compact representation can be found in this lecture notes, eq. (9.28).
See also FluxHLL
, min_max_speed_naive
, min_max_speed_davis
.
Trixi.min_max_speed_einfeldt
— Methodmin_max_speed_einfeldt(u_ll, u_rr, normal_direction, equations::CompressibleEulerEquations2D)
Computes the HLLE (Harten-Lax-van Leer-Einfeldt) flux for the compressible Euler equations. Special estimates of the signal velocites and linearization of the Riemann problem developed by Einfeldt to ensure that the internal energy and density remain positive during the computation of the numerical flux.
- Bernd Einfeldt (1988) On Godunov-type methods for gas dynamics. DOI: 10.1137/0725021
- Bernd Einfeldt, Claus-Dieter Munz, Philip L. Roe and Björn Sjögreen (1991) On Godunov-type methods near low densities. DOI: 10.1016/0021-9991(91)90211-3
Trixi.min_max_speed_einfeldt
— Methodmin_max_speed_einfeldt(u_ll, u_rr, normal_direction, equations::CompressibleEulerEquations3D)
Computes the HLLE (Harten-Lax-van Leer-Einfeldt) flux for the compressible Euler equations. Special estimates of the signal velocites and linearization of the Riemann problem developed by Einfeldt to ensure that the internal energy and density remain positive during the computation of the numerical flux.
- Bernd Einfeldt (1988) On Godunov-type methods for gas dynamics. DOI: 10.1137/0725021
- Bernd Einfeldt, Claus-Dieter Munz, Philip L. Roe and Björn Sjögreen (1991) On Godunov-type methods near low densities. DOI: 10.1016/0021-9991(91)90211-3
Trixi.min_max_speed_einfeldt
— Methodmin_max_speed_einfeldt(u_ll, u_rr, orientation, equations::CompressibleEulerEquations1D)
Computes the HLLE (Harten-Lax-van Leer-Einfeldt) flux for the compressible Euler equations. Special estimates of the signal velocites and linearization of the Riemann problem developed by Einfeldt to ensure that the internal energy and density remain positive during the computation of the numerical flux.
Original publication:
- Bernd Einfeldt (1988) On Godunov-type methods for gas dynamics. DOI: 10.1137/0725021
Compactly summarized:
- Siddhartha Mishra, Ulrik Skre Fjordholm and Rémi Abgrall Numerical methods for conservation laws and related equations. Link
Trixi.min_max_speed_einfeldt
— Methodmin_max_speed_einfeldt(u_ll, u_rr, orientation, equations::CompressibleEulerEquations2D)
Computes the HLLE (Harten-Lax-van Leer-Einfeldt) flux for the compressible Euler equations. Special estimates of the signal velocites and linearization of the Riemann problem developed by Einfeldt to ensure that the internal energy and density remain positive during the computation of the numerical flux.
- Bernd Einfeldt (1988) On Godunov-type methods for gas dynamics. DOI: 10.1137/0725021
- Bernd Einfeldt, Claus-Dieter Munz, Philip L. Roe and Björn Sjögreen (1991) On Godunov-type methods near low densities. DOI: 10.1016/0021-9991(91)90211-3
Trixi.min_max_speed_einfeldt
— Methodmin_max_speed_einfeldt(u_ll, u_rr, orientation, equations::CompressibleEulerEquations3D)
Computes the HLLE (Harten-Lax-van Leer-Einfeldt) flux for the compressible Euler equations. Special estimates of the signal velocites and linearization of the Riemann problem developed by Einfeldt to ensure that the internal energy and density remain positive during the computation of the numerical flux.
- Bernd Einfeldt (1988) On Godunov-type methods for gas dynamics. DOI: 10.1137/0725021
- Bernd Einfeldt, Claus-Dieter Munz, Philip L. Roe and Björn Sjögreen (1991) On Godunov-type methods near low densities. DOI: 10.1016/0021-9991(91)90211-3
Trixi.min_max_speed_einfeldt
— Methodmin_max_speed_einfeldt(u_ll, u_rr, orientation::Integer, equations::IdealGlmMhdEquations1D)
Calculate minimum and maximum wave speeds for HLL-type fluxes as in
- Li (2005) An HLLC Riemann solver for magneto-hydrodynamics DOI: 10.1016/j.jcp.2004.08.020.
Trixi.min_max_speed_einfeldt
— Methodmin_max_speed_einfeldt(u_ll, u_rr, orientation::Integer, equations::IdealGlmMhdEquations2D)
Calculate minimum and maximum wave speeds for HLL-type fluxes as in
- Li (2005) An HLLC Riemann solver for magneto-hydrodynamics DOI: 10.1016/j.jcp.2004.08.020.
Trixi.min_max_speed_einfeldt
— Methodmin_max_speed_einfeldt(u_ll, u_rr, orientation_or_normal_direction, equations::IdealGlmMhdEquations3D)
Calculate minimum and maximum wave speeds for HLL-type fluxes as in
- Li (2005) An HLLC Riemann solver for magneto-hydrodynamics DOI: 10.1016/j.jcp.2004.08.020
Trixi.min_max_speed_naive
— Functionmin_max_speed_naive(u_ll, u_rr, orientation::Integer, equations)
min_max_speed_naive(u_ll, u_rr, normal_direction::AbstractVector, equations)
Simple and fast estimate(!) of the minimal and maximal wave speed of the Riemann problem with left and right states u_ll, u_rr
, usually based only on the local wave speeds associated to u_ll
and u_rr
. Slightly more diffusive than min_max_speed_davis
.
- Amiram Harten, Peter D. Lax, Bram van Leer (1983) On Upstream Differencing and Godunov-Type Schemes for Hyperbolic Conservation Laws DOI: 10.1137/1025002
See eq. (10.37) from
- Eleuterio F. Toro (2009) Riemann Solvers and Numerical Methods for Fluid Dynamics: A Practical Introduction DOI: 10.1007/b79761
See also FluxHLL
, min_max_speed_davis
, min_max_speed_einfeldt
.
Trixi.modify_dt_for_tstops!
— Methodmodify_dt_for_tstops!(integrator::PairedExplicitRK)
Modify the time-step size to match the time stops specified in integrator.opts.tstops. To avoid adding OrdinaryDiffEq to Trixi's dependencies, this routine is a copy of https://github.com/SciML/OrdinaryDiffEq.jl/blob/d76335281c540ee5a6d1bd8bb634713e004f62ee/src/integrators/integrator_utils.jl#L38-L54
Trixi.modify_dt_for_tstops!
— Methodmodify_dt_for_tstops!(integrator::SimpleIntegratorSSP)
Modify the time-step size to match the time stops specified in integrator.opts.tstops. To avoid adding OrdinaryDiffEq to Trixi's dependencies, this routine is a copy of https://github.com/SciML/OrdinaryDiffEq.jl/blob/d76335281c540ee5a6d1bd8bb634713e004f62ee/src/integrators/integrator_utils.jl#L38-L54
Trixi.multiply_dimensionwise
— Methodmultiply_dimensionwise(matrix::AbstractMatrix, data_in::AbstractArray{<:Any, NDIMS+1})
Multiply the array data_in
by matrix
in each coordinate direction, where data_in
is assumed to have the first coordinate for the number of variables and the remaining coordinates are multiplied by matrix
.
Trixi.n_nonconservative_terms
— Functionn_nonconservative_terms(equations)
Number of nonconservative terms in the form local * symmetric for a particular equation. This function needs to be specialized only if equations with nonconservative terms are combined with certain solvers (e.g., subcell limiting).
Trixi.ndofs
— Methodndofs(semi::AbstractSemidiscretization)
Return the number of degrees of freedom associated with each scalar variable.
Trixi.ndofsglobal
— Methodndofsglobal(semi::SemidiscretizationCoupled)
Return the global number of degrees of freedom associated with each scalar variable across all MPI ranks, and summed up over all coupled systems. This is the same as ndofs
for simulations running in serial or parallelized via threads. It will in general be different for simulations running in parallel with MPI.
Trixi.ndofsglobal
— Methodndofsglobal(semi::AbstractSemidiscretization)
Return the global number of degrees of freedom associated with each scalar variable across all MPI ranks. This is the same as ndofs
for simulations running in serial or parallelized via threads. It will in general be different for simulations running in parallel with MPI.
Trixi.negative_part
— MethodTrixi.negative_part(x)
Return x
if x
is negative, else zero. In other words, return (x - abs(x)) / 2
for real numbers x
.
Trixi.ode_default_options
— Methodode_default_options()
Return the default options for OrdinaryDiffEq's solve
. Pass ode_default_options()...
to solve
to only return the solution at the final time and enable MPI aware error-based step size control, whenever MPI is used. For example, use solve(ode, alg; ode_default_options()...)
.
Trixi.ode_norm
— Methodode_norm(u, t)
Implementation of the weighted L2 norm of Hairer and Wanner used for error-based step size control in OrdinaryDiffEq.jl. This function is aware of MPI and uses global MPI communication when running in parallel.
You must pass this function as a keyword argument internalnorm=ode_norm
to OrdinaryDiffEq.jl's solve
when using error-based step size control with MPI parallel execution of Trixi.jl.
See the "Advanced Adaptive Stepsize Control" section of the documentation.
Trixi.ode_unstable_check
— Methodode_unstable_check(dt, u, semi, t)
Implementation of the basic check for instability used in OrdinaryDiffEq.jl. Instead of checking something like any(isnan, u)
, this function just checks isnan(dt)
. This helps when using MPI parallelization, since no additional global communication is required and all ranks will return the same result.
You should pass this function as a keyword argument unstable_check=ode_unstable_check
to OrdinaryDiffEq.jl's solve
when using error-based step size control with MPI parallel execution of Trixi.jl.
See the "Miscellaneous" section of the documentation.
Trixi.partition!
— MethodTrixi.partition!(mesh::T8codeMesh)
Partition a T8codeMesh
in order to redistribute elements evenly among MPI ranks.
Arguments
mesh::T8codeMesh
: Initialized mesh object.
Trixi.partition!
— Methodpartition!(mesh::ParallelTreeMesh, allow_coarsening=true)
Partition mesh
using a static domain decomposition algorithm based on leaf cell count and tree structure. If allow_coarsening
is true
, the algorithm will keep leaf cells together on one rank when needed for local coarsening (i.e. when all children of a cell are leaves).
Trixi.positive_part
— MethodTrixi.positive_part(x)
Return x
if x
is positive, else zero. In other words, return (x + abs(x)) / 2
for real numbers x
.
Trixi.pressure
— Methodpressure(rho::Real, equations::LatticeBoltzmannEquations2D)
pressure(u, equations::LatticeBoltzmannEquations2D)
Calculate the macroscopic pressure from the density rho
or the particle distribution functions u
.
Trixi.pressure
— Methodpressure(rho::Real, equations::LatticeBoltzmannEquations3D)
pressure(u, equations::LatticeBoltzmannEquations3D)
Calculate the macroscopic pressure from the density rho
or the particle distribution functions u
.
Trixi.prim2cons
— Functionprim2cons(u, equations)
Convert the primitive variables u
to the conserved variables for a given set of equations
. u
is a vector type of the correct length nvariables(equations)
. Notice the function doesn't include any error checks for the purpose of efficiency, so please make sure your input is correct. The inverse conversion is performed by cons2prim
.
Trixi.residual_steady_state
— Methodresidual_steady_state(du, ::AbstractHyperbolicDiffusionEquations)
Used to determine the termination criterion of a SteadyStateCallback
. For hyperbolic diffusion, this checks convergence of the potential $\phi$.
Trixi.rotate_from_x
— Functionrotate_from_x(u, normal, equations)
Apply the rotation that maps the x-axis onto normal
to the convservative variables u
. This is used by FluxRotated
to calculate the numerical flux of rotationally invariant equations in arbitrary normal directions.
See also: rotate_to_x
Trixi.rotate_to_x
— Functionrotate_to_x(u, normal, equations)
Apply the rotation that maps normal
onto the x-axis to the convservative variables u
. This is used by FluxRotated
to calculate the numerical flux of rotationally invariant equations in arbitrary normal directions.
See also: rotate_from_x
Trixi.save_plot
— Methodsave_plot(plot_data, variable_names;
show_mesh=true, plot_arguments=Dict{Symbol,Any}(),
time=nothing, timestep=nothing)
Visualize the plot data object provided in plot_data
and save result as a PNG file in the out
directory, plotting only the variables in variable_names
and, optionally, the mesh (if show_mesh
is true
). Additionally, plot_arguments
will be unpacked and passed as keyword arguments to the Plots.plot
command.
The timestep
is used in the filename. time
is currently unused by this function.
This is an experimental feature and may change in future releases.
See also: VisualizationCallback
, show_plot
Trixi.set_log_type!
— MethodTrixi.set_log_type!(type; force = true)
Set the type
of the (natural) log
function to be used in Trixi.jl. The default is "sqrt_Trixi_NaN"
which returns NaN
for negative arguments instead of throwing an error. Alternatively, you can set type
to "sqrt_Base"
to use the Julia built-in sqrt
function which provides a stack-trace of the error which might come in handy when debugging code.
Trixi.set_polyester!
— MethodTrixi.set_polyester!(toggle::Bool; force = true)
Toggle the usage of Polyester.jl for multithreading. By default, Polyester.jl is enabled, but it can be useful for performance comparisons to switch to the Julia core backend.
This does not fully disable Polyester.jl, buy only its use as part of Trixi.jl's @threaded
macro.
Trixi.set_sqrt_type!
— MethodTrixi.set_sqrt_type!(type; force = true)
Set the type
of the square root function to be used in Trixi.jl. The default is "sqrt_Trixi_NaN"
which returns NaN
for negative arguments instead of throwing an error. Alternatively, you can set type
to "sqrt_Base"
to use the Julia built-in sqrt
function which provides a stack-trace of the error which might come in handy when debugging code.
Trixi.show_plot
— Methodshow_plot(plot_data, variable_names;
show_mesh=true, plot_arguments=Dict{Symbol,Any}(),
time=nothing, timestep=nothing)
Visualize the plot data object provided in plot_data
and display result, plotting only the variables in variable_names
and, optionally, the mesh (if show_mesh
is true
). Additionally, plot_arguments
will be unpacked and passed as keyword arguments to the Plots.plot
command.
This function is the default plot_creator
argument for the VisualizationCallback
. time
and timestep
are currently unused by this function.
This is an experimental feature and may change in future releases.
See also: VisualizationCallback
, save_plot
Trixi.solve
— Functionsolve(ode, alg; dt, callbacks, kwargs...)
The following structures and methods provide the infrastructure for SSP Runge-Kutta methods of type SimpleAlgorithmSSP
.
Trixi.source_terms_convergence_test
— Methodsource_terms_convergence_test(u, x, t, equations::AcousticPerturbationEquations2D)
Source terms used for convergence tests in combination with initial_condition_convergence_test
.
Trixi.source_terms_convergence_test
— Methodsource_terms_convergence_test(u, x, t, equations::CompressibleEulerEquations1D)
Source terms used for convergence tests in combination with initial_condition_convergence_test
(and BoundaryConditionDirichlet(initial_condition_convergence_test)
in non-periodic domains).
Trixi.source_terms_convergence_test
— Methodsource_terms_convergence_test(u, x, t, equations::CompressibleEulerEquations2D)
Source terms used for convergence tests in combination with initial_condition_convergence_test
(and BoundaryConditionDirichlet(initial_condition_convergence_test)
in non-periodic domains).
Trixi.source_terms_convergence_test
— Methodsource_terms_convergence_test(u, x, t, equations::CompressibleEulerEquations3D)
Source terms used for convergence tests in combination with initial_condition_convergence_test
.
Trixi.source_terms_convergence_test
— Methodsource_terms_convergence_test(u, x, t, equations::CompressibleEulerEquationsQuasi1D)
Source terms used for convergence tests in combination with initial_condition_convergence_test
(and BoundaryConditionDirichlet(initial_condition_convergence_test)
in non-periodic domains).
This manufactured solution source term is specifically designed for the mozzle width 'a(x) = 1.5 - 0.5 * cos(x[1] * pi)' as defined in initial_condition_convergence_test
.
Trixi.source_terms_convergence_test
— Methodsource_terms_convergence_test(u, x, t, equations::CompressibleEulerMulticomponentEquations1D)
Source terms used for convergence tests in combination with initial_condition_convergence_test
(and BoundaryConditionDirichlet(initial_condition_convergence_test)
in non-periodic domains).
Trixi.source_terms_convergence_test
— Methodsource_terms_convergence_test(u, x, t, equations::CompressibleEulerMulticomponentEquations2D)
Source terms used for convergence tests in combination with initial_condition_convergence_test
(and BoundaryConditionDirichlet(initial_condition_convergence_test)
in non-periodic domains).
Trixi.source_terms_convergence_test
— Methodsource_terms_convergence_test(u, x, t, equations::InviscidBurgersEquation1D)
Source terms used for convergence tests in combination with initial_condition_convergence_test
.
Trixi.source_terms_convergence_test
— Methodsource_terms_convergence_test(u, x, t, equations::PolytropicEulerEquations2D)
Source terms used for convergence tests in combination with initial_condition_convergence_test
.
Trixi.source_terms_convergence_test
— Methodsource_terms_convergence_test(u, x, t, equations::ShallowWaterEquations1D)
Source terms used for convergence tests in combination with initial_condition_convergence_test
(and BoundaryConditionDirichlet(initial_condition_convergence_test)
in non-periodic domains).
This manufactured solution source term is specifically designed for the bottom topography function b(x) = 2.0 + 0.5 * sinpi(sqrt(2.0) * x[1])
as defined in initial_condition_convergence_test
.
Trixi.source_terms_convergence_test
— Methodsource_terms_convergence_test(u, x, t, equations::ShallowWaterEquations2D)
Source terms used for convergence tests in combination with initial_condition_convergence_test
(and BoundaryConditionDirichlet(initial_condition_convergence_test)
in non-periodic domains).
This manufactured solution source term is specifically designed for the bottom topography function b(x,y) = 2 + 0.5 * sinpi(sqrt(2) * x) + 0.5 * sinpi(sqrt(2) * y)
as defined in initial_condition_convergence_test
.
Trixi.source_terms_convergence_test
— Methodsource_terms_convergence_test(u, x, t, equations::ShallowWaterEquationsQuasi1D)
Source terms used for convergence tests in combination with initial_condition_convergence_test
(and BoundaryConditionDirichlet(initial_condition_convergence_test)
in non-periodic domains).
This manufactured solution source term is specifically designed for the bottom topography function b(x) = 0.2 - 0.05 * sinpi(sqrt(2) * x[1])
and channel width 'a(x)= 1 + 0.1 * cospi(sqrt(2) * x[1])' as defined in initial_condition_convergence_test
.
Trixi.source_terms_convergence_test
— Methodsource_terms_convergence_test(u, x, t, equations::TrafficFlowLWREquations1D)
Source terms used for convergence tests in combination with initial_condition_convergence_test
.
Trixi.source_terms_eoc_test_coupled_euler_gravity
— Methodsource_terms_eoc_test_coupled_euler_gravity(u, x, t, equations::CompressibleEulerEquations2D)
Setup used for convergence tests of the Euler equations with self-gravity used in
- Michael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593
in combination with initial_condition_eoc_test_coupled_euler_gravity
.
Trixi.source_terms_eoc_test_coupled_euler_gravity
— Methodsource_terms_eoc_test_coupled_euler_gravity(u, x, t, equations::CompressibleEulerEquations3D)
Setup used for convergence tests of the Euler equations with self-gravity used in
- Michael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593
in combination with initial_condition_eoc_test_coupled_euler_gravity
.
Trixi.source_terms_eoc_test_euler
— Methodsource_terms_eoc_test_euler(u, x, t, equations::CompressibleEulerEquations2D)
Setup used for convergence tests of the Euler equations with self-gravity used in
- Michael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593
in combination with initial_condition_eoc_test_coupled_euler_gravity
.
Trixi.source_terms_eoc_test_euler
— Methodsource_terms_eoc_test_euler(u, x, t, equations::CompressibleEulerEquations3D)
Setup used for convergence tests of the Euler equations with self-gravity used in
- Michael Schlottke-Lakemper, Andrew R. Winters, Hendrik Ranocha, Gregor J. Gassner (2020) A purely hyperbolic discontinuous Galerkin approach for self-gravitating gas dynamics arXiv: 2008.10593
in combination with initial_condition_eoc_test_coupled_euler_gravity
.
This method is to be used for testing pure Euler simulations with analytic self-gravity. If you intend to do coupled Euler-gravity simulations, you need to use source_terms_eoc_test_coupled_euler_gravity
instead.
Trixi.source_terms_harmonic
— Methodsource_terms_harmonic(u, x, t, equations::HyperbolicDiffusionEquations1D)
Source term that only includes the forcing from the hyperbolic diffusion system.
Trixi.source_terms_harmonic
— Methodsource_terms_harmonic(u, x, t, equations::HyperbolicDiffusionEquations2D)
Source term that only includes the forcing from the hyperbolic diffusion system.
Trixi.source_terms_harmonic
— Methodsource_terms_harmonic(u, x, t, equations::HyperbolicDiffusionEquations3D)
Source term that only includes the forcing from the hyperbolic diffusion system.
Trixi.source_terms_poisson_nonperiodic
— Methodsource_terms_poisson_nonperiodic(u, x, t,
equations::HyperbolicDiffusionEquations1D)
Source terms that include the forcing function f(x)
and right hand side for the hyperbolic diffusion system that is used with initial_condition_poisson_nonperiodic
and boundary_condition_poisson_nonperiodic
.
Trixi.splitting_coirier_vanleer
— Methodsplitting_coirier_vanleer(u, orientation::Integer,
equations::CompressibleEulerEquations1D)
splitting_coirier_vanleer(u, which::Union{Val{:minus}, Val{:plus}}
orientation::Integer,
equations::CompressibleEulerEquations1D)
Splitting of the compressible Euler flux from Coirier and van Leer. The splitting has correction terms in the pressure splitting as well as the mass and energy flux components. The motivation for these corrections are to handle flows at the low Mach number limit.
Returns a tuple of the fluxes "minus" (associated with waves going into the negative axis direction) and "plus" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which
set to Val{:minus}()
or Val{:plus}()
.
This is an experimental feature and may change in future releases.
References
- William Coirier and Bram van Leer (1991) Numerical flux formulas for the Euler and Navier-Stokes equations. II - Progress in flux-vector splitting DOI: 10.2514/6.1991-1566
Trixi.splitting_drikakis_tsangaris
— Methodsplitting_drikakis_tsangaris(u, orientation_or_normal_direction,
equations::CompressibleEulerEquations2D)
splitting_drikakis_tsangaris(u, which::Union{Val{:minus}, Val{:plus}}
orientation_or_normal_direction,
equations::CompressibleEulerEquations2D)
Improved variant of the Steger-Warming flux vector splitting splitting_steger_warming
for generalized coordinates. This splitting also reformulates the energy flux as in Hänel et al. to obtain conservation of the total temperature for inviscid flows.
Returns a tuple of the fluxes "minus" (associated with waves going into the negative axis direction) and "plus" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which
set to Val{:minus}()
or Val{:plus}()
.
This is an experimental feature and may change in future releases.
References
- D. Drikakis and S. Tsangaris (1993) On the solution of the compressible Navier-Stokes equations using improved flux vector splitting methods DOI: 10.1016/0307-904X(93)90054-K
- D. Hänel, R. Schwane and G. Seider (1987) On the accuracy of upwind schemes for the solution of the Navier-Stokes equations DOI: 10.2514/6.1987-1105
Trixi.splitting_lax_friedrichs
— Methodsplitting_lax_friedrichs(u, orientation_or_normal_direction,
equations::CompressibleEulerEquations2D)
splitting_lax_friedrichs(u, which::Union{Val{:minus}, Val{:plus}}
orientation_or_normal_direction,
equations::CompressibleEulerEquations2D)
Naive local Lax-Friedrichs style flux splitting of the form f⁺ = 0.5 (f + λ u)
and f⁻ = 0.5 (f - λ u)
similar to a flux splitting one would apply, e.g., to Burgers' equation.
Returns a tuple of the fluxes "minus" (associated with waves going into the negative axis direction) and "plus" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which
set to Val{:minus}()
or Val{:plus}()
.
This is an experimental feature and may change in future releases.
Trixi.splitting_lax_friedrichs
— Methodsplitting_lax_friedrichs(u, orientation::Integer,
equations::InviscidBurgersEquation1D)
splitting_lax_friedrichs(u, which::Union{Val{:minus}, Val{:plus}}
orientation::Integer,
equations::InviscidBurgersEquation1D)
Naive local Lax-Friedrichs style flux splitting of the form f⁺ = 0.5 (f + λ u)
and f⁻ = 0.5 (f - λ u)
where λ = abs(u)
.
Returns a tuple of the fluxes "minus" (associated with waves going into the negative axis direction) and "plus" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which
set to Val{:minus}()
or Val{:plus}()
.
This is an experimental feature and may change in future releases.
Trixi.splitting_lax_friedrichs
— Methodsplitting_lax_friedrichs(u, orientation::Integer,
equations::LinearScalarAdvectionEquation1D)
splitting_lax_friedrichs(u, which::Union{Val{:minus}, Val{:plus}}
orientation::Integer,
equations::LinearScalarAdvectionEquation1D)
Naive local Lax-Friedrichs style flux splitting of the form f⁺ = 0.5 (f + λ u)
and f⁻ = 0.5 (f - λ u)
where λ
is the absolute value of the advection velocity.
Returns a tuple of the fluxes "minus" (associated with waves going into the negative axis direction) and "plus" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which
set to Val{:minus}()
or Val{:plus}()
.
This is an experimental feature and may change in future releases.
Trixi.splitting_steger_warming
— Methodsplitting_steger_warming(u, orientation::Integer,
equations::CompressibleEulerEquations1D)
splitting_steger_warming(u, which::Union{Val{:minus}, Val{:plus}}
orientation::Integer,
equations::CompressibleEulerEquations1D)
Splitting of the compressible Euler flux of Steger and Warming.
Returns a tuple of the fluxes "minus" (associated with waves going into the negative axis direction) and "plus" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which
set to Val{:minus}()
or Val{:plus}()
.
This is an experimental feature and may change in future releases.
References
- Joseph L. Steger and R. F. Warming (1979) Flux Vector Splitting of the Inviscid Gasdynamic Equations With Application to Finite Difference Methods NASA Technical Memorandum
Trixi.splitting_steger_warming
— Methodsplitting_steger_warming(u, orientation::Integer,
equations::CompressibleEulerEquations2D)
splitting_steger_warming(u, which::Union{Val{:minus}, Val{:plus}}
orientation::Integer,
equations::CompressibleEulerEquations2D)
Splitting of the compressible Euler flux of Steger and Warming. For curvilinear coordinates use the improved Steger-Warming-type splitting splitting_drikakis_tsangaris
.
Returns a tuple of the fluxes "minus" (associated with waves going into the negative axis direction) and "plus" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which
set to Val{:minus}()
or Val{:plus}()
.
This is an experimental feature and may change in future releases.
References
- Joseph L. Steger and R. F. Warming (1979) Flux Vector Splitting of the Inviscid Gasdynamic Equations With Application to Finite Difference Methods NASA Technical Memorandum
Trixi.splitting_steger_warming
— Methodsplitting_steger_warming(u, orientation::Integer,
equations::CompressibleEulerEquations3D)
splitting_steger_warming(u, which::Union{Val{:minus}, Val{:plus}}
orientation::Integer,
equations::CompressibleEulerEquations3D)
Splitting of the compressible Euler flux of Steger and Warming.
Returns a tuple of the fluxes "minus" (associated with waves going into the negative axis direction) and "plus" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which
set to Val{:minus}()
or Val{:plus}()
.
This is an experimental feature and may change in future releases.
References
- Joseph L. Steger and R. F. Warming (1979) Flux Vector Splitting of the Inviscid Gasdynamic Equations With Application to Finite Difference Methods NASA Technical Memorandum
Trixi.splitting_vanleer_haenel
— Methodsplitting_vanleer_haenel(u, orientation_or_normal_direction,
equations::CompressibleEulerEquations2D)
splitting_vanleer_haenel(u, which::Union{Val{:minus}, Val{:plus}}
orientation_or_normal_direction,
equations::CompressibleEulerEquations2D)
Splitting of the compressible Euler flux from van Leer. This splitting further contains a reformulation due to Hänel et al. where the energy flux uses the enthalpy. The pressure splitting is independent from the splitting of the convective terms. As such there are many pressure splittings suggested across the literature. We implement the 'p4' variant suggested by Liou and Steffen as it proved the most robust in practice. For details on the curvilinear variant of this flux vector splitting see Anderson et al.
Returns a tuple of the fluxes "minus" (associated with waves going into the negative axis direction) and "plus" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which
set to Val{:minus}()
or Val{:plus}()
.
This is an experimental feature and may change in future releases.
References
- Bram van Leer (1982) Flux-Vector Splitting for the Euler Equation DOI: 10.1007/978-3-642-60543-7_5
- D. Hänel, R. Schwane and G. Seider (1987) On the accuracy of upwind schemes for the solution of the Navier-Stokes equations DOI: 10.2514/6.1987-1105
- Meng-Sing Liou and Chris J. Steffen, Jr. (1991) High-Order Polynomial Expansions (HOPE) for Flux-Vector Splitting NASA Technical Memorandum
- W. Kyle Anderson, James L. Thomas, and Bram van Leer (1986) Comparison of Finite Volume Flux Vector Splittings for the Euler Equations DOI: 10.2514/3.9465
Trixi.splitting_vanleer_haenel
— Methodsplitting_vanleer_haenel(u, orientation::Integer,
equations::CompressibleEulerEquations1D)
splitting_vanleer_haenel(u, which::Union{Val{:minus}, Val{:plus}}
orientation::Integer,
equations::CompressibleEulerEquations1D)
Splitting of the compressible Euler flux from van Leer. This splitting further contains a reformulation due to Hänel et al. where the energy flux uses the enthalpy. The pressure splitting is independent from the splitting of the convective terms. As such there are many pressure splittings suggested across the literature. We implement the 'p4' variant suggested by Liou and Steffen as it proved the most robust in practice.
Returns a tuple of the fluxes "minus" (associated with waves going into the negative axis direction) and "plus" (associated with waves going into the positive axis direction). If only one of the fluxes is required, use the function signature with argument which
set to Val{:minus}()
or Val{:plus}()
.
This is an experimental feature and may change in future releases.
References
- Bram van Leer (1982) Flux-Vector Splitting for the Euler Equation DOI: 10.1007/978-3-642-60543-7_5
- D. Hänel, R. Schwane and G. Seider (1987) On the accuracy of upwind schemes for the solution of the Navier-Stokes equations DOI: 10.2514/6.1987-1105
- Meng-Sing Liou and Chris J. Steffen, Jr. (1991) High-Order Polynomial Expansions (HOPE) for Flux-Vector Splitting NASA Technical Memorandum
Trixi.stolarsky_mean
— MethodTrixi.stolarsky_mean(x::Real, y:Real, gamma::Real)
Compute an instance of a weighted Stolarsky mean of the form
stolarsky_mean(x, y, gamma) = (gamma - 1)/gamma * (y^gamma - x^gamma) / (y^(gamma-1) - x^(gamma-1))
where gamma > 1
.
Problem: The formula above has a removable singularity at x == y
. Thus, some care must be taken to implement it correctly without problems or loss of accuracy when x ≈ y
. Here, we use the approach proposed by Winters et al. (2020). Set f = (y - x) / (y + x) and g = gamma (for compact notation). Then, we use the expansions
((1+f)^g - (1-f)^g) / g = 2*f + (g-1)(g-2)/3 * f^3 + (g-1)(g-2)(g-3)(g-4)/60 * f^5 + O(f^7)
and
((1+f)^(g-1) - (1-f)^(g-1)) / (g-1) = 2*f + (g-2)(g-3)/3 * f^3 + (g-2)(g-3)(g-4)(g-5)/60 * f^5 + O(f^7)
Inserting the first few terms of these expansions and performing polynomial long division we find that
stolarsky_mean(x, y, gamma) ≈ (y + x) / 2 * (1 + (g-2)/3 * f^2 - (g+1)(g-2)(g-3)/45 * f^4 + (g+1)(g-2)(g-3)(2g(g-2)-9)/945 * f^6)
Since divisions are usually more expensive on modern hardware than multiplications (Agner Fog), we try to avoid computing two divisions. Thus, we use
f^2 = (y - x)^2 / (x + y)^2
= (x * (x - 2 * y) + y * y) / (x * (x + 2 * y) + y * y)
Given ε = 1.0e-4, we use the following algorithm.
if f^2 < ε
# use the expansion above
else
# use the direct formula (gamma - 1)/gamma * (y^gamma - x^gamma) / (y^(gamma-1) - x^(gamma-1))
end
References
- Andrew R. Winters, Christof Czernik, Moritz B. Schily & Gregor J. Gassner (2020) Entropy stable numerical approximations for the isothermal and polytropic Euler equations DOI: 10.1007/s10543-019-00789-w
- Agner Fog. Lists of instruction latencies, throughputs and micro-operation breakdowns for Intel, AMD, and VIA CPUs. https://www.agner.org/optimize/instruction_tables.pdf
Trixi.totalgamma
— Methodtotalgamma(u, equations::CompressibleEulerMulticomponentEquations1D)
Function that calculates the total gamma out of all partial gammas using the partial density fractions as well as the partial specific heats at constant volume.
Trixi.totalgamma
— Methodtotalgamma(u, equations::CompressibleEulerMulticomponentEquations2D)
Function that calculates the total gamma out of all partial gammas using the partial density fractions as well as the partial specific heats at constant volume.
Trixi.uses_amr
— Methoduses_amr(callback)
Checks whether the provided callback or CallbackSet
is an AMRCallback
or contains one.
Trixi.varnames
— Functionvarnames(conversion_function, equations)
Return the list of variable names when applying conversion_function
to the conserved variables associated to equations
. This function is mainly used internally to determine output to screen and for IO, e.g., for the AnalysisCallback
and the SaveSolutionCallback
. Common choices of the conversion_function
are cons2cons
and cons2prim
.
Trixi.velocity
— Functionvelocity(u, equations)
Return the velocity vector corresponding to the equations, e.g., fluid velocity for Euler's equations. The velocity in certain orientation or normal direction (scalar) can be computed with velocity(u, orientation, equations)
or velocity(u, normal_direction, equations)
respectively. The velocity(u, normal_direction, equations)
function calls velocity(u, equations)
to compute the velocity vector and then normal vector, thus allowing a general function to be written for the AbstractEquations type. However, the velocity(u, orientation, equations)
is written for each equation separately to ensure only the velocity in the desired direction (orientation) is computed. u
is a vector of the conserved variables at a single node, i.e., a vector of the correct length nvariables(equations)
.
Trixi.velocity
— Methodvelocity(u, orientation, equations::LatticeBoltzmannEquations2D)
Calculate the macroscopic velocity for the given orientation
(1 -> x, 2 -> y) from the particle distribution functions u
.
Trixi.velocity
— Methodvelocity(u, orientation, equations::LatticeBoltzmannEquations3D)
Calculate the macroscopic velocity for the given orientation
(1 -> x, 2 -> y, 3 -> z) from the particle distribution functions u
.
Trixi.velocity
— Methodvelocity(u, equations::LatticeBoltzmannEquations2D)
Calculate the macroscopic velocity vector from the particle distribution functions u
.
Trixi.velocity
— Methodvelocity(u, equations::LatticeBoltzmannEquations3D)
Calculate the macroscopic velocity vector from the particle distribution functions u
.
Trixi.@autoinfiltrate
— Macro@autoinfiltrate
@autoinfiltrate condition::Bool
Invoke the @infiltrate
macro of the package Infiltrator.jl to create a breakpoint for ad-hoc interactive debugging in the REPL. If the optional argument condition
is given, the breakpoint is only enabled if condition
evaluates to true
.
As opposed to using Infiltrator.@infiltrate
directly, this macro does not require Infiltrator.jl to be added as a dependency to Trixi.jl. As a bonus, the macro will also attempt to load the Infiltrator module if it has not yet been loaded manually.
Note: For this macro to work, the Infiltrator.jl package needs to be installed in your current Julia environment stack.
See also: Infiltrator.jl
Please note that this macro is intended for internal use only. It is not part of the public API of Trixi.jl, and it thus can altered (or be removed) at any time without it being considered a breaking change.
Trixi.@threaded
— Macro@threaded for ... end
Semantically the same as Threads.@threads
when iterating over a AbstractUnitRange
but without guarantee that the underlying implementation uses Threads.@threads
or works for more general for
loops. In particular, there may be an additional check whether only one thread is used to reduce the overhead of serial execution or the underlying threading capabilities might be provided by other packages such as Polyester.jl.
This macro does not necessarily work for general for
loops. For example, it does not necessarily support general iterables such as eachline(filename)
.
Some discussion can be found at https://discourse.julialang.org/t/overhead-of-threads-threads/53964 and https://discourse.julialang.org/t/threads-threads-with-one-thread-how-to-remove-the-overhead/58435.