Peano
Loading...
Searching...
No Matches
exagrype.api.scalarfield.InnerCouplingGenerator.InnerCouplingGenerator Class Reference

Numerical scheme of the coupled solver exagrype.api.scalarfield.CCZ4WithScalarField_InnerCoupling. More...

Inheritance diagram for exagrype.api.scalarfield.InnerCouplingGenerator.InnerCouplingGenerator:
Collaboration diagram for exagrype.api.scalarfield.InnerCouplingGenerator.InnerCouplingGenerator:

Public Member Functions

 __init__ (self, int patch_size)
 attach_to (self, host)
 Install the numerical schemes of the building blocks on the solvers of the host.
 construct_output (self, exahype2_project, peano_project, setup_simulation, time_step, plot, mesh_adaptation)
 Build the task graph of the coupled system, and add it to time_step.

Data Fields

 patch_size = patch_size

Static Public Attributes

bool MULTIPLICATIVE = False
str COPY_TASK_NAME = "Copy CCZ4 fields into {} stage {}"
str SYNCHRONISE_TASK_NAME = "Synchronise time step sizes"

Protected Member Functions

 _create_scheme (self, solver)
 The numerical scheme of one of the solvers, i.e.
int _number_of_stages (self)
 Number of stages of the time integrator.
 _stage_input (self, solver, stage)
 The patch which a solver's stage reads as input (it holds the solver's unknowns of the stage's time level).
 _end_of_stage (self, solver, graph, stage)
 The tasks of a solver's graph that end a stage.

Static Protected Member Functions

 _first_tasks (graph, previous_end)
 The tasks of a solver's graph that start a stage.

Protected Attributes

 _host = None
 Install the numerical schemes of the building blocks on the solvers of the host.
dict _schemes = {}
 Install the numerical schemes of the building blocks on the solvers of the host.

Detailed Description

Numerical scheme of the coupled solver exagrype.api.scalarfield.CCZ4WithScalarField_InnerCoupling.

The generator builds the task graph of the whole combination of CCZ4 and the scalar field. The scheme-specific parts are the numerical schemes of the two solvers (_create_scheme()) and what a stage of the time integrator is (_number_of_stages(), _stage_input(), _end_of_stage()). The four concrete generators only provide these. Whether the coupling is multiplicative or additive is the class attribute MULTIPLICATIVE.

Task graph

attach_to() installs a numerical scheme on each solver. The schemes are building blocks: they create the data and the kernels of their solver, and the tasks of its stages. The generator's construct_output() then

  1. realises both solvers into graphs of their own (without global tasks) and merges them;
  2. adds per stage k a task "Copy CCZ4 fields into ... stage k". It copies the input of CCZ4's stage into the auxiliary variables of the scalar field, projects them onto the faces, restricts them on hanging faces, and rolls them over. It reads the stage input before CCZ4's reconstruction discards it, and it waits for the end of stage k-1 of both solvers;
  3. lets the first tasks of the stage of the solvers wait for the copy task. This is additive coupling: the stages of the solvers run in parallel. For multiplicative coupling, the first tasks of the scalar field's stage also wait for the end of CCZ4's stage, i.e. the stage of the scalar field follows the one of CCZ4;
  4. adds a final global end-of-step task which enforces the minimum of the time step sizes, and wraps the graph into the load balancing and the dynamic mesh refinement (through CCZ4's scheme).

The scalar field sees the CCZ4 data of the very time level of its own stage in both flavours. This is what keeps the order of the time integrator: if the scalar field saw the outcome of CCZ4's stage, its Runge-Kutta scheme would see the spacetime at the wrong time level. Hence, the data of the two flavours are the same for a one-directional coupling, and they differ in the schedule only.

Definition at line 14 of file InnerCouplingGenerator.py.

Constructor & Destructor Documentation

◆ __init__()

exagrype.api.scalarfield.InnerCouplingGenerator.InnerCouplingGenerator.__init__ ( self,
int patch_size )
Parameters
patch_sizeint Number of grid cells (volumes) per patch and axis. The same for both solvers.

Definition at line 59 of file InnerCouplingGenerator.py.

Member Function Documentation

◆ _create_scheme()

exagrype.api.scalarfield.InnerCouplingGenerator.InnerCouplingGenerator._create_scheme ( self,
solver )
protected

The numerical scheme of one of the solvers, i.e.

a building block of the whole scheme

Reimplemented in exagrype.api.scalarfield.FiniteVolumesInnerCoupling._FiniteVolumes, and exagrype.api.scalarfield.RungeKuttaFD4InnerCoupling._RungeKuttaFD4.

Definition at line 199 of file InnerCouplingGenerator.py.

Referenced by attach_to().

Here is the caller graph for this function:

◆ _end_of_stage()

exagrype.api.scalarfield.InnerCouplingGenerator.InnerCouplingGenerator._end_of_stage ( self,
solver,
graph,
stage )
protected

The tasks of a solver's graph that end a stage.

Global tasks do not count.

Reimplemented in exagrype.api.scalarfield.FiniteVolumesInnerCoupling._FiniteVolumes, and exagrype.api.scalarfield.RungeKuttaFD4InnerCoupling._RungeKuttaFD4.

Definition at line 211 of file InnerCouplingGenerator.py.

Referenced by construct_output().

Here is the caller graph for this function:

◆ _first_tasks()

exagrype.api.scalarfield.InnerCouplingGenerator.InnerCouplingGenerator._first_tasks ( graph,
previous_end )
staticprotected

The tasks of a solver's graph that start a stage.

Parameters
graphpeano4.api.taskgraph.Graph The graph of one solver.
previous_endList[peano4.api.taskgraph.Task] The tasks that end the previous stage, empty for the first stage. The first tasks are the sources of the graph in that case, and otherwise all tasks that wait for one of previous_end.

Definition at line 176 of file InnerCouplingGenerator.py.

Referenced by construct_output().

Here is the caller graph for this function:

◆ _number_of_stages()

int exagrype.api.scalarfield.InnerCouplingGenerator.InnerCouplingGenerator._number_of_stages ( self)
protected

Number of stages of the time integrator.

Reimplemented in exagrype.api.scalarfield.FiniteVolumesInnerCoupling._FiniteVolumes, and exagrype.api.scalarfield.RungeKuttaFD4InnerCoupling._RungeKuttaFD4.

Definition at line 203 of file InnerCouplingGenerator.py.

Referenced by construct_output().

Here is the caller graph for this function:

◆ _stage_input()

exagrype.api.scalarfield.InnerCouplingGenerator.InnerCouplingGenerator._stage_input ( self,
solver,
stage )
protected

The patch which a solver's stage reads as input (it holds the solver's unknowns of the stage's time level).

Reimplemented in exagrype.api.scalarfield.FiniteVolumesInnerCoupling._FiniteVolumes, and exagrype.api.scalarfield.RungeKuttaFD4InnerCoupling._RungeKuttaFD4.

Definition at line 207 of file InnerCouplingGenerator.py.

Referenced by construct_output(), and exagrype.api.CCZ4SolverBase.CCZ4SolverBase.generate_solver_realisation().

Here is the caller graph for this function:

◆ attach_to()

exagrype.api.scalarfield.InnerCouplingGenerator.InnerCouplingGenerator.attach_to ( self,
host )

Install the numerical schemes of the building blocks on the solvers of the host.

The host calls it when the user assigns the generator to its numerical_scheme.

Definition at line 70 of file InnerCouplingGenerator.py.

References exagrype.api.scalarfield.FiniteVolumesInnerCoupling._FiniteVolumes._create_scheme(), _create_scheme(), _host, and _schemes.

Here is the call graph for this function:

◆ construct_output()

exagrype.api.scalarfield.InnerCouplingGenerator.InnerCouplingGenerator.construct_output ( self,
exahype2_project,
peano_project,
setup_simulation,
time_step,
plot,
mesh_adaptation )

Field Documentation

◆ _host

exagrype.api.scalarfield.InnerCouplingGenerator.InnerCouplingGenerator._host = None
protected

Install the numerical schemes of the building blocks on the solvers of the host.

The host calls it when the user assigns the generator to its numerical_scheme.

Definition at line 67 of file InnerCouplingGenerator.py.

Referenced by exagrype.api.scalarfield.RungeKuttaFD4InnerCoupling._RungeKuttaFD4._create_scheme(), attach_to(), and construct_output().

◆ _schemes

dict exagrype.api.scalarfield.InnerCouplingGenerator.InnerCouplingGenerator._schemes = {}
protected

Install the numerical schemes of the building blocks on the solvers of the host.

The host calls it when the user assigns the generator to its numerical_scheme.

Definition at line 68 of file InnerCouplingGenerator.py.

Referenced by attach_to(), and construct_output().

◆ COPY_TASK_NAME

str exagrype.api.scalarfield.InnerCouplingGenerator.InnerCouplingGenerator.COPY_TASK_NAME = "Copy CCZ4 fields into {} stage {}"
static

Definition at line 54 of file InnerCouplingGenerator.py.

Referenced by construct_output().

◆ MULTIPLICATIVE

bool exagrype.api.scalarfield.InnerCouplingGenerator.InnerCouplingGenerator.MULTIPLICATIVE = False
static

Definition at line 52 of file InnerCouplingGenerator.py.

Referenced by construct_output().

◆ patch_size

◆ SYNCHRONISE_TASK_NAME

str exagrype.api.scalarfield.InnerCouplingGenerator.InnerCouplingGenerator.SYNCHRONISE_TASK_NAME = "Synchronise time step sizes"
static

Definition at line 56 of file InnerCouplingGenerator.py.

Referenced by construct_output().


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