Peano
Loading...
Searching...
No Matches
swift2.particle.tests.testLeapfrogFixedTimeStepSize.testLeapfrogFixedTimeStepSize Class Reference

Simple particle with a fixed interaction radius h which moves according to leapfrog KDK scheme. More...

Inheritance diagram for swift2.particle.tests.testLeapfrogFixedTimeStepSize.testLeapfrogFixedTimeStepSize:
Collaboration diagram for swift2.particle.tests.testLeapfrogFixedTimeStepSize.testLeapfrogFixedTimeStepSize:

Public Member Functions

 __init__ (self, name, cfl_factor, initial_time_step_size, constant_time_step_size, particle_particle_interaction_over_particle_sets_kernel="", touch_particles_of_set_first_time_kernel="", touch_particles_of_set_last_time_kernel="", particles_per_cell=0, min_h=0.005, max_h=0.3)
 Initialise the particle.
 
 set_parameters (self)
 This function translates "global" particle parameters which are constant throughout the simulation (like CFL factor, minimal time step size, viscosity parameters...) into dastgen attributes of the C++ particle class.
 
 algorithm_steps (self)
 Leapfrog consists basically of four steps per particle.
 
 initialisation_steps (self)
 No particular initialisation required.
 
- Public Member Functions inherited from swift2.particle.Particle.Particle
 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

 particle_particle_interaction_over_particle_sets_kernel
 
 touch_particles_of_set_first_time_kernel
 
 touch_particles_of_set_last_time_kernel
 
 name
 
- Data Fields inherited from swift2.particle.Particle.Particle
 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
 

Protected Attributes

 _cfl_factor
 
 _initial_time_step_size
 
 _adjustTimeStepSize
 
 _velocity
 
 _accelerator
 
 _v_full
 
 _u_full
 
 _u
 
 _density
 
 _pressure
 
 _soundSpeed
 
 _v_sig_AV
 
 _is_boundary_part
 
- Protected Attributes inherited from swift2.particle.Particle.Particle
 _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
 

Additional Inherited Members

- Static Public Attributes inherited from swift2.particle.Particle.Particle
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 inherited from swift2.particle.Particle.Particle
 _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.
 

Detailed Description

Simple particle with a fixed interaction radius h which moves according to leapfrog KDK scheme.

By default, it uses global time stepping, i.e. the combination of maximum velocity and minimal mesh size determines the time step size of the subsequent time step. Besides the default variables x and h, the particle has the following properties:

  • a vector a which is the acceleration;
  • a vector v which is the velocity.

You can add further properties via

   myparticle.data.add_attribute( peano4.dastgen2.Peano4DoubleArray("myFancyArray","Dimensions") )

in your code. Or you can create a subclass which adds additional fields after it has called the baseline constructor.

You will need to add further properties for any SPH project.

Force calculation

particle_particle_interaction_over_particle_sets_kernel is a C++ string which defines a force between two particles. It has access to three important objects:

  • localParticles is a container (list) over pointers to local particles
  • activeParticles is a container (list) over pointers to active particles
  • marker is a cell marker which identifies the current cell.

Please consult the guidebook for a definition of local and active particles but take into account that the local particles always are a subset of the active particles.

Besides the actual particle-to-particle calculation, i.e. a force calculation, users can also provide kernels that kick in when you touch particles for the first time before you actually compute any particle-particle interaction, and there is a plug-in point what you do just once the particle-particle interaction has terminated. The latter point is reached before we do the actual time stepping. In both plug-in points, you have a vertex marker which gives you the position of the vertex to which a particular is associated, and you have the localParticles. This is a vector of pointers in this particular case.

See also
peano4::datamanagement::CellMarker
peano4::datamanagement::VertexMarker

Definition at line 11 of file testLeapfrogFixedTimeStepSize.py.

Constructor & Destructor Documentation

◆ __init__()

swift2.particle.tests.testLeapfrogFixedTimeStepSize.testLeapfrogFixedTimeStepSize.__init__ ( self,
name,
particles_per_cell,
min_h,
max_h,
particle_particle_interaction_over_particle_sets_kernel = "",
touch_particles_of_set_first_time_kernel = "",
touch_particles_of_set_last_time_kernel = "",
particles_per_cell = 0,
min_h = 0.005,
max_h = 0.3 )

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 swift2.particle.Particle.Particle.

Definition at line 61 of file testLeapfrogFixedTimeStepSize.py.

References swift2.particle.tests.testLeapfrogFixedTimeStepSize.testLeapfrogFixedTimeStepSize.__init__().

Referenced by swift2.particle.tests.testLeapfrogFixedTimeStepSize.testLeapfrogFixedTimeStepSize.__init__().

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

Member Function Documentation

◆ algorithm_steps()

swift2.particle.tests.testLeapfrogFixedTimeStepSize.testLeapfrogFixedTimeStepSize.algorithm_steps ( self)

Leapfrog consists basically of four steps per particle.

We first determine the force. Then we update the velocity by half a timestep and move the particle by a full timestep. Then the force is re-computed and the second half of the velocity update is done. Some variations of this KDK form re-arrange the steps executed per timestep to avoid a second force loop.

Reimplemented from swift2.particle.Particle.Particle.

Definition at line 172 of file testLeapfrogFixedTimeStepSize.py.

References swift2.particle.ExplicitEulerDynamicSearchRadius.ExplicitEulerDynamicSearchRadius.touch_particles_of_set_first_time_kernel, swift2.particle.ExplicitEulerFixedSearchRadius.ExplicitEulerFixedSearchRadius.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_first_time_kernel(), swift2.particle.LeapfrogFixedSearchRadius.LeapfrogFixedSearchRadius.touch_particles_of_set_first_time_kernel, swift2.particle.LeapfrogFixedSearchRadius.LeapfrogFixedSearchRadius.touch_particles_of_set_first_time_kernel(), swift2.particle.tests.DisappearingParticleTest.DisappearingParticleTest.touch_particles_of_set_first_time_kernel, and swift2.particle.tests.testLeapfrogFixedTimeStepSize.testLeapfrogFixedTimeStepSize.touch_particles_of_set_first_time_kernel.

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:

◆ initialisation_steps()

swift2.particle.tests.testLeapfrogFixedTimeStepSize.testLeapfrogFixedTimeStepSize.initialisation_steps ( self)

No particular initialisation required.

Reimplemented from swift2.particle.Particle.Particle.

Definition at line 310 of file testLeapfrogFixedTimeStepSize.py.

◆ set_parameters()

swift2.particle.tests.testLeapfrogFixedTimeStepSize.testLeapfrogFixedTimeStepSize.set_parameters ( self)

This function translates "global" particle parameters which are constant throughout the simulation (like CFL factor, minimal time step size, viscosity parameters...) into dastgen attributes of the C++ particle class.

If you modify any of the attributes manually outside of the particle initialisation, e.g. by invoking

particle = SPHLeapfrogFixedSearchRadius(initial_time_step_size=ABC, ...)
particle.initial_time_step_size = XYZ

you need to call this function manually so your changes propagate into the generated C++ files.

Definition at line 131 of file testLeapfrogFixedTimeStepSize.py.

References swift2.particle.tests.testLeapfrogFixedTimeStepSize.testLeapfrogFixedTimeStepSize._adjustTimeStepSize, swift2.particle.SPHLeapfrogFixedSearchRadius.SPHLeapfrogFixedSearchRadius._cfl_factor, swift2.particle.SPHParticle.SPHParticle._cfl_factor, swift2.particle.tests.testLeapfrogFixedTimeStepSize.testLeapfrogFixedTimeStepSize._cfl_factor, swift2.particle.SPHLeapfrogFixedSearchRadius.SPHLeapfrogFixedSearchRadius._initial_time_step_size, swift2.particle.SPHParticle.SPHParticle._initial_time_step_size, swift2.particle.tests.testLeapfrogFixedTimeStepSize.testLeapfrogFixedTimeStepSize._initial_time_step_size, 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, double >.data(), tarch::la::Vector< Dimensions, int >.data(), tarch::la::Vector< Size, Scalar >.data(), tarch::la::Vector< TwoTimesD, int >.data(), tarch::la::Vector< TwoPowerD, int >.data(), Vec< ITEM, ALLOCATOR >.data(), tarch::la::DynamicMatrix.data(), tarch::la::Matrix< Rows, Cols, Scalar >.data(), tarch::la::Vector< Dimensions, double >.data(), tarch::la::Vector< TwoPowerD, int >.data(), tarch::la::Vector< TwoTimesD, int >.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.

Here is the call graph for this function:

Field Documentation

◆ _accelerator

swift2.particle.tests.testLeapfrogFixedTimeStepSize.testLeapfrogFixedTimeStepSize._accelerator
protected

Definition at line 92 of file testLeapfrogFixedTimeStepSize.py.

◆ _adjustTimeStepSize

swift2.particle.tests.testLeapfrogFixedTimeStepSize.testLeapfrogFixedTimeStepSize._adjustTimeStepSize
protected

◆ _cfl_factor

swift2.particle.tests.testLeapfrogFixedTimeStepSize.testLeapfrogFixedTimeStepSize._cfl_factor
protected

◆ _density

swift2.particle.tests.testLeapfrogFixedTimeStepSize.testLeapfrogFixedTimeStepSize._density
protected

Definition at line 102 of file testLeapfrogFixedTimeStepSize.py.

◆ _initial_time_step_size

swift2.particle.tests.testLeapfrogFixedTimeStepSize.testLeapfrogFixedTimeStepSize._initial_time_step_size
protected

◆ _is_boundary_part

swift2.particle.tests.testLeapfrogFixedTimeStepSize.testLeapfrogFixedTimeStepSize._is_boundary_part
protected

Definition at line 106 of file testLeapfrogFixedTimeStepSize.py.

◆ _pressure

swift2.particle.tests.testLeapfrogFixedTimeStepSize.testLeapfrogFixedTimeStepSize._pressure
protected

Definition at line 103 of file testLeapfrogFixedTimeStepSize.py.

◆ _soundSpeed

swift2.particle.tests.testLeapfrogFixedTimeStepSize.testLeapfrogFixedTimeStepSize._soundSpeed
protected

Definition at line 104 of file testLeapfrogFixedTimeStepSize.py.

◆ _u

swift2.particle.tests.testLeapfrogFixedTimeStepSize.testLeapfrogFixedTimeStepSize._u
protected

Definition at line 101 of file testLeapfrogFixedTimeStepSize.py.

◆ _u_full

swift2.particle.tests.testLeapfrogFixedTimeStepSize.testLeapfrogFixedTimeStepSize._u_full
protected

Definition at line 100 of file testLeapfrogFixedTimeStepSize.py.

◆ _v_full

swift2.particle.tests.testLeapfrogFixedTimeStepSize.testLeapfrogFixedTimeStepSize._v_full
protected

Definition at line 99 of file testLeapfrogFixedTimeStepSize.py.

◆ _v_sig_AV

swift2.particle.tests.testLeapfrogFixedTimeStepSize.testLeapfrogFixedTimeStepSize._v_sig_AV
protected

Definition at line 105 of file testLeapfrogFixedTimeStepSize.py.

◆ _velocity

swift2.particle.tests.testLeapfrogFixedTimeStepSize.testLeapfrogFixedTimeStepSize._velocity
protected

◆ name

◆ particle_particle_interaction_over_particle_sets_kernel

swift2.particle.tests.testLeapfrogFixedTimeStepSize.testLeapfrogFixedTimeStepSize.particle_particle_interaction_over_particle_sets_kernel

Definition at line 116 of file testLeapfrogFixedTimeStepSize.py.

◆ touch_particles_of_set_first_time_kernel

◆ touch_particles_of_set_last_time_kernel

swift2.particle.tests.testLeapfrogFixedTimeStepSize.testLeapfrogFixedTimeStepSize.touch_particles_of_set_last_time_kernel

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