OpenLB 1.7
Loading...
Searching...
No Matches
Classes | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
olb::ParticleSystem3D< T, PARTICLETYPE > Class Template Reference

#include <particleSystem3D.h>

+ Inheritance diagram for olb::ParticleSystem3D< T, PARTICLETYPE >:
+ Collaboration diagram for olb::ParticleSystem3D< T, PARTICLETYPE >:

Classes

struct  getMinDistPart
 Sorts the vector of neighbor Particles by increasing distance. More...
 

Public Member Functions

 ParticleSystem3D ()=default
 Default constructor for ParticleSystem.
 
 ParticleSystem3D (int iGeometry, SuperGeometry< T, 3 > &superGeometry)
 Constructor for ParticleSystem.
 
 ParticleSystem3D (const ParticleSystem3D< T, PARTICLETYPE > &pS)
 Copy constructor for ParticleSystem.
 
 ParticleSystem3D (ParticleSystem3D< T, PARTICLETYPE > &&pS)
 Move constructor for ParticleSystem.
 
virtual ~ParticleSystem3D ()
 Destructor for ParticleSystem.
 
virtual void simulate (T deltatime, bool scale=false)
 
virtual void simulateWithTwoWayCoupling_Mathias (T dT, ForwardCouplingModel< T, PARTICLETYPE > &forwardCoupling, BackCouplingModel< T, PARTICLETYPE > &backCoupling, int material, int subSteps, bool scale)
 
virtual void simulateWithTwoWayCoupling_Davide (T dT, ForwardCouplingModel< T, PARTICLETYPE > &forwardCoupling, BackCouplingModel< T, PARTICLETYPE > &backCoupling, int material, int subSteps, bool scale)
 
virtual void simulate (T deltatime, std::set< int > sActivityOfParticle, bool scale=false)
 
void printDeep (std::string message="")
 
int size ()
 Get number of particles in ParticleSystem.
 
int sizeInclShadow () const
 Get number of particles including shadow particles in ParticleSystem.
 
int numOfActiveParticles ()
 Get number of active particles in ParticleSystem.
 
int numOfForces ()
 Get number of linked forces in ParticleSystem.
 
int countMaterial (int mat=1)
 Get number of particles in vicinity of material number mat.
 
void addParticle (PARTICLETYPE< T > &p)
 Add a particle to ParticleSystem.
 
void clearParticles ()
 Removes all particles from system.
 
void addForce (std::shared_ptr< Force3D< T, PARTICLETYPE > > pF)
 Add a force to ParticleSystem.
 
void addBoundary (std::shared_ptr< Boundary3D< T, PARTICLETYPE > > pB)
 Add a boundary to ParticleSystem.
 
void addParticleOperation (std::shared_ptr< ParticleOperation3D< T, PARTICLETYPE > > pO)
 Add an operation to ParticleSystem.
 
PARTICLETYPE< T > & operator[] (const int i)
 Get reference to a particle in the ParticleSystem runs over all particles incl.
 
const PARTICLETYPE< T > & operator[] (const int i) const
 
template<typename DESCRIPTOR >
void setVelToFluidVel (SuperLatticeInterpPhysVelocity3D< T, DESCRIPTOR > &)
 Set velocity of all particles to fluid velocity.
 
void setVelToAnalyticalVel (AnalyticalConst3D< T, T > &)
 Set particle velocity to analytical velocity (e.g. as initial condition.
 
void setPosExt (std::vector< T > physPos, std::vector< T > physExtend)
 Set global coordinates and extends of Particlesystem (SI units)
 
const std::vector< T > & getPhysPos ()
 Get global coordinates and extends of Particlesystem (SI units)
 
const std::vector< T > & getPhysExtend ()
 
void saveToFile (std::string name)
 Save particle positions to file.
 
void computeForce ()
 Compute all forces on particles.
 
void computeForce (std::set< int > sActivityOfParticle)
 
void setStoredValues ()
 Stores old particle positions - is used in ..._ActExt.
 
void getMinDistParticle (std::vector< std::pair< size_t, T > > ret_matches)
 
void computeBoundary ()
 Compute boundary contact.
 
void computeParticleOperation ()
 Compute operations on particles.
 
void setContactDetection (ContactDetection< T, PARTICLETYPE > &contactDetection)
 Set boundary detection algorithm (for future features)
 
ContactDetection< T, PARTICLETYPE > * getContactDetection ()
 
void explicitEuler (T dT, bool scale=false)
 Integration method: explicit Euler if scale = true, velocity is scaled to maximal velocity maximal velocity = _superGeometry.getCuboidGeometry().getMaxDeltaR()/dT.
 
void explicitEuler (T dT, std::set< int > sActivityOfParticle, bool scale=false)
 
bool executeForwardCoupling (ForwardCouplingModel< T, PARTICLETYPE > &forwardCoupling)
 
bool executeBackwardCoupling (BackCouplingModel< T, PARTICLETYPE > &backwardCoupling, int material, int subSteps=1)
 
ContactDetection< T, PARTICLETYPE > * getDetection ()
 
int getIGeometry ()
 
std::deque< PARTICLETYPE< T > * > getParticlesPointer ()
 returns deque of pointer to particles (not shadow particles) contained in a particleSystem3D
 
std::deque< PARTICLETYPE< T > * > getAllParticlesPointer ()
 returns deque of pointer to all particles (incl.
 
std::deque< PARTICLETYPE< T > * > getShadowParticlesPointer ()
 returns deque of pointer to all shadow particles contained in a particleSystem3D
 
std::deque< PARTICLETYPE< T > > & getParticles ()
 returns deque of particles (no shadow particles) contained in a particleSystem3D
 
void removeParticle (typename std::deque< PARTICLETYPE< T > >::iterator &p)
 
std::list< std::shared_ptr< Force3D< T, PARTICLETYPE > > > getForcesPointer ()
 returns shared pointer of forces
 
void computeForce ()
 
void computeForce (std::set< int > sActivityOfParticle)
 
void explicitEuler (double dT, bool scale)
 
void explicitEuler (double dT, std::set< int > sActivityOfParticle, bool scale)
 
void explicitEuler (double dT, bool scale)
 
void explicitEuler (double dT, std::set< int > sActivityOfParticle, bool scale)
 
void computeForce ()
 
void computeForce (std::set< int > sActivityOfParticle)
 

Public Attributes

struct olb::ParticleSystem3D::getMinDistPart getMinDistPartObj
 
std::deque< std::list< PARTICLETYPE< T > * > > _Agglomerates
 Deque of Lists of agglomerated particles.
 

Protected Member Functions

void integrateTorque (T dT)
 
void integrateTorqueMag (T dT)
 
void integrateTorqueMag (T dT, std::set< int > sActivityOfParticle)
 
void resetMag ()
 
void resetMag (std::set< int > sActivityOfParticle)
 
void setOverlapZero ()
 Collision models: Todo: enable for parallel mode Resets existing particle overlaps in the event of a collision.
 
void setOverlapZeroForCombinationWithMechContactForce ()
 For the combined use of setOverlapZero() and a mechanic contact force.
 
void partialElasticImpact (T restitutionCoeff)
 Resets existing particle overlaps in the event of a collision and applies the physics of an partial elastic impact.
 
void partialElasticImpactV2 (T restitutionCoeff)
 Applies the physics of an partial elastic impact while multiple particle overlapping only to the particles with the least separation distance.
 
void partialElasticImpactForCombinationWithMechContactForce (T restitutionCoeff)
 For the combined use of partialElasticImpact() and a mechanic contact force.
 
void findAgglomerates ()
 Detects and manages particle agglomerates.
 
void initAggloParticles ()
 Adds new generated particles to the list of non agglomerated Particles.
 
void addShadowParticle (PARTICLETYPE< T > &p)
 
void velocityVerlet1 (T dT)
 Integration methods, each need a special template particle.
 
void velocityVerlet2 (T dT)
 
void rungeKutta4_1 (T dt)
 
void rungeKutta4_2 (T dt)
 
void rungeKutta4_3 (T dt)
 
void rungeKutta4_4 (T dt)
 
void rungeKutta4 (T dT)
 
void updateParticleDistribution ()
 
void integrateTorqueMag (double dT)
 
void integrateTorqueMag (double dT, std::set< int > sActivityOfParticle)
 
void resetMag ()
 
void resetMag (std::set< int > sActivityOfParticle)
 
void setOverlapZero ()
 
void setOverlapZeroForCombinationWithMechContactForce ()
 
void partialElasticImpact (double restitutionCoeff)
 
void partialElasticImpactV2 (double restitutionCoeff)
 
void partialElasticImpactForCombinationWithMechContactForce (double restitutionCoeff)
 
void findAgglomerates ()
 
void initAggloParticles ()
 
void resetMag ()
 
void resetMag (std::set< int > sActivityOfParticle)
 
void integrateTorqueMag (double dT)
 
void integrateTorqueMag (double dT, std::set< int > sActivityOfParticle)
 
void setOverlapZero ()
 
void setOverlapZeroForCombinationWithMechContactForce ()
 
void partialElasticImpact (double restitutionCoeff)
 
void partialElasticImpactV2 (double restitutionCoeff)
 
void partialElasticImpactForCombinationWithMechContactForce (double restitutionCoeff)
 
void findAgglomerates ()
 
void initAggloParticles ()
 

Protected Attributes

OstreamManager clout
 
int _iGeometry = -1
 
SuperGeometry< T, 3 > & _superGeometry
 
ContactDetection< T, PARTICLETYPE > * _contactDetection
 
SimulateParticles< T, PARTICLETYPE > _sim
 
std::deque< PARTICLETYPE< T > > _particles
 
std::deque< PARTICLETYPE< T > > _shadowParticles
 
std::list< std::shared_ptr< Force3D< T, PARTICLETYPE > > > _forces
 
std::list< std::shared_ptr< Boundary3D< T, PARTICLETYPE > > > _boundaries
 
std::list< std::shared_ptr< ParticleOperation3D< T, PARTICLETYPE > > > _particleOperations
 
std::vector< T > _physPos
 
std::vector< T > _physExtend
 

Friends

class SuperParticleSystem3D< T, PARTICLETYPE >
 Particle-Fluid interaction for subgrid scale particles.
 
class SuperParticleSysVtuWriter< T, PARTICLETYPE >
 
class SuperParticleSysVtuWriterMag< T >
 
class SimulateParticles< T, PARTICLETYPE >
 

Detailed Description

template<typename T, template< typename U > class PARTICLETYPE>
class olb::ParticleSystem3D< T, PARTICLETYPE >

Definition at line 73 of file particleSystem3D.h.

Constructor & Destructor Documentation

◆ ParticleSystem3D() [1/4]

template<typename T , template< typename U > class PARTICLETYPE>
olb::ParticleSystem3D< T, PARTICLETYPE >::ParticleSystem3D ( )
default

Default constructor for ParticleSystem.

◆ ParticleSystem3D() [2/4]

template<typename T , template< typename U > class PARTICLETYPE>
olb::ParticleSystem3D< T, PARTICLETYPE >::ParticleSystem3D ( int iGeometry,
SuperGeometry< T, 3 > & superGeometry )

Constructor for ParticleSystem.

Definition at line 51 of file particleSystem3D.hh.

53 : clout(std::cout, "ParticleSystem3D"),
54 _iGeometry(iGeometry),
55 _superGeometry(superGeometry),
56 _contactDetection(new ContactDetection<T, PARTICLETYPE>(*this)),
57 _sim(this)
58 {
59 }
ContactDetection< T, PARTICLETYPE > * _contactDetection
SuperGeometry< T, 3 > & _superGeometry
SimulateParticles< T, PARTICLETYPE > _sim

◆ ParticleSystem3D() [3/4]

template<typename T , template< typename U > class PARTICLETYPE>
olb::ParticleSystem3D< T, PARTICLETYPE >::ParticleSystem3D ( const ParticleSystem3D< T, PARTICLETYPE > & pS)

Copy constructor for ParticleSystem.

Definition at line 62 of file particleSystem3D.hh.

64 : clout(std::cout, "ParticleSystem3D"),
65 _iGeometry(pS._iGeometry),
66 _superGeometry(pS._superGeometry),
67 _contactDetection(new ContactDetection<T, PARTICLETYPE>(*this)),
68 _sim(this),
69 _physPos(pS._physPos),
70 _physExtend(pS._physExtend)
71 {
72 _particles = pS._particles;
73 _forces = pS._forces;
74 }
std::vector< T > _physPos
std::deque< PARTICLETYPE< T > > _particles
std::vector< T > _physExtend
std::list< std::shared_ptr< Force3D< T, PARTICLETYPE > > > _forces

References olb::ParticleSystem3D< T, PARTICLETYPE >::_forces, and olb::ParticleSystem3D< T, PARTICLETYPE >::_particles.

◆ ParticleSystem3D() [4/4]

template<typename T , template< typename U > class PARTICLETYPE>
olb::ParticleSystem3D< T, PARTICLETYPE >::ParticleSystem3D ( ParticleSystem3D< T, PARTICLETYPE > && pS)

Move constructor for ParticleSystem.

Definition at line 77 of file particleSystem3D.hh.

79 : clout(std::cout, "ParticleSystem3D"),
80 _iGeometry(pS._iGeometry),
81 _superGeometry(pS._superGeometry),
82 _contactDetection(new ContactDetection<T, PARTICLETYPE>(*this)),
83 _sim(this),
84 _physPos(pS._physPos),
85 _physExtend(pS._physExtend)
86 {
87 _particles = std::move(pS._particles);
88 _forces = std::move(pS._forces);
89 }

◆ ~ParticleSystem3D()

template<typename T , template< typename U > class PARTICLETYPE>
virtual olb::ParticleSystem3D< T, PARTICLETYPE >::~ParticleSystem3D ( )
inlinevirtual

Destructor for ParticleSystem.

Definition at line 89 of file particleSystem3D.h.

90 {
91 delete _contactDetection;
92 }

References olb::ParticleSystem3D< T, PARTICLETYPE >::_contactDetection.

Member Function Documentation

◆ addBoundary()

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::addBoundary ( std::shared_ptr< Boundary3D< T, PARTICLETYPE > > pB)

Add a boundary to ParticleSystem.

Definition at line 246 of file particleSystem3D.hh.

248 {
249 _boundaries.push_back(pB);
250 }
std::list< std::shared_ptr< Boundary3D< T, PARTICLETYPE > > > _boundaries

◆ addForce()

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::addForce ( std::shared_ptr< Force3D< T, PARTICLETYPE > > pF)

Add a force to ParticleSystem.

Definition at line 239 of file particleSystem3D.hh.

241 {
242 _forces.push_back(pF);
243 }
+ Here is the caller graph for this function:

◆ addParticle()

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::addParticle ( PARTICLETYPE< T > & p)

Add a particle to ParticleSystem.

Definition at line 221 of file particleSystem3D.hh.

222 {
223 _particles.push_back(p);
224 }

◆ addParticleOperation()

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::addParticleOperation ( std::shared_ptr< ParticleOperation3D< T, PARTICLETYPE > > pO)

Add an operation to ParticleSystem.

Definition at line 253 of file particleSystem3D.hh.

255 {
256 _particleOperations.push_back(pO);
257 }
std::list< std::shared_ptr< ParticleOperation3D< T, PARTICLETYPE > > > _particleOperations

◆ addShadowParticle()

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::addShadowParticle ( PARTICLETYPE< T > & p)
protected

Definition at line 233 of file particleSystem3D.hh.

234 {
235 _shadowParticles.push_back(p);
236 }
std::deque< PARTICLETYPE< T > > _shadowParticles

◆ clearParticles()

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::clearParticles ( )

Removes all particles from system.

Definition at line 227 of file particleSystem3D.hh.

228 {
229 _particles.clear();
230 }

◆ computeBoundary()

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::computeBoundary ( )

Compute boundary contact.

Definition at line 312 of file particleSystem3D.hh.

313 {
314 typename std::deque<PARTICLETYPE<T> >::iterator p;
315 for (auto f : _boundaries) {
316 for (p = _particles.begin(); p != _particles.end(); ++p) {
317 if (p->getActive()) {
318 f->applyBoundary(p, *this);
319 }
320 }
321 }
322 }

◆ computeForce() [1/6]

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::computeForce ( )

Compute all forces on particles.

Definition at line 284 of file particleSystem3D.hh.

285 {
286 typename std::deque<PARTICLETYPE<T> >::iterator p;
287 int pInt = 0;
288 for (p = _particles.begin(); p != _particles.end(); ++p, ++pInt) {
289 if (p->getActive()) {
290 p->resetForce();
291 for (auto f : _forces) {
292 f->applyForce(p, pInt, *this);
293 }
294 }
295 }
296 }
+ Here is the caller graph for this function:

◆ computeForce() [2/6]

void olb::ParticleSystem3D< double, MagneticParticle3D >::computeForce ( )

◆ computeForce() [3/6]

void olb::ParticleSystem3D< double, MagneticParticle3D >::computeForce ( )

Definition at line 1125 of file particleSystem3D.hh.

1126 {
1127 typename std::deque<MagneticParticle3D<double> >::iterator p;
1128 int pInt = 0;
1129 for (p = _particles.begin(); p != _particles.end(); ++p, ++pInt) {
1130 if (p->getActive()) {
1131
1132 for (auto f : _forces) {
1133 f->applyForce(p, pInt, *this);
1134 }
1135 }
1136 }
1137 }

◆ computeForce() [4/6]

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::computeForce ( std::set< int > sActivityOfParticle)
inline

Definition at line 155 of file particleSystem3D.h.

156 {
157 computeForce();
158 };
void computeForce()
Compute all forces on particles.

References olb::ParticleSystem3D< T, PARTICLETYPE >::computeForce().

+ Here is the call graph for this function:

◆ computeForce() [5/6]

void olb::ParticleSystem3D< double, MagneticParticle3D >::computeForce ( std::set< int > sActivityOfParticle)

◆ computeForce() [6/6]

void olb::ParticleSystem3D< double, MagneticParticle3D >::computeForce ( std::set< int > sActivityOfParticle)

Definition at line 1141 of file particleSystem3D.hh.

1142 {
1143 typename std::deque<MagneticParticle3D<double> >::iterator p;
1144 int pInt = 0;
1145 for (p = _particles.begin(); p != _particles.end(); ++p, ++pInt) {
1146
1147 if (p->getActive()) {
1148
1149 if (p->getSActivity() == 3) {
1150 continue;
1151 }
1152
1153 bool b = false;
1154 for (auto sA : sActivityOfParticle) {
1155 if (p->getSActivity() == sA) {
1156 b = true;
1157 break;
1158 }
1159 }
1160 if (b == false) {
1161 continue;
1162 }
1163
1164 for (auto f : _forces) {
1165 // f->applyForce(p, p->getID(), *this);
1166 f->applyForce(p, pInt, *this);
1167 }
1168 }
1169 }
1170 }

◆ computeParticleOperation()

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::computeParticleOperation ( )

Compute operations on particles.

Definition at line 325 of file particleSystem3D.hh.

326 {
327 typename std::deque<PARTICLETYPE<T> >::iterator p;
328 for (auto o : _particleOperations) {
329 for (p = _particles.begin(); p != _particles.end(); ++p) {
330 if (p->getActive()) {
331 o->applyParticleOperation(p, *this);
332 }
333 }
334 }
335 }

◆ countMaterial()

template<typename T , template< typename U > class PARTICLETYPE>
int olb::ParticleSystem3D< T, PARTICLETYPE >::countMaterial ( int mat = 1)

Get number of particles in vicinity of material number mat.

Definition at line 369 of file particleSystem3D.hh.

370 {
371 int num = 0;
372 int locLatCoords[3] = {0};
373 for (auto& p : _particles) {
374 _superGeometry.getCuboidGeometry().get(p.getCuboid()).getFloorLatticeR(
375 locLatCoords, &p.getPos()[0]);
376 const BlockGeometry<T,3>& bg = _superGeometry.getBlockGeometry(_superGeometry.getLoadBalancer().loc(p.getCuboid()));
377 int iX = locLatCoords[0];
378 int iY = locLatCoords[1];
379 int iZ = locLatCoords[2];
380 if (bg.get(iX, iY, iZ) == mat
381 || bg.get(iX, iY + 1, iZ) == mat
382 || bg.get(iX, iY, iZ + 1) == mat
383 || bg.get(iX, iY + 1, iZ + 1) == mat
384 || bg.get(iX + 1, iY, iZ) == mat
385 || bg.get(iX + 1, iY + 1, iZ) == mat
386 || bg.get(iX + 1, iY, iZ + 1) == mat
387 || bg.get(iX + 1, iY + 1, iZ + 1) == mat) {
388 num++;
389 }
390 }
391 return num;
392 }
BlockGeometry< T, D > & getBlockGeometry(int locIC)
Read and write access to a single block geometry.
CuboidGeometry< T, D > & getCuboidGeometry()
Read and write access to cuboid geometry.
LoadBalancer< T > & getLoadBalancer()
Read and write access to the load balancer.

References olb::BlockGeometry< T, D >::get().

+ Here is the call graph for this function:

◆ executeBackwardCoupling()

template<typename T , template< typename U > class PARTICLETYPE>
bool olb::ParticleSystem3D< T, PARTICLETYPE >::executeBackwardCoupling ( BackCouplingModel< T, PARTICLETYPE > & backwardCoupling,
int material,
int subSteps = 1 )

Definition at line 409 of file particleSystem3D.hh.

410 {
411 for (auto& p : _particles) {
412 if (p.getActive()) {
413 if (! backCoupling(&p, _iGeometry, material, subSteps) ) {
414 std::cout << "ERROR: BackwardCoupling functional failed on particle " << p.getID();
415 return false;
416 }
417 }
418 }
419 return true;
420 }

◆ executeForwardCoupling()

template<typename T , template< typename U > class PARTICLETYPE>
bool olb::ParticleSystem3D< T, PARTICLETYPE >::executeForwardCoupling ( ForwardCouplingModel< T, PARTICLETYPE > & forwardCoupling)

Definition at line 395 of file particleSystem3D.hh.

396 {
397 for (auto& p : _particles) {
398 if (p.getActive()) {
399 if (! forwardCoupling(&p, _iGeometry) ) {
400 std::cout << "ERROR: ForwardCoupling functional failed on particle " << p.getID();
401 return false;
402 }
403 }
404 }
405 return true;
406 }

◆ explicitEuler() [1/6]

void olb::ParticleSystem3D< double, MagneticParticle3D >::explicitEuler ( double dT,
bool scale )

◆ explicitEuler() [2/6]

void olb::ParticleSystem3D< double, MagneticParticle3D >::explicitEuler ( double dT,
bool scale )

Definition at line 477 of file particleSystem3D.hh.

478 {
479 double maxDeltaR = _superGeometry.getCuboidGeometry().getMaxDeltaR();
480 double maxFactor = double();
481
482 for (auto& p : _particles) {
483
484 if (p.getActive()) {
485
486 if (p.getSActivity() == 3) {
487 continue;
488 }
489
490 for (int i = 0; i < 3; i++) {
491 p.getVel()[i] += p.getForce()[i] * p.getInvEffectiveMass() * dT;
492 p.getPos()[i] += p.getVel()[i] * dT;
493
494 // computation of direction depending maxFactor to scale velocity value
495 // to keep velocity small enough for simulation
496 if (util::fabs(p.getVel()[i]) > util::fabs(maxDeltaR / dT)) {
497 maxFactor = util::max(maxFactor, util::fabs(p.getVel()[i] / maxDeltaR * dT));
498 }
499 }
500 // scaling of velocity values
501 // if particles are too fast, e.g. material boundary can not work anymore
502 if ( !util::nearZero(maxFactor) && scale) {
503 std::cout << "particle velocity is scaled because of reached limit"
504 << std::endl;
505 for (int i = 0; i < 3; i++) {
506 p.getPos()[i] -= p.getVel()[i] * dT; // position set back
507 p.getVel()[i] /= maxFactor; // scale velocity value
508 p.getPos()[i] += p.getVel()[i] * dT;
509 }
510 }
511
512 // Change sActivity of particle in dependence of its position in the geometry
513 // if ((p.getPos()[0] > 0.00015) && (p.getSActivity() == 0)) {
514 // p.setSActivity(2);
515 // }
516
517 // }
518
519 // if particles are too fast, e.g. material boundary can not work anymore
520 //#ifdef OLB_DEBUG
521 // if (p.getVel()[i] * dT > _superGeometry.getCuboidGeometry().getMaxDeltaR()) {
522 // std::cout << " PROBLEM: particle speed too high rel. to delta of "
523 // "lattice: "<< std::endl;
524 // std::cout << "p.getVel()[i]*dT: " << i <<" "<< p.getVel()[i] * dT;
525 // std::cout << "MaxDeltaR(): " <<
526 // _superGeometry.getCuboidGeometry().getMaxDeltaR() << std::endl;
527 // exit(-1);
528 // }
529 //#endif
530
531 }
532 }
533 }
cpu::simd::Pack< T > max(cpu::simd::Pack< T > rhs, cpu::simd::Pack< T > lhs)
Definition pack.h:130
cpu::simd::Pack< T > fabs(cpu::simd::Pack< T > value)
Definition pack.h:106
bool nearZero(const ADf< T, DIM > &a)
Definition aDiff.h:1087

References olb::util::fabs(), olb::util::max(), and olb::util::nearZero().

+ Here is the call graph for this function:

◆ explicitEuler() [3/6]

void olb::ParticleSystem3D< double, MagneticParticle3D >::explicitEuler ( double dT,
std::set< int > sActivityOfParticle,
bool scale )

◆ explicitEuler() [4/6]

void olb::ParticleSystem3D< double, MagneticParticle3D >::explicitEuler ( double dT,
std::set< int > sActivityOfParticle,
bool scale )

Definition at line 537 of file particleSystem3D.hh.

538 {
539 double maxDeltaR = _superGeometry.getCuboidGeometry().getMaxDeltaR();
540 double maxFactor = double();
541
542 for (auto& p : _particles) {
543
544 if (p.getActive()) {
545
546 if (p.getSActivity() == 3) {
547 continue;
548 }
549
550 bool b = false;
551 for (auto sA : sActivityOfParticle) {
552 if (p.getSActivity() == sA) {
553 b = true;
554 break;
555 }
556 }
557 if (b == false) {
558 continue;
559 }
560
561 for (int i = 0; i < 3; i++) {
562 p.getVel()[i] += p.getForce()[i] * p.getInvEffectiveMass() * dT;
563 p.getPos()[i] += p.getVel()[i] * dT;
564
565 // computation of direction depending maxFactor to scale velocity value
566 // to keep velocity small enough for simulation
567 if (util::fabs(p.getVel()[i]) > util::fabs(maxDeltaR / dT)) {
568 maxFactor = util::max(maxFactor, util::fabs(p.getVel()[i] / maxDeltaR * dT));
569 }
570 }
571 // scaling of velocity values
572 // if particles are too fast, e.g. material boundary can not work anymore
573 if ( !util::nearZero(maxFactor) && scale) {
574 std::cout << "particle velocity is scaled because of reached limit"
575 << std::endl;
576 for (int i = 0; i < 3; i++) {
577 p.getPos()[i] -= p.getVel()[i] * dT; // position set back
578 p.getVel()[i] /= maxFactor; // scale velocity value
579 p.getPos()[i] += p.getVel()[i] * dT;
580 }
581 }
582
583 // Change sActivity of particle in dependence of its position in the geometry
584 // if ((p.getPos()[0] > 0.00015) && (p.getSActivity() == 0)) {
585 // p.setSActivity(2);
586 // }
587
588 // }
589
590 // if particles are too fast, e.g. material boundary can not work anymore
591 //#ifdef OLB_DEBUG
592 // if (p.getVel()[i] * dT > _superGeometry.getCuboidGeometry().getMaxDeltaR()) {
593 // std::cout << " PROBLEM: particle speed too high rel. to delta of "
594 // "lattice: "<< std::endl;
595 // std::cout << "p.getVel()[i]*dT: " << i <<" "<< p.getVel()[i] * dT;
596 // std::cout << "MaxDeltaR(): " <<
597 // _superGeometry.getCuboidGeometry().getMaxDeltaR() << std::endl;
598 // exit(-1);
599 // }
600 //#endif
601
602 }
603 }
604 }

References olb::util::fabs(), olb::util::max(), and olb::util::nearZero().

+ Here is the call graph for this function:

◆ explicitEuler() [5/6]

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::explicitEuler ( T dT,
bool scale = false )

Integration method: explicit Euler if scale = true, velocity is scaled to maximal velocity maximal velocity = _superGeometry.getCuboidGeometry().getMaxDeltaR()/dT.

Definition at line 423 of file particleSystem3D.hh.

424 {
425 //std::cout << "explicit Euler" << std::endl;
426
427 T maxDeltaR = _superGeometry.getCuboidGeometry().getMaxDeltaR();
428 T maxFactor = T();
429
430 for (auto& p : _particles) {
431
432 if (p.getActive()) {
433
434 for (int i = 0; i < 3; i++) {
435 // std::cout <<p.getInvEffectiveMass()<< std::endl;
436 p.getVel()[i] += p.getForce()[i] * p.getInvEffectiveMass() * dT;
437 //std::cout << p.getVel()[i] << std::endl;
438 p.getPos()[i] += p.getVel()[i] * dT;
439 // std::cout << p.getPos()[i] << std::endl;
440
441 // computation of direction depending maxFactor to scale velocity value
442 // to keep velocity small enough for simulation
443 if (util::fabs(p.getVel()[i]) > util::fabs(maxDeltaR / dT)) {
444 maxFactor = util::max(maxFactor, util::fabs(p.getVel()[i] / maxDeltaR * dT));
445 }
446 }
447 // scaling of velocity values
448 // if particles are too fast, e.g. material boundary can not work anymore
449 if (!util::nearZero(maxFactor) && scale) {
450 std::cout << "particle velocity is scaled because of reached limit"
451 << std::endl;
452 for (int i = 0; i < 3; i++) {
453 p.getPos()[i] -= p.getVel()[i] * dT; // position set back
454 p.getVel()[i] /= maxFactor; // scale velocity value
455 p.getPos()[i] += p.getVel()[i] * dT;
456 }
457 }
458
459
460 // if particles are too fast, e.g. material boundary can not work anymore
461 //#ifdef OLB_DEBUG
462 // if (p.getVel()[i] * dT > _superGeometry.getCuboidGeometry().getMaxDeltaR()) {
463 // std::cout << " PROBLEM: particle speed too high rel. to delta of "
464 // "lattice: "<< std::endl;
465 // std::cout << "p.getVel()[i]*dT: " << i <<" "<< p.getVel()[i] * dT;
466 // std::cout << "MaxDeltaR(): " <<
467 // _superGeometry.getCuboidGeometry().getMaxDeltaR() << std::endl;
468 // exit(-1);
469 // }
470 //#endif
471
472 }
473 }
474 }

References olb::util::fabs(), olb::util::max(), and olb::util::nearZero().

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

◆ explicitEuler() [6/6]

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::explicitEuler ( T dT,
std::set< int > sActivityOfParticle,
bool scale = false )
inline

Definition at line 203 of file particleSystem3D.h.

204 {
205 explicitEuler(dT, scale);
206 };
void explicitEuler(T dT, bool scale=false)
Integration method: explicit Euler if scale = true, velocity is scaled to maximal velocity maximal ve...

References olb::ParticleSystem3D< T, PARTICLETYPE >::explicitEuler().

+ Here is the call graph for this function:

◆ findAgglomerates() [1/3]

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::findAgglomerates ( )
inlineprotected

Detects and manages particle agglomerates.

Definition at line 268 of file particleSystem3D.h.

268{};

◆ findAgglomerates() [2/3]

void olb::ParticleSystem3D< double, MagneticParticle3D >::findAgglomerates ( )
protected

◆ findAgglomerates() [3/3]

void olb::ParticleSystem3D< double, MagneticParticle3D >::findAgglomerates ( )
protected

Definition at line 1862 of file particleSystem3D.hh.

1863 {
1864 typename std::deque<MagneticParticle3D<double> >::iterator p;
1865 int pInt = 0;
1866
1867 for (p = _particles.begin(); p != _particles.end(); ++p, ++pInt) {
1868
1869 auto* p1 = &(*p);
1870 std::vector<std::pair<size_t, double>> ret_matches;
1871
1872 getContactDetection()->getMatches(pInt, ret_matches);
1873
1874 MagneticParticle3D<double>* p2 = NULL;
1875
1876 for (const auto& it : ret_matches) {
1877
1878 if (!util::nearZero(it.second)) {
1879
1880 p2 = &(_particles.at(it.first));
1881
1882 if ((p2->getRad() + p1->getRad()) > (util::sqrt(it.second))) {
1883
1884 // Both particles are non agglomerated
1885 // A new agglomerate is formed
1886 if ((p1->getAggloItr() == _Agglomerates.begin()) && (p2->getAggloItr() == _Agglomerates.begin())) {
1887
1888 std::list<MagneticParticle3D<double>*> aggloList{p1, p2} ;
1889
1890 typename std::list<MagneticParticle3D<double>*>::iterator x1;
1891 typename std::list<MagneticParticle3D<double>*>::iterator x2;
1892
1893 _Agglomerates.push_back(aggloList);
1894 p1->setAggloItr(_Agglomerates.end() - 1);
1895 p2->setAggloItr(_Agglomerates.end() - 1);
1896
1897 for (auto x = _Agglomerates[0].begin(); x != _Agglomerates[0].end(); ++x) {
1898
1899 if (*x == p1) {
1900 x1 = x;
1901 }
1902 if (*x == p2) {
1903 x2 = x;
1904 }
1905
1906 }
1907 _Agglomerates[0].erase(x1);
1908 _Agglomerates[0].erase(x2);
1909
1910 continue;
1911 }
1912
1913 // Particle 2 is already part of an agglomerate and Particle 1 is non agglomerated
1914 // Particle 1 is added to the agglomerate
1915 if ((p1->getAggloItr() == _Agglomerates.begin()) && (p2->getAggloItr() != _Agglomerates.begin())) {
1916
1917 (p2->getAggloItr())->push_back(p1) ;
1918 p1->setAggloItr(p2->getAggloItr()) ;
1919 typename std::list<MagneticParticle3D<double>*>::iterator x1;
1920
1921 for (auto x = _Agglomerates[0].begin(); x != _Agglomerates[0].end(); ++x) {
1922 if (*x == p1) {
1923 x1 = x;
1924 }
1925 }
1926 _Agglomerates[0].erase(x1);
1927
1928 continue;
1929 }
1930
1931 // Particle 1 is already part of an agglomerate and Particle 2 is non agglomerated
1932 // Particle 2 is added to the agglomerate
1933 if ((p1->getAggloItr() != _Agglomerates.begin()) && (p2->getAggloItr() == _Agglomerates.begin())) {
1934
1935 (p1->getAggloItr())->push_back(p2) ;
1936 p2->setAggloItr(p1->getAggloItr()) ;
1937 typename std::list<MagneticParticle3D<double>*>::iterator x2;
1938
1939 for (auto x = _Agglomerates[0].begin(); x != _Agglomerates[0].end(); ++x) {
1940 if (*x == p2) {
1941 x2 = x;
1942 }
1943 }
1944
1945 _Agglomerates[0].erase(x2);
1946
1947 continue;
1948 }
1949
1950 // Both particles are part of diffrent agglomerates
1951 // The two Agglomerates are united
1952 if (((p1->getAggloItr() != _Agglomerates.begin()) && (p2->getAggloItr() != _Agglomerates.begin())) && ( p1->getAggloItr() != p2->getAggloItr())) {
1953
1954 typename std::deque<std::list<MagneticParticle3D<double>*>>::iterator x1;
1955 typename std::deque<std::list<MagneticParticle3D<double>*>>::iterator x2;
1956
1957 if (p1->getAggloItr() <= p2->getAggloItr()) {
1958 x2 = p2->getAggloItr() ;
1959 x1 = p1->getAggloItr() ;
1960
1961 }
1962 else {
1963 x2 = p1->getAggloItr() ;
1964 x1 = p2->getAggloItr() ;
1965 }
1966
1967 x1->splice(x1->end(), *x2) ;
1968
1969 _Agglomerates.erase(x2) ;
1970
1971 for (auto anew = _Agglomerates.begin(); anew != _Agglomerates.end(); ++anew) {
1972
1973 for (auto pnew = anew->begin(); pnew != anew->end(); ++pnew) {
1974
1975 (*pnew)->setAggloItr(anew);
1976 }
1977 }
1978
1979 continue;
1980
1981 }
1982 }
1983 }
1984 }
1985 }
1986 }
std::deque< std::list< PARTICLETYPE< T > * > > _Agglomerates
Deque of Lists of agglomerated particles.
ContactDetection< T, PARTICLETYPE > * getContactDetection()
cpu::simd::Pack< T > sqrt(cpu::simd::Pack< T > value)
Definition pack.h:100

References olb::MagneticParticle3D< T >::getAggloItr(), olb::Particle3D< T >::getRad(), olb::util::nearZero(), olb::MagneticParticle3D< T >::setAggloItr(), and olb::util::sqrt().

+ Here is the call graph for this function:

◆ getAllParticlesPointer()

template<typename T , template< typename U > class PARTICLETYPE>
std::deque< PARTICLETYPE< T > * > olb::ParticleSystem3D< T, PARTICLETYPE >::getAllParticlesPointer ( )

returns deque of pointer to all particles (incl.

shadow particles) contained in a particleSystem3D

Definition at line 935 of file particleSystem3D.hh.

937 {
938 std::deque<PARTICLETYPE<T>*> pointerParticles;
939 int i = 0;
940 for (; i < (int) _particles.size(); i++) {
941 pointerParticles.push_back(&_particles[i]);
942 }
943 for (; i < (int) (_particles.size() + _shadowParticles.size()); i++) {
944 pointerParticles.push_back(&_shadowParticles[i - _particles.size()]);
945 }
946 return pointerParticles;
947 }

◆ getContactDetection()

template<typename T , template< typename U > class PARTICLETYPE>
ContactDetection< T, PARTICLETYPE > * olb::ParticleSystem3D< T, PARTICLETYPE >::getContactDetection ( )

Definition at line 92 of file particleSystem3D.hh.

93 {
94 return _contactDetection;
95 }
+ Here is the caller graph for this function:

◆ getDetection()

template<typename T , template< typename U > class PARTICLETYPE>
ContactDetection< T, PARTICLETYPE > * olb::ParticleSystem3D< T, PARTICLETYPE >::getDetection ( )
inline

Definition at line 210 of file particleSystem3D.h.

211 {
212 return _contactDetection;
213 }

References olb::ParticleSystem3D< T, PARTICLETYPE >::_contactDetection.

+ Here is the caller graph for this function:

◆ getForcesPointer()

template<typename T , template< typename U > class PARTICLETYPE>
std::list< std::shared_ptr< Force3D< T, PARTICLETYPE > > > olb::ParticleSystem3D< T, PARTICLETYPE >::getForcesPointer ( )

returns shared pointer of forces

Definition at line 929 of file particleSystem3D.hh.

930 {
931 return _forces;
932 }

◆ getIGeometry()

template<typename T , template< typename U > class PARTICLETYPE>
int olb::ParticleSystem3D< T, PARTICLETYPE >::getIGeometry ( )
inline

Definition at line 215 of file particleSystem3D.h.

216 {
217 return _iGeometry;
218 }

References olb::ParticleSystem3D< T, PARTICLETYPE >::_iGeometry.

+ Here is the caller graph for this function:

◆ getMinDistParticle()

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::getMinDistParticle ( std::vector< std::pair< size_t, T > > ret_matches)

Definition at line 1470 of file particleSystem3D.hh.

1471 {
1472 std::sort(ret_matches.begin(), ret_matches.end(), getMinDistPartObj);
1473 }
struct olb::ParticleSystem3D::getMinDistPart getMinDistPartObj

◆ getParticles()

template<typename T , template< typename U > class PARTICLETYPE>
std::deque< PARTICLETYPE< T > > & olb::ParticleSystem3D< T, PARTICLETYPE >::getParticles ( )
inline

returns deque of particles (no shadow particles) contained in a particleSystem3D

Definition at line 231 of file particleSystem3D.h.

232 {
233 return _particles;
234 }

References olb::ParticleSystem3D< T, PARTICLETYPE >::_particles.

◆ getParticlesPointer()

template<typename T , template< typename U > class PARTICLETYPE>
std::deque< PARTICLETYPE< T > * > olb::ParticleSystem3D< T, PARTICLETYPE >::getParticlesPointer ( )

returns deque of pointer to particles (not shadow particles) contained in a particleSystem3D

Definition at line 917 of file particleSystem3D.hh.

919 {
920 std::deque<PARTICLETYPE<T>*> pointerParticles;
921 for (int i = 0; i < (int) _particles.size(); i++) {
922 pointerParticles.push_back(&_particles[i]);
923 }
924 return pointerParticles;
925 }

◆ getPhysExtend()

template<typename T , template< typename U > class PARTICLETYPE>
const std::vector< T > & olb::ParticleSystem3D< T, PARTICLETYPE >::getPhysExtend ( )

Definition at line 128 of file particleSystem3D.hh.

129 {
130 return _physExtend;
131 }

◆ getPhysPos()

template<typename T , template< typename U > class PARTICLETYPE>
const std::vector< T > & olb::ParticleSystem3D< T, PARTICLETYPE >::getPhysPos ( )

Get global coordinates and extends of Particlesystem (SI units)

Definition at line 122 of file particleSystem3D.hh.

123 {
124 return _physPos;
125 }

◆ getShadowParticlesPointer()

template<typename T , template< typename U > class PARTICLETYPE>
std::deque< PARTICLETYPE< T > * > olb::ParticleSystem3D< T, PARTICLETYPE >::getShadowParticlesPointer ( )

returns deque of pointer to all shadow particles contained in a particleSystem3D

Definition at line 950 of file particleSystem3D.hh.

952 {
953 std::deque<PARTICLETYPE<T>*> pointerParticles;
954 for (int i = 0; i < (int) (_shadowParticles.size()); i++) {
955 pointerParticles.push_back(&_shadowParticles[i]);
956 }
957 return pointerParticles;
958 }

◆ initAggloParticles() [1/3]

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::initAggloParticles ( )
inlineprotected

Adds new generated particles to the list of non agglomerated Particles.

Definition at line 270 of file particleSystem3D.h.

270{};

◆ initAggloParticles() [2/3]

void olb::ParticleSystem3D< double, MagneticParticle3D >::initAggloParticles ( )
protected

◆ initAggloParticles() [3/3]

void olb::ParticleSystem3D< double, MagneticParticle3D >::initAggloParticles ( )
protected

Definition at line 1989 of file particleSystem3D.hh.

1990 {
1991 typename std::deque<MagneticParticle3D<double> >::iterator p;
1992 static int pInt = 0;
1993
1994 for (p = _particles.begin() + pInt; p != _particles.end(); ++p, ++pInt) {
1995 p->setAggloItr(_Agglomerates.begin());
1996 MagneticParticle3D<double>* pPointer = &(*p);
1997 _Agglomerates.begin()->push_back(pPointer);
1998 }
1999 }

◆ integrateTorque()

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::integrateTorque ( T dT)
protected

◆ integrateTorqueMag() [1/6]

void olb::ParticleSystem3D< double, MagneticParticle3D >::integrateTorqueMag ( double dT)
protected

◆ integrateTorqueMag() [2/6]

void olb::ParticleSystem3D< double, MagneticParticle3D >::integrateTorqueMag ( double dT)
protected

Definition at line 1211 of file particleSystem3D.hh.

1212 {
1213 for (auto& p : _particles) {
1214
1215 Vector<double, 3> deltaAngle;
1216 double angle;
1217 double epsilon = std::numeric_limits<double>::epsilon();
1218 for (int i = 0; i < 3; i++) {
1219 p.getAVel()[i] += (5. * (p.getTorque()[i]) * dT) / (2. * p.getMass() * util::pow(p.getRad(), 2));
1220 deltaAngle[i] = p.getAVel()[i] * dT;
1221 angle = norm(deltaAngle);
1222
1223 if (angle > epsilon) {
1224 std::vector<double> null(3, double());
1225 RotationRoundAxis3D<double, double> rotRAxis(null, util::fromVector3(deltaAngle), angle);
1226 double input[3] = {p.getMoment()[0], p.getMoment()[1], p.getMoment()[2]};
1227 Vector<double, 3> in(input);
1228 double output[3] = {double(), double(), double()};
1229 rotRAxis(output, input);
1230 Vector<double, 3> out(output);
1231 // renormalize output
1232 if (norm(out) > epsilon) {
1233 out = normalize(out);
1234 }
1235
1236 p.getMoment()[0] = out[0];
1237 p.getMoment()[1] = out[1];
1238 p.getMoment()[2] = out[2];
1239 }
1240 }
1241 }
1242 }
std::vector< T > fromVector3(const Vector< T, 3 > &vec)
cpu::simd::Pack< T > pow(cpu::simd::Pack< T > base, cpu::simd::Pack< T > exp)
Definition pack.h:112
constexpr T norm(const ScalarVector< T, D, IMPL > &a)
Euclidean vector norm.
constexpr Vector< T, D > normalize(const ScalarVector< T, D, IMPL > &a, T scale=T{1})
Definition vector.h:245

References olb::util::fromVector3(), olb::norm(), olb::normalize(), and olb::util::pow().

+ Here is the call graph for this function:

◆ integrateTorqueMag() [3/6]

void olb::ParticleSystem3D< double, MagneticParticle3D >::integrateTorqueMag ( double dT,
std::set< int > sActivityOfParticle )
protected

◆ integrateTorqueMag() [4/6]

void olb::ParticleSystem3D< double, MagneticParticle3D >::integrateTorqueMag ( double dT,
std::set< int > sActivityOfParticle )
protected

Definition at line 1246 of file particleSystem3D.hh.

1247 {
1248
1249 for (auto& p : _particles) {
1250
1251 if (p.getSActivity() == 3) {
1252 continue;
1253 }
1254
1255 bool b = false;
1256 for (auto sA : sActivityOfParticle) {
1257 if (p.getSActivity() == sA) {
1258 b = true;
1259 break;
1260 }
1261 }
1262 if (b == false) {
1263 continue;
1264 }
1265
1266 Vector<double, 3> deltaAngle;
1267 double angle;
1268 double epsilon = std::numeric_limits<double>::epsilon();
1269 for (int i = 0; i < 3; i++) {
1270 p.getAVel()[i] += (5. * (p.getTorque()[i]) * dT) / (2. * p.getMass() * util::pow(p.getRad(), 2));
1271 deltaAngle[i] = p.getAVel()[i] * dT;
1272 angle = norm(deltaAngle);
1273
1274 if (angle > epsilon) {
1275 std::vector<double> null(3, double());
1276 RotationRoundAxis3D<double, double> rotRAxis(null, util::fromVector3(deltaAngle), angle);
1277 double input[3] = {p.getMoment()[0], p.getMoment()[1], p.getMoment()[2]};
1278 Vector<double, 3> in(input);
1279 double output[3] = {double(), double(), double()};
1280 rotRAxis(output, input);
1281 Vector<double, 3> out(output);
1282 // renormalize output
1283 if (norm(out) > epsilon) {
1284 out = normalize(out);
1285 }
1286
1287 p.getMoment()[0] = out[0];
1288 p.getMoment()[1] = out[1];
1289 p.getMoment()[2] = out[2];
1290 }
1291 }
1292 }
1293 }

References olb::util::fromVector3(), olb::norm(), olb::normalize(), and olb::util::pow().

+ Here is the call graph for this function:

◆ integrateTorqueMag() [5/6]

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::integrateTorqueMag ( T dT)
inlineprotected

Definition at line 246 of file particleSystem3D.h.

246{};

◆ integrateTorqueMag() [6/6]

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::integrateTorqueMag ( T dT,
std::set< int > sActivityOfParticle )
inlineprotected

Definition at line 248 of file particleSystem3D.h.

248{};

◆ numOfActiveParticles()

template<typename T , template< typename U > class PARTICLETYPE>
int olb::ParticleSystem3D< T, PARTICLETYPE >::numOfActiveParticles ( )

Get number of active particles in ParticleSystem.

Definition at line 183 of file particleSystem3D.hh.

184 {
185 int activeParticles = 0;
186 for (auto p : _particles) {
187 if (p.getActive()) {
188 activeParticles++;
189 }
190 }
191 return activeParticles;
192 }

◆ numOfForces()

template<typename T , template< typename U > class PARTICLETYPE>
int olb::ParticleSystem3D< T, PARTICLETYPE >::numOfForces ( )

Get number of linked forces in ParticleSystem.

Definition at line 215 of file particleSystem3D.hh.

216 {
217 return _forces.size();
218 }

◆ operator[]() [1/2]

template<typename T , template< typename U > class PARTICLETYPE>
PARTICLETYPE< T > & olb::ParticleSystem3D< T, PARTICLETYPE >::operator[] ( const int i)

Get reference to a particle in the ParticleSystem runs over all particles incl.

shadow particles

Definition at line 134 of file particleSystem3D.hh.

135 {
136 if (i < (int) _particles.size()) {
137 return _particles[i];
138 }
139 else if (i < (int) (_particles.size() + _shadowParticles.size())) {
140 return _shadowParticles[i - _particles.size()];
141 }
142 else {
143 std::ostringstream os;
144 os << i;
145 std::string err = "Cannot access element: " + os.str()
146 + " to large";
147 throw std::runtime_error(err);
148 }
149 }

◆ operator[]() [2/2]

template<typename T , template< typename U > class PARTICLETYPE>
const PARTICLETYPE< T > & olb::ParticleSystem3D< T, PARTICLETYPE >::operator[] ( const int i) const

Definition at line 152 of file particleSystem3D.hh.

154 {
155 if ((unsigned)i < _particles.size()) {
156 return _particles[i];
157 }
158 else if (i - _particles.size() < _shadowParticles.size()) {
159 return _shadowParticles[i - _particles.size()];
160 }
161 else {
162 std::ostringstream os;
163 os << i;
164 std::string err = "Cannot access element: " + os.str()
165 + " to large";
166 throw std::runtime_error(err);
167 }
168 }

◆ partialElasticImpact() [1/3]

void olb::ParticleSystem3D< double, MagneticParticle3D >::partialElasticImpact ( double restitutionCoeff)
protected

◆ partialElasticImpact() [2/3]

void olb::ParticleSystem3D< double, MagneticParticle3D >::partialElasticImpact ( double restitutionCoeff)
protected

Definition at line 1476 of file particleSystem3D.hh.

1477 {
1478 typename std::deque<MagneticParticle3D<double> >::iterator p;
1479 int pInt = 0;
1480
1481 for (p = _particles.begin(); p != _particles.end(); ++p, ++pInt) {
1482
1483 std::vector<std::pair<size_t, double>> ret_matches;
1484 // kind of contactDetection has to be chosen in application
1485 getContactDetection()->getMatches(pInt, ret_matches);
1486
1487 MagneticParticle3D<double>* p2 = NULL;
1488
1489 // iterator walks through number of neighbored particles = ret_matches
1490 for (const auto& it : ret_matches) {
1491
1492 if (!util::nearZero(it.second)) {
1493 p2 = &(_particles.at(it.first));
1494
1495 if ((p2->getRad() + p->getRad()) > (util::sqrt(it.second))) {
1496
1497 // overlap
1498 double overlap = (p2->getRad() + p->getRad()) - util::sqrt(it.second);
1499
1500 //conVec: vector from particle1 to particle2
1501 Vector<double, 3> conVec(0., 0., 0.) ;
1502 for (int i = 0; i <= 2; i++) {
1503
1504 conVec[i] = p2->getPos()[i] - p->getPos()[i];
1505 }
1506 Vector<double, 3> conVecNormalized(conVec) ;
1507 normalize(conVecNormalized) ;
1508
1509 // Particle velocities before collision
1510 Vector<double, 3> vel1bc = {p->getVel()} ;
1511 Vector<double, 3> vel2bc = {p2->getVel()} ;
1512
1513 // Normal and tangential particle velocities before collision
1514 Vector<double, 3> velN1(0., 0., 0.) ;
1515 Vector<double, 3> velT1(0., 0., 0.) ;
1516 Vector<double, 3> velN2(0., 0., 0.) ;
1517 Vector<double, 3> velT2(0., 0., 0.) ;
1518
1519 // Particle velocities after collision
1520 Vector<double, 3> vel1ac(0., 0., 0.) ;
1521 Vector<double, 3> vel2ac(0., 0., 0.) ;
1522
1523 // Restitution coefficient
1524 double Cr = restitutionCoeff;
1525
1526 velN1 = (conVecNormalized * vel1bc) * conVecNormalized;
1527 velN2 = (conVecNormalized * vel2bc) * conVecNormalized;
1528 velT1 = vel1bc - velN1;
1529 velT2 = vel2bc - velN2;
1530 vel1ac = (Cr * p2->getMass() * ( velN2 - velN1) + (p2->getMass() * velN2) + (p->getMass() * velN1)) * (1. / (p->getMass() + p2->getMass())) ;
1531 vel2ac = (Cr * p->getMass() * ( velN1 - velN2) + (p2->getMass() * velN2) + (p->getMass() * velN1)) * (1. / (p->getMass() + p2->getMass())) ;
1532
1533 double dpos[3] = {double(0), double(0), double(0) } ;
1534
1535 // Both particles are not deposited (sActivity = 3)
1536 if ((p->getSActivity() != 3) && (p2->getSActivity() != 3)) {
1537
1538 for (int i = 0; i <= 2; i++) {
1539
1540 dpos[i] = conVecNormalized[i] * 0.5 * overlap ;
1541 p->getPos()[i] -= dpos[i] * 1. ;
1542 p->getVel()[i] = vel1ac[i] + velT1[i] ;
1543 p2->getPos()[i] += dpos[i] * 1. ;
1544 p2->getVel()[i] = vel2ac[i] + velT2[i] ;
1545 }
1546 if ((p->getSActivity() == 2) || (p->getSActivity() == 2)) {
1547 p->setSActivity(2);
1548 p2->setSActivity(2);
1549 }
1550 continue;
1551 }
1552
1553 // Particle 1 is deposited (sActivity = 3) and Particle 2 is not
1554 if ((p->getSActivity() != 3) && (p2->getSActivity() == 3)) {
1555
1556 for (int i = 0; i <= 2; i++) {
1557
1558 dpos[i] = conVecNormalized[i] * 0.5 * overlap ;
1559 p->getPos()[i] -= 2. * dpos[i];
1560 p->getVel()[i] = -1. * p->getVel()[i];
1561 }
1562 p->setSActivity(2) ;
1563 continue;
1564 }
1565
1566 // Particle 2 is deposited (sActivity = 3) and Particle 1 is not
1567 if ((p->getSActivity() == 3) && (p2->getSActivity() != 3)) {
1568
1569 for (int i = 0; i <= 2; i++) {
1570
1571 dpos[i] = conVecNormalized[i] * 0.5 * overlap ;
1572 p2->getPos()[i] += 2. * dpos[i];
1573 p2->getVel()[i] = -1. * p2->getVel()[i];
1574 }
1575 p2->setSActivity(2) ;
1576 continue;
1577 }
1578
1579 // Both particles are deposited (sActivity = 3)
1580 if ((p->getSActivity() == 3) && (p2->getSActivity() == 3)) {
1581
1582 for (int i = 0; i <= 2; i++) {
1583
1584 dpos[i] = conVecNormalized[i] * 0.5 * overlap ;
1585 p->getPos()[i] -= dpos[i];
1586 p2->getPos()[i] += dpos[i];
1587 }
1588 continue;
1589 }
1590 }
1591 }
1592 }
1593 }
1594 }

References olb::Particle3D< T >::getMass(), olb::Particle3D< T >::getPos(), olb::Particle3D< T >::getRad(), olb::MagneticParticle3D< T >::getSActivity(), olb::Particle3D< T >::getVel(), olb::util::nearZero(), olb::normalize(), olb::MagneticParticle3D< T >::setSActivity(), and olb::util::sqrt().

+ Here is the call graph for this function:

◆ partialElasticImpact() [3/3]

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::partialElasticImpact ( T restitutionCoeff)
inlineprotected

Resets existing particle overlaps in the event of a collision and applies the physics of an partial elastic impact.

Definition at line 260 of file particleSystem3D.h.

260{};

◆ partialElasticImpactForCombinationWithMechContactForce() [1/3]

void olb::ParticleSystem3D< double, MagneticParticle3D >::partialElasticImpactForCombinationWithMechContactForce ( double restitutionCoeff)
protected

◆ partialElasticImpactForCombinationWithMechContactForce() [2/3]

void olb::ParticleSystem3D< double, MagneticParticle3D >::partialElasticImpactForCombinationWithMechContactForce ( double restitutionCoeff)
protected

Definition at line 1736 of file particleSystem3D.hh.

1737 {
1738 typename std::deque<MagneticParticle3D<double> >::iterator p;
1739 int pInt = 0;
1740
1741 for (p = _particles.begin(); p != _particles.end(); ++p, ++pInt) {
1742
1743 if (p->getSActivity() > 1) {
1744 continue;
1745 }
1746
1747 std::vector<std::pair<size_t, double>> ret_matches;
1748 // kind of contactDetection has to be chosen in application
1749 getContactDetection()->getMatches(pInt, ret_matches);
1750
1751 MagneticParticle3D<double>* p2 = NULL;
1752
1753 // iterator walks through number of neighbored particles = ret_matches
1754 for (const auto& it : ret_matches) {
1755
1756 if (!util::nearZero(it.second)) {
1757 p2 = &(_particles.at(it.first));
1758
1759 if ((p2->getRad() + p->getRad()) > (util::sqrt(it.second))) {
1760
1761 // overlap
1762 double overlap = (p2->getRad() + p->getRad()) - util::sqrt(it.second);
1763
1764 // conVec: vector from particle 1 to particle 2
1765 Vector<double, 3> conVec(0., 0., 0.) ;
1766 for (int i = 0; i <= 2; i++) {
1767
1768 conVec[i] = p2->getPos()[i] - p->getPos()[i];
1769 }
1770
1771 Vector<double, 3> conVecNormalized(conVec) ;
1772 normalize(conVecNormalized) ;
1773
1774 // Particle velocities before collision
1775 Vector<double, 3> vel1bc = {p->getVel()} ;
1776 Vector<double, 3> vel2bc = {p2->getVel()} ;
1777
1778 // Normal and tangential particle velocities before collision
1779 Vector<double, 3> velN1(0., 0., 0.) ;
1780 Vector<double, 3> velT1(0., 0., 0.) ;
1781 Vector<double, 3> velN2(0., 0., 0.) ;
1782 Vector<double, 3> velT2(0., 0., 0.) ;
1783
1784 // Particle velocities after collision
1785 Vector<double, 3> vel1ac(0., 0., 0.) ;
1786 Vector<double, 3> vel2ac(0., 0., 0.) ;
1787
1788 // Restitution coeffizient
1789 double Cr = restitutionCoeff;
1790
1791 velN1 = (conVecNormalized * vel1bc) * conVecNormalized;
1792 velN2 = (conVecNormalized * vel2bc) * conVecNormalized;
1793 velT1 = vel1bc - velN1;
1794 velT2 = vel2bc - velN2;
1795 vel1ac = (Cr * p2->getMass() * ( velN2 - velN1) + (p2->getMass() * velN2) + (p->getMass() * velN1)) * (1. / (p->getMass() + p2->getMass())) ;
1796 vel2ac = (Cr * p->getMass() * ( velN1 - velN2) + (p2->getMass() * velN2) + (p->getMass() * velN1)) * (1. / (p->getMass() + p2->getMass())) ;
1797
1798 double dpos[3] = {double(0), double(0), double(0) } ;
1799
1800 // Both particles are not deposited (sActivity = 3)
1801 if ((p->getSActivity() != 3) && (p2->getSActivity() != 3)) {
1802
1803 for (int i = 0; i <= 2; i++) {
1804
1805 dpos[i] = conVecNormalized[i] * 0.5 * overlap ;
1806 p->getPos()[i] -= dpos[i] * 1. ;
1807 p->getVel()[i] = vel1ac[i] + velT1[i] ;
1808 p2->getPos()[i] += dpos[i] * 1. ;
1809 p2->getVel()[i] = vel2ac[i] + velT2[i] ;
1810 }
1811 if ((p->getSActivity() == 2) || (p->getSActivity() == 2)) {
1812 p->setSActivity(2);
1813 p2->setSActivity(2);
1814 }
1815 continue;
1816 }
1817
1818 // Particle 1 is deposited (sActivity = 3) and Particle 2 is not
1819 if ((p->getSActivity() != 3) && (p2->getSActivity() == 3)) {
1820
1821 for (int i = 0; i <= 2; i++) {
1822
1823 dpos[i] = conVecNormalized[i] * 0.5 * overlap ;
1824 p->getPos()[i] -= 2. * dpos[i];
1825 p->getVel()[i] = -1. * p->getVel()[i];
1826 }
1827 p->setSActivity(2) ;
1828 continue;
1829 }
1830
1831 // Particle 2 is deposited (sActivity = 3) and Particle 1 is not
1832 if ((p->getSActivity() == 3) && (p2->getSActivity() != 3)) {
1833
1834 for (int i = 0; i <= 2; i++) {
1835
1836 dpos[i] = conVecNormalized[i] * 0.5 * overlap ;
1837 p2->getPos()[i] += 2. * dpos[i];
1838 p2->getVel()[i] = -1. * p2->getVel()[i];
1839 }
1840 p2->setSActivity(2) ;
1841 continue;
1842 }
1843
1844 // Both particles are deposited (sActivity = 3)
1845 if ((p->getSActivity() == 3) && (p2->getSActivity() == 3)) {
1846
1847 for (int i = 0; i <= 2; i++) {
1848
1849 dpos[i] = conVecNormalized[i] * 0.5 * overlap ;
1850 p->getPos()[i] -= dpos[i];
1851 p2->getPos()[i] += dpos[i];
1852 }
1853 continue;
1854 }
1855 }
1856 }
1857 }
1858 }
1859 }

References olb::Particle3D< T >::getMass(), olb::Particle3D< T >::getPos(), olb::Particle3D< T >::getRad(), olb::MagneticParticle3D< T >::getSActivity(), olb::Particle3D< T >::getVel(), olb::util::nearZero(), olb::normalize(), olb::MagneticParticle3D< T >::setSActivity(), and olb::util::sqrt().

+ Here is the call graph for this function:

◆ partialElasticImpactForCombinationWithMechContactForce() [3/3]

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::partialElasticImpactForCombinationWithMechContactForce ( T restitutionCoeff)
inlineprotected

For the combined use of partialElasticImpact() and a mechanic contact force.

Definition at line 265 of file particleSystem3D.h.

265{};

◆ partialElasticImpactV2() [1/3]

void olb::ParticleSystem3D< double, MagneticParticle3D >::partialElasticImpactV2 ( double restitutionCoeff)
protected

◆ partialElasticImpactV2() [2/3]

void olb::ParticleSystem3D< double, MagneticParticle3D >::partialElasticImpactV2 ( double restitutionCoeff)
protected

Definition at line 1597 of file particleSystem3D.hh.

1598 {
1599 typename std::deque<MagneticParticle3D<double> >::iterator p;
1600 int pInt = 0;
1601
1602 for (p = _particles.begin(); p != _particles.end(); ++p, ++pInt) {
1603
1604 std::vector<std::pair<size_t, double>> ret_matches;
1605 // kind of contactDetection has to be chosen in application
1606 getContactDetection()->getMatches(pInt, ret_matches);
1607
1608 MagneticParticle3D<double>* p2 = NULL;
1609
1610 // iterator walks through number of neighbored particles = ret_matches
1611 if (ret_matches.size() == 1) {
1612 continue;
1613 }
1614 double minDist = 0. ;
1615 int xPInt = 0 ;
1616
1617 for (auto a : ret_matches) {
1618 if (util::nearZero(a.second)) {
1619 continue;
1620 }
1621 if (minDist == 0) {
1622 minDist = a.second;
1623 xPInt = a.first;
1624 }
1625 else {
1626 if (a.second < minDist) {
1627 minDist = a.second;
1628 xPInt = a.first;
1629 }
1630 continue;
1631 }
1632 }
1633
1634 p2 = &(_particles.at(xPInt));
1635
1636 if ((p2->getRad() + p->getRad()) > (util::sqrt(minDist))) {
1637
1638 // overlap
1639 double overlap = (p2->getRad() + p->getRad()) - util::sqrt(minDist);
1640
1641 //conVec: vector from particle 1 to particle 2
1642 Vector<double, 3> conVec(0., 0., 0.) ;
1643 for (int i = 0; i <= 2; i++) {
1644
1645 conVec[i] = p2->getPos()[i] - p->getPos()[i];
1646 }
1647 Vector<double, 3> conVecNormalized(conVec) ;
1648 normalize(conVecNormalized) ;
1649
1650 // Particle velocities before collision
1651 Vector<double, 3> vel1bc = {p->getVel()} ;
1652 Vector<double, 3> vel2bc = {p2->getVel()};
1653
1654 // Normal and tangential particle velocities before collision
1655 Vector<double, 3> velN1(0., 0., 0.) ;
1656 Vector<double, 3> velT1(0., 0., 0.) ;
1657 Vector<double, 3> velN2(0., 0., 0.) ;
1658 Vector<double, 3> velT2(0., 0., 0.) ;
1659
1660 // Particle velocities after collision
1661 Vector<double, 3> vel1ac(0., 0., 0.) ;
1662 Vector<double, 3> vel2ac(0., 0., 0.) ;
1663
1664 // Restitution coeffizient
1665 double Cr = restitutionCoeff;
1666
1667 velN1 = (conVecNormalized * vel1bc) * conVecNormalized;
1668 velN2 = (conVecNormalized * vel2bc) * conVecNormalized;
1669 velT1 = vel1bc - velN1;
1670 velT2 = vel2bc - velN2;
1671 vel1ac = (Cr * p2->getMass() * ( velN2 - velN1) + (p2->getMass() * velN2) + (p->getMass() * velN1)) * (1. / (p->getMass() + p2->getMass())) ;
1672 vel2ac = (Cr * p->getMass() * ( velN1 - velN2) + (p2->getMass() * velN2) + (p->getMass() * velN1)) * (1. / (p->getMass() + p2->getMass())) ;
1673
1674 double dpos[3] = {double(0), double(0), double(0) } ;
1675
1676 // Both particles are not deposited (sActivity = 3)
1677 if ((p->getSActivity() != 3) && (p2->getSActivity() != 3)) {
1678
1679 for (int i = 0; i <= 2; i++) {
1680
1681 dpos[i] = conVecNormalized[i] * 0.5 * overlap ;
1682 p->getPos()[i] -= dpos[i] * 1. ;
1683 p->getVel()[i] = vel1ac[i] + velT1[i] ;
1684 p2->getPos()[i] += dpos[i] * 1. ;
1685 p2->getVel()[i] = vel2ac[i] + velT2[i] ;
1686 }
1687 if ((p->getSActivity() == 2) || (p->getSActivity() == 2)) {
1688 p->setSActivity(2);
1689 p2->setSActivity(2);
1690 }
1691 continue;
1692 }
1693
1694 // Particle 1 is deposited (sActivity = 3) and Particle 2 is not
1695 if ((p->getSActivity() != 3) && (p2->getSActivity() == 3)) {
1696
1697 for (int i = 0; i <= 2; i++) {
1698
1699 dpos[i] = conVecNormalized[i] * 0.5 * overlap ;
1700 p->getPos()[i] -= 2. * dpos[i];
1701 p->getVel()[i] = -1. * p->getVel()[i];
1702 }
1703 p->setSActivity(2) ;
1704 continue;
1705 }
1706
1707 // Particle 2 is deposited (sActivity = 3) and Particle 1 is not
1708 if ((p->getSActivity() == 3) && (p2->getSActivity() != 3)) {
1709
1710 for (int i = 0; i <= 2; i++) {
1711
1712 dpos[i] = conVecNormalized[i] * 0.5 * overlap ;
1713 p2->getPos()[i] += 2. * dpos[i];
1714 p2->getVel()[i] = -1. * p2->getVel()[i];
1715 }
1716 p2->setSActivity(2) ;
1717 continue;
1718 }
1719
1720 // Both particles are not deposited (sActivity = 3)
1721 if ((p->getSActivity() == 3) && (p2->getSActivity() == 3)) {
1722
1723 for (int i = 0; i <= 2; i++) {
1724
1725 dpos[i] = conVecNormalized[i] * 0.5 * overlap ;
1726 p->getPos()[i] -= dpos[i];
1727 p2->getPos()[i] += dpos[i];
1728 }
1729 continue;
1730 }
1731 }
1732 }
1733 }

References olb::Particle3D< T >::getMass(), olb::Particle3D< T >::getPos(), olb::Particle3D< T >::getRad(), olb::MagneticParticle3D< T >::getSActivity(), olb::Particle3D< T >::getVel(), olb::util::nearZero(), olb::normalize(), olb::MagneticParticle3D< T >::setSActivity(), and olb::util::sqrt().

+ Here is the call graph for this function:

◆ partialElasticImpactV2() [3/3]

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::partialElasticImpactV2 ( T restitutionCoeff)
inlineprotected

Applies the physics of an partial elastic impact while multiple particle overlapping only to the particles with the least separation distance.

Definition at line 263 of file particleSystem3D.h.

263{};

◆ printDeep()

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::printDeep ( std::string message = "")

Definition at line 98 of file particleSystem3D.hh.

99 {
100 std::deque<PARTICLETYPE<T>*> allParticles = this->getAllParticlesPointer();
101 for (auto p : allParticles) {
102 p->printDeep("");
103 }
104 }
std::deque< PARTICLETYPE< T > * > getAllParticlesPointer()
returns deque of pointer to all particles (incl.

◆ removeParticle()

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::removeParticle ( typename std::deque< PARTICLETYPE< T > >::iterator & p)

◆ resetMag() [1/6]

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::resetMag ( )
inlineprotected

Definition at line 249 of file particleSystem3D.h.

249{};

◆ resetMag() [2/6]

void olb::ParticleSystem3D< double, MagneticParticle3D >::resetMag ( )
protected

◆ resetMag() [3/6]

void olb::ParticleSystem3D< double, MagneticParticle3D >::resetMag ( )
protected

Definition at line 1080 of file particleSystem3D.hh.

1081 {
1082 typename std::deque<MagneticParticle3D<double> >::iterator p;
1083 int pInt = 0;
1084 for (p = _particles.begin(); p != _particles.end(); ++p, ++pInt) {
1085
1086 if (p->getActive()) {
1087
1088 p->resetForce();
1089 p->resetTorque();
1090 }
1091 }
1092 }

◆ resetMag() [4/6]

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::resetMag ( std::set< int > sActivityOfParticle)
inlineprotected

Definition at line 251 of file particleSystem3D.h.

251{};

◆ resetMag() [5/6]

void olb::ParticleSystem3D< double, MagneticParticle3D >::resetMag ( std::set< int > sActivityOfParticle)
protected

◆ resetMag() [6/6]

void olb::ParticleSystem3D< double, MagneticParticle3D >::resetMag ( std::set< int > sActivityOfParticle)
protected

Definition at line 1096 of file particleSystem3D.hh.

1097 {
1098 typename std::deque<MagneticParticle3D<double> >::iterator p;
1099 int pInt = 0;
1100 for (p = _particles.begin(); p != _particles.end(); ++p, ++pInt) {
1101
1102 if (p->getSActivity() == 3) {
1103 continue;
1104 }
1105
1106 if (p->getActive()) {
1107 bool b = false;
1108 for (auto sA : sActivityOfParticle) {
1109 if (p->getSActivity() == sA) {
1110 b = true;
1111 break;
1112 }
1113 }
1114 if (b == false) {
1115 continue;
1116 }
1117 p->resetForce();
1118 p->resetTorque();
1119 }
1120 }
1121 }

◆ rungeKutta4()

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::rungeKutta4 ( T dT)
protected

◆ rungeKutta4_1()

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::rungeKutta4_1 ( T dt)
protected

◆ rungeKutta4_2()

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::rungeKutta4_2 ( T dt)
protected

◆ rungeKutta4_3()

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::rungeKutta4_3 ( T dt)
protected

◆ rungeKutta4_4()

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::rungeKutta4_4 ( T dt)
protected

◆ saveToFile()

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::saveToFile ( std::string name)

Save particle positions to file.

Definition at line 961 of file particleSystem3D.hh.

962 {
963 std::ofstream fout(fullName.c_str(), std::ios::app);
964 if (!fout) {
965 clout << "Error: could not open " << fullName << std::endl;
966 }
967 std::vector<T> serPar(PARTICLETYPE<T>::serialPartSize, 0);
968 for (auto& p : _particles) {
969 p.serialize(&serPar[0]);
970 typename std::vector<T>::iterator it = serPar.begin();
971 for (; it != serPar.end(); ++it) {
972 fout << *it << " ";
973 }
974 fout << std::endl;
975 //fout << p.getPos()[0] << " " << p.getPos()[1] << " " << p.getPos()[2] << " " << p.getVel()[0] << " " << p.getVel()[1] << " "<< p.getVel()[2] << std::endl;
976 }
977 fout.close();
978 }

◆ setContactDetection()

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::setContactDetection ( ContactDetection< T, PARTICLETYPE > & contactDetection)

Set boundary detection algorithm (for future features)

Definition at line 107 of file particleSystem3D.hh.

108 {
109 delete _contactDetection;
110 _contactDetection = contactDetection.generate(*this);
111 }

◆ setOverlapZero() [1/3]

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::setOverlapZero ( )
inlineprotected

Collision models: Todo: enable for parallel mode Resets existing particle overlaps in the event of a collision.

Definition at line 255 of file particleSystem3D.h.

255{};

◆ setOverlapZero() [2/3]

void olb::ParticleSystem3D< double, MagneticParticle3D >::setOverlapZero ( )
protected

◆ setOverlapZero() [3/3]

void olb::ParticleSystem3D< double, MagneticParticle3D >::setOverlapZero ( )
protected

Definition at line 1310 of file particleSystem3D.hh.

1311 {
1312
1313 typename std::deque<MagneticParticle3D<double> >::iterator p;
1314 int pInt = 0;
1315 for (p = _particles.begin(); p != _particles.end(); ++p, ++pInt) {
1316
1317 std::vector<std::pair<size_t, double>> ret_matches;
1318 // kind of contactDetection has to be chosen in application
1319 getContactDetection()->getMatches(pInt, ret_matches);
1320
1321 MagneticParticle3D<double>* p2 = NULL;
1322
1323 // iterator walks through number of neighbored particles = ret_matches
1324 for (const auto& it : ret_matches) {
1325
1326 if (!util::nearZero(it.second)) {
1327 p2 = &(_particles.at(it.first)); //p2 = &pSys[it.first];
1328
1329 if ((p2->getRad() + p->getRad()) > (util::sqrt(it.second))) {
1330
1331 // overlap
1332 double overlap = (p2->getRad() + p->getRad()) - util::sqrt(it.second);
1333
1334 //conVec: vector from particle1 to particle2
1335 Vector<double, 3> conVec(0., 0., 0.) ;
1336 for (int i = 0; i <= 2; i++) {
1337
1338 conVec[i] = p2->getPos()[i] - p->getPos()[i];
1339 }
1340 Vector<double, 3> conVecNormalized(conVec) ;
1341 normalize(conVecNormalized) ;
1342
1343 double dpos[3] = {double(0), double(0), double(0) } ;
1344
1345 // Both particles are not deposited (sActivity = 3)
1346 if ((p->getSActivity() != 3) && (p2->getSActivity() != 3)) {
1347
1348 for (int i = 0; i <= 2; i++) {
1349
1350 dpos[i] = conVecNormalized[i] * 0.5 * overlap ;
1351 p->getPos()[i] -= 1.* dpos[i];
1352 p2->getPos()[i] += 1.* dpos[i];
1353 }
1354 if ((p->getSActivity() == 2) || (p->getSActivity() == 2)) {
1355 p->setSActivity(2);
1356 p2->setSActivity(2);
1357 }
1358 continue;
1359 }
1360
1361 // Particle 1 is deposited (sActivity = 3) and Particle 2 is not
1362 if ((p->getSActivity() != 3) && (p2->getSActivity() == 3)) {
1363
1364 for (int i = 0; i <= 2; i++) {
1365
1366 dpos[i] = conVecNormalized[i] * 0.5 * overlap ;
1367 p->getPos()[i] -= 2. * dpos[i];
1368 }
1369 p->setSActivity(2) ;
1370 }
1371
1372 // Particle 2 is deposited (sActivity = 3) and Particle 1 is not
1373 if ((p->getSActivity() == 3) && (p2->getSActivity() != 3)) {
1374
1375 for (int i = 0; i <= 2; i++) {
1376
1377 dpos[i] = conVecNormalized[i] * 0.5 * overlap ;
1378 p2->getPos()[i] += 2. * dpos[i];
1379 }
1380 p2->setSActivity(2) ;
1381 }
1382
1383 // Both particles are not deposited (sActivity = 3)
1384 if ((p->getSActivity() == 3) && (p2->getSActivity() == 3)) {
1385
1386 for (int i = 0; i <= 2; i++) {
1387
1388 dpos[i] = conVecNormalized[i] * 0.5 * overlap ;
1389 p->getPos()[i] -= dpos[i];
1390 p2->getPos()[i] += dpos[i];
1391 }
1392 }
1393 }
1394 }
1395 }
1396 }
1397 }

References olb::Particle3D< T >::getPos(), olb::Particle3D< T >::getRad(), olb::MagneticParticle3D< T >::getSActivity(), olb::util::nearZero(), olb::normalize(), olb::MagneticParticle3D< T >::setSActivity(), and olb::util::sqrt().

+ Here is the call graph for this function:

◆ setOverlapZeroForCombinationWithMechContactForce() [1/3]

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::setOverlapZeroForCombinationWithMechContactForce ( )
inlineprotected

For the combined use of setOverlapZero() and a mechanic contact force.

Definition at line 257 of file particleSystem3D.h.

257{};

◆ setOverlapZeroForCombinationWithMechContactForce() [2/3]

void olb::ParticleSystem3D< double, MagneticParticle3D >::setOverlapZeroForCombinationWithMechContactForce ( )
protected

◆ setOverlapZeroForCombinationWithMechContactForce() [3/3]

void olb::ParticleSystem3D< double, MagneticParticle3D >::setOverlapZeroForCombinationWithMechContactForce ( )
protected

Definition at line 1400 of file particleSystem3D.hh.

1401 {
1402
1403 typename std::deque<MagneticParticle3D<double> >::iterator p;
1404 int pInt = 0;
1405
1406 for (p = _particles.begin(); p != _particles.end(); ++p, ++pInt) {
1407
1408 if (p->getSActivity() > 1) {
1409 continue;
1410 }
1411
1412 std::vector<std::pair<size_t, double>> ret_matches;
1413 // kind of contactDetection has to be chosen in application
1414 getContactDetection()->getMatches(pInt, ret_matches);
1415
1416 MagneticParticle3D<double>* p2 = NULL;
1417 // iterator walks through number of neighbored particles = ret_matches
1418 for (const auto& it : ret_matches) {
1419 if (!util::nearZero(it.second)) {
1420 p2 = &(_particles.at(it.first)); //p2 = &pSys[it.first];
1421
1422 if ((p2->getRad() + p->getRad()) > (util::sqrt(it.second))) {
1423 // overlap
1424 double overlap = (p2->getRad() + p->getRad()) - util::sqrt(it.second);
1425
1426 //conVec: vector from particle1 to particle2
1427 Vector<double, 3> conVec(0., 0., 0.) ;
1428 for (int i = 0; i <= 2; i++) {
1429
1430 conVec[i] = p2->getPos()[i] - p->getPos()[i];
1431 }
1432 Vector<double, 3> conVecNormalized(conVec) ;
1433 normalize(conVecNormalized) ;
1434
1435 double dpos[3] = {double(0), double(0), double(0) } ;
1436
1437 // Both particles are not deposited
1438 if (overlap > p2->getRad() + p->getRad()) {
1439
1440 if (p2->getSActivity() == 1) {
1441
1442 for (int i = 0; i <= 2; i++) {
1443
1444 dpos[i] = conVecNormalized[i] * 0.5 * overlap ;
1445 p->getPos()[i] -= dpos[i] * 1. ;
1446 p2->getPos()[i] += dpos[i] * 1. ;
1447 }
1448 continue;
1449 }
1450 }
1451
1452 // Particle 2 is out of the sphere of influence of setOverlapZeroForCombinationWithMechContactForce()
1453 // Particle 1 is transferred to the influence of the mechanic contact force
1454 else {
1455 for (int i = 0; i <= 2; i++) {
1456
1457 dpos[i] = conVecNormalized[i] * 0.5 * overlap ;
1458 p->getPos()[i] -= 2 * dpos[i];
1459 }
1460 p->setSActivity(2);
1461 continue;
1462 }
1463 }
1464 }
1465 }
1466 }
1467 }

References olb::Particle3D< T >::getPos(), olb::Particle3D< T >::getRad(), olb::MagneticParticle3D< T >::getSActivity(), olb::util::nearZero(), olb::normalize(), and olb::util::sqrt().

+ Here is the call graph for this function:

◆ setPosExt()

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::setPosExt ( std::vector< T > physPos,
std::vector< T > physExtend )

Set global coordinates and extends of Particlesystem (SI units)

Definition at line 114 of file particleSystem3D.hh.

116 {
117 _physPos = physPos;
118 _physExtend = physExtend;
119 }

◆ setStoredValues()

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::setStoredValues ( )

Stores old particle positions - is used in ..._ActExt.

Definition at line 1296 of file particleSystem3D.hh.

1297 {
1298
1299 typename std::deque<PARTICLETYPE<T> >::iterator p;
1300 int pInt = 0;
1301 for (p = _particles.begin(); p != _particles.end(); ++p, ++pInt) {
1302
1303 p->setStoredPos(p->getPos());
1304 // p->setStoredVel(p->getVel());
1305 // p->setStoreForce(p->getForce());
1306 }
1307 }

◆ setVelToAnalyticalVel()

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::setVelToAnalyticalVel ( AnalyticalConst3D< T, T > & aVel)

Set particle velocity to analytical velocity (e.g. as initial condition.

Definition at line 272 of file particleSystem3D.hh.

274 {
275 for (auto& p : _particles) {
276 if (p.getActive()) {
277 std::vector<T> vel(3, T());
278 aVel(&p.getVel()[0], &p.getPos()[0]);
279 }
280 }
281 }

◆ setVelToFluidVel()

template<typename T , template< typename U > class PARTICLETYPE>
template<typename DESCRIPTOR >
void olb::ParticleSystem3D< T, PARTICLETYPE >::setVelToFluidVel ( SuperLatticeInterpPhysVelocity3D< T, DESCRIPTOR > & fVel)

Set velocity of all particles to fluid velocity.

Definition at line 261 of file particleSystem3D.hh.

263 {
264 for (auto& p : _particles) {
265 if (p.getActive()) {
266 fVel(&p.getVel()[0], &p.getPos()[0], p.getCuboid());
267 }
268 }
269 }

◆ simulate() [1/2]

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::simulate ( T deltatime,
bool scale = false )
virtual

Definition at line 338 of file particleSystem3D.hh.

339 {
340 _sim.simulate(dT, scale);
341 }

◆ simulate() [2/2]

template<typename T , template< typename U > class MagneticParticle3D>
void olb::ParticleSystem3D< T, MagneticParticle3D >::simulate ( T deltatime,
std::set< int > sActivityOfParticle,
bool scale = false )
virtual

Definition at line 363 of file particleSystem3D.hh.

364 {
365 _sim.simulate(dT, sActivity, scale);
366 }

◆ simulateWithTwoWayCoupling_Davide()

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::simulateWithTwoWayCoupling_Davide ( T dT,
ForwardCouplingModel< T, PARTICLETYPE > & forwardCoupling,
BackCouplingModel< T, PARTICLETYPE > & backCoupling,
int material,
int subSteps,
bool scale )
virtual

Definition at line 353 of file particleSystem3D.hh.

357 {
358 _sim.simulateWithTwoWayCoupling_Davide(dT, forwardCoupling, backCoupling, material, subSteps, scale);
359 }

◆ simulateWithTwoWayCoupling_Mathias()

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::simulateWithTwoWayCoupling_Mathias ( T dT,
ForwardCouplingModel< T, PARTICLETYPE > & forwardCoupling,
BackCouplingModel< T, PARTICLETYPE > & backCoupling,
int material,
int subSteps,
bool scale )
virtual

Definition at line 344 of file particleSystem3D.hh.

348 {
349 _sim.simulateWithTwoWayCoupling_Mathias(dT, forwardCoupling, backCoupling, material, subSteps, scale);
350 }

◆ size()

template<typename T , template< typename U > class PARTICLETYPE>
int olb::ParticleSystem3D< T, PARTICLETYPE >::size ( )

Get number of particles in ParticleSystem.

Definition at line 171 of file particleSystem3D.hh.

172 {
173 return _particles.size();
174 }

◆ sizeInclShadow()

template<typename T , template< typename U > class PARTICLETYPE>
int olb::ParticleSystem3D< T, PARTICLETYPE >::sizeInclShadow ( ) const

Get number of particles including shadow particles in ParticleSystem.

Definition at line 177 of file particleSystem3D.hh.

178 {
179 return _particles.size() + _shadowParticles.size();
180 }

◆ updateParticleDistribution()

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::updateParticleDistribution ( )
protected

◆ velocityVerlet1()

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::velocityVerlet1 ( T dT)
protected

Integration methods, each need a special template particle.

Definition at line 759 of file particleSystem3D.hh.

760 {
761 for (auto& p : _particles) {
762 if (p.getActive()) {
763 std::vector<T> pos = p.getPos();
764 for (int i = 0; i < 3; i++) {
765 pos[i] += p.getVel()[i] * dT
766 + .5 * p.getForce()[i] / p.getMass() * util::pow(dT, 2);
767 }
768 p.setPos(pos);
769 }
770 }
771 }

References olb::util::pow().

+ Here is the call graph for this function:

◆ velocityVerlet2()

template<typename T , template< typename U > class PARTICLETYPE>
void olb::ParticleSystem3D< T, PARTICLETYPE >::velocityVerlet2 ( T dT)
protected

Definition at line 774 of file particleSystem3D.hh.

775 {
776 std::vector<T> frc;
777 std::vector<T> vel;
778 typename std::deque<PARTICLETYPE<T> >::iterator p;
779 int pInt = 0;
780 for (p = _particles.begin(); p != _particles.end(); ++p, ++pInt) {
781 // for (auto& p : _particles) {
782 if (p->getActive()) {
783 frc = p->getForce();
784 vel = p->getVel();
785 p->resetForce();
786 for (auto f : _forces) {
787 f->applyForce(p, pInt, *this);
788 }
789 for (int i = 0; i < 3; i++) {
790 vel[i] += .5 * (p->getForce()[i] + frc[i]) / p->getMass() * dT;
791 }
792 p->setVel(vel);
793 }
794 }
795 }

Friends And Related Symbol Documentation

◆ SimulateParticles< T, PARTICLETYPE >

template<typename T , template< typename U > class PARTICLETYPE>
friend class SimulateParticles< T, PARTICLETYPE >
friend

Definition at line 180 of file particleSystem3D.h.

◆ SuperParticleSystem3D< T, PARTICLETYPE >

template<typename T , template< typename U > class PARTICLETYPE>
friend class SuperParticleSystem3D< T, PARTICLETYPE >
friend

Particle-Fluid interaction for subgrid scale particles.

Definition at line 180 of file particleSystem3D.h.

◆ SuperParticleSysVtuWriter< T, PARTICLETYPE >

template<typename T , template< typename U > class PARTICLETYPE>
friend class SuperParticleSysVtuWriter< T, PARTICLETYPE >
friend

Definition at line 180 of file particleSystem3D.h.

◆ SuperParticleSysVtuWriterMag< T >

template<typename T , template< typename U > class PARTICLETYPE>
friend class SuperParticleSysVtuWriterMag< T >
friend

Definition at line 180 of file particleSystem3D.h.

Member Data Documentation

◆ _Agglomerates

template<typename T , template< typename U > class PARTICLETYPE>
std::deque<std::list<PARTICLETYPE<T>*> > olb::ParticleSystem3D< T, PARTICLETYPE >::_Agglomerates

Deque of Lists of agglomerated particles.

Definition at line 242 of file particleSystem3D.h.

◆ _boundaries

template<typename T , template< typename U > class PARTICLETYPE>
std::list<std::shared_ptr<Boundary3D<T, PARTICLETYPE> > > olb::ParticleSystem3D< T, PARTICLETYPE >::_boundaries
protected

Definition at line 284 of file particleSystem3D.h.

◆ _contactDetection

template<typename T , template< typename U > class PARTICLETYPE>
ContactDetection<T, PARTICLETYPE>* olb::ParticleSystem3D< T, PARTICLETYPE >::_contactDetection
protected

Definition at line 277 of file particleSystem3D.h.

◆ _forces

template<typename T , template< typename U > class PARTICLETYPE>
std::list<std::shared_ptr<Force3D<T, PARTICLETYPE> > > olb::ParticleSystem3D< T, PARTICLETYPE >::_forces
protected

Definition at line 283 of file particleSystem3D.h.

◆ _iGeometry

template<typename T , template< typename U > class PARTICLETYPE>
int olb::ParticleSystem3D< T, PARTICLETYPE >::_iGeometry = -1
protected

Definition at line 275 of file particleSystem3D.h.

◆ _particleOperations

template<typename T , template< typename U > class PARTICLETYPE>
std::list<std::shared_ptr<ParticleOperation3D<T, PARTICLETYPE> > > olb::ParticleSystem3D< T, PARTICLETYPE >::_particleOperations
protected

Definition at line 285 of file particleSystem3D.h.

◆ _particles

template<typename T , template< typename U > class PARTICLETYPE>
std::deque<PARTICLETYPE<T> > olb::ParticleSystem3D< T, PARTICLETYPE >::_particles
protected

Definition at line 280 of file particleSystem3D.h.

◆ _physExtend

template<typename T , template< typename U > class PARTICLETYPE>
std::vector<T> olb::ParticleSystem3D< T, PARTICLETYPE >::_physExtend
protected

Definition at line 288 of file particleSystem3D.h.

◆ _physPos

template<typename T , template< typename U > class PARTICLETYPE>
std::vector<T> olb::ParticleSystem3D< T, PARTICLETYPE >::_physPos
protected

Definition at line 287 of file particleSystem3D.h.

◆ _shadowParticles

template<typename T , template< typename U > class PARTICLETYPE>
std::deque<PARTICLETYPE<T> > olb::ParticleSystem3D< T, PARTICLETYPE >::_shadowParticles
protected

Definition at line 282 of file particleSystem3D.h.

◆ _sim

template<typename T , template< typename U > class PARTICLETYPE>
SimulateParticles<T, PARTICLETYPE> olb::ParticleSystem3D< T, PARTICLETYPE >::_sim
protected

Definition at line 278 of file particleSystem3D.h.

◆ _superGeometry

template<typename T , template< typename U > class PARTICLETYPE>
SuperGeometry<T,3>& olb::ParticleSystem3D< T, PARTICLETYPE >::_superGeometry
protected

Definition at line 276 of file particleSystem3D.h.

◆ clout

template<typename T , template< typename U > class PARTICLETYPE>
OstreamManager olb::ParticleSystem3D< T, PARTICLETYPE >::clout
mutableprotected

Definition at line 274 of file particleSystem3D.h.

◆ getMinDistPartObj

template<typename T , template< typename U > class PARTICLETYPE>
struct olb::ParticleSystem3D::getMinDistPart olb::ParticleSystem3D< T, PARTICLETYPE >::getMinDistPartObj

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