24#ifndef PARTICLE_DYNAMICS_BASE_HH
25#define PARTICLE_DYNAMICS_BASE_HH
34template <
typename T,
typename PARTICLETYPE>
40template <
typename T,
typename PARTICLETYPE>
47template<
typename T,
typename PARTICLETYPE>
50 this->getName() =
"NoParticleDynamics";
53template<
typename T,
typename PARTICLETYPE>
60template<
typename T,
typename PARTICLETYPE,
typename PCONDITION>
63 this->getName() =
"VerletParticleDynamics";
66template<
typename T,
typename PARTICLETYPE,
typename PCONDITION>
70 using namespace particles::access;
72 doWhenMeetingCondition<T,PARTICLETYPE,PCONDITION>( particle,[&](){
74 auto acceleration = getAcceleration( particle );
76 if constexpr ( providesAngle<PARTICLETYPE>() ) {
78 auto angularAcceleration = getAngAcceleration( particle );
81 particle, timeStepSize, acceleration, angularAcceleration );
83 if constexpr ( providesRotationMatrix<PARTICLETYPE>() ) {
91 timeStepSize, timeStepSize*timeStepSize, acceleration );
97template<
typename T,
typename PARTICLETYPE,
typename PCONDITION>
100 this->getName() =
"VerletParticleDynamicsTranslationOnly";
103template<
typename T,
typename PARTICLETYPE,
typename PCONDITION>
107 using namespace particles::access;
109 doWhenMeetingCondition<T,PARTICLETYPE,PCONDITION>( particle,[&](){
111 auto acceleration = getAcceleration( particle );
114 particle, timeStepSize, timeStepSize*timeStepSize, acceleration );
119template<
typename T,
typename PARTICLETYPE,
typename PCONDITION>
122 this->getName() =
"VerletParticleDynamicsRotationOnly";
125template<
typename T,
typename PARTICLETYPE,
typename PCONDITION>
129 using namespace particles::access;
131 doWhenMeetingCondition<T,PARTICLETYPE,PCONDITION>( particle,[&](){
133 auto angularAcceleration = getAngAcceleration( particle );
136 particle, timeStepSize, timeStepSize*timeStepSize, angularAcceleration );
138 if constexpr ( providesRotationMatrix<PARTICLETYPE>() ) {
145template<
typename T,
typename PARTICLETYPE,
typename PCONDITION>
149 this->getName() =
"VerletParticleDynamicsRotor";
152template<
typename T,
typename PARTICLETYPE,
typename PCONDITION>
156 using namespace particles::access;
158 doWhenMeetingCondition<T,PARTICLETYPE,PCONDITION>( particle,[&](){
161 particle, timeStepSize, _angVel );
163 if constexpr ( providesRotationMatrix<PARTICLETYPE>() ) {
171template<
typename T,
typename PARTICLETYPE,
bool useCubicBounds,
typename PCONDITION>
175 : _solidBoundary(solidBoundary)
177 this->
getName() =
"VerletParticleDynamicsVelocityWallReflection";
181template<
typename T,
typename PARTICLETYPE,
bool useCubicBounds,
typename PCONDITION>
188 boundaries::velocityWallReflection<useCubicBounds>(particle, _solidBoundary);
192template<
typename T,
typename PARTICLETYPE,
bool useCubicBounds,
typename PCONDITION>
196 : _solidBoundary(solidBoundary)
198 this->
getName() =
"VerletParticleDynamicsWallCapture";
202template<
typename T,
typename PARTICLETYPE,
bool useCubicBounds,
typename PCONDITION>
209 boundaries::wallCapture<useCubicBounds>(particle, _solidBoundary);
213template<
typename T,
typename PARTICLETYPE,
typename PCONDITION>
217 : _materialIndicator(materialIndicator)
219 this->
getName() =
"VerletParticleDynamicsMaterialCapture";
223template<
typename T,
typename PARTICLETYPE,
typename PCONDITION>
234template<
typename T,
typename PARTICLETYPE,
typename PCONDITION>
239 : _solidBoundary(solidBoundary), _materialIndicator(materialIndicator)
241 this->
getName() =
"VerletParticleDynamicsMaterialAwareWallCapture";
245template<
typename T,
typename PARTICLETYPE,
typename PCONDITION>
256template<
typename T,
typename PARTICLETYPE,
bool useCubicBounds,
typename PCONDITION>
260 : _solidBoundary(solidBoundary)
262 this->
getName() =
"VerletParticleDynamicsEscape";
266template<
typename T,
typename PARTICLETYPE,
bool useCubicBounds,
typename PCONDITION>
273 boundaries::escape<useCubicBounds>(particle, _solidBoundary);
277template<
typename T,
typename PARTICLETYPE,
typename PCONDITION>
281 : _materialIndicator(materialIndicator)
283 this->
getName() =
"VerletParticleDynamicsMaterialEscape";
287template<
typename T,
typename PARTICLETYPE,
typename PCONDITION>
298template<
typename T,
typename PARTICLETYPE,
typename PCONDITION>
303 : _solidBoundary(solidBoundary), _materialIndicator(materialIndicator)
305 this->
getName() =
"VerletParticleDynamicsMaterialAwareEscape";
309template<
typename T,
typename PARTICLETYPE,
typename PCONDITION>
321template<
typename T,
typename PARTICLETYPE,
typename PCONDITION>
326 : _captureMaterialIndicator(captureMaterialIndicator),
327 _escapeMaterialIndicator(escapeMaterialIndicator)
329 this->
getName() =
"VerletParticleDynamicsMaterialCaptureAndEscape";
333template<
typename T,
typename PARTICLETYPE,
typename PCONDITION>
341 *_escapeMaterialIndicator);
345template<
typename T,
typename PARTICLETYPE,
typename PCONDITION>
351 : _solidBoundary(solidBoundary),
352 _captureMaterialIndicator(captureMaterialIndicator),
353 _escapeMaterialIndicator(escapeMaterialIndicator)
355 this->
getName() =
"VerletParticleDynamicsMaterialAwareWallCaptureAndEscape";
359template<
typename T,
typename PARTICLETYPE,
typename PCONDITION>
367 *_captureMaterialIndicator, *_escapeMaterialIndicator);
372template<
typename T,
typename PARTICLETYPE>
376 : _solidBoundary(solidBoundary), _mainFlowDirection(mainFlowDirection), _tiltThreshold(tiltThreshold)
378 this->
getName() =
"ParticleDetachmentDynamics";
379 static_assert(PARTICLETYPE::template providesNested<descriptors::SURFACE,descriptors::ANGLE>(),
380 "Field SURFACE:ANGLE has to be provided");
381 static_assert(PARTICLETYPE::template providesNested<descriptors::DYNBEHAVIOUR,descriptors::DETACHING>(),
382 "Field DYNBEHAVIOUR:DETACHING has to be provided");
385template<
typename T,
typename PARTICLETYPE>
389 using namespace particles::access;
390 using namespace descriptors;
393 doWhenMeetingCondition<T,PARTICLETYPE,conditions::valid_particles>( particle,[&](){
395 bool detaching = isDetaching( particle );
409 auto angularAcceleration = getAngAcceleration( particle );
412 particle, timeStepSize, timeStepSize*timeStepSize, angularAcceleration );
414 if constexpr ( providesRotationMatrix<PARTICLETYPE>() ) {
436template<
typename T,
typename PARTICLETYPE>
441 : _domainMin(domainMin), _domainMax(domainMax)
443 this->
getName() =
"VerletParticleDynamicsCubicBoundsAdhesion";
456template<
typename T,
typename PARTICLETYPE>
460 using namespace particles::access;
462 auto acceleration = getAcceleration( particle );
467 if constexpr ( providesAngle<PARTICLETYPE>() ) {
469 auto angularAcceleration = getAngAcceleration( particle );
471 dynStatePre.angle = getAngle( particle );
474 particle, timeStepSize, acceleration, angularAcceleration );
478 particle, timeStepSize, acceleration);
482 auto force = getForce( particle );
483 auto adhesionThreshold = getAdhesion( particle );
486 bool adhesionSuperior =
false;
494 T normalForce = force[iDim]*normal[iDim];
495 if (normalForce > 0 && normalForce < adhesionThreshold[0] ){
496 adhesionSuperior =
true;
500 bool bothTangentalSuperior =
true;
501 for (
int iDimT=1; iDimT<PARTICLETYPE::d; ++iDimT) {
502 int jDim = (iDim+iDimT)%PARTICLETYPE::d;
503 if (std::abs(force[jDim]) >= adhesionThreshold[1]){
504 bothTangentalSuperior =
false;
508 adhesionSuperior = adhesionSuperior || bothTangentalSuperior;
511 if constexpr ( providesAngle<PARTICLETYPE>() ) {
513 if (adhesionSuperior){
514 resetMovement( particle, dynStatePre.position, dynStatePre.angle );
520 if (adhesionSuperior){
resetMovement( particle, dynStatePre.position); }
527template<
typename T,
typename PARTICLETYPE,
typename DEPOSITION_MODEL>
532 DEPOSITION_MODEL& depositionModel
534 : _domainMin(domainMin), _domainMax(domainMax),
535 _depositionModel( depositionModel )
537 this->
getName() =
"VerletParticleDynamicsCubicBoundsDeposition";
541template<
typename T,
typename PARTICLETYPE,
typename DEPOSITION_MODEL>
545 using namespace particles::access;
546 static_assert( providesActive<PARTICLETYPE>(),
"Field ACTIVE has to be provided");
549 if (particle.template getField<descriptors::DYNBEHAVIOUR,descriptors::ACTIVE>()) {
551 auto force = getForce( particle );
552 auto velocity = getVelocity( particle );
555 bool deposition =
false;
559 deposition = deposition || _depositionModel.checkDeposition(velocity,normal);
562 auto radius = getRadius( particle );
563 T penetrationDepth = -distToBound;
564 T velNormal = -normal[iDim]*velocity[iDim];
565 T forceNormal = _depositionModel.contactForceSphereHalfSpaceDampened(
566 radius, penetrationDepth, velNormal );
567 force[iDim] = forceNormal*normal[iDim];
570 particle.template setField<descriptors::FORCING,descriptors::FORCE>( force );
575 auto acceleration = getAcceleration( particle );
577 auto positionPre = getPosition( particle );
579 if constexpr ( providesAngle<PARTICLETYPE>() ) {
581 auto angularAcceleration = getAngAcceleration( particle );
584 particle, timeStepSize, acceleration, angularAcceleration );
591 particle, timeStepSize, acceleration );
595 particle.template setField<descriptors::DYNBEHAVIOUR,descriptors::ACTIVE>(
false );
596 particle.template setField<descriptors::MOBILITY,descriptors::VELOCITY>( 0. );
597 particle.template setField<descriptors::MOBILITY,descriptors::ACCELERATION_STRD>( 0. );
598 if constexpr ( providesAngle<PARTICLETYPE>() ) {
599 particle.template setField<descriptors::MOBILITY,descriptors::ANG_VELOCITY>( 0. );
600 particle.template setField<descriptors::MOBILITY,descriptors::ANG_ACC_STRD>( 0. );
void process(Particle< T, PARTICLETYPE > &particle, T timeStepSize) override
Processing step.
NoParticleDynamics(T rhoDummy)
void process(Particle< T, PARTICLETYPE > &particle, T timeStepSize) override
Procesisng step.
ParticleDetachmentDynamics(SolidBoundary< T, PARTICLETYPE::d > &solidBoundary, Vector< T, PARTICLETYPE::d > &mainFlowDirection, T tiltThreshold=0.3 *M_PI)
Constructor.
VerletParticleDynamicsCubicBoundsAdhesion(PhysR< T, PARTICLETYPE::d > &domainMin, PhysR< T, PARTICLETYPE::d > &domainMax)
Constructor.
void process(Particle< T, PARTICLETYPE > &particle, T timeStepSize) override
Procesisng step.
Velocity verlet particle dynamics with deposition modelling by checking domain bounds in cartesion di...
void process(Particle< T, PARTICLETYPE > &particle, T timeStepSize) override
Procesisng step.
VerletParticleDynamicsEscape(SolidBoundary< T, PARTICLETYPE::d > &solidBoundary)
Constructor.
VerletParticleDynamicsMaterialAwareEscape(SolidBoundary< T, PARTICLETYPE::d > &solidBoundary, std::shared_ptr< SuperIndicatorMaterial< T, PARTICLETYPE::d > > materialIndicator)
Constructor.
void process(Particle< T, PARTICLETYPE > &particle, T timeStepSize) override
Procesisng step.
void process(Particle< T, PARTICLETYPE > &particle, T timeStepSize) override
Procesisng step.
VerletParticleDynamicsMaterialAwareWallCaptureAndEscape(SolidBoundary< T, PARTICLETYPE::d > &solidBoundary, std::shared_ptr< SuperIndicatorMaterial< T, PARTICLETYPE::d > > captureMaterialIndicator, std::shared_ptr< SuperIndicatorMaterial< T, PARTICLETYPE::d > > escapeMaterialIndicator)
Constructor.
void process(Particle< T, PARTICLETYPE > &particle, T timeStepSize) override
Procesisng step.
VerletParticleDynamicsMaterialAwareWallCapture(SolidBoundary< T, PARTICLETYPE::d > &solidBoundary, std::shared_ptr< SuperIndicatorMaterial< T, PARTICLETYPE::d > >)
Constructor.
void process(Particle< T, PARTICLETYPE > &particle, T timeStepSize) override
Procesisng step.
VerletParticleDynamicsMaterialCaptureAndEscape(std::shared_ptr< SuperIndicatorMaterial< T, PARTICLETYPE::d > > captureMaterialIndicator, std::shared_ptr< SuperIndicatorMaterial< T, PARTICLETYPE::d > > escapeMaterialIndicator)
Constructor.
VerletParticleDynamicsMaterialCapture(std::shared_ptr< SuperIndicatorMaterial< T, PARTICLETYPE::d > >)
Constructor.
void process(Particle< T, PARTICLETYPE > &particle, T timeStepSize) override
Procesisng step.
VerletParticleDynamicsMaterialEscape(std::shared_ptr< SuperIndicatorMaterial< T, PARTICLETYPE::d > > materialIndicator)
Constructor.
void process(Particle< T, PARTICLETYPE > &particle, T timeStepSize) override
Procesisng step.
VerletParticleDynamicsRotationOnly()
Constructor.
void process(Particle< T, PARTICLETYPE > &particle, T timeStepSize) override
Procesisng step.
VerletParticleDynamicsRotor(Vector< T, PARTICLETYPE::d > angVel)
Constructor.
void process(Particle< T, PARTICLETYPE > &particle, T timeStepSize) override
Procesisng step.
VerletParticleDynamicsTranslationOnly()
Constructor.
void process(Particle< T, PARTICLETYPE > &particle, T timeStepSize) override
Procesisng step.
void process(Particle< T, PARTICLETYPE > &particle, T timeStepSize) override
Procesisng step.
VerletParticleDynamicsVelocityWallReflection(SolidBoundary< T, PARTICLETYPE::d > &solidBoundary)
Constructor.
void process(Particle< T, PARTICLETYPE > &particle, T timeStepSize) override
Procesisng step.
VerletParticleDynamicsWallCapture(SolidBoundary< T, PARTICLETYPE::d > &solidBoundary)
Constructor.
Standard dynamics for particles.
VerletParticleDynamics()
Constructor.
void process(Particle< T, PARTICLETYPE > &particle, T timeStepSize) override
Procesisng step.
void materialCaptureAndEscape(Particle< T, PARTICLETYPE > &particle, SuperIndicatorMaterial< T, PARTICLETYPE::d > &captureMaterialIndicator, SuperIndicatorMaterial< T, PARTICLETYPE::d > &escapeMaterialIndicator)
Escape and capture based on material rather than SolidBoundary.
void wallCaptureMaterialAware(Particle< T, PARTICLETYPE > &particle, SolidBoundary< T, PARTICLETYPE::d > &solidBoundary, SuperIndicatorMaterial< T, PARTICLETYPE::d > &materialIndicator)
Wall capture with material awareness.
void escapeMaterialAware(Particle< T, PARTICLETYPE > &particle, SolidBoundary< T, PARTICLETYPE::d > &solidBoundary, SuperIndicatorMaterial< T, PARTICLETYPE::d > &materialIndicator)
Escape boundary with material awareness.
void materialEscape(Particle< T, PARTICLETYPE > &particle, SuperIndicatorMaterial< T, PARTICLETYPE::d > &materialIndicator)
Escape boundary based on material rather than SolidBoundary.
void wallCaptureAndEscapeMaterialAware(Particle< T, PARTICLETYPE > &particle, SolidBoundary< T, PARTICLETYPE::d > &solidBoundary, SuperIndicatorMaterial< T, PARTICLETYPE::d > &captureMaterialIndicator, SuperIndicatorMaterial< T, PARTICLETYPE::d > &escapeMaterialIndicator)
Escape boundary with material awareness.
void materialCapture(Particle< T, PARTICLETYPE > &particle, SuperIndicatorMaterial< T, PARTICLETYPE::d > &materialIndicator)
Wall capture based on material rather than SolidBoundary.
void velocityVerletRotor(Particle< T, PARTICLETYPE > &particle, T delTime, Vector< T, PARTICLETYPE::d > angVel)
void resetMovement(Particle< T, PARTICLETYPE > &particle, Vector< T, PARTICLETYPE::d > positionPre, Vector< T, utilities::dimensions::convert< PARTICLETYPE::d >::rotation > anglePre=Vector< T, utilities::dimensions::convert< PARTICLETYPE::d >::rotation >(0.))
void velocityVerletTranslation(Particle< T, PARTICLETYPE > &particle, T delTime, T delTime2, Vector< T, PARTICLETYPE::d > acceleration)
std::conditional_t< PARTICLETYPE::template providesNested< descriptors::SURFACE, descriptors::ANGLE >(), ParticleDynamicStateAngle< T, PARTICLETYPE >, ParticleDynamicStateNoAngle< T, PARTICLETYPE > > DynState
void velocityVerletRotation(Particle< T, PARTICLETYPE > &particle, T delTime, T delTime2, Vector< T, utilities::dimensions::convert< PARTICLETYPE::d >::rotation > angularAcceleration)
void velocityVerletIntegration(Particle< T, PARTICLETYPE > &particle, T delTime, Vector< T, PARTICLETYPE::d > acceleration, Vector< T, utilities::dimensions::convert< PARTICLETYPE::d >::rotation > angularAcceleration)
void resetDirection(Particle< T, PARTICLETYPE > &particle, Vector< T, PARTICLETYPE::d > positionPre, int iDir)
void updateRotationMatrix(Particle< T, PARTICLETYPE > &particle)
void doAtCubicBoundPenetration(Particle< T, PARTICLETYPE > &particle, Vector< T, PARTICLETYPE::d > domainMin, Vector< T, PARTICLETYPE::d > domainMax, F boundTreatment)
Helper functions.
bool checkAdhesion(SolidBoundary< T, PARTICLETYPE::d > &wall, Vector< T, PARTICLETYPE::d > &mainFlowDirection, Particle< T, PARTICLETYPE > &particle)
Check adhesion and return true if still adhering.
void evaluateDetachmentState(SolidBoundary< T, PARTICLETYPE::d > &wall, Particle< T, PARTICLETYPE > &particle, T tiltThreshold=0.3 *M_PI)
void handleDetachment(SolidBoundary< T, PARTICLETYPE::d > &wall, Vector< T, PARTICLETYPE::d > &mainFlowDirection, Particle< T, PARTICLETYPE > &particle)
Top level namespace for all of OpenLB.
std::conditional_t< D==2, SuperIndicatorMaterial2D< T >, SuperIndicatorMaterial3D< T > > SuperIndicatorMaterial
std::string & getName()
read and write access to name