Peano
Loading...
Searching...
No Matches
exaparty.api.particle.Particle.Particle Class Reference

Base class for any particle in the project. More...

Inheritance diagram for exaparty.api.particle.Particle.Particle:
Collaboration diagram for exaparty.api.particle.Particle.Particle:

Data Structures

class  SpeciesAspect
 Every generated particle belongs to a species. More...

Public Member Functions

 __init__ (self, name, particles_per_cell, min_h, max_h)
 Initialise the particle.
 algorithm_steps (self)
 Return sequence of algorithm steps that have to be called per time step.
 initialisation_steps (self)
 Return sequence of algorithm steps that have to be performed throughout initialisation.
 readme_descriptor (self)
 Create default readme descriptor.
Public Member Functions inherited from peano4.api.toolbox.particles.Particle.Particle
 __init__ (self, name)
 Constructor.
Public Member Functions inherited from peano4.api.datamodel.DaStGen2.DaStGen2
 __init__ (self, name)
 Construct a DaStGen2 object.
 configure (self, namespace, association, subdirectory="", temporary_subdirectory="")
 Configure output.
 additional_load_and_store_arguments (self)
 additional_load_and_store_arguments (self, new_arguments)
 hosts_smart_pointer_attribute (self)
 Does class host a smart pointer attribute.
Public Member Functions inherited from peano4.api.datamodel.DoF.DoF
 __init__ (self, name)
 Create a degree of freedom object.
 get_full_qualified_type (self)
 get_logical_type_name (self)
 What should the data type be called within the data repository, or within action sets.
 get_enumeration_type (self)
 What should the data type be called within the data repository.
 additional_load_and_store_arguments_for_other_dof (self, argument_name, use_dof_association=None)
 You can make Peano's store and load arguments of any DoF depend on other DoFs that you have loaded before.
 subnamespace (self)

Data Fields

 particles_per_cell = particles_per_cell
 min_h = min_h
 max_h = max_h
Data Fields inherited from peano4.api.toolbox.particles.Particle.Particle
 partid = dastgen2.attributes.Integer("partid", ifdefs=["PeanoDebug > 0"], initval="-1")
Data Fields inherited from peano4.api.datamodel.DaStGen2.DaStGen2
 generator = None
 data = dastgen2.DataModel(name)
 peano4_mpi_and_storage_aspect = peano4.api.dastgen2.MPIAndStorageAspect(peano4.api.datamodel.DoFAssociation.Undef)
Data Fields inherited from peano4.api.datamodel.DoF.DoF
 association = DoFAssociation.Undef
 name = name
list namespace = []
 grid_selector = None
 subdirectory = subdirectory
 temporary_subdirectory = temporary_subdirectory

Static Public Attributes

str DependencyChecks_Attribute_Prefix = "dependencyChecks"
list DependencyChecks_Ifdefs = ["PeanoDebug > 0"]
Static Public Attributes inherited from peano4.api.datamodel.DaStGen2.DaStGen2
str readme_package_descriptor

Protected Member Functions

 _dependency_checks_modify_steps (self, steplist, step_type_name, peano4_event_enum)
 Add dependency checks as well as mesh consistency checks to the algorithm steps.
 _add_dependency_checks (self)
 Add dependency (particle consistency) checks.

Protected Attributes

 _algorithm_steps = modified_steps
 _initialisation_steps = modified_steps
Protected Attributes inherited from peano4.api.datamodel.DoF.DoF
list _additional_load_and_store_arguments = []

Detailed Description

Base class for any particle in the project.

You usually do not initialise this base class, but you pick one of the subclasses which define which time stepping scheme is realised by a particle. The time stepping scheme defines through which phases or steps each particle runs through per time step, while this generic base class has no steps at all.

The type is a specialisation of Peano's particle as it is provided via the toolbox. In line with the docu there, you can use this particle and add further attributes via

my_particle.data.add_attribute( peano4.api.dastgen2.Peano4DoubleArray("v","Dimensions") )
Specialisation of array using Peano's tarch.

Definition at line 10 of file Particle.py.

Constructor & Destructor Documentation

◆ __init__()

exaparty.api.particle.Particle.Particle.__init__ ( self,
name,
particles_per_cell,
min_h,
max_h )

Initialise the particle.

This is the baseclass for a particle, i.e. we only add the absolute minimum of information to a particle. As we inherit from the toolbox particle, we already have some attributes defined. These are the guys which are not explicitly visible from the code snippet below, i.e. they are introduced by the superclass constructor.

Here's an overview of pre-defined attributes that each and every particle hosts:

  • A position which is a double vector with Dimension entries.
  • A search radius which describes the range with which other particles a particle might theoretically interact. The effective interaction might be smaller if a code decides to ignore potential interaction partners, i.e. this is an absolute maximum. The search radius will decide on which resolution level within the tree a particle is held.
  • A MoveState flag. This flag is essential. We use it later to label those particles that have been moved to avoid that we move particles multiple times.
  • A flag that indicates if a particle has been updated within a cell. Consult our code release papers: In short, a particle does not uniquely belong to one cell but can belong to many cells. We nevertheless want to update them only once.
See also
exaparty.api.actionsets.UpdateParticleMarker

Definition at line 74 of file Particle.py.

References __init__(), convert::data::PatchData.data, and peano4.api.datamodel.DaStGen2.DaStGen2.data.

Referenced by __init__().

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

Member Function Documentation

◆ _add_dependency_checks()

exaparty.api.particle.Particle.Particle._add_dependency_checks ( self)
protected

Add dependency (particle consistency) checks.

This routine should be called in the subclass directly after you have befilled self._algorithm_steps and self._initialisation_steps. It is safe to add this stuff to your particle model all the time - the actual checks kick in if and only if you run in non-release modes. However, you might want to call the function only in these cases to ensure that no (empty) C++ code is generated and the compiler can optimise more aggressively.

Realisation

We first create Enumerations representing each algorithm step defined for the Particle, as well as each sweep stage of any grid traversal.

Then for each defined algorithm step, we add a call to the dependency check functions for each sweep stage (touch vertex first time, cell kernel, touch vertex last time...)

The check consists of 1) marking down which step in the full algorithm a particle has completed in the current simulation step 2) verifying that each step and sweep stage before the one the particle currently finds itself in has been completed.

This is done both for the main algorithm steps as well as for the initialisation steps individually.

Definition at line 487 of file Particle.py.

References _dependency_checks_modify_steps(), exaparty.api.particle.ExplicitEulerDynamicSearchRadius.ExplicitEulerDynamicSearchRadius.algorithm_steps(), exaparty.api.particle.ExplicitEulerFixedSearchRadius.ExplicitEulerFixedSearchRadius.algorithm_steps(), exaparty.api.particle.LeapfrogFixedSearchRadius.LeapfrogFixedSearchRadius.algorithm_steps(), algorithm_steps(), convert::data::PatchData.data, peano4.api.datamodel.DaStGen2.DaStGen2.data, and DependencyChecks_Attribute_Prefix.

Here is the call graph for this function:

◆ _dependency_checks_modify_steps()

exaparty.api.particle.Particle.Particle._dependency_checks_modify_steps ( self,
steplist,
step_type_name,
peano4_event_enum )
protected

Add dependency checks as well as mesh consistency checks to the algorithm steps.

This function actually modifies the AlgorithmSteps to contain the debug dependency checks. Is called by self._add_dependency_checks() and uses the validation routines from exaparty.dependencychecks.

The routine is used to either add checks for the init phase or the actual time stepping. Which one is meant is identified through step_type_name. You can obviously call the routine twice: once for init and once for the time stepping. Later on, you might want to add further steps.

Besides the name of interest, we also require a list of algorithmic steps through which the code runs through.

Default settings

If the user does not define bespoke default settings, this routine adds default ones. These are set through instances of exaparty.dependencychecks.Invariant.

  • For vertices, this is touch-at-most-once-mask-out-otherwise-all-previous-steps-update-at-least-once.
  • For cells, this is also touch-at-most-once-mask-out-otherwise-all-previous-steps-update-at-least-once.

For any step whose effect may trigger a rerun, we switch to the _SweepMayRerun variant of the invariant instead, as such a step may legitimately touch a particle more than once within a sweep.

See also
AlgorithmStep.may_trigger_rerun()

Additional attributes

First, the particle is added two counters which count up how often a particle is touched or masked out.

Parameters
Steplistlist list of AlgorithmStep objects to work on
step_type_namestr name of type of steps we're dealing with. Either AlgorithmStep or InitStep.
peano4_event_enumlist list of enums of peano4 events within a single mesh traversal (e.g. touch vertex first time, cell kernel, ...)
Returns
steps: list the modified list of AlgorithmSteps, now including dependency checks

Definition at line 188 of file Particle.py.

References convert::data::PatchData.data, peano4.api.datamodel.DaStGen2.DaStGen2.data, DependencyChecks_Attribute_Prefix, DependencyChecks_Ifdefs, convert::data::Variable.name, exagrype.api.euler.CCZ4WithEuler_OuterAdditiveCoupling.CCZ4WithEuler_OuterAdditiveCoupling.name, exagrype.api.euler.CCZ4WithEuler_OuterMultiplicativeCoupling.CCZ4WithEuler_OuterMultiplicativeCoupling.name, exagrype.api.FOSOSolver.FOSOSolver.name, exagrype.api.scalarfield.CCZ4WithScalarField_InnerCoupling.CCZ4WithScalarField_InnerCoupling.name, exagrype.api.scalarfield.CCZ4WithScalarField_OuterMultiplicativeCoupling.CCZ4WithScalarField_OuterMultiplicativeCoupling.name, exahype2.api.dslhype2.AbstractSyntaxTree.Argument.name, exahype2.api.dslhype2.AbstractSyntaxTree.Function.name, exahype2.api.dslhype2.AbstractSyntaxTree.FunctionCall.name, exahype2.api.dslhype2.Expressions.Variable.name, exahype2.api.dslhype2.Types.TFunction.name, exahype2.api.dslhype2.Types.TStruct.name, exahype2.api.PDETerm.PDETerm.name, exahype2.api.Solver.Solver.Plotter.name, exaparty.api.particle.AlgorithmStep.AlgorithmStep.name, and peano4.api.datamodel.DoF.DoF.name.

Referenced by _add_dependency_checks().

Here is the caller graph for this function:

◆ algorithm_steps()

◆ initialisation_steps()

◆ readme_descriptor()

exaparty.api.particle.Particle.Particle.readme_descriptor ( self)

Create default readme descriptor.

You might want to overwrite this for your particular particle species to get more detailed info the the README.md file generated by Peano.

Reimplemented from peano4.api.datamodel.DaStGen2.DaStGen2.

Reimplemented in exaparty.api.particle.ExplicitEulerFixedSearchRadius.ExplicitEulerFixedSearchRadius, exaparty.api.particle.LeapfrogFixedSearchRadius.LeapfrogFixedSearchRadius, exaparty.api.particle.SPHLeapfrogFixedSearchRadius.SPHLeapfrogFixedSearchRadius, exaparty.api.particle.SPHParticle.SPHParticle, and exaparty.api.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle.

Definition at line 152 of file Particle.py.

References convert::data::PatchData.data, peano4.api.datamodel.DaStGen2.DaStGen2.data, max_h, min_h, convert::data::Variable.name, exagrype.api.euler.CCZ4WithEuler_OuterAdditiveCoupling.CCZ4WithEuler_OuterAdditiveCoupling.name, exagrype.api.euler.CCZ4WithEuler_OuterMultiplicativeCoupling.CCZ4WithEuler_OuterMultiplicativeCoupling.name, exagrype.api.FOSOSolver.FOSOSolver.name, exagrype.api.scalarfield.CCZ4WithScalarField_InnerCoupling.CCZ4WithScalarField_InnerCoupling.name, exagrype.api.scalarfield.CCZ4WithScalarField_OuterMultiplicativeCoupling.CCZ4WithScalarField_OuterMultiplicativeCoupling.name, exahype2.api.dslhype2.AbstractSyntaxTree.Argument.name, exahype2.api.dslhype2.AbstractSyntaxTree.Function.name, exahype2.api.dslhype2.AbstractSyntaxTree.FunctionCall.name, exahype2.api.dslhype2.Expressions.Variable.name, exahype2.api.dslhype2.Types.TFunction.name, exahype2.api.dslhype2.Types.TStruct.name, exahype2.api.PDETerm.PDETerm.name, exahype2.api.Solver.Solver.Plotter.name, exaparty.api.particle.AlgorithmStep.AlgorithmStep.name, peano4.api.datamodel.DoF.DoF.name, and particles_per_cell.

Field Documentation

◆ _algorithm_steps

exaparty.api.particle.Particle.Particle._algorithm_steps = modified_steps
protected

◆ _initialisation_steps

exaparty.api.particle.Particle.Particle._initialisation_steps = modified_steps
protected

◆ DependencyChecks_Attribute_Prefix

str exaparty.api.particle.Particle.Particle.DependencyChecks_Attribute_Prefix = "dependencyChecks"
static

Definition at line 185 of file Particle.py.

Referenced by _add_dependency_checks(), and _dependency_checks_modify_steps().

◆ DependencyChecks_Ifdefs

list exaparty.api.particle.Particle.Particle.DependencyChecks_Ifdefs = ["PeanoDebug > 0"]
static

Definition at line 186 of file Particle.py.

Referenced by _dependency_checks_modify_steps().

◆ max_h

◆ min_h

◆ particles_per_cell

exaparty.api.particle.Particle.Particle.particles_per_cell = particles_per_cell

Definition at line 125 of file Particle.py.

Referenced by readme_descriptor().


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