Peano
Loading...
Searching...
No Matches
exagrype.api.euler.Euler.Euler Class Reference

Compressible Euler equations of an ideal gas. More...

Inheritance diagram for exagrype.api.euler.Euler.Euler:
Collaboration diagram for exagrype.api.euler.Euler.Euler:

Public Member Functions

 __init__ (self, str name, float gamma=1.4, exahype2.api.InitPointWisely initial_condition=None)
 Create an Euler solver.
 add_auxiliary_variables (self, exahype2.api.AuxiliaryVariables auxiliary)
 Attach a set of auxiliary variables and hand it to flux, source and eigenvalue.
 generate_solver_realisation (self, *args, **kwargs)
 Reject solvers that do not see the CCZ4 fields.
float gamma (self)
 Adiabatic index of the gas.
Public Member Functions inherited from exahype2.api.Solver.Solver
 __init__ (self, str name, VariableSpecification unknowns)
 Create solver.
str __str__ (self)
str name (self)
 Unique solver name.
"Solver.NumericalScheme" numerical_scheme (self)
 numerical_scheme (self, "Solver.NumericalScheme" value)
List["Solver.Plotter"] plotters (self)
 All plotters of the solver, in the order they have been added.
 add_plotter (self, "Solver.Plotter" plotter)
 Add a plotter to the solver.
"Solver.Plotter" plotter (self)
 Shorthand for solvers with at most one plotter.
 plotter (self, "Solver.Plotter" value)
int unknowns (self)
List["AuxiliaryVariables"] auxiliary_variables (self)
 All sets of auxiliary variables in the order they have been attached.
int number_of_auxiliary_variables (self)
 Total number of entries of all sets of auxiliary variables.
int auxiliary_variable_offset (self, "AuxiliaryVariables" auxiliary)
 Offset of the first entry of a set within the buffer the compute kernels work on, i.e.
str signature_of (self, PDETerm term)
 The signature of a PDE term including the pointers to the auxiliary variables.
str user_solver_includes (self)
 Add further includes to this property, if your solver requires some additional routines from other header files.
 add_user_solver_includes (self, str value)
 Add further includes to this property, if your solver requires some additional routines from other header files.
 set_solver_constants (self, str datastring)
 add_solver_constants (self, str datastring)
List[str] variable_names_per_entry (self)
 One name per entry of Q, i.e.
str get_name_of_global_instance (self)
List[PDETerm] pde_terms (self)
 All PDE terms (flux, eigenvalues, ...) registered with this solver, in registration order.
bool requires_user_class (self)
 True iff at least one PDE term has no implementation.
str get_name_of_solver_class (self)
 Name of the C++ class the solver repository instantiates: <SolverName> if requires_user_class, Abstract<SolverName> otherwise.
 add_pde_term (self, PDETerm term)
 Register a PDE term with this solver, or replace the one already registered under the same name and statelessness.
 remove_pde_term (self, str name, bool stateless=False)
 Remove a previously registered PDE term by name and statelessness.
PDETerm get_pde_term (self, str name, bool stateless=False)
 Look up a previously registered PDE term by name and statelessness.
 add_abstract_solver_attribute (self, str declaration)
 Add a raw C++ member attribute declaration to the generated Abstract<SolverName> class (.
 add_abstract_solver_method (self, str declaration, Callable[[str], str] definition_generator)
 Add a raw C++ method to the generated Abstract<SolverName> class: declaration goes into the class body (public section), verbatim.
str create_readme_descriptor (self, domain_offset, domain_size)
 Return a human-readable description of this solver instance, to be embedded into the generated project's README.

Static Public Attributes

dict Unknowns
Static Public Attributes inherited from exahype2.api.Solver.Solver
str SolutionUpdateTaskTag = "exahype2.api.Solver.SolutionUpdateTaskTag"
 Tag of all tasks which write a new solution.
str IntermediateSolutionUpdateTag = "exahype2.api.Solver.IntermediateSolutionUpdateTag"
 Tag of all tasks which write an intermediate solution.

Protected Member Functions

 _refresh_pde_terms (self)
 Rebuild the implementations of flux, source and eigenvalue from the hooks.
 _ccz4_fields_set (self)
 The set of auxiliary variables which holds the CCZ4 fields.
str _ccz4_fields (self)
 C++ expression of the pointer to the CCZ4 fields in a PDE term.
str _flux_implementation (self)
 C++ of the flux along normal.
str _source_implementation (self)
 C++ of the volumetric source.
str _max_eigenvalue_implementation (self)
Protected Member Functions inherited from exahype2.api.Solver.Solver
int _register_variables (self, VariableSpecification variables, int offset)
 Translate a plain int or a name-to-multiplicity dict into a total variable count, and - for the dict case - add each name's position within Q to _variable_positions.
str _get_default_includes (self)
 Includes every generated action set can rely on being available, regardless of which action sets a concrete discretisation (e.g.
str _unknown_identifier (self)
 _add_wants_to_plot_to_solver (self)
 Add wantsToPlot() to the solver's C++ class: It holds if any of the solver's plotters is active (exahype2.api.Solver.Solver.Plotter).
 _add_checkpoint_meta_data_to_solver (self)
 Override exahype2.Solver.toCheckpointMetaData() in the solver's C++ class such that it also writes the attributes added through add_abstract_solver_attribute(), e.g.

Protected Attributes

float _gamma = gamma
 _flux = exahype2.api.Flux(implementation="", stateless=True)
 _source = exahype2.api.VolumetricSource(implementation="", stateless=True)
 _max_eigenvalue
Protected Attributes inherited from exahype2.api.Solver.Solver
str _name = name
 Create solver.
dict _variable_positions = {}
 Translate a plain int or a name-to-multiplicity dict into a total variable count, and - for the dict case - add each name's position within Q to _variable_positions.
int _unknowns = self._register_variables(unknowns, 0)
list _auxiliary_variables = []
 All sets of auxiliary variables in the order they have been attached.
str _user_solver_includes = ""
str _solver_constants = ""
dict _pde_terms = {}
list _abstract_solver_attributes = []
list _abstract_solver_methods = []
 _numerical_scheme = None
list _plotters = []
 Turn this solver specification into a task graph and create the required C++ kernels/stubs.

Additional Inherited Members

Data Fields inherited from exahype2.api.Solver.Solver
 solver_generator = SolverToCPPFiles(self)
 grid_construction = None
tuple mesh_adaptation = None
 Turn this solver specification into a task graph and create the required C++ kernels/stubs.
tuple grid_selector
str compute_kernel_call = None
 pde_terms
 True iff at least one PDE term has no implementation.

Detailed Description

Compressible Euler equations of an ideal gas.

The solver evolves the five conserved quantities density, momentum and total energy,

\( \\partial_t \\begin{pmatrix} \\rho \\\\ j \\\\ E \\end{pmatrix} + \\nabla \\cdot \\begin{pmatrix} j \\\\ j \\otimes j / \\rho + p I \\\\ (E+p) j / \\rho \\end{pmatrix} = 0, \\qquad p = (\\gamma-1) \\left(E - \\frac{|j|^2}{2\\rho}\\right), \)

in three dimensions. It has a flux, a maximum eigenvalue, a source term and an initial condition, all of them stateless. The source term is zero. Flux, source and eigenvalue see the CCZ4 fields, even though they ignore them at the moment. The solver always holds a set of auxiliary variables with the 58 entries of first-order CCZ4, which the user attaches (add_auxiliary_variables()); generating the solver without it fails. By default, the initial condition is a density wave which the fluid advects with constant velocity (initialvalues.smooth_wave()).

The solver is deliberately plain. Its purpose within ExaGRyPE is to be the matter ingredient which one couples to exagrype.api.FOCCZ4Solver. The assembly of such a coupled system is not part of this class, but done by the user (see benchmarks/exagrype/gauge-wave-with-Euler), who typically attaches auxiliary variables (exahype2.api.AuxiliaryVariables) with the spacetime to the solver, and replaces the flux and the source term through the hooks _flux_implementation() and _source_implementation().

Shortcomings

  • The equations are those of flat-space hydrodynamics, i.e. the solver knows nothing about general relativity on its own.
  • Only ideal gases are supported, and there is no positivity limiter.

Definition at line 11 of file Euler.py.

Constructor & Destructor Documentation

◆ __init__()

exagrype.api.euler.Euler.Euler.__init__ ( self,
str name,
float gamma = 1.4,
exahype2.api.InitPointWisely initial_condition = None )

Create an Euler solver.

Parameters
namestr Name of the solver, exahype2.api.Solver.
gammafloat Adiabatic index of the ideal gas. Has to be greater than one.
initial_conditionexahype2.api.InitPointWisely Initial condition. Defaults to exagrype.api.euler.initialvalues.smooth_wave().

Definition at line 58 of file Euler.py.

References __init__(), and Unknowns.

Referenced by __init__().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ _ccz4_fields()

str exagrype.api.euler.Euler.Euler._ccz4_fields ( self)
protected

C++ expression of the pointer to the CCZ4 fields in a PDE term.

The kernels of exagrype.euler take it as ccz4Fields.

Definition at line 180 of file Euler.py.

References _ccz4_fields_set().

Here is the call graph for this function:

◆ _ccz4_fields_set()

exagrype.api.euler.Euler.Euler._ccz4_fields_set ( self)
protected

The set of auxiliary variables which holds the CCZ4 fields.

It is the set with as many entries as FOCCZ4Solver has unknowns. Other sets (such as the lapse of a toy coupling) are not handed to the kernels.

Returns
exahype2.api.AuxiliaryVariables The set, or None if it has not been attached yet.

Definition at line 159 of file Euler.py.

References exahype2.api.Solver.Solver.auxiliary_variables().

Referenced by _ccz4_fields(), _refresh_pde_terms(), and generate_solver_realisation().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _flux_implementation()

str exagrype.api.euler.Euler.Euler._flux_implementation ( self)
protected

C++ of the flux along normal.

Hook for subclasses, which can scale or modify the flux, e.g. by the lapse of a spacetime they hold as auxiliary variables. The code has the variables Q, x, normal and F at hand, plus one pointer per set of auxiliary variables (the CCZ4 fields: _ccz4_fields()). The default calls exagrype.euler.flux().

Definition at line 195 of file Euler.py.

Referenced by solvers.fv.FV.FV.__str__(), and _refresh_pde_terms().

Here is the caller graph for this function:

◆ _max_eigenvalue_implementation()

str exagrype.api.euler.Euler.Euler._max_eigenvalue_implementation ( self)
protected

Definition at line 225 of file Euler.py.

Referenced by _refresh_pde_terms().

Here is the caller graph for this function:

◆ _refresh_pde_terms()

exagrype.api.euler.Euler.Euler._refresh_pde_terms ( self)
protected

Rebuild the implementations of flux, source and eigenvalue from the hooks.

Nothing happens before the set with the CCZ4 fields has been attached, as the kernels need it.

Definition at line 144 of file Euler.py.

References _ccz4_fields_set(), _flux, _flux_implementation(), solvers.aderdg.AbstractSolverDeclarations.AbstractSolverDeclarations._flux_implementation, solvers.aderdg.AbstractSolverDefinitions.AbstractSolverDefinitions._flux_implementation, solvers.aderdg.ADERDG.ADERDG._flux_implementation, solvers.aderdg.SolverDeclarations.SolverDeclarations._flux_implementation, solvers.aderdg.SolverDefinitions.SolverDefinitions._flux_implementation, solvers.fv.musclhancock.GlobalAdaptiveTimeStep.GlobalAdaptiveTimeStep._flux_implementation, solvers.fv.musclhancock.GlobalFixedTimeStep.GlobalFixedTimeStep._flux_implementation, solvers.fv.riemann.GlobalAdaptiveTimeStep.GlobalAdaptiveTimeStep._flux_implementation, solvers.fv.riemann.GlobalAdaptiveTimeStepWithEnclaveTasking.GlobalAdaptiveTimeStepWithEnclaveTasking._flux_implementation, solvers.fv.riemann.GlobalFixedTimeStep.GlobalFixedTimeStep._flux_implementation, solvers.fv.riemann.GlobalFixedTimeStepWithEnclaveTasking.GlobalFixedTimeStepWithEnclaveTasking._flux_implementation, solvers.fv.rusanov.GlobalAdaptiveTimeStep.GlobalAdaptiveTimeStep._flux_implementation, solvers.fv.rusanov.GlobalAdaptiveTimeStepWithEnclaveTasking.GlobalAdaptiveTimeStepWithEnclaveTasking._flux_implementation, solvers.fv.rusanov.GlobalFixedTimeStep.GlobalFixedTimeStep._flux_implementation, solvers.fv.rusanov.GlobalFixedTimeStepWithEnclaveTasking.GlobalFixedTimeStepWithEnclaveTasking._flux_implementation, solvers.fv.rusanov.LocalTimeStepWithEnclaveTasking.LocalTimeStepWithEnclaveTasking._flux_implementation, solvers.fv.rusanov.SubcyclingAdaptiveTimeStepWithEnclaveTasking.SubcyclingAdaptiveTimeStepWithEnclaveTasking._flux_implementation, solvers.fv.rusanov.SubcyclingFixedTimeStep.SubcyclingFixedTimeStep._flux_implementation, solvers.fv.rusanov.SubcyclingFixedTimeStepWithEnclaveTasking.SubcyclingFixedTimeStepWithEnclaveTasking._flux_implementation, solvers.rkdg.RungeKuttaDG.RungeKuttaDG._flux_implementation, _max_eigenvalue, exagrype.api.CCZ4SolverBase.CCZ4SolverBase._max_eigenvalue_implementation(), _max_eigenvalue_implementation(), exagrype.api.actionsets.CopyPatchWithLinearInterpolation.CopyPatchWithLinearInterpolation._source, _source, exagrype.api.CCZ4SolverBase.CCZ4SolverBase._source_implementation(), and _source_implementation().

Referenced by add_auxiliary_variables().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _source_implementation()

str exagrype.api.euler.Euler.Euler._source_implementation ( self)
protected

C++ of the volumetric source.

Hook for subclasses. The code has Q, x, t and S at hand, plus the arguments of _flux_implementation(). The default calls exagrype.euler.source(), which yields zero.

Definition at line 211 of file Euler.py.

Referenced by _refresh_pde_terms().

Here is the caller graph for this function:

◆ add_auxiliary_variables()

exagrype.api.euler.Euler.Euler.add_auxiliary_variables ( self,
exahype2.api.AuxiliaryVariables auxiliary )

Attach a set of auxiliary variables and hand it to flux, source and eigenvalue.

The sets are not known when the constructor creates the PDE terms, so the terms are (re)built from the hooks whenever a set arrives. They stay empty until the first set has been attached.

Parameters
auxiliaryexahype2.api.AuxiliaryVariables The set, exahype2.api.Solver.add_auxiliary_variables().

Reimplemented from exahype2.api.Solver.Solver.

Definition at line 106 of file Euler.py.

References _refresh_pde_terms(), and add_auxiliary_variables().

Referenced by exagrype.api.scalarfield.ScalarField.ScalarField.__init__(), and add_auxiliary_variables().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gamma()

float exagrype.api.euler.Euler.Euler.gamma ( self)

Adiabatic index of the gas.

Definition at line 191 of file Euler.py.

References _gamma.

◆ generate_solver_realisation()

exagrype.api.euler.Euler.Euler.generate_solver_realisation ( self,
* args,
** kwargs )

Reject solvers that do not see the CCZ4 fields.

The Euler solver is the matter part of a coupled system with first-order CCZ4. Hence, it always holds a set of auxiliary variables with as many entries as FOCCZ4Solver has unknowns. Flux, source and eigenvalue rely on this and do not handle solvers without auxiliary variables. The check runs at generation time, as the sets are attached after the constructor.

Reimplemented from exahype2.api.Solver.Solver.

Definition at line 122 of file Euler.py.

References _ccz4_fields_set(), and generate_solver_realisation().

Referenced by generate_solver_realisation().

Here is the call graph for this function:
Here is the caller graph for this function:

Field Documentation

◆ _flux

exagrype.api.euler.Euler.Euler._flux = exahype2.api.Flux(implementation="", stateless=True)
protected

Definition at line 94 of file Euler.py.

Referenced by _refresh_pde_terms().

◆ _gamma

float exagrype.api.euler.Euler.Euler._gamma = gamma
protected

Definition at line 81 of file Euler.py.

Referenced by gamma(), and exaparty.api.sphtools.riemann.RiemannSolver.get_soundspeed().

◆ _max_eigenvalue

exagrype.api.euler.Euler.Euler._max_eigenvalue
protected
Initial value:
implementation="", stateless=True
)
The maximum absolute eigenvalue of the flux Jacobian in a given direction, i.e.

Definition at line 96 of file Euler.py.

Referenced by _refresh_pde_terms().

◆ _source

exagrype.api.euler.Euler.Euler._source = exahype2.api.VolumetricSource(implementation="", stateless=True)
protected

Definition at line 95 of file Euler.py.

Referenced by _refresh_pde_terms().

◆ Unknowns


The documentation for this class was generated from the following file: