|
Peano
|
Reduce the cells' maximum eigenvalues and derive the next global time step size from the CFL condition. More...


Public Member Functions | |
| __init__ (self, solver, cfl_constant, patch_size, guard, max_eigenvalue=None) | |
| get_body_of_prepareTraversal (self) | |
| prepareTraversal() is static - called once per rank, before any instance of this action set is created - so it can only ever touch static members, never a per-instance one. | |
| get_body_of_unprepareTraversal (self) | |
| Called once per rank, after every instance of this action set for the current grid sweep has already been destroyed (see get_body_of_prepareTraversal()'s note on the static/per-instance split) - the one safe place both to read _maxEigenvalue (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_attributes (self) | |
| Return attributes as copied and pasted into the generated class. | |
| get_static_initialisations (self, full_qualified_classname) | |
| 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. | |
| 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 | |
| user_should_modify_template (self) | |
| Is the user allowed to modify the output. | |
Public Member Functions inherited from peano4.api.solversteps.ActionSet.ActionSet | |
| get_constructor_body (self) | |
| Define a tailored constructor body. | |
| 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_implementation_of_prepareTraversal (self) | |
| Return the C++ implementation of prepareTraversal() | |
| get_implementation_of_unprepareTraversal (self) | |
| Return the C++ implementation of unprepareTraversal() | |
| 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. | |
Data Fields | |
| guard | |
| cfl_constant | |
| patch_size | |
Data Fields inherited from peano4.api.solversteps.ActionSet.ActionSet | |
| descend_invocation_order | |
| parallel | |
Protected Attributes | |
| _max_eigenvalue | |
Protected Attributes inherited from exahype2.api.fv.actionsets.AbstractFVActionSet.AbstractFVActionSet | |
| _solver | |
Reduce the cells' maximum eigenvalues and derive the next global time step size from the CFL condition.
exahype2.api.fv.actionsets.UpdateCell stores the maximum eigenvalue of every patch it has updated in the cell data solver._max_eigenvalue. This action set runs in a subsequent mesh traversal: touchCellFirstTime() folds each cell's value into the static _maxEigenvalue, and unprepareTraversal() turns the global maximum 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.
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, | |||
| guard, | |||
max_eigenvalue = None |
|||
| ) |
| solver | exahype2.api.Solver Has to have solver._max_eigenvalue set - |
| 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. |
| guard | str C++ boolean expression, evaluated per cell in touchCellFirstTime, guarding whether that cell contributes to the CFL condition. Has to match the guard of exahype2.api.fv.actionsets.UpdateCell, as only the cells updated there hold a valid maximum eigenvalue. |
| max_eigenvalue | peano4.api.datamodel.DaStGen2 The cell data holding the maximum eigenvalue (first entry). Defaults to solver._max_eigenvalue. |
Reimplemented from exahype2.api.fv.actionsets.AbstractFVActionSet.AbstractFVActionSet.
Definition at line 40 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 222 of file ComputeGlobalCFLCondition.py.
| exahype2.api.fv.actionsets.ComputeGlobalCFLCondition.ComputeGlobalCFLCondition.get_attributes | ( | self | ) |
Return attributes as copied and pasted into the generated class.
Please note that action sets are not persistent, i.e. there is one object creation per grid sweep per tree.
Reimplemented from peano4.api.solversteps.ActionSet.ActionSet.
Definition at line 178 of file ComputeGlobalCFLCondition.py.
| exahype2.api.fv.actionsets.ComputeGlobalCFLCondition.ComputeGlobalCFLCondition.get_body_of_operation | ( | self, | |
| operation_name | |||
| ) |
Return actual C++ code snippets to be inserted into C++ code.
See class' string constants starting with OPERATION_ for possible values of operation_name. The snippet is executed if and only if the guard returned by get_guard_of_operation() holds, i.e. the body should not evaluate the guard itself. See the section "Guard and body" in the class documentation.
Reimplemented from peano4.api.solversteps.ActionSet.ActionSet.
Definition at line 208 of file ComputeGlobalCFLCondition.py.
Referenced by peano4.api.solversteps.ActionSet.ActionSet.get_implementation_of_operation().

| exahype2.api.fv.actionsets.ComputeGlobalCFLCondition.ComputeGlobalCFLCondition.get_body_of_prepareTraversal | ( | self | ) |
prepareTraversal() is static - called once per rank, before any instance of this action set is created - so it can only ever touch static members, never a per-instance one.
_maxEigenvalue is static for exactly that reason: it is reset here, once, before every grid sweep, and then accumulated into by potentially many instances of this action set (one per tree, possibly running on different threads concurrently) as touchCellFirstTime() visits the cells - see _semaphore, which guards that concurrent access.
Reimplemented from peano4.api.solversteps.ActionSet.ActionSet.
Definition at line 77 of file ComputeGlobalCFLCondition.py.
Referenced by peano4.api.solversteps.ActionSet.ActionSet.get_implementation_of_prepareTraversal().

| exahype2.api.fv.actionsets.ComputeGlobalCFLCondition.ComputeGlobalCFLCondition.get_body_of_unprepareTraversal | ( | self | ) |
Called once per rank, after every instance of this action set for the current grid sweep has already been destroyed (see get_body_of_prepareTraversal()'s note on the static/per-instance split) - the one safe place both to read _maxEigenvalue (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 92 of file ComputeGlobalCFLCondition.py.
Referenced by peano4.api.solversteps.ActionSet.ActionSet.get_implementation_of_unprepareTraversal().

| exahype2.api.fv.actionsets.ComputeGlobalCFLCondition.ComputeGlobalCFLCondition.get_guard_of_operation | ( | self, | |
| operation_name | |||
| ) |
Return the guard of an operation.
The guard is a C++ boolean expression. The body of the operation (see get_body_of_operation()) is executed if and only if the guard holds. The guard can use the same arguments as the body, i.e. the marker and the fine and coarse grid data. By default, the guard is true, i.e. the body is always executed.
See class' string constants starting with OPERATION_ for possible values of operation_name.
Reimplemented from peano4.api.solversteps.ActionSet.ActionSet.
Definition at line 217 of file ComputeGlobalCFLCondition.py.
References solvers.fv.actionsets.AdaptivityCriterion.AdaptivityCriterion.guard, solvers.fv.actionsets.HandleBoundary.HandleBoundary.guard, solvers.fv.actionsets.InitialCondition.InitialCondition.guard, solvers.fv.actionsets.PostprocessSolution.EmptyPostprocessSolution.guard, solvers.fv.actionsets.PostprocessSolution.VolumeWisePostprocessSolution.guard, solvers.fv.actionsets.PreprocessSolution.EmptyPreprocessSolution.guard, solvers.fv.actionsets.PreprocessSolution.VolumeWisePreprocessSolution.guard, solvers.fv.EnclaveTasking.MergeEnclaveTaskOutcome.guard, solvers.limiting.actionsets.SaveNewCellData.SaveNewCellData.guard, solvers.limiting.actionsets.SpreadLimiterStatus.SpreadLimiterStatus.guard, solvers.limiting.actionsets.VerifyTroubledness.VerifyTroubledness.guard, solvers.rkdg.actionsets.AdaptivityCriterion.AdaptivityCriterion.guard, solvers.rkdg.actionsets.ComputeFinalLinearCombination.ComputeFinalLinearCombination.guard, solvers.rkdg.actionsets.InitialCondition.InitialCondition.guard, solvers.rkdg.actionsets.PostprocessSolution.EmptyPostprocessSolution.guard, solvers.rkdg.actionsets.PostprocessSolution.DoFWisePostprocessSolution.guard, solvers.rkdg.actionsets.PostprocessSolution.CellWisePostprocessSolution.guard, solvers.rkdg.actionsets.PreprocessSolution.EmptyPreprocessSolution.guard, solvers.rkdg.actionsets.PreprocessSolution.DoFWisePreprocessSolution.guard, solvers.rkdg.actionsets.PreprocessSolution.CellWisePreprocessSolution.guard, exagrype.api.actionsets.AddKreissOligerDissipation.AddKreissOligerDissipation.guard, exahype2.api.blockstructured.DynamicMeshRefinement.DynamicMeshRefinement.guard, exahype2.api.fv.actionsets.ApplyDirichletBoundaryConditions.ApplyDirichletBoundaryConditions.guard, exahype2.api.fv.actionsets.ComputeGlobalCFLCondition.ComputeGlobalCFLCondition.guard, exahype2.api.fv.actionsets.DiscardPatchInterior.DiscardPatchInterior.guard, exahype2.api.fv.actionsets.InitialCondition.InitialCondition.guard, exahype2.api.fv.actionsets.InsertPatchInterior.InsertPatchInterior.guard, exahype2.api.fv.actionsets.ReadjustTimeStepSizeForOptimisticGlobalTimestepping.ReadjustTimeStepSizeForOptimisticGlobalTimestepping.guard, exahype2.api.fv.actionsets.SpawnTaskToUpdateCellInterior.SpawnTaskToUpdateCellInterior.guard, exahype2.api.fv.actionsets.UpdateCell.UpdateCell.guard, exahype2.api.fv.actionsets.UpdateCellGPU.UpdateCellGPU.guard, exahype2.api.fv.actionsets.UpdateCellInterior.UpdateCellInterior.guard, exahype2.api.fv.actionsets.UpdateCellShell.UpdateCellShell.guard, exahype2.api.rkfd4.actionsets.AddLopsidedAdvection.AddLopsidedAdvection.guard, exahype2.api.rkfd4.actionsets.ApplyDirichletBoundaryConditions.ApplyDirichletBoundaryConditions.guard, exahype2.api.rkfd4.actionsets.ComputeLinearCombination.ComputeLinearCombination.guard, exahype2.api.rkfd4.actionsets.ComputeMaxEigenvalue.ComputeMaxEigenvalue.guard, exahype2.api.rkfd4.actionsets.ComputeTimeStepSize.ComputeTimeStepSize.guard, exahype2.api.rkfd4.actionsets.EvaluateRightHandSide.EvaluateRightHandSide.guard, exahype2.api.rkfd4.actionsets.InitialCondition.InitialCondition.guard, peano4.api.actionsets.ConstructRegularGrid.ConstructRegularGrid.guard, api.ApplyPointWiselyToPatch.ApplyPointWiselyToPatch.guard(), api.InterpolateHangingFaces.InterpolateHangingFaces.guard, api.ProjectPatchOntoFaces.ProjectPatchOntoFaces.guard(), api.ApplyPointWiselyToPatch.ApplyPointWiselyToPatch.guard(), api.ProjectPatchOntoFaces.ProjectPatchOntoFaces.guard(), api.ProjectPatchWithHaloOntoFaces.ProjectPatchWithHaloOntoFaces.guard, api.ReconstructPatchWithHalo.ReconstructPatchWithHalo.guard, and api.RestrictHangingFaces.RestrictHangingFaces.guard.
Referenced by peano4.api.solversteps.ActionSet.ActionSet.get_implementation_of_operation().


| 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 194 of file ComputeGlobalCFLCondition.py.
| exahype2.api.fv.actionsets.ComputeGlobalCFLCondition.ComputeGlobalCFLCondition.get_static_initialisations | ( | self, | |
| full_qualified_classname | |||
| ) |
Reimplemented from peano4.api.solversteps.ActionSet.ActionSet.
Definition at line 184 of file ComputeGlobalCFLCondition.py.
|
protected |
Definition at line 73 of file ComputeGlobalCFLCondition.py.
| exahype2.api.fv.actionsets.ComputeGlobalCFLCondition.ComputeGlobalCFLCondition.cfl_constant |
| exahype2.api.fv.actionsets.ComputeGlobalCFLCondition.ComputeGlobalCFLCondition.guard |
Definition at line 72 of file ComputeGlobalCFLCondition.py.
Referenced by api.ReconstructPatchWithHalo.ReconstructPatchWithHalo._add_action_set_entries_to_dictionary(), solvers.aderdg.actionsets.Correction.Correction.get_body_of_operation(), solvers.aderdg.actionsets.Prediction.Prediction.get_body_of_operation(), solvers.fv.actionsets.AdaptivityCriterion.AdaptivityCriterion.get_body_of_operation(), solvers.fv.actionsets.InitialCondition.InitialCondition.get_body_of_operation(), solvers.fv.actionsets.PostprocessSolution.VolumeWisePostprocessSolution.get_body_of_operation(), solvers.fv.actionsets.PreprocessSolution.VolumeWisePreprocessSolution.get_body_of_operation(), solvers.fv.EnclaveTasking.MergeEnclaveTaskOutcome.get_body_of_operation(), solvers.limiting.actionsets.SaveNewCellData.SaveNewCellData.get_body_of_operation(), solvers.limiting.actionsets.SpreadLimiterStatus.SpreadLimiterStatus.get_body_of_operation(), solvers.limiting.actionsets.VerifyTroubledness.VerifyTroubledness.get_body_of_operation(), solvers.rkdg.actionsets.AdaptivityCriterion.AdaptivityCriterion.get_body_of_operation(), solvers.rkdg.actionsets.ComputeFinalLinearCombination.ComputeFinalLinearCombination.get_body_of_operation(), solvers.rkdg.actionsets.InitialCondition.InitialCondition.get_body_of_operation(), solvers.rkdg.actionsets.PostprocessSolution.DoFWisePostprocessSolution.get_body_of_operation(), solvers.rkdg.actionsets.PostprocessSolution.CellWisePostprocessSolution.get_body_of_operation(), solvers.rkdg.actionsets.PreprocessSolution.DoFWisePreprocessSolution.get_body_of_operation(), solvers.rkdg.actionsets.PreprocessSolution.CellWisePreprocessSolution.get_body_of_operation(), solvers.fv.actionsets.InitialCondition.InitialCondition.get_body_of_prepareTraversal(), exagrype.api.actionsets.AddKreissOligerDissipation.AddKreissOligerDissipation.get_guard_of_operation(), exahype2.api.blockstructured.DynamicMeshRefinement.DynamicMeshRefinement.get_guard_of_operation(), exahype2.api.fv.actionsets.ApplyDirichletBoundaryConditions.ApplyDirichletBoundaryConditions.get_guard_of_operation(), exahype2.api.fv.actionsets.ComputeGlobalCFLCondition.ComputeGlobalCFLCondition.get_guard_of_operation(), exahype2.api.fv.actionsets.DiscardPatchInterior.DiscardPatchInterior.get_guard_of_operation(), exahype2.api.fv.actionsets.InitialCondition.InitialCondition.get_guard_of_operation(), exahype2.api.fv.actionsets.InitialiseNewCells.InitialiseNewCells.get_guard_of_operation(), exahype2.api.fv.actionsets.InsertPatchInterior.InsertPatchInterior.get_guard_of_operation(), exahype2.api.fv.actionsets.ReadjustTimeStepSizeForOptimisticGlobalTimestepping.ReadjustTimeStepSizeForOptimisticGlobalTimestepping.get_guard_of_operation(), exahype2.api.fv.actionsets.SpawnTaskToUpdateCellInterior.SpawnTaskToUpdateCellInterior.get_guard_of_operation(), exahype2.api.fv.actionsets.UpdateCell.UpdateCell.get_guard_of_operation(), exahype2.api.fv.actionsets.UpdateCellGPU.UpdateCellGPU.get_guard_of_operation(), exahype2.api.fv.actionsets.UpdateCellInterior.UpdateCellInterior.get_guard_of_operation(), exahype2.api.fv.actionsets.UpdateCellShell.UpdateCellShell.get_guard_of_operation(), exahype2.api.rkfd4.actionsets.AddLopsidedAdvection.AddLopsidedAdvection.get_guard_of_operation(), exahype2.api.rkfd4.actionsets.ApplyDirichletBoundaryConditions.ApplyDirichletBoundaryConditions.get_guard_of_operation(), exahype2.api.rkfd4.actionsets.ComputeLinearCombination.ComputeLinearCombination.get_guard_of_operation(), exahype2.api.rkfd4.actionsets.ComputeMaxEigenvalue.ComputeMaxEigenvalue.get_guard_of_operation(), exahype2.api.rkfd4.actionsets.ComputeTimeStepSize.ComputeTimeStepSize.get_guard_of_operation(), exahype2.api.rkfd4.actionsets.EvaluateRightHandSide.EvaluateRightHandSide.get_guard_of_operation(), exahype2.api.rkfd4.actionsets.InitialCondition.InitialCondition.get_guard_of_operation(), api.InterpolateHangingFaces.InterpolateHangingFaces.get_guard_of_operation(), api.ProjectPatchWithHaloOntoFaces.ProjectPatchWithHaloOntoFaces.get_guard_of_operation(), api.ReconstructPatchWithHalo.ReconstructPatchWithHalo.get_guard_of_operation(), and api.RestrictHangingFaces.RestrictHangingFaces.get_guard_of_operation().
| exahype2.api.fv.actionsets.ComputeGlobalCFLCondition.ComputeGlobalCFLCondition.patch_size |
Definition at line 75 of file ComputeGlobalCFLCondition.py.
Referenced by 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(), exahype2.api.blockstructured.DynamicMeshRefinement.DynamicMeshRefinement.get_body_of_operation(), and exahype2.api.fv.actionsets.InsertPatchInterior.InsertPatchInterior.get_body_of_operation().