OpenLB 1.7
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Functions
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  communicate_surface_force
 Communicate surface force of parallel particles. More...
 
struct  couple_lattice_to_parallel_particles
 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 356 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 363 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 329 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 342 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 349 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 68 of file blockLatticeInteraction.hh.

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

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.
Definition vector.h:47

◆ 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 doForParticleMatchingID().

+ Here is the call graph for this function:
+ Here is the caller 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:

◆ 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 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 olb::particles::ParticleSystem< T, PARTICLETYPE >::get(), and olb::particles::ParticleSystem< T, PARTICLETYPE >::size().

+ Here is the call 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 olb::particles::communication::forSystemsInSuperParticleSystem().

+ Here is the call 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 195 of file blockLatticeInteraction.hh.

199{
200 constexpr unsigned D = DESCRIPTOR::d;
201 LatticeR<D> start;
202 LatticeR<D> end;
203 if (getBlockParticleIntersection(blockGeometry,
204 T {1} / blockGeometry.getDeltaR(), start,
205 end, position, circumRadius)) {
206 //Extend range by padding if desired
207 start -= LatticeR<D>(padding);
208 end += LatticeR<D>(padding);
209 //For all cells in subdomain defined by start/end
210 blockLattice.forSpatialLocations(start, end,
211 [&](const LatticeR<D>& latticeR) {
212 f(latticeR);
213 });
214 }
215}
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 olb::BlockStructureD< D >::forSpatialLocations(), 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 39 of file blockLatticeInteraction.hh.

43{
45 LatticeR<D> blockMin(0);
46 LatticeR<D> blockMax(blockGeometry.getExtent() - 1);
47
49 PhysR<T, D> particleMin(position - circumRadius);
50 PhysR<T, D> relStart(particleMin - blockGeometry.getOrigin());
51 PhysR<T, D> particleMax(position + circumRadius);
52 PhysR<T, D> relEnd(particleMax - blockGeometry.getOrigin());
53
55 bool validRange = true;
56 for (unsigned iDim = 0; iDim < D; ++iDim) {
57 start[iDim] =
58 util::max(util::floor(invDeltaX * relStart[iDim]), blockMin[iDim]);
59 end[iDim] = util::min(util::ceil(invDeltaX * relEnd[iDim]), blockMax[iDim]);
60 int intersectionRange = end[iDim] - start[iDim];
61 validRange = validRange && (intersectionRange >= 0.);
62 }
63
64 return validRange;
65}
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>
constexpr 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}

References olb::particles::communication::forSystemsInSuperParticleSystem(), 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 82 of file porousBGKdynamics.h.

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

◆ resetBlockContactField()

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

Definition at line 455 of file blockLatticeInteraction.hh.

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

References olb::BlockStructureD< D >::forSpatialLocations(), olb::BlockLattice< T, DESCRIPTOR >::get(), olb::BlockGeometry< T, D >::getExtent(), and olb::BlockStructureD< D >::getPadding().

+ 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 436 of file blockLatticeInteraction.hh.

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

References olb::BlockStructureD< D >::forSpatialLocations(), olb::BlockLattice< T, DESCRIPTOR >::get(), olb::BlockGeometry< T, D >::getExtent(), and olb::BlockStructureD< D >::getPadding().

+ 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 71 of file porousBGKdynamics.h.

72{
73 if constexpr (DESCRIPTOR::template provides<
75 cell.template setField<descriptors::CONTACT_DETECTION>(
76 descriptors::CONTACT_DETECTION::template getInitialValue<V,DESCRIPTOR>() );
77 }
78}

◆ resetParticleRelatedFields()

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

Definition at line 47 of file porousBGKdynamics.h.

48{
49 if constexpr (DESCRIPTOR::template provides<descriptors::POROSITY>()) {
50 cell.template setField<descriptors::POROSITY>(
51 descriptors::POROSITY::template getInitialValue<V,DESCRIPTOR>() );
52 }
53 if constexpr (DESCRIPTOR::template provides<
55 cell.template setField<descriptors::VELOCITY_DENOMINATOR>(
56 descriptors::VELOCITY_DENOMINATOR::template getInitialValue<V,DESCRIPTOR>() );
57 }
58 if constexpr (DESCRIPTOR::template provides<
59 descriptors::VELOCITY_NUMERATOR>()) {
60 cell.template setField<descriptors::VELOCITY_NUMERATOR>(
61 descriptors::VELOCITY_NUMERATOR::template getInitialValue<V,DESCRIPTOR>() );
62 }
63 if constexpr (DESCRIPTOR::template provides<descriptors::VELOCITY_SOLID>()) {
64 cell.template setField<descriptors::VELOCITY_SOLID>(
65 descriptors::VELOCITY_SOLID::template getInitialValue<V,DESCRIPTOR>() );
66 }
67}

◆ 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}
std::size_t getId() const
Return memory ID of the currently represented particle.
Definition particle.hh:67

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

+ Here is the call graph for this function:
+ Here is the caller 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 95 of file blockLatticeInteraction.hh.

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

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

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 220 of file blockLatticeInteraction.hh.

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

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

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

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