Peano
Loading...
Searching...
No Matches
ComputeMaxEigenvalue.py
Go to the documentation of this file.
1# This file is part of the ExaHyPE2 project. For conditions of distribution and
2# use, please see the copyright notice at www.peano-framework.org
3import peano4.api
4
5from .AbstractRKFD4ActionSet import AbstractRKFD4ActionSet
6
7
9 """!
10
11 Store the maximum eigenvalue over all grid cells of a patch
12
13 The action set runs after the final linear combination of a Runge-Kutta
14 step, i.e. it sees the solution of the next time step in solver._patch.
15 It stores the maximum eigenvalue in solver._max_eigenvalue, from where
16 exahype2.api.rkfd4.actionsets.ComputeTimeStepSize reduces it into the
17 next time step size.
18
19 """
20
21 def __init__(self, solver, guard):
22 """!
23
24 @param solver: exahype2.api.Solver
25 Has to have an exahype2.api.rkfd4.CentralDifferencesWithRungeKutta
26 with adaptive time stepping as numerical scheme, which has already
27 constructed its kernel calls.
28
29 @param guard: str
30 C++ boolean expression, evaluated per cell in touchCellFirstTime.
31
32 """
33 AbstractRKFD4ActionSet.__init__(self, solver)
34 self.guard = guard
35
36 def get_body_of_operation(self, operation_name):
37 if (
38 operation_name
39 != peano4.api.solversteps.ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME
40 ):
41 return ""
42 instance = self._solver.get_name_of_global_instance()
43 return f"""
44 ::exahype2::CellData patchData(
45 fineGridCell{self._solver._patch.name}.value,
46 marker.x(),
47 marker.h(),
48 repositories::{instance}.getMinTimeStamp(),
49 repositories::{instance}.getMinTimeStepSize(),
50 fineGridCell{self._solver._patch.name}.value
51 );
52 {self._solver.numerical_scheme.max_eigenvalue_kernel_call}
53 fineGridCell{self._solver._max_eigenvalue.name}.setMaxEigenvalue( 0, patchData.maxEigenvalue[0] );
54"""
55
56 def get_guard_of_operation(self, operation_name):
57 if (
58 operation_name
59 == peano4.api.solversteps.ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME
60 ):
61 return self.guard
62 return "true"
63
65 return __name__.replace(".py", "").replace(".", "_")
Base class of the action sets of exahype2.api.rkfd4 which work against the solver.
Store the maximum eigenvalue over all grid cells of a patch.
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.
get_action_set_name(self)
You should replicate this function in each subclass, so you get meaningful action set names (otherwis...