30#ifndef PARTICLE_TASKS_H
31#define PARTICLE_TASKS_H
41template<
typename T,
typename DESCRIPTOR,
typename PARTICLETYPE,
42 typename FORCEFUNCTOR=SuperLatticeMomentumExchangeForce<T, DESCRIPTOR, PARTICLETYPE>>
54 FORCEFUNCTOR forceFunctor( sLattice, sGeometry,
55 particleSystem, converter, periodicity, iP0 );
64template<
typename T,
typename PARTICLETYPE>
70 T timeStepSize,
int globiC=0)
72 using namespace descriptors;
75 T mass = particle.template getField<PHYSPROPERTIES,MASS>();
76 force += externalAcceleration * mass;
77 particle.template setField<FORCING,FORCE>( force );
84template<
typename T,
typename PARTICLETYPE>
90 T timeStepSize,
int globiC=0 )
93 if constexpr (!access::providesDynamicsID<PARTICLETYPE>()){
97 particle.
process(timeStepSize, dynamicsID);
105template<
typename T,
typename DESCRIPTOR,
typename PARTICLETYPE>
117 using namespace descriptors;
131#ifdef PARALLEL_MODE_MPI
136template<
typename T,
typename PARTICLETYPE>
142 T timeStepSize,
int globiC )
144 using PCONDITION = std::conditional_t<
145 access::providesSurface<PARTICLETYPE>(),
149 doWhenMeetingCondition<T,PARTICLETYPE,PCONDITION>( particle,
151 particle.
process(timeStepSize);
162template<
typename T,
typename DESCRIPTOR,
typename PARTICLETYPE,
174 constexpr unsigned D = DESCRIPTOR::d;
182 auto& blockLattice = sLattice.
getBlock(iC);
186 FORCEFUNCTOR forceFunctor( blockLattice, blockGeometry,
187 particleSystem, converter, min, max, periodicity, iP0 );
191 if constexpr (FORCEFUNCTOR::serializeForce){
195 dynamics::applyLocalParticleForce<T,PARTICLETYPE,FORCEFUNCTOR,PCONDITION>(
196 forceFunctor, particleSystem, iP0 );
206template<
typename T,
typename PARTICLETYPE>
228template<
typename T,
typename PARTICLETYPE>
235 using namespace descriptors;
238 constexpr unsigned D = PARTICLETYPE::d;
240 constexpr unsigned forceDataSize = D+Drot;
243 std::map<std::size_t, Vector<T,forceDataSize>> globalIdDataMap;
261template<
typename T,
typename DESCRIPTOR,
typename PARTICLETYPE>
273 constexpr unsigned D = DESCRIPTOR::d;
274 using namespace descriptors;
279 int iC = loadBalancer.loc(globiC);
282 auto& blockLattice = sLattice.
getBlock(iC);
291 particle, periodicity);
303template<
typename T,
typename PARTICLETYPE>
309 T timeStepSize,
int globiC=0)
311 using namespace descriptors;
314 T mass = particle.template getField<PHYSPROPERTIES,MASS>();
315 force += externalAcceleration * mass;
316 particle.template setField<FORCING,FORCE>( force );
328template<
typename T,
typename DESCRIPTOR,
typename PARTICLETYPE>
330 access::providesSurface<PARTICLETYPE>(),
332 access::providesParallelization<PARTICLETYPE>(),
341template<
typename T,
typename DESCRIPTOR,
typename PARTICLETYPE>
343 access::providesParallelization<PARTICLETYPE>(),
348template<
typename T,
typename PARTICLETYPE>
350 access::providesParallelization<PARTICLETYPE>(),
355template<
typename T,
typename PARTICLETYPE>
357 access::providesParallelization<PARTICLETYPE>(),
362template<
typename T,
typename PARTICLETYPE>
368template<
typename T,
typename DESCRIPTOR,
typename PARTICLETYPE>
373template<
typename T,
typename DESCRIPTOR,
typename PARTICLETYPE>
377template<
typename T,
typename PARTICLETYPE>
381template<
typename T,
typename PARTICLETYPE>
Functor that returns forces acting on a particle surface, returns data in output for every particle i...
Representation of a statistic for a parallel 2D geometry.
BlockGeometry< T, D > & getBlockGeometry(int locIC)
Read and write access to a single block geometry.
Functor that returns forces acting on a particle surface, returns data in output for every particle i...
Super class maintaining block lattices for a cuboid decomposition.
BlockLattice< T, DESCRIPTOR > & getBlock(int locC)
Return BlockLattice with local index locC.
CuboidGeometry< T, D > & getCuboidGeometry()
Read and write access to cuboid geometry.
LoadBalancer< T > & getLoadBalancer()
Read and write access to the load balancer.
Conversion between physical and lattice units, as well as discretization.
void process(T timeStepSize, unsigned short iDyn=0)
Apply processing to the particle according to dynamics at iDyn.
SuperStructure< T, PARTICLETYPE::d > & getSuperStructure()
unsigned short getDynamicsID(Particle< T, PARTICLETYPE > &particle)
void forSystemsInSuperParticleSystem(SuperParticleSystem< T, PARTICLETYPE > &sParticleSystem, F f)
void communicateSurfaceForce(SuperParticleSystem< T, PARTICLETYPE > &sParticleSystem, std::map< std::size_t, Vector< T, forceDataSize > > &globalIdDataMap, MPI_Comm surfaceForceComm)
void updateParticleCuboidDistribution(SuperParticleSystem< T, PARTICLETYPE > &sParticleSystem, const T physDeltaX, MPI_Comm particleDistributionComm, const Vector< bool, PARTICLETYPE::d > &periodicity)
void assignSurfaceForce(SuperParticleSystem< T, PARTICLETYPE > &sParticleSystem, std::map< std::size_t, Vector< T, forceDataSize > > &globalIdDataMap)
void applySerializableParticleForce(FORCEFUNCTOR &forceF, ParticleSystem< T, PARTICLETYPE > &particleSystem, std::size_t iP0=0)
Apply boundary force provided by force functor to the particle center as torque and force.
std::conditional_t< access::providesParallelization< PARTICLETYPE >(), apply_external_acceleration_parallel< T, PARTICLETYPE >, apply_external_acceleration_single_cuboid< T, PARTICLETYPE > > apply_gravity
std::conditional_t< access::providesParallelization< PARTICLETYPE >(), couple_parallel_particles_to_lattice< T, DESCRIPTOR, PARTICLETYPE >, couple_particles_to_lattice_single_cuboid< T, DESCRIPTOR, PARTICLETYPE > > couple_particles_to_lattice
constexpr bool isPeriodic(const Vector< bool, D > &periodic)
void setBlockParticleField(const BlockGeometry< T, DESCRIPTOR::d > &blockGeometry, BlockLattice< T, DESCRIPTOR > &blockLattice, UnitConverter< T, DESCRIPTOR > const &converter, Particle< T, PARTICLETYPE > &particle)
std::conditional_t< access::providesParallelization< PARTICLETYPE >(), process_dynamics_parallel< T, PARTICLETYPE >, process_dynamics_single_cuboid< T, PARTICLETYPE > > process_dynamics
std::conditional_t< access::providesSurface< PARTICLETYPE >(), std::conditional_t< access::providesParallelization< PARTICLETYPE >(), couple_lattice_to_parallel_particles< T, DESCRIPTOR, PARTICLETYPE, BlockLatticeMomentumExchangeForce< T, DESCRIPTOR, PARTICLETYPE > >, couple_lattice_to_particles_single_cuboid< T, DESCRIPTOR, PARTICLETYPE, SuperLatticeMomentumExchangeForce< T, DESCRIPTOR, PARTICLETYPE > > >, couple_lattice_to_parallel_particles< T, DESCRIPTOR, PARTICLETYPE, BlockLatticeStokesDragForce< T, DESCRIPTOR, PARTICLETYPE, false > > > couple_lattice_to_particles
Aliases.
void setSuperParticleField(const SuperGeometry< T, DESCRIPTOR::d > &sGeometry, SuperLattice< T, DESCRIPTOR > &sLattice, UnitConverter< T, DESCRIPTOR > const &converter, Particle< T, PARTICLETYPE > &particle, const Vector< bool, DESCRIPTOR::d > &periodicity)
Set particle field with peridic support.
Top level namespace for all of OpenLB.
Apply external acceleration (e.g. for apply gravity)
static auto execute(SuperParticleSystem< T, PARTICLETYPE > &sParticleSystem, Particle< T, PARTICLETYPE > &particle, Vector< T, PARTICLETYPE::d > externalAcceleration, T timeStepSize, int globiC=0)
static constexpr bool latticeCoupling
static constexpr bool particleLoop
Apply external acceleration (e.g. for apply gravity)
static constexpr bool particleLoop
static auto execute(ParticleSystem< T, PARTICLETYPE > &ParticleSystem, Particle< T, PARTICLETYPE > &particle, Vector< T, PARTICLETYPE::d > externalAcceleration, T timeStepSize, int globiC=0)
static constexpr bool latticeCoupling
Communicate surface force of parallel particles.
static auto execute(SuperParticleSystem< T, PARTICLETYPE > &sParticleSystem, const communication::ParticleCommunicator &communicator)
static constexpr bool particleLoop
static constexpr bool latticeCoupling
MPI_Comm surfaceForceComm
Communicator for particle distribution communication.
MPI_Comm particleDistribution
Couple lattice to parallel particles.
static constexpr bool particleLoop
static auto execute(SuperParticleSystem< T, PARTICLETYPE > &sParticleSystem, const SuperGeometry< T, DESCRIPTOR::d > &sGeometry, SuperLattice< T, DESCRIPTOR > &sLattice, UnitConverter< T, DESCRIPTOR > const &converter, Vector< bool, DESCRIPTOR::d > periodicity=Vector< bool, DESCRIPTOR::d >(false), std::size_t iP0=0)
static constexpr bool latticeCoupling
Couple lattice to particles.
static auto execute(ParticleSystem< T, PARTICLETYPE > &particleSystem, SuperGeometry< T, DESCRIPTOR::d > &sGeometry, SuperLattice< T, DESCRIPTOR > &sLattice, UnitConverter< T, DESCRIPTOR > const &converter, Vector< bool, DESCRIPTOR::d > periodicity=Vector< bool, DESCRIPTOR::d >(false), std::size_t iP0=0)
static constexpr bool latticeCoupling
static constexpr bool particleLoop
Couple particles to lattice.
static constexpr bool particleLoop
static constexpr bool latticeCoupling
static auto execute(SuperParticleSystem< T, PARTICLETYPE > &sParticleSystem, Particle< T, PARTICLETYPE > &particle, const SuperGeometry< T, DESCRIPTOR::d > &sGeometry, SuperLattice< T, DESCRIPTOR > &sLattice, UnitConverter< T, DESCRIPTOR > const &converter, int globiC, Vector< bool, DESCRIPTOR::d > periodicity=Vector< bool, DESCRIPTOR::d >(false))
Couple particles to lattice.
static constexpr bool latticeCoupling
static auto execute(ParticleSystem< T, PARTICLETYPE > &particleSystem, Particle< T, PARTICLETYPE > &particle, SuperGeometry< T, DESCRIPTOR::d > &sGeometry, SuperLattice< T, DESCRIPTOR > &sLattice, UnitConverter< T, DESCRIPTOR > const &converter, int globiC=0, Vector< bool, DESCRIPTOR::d > periodicity=Vector< bool, DESCRIPTOR::d >(false))
static constexpr bool particleLoop
Process particle dynamics.
static auto execute(SuperParticleSystem< T, PARTICLETYPE > &sParticleSystem, Particle< T, PARTICLETYPE > &particle, Vector< T, PARTICLETYPE::d > &externalAcceleration, T timeStepSize, int globiC)
static constexpr bool latticeCoupling
static constexpr bool particleLoop
Process particle dynamics.
static constexpr bool latticeCoupling
static constexpr bool particleLoop
static auto execute(ParticleSystem< T, PARTICLETYPE > &particleSystem, Particle< T, PARTICLETYPE > &particle, Vector< T, PARTICLETYPE::d > &externalAcceleration, T timeStepSize, int globiC=0)
Update particle core distribution of parallel particles.
static constexpr bool latticeCoupling
static constexpr bool particleLoop
static auto execute(SuperParticleSystem< T, PARTICLETYPE > &sParticleSystem, const T physDeltaX, const communication::ParticleCommunicator &communicator, const Vector< bool, PARTICLETYPE::d > &periodicity)
Converts dimensions by deriving from given cartesian dimension D.