Peano
Loading...
Searching...
No Matches
ReduceMaxEigenvalue.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 Reduce the maximum eigenvalues of the cells into the solver
12
13 exahype2.api.rkfd4.actionsets.ComputeMaxEigenvalue stores the maximum
14 eigenvalue per cell in solver._max_eigenvalue. The action set visits each
15 cell and hands this value to the solver's reduceMaxEigenvalue(), which
16 takes the maximum over all cells and threads of the rank. It writes the
17 global datum from which
18 exahype2.api.rkfd4.actionsets.ComputeTimeStepSize derives the next time
19 step size at the end of the time step. The action set does not touch
20 anything else, i.e. neither the solution nor the faces.
21
22 """
23
24 def __init__(self, solver, guard):
25 """!
26
27 @param solver: exahype2.api.Solver
28 Has to have an exahype2.api.rkfd4.CentralDifferencesWithRungeKutta
29 with adaptive time stepping as numerical scheme.
30
31 @param guard: str
32 C++ boolean expression, evaluated per cell in touchCellFirstTime.
33 Has to match the guard of exahype2.api.rkfd4.actionsets.ComputeMaxEigenvalue.
34
35 """
36 AbstractRKFD4ActionSet.__init__(self, solver)
37 self.guard = guard
38
39 def get_body_of_operation(self, operation_name):
40 if (
41 operation_name
42 != peano4.api.solversteps.ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME
43 ):
44 return ""
45 instance = self._solver.get_name_of_global_instance()
46 return f"""
47 repositories::{instance}.reduceMaxEigenvalue( fineGridCell{self._solver._max_eigenvalue.name}.getMaxEigenvalue(0) );
48"""
49
50 def get_guard_of_operation(self, operation_name):
51 if (
52 operation_name
53 == peano4.api.solversteps.ActionSet.OPERATION_TOUCH_CELL_FIRST_TIME
54 ):
55 return self.guard
56 return "true"
57
59 return __name__.replace(".py", "").replace(".", "_")
Base class of the action sets of exahype2.api.rkfd4 which work against the solver.
Reduce the maximum eigenvalues of the cells into the solver.
get_guard_of_operation(self, operation_name)
Return the guard of an operation.
get_action_set_name(self)
You should replicate this function in each subclass, so you get meaningful action set names (otherwis...
get_body_of_operation(self, operation_name)
Return actual C++ code snippets to be inserted into C++ code.