|
chombo-discharge
|
Templated class for holding particles on an AMR hierarchy with particle remapping. More...
#include <CD_ParticleContainer.H>

Public Types | |
| using | ValidMask = RefCountedPtr< LevelData< BaseFab< bool > > > |
| alias type alias. | |
Public Member Functions | |
| ParticleContainer () | |
| Default constructor. Leaves object in undefined state. | |
| ParticleContainer (const Vector< DisjointBoxLayout > &a_grids, const Vector< ProblemDomain > &a_domains, const Vector< Real > &a_dx, const Vector< int > &a_refRat, const Vector< ValidMask > &a_validMask, const Vector< RefCountedPtr< LevelTiles > > &a_levelTiles, const RealVect &a_probLo, int a_blockingFactor, int a_finestLevel, std::string a_realm) | |
| Full constructor. | |
| virtual | ~ParticleContainer () |
| Destructor ( does nothing) | |
| ParticleContainer (const ParticleContainer &)=delete | |
| ParticleContainer & | operator= (const ParticleContainer &)=delete |
| ParticleContainer (ParticleContainer &&)=default | |
| Move constructor. | |
| ParticleContainer & | operator= (ParticleContainer &&)=default |
| Move assignment operator. | |
| void | define (const Vector< DisjointBoxLayout > &a_grids, const Vector< ProblemDomain > &a_domains, const Vector< Real > &a_dx, const Vector< int > &a_refRat, const Vector< ValidMask > &a_validMask, const Vector< RefCountedPtr< LevelTiles > > &a_levelTiles, const RealVect &a_probLo, int a_blockingFactor, int a_finestLevel, const std::string &a_realm) |
| Define the container. This will do a clear-out of all particles. | |
| void | regrid (const Vector< DisjointBoxLayout > &a_grids, const Vector< ProblemDomain > &a_domains, const Vector< Real > &a_dx, const Vector< int > &a_refRat, const Vector< ValidMask > &a_validMask, const Vector< RefCountedPtr< LevelTiles > > &a_levelTiles, int a_base, int a_newFinestLevel) |
| Regrid function. a_base is the coarsest grid level which did not change. | |
| void | preRegrid (int a_lmin) |
| Cache particles before calling regrid. | |
| void | resetParticleIDs () noexcept |
| Compute new particle IDs. | |
| void | copyMaskParticles (const Vector< RefCountedPtr< LevelData< BaseFab< bool > > > > &a_mask) const |
| Copy particles to mask particle data holder. | |
| void | copyMaskParticles (int a_level, const LevelData< BaseFab< bool > > &a_mask) const |
| Copy particles to masked particle data holder. | |
| void | transferMaskParticles (const Vector< RefCountedPtr< LevelData< BaseFab< bool > > > > &a_mask) |
| Copy particles to the mask particle data holder. | |
| void | transferMaskParticles (int a_level, const LevelData< BaseFab< bool > > &a_mask) |
| Copy particles to masked particle data holder. | |
| void | sortParticles () noexcept |
| Sort particles according to the < operator in the particle. | |
| void | clearParticles () |
| Clear all particles. | |
| void | clearBufferParticles () const |
| Clear the buffer particles. | |
| void | clearMaskParticles () const |
| Clear the "mask" particles. | |
| void | clearOutcast () noexcept |
| Clear outcast particles. | |
| void | clear (AMRParticles< P > &a_particles) const |
| Clear particles on input data holder. | |
| bool | isOrganizedByCell () const |
| Is cell-sorted or not. | |
| int | getFinestLevel () const |
| Get finest AMR level. | |
| std::string | getRealm () const |
| Get the realm where this ParticleContainer lives. | |
| AMRParticles< P > & | getParticles () |
| Get all particles on all levels. | |
| const AMRParticles< P > & | getParticles () const |
| Get all particles on a level. Const version. | |
| AMRParticles< P > & | getBufferParticles () |
| Get buffer particles on all levels. | |
| const AMRParticles< P > & | getBufferParticles () const |
| Get buffer particles on all levels. Const version. | |
| AMRParticles< P > & | getMaskParticles () |
| Get the mask particles. | |
| const AMRParticles< P > & | getMaskParticles () const |
| Get the mask particles. Const version. | |
| const Vector< DisjointBoxLayout > & | getGrids () const |
| Get the AMR grids. | |
| RealVect | getProbLo () const noexcept |
| Get lower-left corner. | |
| Vector< RealVect > | getDx () const noexcept |
| Get grid resolutions. | |
| ParticleData< P > & | operator[] (int a_lvl) |
| Get particle data on a level. | |
| const ParticleData< P > & | operator[] (int a_level) const |
| Get data on a level. Const version. | |
| AMRCellParticles< P > & | getCellParticles () |
| Get all cell particles. | |
| const AMRCellParticles< P > & | getCellParticles () const |
| Get cell particles, const version. | |
| LayoutData< BinFab< P > > & | getCellParticles (int a_level) |
| Get cell particles. | |
| const LayoutData< BinFab< P > > & | getCellParticles (int a_level) const |
| Get cell particles, const version. | |
| BinFab< P > & | getCellParticles (int a_level, const DataIndex &a_dit) |
| Get cell particles on a specific level and grid inex. | |
| const BinFab< P > & | getCellParticles (int a_level, const DataIndex &a_dit) const |
| Get cell particles, const version. | |
| void | getCellParticles (BinFab< P > &a_cellParticles, int a_lvl, const DataIndex &a_dit) const |
| Fill a cell-sorted particle data holder with all the particles in the grid patch. | |
| void | getCellParticlesDestructive (BinFab< P > &a_cellParticles, int a_lvl, const DataIndex &a_dit) |
| Fill a cell-sorted particle data holder with all the particles in the grid patch. The original particles are destroyed. | |
| void | organizeParticlesByCell () |
| Sort particles by cell. | |
| void | organizeParticlesByPatch () |
| Sort particles by cell. | |
| void | addParticles (const List< P > &a_particles) |
| Add particles to container. | |
| void | addParticlesDestructive (List< P > &a_particles) |
| Add particles to container. The input particles are destroyed by this routine. | |
| void | addParticles (const BinFab< P > &a_particles, int a_lvl, const DataIndex &a_dit) |
| Add particles to a certain level and patch. The input particles are cell-sorted. | |
| void | addParticlesDestructive (BinFab< P > &a_particles, int a_lvl, const DataIndex &a_dit) |
| Add particles to a certain level and patch. The input particles are cell-sorted (and destroyed on output). | |
| void | addParticles (const ParticleContainer< P > &a_otherContainer) |
| Add particles from other container to this one. | |
| void | addParticlesDestructive (ParticleContainer< P > &a_otherContainer) |
| Add particles from other container to this one. This destroys the particles in the other container. | |
| void | sanityCheck () const noexcept |
| Run a sanity check and make sure all particles are in their correctly assigned box. | |
| void | remap () |
| Remap over the entire AMR hierarchy. | |
| void | transferParticles (ParticleContainer< P > &a_otherContainer) |
| Move particles into this container. | |
| void | transferParticles (AMRParticles< P > &a_otherContainer) |
| Move particles into this container. | |
| void | admitValidParticles (List< P > &a_evictedParticles, ParticleData< P > &a_particles, int a_coarseLevel) |
| Evict particles if they move out of the valid region. | |
| template<Real &(P::*)() particleScalarField> | |
| void | setValue (Real a_value) |
| Set the particle member to the input value. | |
| template<RealVect &(P::*)() particleVectorField> | |
| void | setValue (const RealVect &a_value) |
| Set the particle member to the input value. | |
| unsigned long long | getNumberOfValidParticlesLocal () const |
| Get local number of particles. | |
| unsigned long long | getNumberOfValidParticlesGlobal () const |
| Get global number of particles. | |
| unsigned long long | getNumberOfOutcastParticlesLocal () const |
| Get local number of particles. | |
| unsigned long long | getNumberOfOutcastParticlesGlobal () const |
| Get global number of particles. | |
| unsigned long long | getNumberOfMaskParticlesLocal () const |
| Get the number particles in the halo cells. | |
| unsigned long long | getNumberOfMaskParticlesGlobal () const |
| Get the number particles in the halo cells. | |
Protected Attributes | |
| std::string | m_realm |
| Realm on which the ParticleContainer is defined. | |
| int | m_blockingFactor |
| Blocking factor, aka grid size. | |
| int | m_finestLevel |
| Finest grid level. | |
| RealVect | m_probLo |
| Lower left corner of the physical domain. | |
| bool | m_isDefined = false |
| Check if particle container is defined. | |
| bool | m_isOrganizedByCell = false |
| Check if particle container is "cell sorted". | |
| bool | m_profile = false |
| Profile or not. | |
| bool | m_debug = false |
| Debug or not. | |
| bool | m_verbose = false |
| Verbose or not. | |
| Vector< RefCountedPtr< LevelTiles > > | m_levelTiles |
| Tiled AMR space. | |
| Vector< DisjointBoxLayout > | m_grids |
| AMR grids. | |
| Vector< DisjointBoxLayout > | m_oldGrids |
| Old AMR grids. Used during regrids. | |
| Vector< ProblemDomain > | m_domains |
| Problem domains. | |
| Vector< RefCountedPtr< LevelData< BaseFab< bool > > > > | m_validRegion |
| Map of valid cells; evaluates to false if a cell is covered by a finer grid. | |
| Vector< BoxLayout > | m_grownGrids |
| Grown layouts. | |
| Vector< RealVect > | m_dx |
| Resolutions on each grid level. | |
| Vector< int > | m_refRat |
| Refinement ratios. Entry at index 'l' is the refinement between level 'l' and level 'l+1'. | |
| AMRParticles< P > | m_particles |
| The actual particles that this ParticleContainer represents. | |
| AMRParticles< P > | m_bufferParticles |
| Special data holder that holds particles on a grown grid layout. | |
| AMRParticles< P > | m_maskParticles |
| Special data holder that holds copies of particles on the coarse level that are within a specified range of the refinement boundary. Used for deposition of coarse-level particle clouds across refinement boundaries. | |
| AMRParticles< P > | m_cacheParticles |
| Particles stored on the old grid. | |
| AMRCellParticles< P > | m_cellSortedParticles |
| Cell particles. | |
Templated class for holding particles on an AMR hierarchy with particle remapping.
The template parameter P should derive from Chombo's BinItem.
| ParticleContainer< P >::ParticleContainer | ( | const Vector< DisjointBoxLayout > & | a_grids, |
| const Vector< ProblemDomain > & | a_domains, | ||
| const Vector< Real > & | a_dx, | ||
| const Vector< int > & | a_refRat, | ||
| const Vector< ValidMask > & | a_validMask, | ||
| const Vector< RefCountedPtr< LevelTiles > > & | a_levelTiles, | ||
| const RealVect & | a_probLo, | ||
| int | a_blockingFactor, | ||
| int | a_finestLevel, | ||
| std::string | a_realm | ||
| ) |
Full constructor.
| [in] | a_grids | AMR grids |
| [in] | a_domains | AMR domains |
| [in] | a_dx | Grid resolutions |
| [in] | a_refRat | Refinement ratios |
| [in] | a_validMask | Valid cells (false for cells covered by a finer grid) |
| [in] | a_levelTiles | Tiled AMR grids |
| [in] | a_probLo | Lower-left corner of the physical domain |
| [in] | a_blockingFactor | Grid blocking factor |
| [in] | a_finestLevel | Finest grid level |
| [in] | a_realm | Realm where these particles live. |
| void ParticleContainer< P >::addParticles | ( | const BinFab< P > & | a_particles, |
| int | a_lvl, | ||
| const DataIndex & | a_dit | ||
| ) |
Add particles to a certain level and patch. The input particles are cell-sorted.
| [in] | a_particles | Input particles (cell-sorted) |
| [in] | a_lvl | Grid level |
| [in] | a_dit | Grid index |
Add particles to container.
| [in] | a_particles | particles to add to this container. |
| void ParticleContainer< P >::addParticles | ( | const ParticleContainer< P > & | a_otherContainer | ) |
Add particles from other container to this one.
| [in] | a_otherContainer | Other particle container. |
| void ParticleContainer< P >::addParticlesDestructive | ( | BinFab< P > & | a_particles, |
| int | a_lvl, | ||
| const DataIndex & | a_dit | ||
| ) |
Add particles to a certain level and patch. The input particles are cell-sorted (and destroyed on output).
| [in,out] | a_particles | Input particles (cell-sorted). Destroyed on exit. |
| [in] | a_lvl | Grid level |
| [in] | a_dit | Grid index |
Add particles to container. The input particles are destroyed by this routine.
| [in] | a_particles | particles to add to this container. . |
| void ParticleContainer< P >::addParticlesDestructive | ( | ParticleContainer< P > & | a_otherContainer | ) |
Add particles from other container to this one. This destroys the particles in the other container.
| [in,out] | a_otherContainer | Other particle container (destroyed on output). |
| void ParticleContainer< P >::admitValidParticles | ( | List< P > & | a_evictedParticles, |
| ParticleData< P > & | a_particles, | ||
| int | a_coarseLevel | ||
| ) |
Evict particles if they move out of the valid region.
| [in,out] | a_evictedParticles | List that the particles are moved into. |
| [in,out] | a_particles | Particles. |
| [in] | a_coarseLevel | Coarse level |
|
inlineprotectednoexcept |
Gather particles locally.
| [in,out] | a_mappedParticles | Particles that have been mapped to this rank. |
| [in,out] | a_particleData | Where to assign the mapped particles |
|
inlineprotectednoexcept |
Catenate the particles. This is usually called within OpenMP parallel regions.
| [in,out] | a_globalParticles | Global particle map |
| [in,out] | a_localParticles | Local particle map |
| void ParticleContainer< P >::clear | ( | AMRParticles< P > & | a_particles | ) | const |
Clear particles on input data holder.
| [in,out] | a_particles |
| void ParticleContainer< P >::copyMaskParticles | ( | const Vector< RefCountedPtr< LevelData< BaseFab< bool > > > > & | a_mask | ) | const |
Copy particles to mask particle data holder.
| [in] | a_mask | Mask |
| void ParticleContainer< P >::copyMaskParticles | ( | int | a_level, |
| const LevelData< BaseFab< bool > > & | a_mask | ||
| ) | const |
Copy particles to masked particle data holder.
| [in] | a_level | Grid level |
| [in] | a_mask | Mask |
|
inlineprotectednoexcept |
Copy the input particles onto a single list.
| [in,out] | a_list | List containing all the particles in a_particles |
| [in,out] | a_particles | Particles to transfer to list |
| void ParticleContainer< P >::define | ( | const Vector< DisjointBoxLayout > & | a_grids, |
| const Vector< ProblemDomain > & | a_domains, | ||
| const Vector< Real > & | a_dx, | ||
| const Vector< int > & | a_refRat, | ||
| const Vector< ValidMask > & | a_validMask, | ||
| const Vector< RefCountedPtr< LevelTiles > > & | a_levelTiles, | ||
| const RealVect & | a_probLo, | ||
| int | a_blockingFactor, | ||
| int | a_finestLevel, | ||
| const std::string & | a_realm | ||
| ) |
Define the container. This will do a clear-out of all particles.
| [in] | a_grids | AMR grids |
| [in] | a_domains | AMR domains |
| [in] | a_dx | Grid resolutions |
| [in] | a_refRat | Refinement ratios |
| [in] | a_validMask | Valid cells (false for cells covered by a finer grid) |
| [in] | a_levelTiles | Tiled AMR grids |
| [in] | a_probLo | Lower-left corner of the physical domain |
| [in] | a_blockingFactor | Grid blocking factor |
| [in] | a_finestLevel | Finest grid level |
| [in] | a_realm | Realm where these particles live. |
| AMRParticles< P > & ParticleContainer< P >::getBufferParticles | ( | ) |
Get buffer particles on all levels.
| const AMRParticles< P > & ParticleContainer< P >::getBufferParticles | ( | ) | const |
Get buffer particles on all levels. Const version.
| AMRCellParticles< P > & ParticleContainer< P >::getCellParticles | ( | ) |
Get all cell particles.
| const AMRCellParticles< P > & ParticleContainer< P >::getCellParticles | ( | ) | const |
Get cell particles, const version.
| void ParticleContainer< P >::getCellParticles | ( | BinFab< P > & | a_cellParticles, |
| int | a_lvl, | ||
| const DataIndex & | a_dit | ||
| ) | const |
Fill a cell-sorted particle data holder with all the particles in the grid patch.
| [out] | a_cellParticles | Particles in the input grid patch, sorted by cell. |
| [in] | a_dit | Grid index |
| [in] | a_lvl | Lvl |
| LayoutData< BinFab< P > > & ParticleContainer< P >::getCellParticles | ( | int | a_level | ) |
Get cell particles.
| [in] | a_level | Grid level |
| const LayoutData< BinFab< P > > & ParticleContainer< P >::getCellParticles | ( | int | a_level | ) | const |
Get cell particles, const version.
| [in] | a_level | Grid level |
Get cell particles on a specific level and grid inex.
| [in] | a_level | Grid level |
| [in] | a_dit | Grid index |
| const BinFab< P > & ParticleContainer< P >::getCellParticles | ( | int | a_level, |
| const DataIndex & | a_dit | ||
| ) | const |
Get cell particles, const version.
| [in] | a_level | Grid level |
| [in] | a_dit | Grid index |
| void ParticleContainer< P >::getCellParticlesDestructive | ( | BinFab< P > & | a_cellParticles, |
| int | a_lvl, | ||
| const DataIndex & | a_dit | ||
| ) |
Fill a cell-sorted particle data holder with all the particles in the grid patch. The original particles are destroyed.
| [out] | a_cellParticles | Particles in the input grid patch, sorted by cell. |
| [in] | a_dit | Grid index |
| [in] | a_lvl | Lvl |
Get grid resolutions.
| int ParticleContainer< P >::getFinestLevel | ( | ) | const |
Get finest AMR level.
| const Vector< DisjointBoxLayout > & ParticleContainer< P >::getGrids | ( | ) | const |
Get the AMR grids.
| AMRParticles< P > & ParticleContainer< P >::getMaskParticles | ( | ) |
Get the mask particles.
| const AMRParticles< P > & ParticleContainer< P >::getMaskParticles | ( | ) | const |
Get the mask particles. Const version.
| unsigned long long ParticleContainer< P >::getNumberOfMaskParticlesGlobal | ( | ) | const |
Get the number particles in the halo cells.
| unsigned long long ParticleContainer< P >::getNumberOfMaskParticlesLocal | ( | ) | const |
Get the number particles in the halo cells.
| unsigned long long ParticleContainer< P >::getNumberOfOutcastParticlesGlobal | ( | ) | const |
Get global number of particles.
| unsigned long long ParticleContainer< P >::getNumberOfOutcastParticlesLocal | ( | ) | const |
Get local number of particles.
| unsigned long long ParticleContainer< P >::getNumberOfValidParticlesGlobal | ( | ) | const |
Get global number of particles.
| unsigned long long ParticleContainer< P >::getNumberOfValidParticlesLocal | ( | ) | const |
Get local number of particles.
| AMRParticles< P > & ParticleContainer< P >::getParticles | ( | ) |
Get all particles on all levels.
| const AMRParticles< P > & ParticleContainer< P >::getParticles | ( | ) | const |
Get all particles on a level. Const version.
|
noexcept |
Get lower-left corner.
| std::string ParticleContainer< P >::getRealm | ( | ) | const |
Get the realm where this ParticleContainer lives.
| bool ParticleContainer< P >::isOrganizedByCell | ( | ) | const |
Is cell-sorted or not.
|
inlineprotectednoexcept |
Iterate through the unmapped particles and map them to proper level, grid indices, and grid ranks.
| [in,out] | a_mappedParticles | Particles mapped according to rank ownership (vector index) and grid level and index (std::pair) |
| [in,out] | a_unmappedParticles | Particles that are not mapped (yet) |
|
default |
Move assignment operator.
| const ParticleData< P > & ParticleContainer< P >::operator[] | ( | int | a_level | ) | const |
Get data on a level. Const version.
| [in] | a_level | AMR level |
| ParticleData< P > & ParticleContainer< P >::operator[] | ( | int | a_lvl | ) |
Get particle data on a level.
| [in] | a_lvl | AMR level |
| void ParticleContainer< P >::organizeParticlesByCell | ( | ) |
Sort particles by cell.
This will fill m_cellSortedParticles and destroy the patch-sorted particles.
| void ParticleContainer< P >::organizeParticlesByPatch | ( | ) |
Sort particles by cell.
This will fill m_particles from m_cellSortedParticles and destroy the cell-sorted particles.
Cache particles before calling regrid.
| [in] | a_lmin | Coarsest grid level which will not change. |
| void ParticleContainer< P >::regrid | ( | const Vector< DisjointBoxLayout > & | a_grids, |
| const Vector< ProblemDomain > & | a_domains, | ||
| const Vector< Real > & | a_dx, | ||
| const Vector< int > & | a_refRat, | ||
| const Vector< ValidMask > & | a_validMask, | ||
| const Vector< RefCountedPtr< LevelTiles > > & | a_levelTiles, | ||
| int | a_base, | ||
| int | a_newFinestLevel | ||
| ) |
Regrid function. a_base is the coarsest grid level which did not change.
| [in] | a_grids | AMR grids |
| [in] | a_domains | AMR domains |
| [in] | a_dx | Grid resolutions |
| [in] | a_refRat | Refinement ratios |
| [in] | a_validMask | Valid cells |
| [in] | a_levelTiles | Tiled AMR grids |
| [in] | a_base | Coarsest grid level that did not change. |
| [in] | a_newFinestLevel | New finest grid level |
|
protected |
Set up grown grids.
| [in] | a_base | Base level |
| [in] | a_finestLevel | Finest AMR level |
|
protected |
Setup function for the particle data (m_particles and m_maskParticles)
| [in] | a_base | Base level |
| [in] | a_finestLevel | Finest AMR level |
|
inline |
Set the particle member to the input value.
This is a jack-of-all-trades kind of routine for setting a particle field. The template parameter indicates the field to be set, it must be a pointer-to-member-function that returns the field to be set. For example, if the particle class P has a field vector which one wants to set, and this field is returned by a function RealVect& P::velocity(), one can set the quantity for all particles by calling ParticleContainer<P>::setValue<&P::velocity>(RealVect);
| [in] | a_value | Value |
|
inline |
Set the particle member to the input value.
This is a jack-of-all-trades kind of routine for setting a particle field. The template parameter indicates the field to be set, it must be a pointer-to-member-function that returns the field to be set. For example, if the particle class P has a field mass which one wants to set, and this field is returned by a function Real& P::mass(), one can set the quantity for all particles by calling ParticleContainer<P>::setValue<&P::mass>(Real)
| [in] | a_value | Value |
| void ParticleContainer< P >::transferMaskParticles | ( | const Vector< RefCountedPtr< LevelData< BaseFab< bool > > > > & | a_mask | ) |
Copy particles to the mask particle data holder.
| [in] | a_mask | Mask |
| void ParticleContainer< P >::transferMaskParticles | ( | int | a_level, |
| const LevelData< BaseFab< bool > > & | a_mask | ||
| ) |
Copy particles to masked particle data holder.
| [in] | a_level | Grid level |
| [in] | a_mask | Mask |
| void ParticleContainer< P >::transferParticles | ( | AMRParticles< P > & | a_otherContainer | ) |
Move particles into this container.
| [in,out] | a_otherContainer | Other particle container. |
| void ParticleContainer< P >::transferParticles | ( | ParticleContainer< P > & | a_otherContainer | ) |
Move particles into this container.
| [in,out] | a_otherContainer | Other particle container. |
|
inlineprotectednoexcept |
Gather the particles onto a single list.
| [in,out] | a_list | List containing all the particles in a_particles |
| [in,out] | a_particles | Particles to transfer to list |
|
mutableprotected |
Special data holder that holds particles on a grown grid layout.
This particle data holder uses grids that exceed the DisjointBoxLayout on each level (boxes are grown by m_refRat). This means that this particle data holder can store particles that are out the DisjointBoxLayout by m_refRat cells. This is very useful when one wants to deposit particles on the fine level, but where the particles live on the coarse level. In such cases one will typically copy some (or all) particles from the coarse level to this data holder and deposit from this data holder onto the fine level.
|
protected |
Particles stored on the old grid.
Populated during the preRegrid call.