Peano
Loading...
Searching...
No Matches
RungeKuttaFD4InnerCoupling.py
Go to the documentation of this file.
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
3"""
4
5import exahype2.api
6
7from ..FOCCZ4Solver import FOCCZ4Solver
8from .InnerCouplingGenerator import InnerCouplingGenerator
9
10
12 """!
13
14 Fourth-order Finite Differences with Runge-Kutta for both solvers (@ref exahype2.api.rkfd4.CentralDifferencesWithRungeKutta)
15
16 The solvers exchange data in each Runge-Kutta stage. CCZ4 uses the lopsided advection of its shift.
17
18 """
19
20 def __init__(self, patch_size: int, rk_order: int):
21 """!
22
23 @param patch_size: int
24 Number of grid cells per patch and axis. The same for both solvers.
25
26 @param rk_order: int
27 Order of the Runge-Kutta scheme, i.e. its number of stages (one to four).
28
29 """
30 super().__init__(patch_size)
31 self.rk_order = rk_order
32
33 def _create_scheme(self, solver):
35 if solver is self._host.ccz4:
36 return Scheme(
37 solver,
39 rk_order=self.rk_order,
40 right_hand_side_kernel=Scheme.RightHandSideKernel.CentralDifferencesWithLopsidedAdvection,
41 advection_velocity=FOCCZ4Solver.ADVECTION_VELOCITY,
42 advected_quantities=solver.lopsided_advection_quantities(),
43 )
44 return Scheme(solver, self.patch_size, rk_order=self.rk_order)
45
46 def _number_of_stages(self) -> int:
47 return self.rk_order
48
49 def _stage_input(self, solver, stage):
50 return solver._patch if stage == 0 else solver._stage_input
51
52 def _end_of_stage(self, solver, graph, stage):
53 if stage == self.rk_order - 1:
54 return [task for task in graph.sink_tasks() if not task.entity.is_global]
55 name = f"{solver.name}_Roll over stage {stage + 1} faces"
56 return [task for task in graph.tasks if task.name == name]
57
58
60 """! Runge-Kutta; in each stage, the scalar field's stage follows the one of CCZ4 """
61
62 MULTIPLICATIVE = True
63
64
66 """! Runge-Kutta; in each stage, the stages of CCZ4 and the scalar field run in parallel """
67
68 MULTIPLICATIVE = False
Numerical scheme of the coupled solver exagrype.api.scalarfield.CCZ4WithScalarField_InnerCoupling.
_host
Install the numerical schemes of the building blocks on the solvers of the host.
Runge-Kutta; in each stage, the stages of CCZ4 and the scalar field run in parallel.
Runge-Kutta; in each stage, the scalar field's stage follows the one of CCZ4.
Fourth-order Finite Differences with Runge-Kutta for both solvers (exahype2.api.rkfd4....
_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 l...
_create_scheme(self, solver)
The numerical scheme of one of the solvers, i.e.
_end_of_stage(self, solver, graph, stage)
The tasks of a solver's graph that end a stage.
int _number_of_stages(self)
Number of stages of the time integrator.
Fourth-order central Finite Differences with explicit Runge-Kutta time stepping, realised over a bloc...