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

Reconstructs the first derivatives which exagrype.api.FOSOCCZ4Solver needs. More...

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

Data Structures

class  NoGridConstruction
 The reconstruction solver builds no mesh. More...

Public Member Functions

 __init__ (self, str name, "FOSOCCZ4Solver" ccz4)
str task_graph_title_suffix (self)
 partner_task_names (self, int stage)
 Names of the tasks of the CCZ4 solver which the reconstruction of a stage interacts with.
 create_task_graph (self, exahype2_project, peano_project, int stage, int number_of_stages)
 Create the chain of reconstruction tasks of one stage.
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.
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.
 generate_solver_realisation (self, exahype2_project, peano_project, setup_simulation, time_step, plot, mesh_adaptation, add_global_tasks=True)
 Turn this solver specification into a task graph and create the required C++ kernels/stubs.

Data Fields

 ccz4 = ccz4
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.

Protected Member Functions

 _forward_time_stamps_and_time_step_sizes (self)
 The solver does not time step.
 _layout (self)
 Validate the scheme of the CCZ4 solver and return how to reconstruct.
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

tuple _scratch_halos = None
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

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.

Detailed Description

Reconstructs the first derivatives which exagrype.api.FOSOCCZ4Solver needs.

The solver is the second partner in the ping-pong of the first-/second-order reconstructed CCZ4 formulation (First-order second-order CCZ4). Where the CCZ4 solver sees 25 unknowns and 33 auxiliary variables (the derivatives), the reconstruction solver sees the same 58 entries the other way round: its 33 unknowns are the derivatives, and its 25 auxiliary variables are the unknowns of the CCZ4 solver. Nothing is copied: the derivatives are the very patch that the CCZ4 solver holds as auxiliary variables "Derivatives", and the reconstruction reads the CCZ4 solver's patch.

It is a real exahype2.api.Solver (it has a solver class and a global instance in the solver repository), yet it is much simpler than a normal solver:

  • It has no PDE terms and no compute kernel. Its only compute step evaluates the stencil on the unknowns of the partner.
  • It computes no time step size. Its C++ class forwards the time stamps and time step sizes of the CCZ4 solver, so the global minimum over all solvers is the one of the CCZ4 solver.
  • It does neither add lopsided advection nor enforce constraints.
  • It has no grid construction of its own, no plotter and no mesh adaptation. The CCZ4 solver builds the mesh and initialises the derivatives.

Users do not create the solver themselves: exagrype.api.FOSOSolver creates it and realises it right after the CCZ4 solver. The solver has no numerical scheme of its own: the scheme of the host builds the CCZ4 solver's graph and asks this solver for its graph per stage (create_task_graph()). The reconstruction has to be realised after the CCZ4 solver, as it uses its data.

Task graph

For each stage of the Runge-Kutta scheme of the CCZ4 solver (once for FV), the solver creates a chain of tasks in a task graph of its own:

  1. Interpolate the coarse face data of the primary variables and of the derivatives onto hanging faces (two parallel tasks). From the point of view of this solver, the primary variables are auxiliary variables that are to be interpolated, and the derivative variables are the unknowns.
  2. Reconstruct the primary variables and the derivative variables (halo from the cell and the faces). The two tasks run in parallel, and each waits for its interpolation.
  3. Apply the stencil, i.e. recompute the derivatives from the primary variables.
  4. Project the derivatives onto the faces.
  5. Restrict them on hanging faces, but only if the derivatives' mode (exahype2.api.AuxiliaryVariables.Mode) is CHANGING_ON_FACES, which it is.
  6. Roll the face data over.

The graph has no dependencies between stages. The host concatenates the graph with the one of the CCZ4 solver (exagrype.api.FOSOSolver._couple()): The first tasks of a stage wait for what the CCZ4 solver's interpolation of the derivatives in this stage waited for, and the interpolation of the primary variables additionally waits for the CCZ4 solver's interpolation of the unknowns (both write the same faces). The chain is a block between the CCZ4 solver's interpolation of the unknowns and the rest of the stage: The CCZ4 solver's interpolation of the derivatives (and thus the reconstruction of their halos) and its reconstruction of the unknowns wait for the last task. In terms of Coupling different solvers, this is a multiplicative coupling, with the coupling repeated per stage.

Shortcomings

  • Domain boundaries other than periodic ones and Sommerfeld boundary conditions are not supported, as the reconstruction reads the halo of the CCZ4 solver's unknowns before the Dirichlet boundary conditions are applied. The reconstruction takes the same dependencies as the CCZ4 solver's reconstruction, which makes it work in principle, but this has not been tested.
  • Supported are exahype2.api.rkfd4.CentralDifferencesWithRungeKutta (fourth-order stencil, halo of at least three grid cells, one task per Runge-Kutta stage) and exahype2.api.fv.RusanovWithExplicitEuler (second-order central differences, overlap of one is enough, a single task as there is a single stage). The optimistic Finite Volume scheme is not supported.

Definition at line 14 of file FOSOReconstructionSolver.py.

Constructor & Destructor Documentation

◆ __init__()

exagrype.api.FOSOReconstructionSolver.FOSOReconstructionSolver.__init__ ( self,
str name,
"FOSOCCZ4Solver" ccz4 )
Parameters
namestr Name of the solver,
See also
exahype2.api.Solver.
Parameters
ccz4exagrype.api.FOSOCCZ4Solver The CCZ4 solver whose derivatives this solver reconstructs.

Definition at line 109 of file FOSOReconstructionSolver.py.

Member Function Documentation

◆ _forward_time_stamps_and_time_step_sizes()

exagrype.api.FOSOReconstructionSolver.FOSOReconstructionSolver._forward_time_stamps_and_time_step_sizes ( self)
protected

The solver does not time step.

It therefore hands out what the CCZ4 solver hands out. Otherwise, the global minimum and maximum which the solver repository evaluates over all solvers would be spoilt.

Definition at line 136 of file FOSOReconstructionSolver.py.

References exahype2.api.Solver.Solver.add_abstract_solver_method().

Here is the call graph for this function:

◆ _layout()

exagrype.api.FOSOReconstructionSolver.FOSOReconstructionSolver._layout ( self)
protected

Validate the scheme of the CCZ4 solver and return how to reconstruct.

Returns
scheme, actionsets, reconstruction_function, stages, per_stage

Definition at line 160 of file FOSOReconstructionSolver.py.

Referenced by create_task_graph(), and partner_task_names().

Here is the caller graph for this function:

◆ create_readme_descriptor()

str exagrype.api.FOSOReconstructionSolver.FOSOReconstructionSolver.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.

Reimplemented from exahype2.api.Solver.Solver.

Definition at line 462 of file FOSOReconstructionSolver.py.

◆ create_task_graph()

exagrype.api.FOSOReconstructionSolver.FOSOReconstructionSolver.create_task_graph ( self,
exahype2_project,
peano_project,
int stage,
int number_of_stages )

Create the chain of reconstruction tasks of one stage.

The CCZ4 solver has to be realised before, as the routine needs its data. The graph holds one chain of tasks, without any dependency on the CCZ4 solver's tasks. Its sources are the two interpolation tasks, its only sink the roll over. The host (exagrype.api.FOSOSolver) wires the chain into the stage of the CCZ4 solver.

Parameters
exahype2_projectexahype2.api.Project The project that hosts the solvers (unused).
peano_projectpeano4.api.Project The Peano project that the exahype2 project assembles.
stageint Stage of the Runge-Kutta scheme of the CCZ4 solver, 0 for Finite Volumes.
number_of_stagesint Number of stages (unused).
Returns
peano4.api.taskgraph.Graph

Definition at line 235 of file FOSOReconstructionSolver.py.

References _layout(), _scratch_halos, exagrype.api.euler.CCZ4WithEuler_OuterAdditiveCoupling.CCZ4WithEuler_OuterAdditiveCoupling.ccz4, exagrype.api.euler.CCZ4WithEuler_OuterMultiplicativeCoupling.CCZ4WithEuler_OuterMultiplicativeCoupling.ccz4, ccz4, 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.

Here is the call graph for this function:

◆ partner_task_names()

exagrype.api.FOSOReconstructionSolver.FOSOReconstructionSolver.partner_task_names ( self,
int stage )

Names of the tasks of the CCZ4 solver which the reconstruction of a stage interacts with.

Parameters
stageint Stage of the Runge-Kutta scheme, 0 for Finite Volumes.
Returns
unknowns_interpolation, derivatives_interpolation, reconstruction Names of the tasks that interpolate the unknowns onto hanging faces, interpolate the derivatives, and reconstruct the unknowns (halo). The first reconstruction tasks of the stage wait for what the second one waits for, and the second and third one wait for the last reconstruction task. exagrype.api.FOSOSolver._couple()

Definition at line 211 of file FOSOReconstructionSolver.py.

References _layout(), exagrype.api.euler.CCZ4WithEuler_OuterAdditiveCoupling.CCZ4WithEuler_OuterAdditiveCoupling.ccz4, exagrype.api.euler.CCZ4WithEuler_OuterMultiplicativeCoupling.CCZ4WithEuler_OuterMultiplicativeCoupling.ccz4, and ccz4.

Here is the call graph for this function:

◆ task_graph_title_suffix()

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

Definition at line 133 of file FOSOReconstructionSolver.py.

Field Documentation

◆ _scratch_halos

tuple exagrype.api.FOSOReconstructionSolver.FOSOReconstructionSolver._scratch_halos = None
protected

Definition at line 127 of file FOSOReconstructionSolver.py.

Referenced by create_task_graph().

◆ ccz4


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