OpenLB 1.7
Loading...
Searching...
No Matches
Classes | Functions
olb::particles::resolved Namespace Reference

Classes

struct  population_momentum_exchange
 
struct  population_momentum_exchange< T, 2, false >
 
struct  population_momentum_exchange< T, 2, true >
 
struct  population_momentum_exchange< T, 3, false >
 
struct  population_momentum_exchange< T, 3, true >
 

Functions

template<typename T , typename DESCRIPTOR , typename PARTICLETYPE >
bool momentumExchangeAtSurfaceLocation (T momentumExchange[], PhysR< T, DESCRIPTOR::d > &lever, const LatticeR< DESCRIPTOR::d > &latticeRinner, const BlockGeometry< T, DESCRIPTOR::d > &blockGeometry, BlockLattice< T, DESCRIPTOR > &blockLattice, const UnitConverter< T, DESCRIPTOR > &converter, Particle< T, PARTICLETYPE > &particle, const int bulkMaterial=1)
 
template<typename T , typename S , typename PARTICLETYPE >
PhysR< S, PARTICLETYPE::d > transformInput (Particle< T, PARTICLETYPE > &particle, const PhysR< S, PARTICLETYPE::d > &input)
 
template<typename T , typename S , typename PARTICLETYPE >
PhysR< S, PARTICLETYPE::d > transformDirection (Particle< T, PARTICLETYPE > &particle, const PhysR< S, PARTICLETYPE::d > &direction)
 
template<typename T , typename S , typename PARTICLETYPE >
bool isInsideCircumRadius (Particle< T, PARTICLETYPE > &particle, const PhysR< S, PARTICLETYPE::d > &input)
 
template<typename T , typename S , typename PARTICLETYPE >
bool isInsideParticle (Particle< T, PARTICLETYPE > &particle, const PhysR< S, PARTICLETYPE::d > &input)
 
template<typename T , typename S , typename PARTICLETYPE >
const S signedDistanceToParticle (Particle< T, PARTICLETYPE > &particle, const PhysR< S, PARTICLETYPE::d > &input)
 
template<typename T , typename S , typename PARTICLETYPE >
const S distanceToParticle (Particle< T, PARTICLETYPE > &particle, const Vector< S, PARTICLETYPE::d > &origin, const Vector< S, PARTICLETYPE::d > &direction, S precision, S pitch)
 
template<typename T , typename S , typename PARTICLETYPE >
const S distanceToParticle (Particle< T, PARTICLETYPE > &particle, const Vector< S, PARTICLETYPE::d > &origin, const Vector< S, PARTICLETYPE::d > &direction, S precision)
 
template<typename T , typename S , typename PARTICLETYPE >
Vector< S, PARTICLETYPE::d > normalOnParticleSurface (Particle< T, PARTICLETYPE > &particle, const Vector< S, PARTICLETYPE::d > &pos, const T meshSize)
 
template<typename T , typename S , typename PARTICLETYPE >
bool evalSolidVolumeFraction (T output[], const S input[], Particle< T, PARTICLETYPE > &particle)
 

Function Documentation

◆ distanceToParticle() [1/2]

template<typename T , typename S , typename PARTICLETYPE >
const S olb::particles::resolved::distanceToParticle ( Particle< T, PARTICLETYPE > & particle,
const Vector< S, PARTICLETYPE::d > & origin,
const Vector< S, PARTICLETYPE::d > & direction,
S precision )

Definition at line 175 of file smoothIndicatorInteraction.h.

179{
180 using namespace descriptors;
181 auto sIndicator = particle.template getField<SURFACE, SINDICATOR>();
182 PhysR<S, PARTICLETYPE::d> input = transformInput(particle, origin);
183 PhysR<S, PARTICLETYPE::d> dir = transformDirection(particle, direction);
184
185 T distance(T(0.));
186 if (util::distance(
187 distance, input, dir, precision,
188 [&](const Vector<T, PARTICLETYPE::d>& input) {
189 return sIndicator->signedDistance(input);
190 },
191 [&](const Vector<T, PARTICLETYPE::d>& pos) {
192 // bigger bounding box is usually necessary
193 return norm(pos) <= 1.5 * sIndicator->getCircumRadius();
194 })) {
195 return distance;
196 }
197 else {
198#ifdef OLB_DEBUG
199 OstreamManager clout(std::cout, "distanceCalculation");
200 clout << "WARNING: Distance to particle in direction "
201 << normalize(direction) << " couldn't be calculated." << std::endl;
202#endif
203 return T(0.);
204 }
205
206 __builtin_unreachable();
207}
Plain old scalar vector.
Definition vector.h:47
PhysR< S, PARTICLETYPE::d > transformDirection(Particle< T, PARTICLETYPE > &particle, const PhysR< S, PARTICLETYPE::d > &direction)
PhysR< S, PARTICLETYPE::d > transformInput(Particle< T, PARTICLETYPE > &particle, const PhysR< S, PARTICLETYPE::d > &input)
constexpr T norm(const ScalarVector< T, D, IMPL > &a)
Euclidean vector norm.

References olb::util::distance(), olb::norm(), olb::normalize(), transformDirection(), and transformInput().

+ Here is the call graph for this function:

◆ distanceToParticle() [2/2]

template<typename T , typename S , typename PARTICLETYPE >
const S olb::particles::resolved::distanceToParticle ( Particle< T, PARTICLETYPE > & particle,
const Vector< S, PARTICLETYPE::d > & origin,
const Vector< S, PARTICLETYPE::d > & direction,
S precision,
S pitch )

Definition at line 138 of file smoothIndicatorInteraction.h.

142{
143 using namespace descriptors;
144 auto sIndicator = particle.template getField<SURFACE, SINDICATOR>();
145 PhysR<S, PARTICLETYPE::d> input = transformInput(particle, origin);
146 PhysR<S, PARTICLETYPE::d> dir = transformDirection(particle, direction);
147
148 T distance(T(0.));
149 if (util::distance(
150 distance, input, dir, precision, pitch,
151 [&](bool output[1], const T input[3]) {
152 output[0] = sIndicator->signedDistance(
153 PhysR<T, PARTICLETYPE::d>(input)) <= 0;
154 return output[0];
155 },
156 [&](const Vector<T, 3>& pos) {
157 // bigger bounding box is usually necessary
158 return norm(pos) <= 1.5 * sIndicator->getCircumRadius();
159 })) {
160 return distance;
161 }
162 else {
163#ifdef OLB_DEBUG
164 OstreamManager clout(std::cout, "distanceCalculation");
165 clout << "WARNING: Distance to particle in direction "
166 << normalize(direction) << " couldn't be calculated." << std::endl;
167#endif
168 return T(0.);
169 }
170
171 __builtin_unreachable();
172}

References olb::util::distance(), olb::norm(), olb::normalize(), transformDirection(), and transformInput().

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

◆ evalSolidVolumeFraction()

template<typename T , typename S , typename PARTICLETYPE >
bool olb::particles::resolved::evalSolidVolumeFraction ( T output[],
const S input[],
Particle< T, PARTICLETYPE > & particle )

Definition at line 225 of file smoothIndicatorInteraction.h.

227{
228 using namespace descriptors;
229 auto sIndicator = particle.template getField<SURFACE, SINDICATOR>();
230 T const signedDist =
232 return sdf::evalSolidVolumeFraction(output, signedDist,
233 sIndicator->getEpsilon());
234}
const S signedDistanceToParticle(Particle< T, PARTICLETYPE > &particle, const PhysR< S, PARTICLETYPE::d > &input)

References olb::sdf::evalSolidVolumeFraction(), and signedDistanceToParticle().

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

◆ isInsideCircumRadius()

template<typename T , typename S , typename PARTICLETYPE >
bool olb::particles::resolved::isInsideCircumRadius ( Particle< T, PARTICLETYPE > & particle,
const PhysR< S, PARTICLETYPE::d > & input )

Definition at line 86 of file smoothIndicatorInteraction.h.

88{
89 using namespace descriptors;
90 auto sIndicator = access::getSmoothIndicatorPtr(particle);
91 return norm(access::getPosition(particle) - input) <=
92 sIndicator->getCircumRadius();
93}

References olb::particles::access::getPosition(), olb::particles::access::getSmoothIndicatorPtr(), and olb::norm().

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

◆ isInsideParticle()

template<typename T , typename S , typename PARTICLETYPE >
bool olb::particles::resolved::isInsideParticle ( Particle< T, PARTICLETYPE > & particle,
const PhysR< S, PARTICLETYPE::d > & input )

Definition at line 96 of file smoothIndicatorInteraction.h.

98{
99 using namespace descriptors;
100 auto sIndicator = access::getSmoothIndicatorPtr(particle);
101
102 if (!isInsideCircumRadius(particle, input)) {
103 return false;
104 }
105
106 PhysR<S, PARTICLETYPE::d> newInput = transformInput(particle, input);
107 return sIndicator->signedDistance(newInput) <= 0;
108}
bool isInsideCircumRadius(Particle< T, PARTICLETYPE > &particle, const PhysR< S, PARTICLETYPE::d > &input)

References olb::particles::access::getSmoothIndicatorPtr(), isInsideCircumRadius(), and transformInput().

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

◆ momentumExchangeAtSurfaceLocation()

template<typename T , typename DESCRIPTOR , typename PARTICLETYPE >
bool olb::particles::resolved::momentumExchangeAtSurfaceLocation ( T momentumExchange[],
PhysR< T, DESCRIPTOR::d > & lever,
const LatticeR< DESCRIPTOR::d > & latticeRinner,
const BlockGeometry< T, DESCRIPTOR::d > & blockGeometry,
BlockLattice< T, DESCRIPTOR > & blockLattice,
const UnitConverter< T, DESCRIPTOR > & converter,
Particle< T, PARTICLETYPE > & particle,
const int bulkMaterial = 1 )

Definition at line 74 of file momentumExchangeForce.h.

84{
85
86 using namespace descriptors;
87 constexpr unsigned D = DESCRIPTOR::d;
88 auto position = particle.template getField<GENERAL,POSITION>();
89
90 //Retrieve grid spacing
91 const T deltaR = blockGeometry.getDeltaR();
92 //Get inner phys position
93 T physRinner[D] = { };
94 blockGeometry.getPhysR(physRinner, latticeRinner);
95 //Retrieve inner porosity
96 T porosityInner[1] = { };
97 particles::resolved::evalSolidVolumeFraction(porosityInner, physRinner, particle);
98 //Check whether particle and bulk is existent at location
99 if ( !util::nearZero(porosityInner[0]) && blockGeometry.get(latticeRinner)==bulkMaterial ) {
100 //Loop over distribution functions
101 for (int iPop = 1; iPop < DESCRIPTOR::q ; ++iPop) {
102 //Calculate outer lattice position (get next cell located in current direction)
103 const Vector<int,D> c = descriptors::c<DESCRIPTOR>(iPop);
104 const LatticeR<D> latticeRouter = latticeRinner + c;
105 //Retrieve outer phys position
106 T physRouter[D] = {0.};
107 blockGeometry.getPhysR(physRouter, latticeRouter);
108 //Retrieve outer porosity
109 T porosityOuter[1] = {0.};
110 particles::resolved::evalSolidVolumeFraction(porosityOuter, physRouter, particle);
111 //if not both cells are in the full solid domain calculate force
112 if ( !(porosityInner[0]==1 && porosityOuter[0]==1) ) {
113 //Momentum Exchange Wen
114 const T f1 = blockLattice.get( latticeRouter )[iPop];
115 const T f2 = blockLattice.get( latticeRinner )[descriptors::opposite<DESCRIPTOR>(iPop)];
116 T pVel[D] = {0.};
117 for (unsigned iDim=0; iDim<D; ++iDim) {
118 pVel[iDim] = converter.getLatticeVelocity(particles::dynamics::calculateLocalVelocity(particle, PhysR<T,D>(physRinner))[iDim]);
119 momentumExchange[iDim] -= converter.getPhysForce(
120 population_momentum_exchange<T,D>::calculate( f1, f2, c[iDim], pVel[iDim], deltaR ) );
121 }
122 }
123 }
124 //Calculate lever (necessary for torque calculation)
125 lever = PhysR<T,D>(physRinner)-position;
126 return true;
127 }
128 else {
129 return false;
130 }
131}
Vector< T, D > getPhysR(LatticeR< D > latticeR)
T getDeltaR() const
Read only access to the voxel size given in SI units (meter)
std::enable_if_t< sizeof...(L)==D, int > get(L... latticeR) const
Read-only access to a material number.
Cell< T, DESCRIPTOR > get(CellID iCell)
Get Cell interface for index iCell.
constexpr T getLatticeVelocity(T physVelocity) const
conversion from physical to lattice velocity
constexpr T getPhysForce(T latticeForce) const
conversion from lattice to physical force

References olb::particles::dynamics::calculateLocalVelocity(), evalSolidVolumeFraction(), olb::BlockLattice< T, DESCRIPTOR >::get(), olb::BlockGeometry< T, D >::get(), olb::BlockGeometry< T, D >::getDeltaR(), olb::UnitConverter< T, DESCRIPTOR >::getLatticeVelocity(), olb::UnitConverter< T, DESCRIPTOR >::getPhysForce(), 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:

◆ normalOnParticleSurface()

template<typename T , typename S , typename PARTICLETYPE >
Vector< S, PARTICLETYPE::d > olb::particles::resolved::normalOnParticleSurface ( Particle< T, PARTICLETYPE > & particle,
const Vector< S, PARTICLETYPE::d > & pos,
const T meshSize )

Definition at line 211 of file smoothIndicatorInteraction.h.

213{
214 using namespace descriptors;
215 constexpr unsigned D = PARTICLETYPE::d;
216 auto sIndicator = particle.template getField<SURFACE, SINDICATOR>();
217
218 // the following gives us the option to overload the calculation of the surface normal for different indicators
219 return sIndicator->surfaceNormal(pos, meshSize, [&](const Vector<S, D>& pos) {
220 return transformInput(particle, pos);
221 });
222}

References transformInput().

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

◆ signedDistanceToParticle()

template<typename T , typename S , typename PARTICLETYPE >
const S olb::particles::resolved::signedDistanceToParticle ( Particle< T, PARTICLETYPE > & particle,
const PhysR< S, PARTICLETYPE::d > & input )

Definition at line 111 of file smoothIndicatorInteraction.h.

113{
114 using namespace descriptors;
115 auto sIndicator = particle.template getField<SURFACE, SINDICATOR>();
116 PhysR<S, PARTICLETYPE::d> newInput = transformInput(particle, input);
117
118 //Check whether elongation provided
119 if constexpr (access::providesElongation<PARTICLETYPE>()) {
120 const unsigned D = PARTICLETYPE::d;
121 //Retrieve original sdf
122 std::function<S(const Vector<S, D>&)> sdf =
123 [&sIndicator](const Vector<S, D>& input) {
124 return sIndicator->signedDistance(input);
125 };
126 //Retrieve elongation
127 auto elongation = access::getElongation(particle);
128 //Return elongated whapper
129 constexpr bool symmetryCheck = false; //User responsibility here.
130 return sdf::elongation<T, symmetryCheck>(sdf, newInput, elongation);
131 }
132 else {
133 return sIndicator->signedDistance(newInput);
134 }
135}

References olb::particles::access::getElongation(), and transformInput().

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

◆ transformDirection()

template<typename T , typename S , typename PARTICLETYPE >
PhysR< S, PARTICLETYPE::d > olb::particles::resolved::transformDirection ( Particle< T, PARTICLETYPE > & particle,
const PhysR< S, PARTICLETYPE::d > & direction )

Definition at line 66 of file smoothIndicatorInteraction.h.

68{
69 constexpr unsigned D = PARTICLETYPE::d;
70 using namespace descriptors;
71
72 if constexpr (PARTICLETYPE::template providesNested<SURFACE, ROT_MATRIX>()) {
74 util::invertRotationMatrix<T, D>(
75 particle.template getField<SURFACE, ROT_MATRIX>());
76 return util::executeRotation<T, D>(direction, rotationMatrix);
77 }
78 else {
79 return direction;
80 }
81
82 __builtin_unreachable();
83}
+ Here is the caller graph for this function:

◆ transformInput()

template<typename T , typename S , typename PARTICLETYPE >
PhysR< S, PARTICLETYPE::d > olb::particles::resolved::transformInput ( Particle< T, PARTICLETYPE > & particle,
const PhysR< S, PARTICLETYPE::d > & input )

Definition at line 44 of file smoothIndicatorInteraction.h.

46{
47 using namespace descriptors;
48 constexpr unsigned D = PARTICLETYPE::d;
49
50 const PhysR<T, D> position = particle.template getField<GENERAL, POSITION>();
51 if constexpr (PARTICLETYPE::template providesNested<SURFACE, ROT_MATRIX>()) {
53 util::invertRotationMatrix<T, D>(
54 particle.template getField<SURFACE, ROT_MATRIX>());
55 return util::executeRotation<T, D, true>(input, rotationMatrix, position);
56 }
57 else {
58 return input - position;
59 }
60
61 __builtin_unreachable();
62}
+ Here is the caller graph for this function: