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

Solver for the Einstein equations in the first-/second-order reconstructed CCZ4 formulation. More...

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

Public Member Functions

 __init__ (self, str name, Dict[str, Union[int, float]] parameters=None, exahype2.api.InitPointWisely initial_condition=None)
 Create a second-order reconstructed CCZ4 solver.
str task_graph_title_suffix (self)
List[str] advected_quantities (self)
 The unknowns whose advection terms the kernels omit.
Public Member Functions inherited from exagrype.api.CCZ4SolverBase.CCZ4SolverBase
 __init__ (self, str name, Dict[str, int] unknowns, Dict[str, Union[int, float]] parameters=None)
 Create a CCZ4 solver.
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.

Data Fields

 derivatives
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.

Static Public Attributes

dict Unknowns
dict DerivativeUnknowns
Static Public Attributes inherited from exagrype.api.CCZ4SolverBase.CCZ4SolverBase
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

str _enforcement_implementation (self)
 C++ which pushes the unknowns Q of one volume back onto the constraints.
int _number_of_evolved_entries (cls)
int _number_of_derivatives (cls)
str _ncp_implementation (self)
 The secondary entries are the auxiliary variables.
str _source_implementation (self)
 C++ which calls the source term kernel.
exahype2.api.InitPointWisely _adapt_initial_condition (self, exahype2.api.InitPointWisely initial_condition)
 The initial condition fills 58 entries; we split them up.
Protected Member Functions inherited from exagrype.api.CCZ4SolverBase.CCZ4SolverBase
 _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.
 _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 _advection_implementation (self)
 C++ which adds the advection terms to the non-conservative product.
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.

Additional Inherited Members

Protected Attributes inherited from exagrype.api.CCZ4SolverBase.CCZ4SolverBase
 _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.

Detailed Description

Solver for the Einstein equations in the first-/second-order reconstructed CCZ4 formulation.

The solver evolves the first 25 of the 58 CCZ4 unknowns (see Unknowns), i.e. the conformal metric, the extrinsic curvature, the gauge and the auxiliary evolution variables. The remaining 33 entries (DerivativeUnknowns) are the first derivatives of the lapse, the shift, the conformal metric and phi. They are not evolved but held as auxiliary variables (exahype2.api.AuxiliaryVariables) named "Derivatives". The PDE terms hand the 25 unknowns and, as a second pointer, the 33 auxiliary variables to the very same kernels as the first-order solver exagrype.api.FOCCZ4Solver. The second-order kernels set the time derivative of the 33 derivatives to zero, and the solver does not even ask for it.

Ping-pong with the reconstruction solver

Nobody updates the derivatives on their own. A second solver, exagrype.api.FOSOReconstructionSolver, does this. Do not create the pair yourself, but use exagrype.api.FOSOSolver, which hosts this solver (as ccz4) and its partner. The reconstruction solver runs in front of each stage of the Runge-Kutta scheme of this solver, recomputes the 33 derivatives from the 25 unknowns of the stage and projects them onto the faces, so this solver finds them with a halo when it evaluates the stage. Without the reconstruction, the solver sees the derivatives of the initial condition forever.

The solver works with exahype2.api.rkfd4.CentralDifferencesWithRungeKutta (and its subclass exagrype.api.FD4WithKODissipation) and with exahype2.api.fv.RusanovWithExplicitEuler. The latter reconstructs the derivatives with second-order central differences.

For Finite Differences, the numerical scheme has to have a halo of at least three grid cells: The solver needs the derivatives one layer outside of its cell (the fluxes and non-conservative products on the cell's faces use the values left and right of the face), and the stencil of the reconstruction reaches two layers further out. The plain scheme has a halo of two; lopsided advection or exagrype.api.FD4WithKODissipation widen it to three. The reconstruction solver rejects a smaller halo.

page_exagrype_fo_so_project_plan for the design and its status.

Shortcomings

Definition at line 13 of file FOSOCCZ4Solver.py.

Constructor & Destructor Documentation

◆ __init__()

exagrype.api.FOSOCCZ4Solver.FOSOCCZ4Solver.__init__ ( self,
str name,
Dict[str, Union[int, float]] parameters = None,
exahype2.api.InitPointWisely initial_condition = None )

Create a second-order reconstructed CCZ4 solver.

Parameters
namestr Name of the solver (exahype2.api.Solver).
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.
initial_conditionexahype2.api.InitPointWisely Initial condition. It fills the 58 entries of the first-order formulation, i.e. it can be any routine from exagrype.api.initialvalues. The solver takes the first 25 as its unknowns, and uses the other 33 as the initial value of the derivatives. Defaults to exagrype.api.initialvalues.gauge_wave().

Definition at line 111 of file FOSOCCZ4Solver.py.

References __init__(), _adapt_initial_condition(), exahype2.api.Solver.Solver.add_pde_term(), exagrype.api.euler.Euler.Euler.Unknowns, exagrype.api.FOCCZ4Solver.FOCCZ4Solver.Unknowns, and Unknowns.

Referenced by __init__().

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

Member Function Documentation

◆ _adapt_initial_condition()

exahype2.api.InitPointWisely exagrype.api.FOSOCCZ4Solver.FOSOCCZ4Solver._adapt_initial_condition ( self,
exahype2.api.InitPointWisely initial_condition )
protected

The initial condition fills 58 entries; we split them up.

The routine wraps the user's implementation. It runs the implementation on a local array of 58 entries (the implementation sees it as Q) and then copies the first 25 entries onto Q and the other 33 onto the derivatives.

Definition at line 226 of file FOSOCCZ4Solver.py.

References _number_of_evolved_entries().

Referenced by __init__().

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

◆ _enforcement_implementation()

str exagrype.api.FOSOCCZ4Solver.FOSOCCZ4Solver._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 from exagrype.api.CCZ4SolverBase.CCZ4SolverBase.

Definition at line 194 of file FOSOCCZ4Solver.py.

◆ _ncp_implementation()

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

The secondary entries are the auxiliary variables.

Reimplemented from exagrype.api.CCZ4SolverBase.CCZ4SolverBase.

Definition at line 205 of file FOSOCCZ4Solver.py.

Referenced by solvers.fv.FV.FV.__str__().

Here is the caller graph for this function:

◆ _number_of_derivatives()

int exagrype.api.FOSOCCZ4Solver.FOSOCCZ4Solver._number_of_derivatives ( cls)
protected

Definition at line 202 of file FOSOCCZ4Solver.py.

References DerivativeUnknowns.

◆ _number_of_evolved_entries()

int exagrype.api.FOSOCCZ4Solver.FOSOCCZ4Solver._number_of_evolved_entries ( cls)
protected

Definition at line 198 of file FOSOCCZ4Solver.py.

References exagrype.api.euler.Euler.Euler.Unknowns, exagrype.api.FOCCZ4Solver.FOCCZ4Solver.Unknowns, and Unknowns.

Referenced by _adapt_initial_condition().

Here is the caller graph for this function:

◆ _source_implementation()

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

C++ which calls the source term kernel.

Hook for the subclasses.

Reimplemented from exagrype.api.CCZ4SolverBase.CCZ4SolverBase.

Definition at line 216 of file FOSOCCZ4Solver.py.

◆ advected_quantities()

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

The unknowns whose advection terms the kernels omit.

exagrype.ccz4.sourceSecondOrder() and exagrype.ccz4.ncpSecondOrder() omit the advection \( \\beta^k \\partial _k Q \) of all 25 evolved unknowns, so the numerical scheme has to add it for all of them, e.g. via

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

The advection of the shift and of b belongs to the shifting shift only, i.e. the routine leaves them out unless CCZ4s=1 and CCZ4b=1 (exagrype.api.CCZ4SolverBase.CCZ4SolverBase.advected_quantities() explains what the non-shifting shift does to the equation of b). Either the numerical scheme or the non-conservative product adds the advection of the unknowns returned (exagrype.api.CCZ4SolverBase.CCZ4SolverBase.ncp_adds_advection()).

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

Reimplemented from exagrype.api.CCZ4SolverBase.CCZ4SolverBase.

Definition at line 157 of file FOSOCCZ4Solver.py.

References exagrype.api.CCZ4SolverBase.CCZ4SolverBase._parameters, exagrype.api.euler.Euler.Euler.Unknowns, exagrype.api.FOCCZ4Solver.FOCCZ4Solver.Unknowns, and Unknowns.

◆ task_graph_title_suffix()

str exagrype.api.FOSOCCZ4Solver.FOSOCCZ4Solver.task_graph_title_suffix ( self)

Definition at line 154 of file FOSOCCZ4Solver.py.

Field Documentation

◆ derivatives

exagrype.api.FOSOCCZ4Solver.FOSOCCZ4Solver.derivatives
Initial value:
"Derivatives",
self.DerivativeUnknowns,
mode=exahype2.api.AuxiliaryVariables.Mode.CHANGING_ON_FACES,
data_name="DerivativeVariables",
)
A set of auxiliary variables of a solver.

Definition at line 145 of file FOSOCCZ4Solver.py.

◆ DerivativeUnknowns

dict exagrype.api.FOSOCCZ4Solver.FOSOCCZ4Solver.DerivativeUnknowns
static
Initial value:
= {
"dLapse": 3,
"dxShift": 3,
"dyShift": 3,
"dzShift": 3,
"dxG": 6,
"dyG": 6,
"dzG": 6,
"P": 3,
}

Definition at line 93 of file FOSOCCZ4Solver.py.

Referenced by _number_of_derivatives().

◆ Unknowns

exagrype.api.FOSOCCZ4Solver.FOSOCCZ4Solver.Unknowns
static
Initial value:
= {
"G": 6,
"K": 6,
"theta": 1,
"Z": 3,
"lapse": 1,
"shift": 3,
"b": 3,
"Kex": 1,
"phi": 1,
}

Definition at line 74 of file FOSOCCZ4Solver.py.

Referenced by __init__(), exagrype.api.scalarfield.ScalarField.ScalarField.__init__(), _number_of_evolved_entries(), exagrype.api.CCZ4SolverBase.CCZ4SolverBase.advected_quantities(), and advected_quantities().


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