1""" This file is part of the ExaGRyPE project. For conditions of distribution and
2 use, please see the copyright notice at www.peano-framework.org
8from ..FOCCZ4Solver
import FOCCZ4Solver
9from .ScalarField
import ScalarField
15 First-order CCZ4 and an advected scalar field with one numerical scheme for both
17 In an inner coupling, the numerical scheme sits in the coupled solver, i.e.
18 in this class. The two aggregated solvers hold no numerical scheme of
19 their own, and the user must not assign one to them. Instead, the user
20 attaches a "generator" (a numerical scheme of the coupled system) to the
23 coupled = exagrype.api.scalarfield.CCZ4WithScalarField_InnerCoupling()
24 coupled.numerical_scheme = exagrype.api.scalarfield.RungeKuttaFD4InnerAdditive(patch_size=9, rk_order=4)
26 There are four generators, one for each combination of Finite Volumes
27 (explicit Euler) or Runge-Kutta with fourth-order Finite Differences, and
28 of multiplicative or additive coupling. They exchange the data in each
29 stage of the time integrator, i.e. both solvers advance the same stage,
30 and the solvers see each other's data of the same time level. This gives
31 the time integration order of the scheme: the lapse that the scalar field
32 sees in stage k is the lapse of the stage input of CCZ4.
33 The generators build the whole task graph of the combination, see
34 @ref exagrype.api.scalarfield.InnerCouplingGenerator.
36 Grid construction and plotters are not part of a generator, they are
37 assigned to the solvers (host.ccz4, host.scalar_field) as always. The
38 coupling is one-directional (fake coupling): CCZ4 does not see the field.
39 The auxiliary variables of the scalar field hold the CCZ4 fields and change
40 in each stage (exahype2.api.AuxiliaryVariables.Mode.CHANGING_ON_FACES).
44 def __init__(self, ccz4_name: str =
"CCZ4", scalar_field_name: str =
"ScalarField"):
48 Name of the CCZ4 solver.
50 @param scalar_field_name: str
51 Name of the scalar field solver.
57 dict(FOCCZ4Solver.Unknowns),
58 mode=exahype2.api.AuxiliaryVariables.Mode.CHANGING_ON_FACES,
59 data_name=
"CCZ4FieldsForScalarField",
62 self.
_name = f
"{ccz4_name}With{scalar_field_name}"
71 """ The solvers the project has to register; exahype2.api.Project.add_solver() asks for them """
76 """! The generator, i.e. the numerical scheme of the coupled system """
79 @numerical_scheme.setter
83 Attach the generator of the coupled system
85 The aggregated solvers must not hold a numerical scheme of their own yet: the
86 generator installs the building blocks on the solvers itself.
90 if solver.numerical_scheme
is not None:
92 f
"Solver {solver.name} holds a numerical scheme of its own. "
93 f
"In an inner coupling, assign the numerical scheme to the coupled solver {self.name} only"
95 generator.attach_to(self)
109 Let the generator build the task graph of the coupled system and add it to the project's graphs
111 The arguments are those of exahype2.api.Solver.generate_solver_realisation().
116 f
"Coupled solver {self.name} has no numerical_scheme set. Assign a generator, "
117 "e.g. exagrype.api.scalarfield.RungeKuttaFD4InnerAdditive, to numerical_scheme."
Solver for the Einstein equations in the first-order CCZ4 formulation.
First-order CCZ4 and an advected scalar field with one numerical scheme for both.
__init__(self, str ccz4_name="CCZ4", str scalar_field_name="ScalarField")
numerical_scheme(self)
The generator, i.e.
generate_solver_realisation(self, exahype2_project, peano_project, setup_simulation, time_step, plot, mesh_adaptation)
Let the generator build the task graph of the coupled system and add it to the project's graphs.
Four scalar fields which a spacetime advects.
A set of auxiliary variables of a solver.
Singleton logger for the Peano 4 Python API.