3from .AbstractFVActionSet
import AbstractFVActionSet
5from ...AuxiliaryVariables
import code_to_assemble_kernel_input
12 Store the maximum eigenvalue over the volumes of a patch
14 The action set runs after the patch update, i.e. it sees the updated
15 solution in solver._patch. It invokes the eigenvalue kernel, which is a
16 kernel of its own and not a by-product of the time step kernel, and
17 stores the outcome in the first entry of the cell data
18 max_eigenvalue (by default solver._max_eigenvalue). It does nothing
19 else: the reduction over the cells is a task of its own
20 (@ref exahype2.api.fv.actionsets.ReduceMaxEigenvalue), and
21 exahype2.api.fv.actionsets.ComputeGlobalCFLCondition derives the next
22 time step size from its outcome. The task graph compiler can fuse the
23 update, the eigenvalue computation and the reduction into one mesh
28 def __init__(self, solver, guard, max_eigenvalue=None):
31 @param solver: exahype2.api.Solver
32 Has to have solver._patch and solver._max_eigenvalue set, and
33 solver.numerical_scheme.max_eigenvalue_kernel_call constructed -
34 @see exahype2.api.fv.RusanovWithExplicitEuler.
37 C++ boolean expression, evaluated per cell in touchCellFirstTime.
39 @param max_eigenvalue: peano4.api.datamodel.DaStGen2
40 The cell data the maximum eigenvalue goes into (first entry).
41 Defaults to solver._max_eigenvalue.
44 AbstractFVActionSet.__init__(self, solver)
47 max_eigenvalue
if max_eigenvalue
is not None else solver._max_eigenvalue
53 != peano4.api.solversteps.ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME
57 unknowns = f
"fineGridCell{solver._patch.name}.value"
58 has_parameters = len(solver.auxiliary_variables) > 0
59 kernel_in =
"kernelIn.data()" if has_parameters
else unknowns
61 {code_to_assemble_kernel_input(solver, "kernelIn", unknowns, 0, lambda auxiliary: f"fineGridCell{auxiliary.patch.name}.value")}
62 ::exahype2::CellData patchData(
66 repositories::{solver.get_name_of_global_instance()}.getMinTimeStamp(),
67 repositories::{solver.get_name_of_global_instance()}.getMinTimeStepSize(),
70 {solver.numerical_scheme.max_eigenvalue_kernel_call}
71 fineGridCell{self._max_eigenvalue.name}.setMaxEigenvalue( 0, patchData.maxEigenvalue[0] );
77 == peano4.api.solversteps.ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME
83 return __name__.replace(
".py",
"").replace(
".",
"_")
Store the maximum eigenvalue over the volumes of a patch.
get_body_of_operation(self, operation_name)
Return actual C++ code snippets to be inserted into C++ code.
__init__(self, solver, guard, max_eigenvalue=None)
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.