Peano
Loading...
Searching...
No Matches
exahype2.api.fv.RusanovWithExplicitEuler.RusanovWithExplicitEuler Class Reference

Finite Volumes with a Rusanov Riemann solver and explicit Euler time stepping, realised over a block-structured mesh. More...

Inheritance diagram for exahype2.api.fv.RusanovWithExplicitEuler.RusanovWithExplicitEuler:
Collaboration diagram for exahype2.api.fv.RusanovWithExplicitEuler.RusanovWithExplicitEuler:

Public Member Functions

 __init__ (self, Solver solver, int patch_size, int overlap=1, float cfl_constant=0.9, "toolbox.blockstructured.api.InterpolateHangingFaces.Scheme" interpolation=toolbox.blockstructured.api.InterpolateHangingFaces.Scheme.Linear, "toolbox.blockstructured.api.RestrictHangingFaces.Scheme" restriction=toolbox.blockstructured.api.RestrictHangingFaces.Scheme.Averaging, float min_volume_size=None, float max_volume_size=None)
 The constructor memorises the attributes.
str kernel_function_name (self)
 Name of the generated time step kernel.
str max_eigenvalue_kernel_function_name (self)
 Name of the generated kernel which determines the maximum eigenvalue over a patch.
Solver.MeshAdaptation create_default_mesh_adaptation (self)
 The Finite Volume schemes adapt the mesh and balance the load through exahype2.api.fv.AdaptMeshAndBalanceLoad by default.
 construct_output (self, exahype2_project, peano_project, time_step, add_global_tasks=True)
 Has to be implemented by subclass.
"toolbox.blockstructured.api.RestrictHangingFaces" create_restriction_of_hanging_faces (self)
 Action set which restricts the projected fine data from the hanging faces onto the coarse faces.
Public Member Functions inherited from exahype2.api.Solver.Solver.NumericalScheme
 __init__ (self, "Solver" solver)
 wrap_task_graph_in_load_balancing_and_amr_tasks (self, time_step)
 Embed the time step's task graph into the global load balancing and AMR tasks.

Data Fields

 min_volume_size = min_volume_size
 max_volume_size = max_volume_size
 interpolation = interpolation
 restriction = restriction
 patch_size = patch_size
 halo_size = overlap
 overlap = overlap
 kernel_namespace = None
 max_eigenvalue_kernel_call = None
 cfl_constant = cfl_constant

Private Member Functions

 __create_data_structures (self)
 Create the mesh data structures (a Finite Volume patch per cell, plus the face-based overlap patches used to reconstruct its halo) this numerical scheme requires.
 __add_data_to_repository (self, peano_project)
 Consult page_exahype_programmers_guide_new_solver for some information how this routine fits to the typical workflow when we introduce a new solver.

Additional Inherited Members

Static Public Attributes inherited from exahype2.api.Solver.Solver.NumericalScheme
str DYNAMIC_MESH_REFINEMENT_TASK_NAME = "Dynamic mesh refinement and load balancing"
 Name of the last task of each time step without the solver's name as prefix, i.e.
Protected Attributes inherited from exahype2.api.Solver.Solver.NumericalScheme
 _solver = solver
Solver.NumericalScheme.NumericalSchemeGenerator _generator = None

Detailed Description

Finite Volumes with a Rusanov Riemann solver and explicit Euler time stepping, realised over a block-structured mesh.

Definition at line 207 of file RusanovWithExplicitEuler.py.

Constructor & Destructor Documentation

◆ __init__()

exahype2.api.fv.RusanovWithExplicitEuler.RusanovWithExplicitEuler.__init__ ( self,
Solver solver,
int patch_size,
int overlap = 1,
float cfl_constant = 0.9,
"toolbox.blockstructured.api.InterpolateHangingFaces.Scheme" interpolation = toolbox.blockstructured.api.InterpolateHangingFaces.Scheme.Linear,
"toolbox.blockstructured.api.RestrictHangingFaces.Scheme" restriction = toolbox.blockstructured.api.RestrictHangingFaces.Scheme.Averaging,
float min_volume_size = None,
float max_volume_size = None )

The constructor memorises the attributes.

However, it does not do this within this class, but it adds the important properties straight to the solver, so anybody else working against this solver knows about the properties introduced by the numerical scheme.

See also
__create_data_structures()

patch_size: int Number of Finite Volumes per axis within one patch (i.e. within one mesh cell).

overlap: int Number of Finite Volumes the halo layer reconstructed around a patch - from the neighbouring patches' faces - is wide.

cfl_constant: float Safety factor the admissible time step size (

See also
exahype2.api.fv.actionsets.ComputeGlobalCFLCondition, which this is passed straight through to) is scaled down by, relative to the theoretical CFL=1 stability limit h / (Dimensions * lambda_max). 0.9 is a conservative default for an explicit-Euler Finite Volume scheme; this codebase has no prior precedent value to match (grep for "cfl" outside this class finds only exaparty's unrelated SPH solvers, which default to 0.1).

interpolation: toolbox.blockstructured.api.InterpolateHangingFaces.Scheme How the scheme initialises the halo of a fine patch next to a coarser patch on an adaptive mesh. Whenever the time step reconstructs the halo of a fine cell, it interpolates the data of the adjacent coarse face onto the fine cell's hanging face (toolbox.blockstructured.api.InterpolateHangingFaces). The default is linear interpolation.

restriction: toolbox.blockstructured.api.RestrictHangingFaces.Scheme How the scheme hands the data of fine patches over to an adjacent coarser patch. Whenever the fine cells project their data onto their faces, the scheme restricts the data of the hanging faces onto the coarse face (toolbox.blockstructured.api.RestrictHangingFaces). The default is averaging.

min_volume_size: float The time step asks for a refinement of a cell only if its volumes are at least of this size (exahype2.api.blockstructured.DynamicMeshRefinement). None (the default) does not bound the refinement.

max_volume_size: float The time step asks for an erase, i.e. coarsening, of a cell only if the volumes of the coarser cell would be strictly smaller than this size. None (the default) does not bound the coarsening.

On a regular mesh, there are no hanging faces, and the two schemes are never used. The fluxes along a face between a coarse and a fine patch are not corrected, i.e. the scheme is not exactly conservative on adaptive meshes.

Definition at line 215 of file RusanovWithExplicitEuler.py.

References __init__().

Referenced by __init__().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ __add_data_to_repository()

exahype2.api.fv.RusanovWithExplicitEuler.RusanovWithExplicitEuler.__add_data_to_repository ( self,
peano_project )
private

Consult page_exahype_programmers_guide_new_solver for some information how this routine fits to the typical workflow when we introduce a new solver.

Definition at line 423 of file RusanovWithExplicitEuler.py.

References exagrype.api.FD4WithKODissipation.FD4WithKODissipation._solver, exahype2.api.blockstructured.AdaptMeshAndBalanceLoad.AdaptMeshAndBalanceLoad._solver, exahype2.api.blockstructured.ConsumeRefinementRequests.ConsumeRefinementRequests._solver, exahype2.api.blockstructured.DynamicMeshRefinement.DynamicMeshRefinement._solver, exahype2.api.blockstructured.LoadCheckpoint._LoadPatchesFromCheckpoint._solver, exahype2.api.blockstructured.LoadCheckpoint.LoadCheckpoint._solver, exahype2.api.fv.actionsets.AbstractFVActionSet.AbstractFVActionSet._solver, exahype2.api.fv.actionsets.ApplyDirichletBoundaryConditions.ApplyDirichletBoundaryConditions._solver, exahype2.api.fv.actionsets.DiscardPatchInterior.DiscardPatchInterior._solver, exahype2.api.fv.AdaptMeshAndBalanceLoad.AdaptMeshAndBalanceLoad._solver, exahype2.api.fv.PlotAsVTKFile.PlotAsVTKFile._solver, _solver, exahype2.api.fv.actionsets.InsertPatchInterior.InsertPatchInterior.overlap, overlap, exagrype.api.scalarfield.FiniteVolumesInnerCoupling._FiniteVolumes.patch_size, exagrype.api.scalarfield.InnerCouplingGenerator.InnerCouplingGenerator.patch_size, exagrype.api.scalarfield.RungeKuttaFD4InnerCoupling._RungeKuttaFD4.patch_size, exahype2.api.blockstructured.DynamicMeshRefinement.DynamicMeshRefinement.patch_size, exahype2.api.fv.actionsets.ComputeGlobalCFLCondition.ComputeGlobalCFLCondition.patch_size, exahype2.api.fv.actionsets.InsertPatchInterior.InsertPatchInterior.patch_size, and patch_size.

Referenced by construct_output(), exahype2.api.fv.RusanovWithOptimisticExplicitEuler.RusanovWithOptimisticExplicitEuler.construct_output(), and exahype2.api.rkfd4.CentralDifferencesWithRungeKutta.CentralDifferencesWithRungeKutta.construct_output().

Here is the caller graph for this function:

◆ __create_data_structures()

exahype2.api.fv.RusanovWithExplicitEuler.RusanovWithExplicitEuler.__create_data_structures ( self)
private

Create the mesh data structures (a Finite Volume patch per cell, plus the face-based overlap patches used to reconstruct its halo) this numerical scheme requires.

Ported from the legacy exahype2.solvers.fv.FV.create_data_structures(): one peano4.api.datamodel.Patch of patch_size^d Finite Volumes per mesh cell (_patch), plus a halo-augmented copy of it (_patch_with_halo, (patch_size+2*overlap)^d,

See also
toolbox.blockstructured.api.ReconstructPatchWithHalo) and two overlap patches of width 2*overlap attached to the mesh faces:
  • _patch_overlap_current_time_step: the persistent halo data toolbox.blockstructured.api.ReconstructPatchWithHalo reads from to rebuild _patch_with_halo (
    See also
    construct_output(), which hands it _patch/_patch_overlap_current_time_step/_patch_with_halo directly rather than the whole solver).
  • _patch_overlap_update: the projection of the just-updated _patch accumulated by the current sweep (
    See also
    exahype2.api.fv.actionsets.ProjectPatchOntoFaces), rolled over into _patch_overlap_current_time_step by exahype2.api.fv.actionsets.RollOverUpdatedFace once the update is complete.
  • _max_eigenvalue: one double per cell, named after the solver followed by MaxEigenvalue (e.g. EulerFVSmoothMaxEigenvalue), which holds the maximum eigenvalue of the patch after its last update (
    See also
    exahype2.api.fv.actionsets.ComputeMaxEigenvalue). exahype2.api.fv.actionsets.ReduceMaxEigenvalue reduces these values into the solver, and exahype2.api.fv.actionsets.ComputeGlobalCFLCondition derives the next time step size from the outcome. It is modelled via DaStGen2 as an array of cardinality one. The array is a peano4.api.dastgen2.Peano4SmartPointerDoubleArray, i.e. the value resides on the heap.
    All five are assigned onto self._solver (the shared exahype2.api.Solver instance both this numerical scheme and its surrounding solver's Solver.GridConstruction/Solver.Plotter counterparts hold a reference to as self._solver), not onto self, since the remaining FV action sets that need them -
    See also
    exahype2.api.fv.actionsets.ApplyDirichletBoundaryConditions, exahype2.api.fv.actionsets.UpdateCell, exahype2.api.fv.actionsets.ComputeGlobalCFLCondition - are handed that shared solver and look the patches up as solver._patch / solver._patch_overlap_*.
    Storage is hardwired to smart pointers (peano4.api.datamodel's PatchToDoubleArrayWithSmartPointer), matching the legacy default (Storage.SmartPointers for both cell and face data) - the legacy Storage enum's other two backends (CallStack, Heap) are not exposed here.

Two pieces of the legacy method are deliberately not ported yet:

  • The cell/face label creation (exahype2.grid.create_cell_label()/create_face_label()) - that module has not been ported to the new API.
  • The load/store/compute guards (FV._provide_cell_data_to_compute_kernels_default_guard() and friends) - they are keyed off the legacy SolverState state machine, which the task-graph architecture has no equivalent of: a task only ever runs within its own phase's task graph in the first place, so "are we still constructing the grid" does not need to be re-checked at runtime the same way.

Definition at line 325 of file RusanovWithExplicitEuler.py.

References exagrype.api.FD4WithKODissipation.FD4WithKODissipation._solver, exahype2.api.blockstructured.AdaptMeshAndBalanceLoad.AdaptMeshAndBalanceLoad._solver, exahype2.api.blockstructured.ConsumeRefinementRequests.ConsumeRefinementRequests._solver, exahype2.api.blockstructured.DynamicMeshRefinement.DynamicMeshRefinement._solver, exahype2.api.blockstructured.LoadCheckpoint._LoadPatchesFromCheckpoint._solver, exahype2.api.blockstructured.LoadCheckpoint.LoadCheckpoint._solver, exahype2.api.fv.actionsets.AbstractFVActionSet.AbstractFVActionSet._solver, exahype2.api.fv.actionsets.ApplyDirichletBoundaryConditions.ApplyDirichletBoundaryConditions._solver, exahype2.api.fv.actionsets.DiscardPatchInterior.DiscardPatchInterior._solver, exahype2.api.fv.AdaptMeshAndBalanceLoad.AdaptMeshAndBalanceLoad._solver, exahype2.api.fv.PlotAsVTKFile.PlotAsVTKFile._solver, _solver, exahype2.api.fv.actionsets.InsertPatchInterior.InsertPatchInterior.overlap, overlap, exagrype.api.scalarfield.FiniteVolumesInnerCoupling._FiniteVolumes.patch_size, exagrype.api.scalarfield.InnerCouplingGenerator.InnerCouplingGenerator.patch_size, exagrype.api.scalarfield.RungeKuttaFD4InnerCoupling._RungeKuttaFD4.patch_size, exahype2.api.blockstructured.DynamicMeshRefinement.DynamicMeshRefinement.patch_size, exahype2.api.fv.actionsets.ComputeGlobalCFLCondition.ComputeGlobalCFLCondition.patch_size, exahype2.api.fv.actionsets.InsertPatchInterior.InsertPatchInterior.patch_size, and patch_size.

◆ construct_output()

exahype2.api.fv.RusanovWithExplicitEuler.RusanovWithExplicitEuler.construct_output ( self,
exahype2_project,
peano_project,
time_step,
add_global_tasks = True )

Has to be implemented by subclass.

time_step: peano4.api.taskgraph.Graph The task graph of the surrounding exahype2_project's time stepping phase, so the numerical scheme can add its own tasks into it.

Parameters
add_global_tasksbool Whether the scheme adds the tasks that belong to the mesh as a whole rather than to the solver: it switches the load balancing off at the begin of the time step, and its last task evaluates the adaptivity criterion and switches the load balancing on again. If set, the scheme adds these tasks by calling wrap_task_graph_in_load_balancing_and_amr_tasks() as its very last step. A host that couples several solvers passes False, as it wraps the concatenated graph itself.

Reimplemented from exahype2.api.Solver.Solver.NumericalScheme.

Reimplemented in 20_additional-solver-steps.RusanovWithDensityFloor, and manipulate-solver-steps-illustrations.RusanovWithPostprocessing.

Definition at line 499 of file RusanovWithExplicitEuler.py.

References __add_data_to_repository(), _generator, construct_output(), and kernel_namespace.

Referenced by construct_output().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_default_mesh_adaptation()

◆ create_restriction_of_hanging_faces()

"toolbox.blockstructured.api.RestrictHangingFaces" exahype2.api.fv.RusanovWithExplicitEuler.RusanovWithExplicitEuler.create_restriction_of_hanging_faces ( self)

◆ kernel_function_name()

str exahype2.api.fv.RusanovWithExplicitEuler.RusanovWithExplicitEuler.kernel_function_name ( self)

Name of the generated time step kernel.

It carries the solver name, as do the kernels/<SolverName>_rusanov*.h files holding it, so two solvers' kernels do not clash.

Definition at line 308 of file RusanovWithExplicitEuler.py.

References exagrype.api.FD4WithKODissipation.FD4WithKODissipation._solver, exahype2.api.blockstructured.AdaptMeshAndBalanceLoad.AdaptMeshAndBalanceLoad._solver, exahype2.api.blockstructured.ConsumeRefinementRequests.ConsumeRefinementRequests._solver, exahype2.api.blockstructured.DynamicMeshRefinement.DynamicMeshRefinement._solver, exahype2.api.blockstructured.LoadCheckpoint._LoadPatchesFromCheckpoint._solver, exahype2.api.blockstructured.LoadCheckpoint.LoadCheckpoint._solver, exahype2.api.fv.actionsets.AbstractFVActionSet.AbstractFVActionSet._solver, exahype2.api.fv.actionsets.ApplyDirichletBoundaryConditions.ApplyDirichletBoundaryConditions._solver, exahype2.api.fv.actionsets.DiscardPatchInterior.DiscardPatchInterior._solver, exahype2.api.fv.AdaptMeshAndBalanceLoad.AdaptMeshAndBalanceLoad._solver, exahype2.api.fv.PlotAsVTKFile.PlotAsVTKFile._solver, and _solver.

Referenced by exahype2.api.fv.RusanovWithOptimisticExplicitEuler.RusanovWithOptimisticExplicitEuler.__construct_kernel_call(), exahype2.api.fv.RusanovWithOptimisticExplicitEuler.RusanovWithOptimisticExplicitEuler.__create_time_step_functions(), and exahype2.api.fv.RusanovWithOptimisticExplicitEuler.RusanovWithOptimisticExplicitEuler.construct_output().

Here is the caller graph for this function:

◆ max_eigenvalue_kernel_function_name()

str exahype2.api.fv.RusanovWithExplicitEuler.RusanovWithExplicitEuler.max_eigenvalue_kernel_function_name ( self)

Field Documentation

◆ cfl_constant

exahype2.api.fv.RusanovWithExplicitEuler.RusanovWithExplicitEuler.cfl_constant = cfl_constant

◆ halo_size

exahype2.api.fv.RusanovWithExplicitEuler.RusanovWithExplicitEuler.halo_size = overlap

Definition at line 297 of file RusanovWithExplicitEuler.py.

◆ interpolation

exahype2.api.fv.RusanovWithExplicitEuler.RusanovWithExplicitEuler.interpolation = interpolation

Definition at line 293 of file RusanovWithExplicitEuler.py.

◆ kernel_namespace

◆ max_eigenvalue_kernel_call

◆ max_volume_size

exahype2.api.fv.RusanovWithExplicitEuler.RusanovWithExplicitEuler.max_volume_size = max_volume_size

Definition at line 292 of file RusanovWithExplicitEuler.py.

◆ min_volume_size

exahype2.api.fv.RusanovWithExplicitEuler.RusanovWithExplicitEuler.min_volume_size = min_volume_size

◆ overlap

◆ patch_size

◆ restriction

exahype2.api.fv.RusanovWithExplicitEuler.RusanovWithExplicitEuler.restriction = restriction

The documentation for this class was generated from the following file: