|
Peano
|
Derive the next global time step size from the CFL condition. More...


Public Member Functions | |
| __init__ (self, solver, cfl_constant, patch_size) | |
| get_body_of_unprepareTraversal (self) | |
| Called once per rank, after the sweep - the one safe place both to read the solver's reduced maximum eigenvalue (nothing can still be writing it) and to issue an MPI reduction: tarch.mpi.Rank.allReduce()'s own documentation requires "only one
thread per rank" to ever call it, which a once-per-rank static method already guarantees. | |
| get_includes (self) | |
| Return include statements that you need. | |
| get_action_set_name (self) | |
| You should replicate this function in each subclass, so you get meaningful action set names (otherwise, it will be AbstractFVActionSet0,1,2,...). | |
| Public Member Functions inherited from exahype2.api.fv.actionsets.AbstractFVActionSet.AbstractFVActionSet | |
| __init__ (self, solver) | |
| solver: ADERDG Reference to creating class | |
| user_should_modify_template (self) | |
| Is the user allowed to modify the output. | |
| Public Member Functions inherited from peano4.api.solversteps.ActionSet.ActionSet | |
| __init__ (self, descend_invocation_order=0, parallel=False) | |
| get_constructor_body (self) | |
| Define a tailored constructor body. | |
| get_static_initialisations (self, full_qualified_classname) | |
| get_destructor_body (self) | |
| get_body_of_createGridControlEventsForNextTraversal (self) | |
| Return the grid control events that this action set wants to trigger. | |
| get_implementation_of_createGridControlEventsForNextTraversal (self) | |
| Return the C++ implementation of createGridControlEventsForNextTraversal(). | |
| get_body_of_prepareTraversal (self) | |
| get_implementation_of_prepareTraversal (self) | |
| Return the C++ implementation of prepareTraversal(). | |
| get_implementation_of_unprepareTraversal (self) | |
| Return the C++ implementation of unprepareTraversal(). | |
| 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. | |
| get_implementation_of_operation (self, operation_name) | |
| Return the C++ implementation of an operation. | |
| bool | may_run_in_background_task (self) |
| May a task graph compiler move touchCellFirstTime() into a task. | |
| get_attributes (self) | |
| Return attributes as copied and pasted into the generated class. | |
Data Fields | |
| cfl_constant = cfl_constant | |
| patch_size = patch_size | |
Derive the next global time step size from the CFL condition.
exahype2.api.fv.actionsets.ComputeMaxEigenvalue stores the maximum eigenvalue of every patch per cell, and exahype2.api.fv.actionsets.ReduceMaxEigenvalue reduces these values into the solver. This action set acts in unprepareTraversal() only: it reads and resets the solver's reduced maximum eigenvalue, turns it into the next time step size, and feeds it into exahype2.Solver's own time step bookkeeping (updateCell()/finishTimeStep()/startTimeStep()). There is deliberately no separate, solver-level time stamp/time step size state on top of exahype2.Solver.
The action set touches no mesh data. The task that hosts it hence is a GLOBAL_END_OF_STEP task (peano4.api.taskgraph.Task.Task.GridEntity), which the task graph compiler fuses into the last traversal of the time step instead of spending a traversal on it.
Global time stepping: all cells share one time stamp and time step size, which are taken from the solver (getMinTimeStamp() and getMinTimeStepSize()) rather than from per-cell bookkeeping.
The kernel updates all dimensions in one explicit Euler step, so the CFL condition reads dt * sum_d lambda_d/h_d <= 1, i.e. the admissible time step size is cfl_constant * h / (Dimensions * lambda_max), with h the minimal volume size and lambda_max the maximum eigenvalue.
As this is global time stepping, getMinTimeStamp()==getMaxTimeStamp() and getMinTimeStepSize()==getMaxTimeStepSize() always hold. Hence a single updateCell() call per time step, not one per cell, is enough to keep both the min and the max in sync.
Definition at line 8 of file ComputeGlobalCFLCondition.py.
| exahype2.api.fv.actionsets.ComputeGlobalCFLCondition.ComputeGlobalCFLCondition.__init__ | ( | self, | |
| solver, | |||
| cfl_constant, | |||
| patch_size ) |
| solver | exahype2.api.Solver Has to host the reduction of the maximum eigenvalue (exahype2.api.fv.MaxEigenvalueReduction). |
| cfl_constant | float Safety factor the admissible time step size is scaled down by, relative to the theoretical CFL=1 stability limit (which already accounts for the number of dimensions, see class docstring) - |
| patch_size | int Number of Finite Volumes per patch and dimension. The CFL condition is evaluated over the volume size, i.e. the cell size divided by patch_size. |
Definition at line 44 of file ComputeGlobalCFLCondition.py.
| exahype2.api.fv.actionsets.ComputeGlobalCFLCondition.ComputeGlobalCFLCondition.get_action_set_name | ( | self | ) |
You should replicate this function in each subclass, so you get meaningful action set names (otherwise, it will be AbstractFVActionSet0,1,2,...).
Reimplemented from exahype2.api.fv.actionsets.AbstractFVActionSet.AbstractFVActionSet.
Definition at line 164 of file ComputeGlobalCFLCondition.py.
| exahype2.api.fv.actionsets.ComputeGlobalCFLCondition.ComputeGlobalCFLCondition.get_body_of_unprepareTraversal | ( | self | ) |
Called once per rank, after the sweep - the one safe place both to read the solver's reduced maximum eigenvalue (nothing can still be writing it) and to issue an MPI reduction: tarch.mpi.Rank.allReduce()'s own documentation requires "only one thread per rank" to ever call it, which a once-per-rank static method already guarantees.
This combines two different kinds of "global", reduced two different ways:
Once newTimeStepSize is known, it folds it into the solver's own time step bookkeeping (see this class' docstring for why a single updateCell() call, not one per cell, is correct for this solver). newTimeStepSize is not truncated by MaxTerminalTime: the last time step may overshoot the end time, and the simulation stops afterwards, i.e. MaxTerminalTime is a lower bound on the final time. The time stamp is advanced by the time step size the update used (getMaxTimeStepSize() before updateCell()), not by newTimeStepSize, which only the next update uses. The very first time step therefore runs with time step size 0 and leaves the time stamp at 0: it only yields the first admissible time step size.
Reimplemented from peano4.api.solversteps.ActionSet.ActionSet.
Definition at line 69 of file ComputeGlobalCFLCondition.py.
Referenced by peano4.api.solversteps.ActionSet.ActionSet.get_implementation_of_unprepareTraversal().

| exahype2.api.fv.actionsets.ComputeGlobalCFLCondition.ComputeGlobalCFLCondition.get_includes | ( | self | ) |
Return include statements that you need.
All of these includes will eventually end up in the header of the generated C++ code.
Reimplemented from exahype2.api.fv.actionsets.AbstractFVActionSet.AbstractFVActionSet.
Definition at line 152 of file ComputeGlobalCFLCondition.py.
| exahype2.api.fv.actionsets.ComputeGlobalCFLCondition.ComputeGlobalCFLCondition.cfl_constant = cfl_constant |
| exahype2.api.fv.actionsets.ComputeGlobalCFLCondition.ComputeGlobalCFLCondition.patch_size = patch_size |
Definition at line 67 of file ComputeGlobalCFLCondition.py.
Referenced by exahype2.api.fv.RusanovWithExplicitEuler.RusanovWithExplicitEuler.__add_data_to_repository(), exahype2.api.rkfd4.CentralDifferencesWithRungeKutta.CentralDifferencesWithRungeKutta.__add_data_to_repository(), exahype2.api.fv.RusanovWithExplicitEuler.RusanovWithExplicitEuler.__create_data_structures(), exahype2.api.fv.RusanovWithOptimisticExplicitEuler.RusanovWithOptimisticExplicitEuler.__create_data_structures(), exahype2.api.rkfd4.CentralDifferencesWithRungeKutta.CentralDifferencesWithRungeKutta.__create_data_structures(), exahype2.api.fv.RusanovWithOptimisticExplicitEuler.RusanovWithOptimisticExplicitEuler.construct_output(), and exahype2.api.fv.actionsets.InsertPatchInterior.InsertPatchInterior.get_body_of_operation().