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

Namespaces

namespace  access
 
namespace  boundaries
 
namespace  communication
 
namespace  conditions
 
namespace  contact
 
namespace  creators
 
namespace  defaults
 
namespace  dynamics
 
namespace  interaction
 
namespace  io
 
namespace  resolved
 
namespace  sorting
 
namespace  statistics
 
namespace  subgrid
 

Classes

struct  apply_external_acceleration_parallel
 Apply external acceleration (e.g. for apply gravity) More...
 
struct  apply_external_acceleration_single_cuboid
 Apply external acceleration (e.g. for apply gravity) More...
 
struct  clear_force_and_torque
 Clear force and torque values, apply when using more forces. More...
 
struct  communicate_surface_force
 Communicate surface force of parallel particles. More...
 
struct  compute_orientation_index
 Euler Rotation -computes the orientation of the main axis of the spheroid to the streamline. More...
 
struct  couple_lattice_to_parallel_particles
 Couple lattice to parallel particles. More...
 
struct  couple_lattice_to_parallel_particles_two_forces
 Couple lattice to parallel particles. More...
 
struct  couple_lattice_to_particles_single_cuboid
 Couple lattice to particles. More...
 
struct  couple_parallel_particles_to_lattice
 Couple particles to lattice. More...
 
struct  couple_particles_to_lattice_single_cuboid
 Couple particles to lattice. More...
 
struct  discrete_points_on_hull
 
struct  ParallelParticleLocator
 
class  Particle
 
class  ParticleSystem
 
struct  process_dynamics_parallel
 Process particle dynamics. More...
 
struct  process_dynamics_single_cuboid
 Process particle dynamics. More...
 
class  SuperParticleSystem
 
struct  update_particle_core_distribution
 Update particle core distribution of parallel particles. More...
 

Typedefs

template<typename T , typename PARTICLETYPE >
using XParticleSystem
 
template<typename T , typename DESCRIPTOR , typename PARTICLETYPE >
using couple_lattice_to_particles
 Aliases.
 
template<typename T , typename DESCRIPTOR , typename PARTICLETYPE >
using couple_particles_to_lattice
 
template<typename T , typename PARTICLETYPE >
using process_dynamics
 
template<typename T , typename PARTICLETYPE >
using apply_gravity
 
template<typename T , typename PARTICLETYPE >
using communicate_parallel_surface_force = communicate_surface_force<T,PARTICLETYPE>
 

Functions

template<typename DESCRIPTOR , typename CELL , typename V = typename CELL::value_t>
void resetParticleRelatedFields (CELL &cell) noexcept
 
template<typename DESCRIPTOR , typename CELL , typename V = typename CELL::value_t>
void resetParticleContactRelatedFields (CELL &cell) noexcept
 
template<typename DESCRIPTOR , typename CELL , typename V = typename CELL::value_t>
void resetAllParticleRelatedFields (CELL &cell) noexcept
 
template<typename T , typename PARTICLETYPE , typename F >
void doForParticle (Particle< T, PARTICLETYPE > &particle, F f)
 
template<typename T , typename PARTICLETYPE , typename PCONDITION = conditions::valid_particles, typename F >
void doWhenMeetingCondition (Particle< T, PARTICLETYPE > &particle, F f)
 
template<typename T , typename PARTICLETYPE , typename PCONDITION = conditions::valid_particles, typename F >
void doWhenMeetingCondition (Particle< T, PARTICLETYPE > &particle, F f, int globiC)
 
template<typename T , typename PARTICLETYPE , typename PCONDITION = conditions::valid_particles, typename F >
void forParticlesInParticleSystem (ParticleSystem< T, PARTICLETYPE > &particleSystem, F f, int globiC)
 
template<typename T , typename PARTICLETYPE , typename PCONDITION = conditions::valid_particles, typename F >
void forParticlesInParticleSystem (ParticleSystem< T, PARTICLETYPE > &particleSystem, F f)
 
template<typename T , typename PARTICLETYPE , typename PCONDITION = conditions::valid_particles, typename F >
void forParticlesInXParticleSystem (XParticleSystem< T, PARTICLETYPE > &xParticleSystem, F f)
 Iterate over particles in x particle system.
 
template<unsigned D>
constexpr bool isPeriodic (const Vector< bool, D > &periodic)
 
template<typename T >
std::array< Vector< T, 3 >, 26 > discretePointsOnSphericalHull (Vector< T, 3 > position, T radius)
 
template<typename T >
std::array< Vector< T, 2 >, 8 > discretePointsOnSphericalHull (Vector< T, 2 > position, T radius)
 
template<typename T , typename PARTICLETYPE >
void purgeInvalidParticles (XParticleSystem< T, PARTICLETYPE > &xParticleSystem)
 
template<typename T , typename PARTICLETYPE , std::size_t selectedID, typename F >
void doForParticleMatchingID (XParticleSystem< T, PARTICLETYPE > &xParticleSystem, F f)
 
template<typename T , typename PARTICLETYPE , typename PCONDITION = conditions::valid_particles>
bool searchParticleLocally (ParticleSystem< T, PARTICLETYPE > &particleSystem, std::size_t globalIDrequested, std::size_t &localParticleID)
 
template<typename T , unsigned D>
bool getBlockParticleIntersection (const BlockGeometry< T, D > &blockGeometry, T invDeltaX, LatticeR< D > &start, LatticeR< D > &end, Vector< T, D > position, T circumRadius)
 
template<typename T , unsigned D>
void checkSmoothIndicatorOutOfGeometry (bool &outOfGeometry, Vector< T, D > &ghostPos, const PhysR< T, D > &cellMin, const PhysR< T, D > &cellMax, const Vector< T, D > &position, T circumRadius, const Vector< bool, D > &periodic)
 
template<typename T , typename DESCRIPTOR , typename F >
void forSpatialLocationsInBlockParticleIntersection (const BlockGeometry< T, DESCRIPTOR::d > &blockGeometry, BlockLattice< T, DESCRIPTOR > &blockLattice, Vector< T, DESCRIPTOR::d > position, T circumRadius, F f)
 
template<typename T , typename DESCRIPTOR , typename PARTICLETYPE >
void setBlockParticleField (const BlockGeometry< T, DESCRIPTOR::d > &blockGeometry, BlockLattice< T, DESCRIPTOR > &blockLattice, UnitConverter< T, DESCRIPTOR > const &converter, Particle< T, PARTICLETYPE > &particle)
 
template<typename T , typename DESCRIPTOR , typename PARTICLETYPE , typename PARTICLECONTACTTYPE , typename WALLCONTACTTYPE , typename F = decltype(defaults::periodicity<PARTICLETYPE::d>)>
void setBlockParticleField (const BlockGeometry< T, DESCRIPTOR::d > &blockGeometry, BlockLattice< T, DESCRIPTOR > &blockLattice, UnitConverter< T, DESCRIPTOR > const &converter, ParticleSystem< T, PARTICLETYPE > &particleSystem, contact::ContactContainer< T, PARTICLECONTACTTYPE, WALLCONTACTTYPE > &particleContacts, size_t iP, Particle< T, PARTICLETYPE > &particle, std::vector< SolidBoundary< T, DESCRIPTOR::d > > &solidBoundaries, const PhysR< T, DESCRIPTOR::d > &cellMin=PhysR< T, DESCRIPTOR::d >(std::numeric_limits< T >::quiet_NaN()), const PhysR< T, DESCRIPTOR::d > &cellMax=PhysR< T, DESCRIPTOR::d >(std::numeric_limits< T >::quiet_NaN()), F getSetupPeriodicity=defaults::periodicity< PARTICLETYPE::d >)
 
template<typename T , typename DESCRIPTOR >
void resetBlockParticleField (const BlockGeometry< T, DESCRIPTOR::d > &blockGeometry, BlockLattice< T, DESCRIPTOR > &blockLattice)
 
template<typename T , typename DESCRIPTOR >
void resetBlockContactField (const BlockGeometry< T, DESCRIPTOR::d > &blockGeometry, BlockLattice< T, DESCRIPTOR > &blockLattice)
 
template<typename T , unsigned D>
bool getBlockParticleIntersection (const BlockGeometry< T, D > &blockGeometry, T invDeltaX, LatticeR< D > &start, LatticeR< D > &end, PhysR< T, D > position, T circumRadius)
 
template<typename T , unsigned D>
void checkSmoothIndicatorOutOfGeometry (bool &surfaceOutOfGeometry, PhysR< T, D > &ghostPos, const PhysR< T, D > &cellMin, const PhysR< T, D > &cellMax, const PhysR< T, D > &position, T circumRadius, const Vector< bool, D > &periodic)
 
template<typename T , typename DESCRIPTOR , typename PARTICLETYPE >
void setBlockParticleField (const BlockGeometry< T, DESCRIPTOR::d > &blockGeometry, BlockLattice< T, DESCRIPTOR > &blockLattice, UnitConverter< T, DESCRIPTOR > const &converter, const PhysR< T, DESCRIPTOR::d > &cellMin, const PhysR< T, DESCRIPTOR::d > &cellMax, Particle< T, PARTICLETYPE > &particle, const Vector< bool, DESCRIPTOR::d > &periodic)
 
template<typename T , typename DESCRIPTOR , typename PARTICLETYPE , typename PARTICLECONTACTTYPE , typename WALLCONTACTTYPE , typename F >
void setBlockParticleField (const BlockGeometry< T, DESCRIPTOR::d > &blockGeometry, BlockLattice< T, DESCRIPTOR > &blockLattice, UnitConverter< T, DESCRIPTOR > const &converter, const PhysR< T, DESCRIPTOR::d > &cellMin, const PhysR< T, DESCRIPTOR::d > &cellMax, ParticleSystem< T, PARTICLETYPE > &particleSystem, contact::ContactContainer< T, PARTICLECONTACTTYPE, WALLCONTACTTYPE > &contactContainer, size_t iP, Particle< T, PARTICLETYPE > &particle, std::vector< SolidBoundary< T, DESCRIPTOR::d > > &solidBoundaries, F getSetupPeriodicity)
 
template<typename T , typename DESCRIPTOR , typename F >
void forSpatialLocationsInBlockParticleIntersection (const BlockGeometry< T, DESCRIPTOR::d > &blockGeometry, BlockLattice< T, DESCRIPTOR > &blockLattice, int padding, Vector< T, DESCRIPTOR::d > position, T circumRadius, F f)
 
template<typename T , typename DESCRIPTOR , typename PARTICLETYPE >
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.
 
template<typename T , typename DESCRIPTOR , typename PARTICLETYPE , typename PARTICLECONTACTTYPE , typename WALLCONTACTTYPE , typename F >
void setSuperParticleField (const SuperGeometry< T, DESCRIPTOR::d > &sGeometry, const PhysR< T, DESCRIPTOR::d > &min, const PhysR< T, DESCRIPTOR::d > &max, SuperLattice< T, DESCRIPTOR > &sLattice, UnitConverter< T, DESCRIPTOR > const &converter, ParticleSystem< T, PARTICLETYPE > &particleSystem, contact::ContactContainer< T, PARTICLECONTACTTYPE, WALLCONTACTTYPE > &particleContacts, size_t iP, Particle< T, PARTICLETYPE > &particle, std::vector< SolidBoundary< T, DESCRIPTOR::d > > &solidBoundaries, F getSetupPeriodicity, int globiC=-1)
 
template<typename T , typename DESCRIPTOR >
void resetSuperParticleField (SuperGeometry< T, DESCRIPTOR::d > &sGeometry, SuperLattice< T, DESCRIPTOR > &sLattice)
 Reset particle field.
 
template<typename T , typename DESCRIPTOR >
void resetContactField (SuperGeometry< T, DESCRIPTOR::d > &sGeometry, SuperLattice< T, DESCRIPTOR > &sLattice)
 

Typedef Documentation

◆ apply_gravity

template<typename T , typename PARTICLETYPE >
using olb::particles::apply_gravity
Initial value:
std::conditional_t<
access::providesParallelization<PARTICLETYPE>(),
apply_external_acceleration_parallel<T,PARTICLETYPE>,
apply_external_acceleration_single_cuboid<T,PARTICLETYPE>
>

Definition at line 458 of file particleTasks.h.

◆ communicate_parallel_surface_force

template<typename T , typename PARTICLETYPE >
using olb::particles::communicate_parallel_surface_force = communicate_surface_force<T,PARTICLETYPE>

Definition at line 465 of file particleTasks.h.

◆ couple_lattice_to_particles

template<typename T , typename DESCRIPTOR , typename PARTICLETYPE >
using olb::particles::couple_lattice_to_particles
Initial value:
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>>
>

Aliases.

Definition at line 431 of file particleTasks.h.

◆ couple_particles_to_lattice

template<typename T , typename DESCRIPTOR , typename PARTICLETYPE >
using olb::particles::couple_particles_to_lattice
Initial value:
std::conditional_t<
access::providesParallelization<PARTICLETYPE>(),
couple_parallel_particles_to_lattice<T,DESCRIPTOR,PARTICLETYPE>,
couple_particles_to_lattice_single_cuboid<T,DESCRIPTOR,PARTICLETYPE>
>

Definition at line 444 of file particleTasks.h.

◆ process_dynamics

template<typename T , typename PARTICLETYPE >
using olb::particles::process_dynamics
Initial value:
std::conditional_t<
access::providesParallelization<PARTICLETYPE>(),
process_dynamics_parallel<T,PARTICLETYPE>,
process_dynamics_single_cuboid<T,PARTICLETYPE>
>

Definition at line 451 of file particleTasks.h.

◆ XParticleSystem

template<typename T , typename PARTICLETYPE >
using olb::particles::XParticleSystem
Initial value:
std::conditional_t<
PARTICLETYPE::template providesNested<descriptors::PARALLELIZATION>(),
SuperParticleSystem<T, PARTICLETYPE>, ParticleSystem<T, PARTICLETYPE>>

Definition at line 74 of file superParticleSystem.h.

Function Documentation

◆ checkSmoothIndicatorOutOfGeometry() [1/2]

template<typename T , unsigned D>
void olb::particles::checkSmoothIndicatorOutOfGeometry ( bool & outOfGeometry,
Vector< T, D > & ghostPos,
const PhysR< T, D > & cellMin,
const PhysR< T, D > & cellMax,
const Vector< T, D > & position,
T circumRadius,
const Vector< bool, D > & periodic )
+ Here is the caller graph for this function:

◆ checkSmoothIndicatorOutOfGeometry() [2/2]

template<typename T , unsigned D>
void olb::particles::checkSmoothIndicatorOutOfGeometry ( bool & surfaceOutOfGeometry,
PhysR< T, D > & ghostPos,
const PhysR< T, D > & cellMin,
const PhysR< T, D > & cellMax,
const PhysR< T, D > & position,
T circumRadius,
const Vector< bool, D > & periodic )

Definition at line 66 of file blockLatticeInteraction.hh.

71{
72 ghostPos = position;
73 surfaceOutOfGeometry = false;
74 for (unsigned i = 0; i < D; ++i) {
75 T const particleMin = position[i] - circumRadius;
76 T const particleMax = position[i] + circumRadius;
77 if (particleMin < cellMin[i] && periodic[i]) {
78 surfaceOutOfGeometry = true;
79 ghostPos[i] = communication::movePositionToEnd(
80 position[i], cellMax[i], cellMin[i]);
81 }
82 else if (particleMax > cellMax[i] && periodic[i]) {
83 surfaceOutOfGeometry = true;
84 ghostPos[i] = communication::movePositionToStart(
85 position[i], cellMax[i], cellMin[i]);
86 }
87 }
88}

References olb::particles::communication::movePositionToEnd(), and olb::particles::communication::movePositionToStart().

+ Here is the call graph for this function:

◆ discretePointsOnSphericalHull() [1/2]

template<typename T >
std::array< Vector< T, 2 >, 8 > olb::particles::discretePointsOnSphericalHull ( Vector< T, 2 > position,
T radius )

Definition at line 100 of file particleUtilities.h.

102{
103 //TODO: check correctness
104 T distA = radius;
105 T distB = (1/std::sqrt(2))*distA;
106
107 //Point on spherical hull
108 std::array<Vector<T,2>,8> pointsOnSphericalHull = {
109 Vector<T,2>(position[0]-distB, position[1]-distB),
110 Vector<T,2>(position[0], position[1]-distA), //right
111 Vector<T,2>(position[0]+distB, position[1]-distB),
112
113 Vector<T,2>(position[0]-distA, position[1]), //back
114 // Centre excluded here!
115 Vector<T,2>(position[0]+distA, position[1]), //front
116
117 Vector<T,2>(position[0]-distB, position[1]+distB),
118 Vector<T,2>(position[0], position[1]+distA), //left
119 Vector<T,2>(position[0]+distB, position[1]+distB)
120 };
121
122 return pointsOnSphericalHull;
123}
Plain old scalar vector.

◆ discretePointsOnSphericalHull() [2/2]

template<typename T >
std::array< Vector< T, 3 >, 26 > olb::particles::discretePointsOnSphericalHull ( Vector< T, 3 > position,
T radius )

Definition at line 47 of file particleUtilities.h.

49{
50 //TODO: check correctness
51 T distA = radius;
52 T distB = (1/std::sqrt(2))*distA;
53 T distC = (1/std::sqrt(2))*distB;
54
55 //Point on spherical hull
56 std::array<Vector<T,3>,26> pointsOnSphericalHull = {
57 Vector<T,3>(position[0]-distC, position[1]-distC, position[2]-distC),
58 Vector<T,3>(position[0], position[1]-distB, position[2]-distB),
59 Vector<T,3>(position[0]+distC, position[1]-distC, position[2]-distC),
60
61 Vector<T,3>(position[0]-distB, position[1], position[2]-distB),
62 Vector<T,3>(position[0], position[1], position[2]-distA), //bottom
63 Vector<T,3>(position[0]+distB, position[1], position[2]-distB),
64
65 Vector<T,3>(position[0]-distC, position[1]+distC, position[2]-distC),
66 Vector<T,3>(position[0], position[1]+distB, position[2]-distB),
67 Vector<T,3>(position[0]+distC, position[1]+distC, position[2]-distC),
68
69
70 Vector<T,3>(position[0]-distB, position[1]-distB, position[2] ),
71 Vector<T,3>(position[0], position[1]-distA, position[2] ), //right
72 Vector<T,3>(position[0]+distB, position[1]-distB, position[2] ),
73
74 Vector<T,3>(position[0]-distA, position[1], position[2] ), //back
75 // Centre excluded here!
76 Vector<T,3>(position[0]+distA, position[1], position[2] ), //front
77
78 Vector<T,3>(position[0]-distB, position[1]+distB, position[2] ),
79 Vector<T,3>(position[0], position[1]+distA, position[2] ), //left
80 Vector<T,3>(position[0]+distB, position[1]+distB, position[2] ),
81
82
83 Vector<T,3>(position[0]-distC, position[1]-distC, position[2]+distC),
84 Vector<T,3>(position[0], position[1]-distB, position[2]+distB),
85 Vector<T,3>(position[0]+distC, position[1]-distC, position[2]+distC),
86
87 Vector<T,3>(position[0]-distB, position[1], position[2]+distB),
88 Vector<T,3>(position[0], position[1], position[2]+distA), //top
89 Vector<T,3>(position[0]+distB, position[1], position[2]+distB),
90
91 Vector<T,3>(position[0]-distC, position[1]+distC, position[2]+distC),
92 Vector<T,3>(position[0], position[1]+distB, position[2]+distB),
93 Vector<T,3>(position[0]+distC, position[1]+distC, position[2]+distC)
94 };
95
96 return pointsOnSphericalHull;
97}
+ Here is the caller graph for this function:

◆ doForParticle()

template<typename T , typename PARTICLETYPE , typename F >
void olb::particles::doForParticle ( Particle< T, PARTICLETYPE > & particle,
F f )

Definition at line 37 of file lambdaLoops.h.

39{
40 if constexpr (std::is_invocable_v<F,Particle<T,PARTICLETYPE>&>){
41 f( particle );
42 } else {
43 f();
44 }
45}
+ Here is the caller graph for this function:

◆ doForParticleMatchingID()

template<typename T , typename PARTICLETYPE , std::size_t selectedID, typename F >
void olb::particles::doForParticleMatchingID ( XParticleSystem< T, PARTICLETYPE > & xParticleSystem,
F f )

Definition at line 189 of file particleUtilities.h.

189 {
190 const bool hasFieldValid = access::providesValid<PARTICLETYPE>();
191 using PCOND = std::conditional_t<
192 hasFieldValid,
193 conditions::template valid_particle_matching_ID<selectedID>,
194 conditions::template particle_matching_ID<selectedID>
195 >;
196 //Loop over particle and find the one matching iD
197 forParticlesInXParticleSystem<T,PARTICLETYPE,PCOND>( xParticleSystem, f );
198}

References forParticlesInXParticleSystem(), and olb::particles::access::providesValid().

+ Here is the call graph for this function:

◆ doWhenMeetingCondition() [1/2]

template<typename T , typename PARTICLETYPE , typename PCONDITION = conditions::valid_particles, typename F >
void olb::particles::doWhenMeetingCondition ( Particle< T, PARTICLETYPE > & particle,
F f )

Definition at line 55 of file lambdaLoops.h.

58{
59 //Check whether dynamic (constexpression value not possible)
60 if constexpr (PCONDITION::dynamic){
61 if ( PCONDITION::template value<T,PARTICLETYPE>(particle) ){
62 doForParticle( particle, f);
63 }
64 }
65 //Use static constexpression value
66 //- for now, implies no template use
67 else {
68 if constexpr (PCONDITION::value){
69 doForParticle( particle, f);
70 }
71 }
72}
void doForParticle(Particle< T, PARTICLETYPE > &particle, F f)
Definition lambdaLoops.h:37

References doForParticle().

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

◆ doWhenMeetingCondition() [2/2]

template<typename T , typename PARTICLETYPE , typename PCONDITION = conditions::valid_particles, typename F >
void olb::particles::doWhenMeetingCondition ( Particle< T, PARTICLETYPE > & particle,
F f,
int globiC )

Definition at line 82 of file lambdaLoops.h.

85{
86 //Check whether dynamic (constexpression value not possible)
87 if constexpr (PCONDITION::dynamic){
88 //Check whether globiC has to be passed
89 if constexpr (std::is_invocable_v<decltype(PCONDITION::template value<T,PARTICLETYPE>),
91 if ( PCONDITION::template value<T,PARTICLETYPE>(particle,globiC) ){
92 if constexpr (std::is_invocable_v<F,Particle<T,PARTICLETYPE>&>){
93 f( particle );
94 } else {
95 f();
96 }
97 }
98 } else {
99 //Call without globiC
100 if ( PCONDITION::template value<T,PARTICLETYPE>(particle) ){
101 doForParticle( particle, f);
102 }
103 }
104 }
105 //Use static constexpression value
106 else {
107 //Call without globiC
108 if constexpr (PCONDITION::value){
109 doForParticle( particle, f);
110 }
111 }
112}

References doForParticle().

+ Here is the call graph for this function:

◆ forParticlesInParticleSystem() [1/2]

template<typename T , typename PARTICLETYPE , typename PCONDITION = conditions::valid_particles, typename F >
void olb::particles::forParticlesInParticleSystem ( ParticleSystem< T, PARTICLETYPE > & particleSystem,
F f )

Definition at line 135 of file lambdaLoops.h.

138{
139 for (std::size_t iP=0; iP<particleSystem.size(); ++iP) {
140 auto particle = particleSystem.get(iP);
141 //Execute F when particle meets condition
142 doWhenMeetingCondition<T,PARTICLETYPE,PCONDITION>( particle,
143 [&](Particle<T,PARTICLETYPE> particle){
144 f( particle );
145 });
146 }
147}
auto & get()
Expose container.
constexpr std::size_t size()
Size of ParticleSystem.

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

+ Here is the call graph for this function:

◆ forParticlesInParticleSystem() [2/2]

template<typename T , typename PARTICLETYPE , typename PCONDITION = conditions::valid_particles, typename F >
void olb::particles::forParticlesInParticleSystem ( ParticleSystem< T, PARTICLETYPE > & particleSystem,
F f,
int globiC )

Definition at line 118 of file lambdaLoops.h.

121{
122 for (std::size_t iP=0; iP<particleSystem.size(); ++iP) {
123 auto particle = particleSystem.get(iP);
124 //Execute F when particle meets condition
125 doWhenMeetingCondition<T,PARTICLETYPE,PCONDITION>( particle,
126 [&](Particle<T,PARTICLETYPE> particle){
127 f( particle );
128 }, globiC );
129 }
130}

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

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

◆ forParticlesInXParticleSystem()

template<typename T , typename PARTICLETYPE , typename PCONDITION = conditions::valid_particles, typename F >
void olb::particles::forParticlesInXParticleSystem ( XParticleSystem< T, PARTICLETYPE > & xParticleSystem,
F f )

Iterate over particles in x particle system.

  • works both for ParticleSystem and SuperParticleSystem
  • can both be run for
    • [](Particle<T,PARTICLETYPE>,ParticleSystem<T,PARTICLETYPE>,int){}
    • [](Particle<T,PARTICLETYPE>){}

Definition at line 227 of file lambdaLoops.h.

230{
231 if constexpr( access::providesParallelization<PARTICLETYPE>() ){
232 //Iterate over particle systems
233 communication::forSystemsInSuperParticleSystem( xParticleSystem,
234 [&](ParticleSystem<T,PARTICLETYPE>& particleSystem, int iC, int globiC){
235 //Iterate over particles
236 forParticlesInParticleSystem<T,PARTICLETYPE,PCONDITION>( particleSystem,
237 [&](Particle<T,PARTICLETYPE>& particle){
238 if constexpr (std::is_invocable_v<F,
240 {
241 f( particle, particleSystem, globiC );
242 } else {
243 f( particle );
244 }
245 },globiC);
246 });
247 } else {
248 //Loop over all particles
249 forParticlesInParticleSystem<T,PARTICLETYPE,PCONDITION>( xParticleSystem,
250 [&](Particle<T,PARTICLETYPE>& particle){
251 if constexpr (std::is_invocable_v<F,
252 Particle<T,PARTICLETYPE>&,ParticleSystem<T,PARTICLETYPE>&,int>)
253 {
254 f( particle, xParticleSystem, 0 );
255 } else {
256 f( particle );
257 }
258 });
259 }
260}

References forParticlesInParticleSystem(), olb::particles::communication::forSystemsInSuperParticleSystem(), and olb::particles::access::providesParallelization().

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

◆ forSpatialLocationsInBlockParticleIntersection() [1/2]

template<typename T , typename DESCRIPTOR , typename F >
void olb::particles::forSpatialLocationsInBlockParticleIntersection ( const BlockGeometry< T, DESCRIPTOR::d > & blockGeometry,
BlockLattice< T, DESCRIPTOR > & blockLattice,
int padding,
Vector< T, DESCRIPTOR::d > position,
T circumRadius,
F f )

Definition at line 193 of file blockLatticeInteraction.hh.

197{
198 constexpr unsigned D = DESCRIPTOR::d;
199 LatticeR<D> start;
200 LatticeR<D> end;
201 if (getBlockParticleIntersection(blockGeometry,
202 T {1} / blockGeometry.getDeltaR(), start,
203 end, position, circumRadius)) {
204 //Extend range by padding if desired
205 start -= LatticeR<D>(padding);
206 end += LatticeR<D>(padding);
207 //For all cells in subdomain defined by start/end
208 blockLattice.forSpatialLocations(start, end,
209 [&](const LatticeR<D>& latticeR) {
210 f(latticeR);
211 });
212 }
213}
T getDeltaR() const
Read only access to the voxel size given in SI units (meter)
void forSpatialLocations(F f) const
bool getBlockParticleIntersection(const BlockGeometry< T, D > &blockGeometry, T invDeltaX, LatticeR< D > &start, LatticeR< D > &end, Vector< T, D > position, T circumRadius)

References getBlockParticleIntersection(), and olb::BlockGeometry< T, D >::getDeltaR().

+ Here is the call graph for this function:

◆ forSpatialLocationsInBlockParticleIntersection() [2/2]

template<typename T , typename DESCRIPTOR , typename F >
void olb::particles::forSpatialLocationsInBlockParticleIntersection ( const BlockGeometry< T, DESCRIPTOR::d > & blockGeometry,
BlockLattice< T, DESCRIPTOR > & blockLattice,
Vector< T, DESCRIPTOR::d > position,
T circumRadius,
F f )
+ Here is the caller graph for this function:

◆ getBlockParticleIntersection() [1/2]

template<typename T , unsigned D>
bool olb::particles::getBlockParticleIntersection ( const BlockGeometry< T, D > & blockGeometry,
T invDeltaX,
LatticeR< D > & start,
LatticeR< D > & end,
PhysR< T, D > position,
T circumRadius )

Setting block bounds excluding(!) padding

Calculate relative start/end in block domain

Set latticeR start/end and check validity

Definition at line 37 of file blockLatticeInteraction.hh.

41{
43 LatticeR<D> blockMin(0);
44 LatticeR<D> blockMax(blockGeometry.getExtent() - 1);
45
47 PhysR<T, D> particleMin(position - circumRadius);
48 PhysR<T, D> relStart(particleMin - blockGeometry.getOrigin());
49 PhysR<T, D> particleMax(position + circumRadius);
50 PhysR<T, D> relEnd(particleMax - blockGeometry.getOrigin());
51
53 bool validRange = true;
54 for (unsigned iDim = 0; iDim < D; ++iDim) {
55 start[iDim] =
56 util::max(util::floor(invDeltaX * relStart[iDim]), blockMin[iDim]);
57 end[iDim] = util::min(util::ceil(invDeltaX * relEnd[iDim]), blockMax[iDim]);
58 int intersectionRange = end[iDim] - start[iDim];
59 validRange = validRange && (intersectionRange >= 0.);
60 }
61
62 return validRange;
63}
Vector< T, D > getOrigin() const
Read only access to the origin position given in SI units (meter)
Vector< int, D > getExtent() const
Returns the extend of the block in lattice units.

References olb::util::ceil(), olb::util::floor(), olb::BlockGeometry< T, D >::getExtent(), olb::BlockGeometry< T, D >::getOrigin(), olb::util::max(), and olb::util::min().

+ Here is the call graph for this function:

◆ getBlockParticleIntersection() [2/2]

template<typename T , unsigned D>
bool olb::particles::getBlockParticleIntersection ( const BlockGeometry< T, D > & blockGeometry,
T invDeltaX,
LatticeR< D > & start,
LatticeR< D > & end,
Vector< T, D > position,
T circumRadius )
+ Here is the caller graph for this function:

◆ isPeriodic()

template<unsigned D>
bool olb::particles::isPeriodic ( const Vector< bool, D > & periodic)
constexpr

Definition at line 42 of file particleDynamicsFunctions.h.

43{
44 bool isPeriodic = periodic[0] || periodic[1];
45 if constexpr (D == 3) {
46 isPeriodic = isPeriodic || periodic[2];
47 }
48 return isPeriodic;
49}
constexpr bool isPeriodic(const Vector< bool, D > &periodic)

References isPeriodic().

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

◆ purgeInvalidParticles()

template<typename T , typename PARTICLETYPE >
void olb::particles::purgeInvalidParticles ( XParticleSystem< T, PARTICLETYPE > & xParticleSystem)

Definition at line 146 of file particleUtilities.h.

148{
149 using PCONDITION = conditions::invalid_particles;
150 if constexpr (access::providesParallelization<PARTICLETYPE>()){
151 auto& sParticleSystem = xParticleSystem;
152 //Iterate over particle systems
153 communication::forSystemsInSuperParticleSystem( sParticleSystem,
154 [&](ParticleSystem<T,PARTICLETYPE>& particleSystem, int iC, int globiC){
155 //Iterate over particles
156 std::size_t iP=0;
157 while(iP < particleSystem.size()){
158 auto particle = particleSystem.get(iP);
159 ++iP;
160 //Execute F when particle meets condition
161 doWhenMeetingCondition<T,PARTICLETYPE,PCONDITION>( particle,
162 [&](Particle<T,PARTICLETYPE> particle){
163 //Erase particle
164 auto& container = particleSystem.get();
165 container.erase( particle.getId() );
166 --iP; //reset counter
167 },globiC);
168 }
169 });
170 } else {
171 auto& particleSystem = xParticleSystem;
172 std::size_t iP=0;
173 while(iP < particleSystem.size()){
174 auto particle = particleSystem.get(iP);
175 ++iP;
176 //Execute F when particle meets condition
177 doWhenMeetingCondition<T,PARTICLETYPE,PCONDITION>( particle,
178 [&](Particle<T,PARTICLETYPE> particle){
179 //Erase particle
180 auto& container = particleSystem.get();
181 container.erase( particle.getId() );
182 --iP; //reset counter
183 });
184 }
185 }
186}
std::size_t getId() const
Return memory ID of the currently represented particle.
Definition particle.hh:67

References doWhenMeetingCondition(), olb::particles::communication::forSystemsInSuperParticleSystem(), olb::particles::ParticleSystem< T, PARTICLETYPE >::get(), olb::particles::Particle< T, PARTICLETYPE >::getId(), olb::particles::access::providesParallelization(), and olb::particles::ParticleSystem< T, PARTICLETYPE >::size().

+ Here is the call graph for this function:

◆ resetAllParticleRelatedFields()

template<typename DESCRIPTOR , typename CELL , typename V = typename CELL::value_t>
void olb::particles::resetAllParticleRelatedFields ( CELL & cell)
inlinenoexcept

Definition at line 83 of file porousBGKdynamics.h.

84{
85 resetParticleRelatedFields<DESCRIPTOR,CELL,V>(cell);
86 resetParticleContactRelatedFields<DESCRIPTOR,CELL,V>(cell);
87}

References resetParticleContactRelatedFields(), and resetParticleRelatedFields().

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

◆ resetBlockContactField()

template<typename T , typename DESCRIPTOR >
void olb::particles::resetBlockContactField ( const BlockGeometry< T, DESCRIPTOR::d > & blockGeometry,
BlockLattice< T, DESCRIPTOR > & blockLattice )

Definition at line 457 of file blockLatticeInteraction.hh.

460{
461 constexpr unsigned D = DESCRIPTOR::d;
462 int padding = blockGeometry.getPadding();
463 LatticeR<D> blockMin(0. - padding);
464 LatticeR<D> blockMax(blockGeometry.getExtent() - 1 + padding);
465
466 using namespace descriptors;
467 blockLattice.forSpatialLocations(
468 blockMin, blockMax, [&](LatticeR<D> latticeR) {
469 auto cell = blockLattice.get(latticeR);
470 particles::resetParticleContactRelatedFields<DESCRIPTOR, decltype(cell), typename decltype(cell)::value_t>(cell);
471 });
472}
Cell< T, DESCRIPTOR > get(CellID iCell)
Get Cell interface for index iCell.
int getPadding() const
Read only access to padding.

References olb::BlockGeometry< T, D >::getExtent(), olb::BlockStructureD< D >::getPadding(), and resetParticleContactRelatedFields().

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

◆ resetBlockParticleField()

template<typename T , typename DESCRIPTOR >
void olb::particles::resetBlockParticleField ( const BlockGeometry< T, DESCRIPTOR::d > & blockGeometry,
BlockLattice< T, DESCRIPTOR > & blockLattice )

Definition at line 438 of file blockLatticeInteraction.hh.

441{
442 constexpr unsigned D = DESCRIPTOR::d;
443 int padding = blockGeometry.getPadding();
444 LatticeR<D> blockMin(0. - padding);
445 LatticeR<D> blockMax(blockGeometry.getExtent() - 1 + padding);
446
447 using namespace descriptors;
448 blockLattice.forSpatialLocations(
449 blockMin, blockMax, [&](const LatticeR<D>& latticeR) {
450 auto cell = blockLattice.get(latticeR);
451 particles::resetAllParticleRelatedFields<DESCRIPTOR, decltype(cell), typename decltype(cell)::value_t>(cell);
452 });
453}

References olb::BlockGeometry< T, D >::getExtent(), olb::BlockStructureD< D >::getPadding(), and resetAllParticleRelatedFields().

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

◆ resetContactField()

template<typename T , typename DESCRIPTOR >
void olb::particles::resetContactField ( SuperGeometry< T, DESCRIPTOR::d > & sGeometry,
SuperLattice< T, DESCRIPTOR > & sLattice )

Definition at line 102 of file superLatticeInteraction.hh.

104{
105 for (int iC = 0; iC < sLattice.getLoadBalancer().size(); ++iC) {
106 resetBlockContactField( sGeometry.getBlockGeometry(iC), sLattice.getBlock(iC));
107 }
108}
BlockGeometry< T, D > & getBlockGeometry(int locIC)
Read and write access to a single block geometry.
BlockLattice< T, DESCRIPTOR > & getBlock(int locC)
Return BlockLattice with local index locC.
LoadBalancer< T > & getLoadBalancer()
Read and write access to the load balancer.
void resetBlockContactField(const BlockGeometry< T, DESCRIPTOR::d > &blockGeometry, BlockLattice< T, DESCRIPTOR > &blockLattice)

References olb::SuperLattice< T, DESCRIPTOR >::getBlock(), olb::SuperGeometry< T, D >::getBlockGeometry(), olb::SuperStructure< T, D >::getLoadBalancer(), and resetBlockContactField().

+ Here is the call graph for this function:

◆ resetParticleContactRelatedFields()

template<typename DESCRIPTOR , typename CELL , typename V = typename CELL::value_t>
void olb::particles::resetParticleContactRelatedFields ( CELL & cell)
inlinenoexcept

Definition at line 72 of file porousBGKdynamics.h.

73{
74 if constexpr (DESCRIPTOR::template provides<
76 cell.template setField<descriptors::CONTACT_DETECTION>(
77 descriptors::CONTACT_DETECTION::template getInitialValue<V,DESCRIPTOR>() );
78 }
79}
+ Here is the caller graph for this function:

◆ resetParticleRelatedFields()

template<typename DESCRIPTOR , typename CELL , typename V = typename CELL::value_t>
void olb::particles::resetParticleRelatedFields ( CELL & cell)
inlinenoexcept

Definition at line 48 of file porousBGKdynamics.h.

49{
50 if constexpr (DESCRIPTOR::template provides<descriptors::POROSITY>()) {
51 cell.template setField<descriptors::POROSITY>(
52 descriptors::POROSITY::template getInitialValue<V,DESCRIPTOR>() );
53 }
54 if constexpr (DESCRIPTOR::template provides<
56 cell.template setField<descriptors::VELOCITY_DENOMINATOR>(
57 descriptors::VELOCITY_DENOMINATOR::template getInitialValue<V,DESCRIPTOR>() );
58 }
59 if constexpr (DESCRIPTOR::template provides<
60 descriptors::VELOCITY_NUMERATOR>()) {
61 cell.template setField<descriptors::VELOCITY_NUMERATOR>(
62 descriptors::VELOCITY_NUMERATOR::template getInitialValue<V,DESCRIPTOR>() );
63 }
64 if constexpr (DESCRIPTOR::template provides<descriptors::VELOCITY_SOLID>()) {
65 cell.template setField<descriptors::VELOCITY_SOLID>(
66 descriptors::VELOCITY_SOLID::template getInitialValue<V,DESCRIPTOR>() );
67 }
68}
+ Here is the caller graph for this function:

◆ resetSuperParticleField()

template<typename T , typename DESCRIPTOR >
void olb::particles::resetSuperParticleField ( SuperGeometry< T, DESCRIPTOR::d > & sGeometry,
SuperLattice< T, DESCRIPTOR > & sLattice )

Reset particle field.

Definition at line 92 of file superLatticeInteraction.hh.

94{
95 for (int iC = 0; iC < sLattice.getLoadBalancer().size(); ++iC) {
96 resetBlockParticleField( sGeometry.getBlockGeometry(iC), sLattice.getBlock(iC));
97 }
98}
void resetBlockParticleField(const BlockGeometry< T, DESCRIPTOR::d > &blockGeometry, BlockLattice< T, DESCRIPTOR > &blockLattice)

References olb::SuperLattice< T, DESCRIPTOR >::getBlock(), olb::SuperGeometry< T, D >::getBlockGeometry(), olb::SuperStructure< T, D >::getLoadBalancer(), and resetBlockParticleField().

+ Here is the call graph for this function:

◆ searchParticleLocally()

template<typename T , typename PARTICLETYPE , typename PCONDITION = conditions::valid_particles>
bool olb::particles::searchParticleLocally ( ParticleSystem< T, PARTICLETYPE > & particleSystem,
std::size_t globalIDrequested,
std::size_t & localParticleID )

Definition at line 202 of file particleUtilities.h.

204{
205 using namespace descriptors;
206 static_assert(PARTICLETYPE::template providesNested<PARALLELIZATION,ID>(), "Field PARALLELIZATION:ID has to be provided");
207 //Initialize return quantities
208 localParticleID = 0;
209 bool found = false;
210 //Loop over particles
211 for (std::size_t iP=0; iP<particleSystem.size(); ++iP) {
212 if (!found){
213 auto particle = particleSystem.get(iP);
214 //Execute F when particle meets condition
215 doWhenMeetingCondition<T,PARTICLETYPE,PCONDITION>( particle,
216 [&](Particle<T,PARTICLETYPE> particle){
217 auto globalID = particle.template getField<PARALLELIZATION,ID>();
218 if (globalID==globalIDrequested){
219 localParticleID = particle.getId();
220 found=true;
221 }
222 });
223 } else {
224 break;
225 }
226 }
227 return found;
228}

References doWhenMeetingCondition(), olb::particles::ParticleSystem< T, PARTICLETYPE >::get(), olb::particles::Particle< T, PARTICLETYPE >::getId(), and olb::particles::ParticleSystem< T, PARTICLETYPE >::size().

+ Here is the call graph for this function:

◆ setBlockParticleField() [1/4]

template<typename T , typename DESCRIPTOR , typename PARTICLETYPE >
void olb::particles::setBlockParticleField ( const BlockGeometry< T, DESCRIPTOR::d > & blockGeometry,
BlockLattice< T, DESCRIPTOR > & blockLattice,
UnitConverter< T, DESCRIPTOR > const & converter,
const PhysR< T, DESCRIPTOR::d > & cellMin,
const PhysR< T, DESCRIPTOR::d > & cellMax,
Particle< T, PARTICLETYPE > & particle,
const Vector< bool, DESCRIPTOR::d > & periodic )

Definition at line 93 of file blockLatticeInteraction.hh.

100{
101 constexpr unsigned D = DESCRIPTOR::d;
102 using namespace descriptors;
103 const T circumRadius = particles::access::getRadius(particle);
104 const PhysR<T, D> originalPosition(particles::access::getPosition(particle));
105 // Checking if the particle's surface leaves the domain
106 bool surfaceOutOfGeometry;
107 PhysR<T, D> ghostPos;
108 checkSmoothIndicatorOutOfGeometry(surfaceOutOfGeometry, ghostPos, cellMin,
109 cellMax, originalPosition, circumRadius,
110 periodic);
111
112 //Do the normal routine if the particle is in the geometry
113 if (!surfaceOutOfGeometry) {
114 setBlockParticleField(blockGeometry, blockLattice, converter, particle);
115 }
116 else {
117 //sets the Particle to ghost position on the other side of the domain and sets the field
118 particle.template setField<GENERAL, POSITION>(ghostPos);
119 setBlockParticleField(blockGeometry, blockLattice, converter, particle);
120 //Reverting Particle to its Previous position and setting the field
121 particle.template setField<GENERAL, POSITION>(originalPosition);
122 setBlockParticleField(blockGeometry, blockLattice, converter, particle);
123
124 // For parallized particles, the update of the position is processed during relocation
125 if constexpr(!particles::access::providesParallelization<PARTICLETYPE>()) {
126 // Check if center of mass left the simulation domain
127 bool centerOfMassOutOfDomain = false;
128 for (unsigned iDim = 0; iDim < D; ++iDim) {
129 centerOfMassOutOfDomain = centerOfMassOutOfDomain ||
130 originalPosition[iDim] < cellMin[iDim] ||
131 originalPosition[iDim] > cellMax[iDim];
132 }
133
134 // Replace the position of the center of mass with the ghost position
135 // (If the center of mass is outside the domain)
136 if (centerOfMassOutOfDomain) {
137 particle.template setField<GENERAL, POSITION>(ghostPos);
138 }
139 }
140 }
141}
void setBlockParticleField(const BlockGeometry< T, DESCRIPTOR::d > &blockGeometry, BlockLattice< T, DESCRIPTOR > &blockLattice, UnitConverter< T, DESCRIPTOR > const &converter, Particle< T, PARTICLETYPE > &particle)
void checkSmoothIndicatorOutOfGeometry(bool &outOfGeometry, Vector< T, D > &ghostPos, const PhysR< T, D > &cellMin, const PhysR< T, D > &cellMax, const Vector< T, D > &position, T circumRadius, const Vector< bool, D > &periodic)

References checkSmoothIndicatorOutOfGeometry(), olb::particles::access::getPosition(), olb::particles::access::getRadius(), olb::particles::access::providesParallelization(), and setBlockParticleField().

+ Here is the call graph for this function:

◆ setBlockParticleField() [2/4]

template<typename T , typename DESCRIPTOR , typename PARTICLETYPE , typename PARTICLECONTACTTYPE , typename WALLCONTACTTYPE , typename F >
void olb::particles::setBlockParticleField ( const BlockGeometry< T, DESCRIPTOR::d > & blockGeometry,
BlockLattice< T, DESCRIPTOR > & blockLattice,
UnitConverter< T, DESCRIPTOR > const & converter,
const PhysR< T, DESCRIPTOR::d > & cellMin,
const PhysR< T, DESCRIPTOR::d > & cellMax,
ParticleSystem< T, PARTICLETYPE > & particleSystem,
contact::ContactContainer< T, PARTICLECONTACTTYPE, WALLCONTACTTYPE > & contactContainer,
size_t iP,
Particle< T, PARTICLETYPE > & particle,
std::vector< SolidBoundary< T, DESCRIPTOR::d > > & solidBoundaries,
F getSetupPeriodicity )

Definition at line 145 of file blockLatticeInteraction.hh.

157{
158 constexpr unsigned D = DESCRIPTOR::d;
159 using namespace descriptors;
160 const T circumRadius = particles::access::getRadius(particle);
161 // Checking if the Particle leaves the Domain
162 bool surfaceOutOfGeometry;
163 PhysR<T, D> originalPosition(particles::access::getPosition(particle));
164 PhysR<T, D> ghostPos;
166 surfaceOutOfGeometry, ghostPos, cellMin, cellMax, originalPosition,
167 circumRadius, getSetupPeriodicity());
168
169 //Do the normal routine if the particle is in the geometry
170 if (!surfaceOutOfGeometry) {
171 setBlockParticleField(blockGeometry, blockLattice, converter,
172 particleSystem, contactContainer, iP, particle,
173 solidBoundaries);
174 }
175 else {
176 //sets the Particle to ghost position on the other side of the domain and sets the field
177 particle.template setField<GENERAL, POSITION>(ghostPos);
178 setBlockParticleField(blockGeometry, blockLattice, converter,
179 particleSystem, contactContainer, iP, particle,
180 solidBoundaries, cellMin, cellMax,
181 getSetupPeriodicity);
182 //Reverting Particle to its Previous position and setting the field
183 particle.template setField<GENERAL, POSITION>(originalPosition);
184 setBlockParticleField(blockGeometry, blockLattice, converter,
185 particleSystem, contactContainer, iP, particle,
186 solidBoundaries, cellMin, cellMax,
187 getSetupPeriodicity);
188 }
189}

References checkSmoothIndicatorOutOfGeometry(), olb::particles::access::getPosition(), olb::particles::access::getRadius(), and setBlockParticleField().

+ Here is the call graph for this function:

◆ setBlockParticleField() [3/4]

template<typename T , typename DESCRIPTOR , typename PARTICLETYPE >
void olb::particles::setBlockParticleField ( const BlockGeometry< T, DESCRIPTOR::d > & blockGeometry,
BlockLattice< T, DESCRIPTOR > & blockLattice,
UnitConverter< T, DESCRIPTOR > const & converter,
Particle< T, PARTICLETYPE > & particle )

Definition at line 218 of file blockLatticeInteraction.hh.

222{
223 constexpr unsigned D = DESCRIPTOR::d;
224
225 using namespace descriptors;
226 auto circumRadius =
227 particle.template getField<SURFACE, SINDICATOR>()->getCircumRadius();
228 auto position = particle.template getField<GENERAL, POSITION>();
229
230 //For all cells in block particle intersection
231 int padding = blockGeometry.getPadding();
233 blockGeometry, blockLattice, padding, position, circumRadius,
234 [&](const LatticeR<D>& latticeR) {
235 //Get phys position
236 T physR[D] = {};
237 Vector<T, D> physRV;
238 blockGeometry.getPhysR(physRV, latticeR);
239 for (unsigned iD = 0; iD != D; ++iD) {
240 physR[iD] = physRV[iD];
241 }
242 //Retrieve porosity
243 FieldD<T, DESCRIPTOR, descriptors::POROSITY> porosity {};
244 particles::resolved::evalSolidVolumeFraction(porosity.data(), physR, particle);
245
246 //For cells containing particle bits
247 if (!util::nearZero(porosity[0])) {
248 auto material = blockGeometry.get(latticeR);
249 //TODO: remove material 1 from hardcoded version
250 if (material == 1) {
251 //Retrieve local velocity
252 FieldD<T, DESCRIPTOR, descriptors::VELOCITY> velocity {};
253 velocity = particles::dynamics::calculateLocalVelocity(
254 particle, PhysR<T, D>(physR));
255 for (unsigned iDim = 0; iDim != D; ++iDim) {
256 velocity[iDim] = converter.getLatticeVelocity(velocity[iDim]);
257 }
258 //Calculate solid volume fraction
259 T solidVolumeFraction = 1. - porosity[0];
260 //Write to fields
261 {
262 auto cell = blockLattice.get(latticeR);
263 if constexpr (!DESCRIPTOR::template provides<descriptors::VELOCITY_SOLID>()) {
264 cell.template getFieldPointer<
265 descriptors::VELOCITY_NUMERATOR>() += porosity[0] * velocity;
266 cell.template getFieldPointer<
267 descriptors::VELOCITY_DENOMINATOR>() += porosity;
268 }
269 else {
270 cell.template getFieldPointer<
271 descriptors::VELOCITY_SOLID>() += velocity;
272 }
273 cell.template getFieldPointer<descriptors::POROSITY>() *=
274 solidVolumeFraction;
275 }
276 } //if (material==1)
277 } //if (!util::nearZero(porosity[0]))
278 });
279}
Vector< T, D > getPhysR(LatticeR< D > latticeR) const
std::enable_if_t< sizeof...(L)==D, int > get(L... latticeR) const
Read-only access to a material number.
constexpr T getLatticeVelocity(T physVelocity) const
conversion from physical to lattice velocity
void forSpatialLocationsInBlockParticleIntersection(const BlockGeometry< T, DESCRIPTOR::d > &blockGeometry, BlockLattice< T, DESCRIPTOR > &blockLattice, Vector< T, DESCRIPTOR::d > position, T circumRadius, F f)

References olb::particles::dynamics::calculateLocalVelocity(), olb::particles::resolved::evalSolidVolumeFraction(), forSpatialLocationsInBlockParticleIntersection(), olb::BlockGeometry< T, D >::get(), olb::UnitConverter< T, DESCRIPTOR >::getLatticeVelocity(), olb::BlockStructureD< D >::getPadding(), olb::BlockGeometry< T, D >::getPhysR(), and olb::util::nearZero().

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

◆ setBlockParticleField() [4/4]

template<typename T , typename DESCRIPTOR , typename PARTICLETYPE , typename PARTICLECONTACTTYPE , typename WALLCONTACTTYPE , typename F = decltype(defaults::periodicity<PARTICLETYPE::d>)>
void olb::particles::setBlockParticleField ( const BlockGeometry< T, DESCRIPTOR::d > & blockGeometry,
BlockLattice< T, DESCRIPTOR > & blockLattice,
UnitConverter< T, DESCRIPTOR > const & converter,
ParticleSystem< T, PARTICLETYPE > & particleSystem,
contact::ContactContainer< T, PARTICLECONTACTTYPE, WALLCONTACTTYPE > & particleContacts,
size_t iP,
Particle< T, PARTICLETYPE > & particle,
std::vector< SolidBoundary< T, DESCRIPTOR::d > > & solidBoundaries,
const PhysR< T, DESCRIPTOR::d > & cellMin = PhysR<T, DESCRIPTOR::d>(std::numeric_limits<T>::quiet_NaN()),
const PhysR< T, DESCRIPTOR::d > & cellMax = PhysR<T, DESCRIPTOR::d>(std::numeric_limits<T>::quiet_NaN()),
F getSetupPeriodicity = defaults::periodicity<PARTICLETYPE::d> )

Definition at line 283 of file blockLatticeInteraction.hh.

294{
295 using namespace descriptors;
296 constexpr unsigned D = DESCRIPTOR::d;
297 const T deltaX = blockGeometry.getDeltaR();
298 auto sIndicator = particle.template getField<SURFACE, SINDICATOR>();
299 const T detectionDistance = particles::contact::evalContactDetectionDistance(particle, deltaX);
300 const T circumRadius = particles::contact::evalCircumRadius(
301 detectionDistance, sIndicator->getCircumRadius(), sIndicator->getEpsilon());
302 auto position = particle.template getField<GENERAL, POSITION>();
303 //Retrieve wallMaterials
304 std::set<int> wallMaterials = getLatticeMaterials( solidBoundaries );
305
306 //For all cells in block particle intersection
307 int padding = blockGeometry.getPadding();
309 blockGeometry, blockLattice, padding, position, circumRadius,
310 [&](const LatticeR<D>& latticeR) {
311 //Get phys position
312 T physR[D] = {};
313 Vector<T, D> physRV;
314 blockGeometry.getPhysR(physRV, latticeR);
315 for (unsigned iD = 0; iD != D; ++iD) {
316 physR[iD] = physRV[iD];
317 }
318 T const signedDist = particles::resolved::signedDistanceToParticle(
319 particle, PhysR<T, D>(physR));
320 //Retrieve porosity
321 FieldD<T, DESCRIPTOR, descriptors::POROSITY> porosity {};
322 sdf::evalSolidVolumeFraction(porosity.data(), signedDist,
323 sIndicator->getEpsilon());
324
325 //For cells containing particle bits
326 if (!util::nearZero(porosity[0])) {
327 //Retrieve material at cell and ensure location outside of boundary
328 auto material = blockGeometry.getMaterial(latticeR);
329 if (material != 0 && wallMaterials.find(material)==wallMaterials.end()) {
330 //Retrieve local velocity
331 FieldD<T, DESCRIPTOR, descriptors::VELOCITY> velocity {};
332 velocity = particles::dynamics::calculateLocalVelocity(
333 particle, PhysR<T, D>(physR));
334 for (unsigned iDim = 0; iDim != D; ++iDim) {
335 velocity[iDim] = converter.getLatticeVelocity(velocity[iDim]);
336 }
337 //Calculate solid volume fraction
338 T solidVolumeFraction = 1. - porosity[0];
339 //Write to fields
340 {
341 auto cell = blockLattice.get(latticeR);
342 if constexpr (!DESCRIPTOR::template provides<descriptors::VELOCITY_SOLID>()) {
343 cell.template getFieldPointer<descriptors::VELOCITY_NUMERATOR>() +=
344 porosity[0] * velocity;
345 cell.template getFieldPointer<
346 descriptors::VELOCITY_DENOMINATOR>() += porosity;
347 }
348 else {
349 cell.template getFieldPointer<descriptors::VELOCITY_SOLID>() += velocity;
350 }
351 cell.template getFieldPointer<descriptors::POROSITY>() *=
352 solidVolumeFraction;
353 }
354 } //if (wallMaterials.find(material)==wallMaterials.end())
355 } //if (!util::nearZero(porosity[0]))
356
357 // For contacts we have another distance
358 // Particle-particle detection (0.5 * deltaX layer for each equals deltaX which is then the same as for the wall detection)
359 if (signedDist < detectionDistance) {
360 // We must ignore cells on padding
361 bool ignoreCell = false;
362 for (unsigned i = 0; i < D; ++i) {
363 if (latticeR[i] < 0 ||
364 latticeR[i] > blockGeometry.getExtent()[i] - 1) {
365 ignoreCell = true;
366 }
367 }
368
369 // processing contact detection
370 if (!ignoreCell) {
371 auto contactHelper = blockLattice.get(latticeR)
372 .template getFieldPointer<
373 descriptors::CONTACT_DETECTION>();
374 // this checks if another particle is already on this cell, if yes, the contacts are updated. If no, the ID (shifted by 1) is stored.
375 std::size_t iP2 = contactHelper[0] - 1;
376 if (contactHelper[0] > 0 && iP2 != iP) {
377 std::size_t localiP2 = iP2;
378 if constexpr (particles::access::providesParallelization<
379 PARTICLETYPE>()) {
380 for (std::size_t localiP = 0; localiP < particleSystem.size();
381 ++localiP) {
382 const std::size_t globalParticleID =
383 particleSystem.get(localiP)
384 .template getField<PARALLELIZATION, ID>();
385 if (globalParticleID == iP2) {
386 localiP2 = localiP;
387 break;
388 }
389 }
390 }
391 auto particle2 = particleSystem.get(localiP2);
392
393 // Check that at least one particle should not ignore contacts
394 bool detectParticleContacts = true;
395 if constexpr (access::providesComputeContact<PARTICLETYPE>()) {
396 detectParticleContacts =
397 access::isContactComputationEnabled(particle, particle2);
398 }
399
400 if (detectParticleContacts) {
401 particles::contact::updateContacts(
402 contactContainer, std::array<std::size_t, 2>({iP2, iP}),
403 PhysR<T, D>(physR), particle2, particle, cellMin, cellMax,
404 getSetupPeriodicity, deltaX);
405 }
406 }
407 else {
408 contactHelper[0] = iP + 1;
409 }
410
411 // Check if contacts should be ignored
412 bool detectWallContacts = true;
413 if constexpr (access::providesComputeContact<PARTICLETYPE>()) {
414 detectWallContacts =
415 access::isContactComputationEnabled(particle);
416 }
417
418 if (detectWallContacts) {
419 for (unsigned short solidBoundaryID = 0; SolidBoundary<T, DESCRIPTOR::d>& solidBoundary : solidBoundaries){
420 const T solidBoundaryDetectionDistance =
421 0.5 * util::sqrt(D) * deltaX +
422 solidBoundary.getEnlargementForContact();
423 if (solidBoundary.getIndicator()->signedDistance(
424 PhysR<T, D>(physR)) < solidBoundaryDetectionDistance) {
425 particles::contact::updateContacts(
426 contactContainer, iP, solidBoundaryID, PhysR<T, D>(physR),
427 particle, cellMin, cellMax, getSetupPeriodicity, deltaX);
428 }
429 ++solidBoundaryID;
430 }
431 }
432 }
433 }
434 });
435}
int getMaterial(LatticeR< D > latticeR) const
returns the (iX,iY) entry in the 2D scalar field
std::set< int > getLatticeMaterials(const std::vector< SolidBoundary< T, D > > &solidBoundaries)
Get material numbers of multiple solid boundaries in std::vector.
Definition wall.h:64

References olb::particles::dynamics::calculateLocalVelocity(), olb::particles::contact::evalCircumRadius(), olb::particles::contact::evalContactDetectionDistance(), olb::sdf::evalSolidVolumeFraction(), forSpatialLocationsInBlockParticleIntersection(), olb::particles::ParticleSystem< T, PARTICLETYPE >::get(), olb::BlockGeometry< T, D >::getDeltaR(), olb::BlockGeometry< T, D >::getExtent(), olb::getLatticeMaterials(), olb::UnitConverter< T, DESCRIPTOR >::getLatticeVelocity(), olb::BlockGeometry< T, D >::getMaterial(), olb::BlockStructureD< D >::getPadding(), olb::BlockGeometry< T, D >::getPhysR(), olb::particles::access::isContactComputationEnabled(), olb::util::nearZero(), olb::particles::access::providesComputeContact(), olb::particles::access::providesParallelization(), olb::particles::resolved::signedDistanceToParticle(), olb::particles::ParticleSystem< T, PARTICLETYPE >::size(), olb::util::sqrt(), and olb::particles::contact::updateContacts().

+ Here is the call graph for this function:

◆ setSuperParticleField() [1/2]

template<typename T , typename DESCRIPTOR , typename PARTICLETYPE , typename PARTICLECONTACTTYPE , typename WALLCONTACTTYPE , typename F >
void olb::particles::setSuperParticleField ( const SuperGeometry< T, DESCRIPTOR::d > & sGeometry,
const PhysR< T, DESCRIPTOR::d > & min,
const PhysR< T, DESCRIPTOR::d > & max,
SuperLattice< T, DESCRIPTOR > & sLattice,
UnitConverter< T, DESCRIPTOR > const & converter,
ParticleSystem< T, PARTICLETYPE > & particleSystem,
contact::ContactContainer< T, PARTICLECONTACTTYPE, WALLCONTACTTYPE > & particleContacts,
size_t iP,
Particle< T, PARTICLETYPE > & particle,
std::vector< SolidBoundary< T, DESCRIPTOR::d > > & solidBoundaries,
F getSetupPeriodicity,
int globiC = -1 )

Definition at line 60 of file superLatticeInteraction.hh.

72{
73 for (int iC = 0; iC < sLattice.getLoadBalancer().size(); ++iC) {
74 if(globaliC == sLattice.getLoadBalancer().glob(iC)
75 || !particles::access::providesParallelization<PARTICLETYPE>()) {
76 if constexpr ( isPeriodic(getSetupPeriodicity()) ) {
78 sLattice.getBlock(iC), converter, min, max,
79 particleSystem, contactContainer, iP,
80 particle, solidBoundaries, getSetupPeriodicity);
81 }
82 else {
83 setBlockParticleField( sGeometry.getBlockGeometry(iC),
84 sLattice.getBlock(iC), converter, particleSystem, contactContainer,
85 iP, particle, solidBoundaries);
86 }
87 }
88 }
89}

References olb::SuperLattice< T, DESCRIPTOR >::getBlock(), olb::SuperGeometry< T, D >::getBlockGeometry(), olb::SuperStructure< T, D >::getLoadBalancer(), isPeriodic(), olb::particles::access::providesParallelization(), and setBlockParticleField().

+ Here is the call graph for this function:

◆ setSuperParticleField() [2/2]

template<typename T , typename DESCRIPTOR , typename PARTICLETYPE >
void olb::particles::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.

Definition at line 34 of file superLatticeInteraction.hh.

39{
40 constexpr unsigned D = DESCRIPTOR::d;
41 const PhysR<T,D> min = communication::getCuboidMin<T,D>(sGeometry.getCuboidDecomposition());
42 const PhysR<T,D> max = communication::getCuboidMax<T,D>(sGeometry.getCuboidDecomposition(), min);
43
44
45 for (int iC = 0; iC < sLattice.getLoadBalancer().size(); ++iC) {
46 if ( isPeriodic(periodicity) ) {
48 sLattice.getBlock(iC), converter, min, max,
49 particle, periodicity);
50 }
51 else {
52 setBlockParticleField( sGeometry.getBlockGeometry(iC),
53 sLattice.getBlock(iC), converter, particle);
54 }
55 }
56}
CuboidDecomposition< T, D > & getCuboidDecomposition()
Read and write access to cuboid geometry.

References olb::SuperLattice< T, DESCRIPTOR >::getBlock(), olb::SuperGeometry< T, D >::getBlockGeometry(), olb::SuperStructure< T, D >::getCuboidDecomposition(), olb::particles::communication::getCuboidMax(), olb::particles::communication::getCuboidMin(), olb::SuperStructure< T, D >::getLoadBalancer(), isPeriodic(), and setBlockParticleField().

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