3from .AbstractFVActionSet
import AbstractFVActionSet
11 Validate the estimated time step size of an optimistic patch interior update
13 The second entry of solver._max_eigenvalue_and_time_step_sizes holds the
14 time step size the patch interior has been updated with optimistically
15 (@see exahype2.api.fv.actionsets.SpawnTaskToUpdateCellInterior). The
16 action set compares it to the admissible time step size, i.e. the time
17 step size the solver would use if it had not been enforced to use a
18 smaller one (@see exahype2::Solver::getAdmissibleTimeStepSize()):
20 - If the admissible time step size is zero, i.e. in the very first time
21 step, there is no estimate yet. The action set sets the fourth entry
22 to zero and does not read the second entry.
23 - If the estimate is bigger than the admissible time step size, we have
24 overestimated the admissible time step size. The action set
25 invalidates the estimate, i.e. sets it to the maximum double value.
26 - If the estimate is smaller than or equal to the admissible time step
27 size, subject to floating point accuracy (tarch::la::equals()), the
28 action set enforces the estimate as the solver's minimum and maximum
29 time step size (@see exahype2::Solver::enforceTimeStepSize()).
31 In the latter two cases, the action set stores the admissible time step
32 size in the fourth entry. It is the time step size the solver could have
33 chosen, whether or not the estimate is enforced.
40 @param solver: exahype2.api.Solver
41 Has to have solver._max_eigenvalue_and_time_step_sizes set - @see
42 exahype2.api.fv.RusanovWithOptimisticExplicitEuler.
45 C++ boolean expression, evaluated per cell in touchCellFirstTime,
46 guarding whether that cell's estimate is checked.
49 AbstractFVActionSet.__init__(self, solver)
54 if operation_name == peano4.api.solversteps.ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME:
55 solver = f
"repositories::{self._solver.get_name_of_global_instance()}"
56 data = f
"fineGridCell{self._solver._max_eigenvalue_and_time_step_sizes.name}"
58 const double admissibleTimeStepSize = {solver}.getAdmissibleTimeStepSize();
59 if ( tarch::la::equals(admissibleTimeStepSize, 0.0) ) {{
60 {data}.setMaxEigenvalue(3, 0.0);
63 const double estimatedTimeStepSize = {data}.getMaxEigenvalue(1);
64 if (estimatedTimeStepSize < admissibleTimeStepSize or tarch::la::equals(estimatedTimeStepSize, admissibleTimeStepSize)) {{
65 {solver}.enforceTimeStepSize(estimatedTimeStepSize);
68 {data}.setMaxEigenvalue(1, std::numeric_limits<double>::max());
70 {data}.setMaxEigenvalue(3, admissibleTimeStepSize);
76 if operation_name == peano4.api.solversteps.ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME:
83 Never spawn this action set as a task
85 The check is a handful of floating point comparisons per cell, i.e.
86 far too cheap to justify the overhead of a task. Task graph compilers
87 such as @ref peano4.api.taskgraph.compiler.CellTaskProducerConsumer
88 therefore keep it within the mesh traversal. It does not touch the
89 patch data, so it does not depend on the reconstruction task which
90 the producer spawns before.
98#include "tarch/la/ScalarOperations.h"
102 return __name__.replace(
".py",
"").replace(
".",
"_")
Validate the estimated time step size of an optimistic patch interior update.
get_includes(self)
Return include statements that you need.
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.
may_run_in_background_task(self)
Never spawn this action set as a task.
get_action_set_name(self)
You should replicate this function in each subclass, so you get meaningful action set names (otherwis...
__init__(self, solver, guard)