Peano
Loading...
Searching...
No Matches
exagrype.api.CCZ4SolverBase.CCZ4SolverBase Class Reference

Everything the first-order and the second-order CCZ4 solvers share. More...

Inheritance diagram for exagrype.api.CCZ4SolverBase.CCZ4SolverBase:
Collaboration diagram for exagrype.api.CCZ4SolverBase.CCZ4SolverBase:

Data Structures

class  EnforceCCZ4Constraint
 When to push the solution back onto the algebraic CCZ4 constraints. More...

Public Member Functions

 __init__ (self, str name, Dict[str, int] unknowns, Dict[str, Union[int, float]] parameters=None)
 Create a CCZ4 solver.
List[str] advected_quantities (self)
 The unknowns whose advection terms the kernels of exagrype.ccz4 leave out.
bool ncp_adds_advection (self)
 Whether the non-conservative product has to add the advection terms.
 enforce_ccz4_constraint (self, "CCZ4SolverBase.EnforceCCZ4Constraint" value)
 Set when the solver pushes the solution back onto the CCZ4 constraints.
 generate_solver_realisation (self, exahype2_project, peano_project, setup_simulation, time_step, plot, mesh_adaptation, add_global_tasks=True)
 Create the solver's task graphs and insert the constraint enforcement.
Dict[str, Union[int, float]] parameters (self)
 The CCZ4 parameters the solver is generated with (read-only copy).
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.
 add_auxiliary_variables (self, "AuxiliaryVariables" auxiliary)
 Attach a set of auxiliary variables to the solver.
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

int NUMBER_OF_CCZ4_ENTRIES = 58
 DefaultParameters
tuple Switches = ("CCZ4LapseType", "CCZ4b", "CCZ4s")
str ADVECTION_VELOCITY = "shift"
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

 _advection_indices (self)
 Indices of the velocity components (ADVECTION_VELOCITY) and of the advected unknowns (advected_quantities()) within Q, in the form both the lopsided advection of the scheme and exahype2.fd.addCentralAdvection() take them.
 _tasks_of_this_solver (self, time_step, tag)
 Tasks of time_step which carry tag and belong to this solver, as the graph holds the tasks of all solvers.
 _insert_constraint_enforcement (self, time_step, anchors, patch)
 Insert the enforcement of the CCZ4 constraints after anchors.
str _enforcement_implementation (self)
 C++ which pushes the unknowns Q of one volume back onto the constraints.
 _register_pde_terms (self)
 Register the source and the maximum eigenvalue.
 _register_non_conservative_product (self, bool advection)
 Register the non-conservative product, with or without the advection terms.
str _ncp_implementation (self)
 C++ which calls the non-conservative product kernel.
str _advection_implementation (self)
 C++ which adds the advection terms to the non-conservative product.
str _source_implementation (self)
 C++ which calls the source term kernel.
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

 _enforce_ccz4_constraint = CCZ4SolverBase.EnforceCCZ4Constraint.No
 One task after all writers of the new solution: The optimistic Finite Volumes write it in one of two tasks, depending on the cell.
 _parameters = dict(self.DefaultParameters)
 _non_conservative_product = None
 _patch
 One task after all writers of the new solution: The optimistic Finite Volumes write it in one of two tasks, depending on the cell.
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

Everything the first-order and the second-order CCZ4 solvers share.

The base class hosts the CCZ4 parameters, the PDE terms (which delegate to the kernels in exagrype.ccz4) and the optional enforcement of the CCZ4 constraints. The initial condition is up to the user. The kernels always work on the 58 entries of CCZ4, see exagrype.api.FOCCZ4Solver.Unknowns, which they take as two pointers: one to the 25 primary and one to the 33 secondary entries. The two subclasses differ only in where the secondary entries live:

  • exagrype.api.FOCCZ4Solver evolves all 58 as unknowns. The secondary entries follow the primary ones, i.e. the pointers are Q and Q+25.
  • exagrype.api.FOSOCCZ4Solver evolves 25 unknowns, and the other 33 entries are auxiliary variables, i.e. they live in separate memory.

The subclasses therefore override the hooks _ncp_implementation() and _source_implementation(), which call the kernel of their formulation. The base class appends the advection terms to the non-conservative product if the numerical scheme does not add them (exagrype.api.CCZ4SolverBase.CCZ4SolverBase.ncp_adds_advection()).

exagrype.api.FOCCZ4Solver, exagrype.api.FOSOCCZ4Solver

Definition at line 14 of file CCZ4SolverBase.py.

Constructor & Destructor Documentation

◆ __init__()

exagrype.api.CCZ4SolverBase.CCZ4SolverBase.__init__ ( self,
str name,
Dict[str, int] unknowns,
Dict[str, Union[int, float]] parameters = None )

Create a CCZ4 solver.

Parameters
namestr Name of the solver (exahype2.api.Solver).
unknownsDict[str, int] The evolved unknowns of the subclass (exahype2.api.Solver). The subclass has to add all entries of CCZ4 that it does not evolve as auxiliary variables, so the entries add up to 58.
parametersDict[str, Union[int, float]] CCZ4 parameters that differ from DefaultParameters, e.g. {"CCZ4k1": 0.0}. Keys which are not in DefaultParameters are rejected, as they most likely are typos. The switches (exagrype.api.CCZ4SolverBase.CCZ4SolverBase.Switches) have to be the integers 0 or 1.

The solver has no initial condition. Add one as for any other solver, e.g. solver.add_pde_term(exagrype.api.initialvalues.gauge_wave()), or your own exahype2.api.InitPointWisely.

Definition at line 130 of file CCZ4SolverBase.py.

References __init__().

Referenced by __init__().

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

Member Function Documentation

◆ _advection_implementation()

str exagrype.api.CCZ4SolverBase.CCZ4SolverBase._advection_implementation ( self)
protected

C++ which adds the advection terms to the non-conservative product.

The term adds \( \\beta^n \\partial _n Q_q \) for the normal n of the call and each unknown q of advected_quantities(), discretised with the derivative the scheme hands over (exahype2.fd.addCentralAdvection()). The indices are those which the lopsided advection of a scheme gets, so either way the same terms are added. Both formulations hold the unknowns in Q, and Q holds the shift.

Definition at line 643 of file CCZ4SolverBase.py.

References _advection_indices().

Referenced by _register_non_conservative_product().

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

◆ _advection_indices()

exagrype.api.CCZ4SolverBase.CCZ4SolverBase._advection_indices ( self)
protected

Indices of the velocity components (ADVECTION_VELOCITY) and of the advected unknowns (advected_quantities()) within Q, in the form both the lopsided advection of the scheme and exahype2.fd.addCentralAdvection() take them.

Definition at line 336 of file CCZ4SolverBase.py.

References advected_quantities(), exahype2.api.rkfd4.CentralDifferencesWithRungeKutta.CentralDifferencesWithRungeKutta.advected_quantities, and ADVECTION_VELOCITY.

Referenced by _advection_implementation(), and ncp_adds_advection().

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

◆ _enforcement_implementation()

str exagrype.api.CCZ4SolverBase.CCZ4SolverBase._enforcement_implementation ( self)
protected

C++ which pushes the unknowns Q of one volume back onto the constraints.

Hook for the subclasses, as the unknowns they evolve differ.

Reimplemented in exagrype.api.FOSOCCZ4Solver.FOSOCCZ4Solver.

Definition at line 540 of file CCZ4SolverBase.py.

Referenced by _insert_constraint_enforcement().

Here is the caller graph for this function:

◆ _insert_constraint_enforcement()

exagrype.api.CCZ4SolverBase.CCZ4SolverBase._insert_constraint_enforcement ( self,
time_step,
anchors,
patch )
protected

Insert the enforcement of the CCZ4 constraints after anchors.

The routine creates a task which applies exagrype.ccz4.enforceCCZ4constraints() to each volume or grid point of patch, and inserts it directly after all anchors via peano4.api.taskgraph.Graph.insert_after(). The anchors' successors, e.g. the projection onto the faces, hence see the constrained data only. The task uses the solver's cell guard: If several anchors write patch, each cell is updated by one of them, and the task runs once per cell after all of them.

Parameters
time_steppeano4.api.taskgraph.Graph The time stepping task graph which holds the anchors.
anchorsList[peano4.api.taskgraph.Task] The tasks which write patch. If the list is empty, the routine does nothing.
patchpeano4.api.datamodel.Patch The cell data which the anchors write, i.e. the solution or a stage input.

Definition at line 492 of file CCZ4SolverBase.py.

References _enforcement_implementation(), exahype2.api.Solver.Solver._get_default_includes(), exagrype.api.FOSOReconstructionSolver.FOSOReconstructionSolver.grid_selector, exahype2.api.Solver.Solver.grid_selector, convert::data::Variable.name, dastgen2.attributes.Attribute.Attribute.name(), dastgen2.DataModel.DataModel.name(), exagrype.api.euler.CCZ4WithEuler_OuterAdditiveCoupling.CCZ4WithEuler_OuterAdditiveCoupling.name, exagrype.api.euler.CCZ4WithEuler_OuterAdditiveCoupling.CCZ4WithEuler_OuterAdditiveCoupling.name(), exagrype.api.euler.CCZ4WithEuler_OuterMultiplicativeCoupling.CCZ4WithEuler_OuterMultiplicativeCoupling.name, exagrype.api.euler.CCZ4WithEuler_OuterMultiplicativeCoupling.CCZ4WithEuler_OuterMultiplicativeCoupling.name(), exagrype.api.FOSOSolver.FOSOSolver.name, exagrype.api.FOSOSolver.FOSOSolver.name(), exagrype.api.scalarfield.CCZ4WithScalarField_InnerCoupling.CCZ4WithScalarField_InnerCoupling.name, exagrype.api.scalarfield.CCZ4WithScalarField_InnerCoupling.CCZ4WithScalarField_InnerCoupling.name(), exagrype.api.scalarfield.CCZ4WithScalarField_OuterMultiplicativeCoupling.CCZ4WithScalarField_OuterMultiplicativeCoupling.name, exagrype.api.scalarfield.CCZ4WithScalarField_OuterMultiplicativeCoupling.CCZ4WithScalarField_OuterMultiplicativeCoupling.name(), exahype2.api.AuxiliaryVariables.AuxiliaryVariables.name(), exahype2.api.dslhype2.AbstractSyntaxTree.Argument.name, exahype2.api.dslhype2.AbstractSyntaxTree.Function.name, exahype2.api.dslhype2.AbstractSyntaxTree.FunctionCall.name, exahype2.api.dslhype2.Expressions.Variable.name, exahype2.api.dslhype2.Types.TFunction.name, exahype2.api.dslhype2.Types.TStruct.name, exahype2.api.PDETerm.PDETerm.name, exahype2.api.Solver.Solver.name(), exahype2.api.Solver.Solver.Plotter.name, exaparty.api.particle.AlgorithmStep.AlgorithmStep.name, peano4.api.datamodel.DoF.DoF.name, peano4.api.solversteps.Step.Step.name, peano4.api.solversteps.UserActionSet.UserActionSet.name, peano4.api.taskgraph.compiler.fuse-steps-illustrations._IllustrationActionSet.name, peano4.api.taskgraph.compiler.fuse-steps-illustrations._IllustrationSubmodel.name, peano4.api.taskgraph.Task.Task.name, peano4.api.toolbox.particles.Particle.Particle.name, solvers.aderdg.kernels.Gemms.Gemms.name, test_derive_load_store_compute_flag._FakeSubmodel.name, test_fuse_steps._FakeActionSet.name, test_fuse_steps._FakeSubmodel.name, test_propagate_use_statements._FakeSubmodel.name, and test_task_groups._FakeActionSet.name.

Referenced by generate_solver_realisation().

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

◆ _max_eigenvalue_implementation()

str exagrype.api.CCZ4SolverBase.CCZ4SolverBase._max_eigenvalue_implementation ( self)
protected

Definition at line 672 of file CCZ4SolverBase.py.

Referenced by exagrype.api.euler.Euler.Euler._refresh_pde_terms(), and _register_pde_terms().

Here is the caller graph for this function:

◆ _ncp_implementation()

str exagrype.api.CCZ4SolverBase.CCZ4SolverBase._ncp_implementation ( self)
protected

C++ which calls the non-conservative product kernel.

The Finite Volume kernels hand over the jump deltaQ along one normal, the fourth-order Finite Differences of exahype2.api.rkfd4 the derivative along one normal times the mesh width. This is what exagrype.ccz4.ncpFirstOrder() and ncpSecondOrder() expect. Hook for the subclasses, as they select the formulation.

Reimplemented in exagrype.api.FOCCZ4Solver.FOCCZ4Solver, and exagrype.api.FOSOCCZ4Solver.FOSOCCZ4Solver.

Definition at line 629 of file CCZ4SolverBase.py.

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

Here is the caller graph for this function:

◆ _register_non_conservative_product()

exagrype.api.CCZ4SolverBase.CCZ4SolverBase._register_non_conservative_product ( self,
bool advection )
protected

Register the non-conservative product, with or without the advection terms.

generate_solver_realisation() calls this routine, as the non-conservative product depends on the numerical scheme (exagrype.api.CCZ4SolverBase.CCZ4SolverBase.ncp_adds_advection()). The term calls the kernel of the formulation (_ncp_implementation()) and, if advection is set, adds the advection terms of advected_quantities() with ADVECTION_VELOCITY (_advection_implementation()). It replaces the term of a former realisation, so a project can be generated several times.

Any other non-conservative product, i.e. one added through add_pde_term(), is rejected: The solver would replace it silently, and it could add advection terms which the scheme adds as well, or miss them (src/exagrype/ccz4/adrs/0003-the-solver-picks-who-adds-the-advection.md). Whoever needs another non-conservative product derives a solver class and overrides _ncp_implementation().

Parameters
advectionbool Whether the term adds the advection terms.

Definition at line 580 of file CCZ4SolverBase.py.

References _advection_implementation(), _ncp_implementation(), solvers.aderdg.AbstractSolverDeclarations.AbstractSolverDeclarations._ncp_implementation, solvers.aderdg.AbstractSolverDefinitions.AbstractSolverDefinitions._ncp_implementation, solvers.aderdg.ADERDG.ADERDG._ncp_implementation, solvers.aderdg.SolverDeclarations.SolverDeclarations._ncp_implementation, solvers.aderdg.SolverDefinitions.SolverDefinitions._ncp_implementation, solvers.fv.musclhancock.GlobalAdaptiveTimeStep.GlobalAdaptiveTimeStep._ncp_implementation, solvers.fv.musclhancock.GlobalFixedTimeStep.GlobalFixedTimeStep._ncp_implementation, solvers.fv.riemann.GlobalAdaptiveTimeStep.GlobalAdaptiveTimeStep._ncp_implementation, solvers.fv.riemann.GlobalAdaptiveTimeStepWithEnclaveTasking.GlobalAdaptiveTimeStepWithEnclaveTasking._ncp_implementation, solvers.fv.riemann.GlobalFixedTimeStep.GlobalFixedTimeStep._ncp_implementation, solvers.fv.riemann.GlobalFixedTimeStepWithEnclaveTasking.GlobalFixedTimeStepWithEnclaveTasking._ncp_implementation, solvers.fv.rusanov.GlobalAdaptiveTimeStep.GlobalAdaptiveTimeStep._ncp_implementation, solvers.fv.rusanov.GlobalAdaptiveTimeStepWithEnclaveTasking.GlobalAdaptiveTimeStepWithEnclaveTasking._ncp_implementation, solvers.fv.rusanov.GlobalFixedTimeStep.GlobalFixedTimeStep._ncp_implementation, solvers.fv.rusanov.GlobalFixedTimeStepWithEnclaveTasking.GlobalFixedTimeStepWithEnclaveTasking._ncp_implementation, solvers.fv.rusanov.LocalTimeStepWithEnclaveTasking.LocalTimeStepWithEnclaveTasking._ncp_implementation, solvers.fv.rusanov.SubcyclingAdaptiveTimeStepWithEnclaveTasking.SubcyclingAdaptiveTimeStepWithEnclaveTasking._ncp_implementation, solvers.fv.rusanov.SubcyclingFixedTimeStep.SubcyclingFixedTimeStep._ncp_implementation, solvers.fv.rusanov.SubcyclingFixedTimeStepWithEnclaveTasking.SubcyclingFixedTimeStepWithEnclaveTasking._ncp_implementation, solvers.rkdg.RungeKuttaDG.RungeKuttaDG._ncp_implementation, _non_conservative_product, exahype2.api.Solver.Solver.add_pde_term(), and exahype2.api.Solver.Solver.pde_terms.

Referenced by generate_solver_realisation().

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

◆ _register_pde_terms()

exagrype.api.CCZ4SolverBase.CCZ4SolverBase._register_pde_terms ( self)
protected

Register the source and the maximum eigenvalue.

The terms are stateless, i.e. static functions: they only use the compile-time constants of the solver and the kernels of exagrype.ccz4. Both the Finite Volumes (exahype2.api.fv) and the Finite Differences (exahype2.api.rkfd4) call stateless terms. The non-conservative product is not registered here: which one fits depends on the numerical scheme, which is assigned after the solver has been created, so generate_solver_realisation() registers it (exagrype.api.CCZ4SolverBase.CCZ4SolverBase._register_non_conservative_product()).

Definition at line 554 of file CCZ4SolverBase.py.

References _max_eigenvalue_implementation(), _source_implementation(), and exahype2.api.Solver.Solver.add_pde_term().

Here is the call graph for this function:

◆ _source_implementation()

str exagrype.api.CCZ4SolverBase.CCZ4SolverBase._source_implementation ( self)
protected

C++ which calls the source term kernel.

Hook for the subclasses.

Reimplemented in exagrype.api.FOCCZ4Solver.FOCCZ4Solver, and exagrype.api.FOSOCCZ4Solver.FOSOCCZ4Solver.

Definition at line 666 of file CCZ4SolverBase.py.

Referenced by exagrype.api.euler.Euler.Euler._refresh_pde_terms(), and _register_pde_terms().

Here is the caller graph for this function:

◆ _tasks_of_this_solver()

exagrype.api.CCZ4SolverBase.CCZ4SolverBase._tasks_of_this_solver ( self,
time_step,
tag )
protected

Tasks of time_step which carry tag and belong to this solver, as the graph holds the tasks of all solvers.

Definition at line 481 of file CCZ4SolverBase.py.

References convert::data::Variable.name, dastgen2.attributes.Attribute.Attribute.name(), dastgen2.DataModel.DataModel.name(), exagrype.api.euler.CCZ4WithEuler_OuterAdditiveCoupling.CCZ4WithEuler_OuterAdditiveCoupling.name, exagrype.api.euler.CCZ4WithEuler_OuterAdditiveCoupling.CCZ4WithEuler_OuterAdditiveCoupling.name(), exagrype.api.euler.CCZ4WithEuler_OuterMultiplicativeCoupling.CCZ4WithEuler_OuterMultiplicativeCoupling.name, exagrype.api.euler.CCZ4WithEuler_OuterMultiplicativeCoupling.CCZ4WithEuler_OuterMultiplicativeCoupling.name(), exagrype.api.FOSOSolver.FOSOSolver.name, exagrype.api.FOSOSolver.FOSOSolver.name(), exagrype.api.scalarfield.CCZ4WithScalarField_InnerCoupling.CCZ4WithScalarField_InnerCoupling.name, exagrype.api.scalarfield.CCZ4WithScalarField_InnerCoupling.CCZ4WithScalarField_InnerCoupling.name(), exagrype.api.scalarfield.CCZ4WithScalarField_OuterMultiplicativeCoupling.CCZ4WithScalarField_OuterMultiplicativeCoupling.name, exagrype.api.scalarfield.CCZ4WithScalarField_OuterMultiplicativeCoupling.CCZ4WithScalarField_OuterMultiplicativeCoupling.name(), exahype2.api.AuxiliaryVariables.AuxiliaryVariables.name(), exahype2.api.dslhype2.AbstractSyntaxTree.Argument.name, exahype2.api.dslhype2.AbstractSyntaxTree.Function.name, exahype2.api.dslhype2.AbstractSyntaxTree.FunctionCall.name, exahype2.api.dslhype2.Expressions.Variable.name, exahype2.api.dslhype2.Types.TFunction.name, exahype2.api.dslhype2.Types.TStruct.name, exahype2.api.PDETerm.PDETerm.name, exahype2.api.Solver.Solver.name(), exahype2.api.Solver.Solver.Plotter.name, exaparty.api.particle.AlgorithmStep.AlgorithmStep.name, peano4.api.datamodel.DoF.DoF.name, peano4.api.solversteps.Step.Step.name, peano4.api.solversteps.UserActionSet.UserActionSet.name, peano4.api.taskgraph.compiler.fuse-steps-illustrations._IllustrationActionSet.name, peano4.api.taskgraph.compiler.fuse-steps-illustrations._IllustrationSubmodel.name, peano4.api.taskgraph.Task.Task.name, peano4.api.toolbox.particles.Particle.Particle.name, solvers.aderdg.kernels.Gemms.Gemms.name, test_derive_load_store_compute_flag._FakeSubmodel.name, test_fuse_steps._FakeActionSet.name, test_fuse_steps._FakeSubmodel.name, test_propagate_use_statements._FakeSubmodel.name, and test_task_groups._FakeActionSet.name.

Referenced by generate_solver_realisation().

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

◆ advected_quantities()

List[str] exagrype.api.CCZ4SolverBase.CCZ4SolverBase.advected_quantities ( self)

The unknowns whose advection terms the kernels of exagrype.ccz4 leave out.

The kernels hold no advection terms \( \\beta^k \\partial _k Q_q \) which need the derivative of the advected unknown q itself. This list is the only place which defines these unknowns. Either the numerical scheme adds their advection with lopsided stencils, e.g. via

solver, patch_size, rk_order=4,
right_hand_side_kernel = exahype2.api.rkfd4.CentralDifferencesWithRungeKutta.RightHandSideKernel.CentralDifferencesWithLopsidedAdvection,
advection_velocity = exagrype.api.FOCCZ4Solver.ADVECTION_VELOCITY,
advected_quantities = solver.advected_quantities(),
)
Fourth-order central Finite Differences with explicit Runge-Kutta time stepping, realised over a bloc...

These are all unknowns besides the conformal metric G, the lapse, the shift and phi: The advection terms of the metric, the lapse, the shift and phi are part of the algebraic source (exagrype.ccz4.sourceFirstOrder()), which expresses them through the auxiliary unknowns, i.e. the first derivatives.

or the solver appends it to the non-conservative product, discretised with the central differences of the scheme (exahype2.fd.addCentralAdvection()), if the scheme adds none. The solver rejects a scheme which advects other quantities (exagrype.api.CCZ4SolverBase.CCZ4SolverBase.ncp_adds_advection()).

The advection of b and of the derivatives of the shift (dxShift, dyShift, dzShift) belongs to the shifting shift only, i.e. the routine leaves these unknowns out unless CCZ4s=1 and CCZ4b=1.

The equation of b holds the time derivative of Ghat (the unknown Z), which comprises the advection of Ghat. The shifting shift subtracts this advection again, i.e. only the advection of b itself is left, which is added as for any other unknown. The non-shifting shift (CCZ4b=0) keeps the advection of Ghat in the equation of b. Who advects each quantity on its own cannot add it there, so the kernel does so with the derivatives it is given (src/exagrype/ccz4/adrs/0002-ccz4b-selects-the-shifting-or-the-non-shifting-shift.md).

Returns
List[str] Names of unknowns (exagrype.api.FOCCZ4Solver.FOCCZ4Solver.Unknowns).

Reimplemented in exagrype.api.FOSOCCZ4Solver.FOSOCCZ4Solver.

Definition at line 205 of file CCZ4SolverBase.py.

References _parameters, exagrype.api.euler.Euler.Euler.Unknowns, exagrype.api.FOCCZ4Solver.FOCCZ4Solver.Unknowns, exagrype.api.FOSOCCZ4Solver.FOSOCCZ4Solver.Unknowns, and exagrype.api.scalarfield.ScalarField.ScalarField.Unknowns.

Referenced by _advection_indices().

Here is the caller graph for this function:

◆ enforce_ccz4_constraint()

exagrype.api.CCZ4SolverBase.CCZ4SolverBase.enforce_ccz4_constraint ( self,
"CCZ4SolverBase.EnforceCCZ4Constraint" value )

Set when the solver pushes the solution back onto the CCZ4 constraints.

By default, the solver does not enforce the constraints. If you switch the enforcement on, generate_solver_realisation() inserts a task which applies exagrype.ccz4.enforceCCZ4constraints() to each volume or grid point after each tagged solution update of the numerical scheme.

Parameters
valueCCZ4SolverBase.EnforceCCZ4Constraint No, OnlyFinalSolution or IntermediateSteps.

Definition at line 349 of file CCZ4SolverBase.py.

References _enforce_ccz4_constraint.

◆ generate_solver_realisation()

exagrype.api.CCZ4SolverBase.CCZ4SolverBase.generate_solver_realisation ( self,
exahype2_project,
peano_project,
setup_simulation,
time_step,
plot,
mesh_adaptation,
add_global_tasks = True )

Create the solver's task graphs and insert the constraint enforcement.

The routine first registers the non-conservative product, with the advection terms if the numerical scheme does not add them (exagrype.api.CCZ4SolverBase.CCZ4SolverBase.ncp_adds_advection()). The solver cannot do this earlier, as the numerical scheme is assigned after the solver has been created. Afterwards, the routine calls the superclass, which lets the grid construction, the numerical scheme and the plotter add their tasks and generates the solver class with the PDE terms. If the constraint enforcement is switched on (enforce_ccz4_constraint()), it afterwards inserts the enforcement after each tagged solution update of the numerical scheme. Which patch a tagged task writes and which guard it uses depends on the scheme, so the routine distinguishes the schemes explicitly (page_exahype2_solver_manipulate_solver_steps). It raises an exception for any other scheme.

All insertions work on the patch which the tagged tasks write and use the cell guard:

  • exahype2.api.fv.RusanovWithExplicitEuler: one task after Update cell.
  • exahype2.api.fv.RusanovWithOptimisticExplicitEuler: one task after both Update cell and Insert patch interior. Each cell runs exactly one of the two, so the task constrains every cell once, after its update.
  • exahype2.api.rkfd4.CentralDifferencesWithRungeKutta and its subclass exagrype.api.FD4WithKODissipation: one task after Complete time step and, for IntermediateSteps, one task after each Prepare stage k on the stage input.

The scheme's log of the time stepping graph does not show the enforcement. With TEXT or VISUALISATION logging, the routine hence logs the graph once more.

Reimplemented from exahype2.api.Solver.Solver.

Definition at line 371 of file CCZ4SolverBase.py.

References _enforce_ccz4_constraint, _insert_constraint_enforcement(), _register_non_conservative_product(), exagrype.api.scalarfield.FiniteVolumesInnerCoupling._FiniteVolumes._stage_input(), exagrype.api.scalarfield.InnerCouplingGenerator.InnerCouplingGenerator._stage_input(), exagrype.api.scalarfield.RungeKuttaFD4InnerCoupling._RungeKuttaFD4._stage_input(), _tasks_of_this_solver(), generate_solver_realisation(), ncp_adds_advection(), exagrype.api.FOSOSolver.FOSOSolver.numerical_scheme(), exagrype.api.FOSOSolver.FOSOSolver.numerical_scheme(), exagrype.api.scalarfield.CCZ4WithScalarField_InnerCoupling.CCZ4WithScalarField_InnerCoupling.numerical_scheme(), exagrype.api.scalarfield.CCZ4WithScalarField_InnerCoupling.CCZ4WithScalarField_InnerCoupling.numerical_scheme(), and exahype2.api.Solver.Solver.numerical_scheme().

Referenced by generate_solver_realisation().

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

◆ ncp_adds_advection()

bool exagrype.api.CCZ4SolverBase.CCZ4SolverBase.ncp_adds_advection ( self)

Whether the non-conservative product has to add the advection terms.

The advection terms \( \\beta^k \\partial _k Q_q \) of the unknowns of advected_quantities() are added either by the numerical scheme or by the non-conservative product, never by both. You choose the formulation (the solver class) and whether the Finite Differences use lopsided advection (the kernel of the numerical scheme). The solver decides which fits this choice, and generate_solver_realisation() registers the non-conservative product accordingly:

  • exahype2.api.rkfd4.CentralDifferencesWithRungeKutta (and its subclass exagrype.api.FD4WithKODissipation) with the kernel CentralDifferences adds no advection terms. The non-conservative product adds them, discretised with the central differences of the scheme.
  • The same scheme with CentralDifferencesWithLopsidedAdvection adds the advection itself, and the non-conservative product adds none. The scheme has to advect exactly exagrype.api.CCZ4SolverBase.CCZ4SolverBase.advected_quantities() with ADVECTION_VELOCITY. Otherwise, it would add some terms twice or miss some, and the routine raises a ValueError.
  • The Finite Volumes of exahype2.api.fv add no advection terms, and the non-conservative product adds none either, i.e. they solve CCZ4 without these advection terms, as before (exagrype.api.FOCCZ4Solver). Whether the non-conservative product should add them is open.

The rationale is written down in src/exagrype/ccz4/adrs/0003-the-solver-picks-who-adds-the-advection.md.

Returns
bool True if the non-conservative product has to add the advection terms.

Definition at line 259 of file CCZ4SolverBase.py.

References _advection_indices(), exagrype.api.FOSOSolver.FOSOSolver.numerical_scheme(), exagrype.api.FOSOSolver.FOSOSolver.numerical_scheme(), exagrype.api.scalarfield.CCZ4WithScalarField_InnerCoupling.CCZ4WithScalarField_InnerCoupling.numerical_scheme(), exagrype.api.scalarfield.CCZ4WithScalarField_InnerCoupling.CCZ4WithScalarField_InnerCoupling.numerical_scheme(), and exahype2.api.Solver.Solver.numerical_scheme().

Referenced by generate_solver_realisation().

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

◆ parameters()

Dict[str, Union[int, float]] exagrype.api.CCZ4SolverBase.CCZ4SolverBase.parameters ( self)

The CCZ4 parameters the solver is generated with (read-only copy).

Definition at line 548 of file CCZ4SolverBase.py.

References _parameters.

Field Documentation

◆ _enforce_ccz4_constraint

exagrype.api.CCZ4SolverBase.CCZ4SolverBase._enforce_ccz4_constraint = CCZ4SolverBase.EnforceCCZ4Constraint.No
protected

One task after all writers of the new solution: The optimistic Finite Volumes write it in one of two tasks, depending on the cell.

One task after each stage, as the stages run one after the other

Definition at line 162 of file CCZ4SolverBase.py.

Referenced by enforce_ccz4_constraint(), and generate_solver_realisation().

◆ _non_conservative_product

exagrype.api.CCZ4SolverBase.CCZ4SolverBase._non_conservative_product = None
protected

Definition at line 202 of file CCZ4SolverBase.py.

Referenced by _register_non_conservative_product().

◆ _parameters

exagrype.api.CCZ4SolverBase.CCZ4SolverBase._parameters = dict(self.DefaultParameters)
protected

◆ _patch

exagrype.api.CCZ4SolverBase.CCZ4SolverBase._patch
protected

◆ ADVECTION_VELOCITY

str exagrype.api.CCZ4SolverBase.CCZ4SolverBase.ADVECTION_VELOCITY = "shift"
static

Definition at line 120 of file CCZ4SolverBase.py.

Referenced by _advection_indices().

◆ DefaultParameters

exagrype.api.CCZ4SolverBase.CCZ4SolverBase.DefaultParameters
static

Definition at line 67 of file CCZ4SolverBase.py.

◆ NUMBER_OF_CCZ4_ENTRIES

int exagrype.api.CCZ4SolverBase.CCZ4SolverBase.NUMBER_OF_CCZ4_ENTRIES = 58
static

Definition at line 42 of file CCZ4SolverBase.py.

◆ Switches

tuple exagrype.api.CCZ4SolverBase.CCZ4SolverBase.Switches = ("CCZ4LapseType", "CCZ4b", "CCZ4s")
static

Definition at line 113 of file CCZ4SolverBase.py.


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