Peano
Loading...
Searching...
No Matches
swift2.particle.Particle.Particle Class Reference

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

Inheritance diagram for swift2.particle.Particle.Particle:
Collaboration diagram for swift2.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.datamodel.DaStGen2.DaStGen2
 configure (self, namespace, association, subdirectory="")
 I always need the MPI aspect, but I can't add the right one before I don't know whether this DaStGen model is used for vertices, faces or cells.
 
 additional_load_and_store_arguments (self)
 
 additional_load_and_store_arguments (self, new_arguments)
 
- Public Member Functions inherited from peano4.datamodel.DoF.DoF
 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
 
 min_h
 
 max_h
 
 name
 
- Data Fields inherited from peano4.toolbox.particles.Particle.Particle
 name
 
 partid
 
- Data Fields inherited from peano4.datamodel.DaStGen2.DaStGen2
 generator
 
 data
 
 peano4_mpi_and_storage_aspect
 
- Data Fields inherited from peano4.datamodel.DoF.DoF
 association
 
 name
 
 namespace
 
 subdirectory
 

Static Public Attributes

str DependencyChecks_Attribute_Prefix = "dependencyChecks"
 
list DependencyChecks_Ifdefs = ["PeanoDebug > 0"]
 
- Static Public Attributes inherited from peano4.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
 
 _initialisation_steps
 
- Protected Attributes inherited from peano4.datamodel.DaStGen2.DaStGen2
 _additional_load_and_store_arguments
 
- Protected Attributes inherited from peano4.datamodel.DoF.DoF
 _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.dastgen2.Peano4DoubleArray("v","Dimensions") )
Specialisation of dastgen2.attributes.DoubleArray which relies on Peano's tarch.

Definition at line 10 of file Particle.py.

Constructor & Destructor Documentation

◆ __init__()

swift2.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
swift2.actionsets.UpdateParticleMarker

Reimplemented from peano4.toolbox.particles.Particle.Particle.

Reimplemented in swift2.particle.tests.testLeapfrogFixedTimeStepSize.testLeapfrogFixedTimeStepSize, swift2.particle.ExplicitEulerFixedSearchRadius.ExplicitEulerFixedSearchRadius, swift2.particle.LeapfrogFixedSearchRadius.LeapfrogFixedSearchRadius, swift2.particle.tests.DisappearingParticleTest.DisappearingParticleTest, swift2.particle.ExplicitEulerDynamicSearchRadius.ExplicitEulerDynamicSearchRadius, swift2.particle.tests.testDensityCalculation.testDensityCalculation, swift2.particle.SPHLeapfrogFixedSearchRadius.SPHLeapfrogFixedSearchRadius, swift2.particle.SPHParticle.SPHParticle, and swift2.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle.

Definition at line 74 of file Particle.py.

References swift2.particle.Particle.Particle.__init__(), peano4.datamodel.DaStGen2.DaStGen2.data, peano4.datamodel.DaStGenToLegacyTool.DaStGenToLegacyTool.data, peano4.datamodel.DynamicArrayOverPrimitivesToStdVector.DynamicArrayOverPrimitivesToStdVector.data, peano4.datamodel.PatchToDoubleArray.PatchToDoubleArray.data, convert::data::DataSet.data, convert::data::PatchData.data, exahype2::EnclaveBookkeeping::Entry.data, tarch::la::DynamicMatrix.data(), tarch::la::Matrix< Rows, Cols, Scalar >.data(), tarch::la::Vector< TwoTimesD, int >.data(), tarch::la::Vector< TwoPowerD, int >.data(), tarch::la::Vector< Size, Scalar >.data(), tarch::la::Vector< DimensionsTimesTwo, int >.data(), tarch::la::Vector< Dimensions, int >.data(), tarch::la::Vector< Dimensions, double >.data(), Vec< ITEM, ALLOCATOR >.data(), tarch::la::DynamicMatrix.data(), tarch::la::Matrix< Rows, Cols, Scalar >.data(), tarch::la::Vector< TwoTimesD, int >.data(), tarch::la::Vector< TwoPowerD, int >.data(), tarch::la::Vector< Dimensions, double >.data(), tarch::la::Vector< Dimensions, int >.data(), tarch::la::Vector< Size, Scalar >.data(), tarch::la::Vector< DimensionsTimesTwo, int >.data(), toolbox::blockstructured::GlobalDatabase::Entry.data, toolbox::particles::memorypool::GlobalContinuousMemoryPool< T >::GlobalMemory.data, and toolbox::particles::TrajectoryDatabase::Entry.data.

Referenced by swift2.particle.Particle.Particle.__init__().

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

Member Function Documentation

◆ _add_dependency_checks()

swift2.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 482 of file Particle.py.

References swift2.particle.Particle.Particle._dependency_checks_modify_steps(), swift2.particle.ExplicitEulerDynamicSearchRadius.ExplicitEulerDynamicSearchRadius.algorithm_steps(), swift2.particle.ExplicitEulerFixedSearchRadius.ExplicitEulerFixedSearchRadius.algorithm_steps(), swift2.particle.LeapfrogFixedSearchRadius.LeapfrogFixedSearchRadius.algorithm_steps(), swift2.particle.Particle.Particle.algorithm_steps(), swift2.particle.SPHParticle.SPHParticle.algorithm_steps(), swift2.particle.tests.DastgenTestDummyParticle.DastgenTestDummyParticle.algorithm_steps(), swift2.particle.tests.DisappearingParticleTest.DisappearingParticleTest.algorithm_steps(), swift2.particle.tests.testLeapfrogFixedTimeStepSize.testLeapfrogFixedTimeStepSize.algorithm_steps(), Vec< ITEM, ALLOCATOR >.data(), peano4.datamodel.DaStGen2.DaStGen2.data, peano4.datamodel.DaStGenToLegacyTool.DaStGenToLegacyTool.data, peano4.datamodel.DynamicArrayOverPrimitivesToStdVector.DynamicArrayOverPrimitivesToStdVector.data, peano4.datamodel.PatchToDoubleArray.PatchToDoubleArray.data, convert::data::DataSet.data, convert::data::PatchData.data, exahype2::EnclaveBookkeeping::Entry.data, tarch::la::DynamicMatrix.data(), tarch::la::Matrix< Rows, Cols, Scalar >.data(), tarch::la::Vector< DimensionsTimesTwo, int >.data(), tarch::la::Vector< Dimensions, int >.data(), tarch::la::Vector< Size, Scalar >.data(), tarch::la::Vector< Dimensions, double >.data(), tarch::la::Vector< TwoTimesD, int >.data(), tarch::la::Vector< TwoPowerD, int >.data(), tarch::la::DynamicMatrix.data(), tarch::la::Matrix< Rows, Cols, Scalar >.data(), tarch::la::Vector< TwoPowerD, int >.data(), tarch::la::Vector< TwoTimesD, int >.data(), tarch::la::Vector< Dimensions, double >.data(), tarch::la::Vector< Dimensions, int >.data(), tarch::la::Vector< Size, Scalar >.data(), tarch::la::Vector< DimensionsTimesTwo, int >.data(), toolbox::blockstructured::GlobalDatabase::Entry.data, toolbox::particles::memorypool::GlobalContinuousMemoryPool< T >::GlobalMemory.data, toolbox::particles::TrajectoryDatabase::Entry.data, and swift2.particle.Particle.Particle.DependencyChecks_Attribute_Prefix.

Here is the call graph for this function:

◆ _dependency_checks_modify_steps()

swift2.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 swift2::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 swift::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.

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 exahype2::EnclaveBookkeeping::Entry.data, tarch::la::DynamicMatrix.data(), tarch::la::Matrix< Rows, Cols, Scalar >.data(), tarch::la::Vector< Dimensions, int >.data(), Vec< ITEM, ALLOCATOR >.data(), peano4.datamodel.DaStGen2.DaStGen2.data, peano4.datamodel.DaStGenToLegacyTool.DaStGenToLegacyTool.data, peano4.datamodel.DynamicArrayOverPrimitivesToStdVector.DynamicArrayOverPrimitivesToStdVector.data, peano4.datamodel.PatchToDoubleArray.PatchToDoubleArray.data, convert::data::DataSet.data, convert::data::PatchData.data, tarch::la::Vector< TwoPowerD, int >.data(), tarch::la::Vector< Size, Scalar >.data(), tarch::la::Vector< TwoTimesD, int >.data(), tarch::la::Vector< DimensionsTimesTwo, int >.data(), tarch::la::Vector< Dimensions, double >.data(), tarch::la::DynamicMatrix.data(), tarch::la::Matrix< Rows, Cols, Scalar >.data(), tarch::la::Vector< TwoTimesD, int >.data(), tarch::la::Vector< DimensionsTimesTwo, int >.data(), tarch::la::Vector< Size, Scalar >.data(), tarch::la::Vector< Dimensions, int >.data(), tarch::la::Vector< Dimensions, double >.data(), tarch::la::Vector< TwoPowerD, int >.data(), toolbox::blockstructured::GlobalDatabase::Entry.data, toolbox::particles::memorypool::GlobalContinuousMemoryPool< T >::GlobalMemory.data, toolbox::particles::TrajectoryDatabase::Entry.data, swift2.particle.Particle.Particle.DependencyChecks_Attribute_Prefix, and swift2.particle.Particle.Particle.DependencyChecks_Ifdefs.

Referenced by swift2.particle.Particle.Particle._add_dependency_checks().

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

◆ algorithm_steps()

◆ initialisation_steps()

◆ readme_descriptor()

swift2.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.datamodel.DaStGen2.DaStGen2.

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

Definition at line 152 of file Particle.py.

References peano4.datamodel.DaStGen2.DaStGen2.data, peano4.datamodel.DaStGenToLegacyTool.DaStGenToLegacyTool.data, peano4.datamodel.DynamicArrayOverPrimitivesToStdVector.DynamicArrayOverPrimitivesToStdVector.data, peano4.datamodel.PatchToDoubleArray.PatchToDoubleArray.data, convert::data::DataSet.data, convert::data::PatchData.data, exahype2::EnclaveBookkeeping::Entry.data, tarch::la::DynamicMatrix.data(), tarch::la::Matrix< Rows, Cols, Scalar >.data(), tarch::la::Vector< TwoTimesD, int >.data(), tarch::la::Vector< DimensionsTimesTwo, int >.data(), tarch::la::Vector< TwoPowerD, int >.data(), tarch::la::Vector< Dimensions, double >.data(), tarch::la::Vector< Dimensions, int >.data(), tarch::la::Vector< Size, Scalar >.data(), Vec< ITEM, ALLOCATOR >.data(), tarch::la::DynamicMatrix.data(), tarch::la::Matrix< Rows, Cols, Scalar >.data(), tarch::la::Vector< TwoTimesD, int >.data(), tarch::la::Vector< TwoPowerD, int >.data(), tarch::la::Vector< Dimensions, double >.data(), tarch::la::Vector< Size, Scalar >.data(), tarch::la::Vector< DimensionsTimesTwo, int >.data(), tarch::la::Vector< Dimensions, int >.data(), toolbox::blockstructured::GlobalDatabase::Entry.data, toolbox::particles::memorypool::GlobalContinuousMemoryPool< T >::GlobalMemory.data, toolbox::particles::TrajectoryDatabase::Entry.data, peano4.visualisation.filters.ExtractMeshResolution.ExtractMeshResolution.max_h, swift2.particle.Particle.Particle.max_h, solvers.api.CollocatedDLinearDiscretisationWithPointJacobi.CollocatedDLinearDiscretisationWithPointJacobi.max_h, solvers.api.Solver.Solver.max_h, api.solvers.Solver.Solver.max_h, peano4.visualisation.filters.ExtractMeshResolution.ExtractMeshResolution.min_h, swift2.particle.Particle.Particle.min_h, solvers.api.CollocatedDLinearDiscretisationWithPointJacobi.CollocatedDLinearDiscretisationWithPointJacobi.min_h, solvers.api.Solver.Solver.min_h, api.solvers.Solver.Solver.min_h, dastgen2.attributes.Attribute.Attribute.name(), exahype2.solvers.aderdg.kernels.Gemms.Gemms.name, exahype2.solvers.elliptic.ConstrainedPoissonEquationForMarkerOnCells.ConstrainedPoissonEquationForMarkerOnCells.name(), exahype2.solvers.fv.FV.FV.name(), exahype2.solvers.rkfd.CellCenteredFiniteDifferences.CellCenteredFiniteDifferences.name(), peano4.datamodel.DoF.DoF.name, peano4.solversteps.Step.Step.name, peano4.solversteps.UserActionSet.UserActionSet.name, peano4.toolbox.particles.Particle.Particle.name, swift2.particle.AlgorithmStep.AlgorithmStep.name, swift2.particle.Particle.Particle.name, swift2.particle.tests.DisappearingParticleTest.DisappearingParticleTest.name, swift2.particle.tests.testLeapfrogFixedTimeStepSize.testLeapfrogFixedTimeStepSize.name, convert::data::Variable.name, solvers.api.Solver.Solver.name(), api.solvers.Solver.Solver.name(), and swift2.particle.Particle.Particle.particles_per_cell.

Here is the call graph for this function:

Field Documentation

◆ _algorithm_steps

swift2.particle.Particle.Particle._algorithm_steps
protected

Definition at line 537 of file Particle.py.

Referenced by swift2.particle.SPHLeapfrogFixedSearchRadius.SPHLeapfrogFixedSearchRadius._setup_algorithm_steps(), swift2.particle.ExplicitEulerFixedSearchRadius.ExplicitEulerFixedSearchRadius.add_to_reduction(), swift2.particle.LeapfrogFixedSearchRadius.LeapfrogFixedSearchRadius.add_to_reduction(), swift2.particle.ExplicitEulerFixedSearchRadius.ExplicitEulerFixedSearchRadius.algorithm_steps(), swift2.particle.LeapfrogFixedSearchRadius.LeapfrogFixedSearchRadius.algorithm_steps(), swift2.particle.ExplicitEulerFixedSearchRadius.ExplicitEulerFixedSearchRadius.cell_kernel(), swift2.particle.LeapfrogFixedSearchRadius.LeapfrogFixedSearchRadius.cell_kernel(), swift2.particle.ExplicitEulerFixedSearchRadius.ExplicitEulerFixedSearchRadius.cell_kernel(), swift2.particle.LeapfrogFixedSearchRadius.LeapfrogFixedSearchRadius.cell_kernel(), swift2.particle.ExplicitEulerFixedSearchRadius.ExplicitEulerFixedSearchRadius.initialisation_steps(), swift2.particle.LeapfrogFixedSearchRadius.LeapfrogFixedSearchRadius.initialisation_steps(), swift2.particle.SPHParticle.SPHParticle.switch_namespace_of_all_particle_iterators(), swift2.particle.ExplicitEulerFixedSearchRadius.ExplicitEulerFixedSearchRadius.touch_particles_of_set_first_time_kernel(), swift2.particle.LeapfrogFixedSearchRadius.LeapfrogFixedSearchRadius.touch_particles_of_set_first_time_kernel(), swift2.particle.ExplicitEulerFixedSearchRadius.ExplicitEulerFixedSearchRadius.touch_particles_of_set_first_time_kernel(), swift2.particle.LeapfrogFixedSearchRadius.LeapfrogFixedSearchRadius.touch_particles_of_set_first_time_kernel(), swift2.particle.ExplicitEulerFixedSearchRadius.ExplicitEulerFixedSearchRadius.touch_particles_of_set_last_time_kernel(), swift2.particle.LeapfrogFixedSearchRadius.LeapfrogFixedSearchRadius.touch_particles_of_set_last_time_kernel(), swift2.particle.ExplicitEulerFixedSearchRadius.ExplicitEulerFixedSearchRadius.touch_particles_of_set_last_time_kernel(), and swift2.particle.LeapfrogFixedSearchRadius.LeapfrogFixedSearchRadius.touch_particles_of_set_last_time_kernel().

◆ _initialisation_steps

swift2.particle.Particle.Particle._initialisation_steps
protected

◆ DependencyChecks_Attribute_Prefix

str swift2.particle.Particle.Particle.DependencyChecks_Attribute_Prefix = "dependencyChecks"
static

◆ DependencyChecks_Ifdefs

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

◆ max_h

◆ min_h

◆ name

◆ particles_per_cell

swift2.particle.Particle.Particle.particles_per_cell

Definition at line 125 of file Particle.py.

Referenced by swift2.particle.Particle.Particle.readme_descriptor().


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