Peano
Loading...
Searching...
No Matches
peano4.toolbox.particles.api.UpdateParticleGridAssociation_Reassign.UpdateParticleGridAssociation_Reassign Class Reference

Associate particles to spacetree vertices. More...

Inheritance diagram for peano4.toolbox.particles.api.UpdateParticleGridAssociation_Reassign.UpdateParticleGridAssociation_Reassign:
Collaboration diagram for peano4.toolbox.particles.api.UpdateParticleGridAssociation_Reassign.UpdateParticleGridAssociation_Reassign:

Public Member Functions

 __init__ (self, particle_set, guard="true", drop_into_hanging_vertices=True)
 
 get_body_of_operation (self, operation_name)
 Core algorithm.
 
 get_action_set_name (self)
 Return unique action set name.
 
- Public Member Functions inherited from peano4.toolbox.particles.api.AbstractUpdateParticleGridAssociation.AbstractUpdateParticleGridAssociation
 get_body_of_getGridControlEvents (self)
 
 user_should_modify_template (self)
 Is the user allowed to modify the output.
 
 get_includes (self)
 Inject all the default includes.
 
 get_constructor_body (self)
 Define a tailored constructor body.
 
 get_attributes (self)
 Return attributes as copied and pasted into the generated class.
 
 get_body_of_unprepareTraversal (self)
 Create prepareTraversal function.
 
- Public Member Functions inherited from peano4.solversteps.ActionSet.ActionSet
 get_static_initialisations (self, full_qualified_classname)
 
 get_destructor_body (self)
 
 get_body_of_prepareTraversal (self)
 

Protected Attributes

 _drop_into_hanging_vertices
 
- Protected Attributes inherited from peano4.toolbox.particles.api.AbstractUpdateParticleGridAssociation.AbstractUpdateParticleGridAssociation
 _particle_set
 

Static Protected Attributes

 _Template_Sieve = UpdateParticleGridAssociation_LiftDrop._Template_Sieve
 
- Static Protected Attributes inherited from peano4.toolbox.particles.api.AbstractUpdateParticleGridAssociation.AbstractUpdateParticleGridAssociation
 _Template_BeginTraversal
 
 _Template_EndTraversal
 
 _Template_ValidateParticleLevelAssociation
 
 _Template_Drop
 
 _Template_LiftAllParticles
 

Static Private Attributes

 __Template_ReassignAndLiftWithinCell
 

Additional Inherited Members

- Data Fields inherited from peano4.toolbox.particles.api.AbstractUpdateParticleGridAssociation.AbstractUpdateParticleGridAssociation
 d
 
- Data Fields inherited from peano4.solversteps.ActionSet.ActionSet
 descend_invocation_order
 
 parallel
 
- Static Public Attributes inherited from peano4.toolbox.particles.api.AbstractUpdateParticleGridAssociation.AbstractUpdateParticleGridAssociation
int DefaultDescendInvocationOrder = -65536
 
- Static Public Attributes inherited from peano4.solversteps.ActionSet.ActionSet
str OPERATION_BEGIN_TRAVERSAL = "beginTraversal"
 
str OPERATION_END_TRAVERSAL = "endTraversal"
 
str OPERATION_CREATE_PERSISTENT_VERTEX = "createPersistentVertex"
 
str OPERATION_DESTROY_PERSISTENT_VERTEX = "destroyPersistentVertex"
 
str OPERATION_CREATE_HANGING_VERTEX = "createHangingVertex"
 
str OPERATION_DESTROY_HANGING_VERTEX = "destroyHangingVertex"
 
str OPERATION_CREATE_PERSISTENT_FACE = "createPersistentFace"
 
str OPERATION_DESTROY_PERSISTENT_FACE = "destroyPersistentFace"
 
str OPERATION_CREATE_HANGING_FACE = "createHangingFace"
 
str OPERATION_DESTROY_HANGING_FACE = "destroyHangingFace"
 
str OPERATION_CREATE_CELL = "createCell"
 
str OPERATION_DESTROY_CELL = "destroyCell"
 
str OPERATION_TOUCH_VERTEX_FIRST_TIME = "touchVertexFirstTime"
 
str OPERATION_TOUCH_VERTEX_LAST_TIME = "touchVertexLastTime"
 
str OPERATION_TOUCH_FACE_FIRST_TIME = "touchFaceFirstTime"
 
str OPERATION_TOUCH_FACE_LAST_TIME = "touchFaceLastTime"
 
str OPERATION_TOUCH_CELL_FIRST_TIME = "touchCellFirstTime"
 
str OPERATION_TOUCH_CELL_LAST_TIME = "touchCellLastTime"
 

Detailed Description

Associate particles to spacetree vertices.

Sort particles into the respective levels and cells. This mapping should be used every time you move particles around.

Algorithm

The re-association has different ingredients. We have two implementations currently available. In this version, we try to minimise the particle re-associations. For this, the algorithm realises the key checks within the cells:

  • Look at all the particles within a cell and check whether they are still assigned to the closest of the \( 2^d \) vertices of this cell. If not, reassign them.
  • Identify particles that have moved by more than one mesh width since the last update. If a particle travels fast, lift it to the next level. This check happens recursively whenever we touch a cell for the last time.
  • Drop particles down within the tree hierarchy such that they reside on an as fine level as possible. This happens in touchVertexFirstTime(), i.e. in-between two grid traversals, particles are distributed over all resolutions, but we move them down in the hierarchy as kind of a preamble of the subsequent grid sweep.

The persent code variant assumes that particles do not move after touchVertexFirstTime(). So you can alter them in touchVertexFirstTime() and then the code will sort them properly in this sweep, but if you change their position again in touchCellLastTime() or touchVertexLastTime(), then you will have an unsorted state by the end of the traversal.

Tunneling and horizontal data movements between trees

All cores run through their trees. On the finest mesh level, we have a non-overlapping domain decomposition. Each cell has a unique owner tree. On the coarser resolutions, the association is not unique anymore. We make it unique, i.e. each cell on any level has a unique owner. The owners (aka threads or ranks) run through their trees concurrently and exchange their boundary data after the traversal. If particles are to be lifted, this causes issues, as we cannot exchange them between two levels after the traversal. We could, but then we can't lift them any further within the first traversal, and we also cannot drop them into another rank at the same time.

Therefore, I employ a mixture of the pidt technique from the paper and the sieve approach also discussed there. Usually, I do all lifts and drops right throughout the mesh traversal. If I'd lift into a cell/level which is owned by another tree, I don't lift but instead dump the particle into a rank-global list. These lists are then exchanged after each traversal sweep. Drops now can either happen from the next coarser level or this global list. I call the latter a sieve.

Due to this global list approach, I can support tunneling, i.e. particles racing through multiple cells in one time step, and all of this works with MPI, too.

Statistics

The mapping keeps some statistics on any state update. These statistics however are not shared via MPI or synchronised between different threads. It is the job of the ParticleSet to ensure that we have a proper global bookkeeping.

Hanging vertices

Hanging vertices are assigned particles when they are created and their particles are lifted again, when they are destroyed. You can disable to drops in the constructor. This might reduce the number of overall drops. However, you will always need the lift, as a cell might reassign a particle to a hanging vertex at any time, and then this particle has to be lifted before the vertex is destroyed.

Where and how to use

Within your algorithm step, this update action set should always be the first or one of the first action sets before you add any other action set. If you add it first, it ensures that the drop of particles is one of the first things that happen, before any user code is triggered. As Peano automatically inverts the action set order throughout the backtracking, adding UpdateParticleGridAssociation as first action set ensures that the lifts are basically the last thing you do. This is particular imporant if your user code alters particle positions in touchVertexLastTime().

Your main code has to call finishedTraversal() on the tracer set after each sweep on each rank. This important to roll those particles over that have been sieved or have been lifted.

This action set has to be used in each and every grid traversal. In-between time steps, it is idempotent if particles do not move or change their search radius. However, as we have hanging vertices, it might move particular up and down. So you have to insert it into each and every mesh traversal.

If you disable drops, the action set becomes idempotent.

Interpolay with particle storage

This sorting scheme should not be used if you use a particle memory pool, i.e. if you try to store particles continuously - unless you insert explicit gather/resort steps. Read through the memory implications for any particle sorting.

Parameters

drop_into_hanging_vertices: Boolean

Definition at line 14 of file UpdateParticleGridAssociation_Reassign.py.

Constructor & Destructor Documentation

◆ __init__()

peano4.toolbox.particles.api.UpdateParticleGridAssociation_Reassign.UpdateParticleGridAssociation_Reassign.__init__ ( self,
particle_set,
guard = "true",
drop_into_hanging_vertices = True )

Member Function Documentation

◆ get_action_set_name()

peano4.toolbox.particles.api.UpdateParticleGridAssociation_Reassign.UpdateParticleGridAssociation_Reassign.get_action_set_name ( self)

Return unique action set name.

Returns a description (word) for the mapping which is also used as class name for the generated type. As a consequence, the result should be one word (if possible) and uppercase. Also, every subclass should overwrite this routine.

The generator will take the result and construct eventually classes similar to MyStep2Dummy.h and MyStep2Dummy.cpp or similar for the example below, where we return Dummy.

Reimplemented from peano4.solversteps.ActionSet.ActionSet.

Definition at line 335 of file UpdateParticleGridAssociation_Reassign.py.

◆ get_body_of_operation()

peano4.toolbox.particles.api.UpdateParticleGridAssociation_Reassign.UpdateParticleGridAssociation_Reassign.get_body_of_operation ( self,
operation_name )

Core algorithm.

See class description.

Reimplemented from peano4.solversteps.ActionSet.ActionSet.

Definition at line 307 of file UpdateParticleGridAssociation_Reassign.py.

References peano4.toolbox.particles.api.UpdateParticleGridAssociation_Reassign.UpdateParticleGridAssociation_Reassign.__Template_ReassignAndLiftWithinCell, peano4.toolbox.particles.api.UpdateParticleGridAssociation_Reassign.UpdateParticleGridAssociation_Reassign._drop_into_hanging_vertices, peano4.toolbox.particles.api.AbstractUpdateParticleGridAssociation.AbstractUpdateParticleGridAssociation._Template_BeginTraversal, peano4.toolbox.particles.api.AbstractUpdateParticleGridAssociation.AbstractUpdateParticleGridAssociation._Template_Drop, peano4.toolbox.particles.api.AbstractUpdateParticleGridAssociation.AbstractUpdateParticleGridAssociation._Template_EndTraversal, peano4.toolbox.particles.api.AbstractUpdateParticleGridAssociation.AbstractUpdateParticleGridAssociation._Template_LiftAllParticles, peano4.toolbox.particles.api.UpdateParticleGridAssociation_BucketSort.UpdateParticleGridAssociation_BucketSort._Template_Sieve, peano4.toolbox.particles.api.UpdateParticleGridAssociation_LiftDrop.UpdateParticleGridAssociation_LiftDrop._Template_Sieve, peano4.toolbox.particles.api.UpdateParticleGridAssociation_Reassign.UpdateParticleGridAssociation_Reassign._Template_Sieve, ScenarioFactory.createScenario(), exahype2.solvers.aderdg.kernels.AMRRoutines.AMRRoutines.d, exahype2.solvers.aderdg.kernels.CellData.CellData.d, exahype2.solvers.aderdg.kernels.DGMatrices.DGMatrices.d, exahype2.solvers.aderdg.kernels.FusedSpaceTimePredictorVolumeIntegral.FusedSpaceTimePredictorVolumeIntegral.d, exahype2.solvers.aderdg.kernels.Quadrature.Quadrature.d, exahype2.solvers.fv.actionsets.HandleBoundary.HandleBoundary.d, exahype2.solvers.fv.actionsets.RollOverUpdatedFace.RollOverUpdatedFace.d, exahype2.solvers.limiting.kernels.Limiter.Limiter.d, exahype2.solvers.limiting.kernels.Quadrature.Quadrature.d, exahype2.solvers.rkfd.actionsets.HandleBoundary.HandleBoundary.d, exahype2.solvers.rkfd.actionsets.RollOverUpdatedFace.RollOverUpdatedFace.d, exahype2.tracer.DumpTracerIntoDatabase.DumpTracerIntoDatabase.d, exahype2.tracer.InsertParticlesFromFile.InsertParticlesFromFile.d, peano4.datamodel.ModelToDataRepository.ModelToDataRepository.d, peano4.output.Constants.Constants.d, peano4.output.Jinja2TemplatedHeaderFile.Jinja2TemplatedHeaderFile.d, peano4.output.Jinja2TemplatedHeaderImplementationFilePair.Jinja2TemplatedHeaderImplementationFilePair.d, peano4.output.Makefile.Makefile.d, peano4.output.Observer.Observer.d, peano4.output.TemplatedHeaderFile.TemplatedHeaderFile.d, peano4.output.TemplatedHeaderImplementationFilePair.TemplatedHeaderImplementationFilePair.d, peano4.runner.DefaultSequence.DefaultSequence.d, peano4.solversteps.StepsToStepRepository.StepsToStepRepository.d, peano4.toolbox.blockstructured.BackupPatchOverlap.BackupPatchOverlap.d, peano4.toolbox.blockstructured.DynamicAMR.DynamicAMR.d, peano4.toolbox.blockstructured.PlotPatchesInPeanoBlockFormat.PlotPatchesInPeanoBlockFormat.d, peano4.toolbox.blockstructured.PlotPatchesOverFacesInPeanoBlockFormat.PlotPatchesOverFacesInPeanoBlockFormat.d, peano4.toolbox.blockstructured.ProjectPatchOntoFaces.ProjectPatchOntoFaces.d, peano4.toolbox.CreateRegularGrid.CreateRegularGrid.d, peano4.toolbox.multigrid.cellbased.ScalarJacobiWithRediscretisation.ScalarJacobiWithRediscretisation.d, peano4.toolbox.multigrid.MatrixFreeJacobi.MatrixFreeJacobi.d, peano4.toolbox.multigrid.vertexbased.ScalarJacobiWithRediscretisation.ScalarJacobiWithRediscretisation.d, peano4.toolbox.particles.api.AbstractUpdateParticleGridAssociation.AbstractUpdateParticleGridAssociation.d, peano4.toolbox.particles.api.UpdateParallelState.UpdateParallelState.d, peano4.toolbox.particles.api.UpdateParticleGridAssociation_BucketSort.UpdateParticleGridAssociation_BucketSort.d, peano4.toolbox.particles.GatherParticlesInMemoryPool.GatherParticlesInMemoryPool.d, peano4.toolbox.particles.InsertParticlesAlongCartesianLayoutIntoUnrefinedCells.InsertParticlesAlongCartesianLayoutIntoUnrefinedCells.d, peano4.toolbox.particles.InsertParticlesByCoordinates.InsertParticlesByCoordinates.d, peano4.toolbox.particles.InsertRandomParticlesIntoUnrefinedCells.InsertRandomParticlesIntoUnrefinedCells.d, peano4.toolbox.particles.ParticleAMR.ParticleAMR.d, peano4.toolbox.particles.ParticleTreeAnalysis.ParticleTreeAnalysis.d, peano4.toolbox.particles.PlotParticlesInVTKFormat.PlotParticlesInVTKFormat.d, peano4.toolbox.particles.UpdateParticle_MultiLevelInteraction_Sets.UpdateParticle_MultiLevelInteraction_Sets.d, peano4.toolbox.particles.UpdateParticle_MultiLevelInteraction_StackOfLists.UpdateParticle_MultiLevelInteraction_StackOfLists.d, peano4.toolbox.particles.UpdateParticle_MultiLevelInteraction_StackOfLists_ContiguousParticles.UpdateParticle_MultiLevelInteraction_StackOfLists_ContiguousParticles.d, peano4.toolbox.particles.UpdateParticle_SingleLevelInteraction.UpdateParticle_SingleLevelInteraction.d, peano4.toolbox.particles.UpdateParticle_SingleLevelInteraction_ContiguousParticles.UpdateParticle_SingleLevelInteraction_ContiguousParticles.d, swift2.actionsets.Cleanup.Cleanup.d, swift2.actionsets.DynamicMeshRefinementAnalysis.DynamicMeshRefinementAnalysis.d, swift2.actionsets.ScatterGlobalMemory.ScatterGlobalMemory.d, swift2.actionsets.UpdateParticleMarker.UpdateParticleMarker.d, swift2.api.actionsets.SynchroniseVerticesWithPreviousMeshSweep.SynchroniseVerticesWithPreviousMeshSweep.d, swift2.api.boundaryconditions.Fixed.Fixed.d, solvers.api.actionsets.CollocatedMGSingleThreaded.UpdateSolution.UpdateSolution.d, solvers.api.actionsets.CollocatedMGSolver.InitDofs.InitDofsCollocatedMG.d, solvers.api.actionsets.CollocatedMGSolver.Prolongation.Prolongation.d, solvers.api.actionsets.CollocatedMGSolver.ResetAndUpdateResidual.ResetAndUpdateResidual.d, solvers.api.actionsets.CollocatedMGSolver.Restriction.Restriction.d, solvers.api.actionsets.CollocatedMGSolver.UpdateSolution.UpdateSolution.d, solvers.api.actionsets.CollocatedSolver.InitDofs.InitDofsCollocated.d, solvers.api.actionsets.CollocatedSolver.ResetAndUpdateResidual.ResetAndUpdateResidual.d, solvers.api.actionsets.CollocatedSolver.UpdateSolution.UpdateSolution.d, ProjectResidualsAndDiagonalOntoFacets.ProjectResidualsAndDiagonalOntoFacets.d, UpdateCell.UpdateCell.d, UpdateFacets.UpdateFacets.d, solvers.api.actionsets.DGCGCoupling.AbstractDGCGCoupling.d, solvers.api.actionsets.DGCGCoupling.AdditiveDGCGCoupling.d, solvers.api.actionsets.DGCGCoupling.MultiplicativeDGCGCoupling.d, solvers.api.actionsets.DGSolver.ProjectIntoCellAndUpdateCellSolution.ProjectIntoCellAndUpdateCellSolution.d, solvers.api.actionsets.DGSolver.ProjectIntoCellAndUpdateCellSolutionWithTasks.ProjectIntoCellAndUpdateCellSolutionWithTasks.d, solvers.api.actionsets.DGSolver.ProjectOntoFaces.ProjectOntoFaces.d, solvers.api.actionsets.DGSolver.UpdateFaceSolution.UpdateFaceSolution.d, solvers.api.actionsets.DGSolver.UpdateResidual.UpdateResidual.d, solvers.api.actionsets.DGSolver.UpdateResidualWithTasks.UpdateResidualWithTasks.d, solvers.api.actionsets.InitHigherOrderDofs.InitHigherOrderDofs.d, solvers.api.actionsets.PlotDGDataInPeanoBlockFormat.PlotDGDataInPeanoBlockFormat.d, solvers.api.actionsets.PlotDGPatchesInPeanoBlockFormat.PlotDGPatchesInPeanoBlockFormat.d, solvers.api.actionsets.PlotVertexDataInPeanoBlockFormat.PlotVertexDataInPeanoBlockFormat.d, archive_AssemblePETSCMatrix.AssemblePETSCMatrixOnCellsAndFaces.d, api.actionsets.EnumerateDoFs.EnumerateDoFs.d, api.actionsets.ImposeDirichletBoundaryConditions.ImposeDirichletBoundaryConditions.d, api.actionsets.ImposeDirichletBoundaryConditionsWithInteriorPenaltyMethod.ImposeDirichletBoundaryConditionsWithInteriorPenaltyMethod.d, api.actionsets.InitCellDoFs.InitCellDoFs.d, api.actionsets.InitFaceDoFs.InitFaceDoFs.d, api.actionsets.InitPetsc.SendDofsToVertices.d, api.actionsets.InitVertexDoFs.InitVertexDoFs.d, api.actionsets.PlotDGDataInPeanoBlockFormat.PlotDGDataInPeanoBlockFormat.d, api.actionsets.PlotExactSolution.PlotExactSolution.d, api.actionsets.ProjectPETScSolutionBackOntoMesh.ProjectPETScSolutionOnCellsBackOntoMesh.d, api.actionsets.ProjectPETScSolutionBackOntoMesh.ProjectPETScSolutionOnVerticesBackOntoMesh.d, api.solvers.CollocatedLowOrderDiscretisation.AssemblePetscMatrix.d, api.solvers.DiscontinuousGalerkinDiscretisation.AssemblePetscMatrix.d, DGCGCoupling.Test4Coupling.d, DGCGCoupling.Test5Coupling.d, DGCGCoupling.Test7Coupling.d, initCollocatedRandom.InitDofsCollocatedRandomRhs.d, initCollocatedRandom.InitCollocatedTest4.d, initCollocatedRandom.InitCollocatedTest5.d, InitDG.InitDofsDGTest1.d, InitDG.InitDofsIntermediatePhaseTest1.d, InitDG.InitDofsDGTest7.d, and test8.InitDofsTest8.d.

Here is the call graph for this function:

Field Documentation

◆ __Template_ReassignAndLiftWithinCell

peano4.toolbox.particles.api.UpdateParticleGridAssociation_Reassign.UpdateParticleGridAssociation_Reassign.__Template_ReassignAndLiftWithinCell
staticprivate

◆ _drop_into_hanging_vertices

peano4.toolbox.particles.api.UpdateParticleGridAssociation_Reassign.UpdateParticleGridAssociation_Reassign._drop_into_hanging_vertices
protected

◆ _Template_Sieve


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