3from .AbstractFVActionSet
import AbstractFVActionSet
6from ...AuxiliaryVariables
import (
7 code_to_assemble_kernel_input,
8 code_to_allocate_kernel_output,
9 code_to_copy_back_kernel_output,
17 Update a Finite Volume patch (solver._patch) from its halo-augmented
18 reconstruction (solver._patch_with_halo, see
19 toolbox.blockstructured.api.ReconstructPatchWithHalo) by applying the
20 solver's numerical scheme (Rusanov flux, explicit Euler time stepping)
23 Global time stepping: all cells share one time stamp and time step
24 size, which are taken from the solver (getMinTimeStamp() and
25 getMinTimeStepSize()) rather than from per-cell bookkeeping.
27 The kernel does not return any eigenvalue: exahype2.api.fv.actionsets.ComputeMaxEigenvalue
28 determines it in a task of its own, and
29 exahype2.api.fv.actionsets.ComputeGlobalCFLCondition derives the next
30 time step size from it.
37 @param solver: exahype2.api.Solver
38 Has to have solver._patch and
39 solver._patch_with_halo set - @see
40 exahype2.api.fv.RusanovWithExplicitEuler.
43 C++ boolean expression, evaluated per cell in touchCellFirstTime,
44 guarding whether that cell's patch is updated. Typically the
45 output of the solver's grid_selector (@see
46 peano4.api.toolbox.GridSelector).
49 AbstractFVActionSet.__init__(self, solver)
55 stride_per_dof = self.
_solver.unknowns + self.
_solver.number_of_auxiliary_variables
56 input_dofs_per_axis = self.
_solver.numerical_scheme.patch_size + 2 * self.
_solver.numerical_scheme.halo_size
57 output_dofs_per_axis = self.
_solver.numerical_scheme.patch_size
60 if operation_name == peano4.api.solversteps.ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME:
62 unknowns_in = f
"fineGridCell{solver._patch_with_halo.name}.value"
63 unknowns_out = f
"fineGridCell{solver._patch.name}.value"
64 has_parameters = len(solver.auxiliary_variables) > 0
65 kernel_in =
"kernelIn.data()" if has_parameters
else unknowns_in
66 kernel_out =
"kernelOut.data()" if has_parameters
else unknowns_out
69 int inputStride = {stride_per_dof} * {input_dofs_per_axis} * {input_dofs_per_axis};
70 int outputStride = {stride_per_dof} * {output_dofs_per_axis} * {output_dofs_per_axis};
72 int inputStride = {stride_per_dof} * {input_dofs_per_axis} * {input_dofs_per_axis} * {input_dofs_per_axis};
73 int outputStride = {stride_per_dof} * {output_dofs_per_axis} * {output_dofs_per_axis} * {output_dofs_per_axis};
76 double timeStamp = repositories::{self._solver.get_name_of_global_instance()}.getMinTimeStamp();
77 double timeStepSize = repositories::{self._solver.get_name_of_global_instance()}.getMinTimeStepSize();
78 {code_to_assemble_kernel_input(solver, "kernelIn", unknowns_in, solver.numerical_scheme.halo_size)}
79 {code_to_allocate_kernel_output(solver, "kernelOut")}
80 ::exahype2::CellData patchData({kernel_in}, marker.x(), marker.h(), timeStamp, timeStepSize, {kernel_out});
81 ::exahype2::CopyCellDataGPU gpuPatchData(patchData, inputStride, outputStride);
82 {self._solver.compute_kernel_call}
83 gpuPatchData.copyBackAndDestroy();
84 {code_to_copy_back_kernel_output(solver, "kernelOut", unknowns_out)}
90 if operation_name == peano4.api.solversteps.ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME:
95 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....
__init__(self, Solver solver, guard)
get_action_set_name(self)
You should replicate this function in each subclass, so you get meaningful action set names (otherwis...
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.