3from .AbstractFVActionSet
import AbstractFVActionSet
12 Update a Finite Volume patch (solver._patch) from its halo-augmented
13 reconstruction (solver._patch_with_halo, see
14 toolbox.blockstructured.api.ReconstructPatchWithHalo) by applying the
15 solver's numerical scheme (Rusanov flux, explicit Euler time stepping)
18 Global time stepping: all cells share one time stamp and time step
19 size, which are taken from the solver (getMinTimeStamp() and
20 getMinTimeStepSize()) rather than from per-cell bookkeeping.
22 The compute kernel returns the maximum eigenvalue over the patch it has
23 just updated. The action set stores it in the cell data
24 solver._max_eigenvalue. exahype2.api.fv.actionsets.ComputeGlobalCFLCondition
25 reduces these values in a subsequent mesh traversal and derives the
26 next time step size from them.
30 def __init__(self, solver: Solver, guard, max_eigenvalue=
None):
33 @param solver: exahype2.api.Solver
34 Has to have solver._patch, solver._patch_with_halo and
35 solver._max_eigenvalue set - @see
36 exahype2.api.fv.RusanovWithExplicitEuler.
39 C++ boolean expression, evaluated per cell in touchCellFirstTime,
40 guarding whether that cell's patch is updated. Typically the
41 output of the solver's grid_selector (@see
42 peano4.api.toolbox.GridSelector).
44 @param max_eigenvalue: peano4.api.datamodel.DaStGen2
45 The cell data the maximum eigenvalue goes into (first entry).
46 Defaults to solver._max_eigenvalue.
49 AbstractFVActionSet.__init__(self, solver)
51 self.
_max_eigenvalue = max_eigenvalue
if max_eigenvalue
is not None else solver._max_eigenvalue
56 stride_per_dof = self.
_solver.unknowns + self.
_solver.auxiliary_variables
57 input_dofs_per_axis = self.
_solver.numerical_scheme.patch_size + 2 * self.
_solver.numerical_scheme.halo_size
58 output_dofs_per_axis = self.
_solver.numerical_scheme.patch_size
61 if operation_name == peano4.api.solversteps.ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME:
64 int inputStride = {stride_per_dof} * {input_dofs_per_axis} * {input_dofs_per_axis};
65 int outputStride = {stride_per_dof} * {output_dofs_per_axis} * {output_dofs_per_axis};
67 int inputStride = {stride_per_dof} * {input_dofs_per_axis} * {input_dofs_per_axis} * {input_dofs_per_axis};
68 int outputStride = {stride_per_dof} * {output_dofs_per_axis} * {output_dofs_per_axis} * {output_dofs_per_axis};
71 double timeStamp = repositories::{self._solver.get_name_of_global_instance()}.getMinTimeStamp();
72 double timeStepSize = repositories::{self._solver.get_name_of_global_instance()}.getMinTimeStepSize();
73 ::exahype2::CellData patchData(fineGridCell{self._solver._patch_with_halo.name}.value, marker.x(), marker.h(), timeStamp, timeStepSize, fineGridCell{self._solver._patch.name}.value);
74 ::exahype2::CopyCellDataGPU gpuPatchData(patchData, inputStride, outputStride);
75 {self._solver.compute_kernel_call}
76 gpuPatchData.copyBackAndDestroy();
78 fineGridCell{self._max_eigenvalue.name}.setMaxEigenvalue( 0, patchData.maxEigenvalue[0] );
83 if operation_name == peano4.api.solversteps.ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME:
88 return __name__.replace(
".py",
"").replace(
".",
"_")
Abstract base class for all ExaHyPE 2 solvers.
Update a Finite Volume patch (solver._patch) from its halo-augmented reconstruction (solver....
get_action_set_name(self)
You should replicate this function in each subclass, so you get meaningful action set names (otherwis...
__init__(self, Solver solver, guard, max_eigenvalue=None)
get_guard_of_operation(self, operation_name)
Return the guard of an operation.
get_body_of_operation(self, operation_name)
Return actual C++ code snippets to be inserted into C++ code.