5from .AbstractRKFD4ActionSet
import AbstractRKFD4ActionSet
11 Add advection terms with lopsided stencils to the right-hand side of one Runge-Kutta stage
13 The action set reads the input of the stage with its halo
14 (solver._patch_with_halo) and adds the advection terms to the stage's
15 slot of solver._rhs_estimates via
16 exahype2::fd::addLopsidedAdvection(). It has to run after
17 exahype2.api.rkfd4.actionsets.EvaluateRightHandSide, which overwrites
18 the slot, within the same task. @ref
19 exahype2.api.rkfd4.CentralDifferencesWithRungeKutta arranges this if
20 the user selects the kernel CentralDifferencesWithLopsidedAdvection.
24 def __init__(self, solver, stage, velocity, quantities, guard):
27 @param solver: exahype2.api.Solver
28 Has to have an exahype2.api.rkfd4.CentralDifferencesWithRungeKutta
32 Number of the Runge-Kutta stage, starting with zero.
34 @param velocity: List[int]
35 Indices of the entries of Q which hold the velocity, one per
38 @param quantities: List[int]
39 Indices of the unknowns which are advected.
42 C++ boolean expression, evaluated per cell in touchCellFirstTime.
54 != peano4.api.solversteps.ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME
57 scheme = self.
_solver.numerical_scheme
59 unknowns = self.
_solver.unknowns
60 velocity =
", ".join(str(index)
for index
in self.
velocity)
61 quantities =
", ".join(str(quantity)
for quantity
in self.
quantities)
63 constexpr int advectionVelocity[] = {{ {velocity} }};
64 constexpr int advectedQuantities[] = {{ {quantities} }};
65 static_assert(sizeof(advectionVelocity) / sizeof(int) == Dimensions, "The advection velocity needs one entry per dimension");
67 double* estimate = fineGridCell{self._solver._rhs_estimates.name}.value + {self.stage * unknowns * n * n};
69 double* estimate = fineGridCell{self._solver._rhs_estimates.name}.value + {self.stage * unknowns * n * n * n};
71 ::exahype2::fd::addLopsidedAdvection(
72 fineGridCell{self._solver._patch_with_halo.name}.value,
78 {self._solver.auxiliary_variables},
81 {len(self.quantities)}
88 == peano4.api.solversteps.ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME
94 return super().
get_includes() +
'\n#include "exahype2/fd/LopsidedAdvection.h"\n'
97 return __name__.replace(
".py",
"").replace(
".",
"_")
Base class of the action sets of exahype2.api.rkfd4 which work against the solver.
Add advection terms with lopsided stencils to the right-hand side of one Runge-Kutta stage.
__init__(self, solver, stage, velocity, quantities, guard)
get_body_of_operation(self, operation_name)
Return actual C++ code snippets to be inserted into C++ code.
get_guard_of_operation(self, operation_name)
Return the guard of an operation.
get_action_set_name(self)
You should replicate this function in each subclass, so you get meaningful action set names (otherwis...
get_includes(self)
The includes cover the kernels the numerical scheme generates (exahype2.api.rkfd4....