OpenLB 1.8.1
Loading...
Searching...
No Matches
olb::particles::creators Namespace Reference

Classes

struct  SpawnData
 

Functions

template<typename T , typename PARTICLETYPE >
std::set< int > prepareParallelResolvedParticle (SuperParticleSystem< T, PARTICLETYPE > &sParticleSystem, Vector< T, PARTICLETYPE::d > position, T circumRadius, const T epsilon, int &globiCcentre, const T physDeltaX, const Vector< bool, PARTICLETYPE::d > &periodicity)
 
template<typename T , typename PARTICLETYPE >
Particle< T, PARTICLETYPE > assignParallelResolvedParticleToiC (ParticleSystem< T, PARTICLETYPE > &particleSystem, std::size_t idxSurface, std::size_t globID, int globiCcentre, const Vector< T, PARTICLETYPE::d > &position, T density=0., const Vector< T, utilities::dimensions::convert< PARTICLETYPE::d >::rotation > &angleInDegree=Vector< T, utilities::dimensions::convert< PARTICLETYPE::d >::rotation >(0.), const Vector< T, PARTICLETYPE::d > &velocity=Vector< T, PARTICLETYPE::d >(0.))
 
template<typename T , typename PARTICLETYPE >
bool assignParallelResolvedParticle (ParticleSystem< T, PARTICLETYPE > &particleSystem, std::set< int > &setOfICs, int globiC, std::size_t idxSurface, std::size_t globID, std::size_t &localID, int globiCcentre, const Vector< T, PARTICLETYPE::d > &position, T density=0., const Vector< T, utilities::dimensions::convert< PARTICLETYPE::d >::rotation > &angleInDegree=Vector< T, utilities::dimensions::convert< PARTICLETYPE::d >::rotation >(0.), const Vector< T, PARTICLETYPE::d > &velocity=Vector< T, PARTICLETYPE::d >(0.))
 
template<typename T , typename PARTICLETYPE >
ParallelParticleLocator addResolvedObject (SuperParticleSystem< T, PARTICLETYPE > &sParticleSystem, std::size_t idxSurface, const Vector< T, PARTICLETYPE::d > &position, T density=0., const Vector< T, utilities::dimensions::convert< PARTICLETYPE::d >::rotation > &angleInDegree=Vector< T, utilities::dimensions::convert< PARTICLETYPE::d >::rotation >(0.), const Vector< T, PARTICLETYPE::d > &velocity=Vector< T, PARTICLETYPE::d >(0.), const Vector< bool, PARTICLETYPE::d > &periodicity=Vector< T, PARTICLETYPE::d >(false))
 
template<typename T , typename PARTICLETYPE , typename F >
std::size_t addSurface (SuperParticleSystem< T, PARTICLETYPE > &sParticleSystem, F createUniqueIndicatorPtr)
 Adds surface (SmoothIndicator) to all block particle systems.
 
template<typename T , typename PARTICLETYPE >
ParallelParticleLocator addResolvedSphere3D (SuperParticleSystem< T, PARTICLETYPE > &sParticleSystem, const Vector< T, 3 > &position, T radius, T epsilon, T density=0., const Vector< T, 3 > &velocity=Vector< T, 3 >(0.), const Vector< bool, 3 > &periodicity=Vector< bool, 3 >(false))
 
template<typename T , typename PARTICLETYPE >
ParallelParticleLocator addResolvedCuboid3D (SuperParticleSystem< T, PARTICLETYPE > &sParticleSystem, const Vector< T, 3 > &position, const Vector< T, 3 > &extend, T epsilon, T density=0., const Vector< T, 3 > &angleInDegree=Vector< T, 3 >(0.), const Vector< T, 3 > &velocity=Vector< T, 3 >(0.), const Vector< bool, 3 > &periodicity=Vector< bool, 3 >(false))
 
template<typename T , typename PARTICLETYPE >
ParallelParticleLocator addResolvedCylinder3D (SuperParticleSystem< T, PARTICLETYPE > &sParticleSystem, const Vector< T, 3 > &position, const Vector< T, 3 > &normal, T height, T radius, T epsilon, T density=0., const Vector< T, 3 > &angleInDegree=Vector< T, 3 >(0.), const Vector< T, 3 > &velocity=Vector< T, 3 >(0.), const Vector< bool, 3 > &periodicity=Vector< bool, 3 >(false))
 
template<typename T , typename PARTICLETYPE >
ParallelParticleLocator addResolvedArbitraryShape3D (SuperParticleSystem< T, PARTICLETYPE > &sParticleSystem, const Vector< T, 3 > &position, T latticeSpacing, std::shared_ptr< IndicatorF3D< T > > indPtr, T epsilon, T density=0., const Vector< T, 3 > &angleInDegree=Vector< T, 3 >(0.), const Vector< T, 3 > &velocity=Vector< T, 3 >(0.), const Vector< bool, 3 > &periodicity=Vector< bool, 3 >(false))
 
template<typename T , typename PARTICLETYPE >
ParallelParticleLocator addResolvedCircle2D (SuperParticleSystem< T, PARTICLETYPE > &sParticleSystem, const Vector< T, 2 > &position, T radius, T epsilon, T density=0., const Vector< T, 2 > &velocity=Vector< T, 2 >(0.), const Vector< bool, 2 > &periodicity=Vector< bool, 2 >(false))
 
template<typename T , typename PARTICLETYPE >
ParallelParticleLocator addSubgridSphere3D (SuperParticleSystem< T, PARTICLETYPE > &sParticleSystem, const Vector< T, 3 > &position, T radius, T density=0., const Vector< T, 3 > &velocity=Vector< T, 3 >(0.))
 
template<typename T , typename PARTICLETYPE >
ParallelParticleLocator addSubgridSphereWithSpecies3D (SuperParticleSystem< T, PARTICLETYPE > &sParticleSystem, const Vector< T, 3 > &position, T radius, T density=0., const Vector< T, 3 > &velocity=Vector< T, 3 >(0.), const int species=0)
 
template<typename T , unsigned D>
calcParticleVolume (const std::vector< SpawnData< T, D > > &spawnData, const std::function< T(const std::size_t &)> &getParticleVolume)
 
template<typename T , unsigned D>
calcParticleVolumeFraction (const std::vector< SpawnData< T, D > > &spawnData, const T fluidVolume, const std::function< T(const std::size_t &)> &getParticleVolume)
 
template<typename T , unsigned D>
void extendSpawnData (std::vector< SpawnData< T, D > > &spawnData, const T wantedParticleVolumeFraction, IndicatorF< T, D > &fluidDomain, const T fluidDomainVolume, const std::function< T(const std::size_t &)> &getCircumRadius, const std::function< T(const std::size_t &)> &getParticleVolume)
 
template<typename T , unsigned D>
std::vector< SpawnData< T, D > > setParticles (const T wantedParticleVolumeFraction, IndicatorF< T, D > &fluidDomain, const T fluidDomainVolume, const std::function< T(const std::size_t &)> &getCircumRadius, const std::function< T(const std::size_t &)> &getParticleVolume, const std::function< void(const SpawnData< T, D > &, const std::size_t &)> createParticle)
 
std::vector< std::vector< std::string > > readParticlePositions (const std::string &filename)
 
template<typename T , unsigned D>
void saveParticlePositions (const std::string &filename, const std::vector< SpawnData< T, D > > &spawnData, const std::function< std::string(const std::size_t &)> &evalIdentifier)
 
template<typename T , unsigned D>
std::vector< SpawnData< T, D > > setParticles (const std::string &filename, const T wantedParticleVolumeFraction, IndicatorF< T, D > &fluidDomain, const T fluidDomainVolume, const std::function< T(const std::size_t &)> &getParticleVolume, const std::function< void(const SpawnData< T, D > &, const std::string &)> createParticle)
 
template<typename T , unsigned D>
void extendSpawnData (std::vector< SpawnData< T, D > > &spawnData, const T wantedParticleVolumeFraction, IndicatorF< T, D > &fluidDomain, const T fluidDomainVolume, const std::function< PhysR< T, D >(const std::size_t &, const PhysR< T, D > &)> &getMin, const std::function< PhysR< T, D >(const std::size_t &, const PhysR< T, D > &)> &getMax, const std::function< T(const std::size_t &)> &getParticleVolume)
 
template<typename T , unsigned D>
std::vector< SpawnData< T, D > > setParticles (const T wantedParticleVolumeFraction, IndicatorF< T, D > &fluidDomain, const T fluidDomainVolume, const std::function< PhysR< T, D >(const std::size_t &, const PhysR< T, D > &)> &getMin, const std::function< PhysR< T, D >(const std::size_t &, const PhysR< T, D > &)> &getMax, const std::function< T(const std::size_t &)> &getParticleVolume, const std::function< void(const SpawnData< T, D > &, const std::size_t &)> createParticle)
 
template<typename T , unsigned D>
void extendSpawnData (std::vector< SpawnData< T, D > > &spawnData, const T wantedParticleVolumeFraction, IndicatorF< T, D > &fluidDomain, const T fluidDomainVolume, const T deltaX, const T contactDetectionDistance, const std::function< PhysR< T, D >(const std::size_t &, const PhysR< T, D > &)> &getMin, const std::function< PhysR< T, D >(const std::size_t &, const PhysR< T, D > &)> &getMax, const std::function< T(const std::size_t &, const SpawnData< T, D > &, const PhysR< T, D > &)> &signedDistanceToParticle, const std::function< T(const std::size_t &)> &getParticleVolume)
 
template<typename T , unsigned D>
std::vector< SpawnData< T, D > > setParticles (const T wantedParticleVolumeFraction, IndicatorF< T, D > &fluidDomain, const T fluidDomainVolume, const T deltaX, const T contactDetectionDistance, const std::function< PhysR< T, D >(const std::size_t &, const PhysR< T, D > &)> &getMin, const std::function< PhysR< T, D >(const std::size_t &, const PhysR< T, D > &)> &getMax, const std::function< T(const std::size_t &, const SpawnData< T, D > &, const PhysR< T, D > &)> &signedDistanceToParticle, const std::function< T(const std::size_t &)> &getParticleVolume, const std::function< void(const SpawnData< T, D > &, const std::size_t &)> createParticle)
 
template<typename T , typename PARTICLETYPE >
std::vector< SpawnData< T, PARTICLETYPE::d > > updateParticlePositions (std::vector< SpawnData< T, PARTICLETYPE::d > > spawnData, XParticleSystem< T, PARTICLETYPE > &particleSystem, MPI_Comm particleCreatorComm=MPI_COMM_WORLD)
 Updates particle positions so that they can be easily written to a txt file with the function above.
 
template<typename T , typename PARTICLETYPE >
std::vector< SpawnData< T, PARTICLETYPE::d > > saveUpdatedParticlePositions (const std::string &filename, const std::vector< SpawnData< T, PARTICLETYPE::d > > &originalSpawnData, const std::function< std::string(const std::size_t &)> &evalIdentifier, XParticleSystem< T, PARTICLETYPE > &particleSystem, MPI_Comm particleCreatorComm=MPI_COMM_WORLD)
 
template<typename T , typename PARTICLETYPE , bool ROTATION_IS_OPTIONAL = false>
void setResolvedObject (ParticleSystem< T, PARTICLETYPE > &particleSystem, std::size_t idxParticle, std::size_t idxSurface, const Vector< T, 2 > &position, T density, T angle, const Vector< T, 2 > &velocity)
 
template<typename T , typename PARTICLETYPE >
void addResolvedObject (ParticleSystem< T, PARTICLETYPE > &particleSystem, std::size_t idxSurface, const Vector< T, 2 > &position, T density=0., T angle=0., const Vector< T, 2 > &velocity=Vector< T, 2 >(0.))
 Add resolved object as new particle with existing surface.
 
template<typename T , typename PARTICLETYPE >
void setResolvedCircle2D (ParticleSystem< T, PARTICLETYPE > &particleSystem, std::size_t idxParticle, Vector< T, 2 > position, T radius, T epsilon, T density=0., Vector< T, 2 > velocity=Vector< T, 2 >(0.))
 Set resolved circle for existing particle but new surface.
 
template<typename T , typename PARTICLETYPE >
void addResolvedCircle2D (ParticleSystem< T, PARTICLETYPE > &particleSystem, Vector< T, 2 > position, T radius, T epsilon, T density=0., Vector< T, 2 > velocity=Vector< T, 2 >(0.))
 Add resolved circle as new particle with new surface.
 
template<typename T , typename PARTICLETYPE >
void setResolvedCuboid2D (ParticleSystem< T, PARTICLETYPE > &particleSystem, std::size_t idxParticle, Vector< T, 2 > position, Vector< T, 2 > extend, T epsilon, T density=0., T angle=0., Vector< T, 2 > velocity=Vector< T, 2 >(0.))
 Set resolved cuboid for existing particle but new surface.
 
template<typename T , typename PARTICLETYPE >
void addResolvedCuboid2D (ParticleSystem< T, PARTICLETYPE > &particleSystem, Vector< T, 2 > position, Vector< T, 2 > extend, T epsilon, T density=0., T angle=0., Vector< T, 2 > velocity=Vector< T, 2 >(0.))
 Add resolved cuboid as new particle with new surface.
 
template<typename T , typename PARTICLETYPE >
void setResolvedTriangle2D (ParticleSystem< T, PARTICLETYPE > &particleSystem, std::size_t idxParticle, Vector< T, 2 > position, T radius, T epsilon, T density=0., T angle=0., Vector< T, 2 > velocity=Vector< T, 2 >(0.))
 Set resolved cuboid for existing particle but new surface.
 
template<typename T , typename PARTICLETYPE >
void addResolvedTriangle2D (ParticleSystem< T, PARTICLETYPE > &particleSystem, Vector< T, 2 > position, T radius, T epsilon, T density=0., T angle=0., Vector< T, 2 > velocity=Vector< T, 2 >(0.))
 Add resolved triangle as new particle with new surface.
 
template<typename T , typename PARTICLETYPE >
void setResolvedArbitraryShape2D (ParticleSystem< T, PARTICLETYPE > &particleSystem, std::size_t idxParticle, Vector< T, 2 > position, T latticeSpacing, std::shared_ptr< IndicatorF2D< T > > indPtr, T epsilon, T density=0., T angle=0., Vector< T, 2 > velocity=Vector< T, 2 >(0.))
 Set resolved cuboid for existing particle but new surface.
 
template<typename T , typename PARTICLETYPE >
void addResolvedArbitraryShape2D (ParticleSystem< T, PARTICLETYPE > &particleSystem, Vector< T, 2 > position, T latticeSpacing, std::shared_ptr< IndicatorF2D< T > > indPtr, T epsilon, T density=0., T angle=0., Vector< T, 2 > velocity=Vector< T, 2 >(0.))
 Add resolved arbitrary shape as new particle with new surface.
 
template<typename T , typename PARTICLETYPE , bool IGNORE_WARNINGS = false>
void setResolvedSphere3D (ParticleSystem< T, PARTICLETYPE > &particleSystem, std::size_t idxParticle, const Vector< T, 3 > &position, T radius, T epsilon, T density=0., const Vector< T, 3 > &velocity=Vector< T, 3 >(0.))
 Set resolved sphere for existing particle but new surface.
 
template<typename T , typename PARTICLETYPE , bool IGNORE_WARNINGS = false>
void addResolvedSphere3D (ParticleSystem< T, PARTICLETYPE > &particleSystem, const Vector< T, 3 > &position, T radius, T epsilon, T density=0., const Vector< T, 3 > &velocity=Vector< T, 3 >(0.))
 Add resolved sphere as new particle with new surface.
 
template<typename T , typename PARTICLETYPE >
void setResolvedCylinder3D (ParticleSystem< T, PARTICLETYPE > &particleSystem, std::size_t idxParticle, const Vector< T, 3 > &position, const Vector< T, 3 > &normal, T height, T radius, T epsilon, T density=0., const Vector< T, 3 > &angleInDegree=Vector< T, 3 >(0.), const Vector< T, 3 > &velocity=Vector< T, 3 >(0.))
 Set resolved cylinder for existing particle but new surface.
 
template<typename T , typename PARTICLETYPE >
void addResolvedCylinder3D (ParticleSystem< T, PARTICLETYPE > &particleSystem, const Vector< T, 3 > &position, const Vector< T, 3 > &normal, T height, T radius, T epsilon, T density=0., const Vector< T, 3 > &angleInDegree=Vector< T, 3 >(0.), const Vector< T, 3 > &velocity=Vector< T, 3 >(0.))
 Add resolved cylinder as new particle with new surface.
 
template<typename T , typename PARTICLETYPE >
void setResolvedCuboid3D (ParticleSystem< T, PARTICLETYPE > &particleSystem, std::size_t idxParticle, const Vector< T, 3 > &position, const Vector< T, 3 > &extend, T epsilon, T density=0., const Vector< T, 3 > &angleInDegree=Vector< T, 3 >(0.), const Vector< T, 3 > &velocity=Vector< T, 3 >(0.))
 Set resolved cuboid for existing particle but new surface.
 
template<typename T , typename PARTICLETYPE >
void addResolvedCuboid3D (ParticleSystem< T, PARTICLETYPE > &particleSystem, const Vector< T, 3 > &position, const Vector< T, 3 > &extend, T epsilon, T density=0., const Vector< T, 3 > &angleInDegree=Vector< T, 3 >(0.), const Vector< T, 3 > &velocity=Vector< T, 3 >(0.))
 Add resolved cuboid as new particle with new surface.
 
template<typename T , typename PARTICLETYPE >
void setResolvedCone3D (ParticleSystem< T, PARTICLETYPE > &particleSystem, std::size_t idxParticle, const Vector< T, 3 > &position1, const Vector< T, 3 > &position2, T radius1, T radius2, T epsilon, T density=0, const Vector< T, 3 > &angleInDegree=Vector< T, 3 >(0.), const Vector< T, 3 > &velocity=Vector< T, 3 >(0.))
 Set resolved cone for existing particle but new surface.
 
template<typename T , typename PARTICLETYPE >
void addResolvedCone3D (ParticleSystem< T, PARTICLETYPE > &particleSystem, const Vector< T, 3 > &position1, const Vector< T, 3 > &position2, T radius1, T radius2, T epsilon, T density=0, const Vector< T, 3 > &angleInDegree=Vector< T, 3 >(0.), const Vector< T, 3 > &velocity=Vector< T, 3 >(0.))
 Add resolved cone as new particle with new surface.
 
template<typename T , typename PARTICLETYPE >
void setResolvedEllipsoid3D (ParticleSystem< T, PARTICLETYPE > &particleSystem, std::size_t idxParticle, const Vector< T, 3 > &position, const Vector< T, 3 > &radius, T epsilon, T density=0., const Vector< T, 3 > &angleInDegree=Vector< T, 3 >(0.), const Vector< T, 3 > &velocity=Vector< T, 3 >(0.))
 Set resolved ellipsoid for existing particle but new surface.
 
template<typename T , typename PARTICLETYPE >
void addResolvedEllipsoid3D (ParticleSystem< T, PARTICLETYPE > &particleSystem, const Vector< T, 3 > &position, const Vector< T, 3 > &radius, T epsilon, T density=0., const Vector< T, 3 > &angleInDegree=Vector< T, 3 >(0.), const Vector< T, 3 > &velocity=Vector< T, 3 >(0.))
 Add resolved ellipsoid as new particle with new surface.
 
template<typename T , typename PARTICLETYPE >
void setResolvedArbitraryShape3D (ParticleSystem< T, PARTICLETYPE > &particleSystem, std::size_t idxParticle, Vector< T, 3 > position, T latticeSpacing, std::shared_ptr< IndicatorF3D< T > > indPtr, T epsilon, T density=0., Vector< T, 3 > angleInDegree=Vector< T, 3 >(0.), Vector< T, 3 > velocity=Vector< T, 3 >(0.))
 Set resolved cuboid for existing particle but new surface.
 
template<typename T , typename PARTICLETYPE >
void addResolvedArbitraryShape3D (ParticleSystem< T, PARTICLETYPE > &particleSystem, Vector< T, 3 > position, T latticeSpacing, std::shared_ptr< IndicatorF3D< T > > indPtr, T epsilon, T density=0., Vector< T, 3 > angleInDegree=Vector< T, 3 >(0.), Vector< T, 3 > velocity=Vector< T, 3 >(0.))
 Add resolved arbitrary shape as new particle with new surface.
 
template<typename T , typename PARTICLETYPE >
void addSubgridSphere3D (ParticleSystem< T, PARTICLETYPE > &particleSystem, const Vector< T, 3 > &position, T radius, T density=0., const Vector< T, 3 > &velocity=Vector< T, 3 >(0.))
 
template<typename T , typename PARTICLETYPE >
void setSubgridHaiderLevenspielObject (ParticleSystem< T, PARTICLETYPE > &particleSystem, std::size_t idxParticle, const Vector< T, PARTICLETYPE::d > &position, T radius, T sphericity, T mass, T density, const Vector< T, PARTICLETYPE::d > &velocity, T lengthP=1., T diameterP=1.)
 Set new particle.
 
template<typename T , typename PARTICLETYPE >
void addSubgridHaiderLevenspielObject (ParticleSystem< T, PARTICLETYPE > &particleSystem, const Vector< T, PARTICLETYPE::d > &position, T radius, T sphericity, T mass=0., T density=1., const Vector< T, PARTICLETYPE::d > &velocity=Vector< T, PARTICLETYPE::d >(0.), T lengthP=1., T diameterP=1.)
 Add subgrid object as new particle.
 
template<typename T , typename PARTICLETYPE >
void addSubgridHaiderLevenspiel3D (ParticleSystem< T, PARTICLETYPE > &particleSystem, const Vector< T, 3 > &position, T surface, T volume, T density=0., const Vector< T, 3 > &velocity=Vector< T, 3 >(0.), T lengthP=1., T diameterP=1.)
 
template<typename T , typename PARTICLETYPE >
void addSubgridHaiderLevenspiel3D (SuperParticleSystem< T, PARTICLETYPE > &sParticleSystem, const Vector< T, 3 > &position, T surface, T volume, T density=1., const Vector< T, 3 > &velocity=Vector< T, 3 >(0.), T lengthP=1., T diameterP=1.)
 
template<typename T , typename PARTICLETYPE >
void setSubgridTranCongObject (ParticleSystem< T, PARTICLETYPE > &particleSystem, std::size_t idxParticle, const Vector< T, PARTICLETYPE::d > &position, T radius, T c, T A_p, T dA_dnn, T mass, T density, const Vector< T, PARTICLETYPE::d > &velocity)
 Set new particle Tran Cong.
 
template<typename T , typename PARTICLETYPE >
void addSubgridTranCongObject (ParticleSystem< T, PARTICLETYPE > &particleSystem, const Vector< T, PARTICLETYPE::d > &position, T radius, T c, T A_p, T dA_dn, T mass=0., T density=1., const Vector< T, PARTICLETYPE::d > &velocity=Vector< T, PARTICLETYPE::d >(0.))
 
template<typename T , typename PARTICLETYPE >
void addSubgridTranCongFromCylinder3D (SuperParticleSystem< T, PARTICLETYPE > &sParticleSystem, const Vector< T, 3 > &position, T length, T diameter, T _angle=0., T density=1., const Vector< T, 3 > &velocity=Vector< T, 3 >(0.))
 
template<typename T , typename PARTICLETYPE >
void setSubgridEulerRotationSpheroid (ParticleSystem< T, PARTICLETYPE > &particleSystem, std::size_t idxParticle, const Vector< T, 3 > &position, T length, T diameter, T density=1., Vector< T, 4 > quaternion=Vector< T, 4 >(0., 0., 0., 1.), Vector< T, 3 > velocity=Vector< T, 3 >(0., 0., 0.), Vector< T, 3 > ang_velocity=Vector< T, 3 >(0., 0., 0.), int label=0)
 EULER ROTATION SPHEROIDS.
 
template<typename T , typename PARTICLETYPE >
void setSubgridEulerRotationSpheroid (ParticleSystem< T, PARTICLETYPE > &particleSystem, std::size_t idxParticle, const Vector< T, 3 > &position, T length, T diameter, T density=1., Vector< T, 3 > eul_ang=Vector< T, 3 >(0., 0., 0.), Vector< T, 3 > velocity=Vector< T, 3 >(0., 0., 0.), Vector< T, 3 > ang_velocity=Vector< T, 3 >(0., 0., 0.), int label=0)
 
template<typename T , typename PARTICLETYPE >
void addSubgridEulerRotationSpheroid (ParticleSystem< T, PARTICLETYPE > &ParticleSystem, const Vector< T, 3 > &position, T length, T diameter, T density=1., Vector< T, 4 > quaternion=Vector< T, 4 >(0., 0., 0., 1.), Vector< T, 3 > velocity=Vector< T, 3 >(0., 0., 0.), Vector< T, 3 > ang_velocity=Vector< T, 3 >(0., 0., 0.), int label=0)
 
template<typename T , typename PARTICLETYPE >
void addSubgridEulerRotationSpheroid (ParticleSystem< T, PARTICLETYPE > &ParticleSystem, const Vector< T, 3 > &position, T length, T diameter, T density=1., Vector< T, 3 > eul_ang=Vector< T, 3 >(0., 0., 0.), Vector< T, 3 > velocity=Vector< T, 3 >(0., 0., 0.), Vector< T, 3 > ang_velocity=Vector< T, 3 >(0., 0., 0.), int label=0)
 
template<typename T , typename PARTICLETYPE >
void addSubgridEulerRotationSpheroid3D (SuperParticleSystem< T, PARTICLETYPE > &sParticleSystem, const Vector< T, 3 > &position, T length, T diameter, T density=1., const Vector< T, 3 > velocity=Vector< T, 3 >(0.), const Vector< T, 3 > eul_ang=Vector< T, 3 >(0., 0., 0.), const Vector< T, 3 > ang_velocity=Vector< T, 3 >(0.), int label=0)
 
template<typename T , typename PARTICLETYPE >
void addSubgridEulerRotationSpheroid3D (SuperParticleSystem< T, PARTICLETYPE > &sParticleSystem, const Vector< T, 3 > &position, T length, T diameter, T density=1., const Vector< T, 3 > velocity=Vector< T, 3 >(0.), const Vector< T, 4 > eul_quat=Vector< T, 4 >(0., 0., 0., 1.), const Vector< T, 3 > ang_velocity=Vector< T, 3 >(0.), int label=0)
 
template<typename PARTICLETYPE , bool ROTATION_IS_OPTIONAL = false>
void checkForErrors ()
 
template<typename T , typename PARTICLETYPE , bool ROTATION_IS_OPTIONAL = false>
Particle< T, PARTICLETYPE > setResolvedObject (ParticleSystem< T, PARTICLETYPE > &particleSystem, std::size_t idxParticle, std::size_t idxSurface, const Vector< T, PARTICLETYPE::d > &position, T density, Vector< T, utilities::dimensions::convert< PARTICLETYPE::d >::rotation > angleInDegree, const Vector< T, PARTICLETYPE::d > &velocity)
 Set new particle for existing surface (and return particle object)
 
template<typename T , typename PARTICLETYPE >
Particle< T, PARTICLETYPE > addResolvedObject (ParticleSystem< T, PARTICLETYPE > &particleSystem, std::size_t idxSurface, const Vector< T, PARTICLETYPE::d > &position, T density=0., const Vector< T, utilities::dimensions::convert< PARTICLETYPE::d >::rotation > &angleInDegree=Vector< T, utilities::dimensions::convert< PARTICLETYPE::d >::rotation >(0.), const Vector< T, PARTICLETYPE::d > &velocity=Vector< T, PARTICLETYPE::d >(0.))
 Add resolved object as new particle with existing surface (and return particle object)
 
template<typename T , typename PARTICLETYPE >
Particle< T, PARTICLETYPE > setSubgridObject (ParticleSystem< T, PARTICLETYPE > &particleSystem, std::size_t idxParticle, const Vector< T, PARTICLETYPE::d > &position, T radius, T density, const Vector< T, PARTICLETYPE::d > &velocity, T shapeFactor=T{1})
 Set new particle (and return particle object)
 
template<typename T , typename PARTICLETYPE >
Particle< T, PARTICLETYPE > addSubgridObject (ParticleSystem< T, PARTICLETYPE > &particleSystem, const Vector< T, PARTICLETYPE::d > &position, T radius, T density=0., const Vector< T, PARTICLETYPE::d > &velocity=Vector< T, PARTICLETYPE::d >(0.))
 Add subgrid object as new particle (and return particle object)
 

Function Documentation

◆ addResolvedArbitraryShape2D()

template<typename T , typename PARTICLETYPE >
void olb::particles::creators::addResolvedArbitraryShape2D ( ParticleSystem< T, PARTICLETYPE > & particleSystem,
Vector< T, 2 > position,
T latticeSpacing,
std::shared_ptr< IndicatorF2D< T > > indPtr,
T epsilon,
T density = 0.,
T angle = 0.,
Vector< T, 2 > velocity = Vector<T,2> (0.) )

Add resolved arbitrary shape as new particle with new surface.

Set resolved arbitrary shape 2D at given index

Definition at line 252 of file particleCreatorFunctions2D.h.

258{
259 //Retrieve new index
260 std::size_t idxParticle = particleSystem.size();
261
262 //Initialize particle address
263 particleSystem.extend();
264
266 setResolvedArbitraryShape2D( particleSystem, idxParticle, position, latticeSpacing, indPtr,
267 epsilon, density, angle, velocity );
268}
constexpr std::size_t size()
Size of ParticleSystem.
void extend()
Extend particle system by one particle.
void setResolvedArbitraryShape2D(ParticleSystem< T, PARTICLETYPE > &particleSystem, std::size_t idxParticle, Vector< T, 2 > position, T latticeSpacing, std::shared_ptr< IndicatorF2D< T > > indPtr, T epsilon, T density=0., T angle=0., Vector< T, 2 > velocity=Vector< T, 2 >(0.))
Set resolved cuboid for existing particle but new surface.

References olb::particles::ParticleSystem< T, PARTICLETYPE >::extend(), setResolvedArbitraryShape2D(), and olb::particles::ParticleSystem< T, PARTICLETYPE >::size().

+ Here is the call graph for this function:

◆ addResolvedArbitraryShape3D() [1/2]

template<typename T , typename PARTICLETYPE >
void olb::particles::creators::addResolvedArbitraryShape3D ( ParticleSystem< T, PARTICLETYPE > & particleSystem,
Vector< T, 3 > position,
T latticeSpacing,
std::shared_ptr< IndicatorF3D< T > > indPtr,
T epsilon,
T density = 0.,
Vector< T, 3 > angleInDegree = Vector<T,3> (0.),
Vector< T, 3 > velocity = Vector<T,3> (0.) )

Add resolved arbitrary shape as new particle with new surface.

Set resolved arbitrary shape 3D at given index

Definition at line 337 of file particleCreatorFunctions3D.h.

344{
345 //Retrieve new index
346 std::size_t idxParticle = particleSystem.size();
347
348 //Initialize particle address
349 particleSystem.extend();
350
352 setResolvedArbitraryShape3D( particleSystem, idxParticle, position,
353 latticeSpacing, indPtr, epsilon, density, angleInDegree, velocity );
354}
void setResolvedArbitraryShape3D(ParticleSystem< T, PARTICLETYPE > &particleSystem, std::size_t idxParticle, Vector< T, 3 > position, T latticeSpacing, std::shared_ptr< IndicatorF3D< T > > indPtr, T epsilon, T density=0., Vector< T, 3 > angleInDegree=Vector< T, 3 >(0.), Vector< T, 3 > velocity=Vector< T, 3 >(0.))
Set resolved cuboid for existing particle but new surface.

References olb::particles::ParticleSystem< T, PARTICLETYPE >::extend(), setResolvedArbitraryShape3D(), and olb::particles::ParticleSystem< T, PARTICLETYPE >::size().

+ Here is the call graph for this function:

◆ addResolvedArbitraryShape3D() [2/2]

template<typename T , typename PARTICLETYPE >
ParallelParticleLocator olb::particles::creators::addResolvedArbitraryShape3D ( SuperParticleSystem< T, PARTICLETYPE > & sParticleSystem,
const Vector< T, 3 > & position,
T latticeSpacing,
std::shared_ptr< IndicatorF3D< T > > indPtr,
T epsilon,
T density = 0.,
const Vector< T, 3 > & angleInDegree = Vector<T,3> (0.),
const Vector< T, 3 > & velocity = Vector<T,3> (0.),
const Vector< bool, 3 > & periodicity = Vector<bool,3>(false) )

Definition at line 345 of file particleParallelCreatorFunctions3D.h.

353{
354 //Get circumRadius and set angleInDegree
355 T circumRadius = SmoothIndicatorCustom3D<T,T,true>(
356 latticeSpacing, indPtr, PhysR<T, 3>(T {}), epsilon, angleInDegree).getCircumRadius();
357
358 //Get new global particle id
359 std::size_t globID = sParticleSystem.getGlobID();
360
361 //Prepare particle and get list of touching iCs
362 int globiCcentre;
363 std::set<int> setOfICs = prepareParallelResolvedParticle(sParticleSystem,
364 position, circumRadius, epsilon, globiCcentre,
365 sParticleSystem.getSuperStructure().getCuboidDecomposition().getMotherCuboid().getDeltaR(),
366 periodicity);
367
368 std::size_t idxSurface = addSurface(sParticleSystem,
369 [&](){
370 return std::make_unique<SmoothIndicatorCustom3D<T, T, true>>(
371 latticeSpacing, indPtr, PhysR<T, 3>(T {}), epsilon, angleInDegree);
372 });
373
374 //Iterate over particle systems
375 std::size_t localIDcentre=0; //Return localID of particle inside particleSystem holding centre
376 communication::forSystemsInSuperParticleSystem( sParticleSystem,
377 [&](ParticleSystem<T,PARTICLETYPE>& particleSystem, int iC, int globiC){
378 //Do for all iCs
379
380 //Assigne resolved particle to iCs specified in setOfICs
381 std::size_t localID=0;
382 assignParallelResolvedParticle( particleSystem, setOfICs, globiC,
383 idxSurface, globID, localID, globiCcentre,
384 position, density, angleInDegree, velocity );
385 //Set localID if centre
386 if (globiC==globiCcentre){ localIDcentre=localID; }
387 });
388
389 return ParallelParticleLocator(globiCcentre, globID, localIDcentre);
390}
CuboidDecomposition< T, D > & getCuboidDecomposition()
Read and write access to cuboid geometry.
SuperStructure< T, PARTICLETYPE::d > & getSuperStructure()

References addSurface(), assignParallelResolvedParticle(), olb::particles::communication::forSystemsInSuperParticleSystem(), olb::SuperStructure< T, D >::getCuboidDecomposition(), olb::particles::SuperParticleSystem< T, PARTICLETYPE >::getGlobID(), olb::particles::SuperParticleSystem< T, PARTICLETYPE >::getSuperStructure(), and prepareParallelResolvedParticle().

+ Here is the call graph for this function:

◆ addResolvedCircle2D() [1/2]

template<typename T , typename PARTICLETYPE >
void olb::particles::creators::addResolvedCircle2D ( ParticleSystem< T, PARTICLETYPE > & particleSystem,
Vector< T, 2 > position,
T radius,
T epsilon,
T density = 0.,
Vector< T, 2 > velocity = Vector<T,2>(0.) )

Add resolved circle as new particle with new surface.

Set resolved circle 2D at given index

Definition at line 109 of file particleCreatorFunctions2D.h.

112{
113 //Retrieve new index
114 std::size_t idxParticle = particleSystem.size();
115
116 //Initialize particle address
117 particleSystem.extend();
118
120 setResolvedCircle2D( particleSystem, idxParticle, position, radius, epsilon, density, velocity );
121}
void setResolvedCircle2D(ParticleSystem< T, PARTICLETYPE > &particleSystem, std::size_t idxParticle, Vector< T, 2 > position, T radius, T epsilon, T density=0., Vector< T, 2 > velocity=Vector< T, 2 >(0.))
Set resolved circle for existing particle but new surface.

References olb::particles::ParticleSystem< T, PARTICLETYPE >::extend(), setResolvedCircle2D(), and olb::particles::ParticleSystem< T, PARTICLETYPE >::size().

+ Here is the call graph for this function:

◆ addResolvedCircle2D() [2/2]

template<typename T , typename PARTICLETYPE >
ParallelParticleLocator olb::particles::creators::addResolvedCircle2D ( SuperParticleSystem< T, PARTICLETYPE > & sParticleSystem,
const Vector< T, 2 > & position,
T radius,
T epsilon,
T density = 0.,
const Vector< T, 2 > & velocity = Vector<T,2> (0.),
const Vector< bool, 2 > & periodicity = Vector<bool,2>(false) )

Definition at line 394 of file particleParallelCreatorFunctions3D.h.

399{
400 //Get circumRadius and set angleInDegree
401 T circumRadius = SmoothIndicatorCircle2D<T,T,true>(
402 Vector<T,2> (0.), radius, epsilon).getCircumRadius();
404 angleInDegree(0.);
405
406 //Get new global particle id
407 std::size_t globID = sParticleSystem.getGlobID();
408
409 //Prepare particle and get list of touching iCs
410 int globiCcentre;
411 std::set<int> setOfICs = prepareParallelResolvedParticle(sParticleSystem,
412 position, circumRadius, epsilon, globiCcentre,
413 sParticleSystem.getSuperStructure().getCuboidDecomposition().getMotherCuboid().getDeltaR(),
414 periodicity);
415
416 std::size_t idxSurface = addSurface(sParticleSystem,
417 [&](){
418 return std::make_unique<SmoothIndicatorCircle2D<T, T, true>>(Vector<T,2> (0.), radius, epsilon );
419 });
420
421 //Iterate over particle systems
422 std::size_t localIDcentre=0; //Return localID of particle inside particleSystem holding centre
423 communication::forSystemsInSuperParticleSystem( sParticleSystem,
424 [&](ParticleSystem<T,PARTICLETYPE>& particleSystem, int iC, int globiC){
425 //Do for all iCs
426
427 //Assigne resolved particle to iCs specified in setOfICs
428 std::size_t localID=0;
429 assignParallelResolvedParticle( particleSystem, setOfICs, globiC,
430 idxSurface, globID, localID, globiCcentre,
431 position, density, angleInDegree, velocity );
432 //Set localID if centre
433 if (globiC==globiCcentre){ localIDcentre=localID; }
434 });
435
436 return ParallelParticleLocator(globiCcentre, globID, localIDcentre);
437}
implements a smooth circle in 2D with an _epsilon sector
std::set< int > prepareParallelResolvedParticle(SuperParticleSystem< T, PARTICLETYPE > &sParticleSystem, Vector< T, PARTICLETYPE::d > position, T circumRadius, const T epsilon, int &globiCcentre, const T physDeltaX, const Vector< bool, PARTICLETYPE::d > &periodicity)
std::size_t addSurface(SuperParticleSystem< T, PARTICLETYPE > &sParticleSystem, F createUniqueIndicatorPtr)
Adds surface (SmoothIndicator) to all block particle systems.

References addSurface(), assignParallelResolvedParticle(), olb::particles::communication::forSystemsInSuperParticleSystem(), olb::SmoothIndicatorF2D< T, S, false >::getCircumRadius(), olb::SuperStructure< T, D >::getCuboidDecomposition(), olb::particles::SuperParticleSystem< T, PARTICLETYPE >::getGlobID(), olb::particles::SuperParticleSystem< T, PARTICLETYPE >::getSuperStructure(), and prepareParallelResolvedParticle().

+ Here is the call graph for this function:

◆ addResolvedCone3D()

template<typename T , typename PARTICLETYPE >
void olb::particles::creators::addResolvedCone3D ( ParticleSystem< T, PARTICLETYPE > & particleSystem,
const Vector< T, 3 > & position1,
const Vector< T, 3 > & position2,
T radius1,
T radius2,
T epsilon,
T density = 0,
const Vector< T, 3 > & angleInDegree = Vector<T,3> (0.),
const Vector< T, 3 > & velocity = Vector<T,3> (0.) )

Add resolved cone as new particle with new surface.

Set resolved cone 3D at given index

Definition at line 234 of file particleCreatorFunctions3D.h.

239{
240 //Retrieve new index
241 std::size_t idxParticle = particleSystem.size();
242
243 //Initialize particle address
244 particleSystem.extend();
245
247 setResolvedCone3D( particleSystem, idxParticle,
248 position1, position2, radius1, radius2, epsilon, density, angleInDegree, velocity );
249}
void setResolvedCone3D(ParticleSystem< T, PARTICLETYPE > &particleSystem, std::size_t idxParticle, const Vector< T, 3 > &position1, const Vector< T, 3 > &position2, T radius1, T radius2, T epsilon, T density=0, const Vector< T, 3 > &angleInDegree=Vector< T, 3 >(0.), const Vector< T, 3 > &velocity=Vector< T, 3 >(0.))
Set resolved cone for existing particle but new surface.

References olb::particles::ParticleSystem< T, PARTICLETYPE >::extend(), setResolvedCone3D(), and olb::particles::ParticleSystem< T, PARTICLETYPE >::size().

+ Here is the call graph for this function:

◆ addResolvedCuboid2D()

template<typename T , typename PARTICLETYPE >
void olb::particles::creators::addResolvedCuboid2D ( ParticleSystem< T, PARTICLETYPE > & particleSystem,
Vector< T, 2 > position,
Vector< T, 2 > extend,
T epsilon,
T density = 0.,
T angle = 0.,
Vector< T, 2 > velocity = Vector<T,2> (0.) )

Add resolved cuboid as new particle with new surface.

Set resolved cuboid 2D at given index

Definition at line 155 of file particleCreatorFunctions2D.h.

159{
160 //Retrieve new index
161 std::size_t idxParticle = particleSystem.size();
162
163 //Initialize particle address
164 particleSystem.extend();
165
167 setResolvedCuboid2D( particleSystem, idxParticle, position,
168 extend, epsilon, density, angle, velocity );
169}
void setResolvedCuboid2D(ParticleSystem< T, PARTICLETYPE > &particleSystem, std::size_t idxParticle, Vector< T, 2 > position, Vector< T, 2 > extend, T epsilon, T density=0., T angle=0., Vector< T, 2 > velocity=Vector< T, 2 >(0.))
Set resolved cuboid for existing particle but new surface.

References olb::particles::ParticleSystem< T, PARTICLETYPE >::extend(), setResolvedCuboid2D(), and olb::particles::ParticleSystem< T, PARTICLETYPE >::size().

+ Here is the call graph for this function:

◆ addResolvedCuboid3D() [1/2]

template<typename T , typename PARTICLETYPE >
void olb::particles::creators::addResolvedCuboid3D ( ParticleSystem< T, PARTICLETYPE > & particleSystem,
const Vector< T, 3 > & position,
const Vector< T, 3 > & extend,
T epsilon,
T density = 0.,
const Vector< T, 3 > & angleInDegree = Vector<T,3> (0.),
const Vector< T, 3 > & velocity = Vector<T,3> (0.) )

Add resolved cuboid as new particle with new surface.

Set resolved cuboid 3D at given index

Definition at line 184 of file particleCreatorFunctions3D.h.

188{
189 //Retrieve new index
190 std::size_t idxParticle = particleSystem.size();
191
192 //Initialize particle address
193 particleSystem.extend();
194
196 setResolvedCuboid3D( particleSystem, idxParticle, position,
197 extend, epsilon, density, angleInDegree, velocity );
198}
void setResolvedCuboid3D(ParticleSystem< T, PARTICLETYPE > &particleSystem, std::size_t idxParticle, const Vector< T, 3 > &position, const Vector< T, 3 > &extend, T epsilon, T density=0., const Vector< T, 3 > &angleInDegree=Vector< T, 3 >(0.), const Vector< T, 3 > &velocity=Vector< T, 3 >(0.))
Set resolved cuboid for existing particle but new surface.

References olb::particles::ParticleSystem< T, PARTICLETYPE >::extend(), setResolvedCuboid3D(), and olb::particles::ParticleSystem< T, PARTICLETYPE >::size().

+ Here is the call graph for this function:

◆ addResolvedCuboid3D() [2/2]

template<typename T , typename PARTICLETYPE >
ParallelParticleLocator olb::particles::creators::addResolvedCuboid3D ( SuperParticleSystem< T, PARTICLETYPE > & sParticleSystem,
const Vector< T, 3 > & position,
const Vector< T, 3 > & extend,
T epsilon,
T density = 0.,
const Vector< T, 3 > & angleInDegree = Vector<T,3> (0.),
const Vector< T, 3 > & velocity = Vector<T,3> (0.),
const Vector< bool, 3 > & periodicity = Vector<bool,3>(false) )

Definition at line 249 of file particleParallelCreatorFunctions3D.h.

256{
257 //Get circumRadius
258 T circumRadius = SmoothIndicatorCuboid3D<T,T,true>(
259 extend[0], extend[1], extend[2], Vector<T,3>(0.), epsilon ).getCircumRadius();
260
261 //Get new global particle id
262 std::size_t globID = sParticleSystem.getGlobID();
263
264 //Prepare particle and get list of touching iCs
265 int globiCcentre;
266 std::set<int> setOfICs = prepareParallelResolvedParticle(sParticleSystem,
267 position, circumRadius, epsilon, globiCcentre,
268 sParticleSystem.getSuperStructure().getCuboidDecomposition().getMotherCuboid().getDeltaR(),
269 periodicity);
270
271 std::size_t idxSurface = addSurface(sParticleSystem,
272 [&](){
273 return std::make_unique<SmoothIndicatorCuboid3D<T, T, true>>(
274 extend[0], extend[1], extend[2], Vector<T,3>(0.), epsilon );
275 });
276
277 //Iterate over particle systems
278 std::size_t localIDcentre=0; //Return localID of particle inside particleSystem holding centre
279 communication::forSystemsInSuperParticleSystem( sParticleSystem,
280 [&](ParticleSystem<T,PARTICLETYPE>& particleSystem, int iC, int globiC){
281 //Do for all iCs
282
283 //Assigne resolved particle to iCs specified in setOfICs
284 std::size_t localID=0;
285 assignParallelResolvedParticle( particleSystem, setOfICs, globiC,
286 idxSurface, globID, localID, globiCcentre,
287 position, density, angleInDegree, velocity );
288 //Set localID if centre
289 if (globiC==globiCcentre){ localIDcentre=localID; }
290 });
291
292 //Return globiC, globID, localiD
293 return ParallelParticleLocator(globiCcentre, globID, localIDcentre);
294}
implements a smooth particle cuboid in 3D with an _epsilon sector.

References addSurface(), assignParallelResolvedParticle(), olb::particles::communication::forSystemsInSuperParticleSystem(), olb::SmoothIndicatorF3D< T, S, false >::getCircumRadius(), olb::SuperStructure< T, D >::getCuboidDecomposition(), olb::particles::SuperParticleSystem< T, PARTICLETYPE >::getGlobID(), olb::particles::SuperParticleSystem< T, PARTICLETYPE >::getSuperStructure(), and prepareParallelResolvedParticle().

+ Here is the call graph for this function:

◆ addResolvedCylinder3D() [1/2]

template<typename T , typename PARTICLETYPE >
void olb::particles::creators::addResolvedCylinder3D ( ParticleSystem< T, PARTICLETYPE > & particleSystem,
const Vector< T, 3 > & position,
const Vector< T, 3 > & normal,
T height,
T radius,
T epsilon,
T density = 0.,
const Vector< T, 3 > & angleInDegree = Vector<T,3> (0.),
const Vector< T, 3 > & velocity = Vector<T,3> (0.) )

Add resolved cylinder as new particle with new surface.

Set resolved cylinder 3D at given index

Definition at line 135 of file particleCreatorFunctions3D.h.

140{
141 //Retrieve new index
142 std::size_t idxParticle = particleSystem.size();
143
144 //Initialize particle address
145 particleSystem.extend();
146
148 setResolvedCylinder3D( particleSystem, idxParticle, position,
149 normal, height, radius, epsilon, density, angleInDegree, velocity );
150}
void setResolvedCylinder3D(ParticleSystem< T, PARTICLETYPE > &particleSystem, std::size_t idxParticle, const Vector< T, 3 > &position, const Vector< T, 3 > &normal, T height, T radius, T epsilon, T density=0., const Vector< T, 3 > &angleInDegree=Vector< T, 3 >(0.), const Vector< T, 3 > &velocity=Vector< T, 3 >(0.))
Set resolved cylinder for existing particle but new surface.

References olb::particles::ParticleSystem< T, PARTICLETYPE >::extend(), setResolvedCylinder3D(), and olb::particles::ParticleSystem< T, PARTICLETYPE >::size().

+ Here is the call graph for this function:

◆ addResolvedCylinder3D() [2/2]

template<typename T , typename PARTICLETYPE >
ParallelParticleLocator olb::particles::creators::addResolvedCylinder3D ( SuperParticleSystem< T, PARTICLETYPE > & sParticleSystem,
const Vector< T, 3 > & position,
const Vector< T, 3 > & normal,
T height,
T radius,
T epsilon,
T density = 0.,
const Vector< T, 3 > & angleInDegree = Vector<T,3> (0.),
const Vector< T, 3 > & velocity = Vector<T,3> (0.),
const Vector< bool, 3 > & periodicity = Vector<bool,3>(false) )

Definition at line 298 of file particleParallelCreatorFunctions3D.h.

305{
306 //Get circumRadius and set angleInDegree
307 T circumRadius = SmoothIndicatorCylinder3D<T,T,true>(Vector<T,3>(0.), normal, radius, height, epsilon ).getCircumRadius();
308
309 //Get new global particle id
310 std::size_t globID = sParticleSystem.getGlobID();
311
312 //Prepare particle and get list of touching iCs
313 int globiCcentre;
314 std::set<int> setOfICs = prepareParallelResolvedParticle(sParticleSystem,
315 position, circumRadius, epsilon, globiCcentre,
316 sParticleSystem.getSuperStructure().getCuboidDecomposition().getMotherCuboid().getDeltaR(),
317 periodicity);
318
319 std::size_t idxSurface = addSurface(sParticleSystem,
320 [&](){
321 return std::make_unique<SmoothIndicatorCylinder3D<T, T, true>>(
322 Vector<T,3>(0.), normal, radius, height, epsilon );
323 });
324
325 //Iterate over particle systems
326 std::size_t localIDcentre=0; //Return localID of particle inside particleSystem holding centre
327 communication::forSystemsInSuperParticleSystem( sParticleSystem,
328 [&](ParticleSystem<T,PARTICLETYPE>& particleSystem, int iC, int globiC){
329 //Do for all iCs
330
331 //Assigne resolved particle to iCs specified in setOfICs
332 std::size_t localID=0;
333 assignParallelResolvedParticle( particleSystem, setOfICs, globiC,
334 idxSurface, globID, localID, globiCcentre,
335 position, density, angleInDegree, velocity );
336 //Set localID if centre
337 if (globiC==globiCcentre){ localIDcentre=localID; }
338 });
339
340 return ParallelParticleLocator(globiCcentre, globID, localIDcentre);
341}
implements a smooth particle cylinder in 3D with an _epsilon sector.

References addSurface(), assignParallelResolvedParticle(), olb::particles::communication::forSystemsInSuperParticleSystem(), olb::SmoothIndicatorF3D< T, S, false >::getCircumRadius(), olb::SuperStructure< T, D >::getCuboidDecomposition(), olb::particles::SuperParticleSystem< T, PARTICLETYPE >::getGlobID(), olb::particles::SuperParticleSystem< T, PARTICLETYPE >::getSuperStructure(), and prepareParallelResolvedParticle().

+ Here is the call graph for this function:

◆ addResolvedEllipsoid3D()

template<typename T , typename PARTICLETYPE >
void olb::particles::creators::addResolvedEllipsoid3D ( ParticleSystem< T, PARTICLETYPE > & particleSystem,
const Vector< T, 3 > & position,
const Vector< T, 3 > & radius,
T epsilon,
T density = 0.,
const Vector< T, 3 > & angleInDegree = Vector<T,3> (0.),
const Vector< T, 3 > & velocity = Vector<T,3> (0.) )

Add resolved ellipsoid as new particle with new surface.

Set resolved ellipsoid 3D at given index

Definition at line 285 of file particleCreatorFunctions3D.h.

291{
292 //Retrieve new index
293 std::size_t idxParticle = particleSystem.size();
294
295 //Initialize particle address
296 particleSystem.extend();
297
299 setResolvedEllipsoid3D( particleSystem, idxParticle, position,
300 radius, epsilon, density, angleInDegree, velocity );
301}
void setResolvedEllipsoid3D(ParticleSystem< T, PARTICLETYPE > &particleSystem, std::size_t idxParticle, const Vector< T, 3 > &position, const Vector< T, 3 > &radius, T epsilon, T density=0., const Vector< T, 3 > &angleInDegree=Vector< T, 3 >(0.), const Vector< T, 3 > &velocity=Vector< T, 3 >(0.))
Set resolved ellipsoid for existing particle but new surface.

References olb::particles::ParticleSystem< T, PARTICLETYPE >::extend(), setResolvedEllipsoid3D(), and olb::particles::ParticleSystem< T, PARTICLETYPE >::size().

+ Here is the call graph for this function:

◆ addResolvedObject() [1/3]

template<typename T , typename PARTICLETYPE >
void olb::particles::creators::addResolvedObject ( ParticleSystem< T, PARTICLETYPE > & particleSystem,
std::size_t idxSurface,
const Vector< T, 2 > & position,
T density = 0.,
T angle = 0.,
const Vector< T, 2 > & velocity = Vector<T,2> (0.) )

Add resolved object as new particle with existing surface.

Set resolved object 2D at given index

Definition at line 62 of file particleCreatorFunctions2D.h.

66{
68 addResolvedObject( particleSystem, idxSurface, position, density,
70}
ParallelParticleLocator addResolvedObject(SuperParticleSystem< T, PARTICLETYPE > &sParticleSystem, std::size_t idxSurface, const Vector< T, PARTICLETYPE::d > &position, T density=0., const Vector< T, utilities::dimensions::convert< PARTICLETYPE::d >::rotation > &angleInDegree=Vector< T, utilities::dimensions::convert< PARTICLETYPE::d >::rotation >(0.), const Vector< T, PARTICLETYPE::d > &velocity=Vector< T, PARTICLETYPE::d >(0.), const Vector< bool, PARTICLETYPE::d > &periodicity=Vector< T, PARTICLETYPE::d >(false))
Converts dimensions by deriving from given cartesian dimension D.

References addResolvedObject().

+ Here is the call graph for this function:

◆ addResolvedObject() [2/3]

template<typename T , typename PARTICLETYPE >
Particle< T, PARTICLETYPE > olb::particles::creators::addResolvedObject ( ParticleSystem< T, PARTICLETYPE > & particleSystem,
std::size_t idxSurface,
const Vector< T, PARTICLETYPE::d > & position,
T density = 0.,
const Vector< T, utilities::dimensions::convert< PARTICLETYPE::d >::rotation > & angleInDegree = Vector<T,utilities::dimensions::convert<PARTICLETYPE::d>::rotation> (0.),
const Vector< T, PARTICLETYPE::d > & velocity = Vector<T,PARTICLETYPE::d> (0.) )

Add resolved object as new particle with existing surface (and return particle object)

Set resolved object 3D at given index

Return new particle object

Definition at line 101 of file particleCreatorHelperFunctions.h.

106{
107 //Retrieve new index
108 std::size_t idxParticle = particleSystem.size();
109
110 //Initialize particle address
111 particleSystem.extend();
112
114 setResolvedObject( particleSystem, idxParticle, idxSurface, position, density, angleInDegree, velocity );
115
117 return particleSystem.get(idxParticle);
118}
auto & get()
Expose container.
void setResolvedObject(ParticleSystem< T, PARTICLETYPE > &particleSystem, std::size_t idxParticle, std::size_t idxSurface, const Vector< T, 2 > &position, T density, T angle, const Vector< T, 2 > &velocity)

References olb::particles::ParticleSystem< T, PARTICLETYPE >::extend(), olb::particles::ParticleSystem< T, PARTICLETYPE >::get(), setResolvedObject(), and olb::particles::ParticleSystem< T, PARTICLETYPE >::size().

+ Here is the call graph for this function:

◆ addResolvedObject() [3/3]

template<typename T , typename PARTICLETYPE >
ParallelParticleLocator olb::particles::creators::addResolvedObject ( SuperParticleSystem< T, PARTICLETYPE > & sParticleSystem,
std::size_t idxSurface,
const Vector< T, PARTICLETYPE::d > & position,
T density = 0.,
const Vector< T, utilities::dimensions::convert< PARTICLETYPE::d >::rotation > & angleInDegree = Vector<T,utilities::dimensions::convert<PARTICLETYPE::d>::rotation> (0.),
const Vector< T, PARTICLETYPE::d > & velocity = Vector<T,PARTICLETYPE::d> (0.),
const Vector< bool, PARTICLETYPE::d > & periodicity = Vector<T,PARTICLETYPE::d>(false) )

Definition at line 129 of file particleParallelCreatorFunctions3D.h.

137{
138 //Retrieve circumRadius from smoothIndicator
139 constexpr unsigned D = PARTICLETYPE::d;
140 typedef SmoothIndicatorF<T,T,D,true> SIndicatorBaseType;
141 auto bParticleSystems = sParticleSystem.getBlockParticleSystems();
142 auto& particleSystem = *bParticleSystems[0]; //Use first randomly
143 auto& vectorOfIndicators = particleSystem.template getAssociatedData<
144 std::vector<std::unique_ptr<SIndicatorBaseType>>>();
145 T circumRadius = vectorOfIndicators[idxSurface]->getCircumRadius();
146 //Get new global particle id
147 std::size_t globID = sParticleSystem.getGlobID();
148 //Prepare particle and get list of touching iCs
149 int globiCcentre;
150 std::set<int> setOfICs = prepareParallelResolvedParticle(sParticleSystem,
151 position, circumRadius, vectorOfIndicators[idxSurface].get()->getEpsilon(), globiCcentre,
152 sParticleSystem.getSuperStructure().getCuboidDecomposition().getMotherCuboid().getDeltaR(),
153 periodicity);
154
155 //Iterate over particle systems
156 std::size_t localIDcentre=0; //Return localID of particle inside particleSystem holding centre
157 communication::forSystemsInSuperParticleSystem( sParticleSystem,
158 [&](ParticleSystem<T,PARTICLETYPE>& particleSystem, int iC, int globiC){
159 //Assigne resolved particle to iCs specified in setOfICs
160 std::size_t localID=0;
161 assignParallelResolvedParticle( particleSystem, setOfICs, globiC,
162 idxSurface, globID, localID, globiCcentre,
163 position, density, angleInDegree, velocity );
164 //Set localID if centre
165 if (globiC==globiCcentre){ localIDcentre=localID; }
166 });
167
168 //Return globiC, globID, localiD
169 return ParallelParticleLocator(globiCcentre, globID, localIDcentre);
170}
std::vector< ParticleSystem< T, PARTICLETYPE > * > & getBlockParticleSystems()
bool assignParallelResolvedParticle(ParticleSystem< T, PARTICLETYPE > &particleSystem, std::set< int > &setOfICs, int globiC, std::size_t idxSurface, std::size_t globID, std::size_t &localID, int globiCcentre, const Vector< T, PARTICLETYPE::d > &position, T density=0., const Vector< T, utilities::dimensions::convert< PARTICLETYPE::d >::rotation > &angleInDegree=Vector< T, utilities::dimensions::convert< PARTICLETYPE::d >::rotation >(0.), const Vector< T, PARTICLETYPE::d > &velocity=Vector< T, PARTICLETYPE::d >(0.))
std::conditional_t< D==2, SmoothIndicatorF2D< T, T, PARTICLE >, SmoothIndicatorF3D< T, T, PARTICLE > > SmoothIndicatorF
Definition aliases.h:267

References assignParallelResolvedParticle(), olb::particles::communication::forSystemsInSuperParticleSystem(), olb::particles::SuperParticleSystem< T, PARTICLETYPE >::getBlockParticleSystems(), olb::SuperStructure< T, D >::getCuboidDecomposition(), olb::particles::SuperParticleSystem< T, PARTICLETYPE >::getGlobID(), olb::particles::SuperParticleSystem< T, PARTICLETYPE >::getSuperStructure(), and prepareParallelResolvedParticle().

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

◆ addResolvedSphere3D() [1/2]

template<typename T , typename PARTICLETYPE , bool IGNORE_WARNINGS = false>
void olb::particles::creators::addResolvedSphere3D ( ParticleSystem< T, PARTICLETYPE > & particleSystem,
const Vector< T, 3 > & position,
T radius,
T epsilon,
T density = 0.,
const Vector< T, 3 > & velocity = Vector<T,3> (0.) )

Add resolved sphere as new particle with new surface.

Set resolved sphere 3D at given index

Definition at line 87 of file particleCreatorFunctions3D.h.

90{
91 //Retrieve new index
92 std::size_t idxParticle = particleSystem.size();
93
94 //Initialize particle address
95 particleSystem.extend();
96
98 setResolvedSphere3D<T,PARTICLETYPE,IGNORE_WARNINGS>(
99 particleSystem, idxParticle, position, radius, epsilon, density, velocity );
100}

References olb::particles::ParticleSystem< T, PARTICLETYPE >::extend(), setResolvedSphere3D(), and olb::particles::ParticleSystem< T, PARTICLETYPE >::size().

+ Here is the call graph for this function:

◆ addResolvedSphere3D() [2/2]

template<typename T , typename PARTICLETYPE >
ParallelParticleLocator olb::particles::creators::addResolvedSphere3D ( SuperParticleSystem< T, PARTICLETYPE > & sParticleSystem,
const Vector< T, 3 > & position,
T radius,
T epsilon,
T density = 0.,
const Vector< T, 3 > & velocity = Vector<T,3> (0.),
const Vector< bool, 3 > & periodicity = Vector<bool,3>(false) )

Definition at line 201 of file particleParallelCreatorFunctions3D.h.

206{
207 //Get circumRadius and set angleInDegree
208 T circumRadius = SmoothIndicatorSphere3D<T,T,true>(
209 Vector<T,3> (0.), radius, epsilon).getCircumRadius();
211 angleInDegree(0.);
212
213 //Get new global particle id
214 std::size_t globID = sParticleSystem.getGlobID();
215
216 //Prepare particle and get list of touching iCs
217 int globiCcentre;
218 std::set<int> setOfICs = prepareParallelResolvedParticle(sParticleSystem,
219 position, circumRadius, epsilon, globiCcentre,
220 sParticleSystem.getSuperStructure().getCuboidDecomposition().getMotherCuboid().getDeltaR(),
221 periodicity);
222
223 std::size_t idxSurface = addSurface(sParticleSystem,
224 [&](){
225 return std::make_unique<SmoothIndicatorSphere3D<T, T, true>>(Vector<T,3> (0.), radius, epsilon );
226 });
227
228 //Iterate over particle systems
229 std::size_t localIDcentre=0; //Return localID of particle inside particleSystem holding centre
230 communication::forSystemsInSuperParticleSystem( sParticleSystem,
231 [&](ParticleSystem<T,PARTICLETYPE>& particleSystem, int iC, int globiC){
232 //Do for all iCs
233
234 //Assigne resolved particle to iCs specified in setOfICs
235 std::size_t localID=0;
236 assignParallelResolvedParticle( particleSystem, setOfICs, globiC,
237 idxSurface, globID, localID, globiCcentre,
238 position, density, angleInDegree, velocity );
239 //Set localID if centre
240 if (globiC==globiCcentre){ localIDcentre=localID; }
241 });
242
243 //Return globiC, globID, localiD
244 return ParallelParticleLocator(globiCcentre, globID, localIDcentre);
245}
implements a smooth sphere in 3D with an _epsilon sector

References addSurface(), assignParallelResolvedParticle(), olb::particles::communication::forSystemsInSuperParticleSystem(), olb::SmoothIndicatorF3D< T, S, false >::getCircumRadius(), olb::SuperStructure< T, D >::getCuboidDecomposition(), olb::particles::SuperParticleSystem< T, PARTICLETYPE >::getGlobID(), olb::particles::SuperParticleSystem< T, PARTICLETYPE >::getSuperStructure(), and prepareParallelResolvedParticle().

+ Here is the call graph for this function:

◆ addResolvedTriangle2D()

template<typename T , typename PARTICLETYPE >
void olb::particles::creators::addResolvedTriangle2D ( ParticleSystem< T, PARTICLETYPE > & particleSystem,
Vector< T, 2 > position,
T radius,
T epsilon,
T density = 0.,
T angle = 0.,
Vector< T, 2 > velocity = Vector<T,2> (0.) )

Add resolved triangle as new particle with new surface.

Set resolved triangle 2D at given index

Definition at line 203 of file particleCreatorFunctions2D.h.

207{
208 //Retrieve new index
209 std::size_t idxParticle = particleSystem.size();
210
211 //Initialize particle address
212 particleSystem.extend();
213
215 setResolvedTriangle2D( particleSystem, idxParticle, position,
216 radius, epsilon, density, angle, velocity );
217}
void setResolvedTriangle2D(ParticleSystem< T, PARTICLETYPE > &particleSystem, std::size_t idxParticle, Vector< T, 2 > position, T radius, T epsilon, T density=0., T angle=0., Vector< T, 2 > velocity=Vector< T, 2 >(0.))
Set resolved cuboid for existing particle but new surface.

References olb::particles::ParticleSystem< T, PARTICLETYPE >::extend(), setResolvedTriangle2D(), and olb::particles::ParticleSystem< T, PARTICLETYPE >::size().

+ Here is the call graph for this function:

◆ addSubgridEulerRotationSpheroid() [1/2]

template<typename T , typename PARTICLETYPE >
void olb::particles::creators::addSubgridEulerRotationSpheroid ( ParticleSystem< T, PARTICLETYPE > & ParticleSystem,
const Vector< T, 3 > & position,
T length,
T diameter,
T density = 1.,
Vector< T, 3 > eul_ang = Vector<T,3> (0.,0.,0.),
Vector< T, 3 > velocity = Vector<T,3> (0.,0.,0.),
Vector< T, 3 > ang_velocity = Vector<T,3> (0.,0.,0.),
int label = 0 )

Definition at line 732 of file particleCreatorFunctions3D.h.

739{
740 //Retrieve new index
741 std::size_t idxParticle = ParticleSystem.size();
742
743 //Initialize particle address
744
747 position, length, diameter, density , eul_ang, velocity, ang_velocity, label );
748}
void setSubgridEulerRotationSpheroid(ParticleSystem< T, PARTICLETYPE > &particleSystem, std::size_t idxParticle, const Vector< T, 3 > &position, T length, T diameter, T density=1., Vector< T, 4 > quaternion=Vector< T, 4 >(0., 0., 0., 1.), Vector< T, 3 > velocity=Vector< T, 3 >(0., 0., 0.), Vector< T, 3 > ang_velocity=Vector< T, 3 >(0., 0., 0.), int label=0)
EULER ROTATION SPHEROIDS.

References olb::particles::ParticleSystem< T, PARTICLETYPE >::extend(), setSubgridEulerRotationSpheroid(), and olb::particles::ParticleSystem< T, PARTICLETYPE >::size().

+ Here is the call graph for this function:

◆ addSubgridEulerRotationSpheroid() [2/2]

template<typename T , typename PARTICLETYPE >
void olb::particles::creators::addSubgridEulerRotationSpheroid ( ParticleSystem< T, PARTICLETYPE > & ParticleSystem,
const Vector< T, 3 > & position,
T length,
T diameter,
T density = 1.,
Vector< T, 4 > quaternion = Vector<T,4> (0.,0.,0.,1.),
Vector< T, 3 > velocity = Vector<T,3> (0.,0.,0.),
Vector< T, 3 > ang_velocity = Vector<T,3> (0.,0.,0.),
int label = 0 )

Definition at line 713 of file particleCreatorFunctions3D.h.

720{
721 //Retrieve new index
722 std::size_t idxParticle = ParticleSystem.size();
723
724 //Initialize particle address
725
728 position, length, diameter, density , quaternion, velocity, ang_velocity, label );
729}

References olb::particles::ParticleSystem< T, PARTICLETYPE >::extend(), setSubgridEulerRotationSpheroid(), and olb::particles::ParticleSystem< T, PARTICLETYPE >::size().

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

◆ addSubgridEulerRotationSpheroid3D() [1/2]

template<typename T , typename PARTICLETYPE >
void olb::particles::creators::addSubgridEulerRotationSpheroid3D ( SuperParticleSystem< T, PARTICLETYPE > & sParticleSystem,
const Vector< T, 3 > & position,
T length,
T diameter,
T density = 1.,
const Vector< T, 3 > velocity = Vector<T,3> (0.),
const Vector< T, 3 > eul_ang = Vector<T,3> (0.,0.,0.),
const Vector< T, 3 > ang_velocity = Vector<T,3> (0.),
int label = 0 )

Definition at line 753 of file particleCreatorFunctions3D.h.

759{
760 using namespace descriptors;
761 //Retrieving cuboid geometry
762 auto& cuboidDecomposition = sParticleSystem.getSuperStructure().getCuboidDecomposition();
763 //Get global particle id
764 std::size_t globID = sParticleSystem.getGlobID();
765 //Find globiC the particle belongs to
766 int globiCcentre;
767 bool inDomain = false;
768 if (auto iC = cuboidDecomposition.getC(position)) {
769 inDomain = true;
770 globiCcentre = *iC;
771 }
772 if (!inDomain){ std::cerr << "ERROR: Particle added outside domain!" << std::endl; }
773 //Iterate over particle systems
774 communication::forSystemsInSuperParticleSystem( sParticleSystem,
775 [&](ParticleSystem<T,PARTICLETYPE>& particleSystem, int iC, int globiC){
776
777 //Do only on residence iC
778 if (globiC == globiCcentre){
779 //Run creator on particleSystem
780
781 addSubgridEulerRotationSpheroid( particleSystem,
782 position, length, diameter, density, eul_ang, velocity, ang_velocity, label );
783 //Add additional data due to parallization
784 auto particle = particleSystem.get(particleSystem.size()-1);
785 particle.template setField<PARALLELIZATION,ID>( globID );
786 //Reinforcing default values
787 particle.template setField<GENERAL,INVALID>( false );
788 }
789 });
790}

References addSubgridEulerRotationSpheroid(), olb::particles::communication::forSystemsInSuperParticleSystem(), olb::particles::ParticleSystem< T, PARTICLETYPE >::get(), olb::SuperStructure< T, D >::getCuboidDecomposition(), olb::particles::SuperParticleSystem< T, PARTICLETYPE >::getGlobID(), olb::particles::SuperParticleSystem< T, PARTICLETYPE >::getSuperStructure(), and olb::particles::ParticleSystem< T, PARTICLETYPE >::size().

+ Here is the call graph for this function:

◆ addSubgridEulerRotationSpheroid3D() [2/2]

template<typename T , typename PARTICLETYPE >
void olb::particles::creators::addSubgridEulerRotationSpheroid3D ( SuperParticleSystem< T, PARTICLETYPE > & sParticleSystem,
const Vector< T, 3 > & position,
T length,
T diameter,
T density = 1.,
const Vector< T, 3 > velocity = Vector<T,3> (0.),
const Vector< T, 4 > eul_quat = Vector<T,4> (0.,0.,0.,1.),
const Vector< T, 3 > ang_velocity = Vector<T,3> (0.),
int label = 0 )

Definition at line 794 of file particleCreatorFunctions3D.h.

800{
801 using namespace descriptors;
802 //Retrieving cuboid geometry
803 auto& cuboidDecomposition= sParticleSystem.getSuperStructure().getCuboidDecomposition();
804 //Get global particle id
805 std::size_t globID = sParticleSystem.getGlobID();
806 //Find globiC the particle belongs to
807 int globiCcentre;
808 bool inDomain = false;
809 if (auto iC = cuboidDecomposition.getC(position)) {
810 inDomain = true;
811 globiCcentre = *iC;
812 }
813 if (!inDomain){ std::cerr << "ERROR: Particle added outside domain!" << std::endl; }
814 //Iterate over particle systems
815 communication::forSystemsInSuperParticleSystem( sParticleSystem,
816 [&](ParticleSystem<T,PARTICLETYPE>& particleSystem, int iC, int globiC){
817
818 //Do only on residence iC
819 if (globiC == globiCcentre){
820 //Run creator on particleSystem
821 T a = diameter/2.;//semi_minor_axis
822
823 addSubgridEulerRotationSpheroid( particleSystem,
824 position, length, diameter, density, eul_quat, velocity, ang_velocity, label );
825 //Add additional data due to parallization
826 auto particle = particleSystem.get(particleSystem.size()-1);
827 particle.template setField<PARALLELIZATION,ID>( globID );
828 //Reinforcing default values
829 particle.template setField<GENERAL,INVALID>( false );
830 }
831 });
832}

References addSubgridEulerRotationSpheroid(), olb::particles::communication::forSystemsInSuperParticleSystem(), olb::particles::ParticleSystem< T, PARTICLETYPE >::get(), olb::SuperStructure< T, D >::getCuboidDecomposition(), olb::particles::SuperParticleSystem< T, PARTICLETYPE >::getGlobID(), olb::particles::SuperParticleSystem< T, PARTICLETYPE >::getSuperStructure(), and olb::particles::ParticleSystem< T, PARTICLETYPE >::size().

+ Here is the call graph for this function:

◆ addSubgridHaiderLevenspiel3D() [1/2]

template<typename T , typename PARTICLETYPE >
void olb::particles::creators::addSubgridHaiderLevenspiel3D ( ParticleSystem< T, PARTICLETYPE > & particleSystem,
const Vector< T, 3 > & position,
T surface,
T volume,
T density = 0.,
const Vector< T, 3 > & velocity = Vector<T,3> (0.),
T lengthP = 1.,
T diameterP = 1. )

Definition at line 430 of file particleCreatorFunctions3D.h.

434{
435 //volume equivalent radius used
436 T radius=util::pow(3*volume/(4*3.141592653),0.33333333333333);
437 T sphericity = (4*M_PI*std::pow(3*volume/(4*M_PI),0.66666666666))/surface;
438 T mass = density*volume;
439 addSubgridHaiderLevenspielObject( particleSystem,
440 position, radius, sphericity, mass, velocity, lengthP, diameterP );
441}
#define M_PI
void addSubgridHaiderLevenspielObject(ParticleSystem< T, PARTICLETYPE > &particleSystem, const Vector< T, PARTICLETYPE::d > &position, T radius, T sphericity, T mass=0., T density=1., const Vector< T, PARTICLETYPE::d > &velocity=Vector< T, PARTICLETYPE::d >(0.), T lengthP=1., T diameterP=1.)
Add subgrid object as new particle.

References addSubgridHaiderLevenspielObject(), M_PI, and olb::util::pow().

+ Here is the call graph for this function:

◆ addSubgridHaiderLevenspiel3D() [2/2]

template<typename T , typename PARTICLETYPE >
void olb::particles::creators::addSubgridHaiderLevenspiel3D ( SuperParticleSystem< T, PARTICLETYPE > & sParticleSystem,
const Vector< T, 3 > & position,
T surface,
T volume,
T density = 1.,
const Vector< T, 3 > & velocity = Vector<T,3> (0.),
T lengthP = 1.,
T diameterP = 1. )

Definition at line 446 of file particleCreatorFunctions3D.h.

450{
451 using namespace descriptors;
452 //Retrieving cuboid geometry
453 auto& cuboidDecomposition = sParticleSystem.getSuperStructure().getCuboidDecomposition();
454 //Get global particle id
455 std::size_t globID = sParticleSystem.getGlobID();
456 //Find globiC the particle belongs to
457 int globiCcentre;
458 bool inDomain = false;
459 if (auto iC = cuboidDecomposition.getC(position)) {
460 inDomain = true;
461 globiCcentre = *iC;
462 }
463 if (!inDomain){ std::cerr << "ERROR: Particle added outside domain!" << std::endl; }
464 //Iterate over particle systems
465 communication::forSystemsInSuperParticleSystem( sParticleSystem,
466 [&](ParticleSystem<T,PARTICLETYPE>& particleSystem, int iC, int globiC){
467
468 //Do only on residence iC
469 if (globiC == globiCcentre){
470 //Run creator on particleSystem
471 T radius=util::pow(3*volume/(4*3.141592653),0.33333333333333);//volume equivalent
472 T sphericity = (4*M_PI*std::pow(3*volume/(4*M_PI),0.66666666666))/surface;
473 T mass = density*volume;
474 addSubgridHaiderLevenspielObject( particleSystem,
475 position, radius, sphericity, mass, density, velocity, lengthP, diameterP );
476 //Add additional data due to parallization
477 auto particle = particleSystem.get(particleSystem.size()-1);
478 particle.template setField<PARALLELIZATION,ID>( globID );
479 //Reinforcing default values
480 particle.template setField<GENERAL,INVALID>( false );
481 }
482 });
483}

References addSubgridHaiderLevenspielObject(), olb::particles::communication::forSystemsInSuperParticleSystem(), olb::particles::ParticleSystem< T, PARTICLETYPE >::get(), olb::SuperStructure< T, D >::getCuboidDecomposition(), olb::particles::SuperParticleSystem< T, PARTICLETYPE >::getGlobID(), olb::particles::SuperParticleSystem< T, PARTICLETYPE >::getSuperStructure(), M_PI, olb::util::pow(), and olb::particles::ParticleSystem< T, PARTICLETYPE >::size().

+ Here is the call graph for this function:

◆ addSubgridHaiderLevenspielObject()

template<typename T , typename PARTICLETYPE >
void olb::particles::creators::addSubgridHaiderLevenspielObject ( ParticleSystem< T, PARTICLETYPE > & particleSystem,
const Vector< T, PARTICLETYPE::d > & position,
T radius,
T sphericity,
T mass = 0.,
T density = 1.,
const Vector< T, PARTICLETYPE::d > & velocity = Vector<T,PARTICLETYPE::d> (0.),
T lengthP = 1.,
T diameterP = 1. )

Add subgrid object as new particle.

Set subgrid object 3D at given index

Definition at line 412 of file particleCreatorFunctions3D.h.

416{
417 //Retrieve new index
418 std::size_t idxParticle = particleSystem.size();
419
420 //Initialize particle address
421 particleSystem.extend();
422
424 setSubgridHaiderLevenspielObject( particleSystem, idxParticle, position, radius, sphericity, mass, density, velocity, lengthP, diameterP );
425}
void setSubgridHaiderLevenspielObject(ParticleSystem< T, PARTICLETYPE > &particleSystem, std::size_t idxParticle, const Vector< T, PARTICLETYPE::d > &position, T radius, T sphericity, T mass, T density, const Vector< T, PARTICLETYPE::d > &velocity, T lengthP=1., T diameterP=1.)
Set new particle.

References olb::particles::ParticleSystem< T, PARTICLETYPE >::extend(), setSubgridHaiderLevenspielObject(), and olb::particles::ParticleSystem< T, PARTICLETYPE >::size().

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

◆ addSubgridObject()

template<typename T , typename PARTICLETYPE >
Particle< T, PARTICLETYPE > olb::particles::creators::addSubgridObject ( ParticleSystem< T, PARTICLETYPE > & particleSystem,
const Vector< T, PARTICLETYPE::d > & position,
T radius,
T density = 0.,
const Vector< T, PARTICLETYPE::d > & velocity = Vector<T,PARTICLETYPE::d> (0.) )

Add subgrid object as new particle (and return particle object)

Set subgrid object 3D at given index

Return new particle object

Definition at line 168 of file particleCreatorHelperFunctions.h.

172{
173 //Retrieve new index
174 std::size_t idxParticle = particleSystem.size();
175
176 //Initialize particle address
177 particleSystem.extend();
178
180 setSubgridObject( particleSystem, idxParticle, position, radius, density,velocity );
181
183 return particleSystem.get(idxParticle);
184}
Particle< T, PARTICLETYPE > setSubgridObject(ParticleSystem< T, PARTICLETYPE > &particleSystem, std::size_t idxParticle, const Vector< T, PARTICLETYPE::d > &position, T radius, T density, const Vector< T, PARTICLETYPE::d > &velocity, T shapeFactor=T{1})
Set new particle (and return particle object)

References olb::particles::ParticleSystem< T, PARTICLETYPE >::extend(), olb::particles::ParticleSystem< T, PARTICLETYPE >::get(), setSubgridObject(), and olb::particles::ParticleSystem< T, PARTICLETYPE >::size().

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

◆ addSubgridSphere3D() [1/2]

template<typename T , typename PARTICLETYPE >
void olb::particles::creators::addSubgridSphere3D ( ParticleSystem< T, PARTICLETYPE > & particleSystem,
const Vector< T, 3 > & position,
T radius,
T density = 0.,
const Vector< T, 3 > & velocity = Vector<T,3> (0.) )

Definition at line 361 of file particleCreatorFunctions3D.h.

365{
366 addSubgridObject( particleSystem,
367 position, radius, density, velocity );
368}
Particle< T, PARTICLETYPE > addSubgridObject(ParticleSystem< T, PARTICLETYPE > &particleSystem, const Vector< T, PARTICLETYPE::d > &position, T radius, T density=0., const Vector< T, PARTICLETYPE::d > &velocity=Vector< T, PARTICLETYPE::d >(0.))
Add subgrid object as new particle (and return particle object)

References addSubgridObject().

+ Here is the call graph for this function:

◆ addSubgridSphere3D() [2/2]

template<typename T , typename PARTICLETYPE >
ParallelParticleLocator olb::particles::creators::addSubgridSphere3D ( SuperParticleSystem< T, PARTICLETYPE > & sParticleSystem,
const Vector< T, 3 > & position,
T radius,
T density = 0.,
const Vector< T, 3 > & velocity = Vector<T,3> (0.) )

Definition at line 443 of file particleParallelCreatorFunctions3D.h.

447{
448 using namespace descriptors;
449 //Retrieving cuboid geometry
450 auto& cuboidDecomposition = sParticleSystem.getSuperStructure().getCuboidDecomposition();
451 //Get global particle id
452 std::size_t globID = sParticleSystem.getGlobID();
453 //Find globiC the particle belongs to
454 int globiCcentre;
455 if (auto iC = cuboidDecomposition.getC(position)) {
456 globiCcentre = *iC;
457 } else {
458 std::cerr << "ERROR: Particle added outside domain!" << std::endl;
459 }
460
461 //Iterate over particle systems
462 std::size_t localID=0; //Return localID of particle inside particleSystem holding centre
463 communication::forSystemsInSuperParticleSystem( sParticleSystem,
464 [&](ParticleSystem<T,PARTICLETYPE>& particleSystem, int iC, int globiC){
465
466 //Do only on residence iC
467 if (globiC == globiCcentre){
468 //Run creator on particleSystem
469 addSubgridObject( particleSystem,
470 position, radius, density, velocity );
471 //Add additional data due to parallization
472 auto particle = particleSystem.get(particleSystem.size()-1);
473 particle.template setField<PARALLELIZATION,ID>( globID );
474 //Set localID
475 localID=particle.getId();
476 }
477 });
478
479 //Return globiC, globID, localiD
480 return ParallelParticleLocator(globiCcentre, globID, localID);
481}

References addSubgridObject(), olb::particles::communication::forSystemsInSuperParticleSystem(), olb::particles::ParticleSystem< T, PARTICLETYPE >::get(), olb::SuperStructure< T, D >::getCuboidDecomposition(), olb::particles::SuperParticleSystem< T, PARTICLETYPE >::getGlobID(), olb::particles::SuperParticleSystem< T, PARTICLETYPE >::getSuperStructure(), and olb::particles::ParticleSystem< T, PARTICLETYPE >::size().

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

◆ addSubgridSphereWithSpecies3D()

template<typename T , typename PARTICLETYPE >
ParallelParticleLocator olb::particles::creators::addSubgridSphereWithSpecies3D ( SuperParticleSystem< T, PARTICLETYPE > & sParticleSystem,
const Vector< T, 3 > & position,
T radius,
T density = 0.,
const Vector< T, 3 > & velocity = Vector<T,3> (0.),
const int species = 0 )

Definition at line 485 of file particleParallelCreatorFunctions3D.h.

490{
491 using namespace descriptors;
492 //Retrieving cuboid geometry
493 auto& cuboidDecomposition = sParticleSystem.getSuperStructure().getCuboidDecomposition();
494 //Get global particle id
495 std::size_t globID = sParticleSystem.getGlobID();
496 //Find globiC the particle belongs to
497 int globiCcentre;
498 if (auto iC = cuboidDecomposition.getC(position)) {
499 globiCcentre = *iC;
500 } else {
501 std::cerr << "ERROR: Particle added outside domain!" << std::endl;
502 }
503
504 //Iterate over particle systems
505 std::size_t localID=0; //Return localID of particle inside particleSystem holding centre
506 communication::forSystemsInSuperParticleSystem( sParticleSystem,
507 [&](ParticleSystem<T,PARTICLETYPE>& particleSystem, int iC, int globiC){
508
509 //Do only on residence iC
510 if (globiC == globiCcentre){
511 //Run creator on particleSystem
512 addSubgridObject( particleSystem,
513 position, radius, density, velocity );
514 //Add additional data due to parallization
515 auto particle = particleSystem.get(particleSystem.size()-1);
516 particle.template setField<PARALLELIZATION,ID>( globID );
517 //Add species type to particle
518 if constexpr( access::providesSpecies<PARTICLETYPE>() ){
519 particle.template setField<PHYSPROPERTIES,SPECIES>( species );
520 }
521 //Set localID
522 localID=particle.getId();
523 }
524 });
525
526 //Return globiC, globID, localiD
527 return ParallelParticleLocator(globiCcentre, globID, localID);
528}

References addSubgridObject(), olb::particles::communication::forSystemsInSuperParticleSystem(), olb::particles::ParticleSystem< T, PARTICLETYPE >::get(), olb::SuperStructure< T, D >::getCuboidDecomposition(), olb::particles::SuperParticleSystem< T, PARTICLETYPE >::getGlobID(), olb::particles::SuperParticleSystem< T, PARTICLETYPE >::getSuperStructure(), olb::particles::access::providesSpecies(), and olb::particles::ParticleSystem< T, PARTICLETYPE >::size().

+ Here is the call graph for this function:

◆ addSubgridTranCongFromCylinder3D()

template<typename T , typename PARTICLETYPE >
void olb::particles::creators::addSubgridTranCongFromCylinder3D ( SuperParticleSystem< T, PARTICLETYPE > & sParticleSystem,
const Vector< T, 3 > & position,
T length,
T diameter,
T _angle = 0.,
T density = 1.,
const Vector< T, 3 > & velocity = Vector<T,3> (0.) )

Definition at line 538 of file particleCreatorFunctions3D.h.

542{
543 using namespace descriptors;
544 //Retrieving cuboid geometry
545 auto& cuboidDecomposition = sParticleSystem.getSuperStructure().getCuboidDecomposition();
546 //Get global particle id
547 std::size_t globID = sParticleSystem.getGlobID();
548 //Find globiC the particle belongs to
549 int globiCcentre;
550 bool inDomain = false;
551 if (auto iC = cuboidDecomposition.getC(position)) {
552 inDomain = true;
553 globiCcentre = *iC;
554 }
555 if (!inDomain){ std::cerr << "ERROR: Particle added outside domain!" << std::endl; }
556 //Iterate over particle systems
557 communication::forSystemsInSuperParticleSystem( sParticleSystem,
558 [&](ParticleSystem<T,PARTICLETYPE>& particleSystem, int iC, int globiC){
559
560 //Do only on residence iC
561 if (globiC == globiCcentre){
562 //Run creator on particleSystem
563 T r = diameter/2.;
564 T angle = _angle/360.*(2*M_PI);
565 T volume = M_PI*r*r*length;
566 T A_p = util::abs(M_PI*diameter*diameter/4.*olb::util::cos(angle)) + util::abs(diameter*length*olb::util::sin(angle));
567 T P_p = 2*M_PI*r*olb::util::cos(angle) + (2*r+length)*2*olb::util::sin(angle);
568 T d_n=util::pow(6*volume/M_PI, 0.33333333333); //volume equivalent diameter
569 T d_A = util::sqrt(4*A_p/M_PI);//projected surface equivalent diameter7
570 T c = (M_PI*d_A)/P_p;//circularity
571 T dA_dn = d_A/d_n;
572 T radius = r*olb::util::cos(angle) + length/2.*olb::util::sin(angle);//calculated for the deposition function
573 //T radius = r;//calculated for the deposition function
574
575
576 T mass = density*volume;
577 addSubgridTranCongObject( particleSystem,
578 position, radius, c, A_p, dA_dn, mass, density, velocity );
579 //Add additional data due to parallization
580 auto particle = particleSystem.get(particleSystem.size()-1);
581 particle.template setField<PARALLELIZATION,ID>( globID );
582 T beta = length/diameter;
583 T a = r;
584 Vector<T,3> scaling(beta*a,a,a);
585 particle.template setField<NUMERICPROPERTIES,SCALING>( scaling); //used for visualisation in Paraview
586 //Reinforcing default values
587 particle.template setField<GENERAL,INVALID>( false );
588 }
589 });
590}
ADf< T, DIM > sin(const ADf< T, DIM > &a)
Definition aDiff.h:569
ADf< T, DIM > cos(const ADf< T, DIM > &a)
Definition aDiff.h:578

References olb::util::abs(), addSubgridTranCongObject(), olb::util::cos(), olb::particles::communication::forSystemsInSuperParticleSystem(), olb::particles::ParticleSystem< T, PARTICLETYPE >::get(), olb::SuperStructure< T, D >::getCuboidDecomposition(), olb::particles::SuperParticleSystem< T, PARTICLETYPE >::getGlobID(), olb::particles::SuperParticleSystem< T, PARTICLETYPE >::getSuperStructure(), M_PI, olb::util::pow(), olb::util::sin(), olb::particles::ParticleSystem< T, PARTICLETYPE >::size(), and olb::util::sqrt().

+ Here is the call graph for this function:

◆ addSubgridTranCongObject()

template<typename T , typename PARTICLETYPE >
void olb::particles::creators::addSubgridTranCongObject ( ParticleSystem< T, PARTICLETYPE > & particleSystem,
const Vector< T, PARTICLETYPE::d > & position,
T radius,
T c,
T A_p,
T dA_dn,
T mass = 0.,
T density = 1.,
const Vector< T, PARTICLETYPE::d > & velocity = Vector<T,PARTICLETYPE::d> (0.) )

Definition at line 521 of file particleCreatorFunctions3D.h.

523{
524 //Retrieve new index
525 std::size_t idxParticle = particleSystem.size();
526
527 //Initialize particle address
528
529 particleSystem.extend();
530 setSubgridTranCongObject( particleSystem, idxParticle,
531 position, radius, c, A_p , dA_dn, mass, density, velocity );
532}
void setSubgridTranCongObject(ParticleSystem< T, PARTICLETYPE > &particleSystem, std::size_t idxParticle, const Vector< T, PARTICLETYPE::d > &position, T radius, T c, T A_p, T dA_dnn, T mass, T density, const Vector< T, PARTICLETYPE::d > &velocity)
Set new particle Tran Cong.

References olb::particles::ParticleSystem< T, PARTICLETYPE >::extend(), setSubgridTranCongObject(), and olb::particles::ParticleSystem< T, PARTICLETYPE >::size().

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

◆ addSurface()

template<typename T , typename PARTICLETYPE , typename F >
std::size_t olb::particles::creators::addSurface ( SuperParticleSystem< T, PARTICLETYPE > & sParticleSystem,
F createUniqueIndicatorPtr )

Adds surface (SmoothIndicator) to all block particle systems.

Definition at line 174 of file particleParallelCreatorFunctions3D.h.

176{
177 typedef SmoothIndicatorF<T, T, PARTICLETYPE::d, true> SIndicatorBaseType;
178 std::size_t idxSurface = 0;
179
180 std::vector<olb::particles::ParticleSystem<T, PARTICLETYPE>*>&
181 blockParticleSystems = sParticleSystem.getBlockParticleSystems();
182 // Iteration over each element independent from cuboids to ensure that surfaces are added everywhere
183 // as some blocks may not have a corresponding cuboid
184 for (unsigned i = 0; i < blockParticleSystems.size(); ++i) {
185 auto& particleSystem = *blockParticleSystems[i];
186 auto& vectorOfIndicators = particleSystem.template getAssociatedData<
187 std::vector<std::unique_ptr<SIndicatorBaseType>>>();
188 if(i > 0 && idxSurface != vectorOfIndicators.size()) {
189 std::cerr << "ERROR: Number of particle surfaces don't match." << std::endl;
190 assert(false);
191 }
192 idxSurface = vectorOfIndicators.size();
193 vectorOfIndicators.push_back( createUniqueIndicatorPtr() );
194 }
195
196 return idxSurface;
197}

References olb::particles::SuperParticleSystem< T, PARTICLETYPE >::getBlockParticleSystems(), and olb::particles::ParticleSystem< T, PARTICLETYPE >::size().

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

◆ assignParallelResolvedParticle()

template<typename T , typename PARTICLETYPE >
bool olb::particles::creators::assignParallelResolvedParticle ( ParticleSystem< T, PARTICLETYPE > & particleSystem,
std::set< int > & setOfICs,
int globiC,
std::size_t idxSurface,
std::size_t globID,
std::size_t & localID,
int globiCcentre,
const Vector< T, PARTICLETYPE::d > & position,
T density = 0.,
const Vector< T, utilities::dimensions::convert< PARTICLETYPE::d >::rotation > & angleInDegree = Vector<T,utilities::dimensions::convert<PARTICLETYPE::d>::rotation> (0.),
const Vector< T, PARTICLETYPE::d > & velocity = Vector<T,PARTICLETYPE::d> (0.) )

Definition at line 102 of file particleParallelCreatorFunctions3D.h.

110{
111 //Check whether asignment needed for globiC
112 bool assigned=false;
113 if( setOfICs.find(globiC) != setOfICs.end() ) {
114 //Attach particle to cuboid with globiC (and retrieve new particle object)
115 auto particle = assignParallelResolvedParticleToiC( particleSystem, idxSurface,
116 globID, globiCcentre, position, density, angleInDegree, velocity );
117 //Declare assignement found
118 assigned=true;
119 //Retrieve localID
120 localID = particle.getId();
121 } //if( std::find() )
122 //Return whether assigned
123 return assigned;
124}
Particle< T, PARTICLETYPE > assignParallelResolvedParticleToiC(ParticleSystem< T, PARTICLETYPE > &particleSystem, std::size_t idxSurface, std::size_t globID, int globiCcentre, const Vector< T, PARTICLETYPE::d > &position, T density=0., const Vector< T, utilities::dimensions::convert< PARTICLETYPE::d >::rotation > &angleInDegree=Vector< T, utilities::dimensions::convert< PARTICLETYPE::d >::rotation >(0.), const Vector< T, PARTICLETYPE::d > &velocity=Vector< T, PARTICLETYPE::d >(0.))

References assignParallelResolvedParticleToiC().

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

◆ assignParallelResolvedParticleToiC()

template<typename T , typename PARTICLETYPE >
Particle< T, PARTICLETYPE > olb::particles::creators::assignParallelResolvedParticleToiC ( ParticleSystem< T, PARTICLETYPE > & particleSystem,
std::size_t idxSurface,
std::size_t globID,
int globiCcentre,
const Vector< T, PARTICLETYPE::d > & position,
T density = 0.,
const Vector< T, utilities::dimensions::convert< PARTICLETYPE::d >::rotation > & angleInDegree = Vector<T,utilities::dimensions::convert<PARTICLETYPE::d>::rotation> (0.),
const Vector< T, PARTICLETYPE::d > & velocity = Vector<T,PARTICLETYPE::d> (0.) )

Definition at line 79 of file particleParallelCreatorFunctions3D.h.

86{
87 using namespace descriptors;
88 //Add resolved object
89 auto particle = creators::addResolvedObject( particleSystem, idxSurface,
90 position, density, angleInDegree, velocity );
91 //Add additional data due to parallization
92 particle.template setField<PARALLELIZATION,ID>( globID );
93 particle.template setField<PARALLELIZATION,IC>( globiCcentre );
94 particle.template setField<SURFACE,SURFACE_ID>( idxSurface );
95 //Return particle object
96 return particle;
97}

References addResolvedObject().

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

◆ calcParticleVolume()

template<typename T , unsigned D>
T olb::particles::creators::calcParticleVolume ( const std::vector< SpawnData< T, D > > & spawnData,
const std::function< T(const std::size_t &)> & getParticleVolume )

Definition at line 57 of file particleCreatorFunctions.h.

60{
61 T particleVolume(0);
62 std::size_t pID(0);
63
64 // Use with C++20:
65 //for(std::size_t pID = 0; [[maybe_unused]] const SpawnData<T,D>& entry : spawnData) {
66 for ([[maybe_unused]] const SpawnData<T, D>& entry : spawnData) {
67 particleVolume += getParticleVolume(pID++);
68 }
69 return particleVolume;
70}
+ Here is the caller graph for this function:

◆ calcParticleVolumeFraction()

template<typename T , unsigned D>
T olb::particles::creators::calcParticleVolumeFraction ( const std::vector< SpawnData< T, D > > & spawnData,
const T fluidVolume,
const std::function< T(const std::size_t &)> & getParticleVolume )

Definition at line 73 of file particleCreatorFunctions.h.

76{
77 return calcParticleVolume(spawnData, getParticleVolume) / fluidVolume;
78}
T calcParticleVolume(const std::vector< SpawnData< T, D > > &spawnData, const std::function< T(const std::size_t &)> &getParticleVolume)

References calcParticleVolume().

+ Here is the call graph for this function:

◆ checkForErrors()

template<typename PARTICLETYPE , bool ROTATION_IS_OPTIONAL = false>
void olb::particles::creators::checkForErrors ( )

Definition at line 36 of file particleCreatorHelperFunctions.h.

37{
38 using namespace descriptors;
39
40 static_assert(ROTATION_IS_OPTIONAL || PARTICLETYPE::template providesNested<SURFACE,ROT_MATRIX>(),
41 "A rotation matrix is necessary but not provided.");
42}
+ Here is the caller graph for this function:

◆ extendSpawnData() [1/3]

template<typename T , unsigned D>
void olb::particles::creators::extendSpawnData ( std::vector< SpawnData< T, D > > & spawnData,
const T wantedParticleVolumeFraction,
IndicatorF< T, D > & fluidDomain,
const T fluidDomainVolume,
const std::function< PhysR< T, D >(const std::size_t &, const PhysR< T, D > &)> & getMin,
const std::function< PhysR< T, D >(const std::size_t &, const PhysR< T, D > &)> & getMax,
const std::function< T(const std::size_t &)> & getParticleVolume )

Definition at line 263 of file particleCreatorFunctions.h.

272{
273 constexpr unsigned maxTries = 1e6;
274 const auto getPoints = [&](const PhysR<T, D>& position,
275 const PhysR<T, D>& min, const PhysR<T, D>& max) {
276 std::vector<PhysR<T, D>> points;
277 if constexpr (D == 3) {
278 points.reserve(9);
279 points.push_back(PhysR<T, D>(min[0], min[1], min[2]));
280 points.push_back(PhysR<T, D>(min[0], min[1], max[2]));
281 points.push_back(PhysR<T, D>(min[0], max[1], min[2]));
282 points.push_back(PhysR<T, D>(min[0], max[1], max[2]));
283 points.push_back(PhysR<T, D>(max[0], min[1], max[2]));
284 points.push_back(PhysR<T, D>(max[0], min[1], min[2]));
285 points.push_back(PhysR<T, D>(max[0], max[1], min[2]));
286 points.push_back(PhysR<T, D>(max[0], max[1], max[2]));
287 }
288 else {
289 points.reserve(5);
290 points.push_back(PhysR<T, D>(min[0], min[1]));
291 points.push_back(PhysR<T, D>(min[0], max[1]));
292 points.push_back(PhysR<T, D>(max[0], min[1]));
293 points.push_back(PhysR<T, D>(max[0], max[1]));
294 }
295 points.push_back(position);
296 return points;
297 };
298
299 OstreamManager clout(std::cout, "ParticleSeeding");
300 //Create randomizer
301 util::Randomizer<T> randomizer;
302
303 std::size_t pID = spawnData.size();
304 unsigned count = 0;
305 T currVolumeOfParticles = calcParticleVolume(spawnData, getParticleVolume);
306 bool isPositionValid;
307
308 const Vector<T, D> extent = fluidDomain.getMax() - fluidDomain.getMin();
309
310 while (currVolumeOfParticles / fluidDomainVolume <
311 wantedParticleVolumeFraction &&
312 count < maxTries) {
313 isPositionValid = true;
314
315 // Randomize position
316 PhysR<T, D> randomPosition = randomizer.template generate<PhysR<T, D>>();
317 randomPosition *= extent;
318 randomPosition += fluidDomain.getMin();
319 const std::vector<PhysR<T, D>> pointsToCheck =
320 getPoints(randomPosition, getMin(pID, randomPosition),
321 getMax(pID, randomPosition));
322
323 // check overlap with other particles
324 for (std::size_t iP = 0; iP < spawnData.size(); ++iP) {
325 const PhysR<T, D> min = getMin(iP, spawnData[iP].position);
326 const PhysR<T, D> max = getMax(iP, spawnData[iP].position);
327
328 for (const PhysR<T, D>& point : pointsToCheck) {
329 /*
330 const int count = std::count(cornerPoints.begin(), cornerPoints.end(), corner);
331 if (count > 1) {
332 clout<< "WARNING: Same point was checked twice during the particle seeding";
333 }
334 */
335
336 bool overlap = true;
337 for (unsigned iD = 0; iD < D; ++iD) {
338 overlap = overlap && min[iD] <= point[iD] && max[iD] >= point[iD];
339 }
340 if (overlap) {
341 isPositionValid = false;
342 break;
343 }
344 }
345
346 if (!isPositionValid) {
347 break;
348 }
349 }
350 if (!isPositionValid) {
351 ++count;
352 continue;
353 }
354
355 // check overlap with boundaries (should work for convex geometries)
356 // for better results an iteration over the whole volume could be added
357 for (const PhysR<T, D>& point : pointsToCheck) {
358 bool isInside;
359 fluidDomain(&isInside, point.data());
360 if (!isInside) {
361 isPositionValid = false;
362 break;
363 }
364 }
365
366 if (isPositionValid) {
367 spawnData.push_back(SpawnData<T, D>(
368 randomPosition,
369 Vector<T, utilities::dimensions::convert<D>::rotation>(T {0.})));
370 count = 0;
371 currVolumeOfParticles += getParticleVolume(pID++);
372 }
373 else {
374 ++count;
375 }
376 }
377 if (count >= maxTries) {
378 clout << "WARNING: Could not set a particle volume fraction of "
379 << wantedParticleVolumeFraction
380 << ", only a particle volume fraction of "
381 << currVolumeOfParticles / fluidDomainVolume << " was possible."
382 << std::endl;
383 }
384
385 return;
386}

References calcParticleVolume(), and olb::max().

+ Here is the call graph for this function:

◆ extendSpawnData() [2/3]

template<typename T , unsigned D>
void olb::particles::creators::extendSpawnData ( std::vector< SpawnData< T, D > > & spawnData,
const T wantedParticleVolumeFraction,
IndicatorF< T, D > & fluidDomain,
const T fluidDomainVolume,
const std::function< T(const std::size_t &)> & getCircumRadius,
const std::function< T(const std::size_t &)> & getParticleVolume )

Definition at line 81 of file particleCreatorFunctions.h.

87{
88 constexpr unsigned maxTries = 1e6;
89
90 OstreamManager clout(std::cout, "ParticleSeeding");
91 //Create randomizer
92 util::Randomizer<T> randomizer;
93
94 std::size_t pID = spawnData.size();
95 unsigned count = 0;
96 T currVolumeOfParticles = calcParticleVolume(spawnData, getParticleVolume);
97 bool isPositionValid;
98
99 const Vector<T, D> extent = fluidDomain.getMax() - fluidDomain.getMin();
100
101 while (currVolumeOfParticles / fluidDomainVolume <
102 wantedParticleVolumeFraction &&
103 count < maxTries) {
104 const T circumRadius = getCircumRadius(pID);
105 isPositionValid = true;
106
107 // Randomize position
108 PhysR<T, D> randomPosition = randomizer.template generate<PhysR<T, D>>();
109 randomPosition *= extent;
110 randomPosition += fluidDomain.getMin();
111
112 // check overlap with other particles
113 std::size_t i = 0;
114 for (const SpawnData<T, D>& entry : spawnData) {
115 const T distanceCenterOfMass = norm(entry.position - randomPosition);
116 if (distanceCenterOfMass <= circumRadius + getCircumRadius(i++)) {
117 ++count;
118 isPositionValid = false;
119 break;
120 }
121 }
122 if (!isPositionValid) {
123 continue;
124 }
125
126 // check overlap with boundaries (should work for convex geometries)
127 // for better results an iteration over the whole volume could be added
128 auto pointsOnHull = particles::discrete_points_on_hull::calculate(
129 randomPosition, circumRadius);
130 for (const PhysR<T, D>& pointOnHull : pointsOnHull) {
131 bool isInside;
132 fluidDomain(&isInside, pointOnHull.data());
133 if (!isInside) {
134 isPositionValid = false;
135 break;
136 }
137 }
138
139 if (isPositionValid) {
140 spawnData.push_back(SpawnData<T, D>(
141 randomPosition,
142 Vector<T, utilities::dimensions::convert<D>::rotation>(T {0})));
143 count = 0;
144 currVolumeOfParticles += getParticleVolume(pID++);
145 }
146 else {
147 ++count;
148 }
149 }
150 if (count >= maxTries) {
151 clout << "WARNING: Could not set a particle volume fraction of "
152 << wantedParticleVolumeFraction
153 << ", only a particle volume fraction of "
154 << currVolumeOfParticles / fluidDomainVolume << " was possible."
155 << std::endl;
156 }
157
158 return;
159}
class for marking output with some text
constexpr T norm(const ScalarVector< T, D, IMPL > &a) any_platform
Euclidean vector norm.

References calcParticleVolume(), olb::particles::discrete_points_on_hull::calculate(), and olb::norm().

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

◆ extendSpawnData() [3/3]

template<typename T , unsigned D>
void olb::particles::creators::extendSpawnData ( std::vector< SpawnData< T, D > > & spawnData,
const T wantedParticleVolumeFraction,
IndicatorF< T, D > & fluidDomain,
const T fluidDomainVolume,
const T deltaX,
const T contactDetectionDistance,
const std::function< PhysR< T, D >(const std::size_t &, const PhysR< T, D > &)> & getMin,
const std::function< PhysR< T, D >(const std::size_t &, const PhysR< T, D > &)> & getMax,
const std::function< T(const std::size_t &, const SpawnData< T, D > &, const PhysR< T, D > &)> & signedDistanceToParticle,
const std::function< T(const std::size_t &)> & getParticleVolume )

Definition at line 411 of file particleCreatorFunctions.h.

422{
423 OstreamManager clout(std::cout, "ParticleSeeding");
424 constexpr unsigned maxTries = 1e6;
425
426 //Create randomizer
427 util::Randomizer<T> randomizer;
428
429 std::size_t pID = spawnData.size();
430 unsigned count = 0;
431 T currVolumeOfParticles = calcParticleVolume(spawnData, getParticleVolume);
432
433 const Vector<T, D> extent = fluidDomain.getMax() - fluidDomain.getMin();
434
435 while (currVolumeOfParticles / fluidDomainVolume <
436 wantedParticleVolumeFraction &&
437 count < maxTries) {
438 bool isPositionValid = true;
439
440 // Randomize position
441 PhysR<T, D> randomPosition = randomizer.template generate<PhysR<T, D>>();
442 randomPosition *= extent;
443 randomPosition += fluidDomain.getMin();
444
445 const PhysR<T, D> min = getMin(pID, randomPosition);
446 const PhysR<T, D> max = getMax(pID, randomPosition);
447 Vector<int, D> start;
448 Vector<int, D> end;
449 for (unsigned iD = 0; iD < D; ++iD) {
450 start[iD] = util::floor(min[iD] / deltaX);
451 end[iD] = util::ceil(max[iD] / deltaX);
452 }
453
454 const auto evalCurrentPosition = [&](const Vector<int, D>& pos,
455 bool& breakLoop) {
456 const PhysR<T, D> physPos = deltaX * pos;
457 if (signedDistanceToParticle(
458 pID,
459 SpawnData<T, D>(
460 randomPosition,
462 T {0.})),
463 physPos) < contactDetectionDistance) {
464
465 // Check wall intersection
466 if (fluidDomain.signedDistance(physPos) > -contactDetectionDistance) {
467 breakLoop = true;
468 isPositionValid = false;
469 return;
470 }
471
472 // Check intersection with particles
473 for (std::size_t i = 0; i < spawnData.size(); ++i) {
474 if (signedDistanceToParticle(i, spawnData[i], physPos) <
475 contactDetectionDistance) {
476 breakLoop = true;
477 isPositionValid = false;
478 return;
479 }
480 }
481 }
482 };
483
484 particles::contact::forEachPositionWithBreak(start, end,
485 evalCurrentPosition);
486
487 if (!isPositionValid) {
488 ++count;
489 }
490 else {
491 spawnData.push_back(SpawnData<T, D>(
492 randomPosition,
493 Vector<T, utilities::dimensions::convert<D>::rotation>(T {0})));
494 currVolumeOfParticles += getParticleVolume(pID++);
495 count = 0;
496 }
497 }
498
499 if (count >= maxTries) {
500 clout << "WARNING: Could not set a particle volume fraction of "
501 << wantedParticleVolumeFraction
502 << ", only a particle volume fraction of "
503 << currVolumeOfParticles / fluidDomainVolume << " was possible."
504 << std::endl;
505 }
506
507 return;
508}

References calcParticleVolume(), olb::util::ceil(), olb::util::floor(), and olb::particles::contact::forEachPositionWithBreak().

+ Here is the call graph for this function:

◆ prepareParallelResolvedParticle()

template<typename T , typename PARTICLETYPE >
std::set< int > olb::particles::creators::prepareParallelResolvedParticle ( SuperParticleSystem< T, PARTICLETYPE > & sParticleSystem,
Vector< T, PARTICLETYPE::d > position,
T circumRadius,
const T epsilon,
int & globiCcentre,
const T physDeltaX,
const Vector< bool, PARTICLETYPE::d > & periodicity )

Definition at line 46 of file particleParallelCreatorFunctions3D.h.

51{
52 //Retrieving cuboid geometry
53 auto& cuboidDecomposition = sParticleSystem.getSuperStructure().getCuboidDecomposition();
54 //Find globiC of particle centre
55 const bool inDomain = particles::communication::getCuboid(
56 cuboidDecomposition, periodicity, position, globiCcentre);
57 //TODO: add error handling, when !inDomain
58 if (!inDomain){
59 std::cerr << "ERROR: Particle added outside domain!" << std::endl;
60 }
61 if constexpr (access::providesContactMaterial<PARTICLETYPE>()) {
62 // without particle enlargement for contact, since it is 0 at the time of creation
63 const T detectionDistance = T{0.5} * util::sqrt(PARTICLETYPE::d) * physDeltaX;
64 const T halfEpsilon = T{0.5} * epsilon;
65 circumRadius = circumRadius - halfEpsilon + util::max(halfEpsilon, detectionDistance);
66 }
67 sParticleSystem.updateOffsetFromCircumRadius(circumRadius);
68 //Find globiCs touching the surface hull
69 std::set<int> setOfICs = communication::getSurfaceTouchingICs( sParticleSystem,
70 position, circumRadius, periodicity, globiCcentre );
71 //Add globiCcentre to list
72 setOfICs.insert(globiCcentre);
73 //Return list of iCs
74 return setOfICs;
75}

References olb::particles::communication::getCuboid(), olb::SuperStructure< T, D >::getCuboidDecomposition(), olb::particles::SuperParticleSystem< T, PARTICLETYPE >::getSuperStructure(), olb::particles::communication::getSurfaceTouchingICs(), olb::util::max(), olb::particles::access::providesContactMaterial(), olb::util::sqrt(), and olb::particles::SuperParticleSystem< T, PARTICLETYPE >::updateOffsetFromCircumRadius().

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

◆ readParticlePositions()

std::vector< std::vector< std::string > > olb::particles::creators::readParticlePositions ( const std::string & filename)

Definition at line 183 of file particleCreatorFunctions.h.

184{
185 std::vector<std::vector<std::string>> content;
186 std::vector<std::string> row;
187 std::string line, word;
188
189 std::fstream file(filename, std::ios::in);
190 if (file.is_open()) {
191 while (getline(file, line)) {
192 row.clear();
193
194 std::stringstream str(line);
195
196 while (getline(str, word, ';')) {
197 row.push_back(word);
198 }
199 content.push_back(row);
200 }
201 }
202 else {
203 std::cerr << "Could not open the file " << filename << std::endl;
204 }
205
206 return content;
207}
+ Here is the caller graph for this function:

◆ saveParticlePositions()

template<typename T , unsigned D>
void olb::particles::creators::saveParticlePositions ( const std::string & filename,
const std::vector< SpawnData< T, D > > & spawnData,
const std::function< std::string(const std::size_t &)> & evalIdentifier )

Definition at line 210 of file particleCreatorFunctions.h.

213{
214 std::ofstream file;
215 file.open(filename.c_str(), std::ios::trunc);
216 std::size_t pID = 0;
217 for (const SpawnData<T, D>& entry : spawnData) {
218 for (unsigned iD = 0; iD < D; ++iD) {
219 file << std::setprecision(16) << entry.position[iD] << ';';
220 }
221 for (unsigned iD = 0; iD < utilities::dimensions::convert<D>::rotation;
222 ++iD) {
223 file << std::setprecision(16) << entry.angleInDegree[iD] << ';';
224 }
225 file << evalIdentifier(pID++) << std::endl;
226 }
227 file.close();
228}
+ Here is the caller graph for this function:

◆ saveUpdatedParticlePositions()

template<typename T , typename PARTICLETYPE >
std::vector< SpawnData< T, PARTICLETYPE::d > > olb::particles::creators::saveUpdatedParticlePositions ( const std::string & filename,
const std::vector< SpawnData< T, PARTICLETYPE::d > > & originalSpawnData,
const std::function< std::string(const std::size_t &)> & evalIdentifier,
XParticleSystem< T, PARTICLETYPE > & particleSystem,
MPI_Comm particleCreatorComm = MPI_COMM_WORLD )

Definition at line 650 of file particleCreatorFunctions.h.

660{
661 std::vector<SpawnData<T, PARTICLETYPE::d>> spawnData =
662 updateParticlePositions<T, PARTICLETYPE>(originalSpawnData, particleSystem
663#ifdef PARALLEL_MODE_MPI
664 ,
665 particleCreatorComm
666#endif
667 );
668 saveParticlePositions(filename, spawnData, evalIdentifier);
669 return spawnData;
670}
void saveParticlePositions(const std::string &filename, const std::vector< SpawnData< T, D > > &spawnData, const std::function< std::string(const std::size_t &)> &evalIdentifier)

References saveParticlePositions(), and updateParticlePositions().

+ Here is the call graph for this function:

◆ setParticles() [1/4]

template<typename T , unsigned D>
std::vector< SpawnData< T, D > > olb::particles::creators::setParticles ( const std::string & filename,
const T wantedParticleVolumeFraction,
IndicatorF< T, D > & fluidDomain,
const T fluidDomainVolume,
const std::function< T(const std::size_t &)> & getParticleVolume,
const std::function< void(const SpawnData< T, D > &, const std::string &)> createParticle )

Definition at line 231 of file particleCreatorFunctions.h.

237{
238 std::vector<SpawnData<T, D>> spawnData;
239 std::vector<std::vector<std::string>> filecontent =
240 particles::creators::readParticlePositions(filename);
241 for (const std::vector<std::string>& line : filecontent) {
242 PhysR<T, D> particlePosition;
244 unsigned iD = 0;
245 for (; iD < D; ++iD) {
246 particlePosition[iD] = std::stod(line[iD]);
247 }
248 for (; iD < (D + utilities::dimensions::convert<D>::rotation); ++iD) {
249 particleAngle[iD - D] = std::stod(line[iD]);
250 }
251 SpawnData<T, D> tmpSpawnData(particlePosition, particleAngle);
252 spawnData.push_back(tmpSpawnData);
253 createParticle(tmpSpawnData, line[iD]);
254 }
255
256 return spawnData;
257}

References readParticlePositions().

+ Here is the call graph for this function:

◆ setParticles() [2/4]

template<typename T , unsigned D>
std::vector< SpawnData< T, D > > olb::particles::creators::setParticles ( const T wantedParticleVolumeFraction,
IndicatorF< T, D > & fluidDomain,
const T fluidDomainVolume,
const std::function< PhysR< T, D >(const std::size_t &, const PhysR< T, D > &)> & getMin,
const std::function< PhysR< T, D >(const std::size_t &, const PhysR< T, D > &)> & getMax,
const std::function< T(const std::size_t &)> & getParticleVolume,
const std::function< void(const SpawnData< T, D > &, const std::size_t &)> createParticle )

Definition at line 389 of file particleCreatorFunctions.h.

399{
400 std::vector<SpawnData<T, D>> spawnData;
401 extendSpawnData<T, D>(spawnData, wantedParticleVolumeFraction, fluidDomain,
402 fluidDomainVolume, getMin, getMax, getParticleVolume);
403
404 for (std::size_t pID = 0; pID < spawnData.size(); ++pID) {
405 createParticle(spawnData[pID], pID);
406 }
407 return spawnData;
408}

References extendSpawnData().

+ Here is the call graph for this function:

◆ setParticles() [3/4]

template<typename T , unsigned D>
std::vector< SpawnData< T, D > > olb::particles::creators::setParticles ( const T wantedParticleVolumeFraction,
IndicatorF< T, D > & fluidDomain,
const T fluidDomainVolume,
const std::function< T(const std::size_t &)> & getCircumRadius,
const std::function< T(const std::size_t &)> & getParticleVolume,
const std::function< void(const SpawnData< T, D > &, const std::size_t &)> createParticle )

Definition at line 162 of file particleCreatorFunctions.h.

169{
170 std::vector<SpawnData<T, D>> spawnData;
171 extendSpawnData<T, D>(spawnData, wantedParticleVolumeFraction, fluidDomain,
172 fluidDomainVolume, getCircumRadius, getParticleVolume);
173
174 std::size_t pID = 0;
175 for (const SpawnData<T, D>& entry : spawnData) {
176 createParticle(entry, pID++);
177 }
178
179 return spawnData;
180}

References extendSpawnData().

+ Here is the call graph for this function:

◆ setParticles() [4/4]

template<typename T , unsigned D>
std::vector< SpawnData< T, D > > olb::particles::creators::setParticles ( const T wantedParticleVolumeFraction,
IndicatorF< T, D > & fluidDomain,
const T fluidDomainVolume,
const T deltaX,
const T contactDetectionDistance,
const std::function< PhysR< T, D >(const std::size_t &, const PhysR< T, D > &)> & getMin,
const std::function< PhysR< T, D >(const std::size_t &, const PhysR< T, D > &)> & getMax,
const std::function< T(const std::size_t &, const SpawnData< T, D > &, const PhysR< T, D > &)> & signedDistanceToParticle,
const std::function< T(const std::size_t &)> & getParticleVolume,
const std::function< void(const SpawnData< T, D > &, const std::size_t &)> createParticle )

Definition at line 511 of file particleCreatorFunctions.h.

524{
525 std::vector<SpawnData<T, D>> spawnData;
526 extendSpawnData<T, D>(spawnData, wantedParticleVolumeFraction, fluidDomain,
527 fluidDomainVolume, deltaX, contactDetectionDistance,
528 getMin, getMax, signedDistanceToParticle,
529 getParticleVolume);
530
531 for (std::size_t pID = 0; pID < spawnData.size(); ++pID) {
532 createParticle(spawnData[pID], pID);
533 }
534 return spawnData;
535}

References extendSpawnData().

+ Here is the call graph for this function:

◆ setResolvedArbitraryShape2D()

template<typename T , typename PARTICLETYPE >
void olb::particles::creators::setResolvedArbitraryShape2D ( ParticleSystem< T, PARTICLETYPE > & particleSystem,
std::size_t idxParticle,
Vector< T, 2 > position,
T latticeSpacing,
std::shared_ptr< IndicatorF2D< T > > indPtr,
T epsilon,
T density = 0.,
T angle = 0.,
Vector< T, 2 > velocity = Vector<T,2> (0.) )

Set resolved cuboid for existing particle but new surface.

Set resolved arbitrary shape with given suface

Definition at line 224 of file particleCreatorFunctions2D.h.

231{
232 using namespace descriptors;
233 typedef SmoothIndicatorF2D<T, T, true> SIndicatorBaseType;
234
235 //Create SmoothIndicator
236 std::unique_ptr<SIndicatorBaseType> sIndicatorPtr(
237 new SmoothIndicatorCustom2D<T, T, true>(latticeSpacing, indPtr, Vector<T,2> (0.), epsilon, 0.));
238
239 //Pass smart pointer to particleSystem
240 auto& vectorOfIndicators = particleSystem.template getAssociatedData<
241 std::vector<std::unique_ptr<SIndicatorBaseType>>>();
242 std::size_t idxSurface = vectorOfIndicators.size();
243 vectorOfIndicators.push_back( std::move(sIndicatorPtr) );
244
246 setResolvedObject(particleSystem, idxParticle, idxSurface,
247 position, density, angle, velocity);
248}

References setResolvedObject(), and olb::particles::ParticleSystem< T, PARTICLETYPE >::size().

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

◆ setResolvedArbitraryShape3D()

template<typename T , typename PARTICLETYPE >
void olb::particles::creators::setResolvedArbitraryShape3D ( ParticleSystem< T, PARTICLETYPE > & particleSystem,
std::size_t idxParticle,
Vector< T, 3 > position,
T latticeSpacing,
std::shared_ptr< IndicatorF3D< T > > indPtr,
T epsilon,
T density = 0.,
Vector< T, 3 > angleInDegree = Vector<T,3> (0.),
Vector< T, 3 > velocity = Vector<T,3> (0.) )

Set resolved cuboid for existing particle but new surface.

Set resolved arbitrary shape with given suface

Definition at line 308 of file particleCreatorFunctions3D.h.

316{
317 using namespace descriptors;
318 typedef SmoothIndicatorF3D<T, T, true> SIndicatorBaseType;
319
320 //Create SmoothIndicator
321 std::unique_ptr<SIndicatorBaseType> sIndicatorPtr(
322 new SmoothIndicatorCustom3D<T, T, true>(latticeSpacing, indPtr, Vector<T,3> (0.), epsilon, Vector<T,3> (0.)));
323
324 //Pass smart pointer to particleSystem
325 auto& vectorOfIndicators = particleSystem.template getAssociatedData<
326 std::vector<std::unique_ptr<SIndicatorBaseType>>>();
327 std::size_t idxSurface = vectorOfIndicators.size();
328 vectorOfIndicators.push_back( std::move(sIndicatorPtr) );
329
331 setResolvedObject(particleSystem, idxParticle, idxSurface,
332 position, density, angleInDegree, velocity);
333}

References setResolvedObject(), and olb::particles::ParticleSystem< T, PARTICLETYPE >::size().

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

◆ setResolvedCircle2D()

template<typename T , typename PARTICLETYPE >
void olb::particles::creators::setResolvedCircle2D ( ParticleSystem< T, PARTICLETYPE > & particleSystem,
std::size_t idxParticle,
Vector< T, 2 > position,
T radius,
T epsilon,
T density = 0.,
Vector< T, 2 > velocity = Vector<T,2>(0.) )

Set resolved circle for existing particle but new surface.

Set resolved circle 2D with given suface

Definition at line 77 of file particleCreatorFunctions2D.h.

82{
83 using namespace descriptors;
84 typedef SmoothIndicatorF2D<T, T, true> SIndicatorBaseType;
85
86 //Create SmoothIndicator
87 std::unique_ptr<SIndicatorBaseType> sIndicatorPtr(
88 new SmoothIndicatorCircle2D<T, T, true>(Vector<T,2>(0.), radius, epsilon ));
89
90 //Pass smart pointer to particleSystem
91 auto& vectorOfIndicators = particleSystem.template getAssociatedData<
92 std::vector<std::unique_ptr<SIndicatorBaseType>>>();
93 std::size_t idxSurface = vectorOfIndicators.size();
94 vectorOfIndicators.push_back( std::move(sIndicatorPtr) );
95
96 // Safety mechanism for wrong particle type - It is better not to use rotation matrix!
97 if constexpr ( PARTICLETYPE::template providesNested<SURFACE,ROT_MATRIX>() ) {
98 OstreamManager clout(std::cout, "creatorCircle2D");
99 clout << "WARNING: A rotation matrix is provided but is not necessary for a circle." << std::endl;
100 }
101
103 setResolvedObject<T,PARTICLETYPE,true>(particleSystem, idxParticle, idxSurface,
104 position, density, 0., velocity);
105}

References setResolvedObject(), and olb::particles::ParticleSystem< T, PARTICLETYPE >::size().

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

◆ setResolvedCone3D()

template<typename T , typename PARTICLETYPE >
void olb::particles::creators::setResolvedCone3D ( ParticleSystem< T, PARTICLETYPE > & particleSystem,
std::size_t idxParticle,
const Vector< T, 3 > & position1,
const Vector< T, 3 > & position2,
T radius1,
T radius2,
T epsilon,
T density = 0,
const Vector< T, 3 > & angleInDegree = Vector<T,3> (0.),
const Vector< T, 3 > & velocity = Vector<T,3> (0.) )

Set resolved cone for existing particle but new surface.

Set resolved cone 3D with given suface

Definition at line 205 of file particleCreatorFunctions3D.h.

211{
212 using namespace descriptors;
213 typedef SmoothIndicatorF3D<T, T, true> SIndicatorBaseType;
214
215 //Create SmoothIndicator
216 std::unique_ptr<SIndicatorBaseType> sIndicatorPtr(
217 new SmoothIndicatorCone3D<T, T, true>(position1, position2, radius1, radius2, epsilon ));
218
219 //Pass smart pointer to particleSystem
220 auto& vectorOfIndicators = particleSystem.template getAssociatedData<
221 std::vector<std::unique_ptr<SIndicatorBaseType>>>();
222 std::size_t idxSurface = vectorOfIndicators.size();
223 const Vector<T,3> position = sIndicatorPtr->calcCenterOfMass();
224 vectorOfIndicators.push_back( std::move(sIndicatorPtr) );
225
227 setResolvedObject(particleSystem, idxParticle, idxSurface,
228 position, density, angleInDegree, velocity);
229}
implements a smooth particle cone in 3D with an _epsilon sector

References setResolvedObject(), and olb::particles::ParticleSystem< T, PARTICLETYPE >::size().

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

◆ setResolvedCuboid2D()

template<typename T , typename PARTICLETYPE >
void olb::particles::creators::setResolvedCuboid2D ( ParticleSystem< T, PARTICLETYPE > & particleSystem,
std::size_t idxParticle,
Vector< T, 2 > position,
Vector< T, 2 > extend,
T epsilon,
T density = 0.,
T angle = 0.,
Vector< T, 2 > velocity = Vector<T,2> (0.) )

Set resolved cuboid for existing particle but new surface.

Set resolved cuboid 3D with given suface

Definition at line 128 of file particleCreatorFunctions2D.h.

133{
134 using namespace descriptors;
135 typedef SmoothIndicatorF2D<T, T, true> SIndicatorBaseType;
136
137 //Create SmoothIndicator
138 std::unique_ptr<SIndicatorBaseType> sIndicatorPtr(
139 new SmoothIndicatorCuboid2D<T, T, true>(Vector<T,2>(0.), extend[0], extend[1], epsilon ));
140
141 //Pass smart pointer to particleSystem
142 auto& vectorOfIndicators = particleSystem.template getAssociatedData<
143 std::vector<std::unique_ptr<SIndicatorBaseType>>>();
144 std::size_t idxSurface = vectorOfIndicators.size();
145 vectorOfIndicators.push_back( std::move(sIndicatorPtr) );
146
148 setResolvedObject(particleSystem, idxParticle, idxSurface,
149 position, density, angle, velocity);
150}
implements a smooth cuboid in 2D with an _epsilon sector.

References setResolvedObject(), and olb::particles::ParticleSystem< T, PARTICLETYPE >::size().

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

◆ setResolvedCuboid3D()

template<typename T , typename PARTICLETYPE >
void olb::particles::creators::setResolvedCuboid3D ( ParticleSystem< T, PARTICLETYPE > & particleSystem,
std::size_t idxParticle,
const Vector< T, 3 > & position,
const Vector< T, 3 > & extend,
T epsilon,
T density = 0.,
const Vector< T, 3 > & angleInDegree = Vector<T,3> (0.),
const Vector< T, 3 > & velocity = Vector<T,3> (0.) )

Set resolved cuboid for existing particle but new surface.

Set resolved cuboid 3D with given suface

Definition at line 157 of file particleCreatorFunctions3D.h.

162{
163 using namespace descriptors;
164 typedef SmoothIndicatorF3D<T, T, true> SIndicatorBaseType;
165
166 //Create SmoothIndicator
167 std::unique_ptr<SIndicatorBaseType> sIndicatorPtr(
168 new SmoothIndicatorCuboid3D<T, T, true>(extend[0], extend[1], extend[2], Vector<T,3>(0.), epsilon ));
169
170 //Pass smart pointer to particleSystem
171 auto& vectorOfIndicators = particleSystem.template getAssociatedData<
172 std::vector<std::unique_ptr<SIndicatorBaseType>>>();
173 std::size_t idxSurface = vectorOfIndicators.size();
174 vectorOfIndicators.push_back( std::move(sIndicatorPtr) );
175
177 setResolvedObject(particleSystem, idxParticle, idxSurface,
178 position, density, angleInDegree, velocity);
179}

References setResolvedObject(), and olb::particles::ParticleSystem< T, PARTICLETYPE >::size().

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

◆ setResolvedCylinder3D()

template<typename T , typename PARTICLETYPE >
void olb::particles::creators::setResolvedCylinder3D ( ParticleSystem< T, PARTICLETYPE > & particleSystem,
std::size_t idxParticle,
const Vector< T, 3 > & position,
const Vector< T, 3 > & normal,
T height,
T radius,
T epsilon,
T density = 0.,
const Vector< T, 3 > & angleInDegree = Vector<T,3> (0.),
const Vector< T, 3 > & velocity = Vector<T,3> (0.) )

Set resolved cylinder for existing particle but new surface.

Set resolved cylinder 3D with given suface

Definition at line 107 of file particleCreatorFunctions3D.h.

114{
115 using namespace descriptors;
116 typedef SmoothIndicatorF3D<T, T, true> SIndicatorBaseType;
117
118 //Create SmoothIndicator
119 std::unique_ptr<SIndicatorBaseType> sIndicatorPtr(
120 new SmoothIndicatorCylinder3D<T, T, true>(Vector<T,3>(0.), normal, radius, height, epsilon ));
121
122 //Pass smart pointer to particleSystem
123 auto& vectorOfIndicators = particleSystem.template getAssociatedData<
124 std::vector<std::unique_ptr<SIndicatorBaseType>>>();
125 std::size_t idxSurface = vectorOfIndicators.size();
126 vectorOfIndicators.push_back( std::move(sIndicatorPtr) );
127
129 setResolvedObject(particleSystem, idxParticle, idxSurface,
130 position, density, angleInDegree, velocity);
131}

References setResolvedObject(), and olb::particles::ParticleSystem< T, PARTICLETYPE >::size().

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

◆ setResolvedEllipsoid3D()

template<typename T , typename PARTICLETYPE >
void olb::particles::creators::setResolvedEllipsoid3D ( ParticleSystem< T, PARTICLETYPE > & particleSystem,
std::size_t idxParticle,
const Vector< T, 3 > & position,
const Vector< T, 3 > & radius,
T epsilon,
T density = 0.,
const Vector< T, 3 > & angleInDegree = Vector<T,3> (0.),
const Vector< T, 3 > & velocity = Vector<T,3> (0.) )

Set resolved ellipsoid for existing particle but new surface.

Set resolved ellipsoid 3D with given suface

Definition at line 256 of file particleCreatorFunctions3D.h.

263{
264 using namespace descriptors;
265 typedef SmoothIndicatorF3D<T, T, true> SIndicatorBaseType;
266
267 //Create SmoothIndicator
268 std::unique_ptr<SIndicatorBaseType> sIndicatorPtr(
269 new SmoothIndicatorEllipsoid3D<T, T, true>(Vector<T,3>(0.), radius, epsilon, Vector<T,3>(0.) ));
270
271 //Pass smart pointer to particleSystem
272 auto& vectorOfIndicators = particleSystem.template getAssociatedData<
273 std::vector<std::unique_ptr<SIndicatorBaseType>>>();
274 std::size_t idxSurface = vectorOfIndicators.size();
275 vectorOfIndicators.push_back( std::move(sIndicatorPtr) );
276
278 setResolvedObject(particleSystem, idxParticle, idxSurface,
279 position, density, angleInDegree, velocity);
280}
implements a smooth particle ellipsoid in 3D with an _epsilon sector.

References setResolvedObject(), and olb::particles::ParticleSystem< T, PARTICLETYPE >::size().

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

◆ setResolvedObject() [1/2]

template<typename T , typename PARTICLETYPE , bool ROTATION_IS_OPTIONAL = false>
void olb::particles::creators::setResolvedObject ( ParticleSystem< T, PARTICLETYPE > & particleSystem,
std::size_t idxParticle,
std::size_t idxSurface,
const Vector< T, 2 > & position,
T density,
T angle,
const Vector< T, 2 > & velocity )

Definition at line 50 of file particleCreatorFunctions2D.h.

55{
56 setResolvedObject<T,PARTICLETYPE,ROTATION_IS_OPTIONAL>( particleSystem, idxParticle, idxSurface, position, density,
58}

References setResolvedObject().

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

◆ setResolvedObject() [2/2]

template<typename T , typename PARTICLETYPE , bool ROTATION_IS_OPTIONAL = false>
Particle< T, PARTICLETYPE > olb::particles::creators::setResolvedObject ( ParticleSystem< T, PARTICLETYPE > & particleSystem,
std::size_t idxParticle,
std::size_t idxSurface,
const Vector< T, PARTICLETYPE::d > & position,
T density,
Vector< T, utilities::dimensions::convert< PARTICLETYPE::d >::rotation > angleInDegree,
const Vector< T, PARTICLETYPE::d > & velocity )

Set new particle for existing surface (and return particle object)

Return new particle object

Definition at line 46 of file particleCreatorHelperFunctions.h.

53{
54 particles::creators::checkForErrors<PARTICLETYPE,ROTATION_IS_OPTIONAL>();
55
56 using namespace descriptors;
57 constexpr unsigned D = PARTICLETYPE::d;
58 typedef SmoothIndicatorF<T,T,D,true> SIndicatorBaseType;
59
60 //Retrieve smart pointer from particleSystem
61 auto& vectorOfIndicators = particleSystem.template getAssociatedData<
62 std::vector<std::unique_ptr<SIndicatorBaseType>>>();
63 auto sIndicatorPtr = vectorOfIndicators.at( idxSurface ).get();
64
65 //Initialize fields (Seems to be necessary for clang-1000.10.44.4 but not for gcc)
66 dynamics::initializeParticle<T,PARTICLETYPE>(particleSystem.get().data(), idxParticle);
67
68 //Calculate moment of inertia and mass
70 if constexpr(D==3) {
71 for (unsigned iD=0; iD<D; ++iD) {
72 momentOfInertia[iD] = sIndicatorPtr->calcMofiAndMass(density)[iD];
73 }
74 }
75 else {
76 momentOfInertia[0] = sIndicatorPtr->calcMofiAndMass(density)[0];
77 }
78
79 //Set values
80 auto particle = particleSystem.get( idxParticle );
81 particle.template setField<GENERAL,POSITION>( position );
82 particle.template setField<SURFACE,SINDICATOR>( sIndicatorPtr );
83 access::setDensity(particle, density);
84 particle.template setField<MOBILITY,VELOCITY>( velocity );
85 particle.template setField<PHYSPROPERTIES,MOFI>( utilities::dimensions::convert<D>::serialize_rotation(momentOfInertia) );
86
87 auto angle = util::degreeToRadian(angleInDegree);
88 particle.template setField<SURFACE,ANGLE>( utilities::dimensions::convert<D>::serialize_rotation(angle) );
89 if constexpr ( PARTICLETYPE::template providesNested<SURFACE,ROT_MATRIX>() ) {
90 const Vector<T,utilities::dimensions::convert<D>::matrix> rotationMatrix = util::calculateRotationMatrix<T,D>(
91 utilities::dimensions::convert<D>::serialize_rotation(angle) );
92 particle.template setField<SURFACE,ROT_MATRIX>( rotationMatrix );
93 }
94
96 return particle;
97}

References olb::util::calculateRotationMatrix(), checkForErrors(), olb::util::degreeToRadian(), olb::particles::ParticleSystem< T, PARTICLETYPE >::get(), olb::particles::dynamics::initializeParticle(), and olb::particles::access::setDensity().

+ Here is the call graph for this function:

◆ setResolvedSphere3D()

template<typename T , typename PARTICLETYPE , bool IGNORE_WARNINGS = false>
void olb::particles::creators::setResolvedSphere3D ( ParticleSystem< T, PARTICLETYPE > & particleSystem,
std::size_t idxParticle,
const Vector< T, 3 > & position,
T radius,
T epsilon,
T density = 0.,
const Vector< T, 3 > & velocity = Vector<T,3> (0.) )

Set resolved sphere for existing particle but new surface.

Set resolved sphere 3D with given suface

Definition at line 54 of file particleCreatorFunctions3D.h.

59{
60 using namespace descriptors;
61 typedef SmoothIndicatorF3D<T, T, true> SIndicatorBaseType;
62
63 //Create SmoothIndicator
64 std::unique_ptr<SIndicatorBaseType> sIndicatorPtr(
65 new SmoothIndicatorSphere3D<T, T, true>(Vector<T,3> (0.), radius, epsilon ));
66
67 //Pass smart pointer to particleSystem
68 auto& vectorOfIndicators = particleSystem.template getAssociatedData<
69 std::vector<std::unique_ptr<SIndicatorBaseType>>>();
70 std::size_t idxSurface = vectorOfIndicators.size();
71 vectorOfIndicators.push_back( std::move(sIndicatorPtr) );
72
73 // Safety mechanism for wrong particle type - It is better not to use rotation matrix!
74 if constexpr ( PARTICLETYPE::template providesNested<SURFACE,ROT_MATRIX>()
75 && !IGNORE_WARNINGS ) {
76 OstreamManager clout(std::cout, "creatorSphere3D");
77 clout << "WARNING: A rotation matrix is provided but is not necessary for a sphere." << std::endl;
78 }
79
81 setResolvedObject<T,PARTICLETYPE,true>(particleSystem, idxParticle, idxSurface,
82 position, density, Vector<T,3>(0.), velocity);
83}

References setResolvedObject(), and olb::particles::ParticleSystem< T, PARTICLETYPE >::size().

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

◆ setResolvedTriangle2D()

template<typename T , typename PARTICLETYPE >
void olb::particles::creators::setResolvedTriangle2D ( ParticleSystem< T, PARTICLETYPE > & particleSystem,
std::size_t idxParticle,
Vector< T, 2 > position,
T radius,
T epsilon,
T density = 0.,
T angle = 0.,
Vector< T, 2 > velocity = Vector<T,2> (0.) )

Set resolved cuboid for existing particle but new surface.

Set resolved triangle 2D with given suface

Definition at line 176 of file particleCreatorFunctions2D.h.

181{
182 using namespace descriptors;
183 typedef SmoothIndicatorF2D<T, T, true> SIndicatorBaseType;
184
185 //Create SmoothIndicator
186 std::unique_ptr<SIndicatorBaseType> sIndicatorPtr(
187 new SmoothIndicatorTriangle2D<T, T, true>(Vector<T,2>(0.), radius, epsilon ));
188
189 //Pass smart pointer to particleSystem
190 auto& vectorOfIndicators = particleSystem.template getAssociatedData<
191 std::vector<std::unique_ptr<SIndicatorBaseType>>>();
192 std::size_t idxSurface = vectorOfIndicators.size();
193 vectorOfIndicators.push_back( std::move(sIndicatorPtr) );
194
196 setResolvedObject(particleSystem, idxParticle, idxSurface,
197 position, density, angle, velocity);
198}
implements a smooth triangle in 2D with an _epsilon sector

References setResolvedObject(), and olb::particles::ParticleSystem< T, PARTICLETYPE >::size().

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

◆ setSubgridEulerRotationSpheroid() [1/2]

template<typename T , typename PARTICLETYPE >
void olb::particles::creators::setSubgridEulerRotationSpheroid ( ParticleSystem< T, PARTICLETYPE > & particleSystem,
std::size_t idxParticle,
const Vector< T, 3 > & position,
T length,
T diameter,
T density = 1.,
Vector< T, 3 > eul_ang = Vector<T,3> (0.,0.,0.),
Vector< T, 3 > velocity = Vector<T,3> (0.,0.,0.),
Vector< T, 3 > ang_velocity = Vector<T,3> (0.,0.,0.),
int label = 0 )

Definition at line 657 of file particleCreatorFunctions3D.h.

664{
665 using namespace descriptors;
666 using namespace access;
667
668 //Initialize fields (Seems to be necessary for clang-1000.10.44.4 but not for gcc)
669 particles::dynamics::initializeParticle<T,PARTICLETYPE>(
670 particleSystem.get().data(), idxParticle);
671 //Set values
672 T beta = length/diameter;
673 T a = diameter/2.;
674 T mass = 4./3.*M_PI*a*a*a*beta*density;//
675 //T mass = 2*M_PI*a*a*a*beta*density;//cylinder
676 Vector<T,3> mom_of_in (((1+beta*beta)*a*a)/5.*mass,((1+beta*beta)*a*a)/5.*mass, 2.*a*a/5.*mass);
677 //Vector<T,3> mom_of_in (((1./4.+1./6.*beta*beta)*a*a)*mass,((1./4.+1./6.*beta*beta)*a*a)*mass, a*a/2.*mass);//cylinder
678
679 Vector<T,3> abg0 (beta*beta/(beta*beta-1)+beta/(2*util::pow(beta*beta-1,1.5))*util::log((beta- util::sqrt(beta*beta-1))/(beta+util::sqrt(beta*beta-1))),
680 beta*beta/(beta*beta-1)+beta/(2*util::pow(beta*beta-1,1.5))*util::log((beta- util::sqrt(beta*beta-1))/(beta+util::sqrt(beta*beta-1))),
681 (-2)/(beta*beta-1)-beta/(util::pow(beta*beta-1,1.5))*util::log((beta- util::sqrt(beta*beta-1))/(beta+util::sqrt(beta*beta-1))));
682
683 auto particle = particleSystem.get( idxParticle );
684 particle.template setField<NUMERICPROPERTIES,ABG0> (abg0);
685 particle.template setField<GENERAL,POSITION>( position );
686 particle.template setField<PHYSPROPERTIES,MASS>( mass );
687 particle.template setField<NUMERICPROPERTIES,MOMENT_OF_INERTIA>( mom_of_in );
688 particle.template setField<PHYSPROPERTIES,DENSITY>( density );
689 particle.template setField<NUMERICPROPERTIES,ROT_MATRIX>(eler::computeTransformMatrixFromEulAng<T>(eul_ang));
690 particle.template setField<NUMERICPROPERTIES,QUATERNION>( eler::computeEulQuatFromEulAng<T>(eul_ang) );
691 particle.template setField<NUMERICPROPERTIES,PARAQUATERNION> (eler::getParaquaternion(particle.template getField<NUMERICPROPERTIES,QUATERNION>()));
692 particle.template setField<NUMERICPROPERTIES,ANG_VELOCITY> (ang_velocity);
693 particle.template setField<NUMERICPROPERTIES, ORIENTATION> (eler::rotate(eler::inverseTransformMatrix(particle.template getField<NUMERICPROPERTIES,ROT_MATRIX>()), Vector<T,3>(0.,0.,1.)));
694 particle.template setField<MOBILITY,VELOCITY>( velocity );
695 particle.template setField<PHYSPROPERTIES,RADIUS>( a );//equal to semi_minor_axis
696 Vector<T,3> scaling(beta*a,a,a);//semi axis saved, for whole dimensions multiply 2x
697 particle.template setField<NUMERICPROPERTIES,SCALING>( scaling); //used for visualisation in Paraview
698 Vector<T,9> dyadic(0.);
699 dyadic[0] = (16.*(beta*beta-1))/((2*beta*beta-3)*olb::util::log(beta+olb::util::sqrt(beta*beta-1))/(olb::util::sqrt(beta*beta-1))+beta);
700 dyadic[4] = dyadic[0];
701 dyadic[8] = (8.*(beta*beta-1))/((2*beta*beta-1)*olb::util::log(beta+olb::util::sqrt(beta*beta-1))/(olb::util::sqrt(beta*beta-1))-beta);
702 particle.template setField<NUMERICPROPERTIES,TRANSLATIONAL_DYADIC>( dyadic );
703 particle.template setField<NUMERICPROPERTIES,BETA> (beta);
704 particle.template setField<NUMERICPROPERTIES,LABEL> (label);
705
706 if constexpr ( providesActive(particle) ){
707 particle.template setField<DYNBEHAVIOUR,ACTIVE>( true );
708 }
709}
Expr sqrt(Expr x)
Definition expr.cpp:225
ADf< T, DIM > log(const ADf< T, DIM > &a)
Definition aDiff.h:475

References olb::particles::ParticleSystem< T, PARTICLETYPE >::get(), olb::particles::dynamics::initializeParticle(), olb::util::log(), M_PI, olb::util::pow(), and olb::util::sqrt().

+ Here is the call graph for this function:

◆ setSubgridEulerRotationSpheroid() [2/2]

template<typename T , typename PARTICLETYPE >
void olb::particles::creators::setSubgridEulerRotationSpheroid ( ParticleSystem< T, PARTICLETYPE > & particleSystem,
std::size_t idxParticle,
const Vector< T, 3 > & position,
T length,
T diameter,
T density = 1.,
Vector< T, 4 > quaternion = Vector<T,4> (0.,0.,0.,1.),
Vector< T, 3 > velocity = Vector<T,3> (0.,0.,0.),
Vector< T, 3 > ang_velocity = Vector<T,3> (0.,0.,0.),
int label = 0 )

EULER ROTATION SPHEROIDS.

Set new particle from quaternion

Definition at line 599 of file particleCreatorFunctions3D.h.

606{
607 using namespace descriptors;
608 using namespace access;
609
610
611 //Initialize fields (Seems to be necessary for clang-1000.10.44.4 but not for gcc)
612 particles::dynamics::initializeParticle<T,PARTICLETYPE>(
613 particleSystem.get().data(), idxParticle);
614 //Set values
615 T beta = length/diameter;
616 T a = diameter/2.;
617 T mass = 4./3.*M_PI*a*a*a*beta*density;//spheroid
618 //T mass = 2*M_PI*a*a*a*beta*density;//cylinder
619 Vector<T,3> mom_of_in (((1+beta*beta)*a*a)/5.*mass,((1+beta*beta)*a*a)/5.*mass, 2.*a*a/5.*mass);//spheroid
620 //Vector<T,3> mom_of_in (((1./4.+1./6.*beta*beta)*a*a)*mass,((1./4.+1./6.*beta*beta)*a*a)*mass, a*a/2.*mass);//cylinder
621
622 Vector<T,3> abg0 (beta*beta/(beta*beta-1)+beta/(2*util::pow(beta*beta-1,1.5))*util::log((beta- util::sqrt(beta*beta-1))/(beta+util::sqrt(beta*beta-1))),
623 beta*beta/(beta*beta-1)+beta/(2*util::pow(beta*beta-1,1.5))*util::log((beta- util::sqrt(beta*beta-1))/(beta+util::sqrt(beta*beta-1))),
624 (-2)/(beta*beta-1)-beta/(util::pow(beta*beta-1,1.5))*util::log((beta- util::sqrt(beta*beta-1))/(beta+util::sqrt(beta*beta-1))));
625
626 auto particle = particleSystem.get( idxParticle );
627 particle.template setField<NUMERICPROPERTIES,ABG0> (abg0);
628 particle.template setField<GENERAL,POSITION>( position );
629 particle.template setField<PHYSPROPERTIES,MASS>( mass );
630 particle.template setField<NUMERICPROPERTIES,MOMENT_OF_INERTIA>( mom_of_in );
631 particle.template setField<PHYSPROPERTIES,DENSITY>( density );
632 eler::qnormalize(quaternion);
633 particle.template setField<NUMERICPROPERTIES,ROT_MATRIX>(eler::computeTransformMatrixFromEulQuat<T>(quaternion));
634 particle.template setField<NUMERICPROPERTIES,QUATERNION>( quaternion );
635 particle.template setField<NUMERICPROPERTIES,PARAQUATERNION> (eler::getParaquaternion(particle.template getField<NUMERICPROPERTIES,QUATERNION>()));
636 particle.template setField<NUMERICPROPERTIES,ANG_VELOCITY> (ang_velocity);
637 particle.template setField<NUMERICPROPERTIES, ORIENTATION> (eler::rotate(eler::inverseTransformMatrix(particle.template getField<NUMERICPROPERTIES,ROT_MATRIX>()), Vector<T,3>(0.,0.,1.)));
638 particle.template setField<MOBILITY,VELOCITY>( velocity );
639 particle.template setField<PHYSPROPERTIES,RADIUS>( a );//equal to semi_minor_axis
640 Vector<T,3> scaling(beta*a,a,a);
641 particle.template setField<NUMERICPROPERTIES,SCALING>( scaling); //used for visualisation in Paraview
642 Vector<T,9> dyadic(0.);
643 dyadic[0] = (16.*(beta*beta-1))/((2*beta*beta-3)*olb::util::log(beta+olb::util::sqrt(beta*beta-1))/(olb::util::sqrt(beta*beta-1))+beta);
644 dyadic[4] = dyadic[0];
645 dyadic[8] = (8.*(beta*beta-1))/((2*beta*beta-1)*olb::util::log(beta+olb::util::sqrt(beta*beta-1))/(olb::util::sqrt(beta*beta-1))-beta);
646 particle.template setField<NUMERICPROPERTIES,TRANSLATIONAL_DYADIC>( dyadic );
647 particle.template setField<NUMERICPROPERTIES,BETA> (beta);
648 particle.template setField<NUMERICPROPERTIES,LABEL> (label);
649
650 if constexpr ( providesActive(particle) ){
651 particle.template setField<DYNBEHAVIOUR,ACTIVE>( true );
652 }
653}

References olb::particles::ParticleSystem< T, PARTICLETYPE >::get(), olb::particles::dynamics::initializeParticle(), olb::util::log(), M_PI, olb::util::pow(), and olb::util::sqrt().

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

◆ setSubgridHaiderLevenspielObject()

template<typename T , typename PARTICLETYPE >
void olb::particles::creators::setSubgridHaiderLevenspielObject ( ParticleSystem< T, PARTICLETYPE > & particleSystem,
std::size_t idxParticle,
const Vector< T, PARTICLETYPE::d > & position,
T radius,
T sphericity,
T mass,
T density,
const Vector< T, PARTICLETYPE::d > & velocity,
T lengthP = 1.,
T diameterP = 1. )

Set new particle.

Definition at line 374 of file particleCreatorFunctions3D.h.

380{
381 using namespace descriptors;
382 using namespace access;
383
384 //Initialize fields (Seems to be necessary for clang-1000.10.44.4 but not for gcc)
385 particles::dynamics::initializeParticle<T,PARTICLETYPE>(
386 particleSystem.get().data(), idxParticle);
387
388 //Set values
389 auto particle = particleSystem.get( idxParticle );
390 using namespace Haider_Levenspiel;
391 particle.template setField<GENERAL,POSITION>( position );
392 particle.template setField<PHYSPROPERTIES,MASS>( mass );
393 particle.template setField<PHYSPROPERTIES,DENSITY>( density );
394 particle.template setField<MOBILITY,VELOCITY>( velocity );
395 particle.template setField<PHYSPROPERTIES,RADIUS>( radius );
396 particle.template setField<NUMERICPROPERTIES, A> (util::exp(2.3288-6.4581*sphericity + 2.4486*sphericity*sphericity));
397 particle.template setField<NUMERICPROPERTIES, B> (0.0964 + 0.5565*sphericity);
398 particle.template setField<NUMERICPROPERTIES, C> (util::exp(4.905-13.8944*sphericity + 18.4222*sphericity*sphericity-10.2599*sphericity*sphericity*sphericity));
399 particle.template setField<NUMERICPROPERTIES, D> (util::exp(1.4681+12.2584*sphericity-20.7322*sphericity*sphericity+15.8855*sphericity*sphericity*sphericity));
400 if constexpr ( providesActive(particle) ){
401 particle.template setField<DYNBEHAVIOUR,ACTIVE>( true );
402 }
403 T beta = lengthP/diameterP;
404 T a = diameterP/2.;
405 Vector<T,3> scaling(beta*a,a,a);
406 particle.template setField<NUMERICPROPERTIES,SCALING>( scaling); //used for visualisation in Paraview
407
408}

References olb::util::exp(), olb::particles::ParticleSystem< T, PARTICLETYPE >::get(), and olb::particles::dynamics::initializeParticle().

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

◆ setSubgridObject()

template<typename T , typename PARTICLETYPE >
Particle< T, PARTICLETYPE > olb::particles::creators::setSubgridObject ( ParticleSystem< T, PARTICLETYPE > & particleSystem,
std::size_t idxParticle,
const Vector< T, PARTICLETYPE::d > & position,
T radius,
T density,
const Vector< T, PARTICLETYPE::d > & velocity,
T shapeFactor = T{1} )

Set new particle (and return particle object)

Return new particle object

Definition at line 125 of file particleCreatorHelperFunctions.h.

131 {1})
132{
133 using namespace descriptors;
134 using namespace access;
135 constexpr unsigned D = PARTICLETYPE::d;
137
138 //Initialize fields (Seems to be necessary for clang-1000.10.44.4 but not for gcc)
139 particles::dynamics::initializeParticle<T,PARTICLETYPE>(
140 particleSystem.get().data(), idxParticle);
141
142 //Set values
143 auto particle = particleSystem.get( idxParticle );
144 particle.template setField<GENERAL,POSITION>( position );
145 particle.template setField<MOBILITY,VELOCITY>( velocity );
146 particle.template setField<PHYSPROPERTIES,RADIUS>( radius );
147 access::setDensity(particle, density, shapeFactor);
148
149 //Calculate moment of inertia and mass
150 Vector<T,Drot> momentOfInertia;
151 T mass = access::getMass(particle, shapeFactor);
152
153 //Calculate moment of inertia and mass
154 if constexpr(D==3) {
155 momentOfInertia = Vector<T,Drot>(2./5.*mass*radius*radius);
156 } else {
157 momentOfInertia[0] = 0.5*mass*radius*radius;
158 }
159
160 particle.template setField<PHYSPROPERTIES,MOFI>( utilities::dimensions::convert<D>::serialize_rotation(momentOfInertia) );
161
163 return particle;
164}
+ Here is the caller graph for this function:

◆ setSubgridTranCongObject()

template<typename T , typename PARTICLETYPE >
void olb::particles::creators::setSubgridTranCongObject ( ParticleSystem< T, PARTICLETYPE > & particleSystem,
std::size_t idxParticle,
const Vector< T, PARTICLETYPE::d > & position,
T radius,
T c,
T A_p,
T dA_dnn,
T mass,
T density,
const Vector< T, PARTICLETYPE::d > & velocity )

Set new particle Tran Cong.

Definition at line 490 of file particleCreatorFunctions3D.h.

496{
497 using namespace descriptors;
498 using namespace access;
499
500 //Initialize fields (Seems to be necessary for clang-1000.10.44.4 but not for gcc)
501 particles::dynamics::initializeParticle<T,PARTICLETYPE>(
502 particleSystem.get().data(), idxParticle);
503 //Set values
504 auto particle = particleSystem.get( idxParticle );
505 particle.template setField<GENERAL,POSITION>( position );
506 particle.template setField<PHYSPROPERTIES,MASS>( mass );
507 particle.template setField<PHYSPROPERTIES,DENSITY>( density );
508 particle.template setField<MOBILITY,VELOCITY>( velocity );
509 particle.template setField<PHYSPROPERTIES,RADIUS>( radius );
510 particle.template setField <NUMERICPROPERTIES,CIRCULARITY> (c);
511 particle.template setField <NUMERICPROPERTIES,PROJECTED_SURFACE> (A_p);
512 particle.template setField <NUMERICPROPERTIES,DA_DN> (dA_dnn);
513
514 if constexpr ( providesActive(particle) ){
515 particle.template setField<DYNBEHAVIOUR,ACTIVE>( true );
516 }
517}

References olb::particles::ParticleSystem< T, PARTICLETYPE >::get(), and olb::particles::dynamics::initializeParticle().

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

◆ updateParticlePositions()

template<typename T , typename PARTICLETYPE >
std::vector< SpawnData< T, PARTICLETYPE::d > > olb::particles::creators::updateParticlePositions ( std::vector< SpawnData< T, PARTICLETYPE::d > > spawnData,
XParticleSystem< T, PARTICLETYPE > & particleSystem,
MPI_Comm particleCreatorComm = MPI_COMM_WORLD )

Updates particle positions so that they can be easily written to a txt file with the function above.

Definition at line 541 of file particleCreatorFunctions.h.

548{
549 using namespace descriptors;
550
551#ifdef PARALLEL_MODE_MPI
552 // Prepare a set of destination ranks from all other ranks
553 // -> every rank will know the position
554 auto& cuboidDecomposition = particleSystem.getSuperStructure().getCuboidDecomposition();
555 auto& loadBalancer = particleSystem.getSuperStructure().getLoadBalancer();
556 std::set<int> destRanksSet;
557 for (int iC = 0; iC < cuboidDecomposition.size(); ++iC) {
558 int rank = loadBalancer.rank(iC);
559 if (rank != singleton::mpi().getRank()) {
560 destRanksSet.insert(rank);
561 }
562 }
563
564 // Preparations
565 std::multimap<int, std::unique_ptr<std::uint8_t[]>> dataMap;
566 using GENERAL_EVAL =
567 typename PARTICLETYPE ::template derivedField<descriptors::GENERAL>;
568 using POSITION_EVAL =
569 typename GENERAL_EVAL ::template derivedField<descriptors::POSITION>;
570 using SURFACE_EVAL =
571 typename PARTICLETYPE ::template derivedField<descriptors::SURFACE>;
572 using ANGLE_EVAL =
573 typename SURFACE_EVAL ::template derivedField<descriptors::ANGLE>;
574
577 1);
579
580 auto communicatableID = ConcreteCommunicatable(fieldID);
581 auto communicatablePosition = ConcreteCommunicatable(fieldPosition);
582 auto communicatableAngle = ConcreteCommunicatable(fieldAngle);
583 const std::vector<unsigned int> indices {0};
584 const std::size_t serialSize = communicatableID.size(indices) +
585 communicatablePosition.size(indices) +
586 communicatableAngle.size(indices);
587
588 // Obtain data for communication
589 communication::forParticlesInSuperParticleSystem<
590 T, PARTICLETYPE,
591 conditions::valid_particle_centres //only consider center for resolved
592 >(particleSystem, [&](Particle<T, PARTICLETYPE>& particle,
593 ParticleSystem<T, PARTICLETYPE>& bParticleSystem,
594 int globiC) {
595 fieldID.setField(0, particle.template getField<PARALLELIZATION, ID>());
596 fieldPosition.setField(0, access::getPosition(particle));
597 fieldAngle.setField(0, access::getAngle(particle));
598 spawnData[fieldID.getField(0)].position = fieldPosition.getField(0);
599 spawnData[fieldID.getField(0)].angleInDegree =
600 util::radianToDegree(fieldAngle.getField(0));
601 for (const int destRank : destRanksSet) {
602 std::unique_ptr<std::uint8_t[]> buffer(new std::uint8_t[serialSize] {});
603 std::uint8_t* bufferRaw = buffer.get();
604 std::size_t serialIdx = communicatableID.serialize(indices, bufferRaw);
605 serialIdx +=
606 communicatablePosition.serialize(indices, &bufferRaw[serialIdx]);
607 serialIdx +=
608 communicatableAngle.serialize(indices, &bufferRaw[serialIdx]);
609 dataMap.insert(std::make_pair(destRank, std::move(buffer)));
610 }
611 });
612
613 //Create non blocking mpi helper
614 singleton::MpiNonBlockingHelper mpiNbHelper;
615
616 std::map<int, std::vector<std::uint8_t>> rankDataMapSorted;
617 communication::fillSendBuffer(dataMap, rankDataMapSorted, serialSize);
618
619 // Send mapped data
620 communication::sendMappedData(rankDataMapSorted, destRanksSet, serialSize,
621 particleCreatorComm, mpiNbHelper);
622
623 // Receive positions from all other ranks
624 communication::receiveAndExecuteForData(
625 destRanksSet, serialSize, particleCreatorComm, mpiNbHelper,
626 [&](int rankOrig, std::uint8_t* buffer) {
627 std::size_t serialIdx = communicatableID.deserialize(indices, buffer);
628 serialIdx +=
629 communicatablePosition.deserialize(indices, &buffer[serialIdx]);
630 serialIdx +=
631 communicatableAngle.deserialize(indices, &buffer[serialIdx]);
632
633 spawnData[fieldID.getField(0)].position = fieldPosition.getField(0);
634 spawnData[fieldID.getField(0)].angleInDegree =
635 util::radianToDegree(fieldAngle.getField(0));
636 });
637
638#else
639 for (int i = 0; i < particleSystem.size(); ++i) {
640 spawnData[i].position = access::getPosition(particleSystem.get(i));
641 spawnData[i].angleInDegree =
642 util::radianToDegree(access::getAngle(particleSystem.get(i)));
643 }
644#endif
645
646 return spawnData;
647}
SoA storage for instances of a single FIELD.

References olb::particles::communication::fillSendBuffer(), olb::particles::communication::forParticlesInSuperParticleSystem(), olb::particles::access::getAngle(), olb::FieldArrayD< T, DESCRIPTOR, PLATFORM, FIELD >::getField(), olb::particles::access::getPosition(), olb::singleton::mpi(), olb::util::radianToDegree(), olb::particles::communication::receiveAndExecuteForData(), olb::particles::communication::sendMappedData(), and olb::FieldArrayD< T, DESCRIPTOR, PLATFORM, FIELD >::setField().

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