Peano
Loading...
Searching...
No Matches
exahype2.api.AuxiliaryVariables.AuxiliaryVariables Class Reference

A set of auxiliary variables of a solver. More...

Collaboration diagram for exahype2.api.AuxiliaryVariables.AuxiliaryVariables:

Data Structures

class  Mode
 Where the values of a set live and whether they change. More...

Public Member Functions

 __init__ (self, str name, Dict[str, int] variables, "AuxiliaryVariables.Mode" mode=Mode.STATIONARY_ON_FACES, str data_name=None)
str name (self)
"AuxiliaryVariables.Mode" mode (self)
 Whether the values sit on the faces, and whether they change after the setup.
str data_name (self)
 Name of the generated data.
int size (self)
 Total number of entries of the set, i.e.
Dict[str, int] variables (self)
Dict[str, int] variable_positions (self)
 Position of each named variable within the set.
 owner (self)
 The solver which initialises the set, i.e.
str argument_name (self)
 Name of the argument of the PDE terms.
bool halo_is_held_through_stages (self)
 Whether the halo has to be reconstructed in the first stage of a time step only.
str delta_argument_name (self)
 Name of the argument behind deltaQ.
List[str] variable_names_per_entry (self)
 One name per entry of the set, qualified by the set's name.
str variables_declaration (self)
 C++ struct which hosts the positions of the variables within the set.
 create_data_structures (self, int patch_size, int overlap, grid_selector)
 Create the cell and face data of the set.
 add_to_datamodel (self, peano_project)
 Register the data with the project (once, even if the set is shared).
str __str__ (self)

Data Fields

peano4.api.datamodel.Patch patch = None
peano4.api.datamodel.Patch patch_overlap_current_time_step = None
peano4.api.datamodel.Patch patch_overlap_update = None

Static Public Attributes

str RECONSTRUCTION_TASK_NAME = "Reconstruct auxiliary variables {}"

Protected Attributes

str _name = name
Dict[str, int] _variables = dict(variables)
dict _positions = {}
 _size = offset
 _owner = None
"AuxiliaryVariables.Mode" _mode = mode
tuple _data_name
 _patch_size = None
 _overlap = None
 _added_to = set()

Detailed Description

A set of auxiliary variables of a solver.

Auxiliary variables are quantities such as the sea floor, a mesh distortion or a density which live in every Finite Volume (or Finite Difference point) next to the unknowns, but which are not evolved by the PDE. A solver can have an arbitrary number of such sets, each of them vector-valued, e.g. ten bathymetry entries and another five entries describing a mesh distortion. Each set is held by its own cell data object, i.e. its own patch, rather than by the patch of the unknowns.

Create a set with a name and a dictionary which maps the names of the parameters onto their multiplicities,

bathymetry = exahype2.api.AuxiliaryVariables("Bathymetry", {"b": 1})

and attach it to a solver via exahype2.api.Solver.add_auxiliary_variables(). The name is also the name of a struct within the generated abstract solver, so you can write bathymetry[Bathymetry.b] in your C++ code.

Impact on the C++ signatures

Every PDE term of a solver with auxiliary variables receives, directly behind each Q (and each deltaQ), one pointer per attached set. The pointers come in the order in which the sets have been attached. The pointer is named after the set (first letter in lower case), the pointers behind deltaQ carry the prefix delta. For the set above and the flux, the signature therefore reads

flux(const double* Q, const double* bathymetry, const Vector& x, int normal, double* F)

and the signature of the non-conservative product is

nonconservativeProduct(Q, bathymetry, deltaQ, deltaBathymetry, x, ...)

Solvers without auxiliary variables keep their original signatures.

Ownership and sharing

The first solver a set is attached to owns it. Only the owner's initPointWisely() receives the set as writable argument and initialises it. Further solvers can attach the same set object. They share the data, i.e. they do not hold an additional copy, and initPointWisely() sees the set as const.

Remarks
Naming These quantities used to be called material parameters. "Material" suggests that they are invariant, but they do not have to be: an auxiliary variable is any quantity that lives next to the unknowns and is not evolved by the PDE terms of the solver. It may well change over time if some other mechanism updates it. The current implementation writes the variables once during the setup, i.e. they are constant in time, but this is a restriction of the implementation, not part of the concept.

Besides periodic boundaries, the halo layer of the volumes at the domain boundary is not available for auxiliary variables.

Definition at line 14 of file AuxiliaryVariables.py.

Constructor & Destructor Documentation

◆ __init__()

exahype2.api.AuxiliaryVariables.AuxiliaryVariables.__init__ ( self,
str name,
Dict[str, int] variables,
"AuxiliaryVariables.Mode" mode = Mode.STATIONARY_ON_FACES,
str data_name = None )
Parameters
namestr Name of the set. Has to be a valid C++ identifier starting with a capital letter. It feeds into the names of the data structures, the name of the struct which hosts the positions of the variables within the set, and - with a lower-case first letter - into the name of the arguments in the PDE term signatures.
variablesdict Maps the name of each parameter onto its multiplicity.
modeAuxiliaryVariables.Mode Whether the values also sit on the faces and whether they change after the setup. Defaults to STATIONARY_ON_FACES. See AuxiliaryVariables.Mode.
data_namestr Name of the generated data (patch and face overlaps). Defaults to the name of the set plus "AuxiliaryVariables".

Definition at line 119 of file AuxiliaryVariables.py.

Member Function Documentation

◆ __str__()

str exahype2.api.AuxiliaryVariables.AuxiliaryVariables.__str__ ( self)

Definition at line 343 of file AuxiliaryVariables.py.

Referenced by peano4.api.toolbox.particles.postprocessing.ParticleVTUReader.VTUParticleSet.__repr__().

Here is the caller graph for this function:

◆ add_to_datamodel()

exahype2.api.AuxiliaryVariables.AuxiliaryVariables.add_to_datamodel ( self,
peano_project )

Register the data with the project (once, even if the set is shared).

Definition at line 334 of file AuxiliaryVariables.py.

References _added_to, patch, patch_overlap_current_time_step, and patch_overlap_update.

◆ argument_name()

◆ create_data_structures()

exahype2.api.AuxiliaryVariables.AuxiliaryVariables.create_data_structures ( self,
int patch_size,
int overlap,
grid_selector )

Create the cell and face data of the set.

The routine is idempotent, as a set may be shared by several solvers: the first call creates the data, any further call checks that the numerical schemes of the solvers agree on the patch size and halo.

Parameters
patch_sizeint Number of volumes per axis within a patch.
overlapint Width of the halo layer.
grid_selectorpeano4.api.toolbox.GridSelector Selects the mesh entities which hold data.

Definition at line 268 of file AuxiliaryVariables.py.

References _data_name, _overlap, _patch_size, _size, patch, patch_overlap_current_time_step, and patch_overlap_update.

Referenced by solvers.aderdg.ADERDG.ADERDG.add_kernel_optimisations(), solvers.fv.FV.FV.auxiliary_variables(), solvers.rkdg.RungeKuttaDG.RungeKuttaDG.auxiliary_variables(), solvers.fv.FV.FV.interpolation(), solvers.fv.FV.FV.overlap(), solvers.fv.FV.FV.patch_size(), solvers.elliptic.ConstrainedPoissonEquationForMarkerOnCells.ConstrainedPoissonEquationForMarkerOnCells.postprocess_updated_cell(), solvers.rkdg.RungeKuttaDG.RungeKuttaDG.postprocess_updated_cell_after_final_linear_combination(), solvers.rkdg.RungeKuttaDG.RungeKuttaDG.postprocess_updated_cell_after_Runge_Kutta_step(), solvers.aderdg.ADERDG.ADERDG.postprocess_updated_patch(), solvers.fv.FV.FV.postprocess_updated_patch(), solvers.aderdg.ADERDG.ADERDG.preprocess_reconstructed_patch(), solvers.fv.FV.FV.preprocess_reconstructed_patch(), solvers.fv.FV.FV.restriction(), solvers.aderdg.ADERDG.ADERDG.set_implementation(), solvers.rkdg.RungeKuttaDG.RungeKuttaDG.set_implementation(), solvers.aderdg.ADERDG.ADERDG.switch_storage_scheme(), solvers.fv.FV.FV.switch_storage_scheme(), solvers.rkdg.RungeKuttaDG.RungeKuttaDG.switch_storage_scheme(), solvers.fv.FV.FV.unknowns(), and solvers.rkdg.RungeKuttaDG.RungeKuttaDG.unknowns().

Here is the caller graph for this function:

◆ data_name()

str exahype2.api.AuxiliaryVariables.AuxiliaryVariables.data_name ( self)

Name of the generated data.

Definition at line 195 of file AuxiliaryVariables.py.

References _data_name.

◆ delta_argument_name()

◆ halo_is_held_through_stages()

bool exahype2.api.AuxiliaryVariables.AuxiliaryVariables.halo_is_held_through_stages ( self)

Whether the halo has to be reconstructed in the first stage of a time step only.

True for AuxiliaryVariables.Mode.STATIONARY_THROUGHOUT_TIME_STEPS_ON_FACES.

Definition at line 224 of file AuxiliaryVariables.py.

References _mode.

◆ mode()

"AuxiliaryVariables.Mode" exahype2.api.AuxiliaryVariables.AuxiliaryVariables.mode ( self)

Whether the values sit on the faces, and whether they change after the setup.

Definition at line 190 of file AuxiliaryVariables.py.

References _mode.

◆ name()

◆ owner()

exahype2.api.AuxiliaryVariables.AuxiliaryVariables.owner ( self)

The solver which initialises the set, i.e.

the first one it was attached to

Definition at line 214 of file AuxiliaryVariables.py.

References _owner.

◆ size()

int exahype2.api.AuxiliaryVariables.AuxiliaryVariables.size ( self)

Total number of entries of the set, i.e.

the sum of all multiplicities

Definition at line 200 of file AuxiliaryVariables.py.

References _size.

◆ variable_names_per_entry()

List[str] exahype2.api.AuxiliaryVariables.AuxiliaryVariables.variable_names_per_entry ( self)

One name per entry of the set, qualified by the set's name.

A variable of multiplicity k yields k names with an index.

Definition at line 242 of file AuxiliaryVariables.py.

References _variables.

◆ variable_positions()

Dict[str, int] exahype2.api.AuxiliaryVariables.AuxiliaryVariables.variable_positions ( self)

Position of each named variable within the set.

Definition at line 209 of file AuxiliaryVariables.py.

References _positions.

◆ variables()

Dict[str, int] exahype2.api.AuxiliaryVariables.AuxiliaryVariables.variables ( self)

Definition at line 205 of file AuxiliaryVariables.py.

References _variables.

◆ variables_declaration()

str exahype2.api.AuxiliaryVariables.AuxiliaryVariables.variables_declaration ( self)

C++ struct which hosts the positions of the variables within the set.

Definition at line 257 of file AuxiliaryVariables.py.

References _positions.

Field Documentation

◆ _added_to

exahype2.api.AuxiliaryVariables.AuxiliaryVariables._added_to = set()
protected

Definition at line 183 of file AuxiliaryVariables.py.

Referenced by add_to_datamodel().

◆ _data_name

tuple exahype2.api.AuxiliaryVariables.AuxiliaryVariables._data_name
protected
Initial value:
= (
data_name if data_name is not None else name + "AuxiliaryVariables"
)

Definition at line 173 of file AuxiliaryVariables.py.

Referenced by create_data_structures(), and data_name().

◆ _mode

"AuxiliaryVariables.Mode" exahype2.api.AuxiliaryVariables.AuxiliaryVariables._mode = mode
protected

◆ _name

str exahype2.api.AuxiliaryVariables.AuxiliaryVariables._name = name
protected

Definition at line 155 of file AuxiliaryVariables.py.

Referenced by api.Tree.Tree.__str__(), exahype2.api.Solver.Solver.__str__(), solvers.aderdg.ADERDG.ADERDG.__str__(), solvers.api.Solver.Solver.__str__(), solvers.elliptic.AMRMarker.AMRMarker.__str__(), solvers.elliptic.ConstrainedPoissonEquationForMarkerOnCells.ConstrainedPoissonEquationForMarkerOnCells.__str__(), solvers.fv.FV.FV.__str__(), solvers.rkdg.RungeKuttaDG.RungeKuttaDG.__str__(), solvers.fv.EnclaveTasking.EnclaveTasking._enclave_task_name(), solvers.aderdg.ADERDG.ADERDG._generate_kernels(), solvers.aderdg.ADERDG.ADERDG._init_dictionary_with_default_parameters(), solvers.fv.FV.FV._init_dictionary_with_default_parameters(), solvers.rkdg.RungeKuttaDG.RungeKuttaDG._init_dictionary_with_default_parameters(), solvers.aderdg.ADERDG.ADERDG._interpolate_face_data_default_guard(), solvers.aderdg.SingleSweep.SingleSweep._interpolate_face_data_default_guard(), solvers.aderdg.ADERDG.ADERDG._load_cell_data_default_guard(), solvers.fv.FV.FV._load_cell_data_default_guard(), solvers.rkdg.RungeKuttaDG.RungeKuttaDG._load_cell_data_default_guard(), solvers.aderdg.ADERDG.ADERDG._load_face_data_default_guard(), solvers.fv.FV.FV._load_face_data_default_guard(), solvers.rkdg.RungeKuttaDG.RungeKuttaDG._load_face_data_default_guard(), solvers.aderdg.ADERDG.ADERDG._provide_cell_data_to_compute_kernels_default_guard(), solvers.fv.FV.FV._provide_cell_data_to_compute_kernels_default_guard(), solvers.rkdg.RungeKuttaDG.RungeKuttaDG._provide_cell_data_to_compute_kernels_default_guard(), solvers.aderdg.ADERDG.ADERDG._provide_face_data_to_compute_kernels_default_guard(), solvers.fv.FV.FV._provide_face_data_to_compute_kernels_default_guard(), solvers.rkdg.RungeKuttaDG.RungeKuttaDG._provide_face_data_to_compute_kernels_default_guard(), solvers.aderdg.SingleSweep.SingleSweep._restrict_face_data_default_guard(), solvers.aderdg.ADERDG.ADERDG._store_boundary_data_default_guard(), solvers.aderdg.ADERDG.ADERDG._store_cell_data_default_guard(), solvers.fv.FV.FV._store_cell_data_default_guard(), solvers.rkdg.RungeKuttaDG.RungeKuttaDG._store_cell_data_default_guard(), solvers.aderdg.ADERDG.ADERDG._store_face_data_default_guard(), solvers.fv.FV.FV._store_face_data_default_guard(), solvers.rkdg.RungeKuttaDG.RungeKuttaDG._store_face_data_default_guard(), exahype2.api.Solver.Solver._unknown_identifier(), solvers.aderdg.ADERDG.ADERDG._unknown_identifier(), solvers.elliptic.AMRMarker.AMRMarker._unknown_identifier(), solvers.elliptic.ConstrainedPoissonEquationForMarkerOnCells.ConstrainedPoissonEquationForMarkerOnCells._unknown_identifier(), solvers.fv.FV.FV._unknown_identifier(), solvers.rkdg.RungeKuttaDG.RungeKuttaDG._unknown_identifier(), solvers.fv.FV.FV.add_actions_to_checkpoint_solution(), solvers.fv.EnclaveTasking.EnclaveTasking.add_actions_to_create_grid(), solvers.fv.EnclaveTasking.EnclaveTasking.add_actions_to_init_grid(), solvers.aderdg.ADERDG.ADERDG.add_actions_to_plot_solution(), solvers.elliptic.ConstrainedPoissonEquationForMarkerOnCells.ConstrainedPoissonEquationForMarkerOnCells.add_actions_to_plot_solution(), solvers.fv.FV.FV.add_actions_to_plot_solution(), solvers.rkdg.RungeKuttaDG.RungeKuttaDG.add_actions_to_plot_solution(), solvers.fv.EnclaveTasking.EnclaveTasking.add_entries_to_text_replacement_dictionary(), solvers.rkdg.SeparateSweepsWithEnclaveTasking.SeparateSweepsWithEnclaveTasking.add_entries_to_text_replacement_dictionary(), api.solvers.CollocatedLowOrderDiscretisation.CollocatedLowOrderDiscretisation.add_implementation_files_to_project(), api.solvers.DiscontinuousGalerkinDiscretisation.DiscontinuousGalerkinDiscretisation.add_implementation_files_to_project(), solvers.aderdg.ADERDG.ADERDG.add_implementation_files_to_project(), solvers.api.CollocatedDLinearDiscretisationWithPointJacobi.CollocatedDLinearDiscretisationWithPointJacobi.add_implementation_files_to_project(), solvers.api.CollocatedMG.CollocatedMG.add_implementation_files_to_project(), solvers.api.ContinuousGalerkinDiscretisationGaussLobattoWithBlockJacobi.ContinuousGalerkinDiscretisationGaussLobattoWithBlockJacobi.add_implementation_files_to_project(), solvers.elliptic.AMRMarker.AMRMarker.add_to_Peano4_datamodel(), solvers.elliptic.ConstrainedPoissonEquationForMarkerOnCells.ConstrainedPoissonEquationForMarkerOnCells.add_to_Peano4_datamodel(), api.solvers.CollocatedLowOrderDiscretisation.CollocatedLowOrderDiscretisation.add_to_plot(), argument_name(), solvers.aderdg.SingleSweep.SingleSweep.create_action_sets(), solvers.fv.rusanov.LocalTimeStepWithEnclaveTasking.LocalTimeStepWithEnclaveTasking.create_action_sets(), solvers.fv.rusanov.SubcyclingAdaptiveTimeStepWithEnclaveTasking.SubcyclingAdaptiveTimeStepWithEnclaveTasking.create_action_sets(), solvers.fv.rusanov.SubcyclingFixedTimeStep.SubcyclingFixedTimeStep.create_action_sets(), solvers.fv.rusanov.SubcyclingFixedTimeStepWithEnclaveTasking.SubcyclingFixedTimeStepWithEnclaveTasking.create_action_sets(), solvers.rkdg.SeparateSweeps.SeparateSweeps.create_action_sets(), solvers.fv.SingleSweep.SingleSweep.create_data_structures(), delta_argument_name(), exahype2.api.Solver.Solver.get_name_of_global_instance(), solvers.aderdg.ADERDG.ADERDG.get_name_of_global_instance(), solvers.elliptic.AMRMarker.AMRMarker.get_name_of_global_instance(), solvers.elliptic.ConstrainedPoissonEquationForMarkerOnCells.ConstrainedPoissonEquationForMarkerOnCells.get_name_of_global_instance(), solvers.fv.FV.FV.get_name_of_global_instance(), solvers.rkdg.RungeKuttaDG.RungeKuttaDG.get_name_of_global_instance(), exahype2.api.Solver.Solver.get_name_of_solver_class(), api.solvers.Solver.Solver.name(), name(), exahype2.api.Solver.Solver.name(), solvers.api.Solver.Solver.name(), solvers.elliptic.ConstrainedPoissonEquationForMarkerOnCells.ConstrainedPoissonEquationForMarkerOnCells.name(), solvers.fv.FV.FV.name(), api.solvers.Solver.Solver.typename(), and solvers.api.Solver.Solver.typename().

◆ _overlap

exahype2.api.AuxiliaryVariables.AuxiliaryVariables._overlap = None
protected

◆ _owner

exahype2.api.AuxiliaryVariables.AuxiliaryVariables._owner = None
protected

Definition at line 167 of file AuxiliaryVariables.py.

Referenced by owner().

◆ _patch_size

◆ _positions

exahype2.api.AuxiliaryVariables.AuxiliaryVariables._positions = {}
protected

Definition at line 157 of file AuxiliaryVariables.py.

Referenced by variable_positions(), and variables_declaration().

◆ _size

exahype2.api.AuxiliaryVariables.AuxiliaryVariables._size = offset
protected

Definition at line 166 of file AuxiliaryVariables.py.

Referenced by create_data_structures(), and size().

◆ _variables

exahype2.api.AuxiliaryVariables.AuxiliaryVariables._variables = dict(variables)
protected

Definition at line 156 of file AuxiliaryVariables.py.

Referenced by variable_names_per_entry(), and variables().

◆ patch

exahype2.api.AuxiliaryVariables.AuxiliaryVariables.patch = None

Definition at line 178 of file AuxiliaryVariables.py.

Referenced by add_to_datamodel(), and create_data_structures().

◆ patch_overlap_current_time_step

exahype2.api.AuxiliaryVariables.AuxiliaryVariables.patch_overlap_current_time_step = None

Definition at line 179 of file AuxiliaryVariables.py.

Referenced by add_to_datamodel(), and create_data_structures().

◆ patch_overlap_update

exahype2.api.AuxiliaryVariables.AuxiliaryVariables.patch_overlap_update = None

Definition at line 180 of file AuxiliaryVariables.py.

Referenced by add_to_datamodel(), and create_data_structures().

◆ RECONSTRUCTION_TASK_NAME

str exahype2.api.AuxiliaryVariables.AuxiliaryVariables.RECONSTRUCTION_TASK_NAME = "Reconstruct auxiliary variables {}"
static

Definition at line 76 of file AuxiliaryVariables.py.


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