OpenLB 1.8.1
Loading...
Searching...
No Matches
olb::legacy::OffDynamics< T, DESCRIPTOR > Class Template Reference

Dynamics for offLattice boundary conditions OffDynamics are basically NoLatticeDynamics with the additional functionality to store given velocities exactly at boundary links. More...

#include <dynamics.h>

+ Inheritance diagram for olb::legacy::OffDynamics< T, DESCRIPTOR >:
+ Collaboration diagram for olb::legacy::OffDynamics< T, DESCRIPTOR >:

Public Member Functions

 OffDynamics (const T _location[DESCRIPTOR::d])
 Constructor.
 
 OffDynamics (const T _location[DESCRIPTOR::d], T _distances[DESCRIPTOR::q])
 Constructor.
 
T computeRho (ConstCell< T, DESCRIPTOR > &cell) const override
 Returns local stored rho which is updated if the bc is used as velocity!=0 condition.
 
void computeU (ConstCell< T, DESCRIPTOR > &cell, T u[DESCRIPTOR::d]) const override
 Returns an average of the locally stored u.
 
void setBoundaryIntersection (int iPop, T distance)
 Set Intersection of the link and the boundary.
 
bool getBoundaryIntersection (int iPop, T intersection[DESCRIPTOR::d])
 Get Intersection of the link and the boundary.
 
void defineRho (Cell< T, DESCRIPTOR > &cell, T rho) override
 Set particle density on the cell.
 
void defineRho (int iPop, T rho)
 Set single velocity.
 
void defineU (Cell< T, DESCRIPTOR > &cell, const T u[DESCRIPTOR::d]) override
 Set fluid velocity on the cell.
 
void defineU (const T u[DESCRIPTOR::d])
 Set constant velocity.
 
void defineU (int iPop, const T u[DESCRIPTOR::d])
 Set single velocity.
 
T getVelocityCoefficient (int iPop)
 Get VelocitySummand for Bouzidi-Boundary Condition.
 
std::type_index id () override
 Expose unique type-identifier for RTTI.
 
- Public Member Functions inherited from olb::legacy::NoLatticeDynamics< T, DESCRIPTOR >
 NoLatticeDynamics (T rho=T(1))
 You may fix a fictitious density value on no dynamics node via this constructor.
 
void computeEquilibrium (ConstCell< T, DESCRIPTOR > &cell, T rho, const T u[DESCRIPTOR::d], T fEq[DESCRIPTOR::q]) const override any_platform
 Yields 0;.
 
CellStatistic< T > collide (Cell< T, DESCRIPTOR > &cell) override
 Collision step.
 
void computeJ (ConstCell< T, DESCRIPTOR > &cell, T j[DESCRIPTOR::d]) const override
 Yields 0;.
 
void computeStress (ConstCell< T, DESCRIPTOR > &cell, T rho, const T u[DESCRIPTOR::d], T pi[util::TensorVal< DESCRIPTOR >::n]) const override
 Yields NaN.
 
void computeRhoU (ConstCell< T, DESCRIPTOR > &cell, T &rho, T u[DESCRIPTOR::d]) const override
 Compute fluid velocity and particle density.
 
void computeAllMomenta (ConstCell< T, DESCRIPTOR > &cell, T &rho, T u[DESCRIPTOR::d], T pi[util::TensorVal< DESCRIPTOR >::n]) const override
 Compute all momenta up to second order.
 
void defineRhoU (Cell< T, DESCRIPTOR > &cell, T rho, const T u[DESCRIPTOR::d]) override
 Does nothing.
 
void defineAllMomenta (Cell< T, DESCRIPTOR > &cell, T rho, const T u[DESCRIPTOR::d], const T pi[util::TensorVal< DESCRIPTOR >::n]) override
 Does nothing.
 
AbstractParameters< T, DESCRIPTOR > & getParameters (BlockLattice< T, DESCRIPTOR > &block) override
 Parameters access for legacy post processors.
 
- Public Member Functions inherited from olb::Dynamics< T, DESCRIPTOR >
virtual ~Dynamics () any_platform
 
virtual std::string getName () const
 Return human-readable name.
 
virtual void initialize (Cell< T, DESCRIPTOR > &cell)
 Initialize dynamics-specific data for cell.
 
void iniEquilibrium (Cell< T, DESCRIPTOR > &cell, T rho, const T u[DESCRIPTOR::d])
 Initialize to equilibrium distribution.
 
void iniRegularized (Cell< T, DESCRIPTOR > &cell, T rho, const T u[DESCRIPTOR::d], const T pi[util::TensorVal< DESCRIPTOR >::n])
 Initialize cell to equilibrium and non-equilibrum part.
 
virtual void inverseShiftRhoU (ConstCell< T, DESCRIPTOR > &cell, T &rho, T u[DESCRIPTOR::d]) const
 Calculate population momenta s.t. the physical momenta are reproduced by the computeRhoU.
 

Additional Inherited Members

- Public Types inherited from olb::Dynamics< T, DESCRIPTOR >
using value_t = T
 
using descriptor_t = DESCRIPTOR
 

Detailed Description

template<typename T, typename DESCRIPTOR>
class olb::legacy::OffDynamics< T, DESCRIPTOR >

Dynamics for offLattice boundary conditions OffDynamics are basically NoLatticeDynamics with the additional functionality to store given velocities exactly at boundary links.

Definition at line 147 of file dynamics.h.

Constructor & Destructor Documentation

◆ OffDynamics() [1/2]

template<typename T , typename DESCRIPTOR >
olb::legacy::OffDynamics< T, DESCRIPTOR >::OffDynamics ( const T _location[DESCRIPTOR::d])

Constructor.

Definition at line 289 of file dynamics.h.

290{
291 this->getName() = "OffDynamics";
292 typedef DESCRIPTOR L;
293 for (int iD = 0; iD < L::d; iD++) {
294 location[iD] = _location[iD];
295 }
296 for (int iPop = 0; iPop < L::q; iPop++) {
297 distances[iPop] = -1;
298 velocityCoefficient[iPop] = 0;
299 for (int iD = 0; iD < L::d; iD++) {
300 boundaryIntersection[iPop][iD] = _location[iD];
301 _u[iPop][iD] = T();
302 }
303 }
304 _rho=T(1);
305}
virtual std::string getName() const
Return human-readable name.
Definition interface.h:65

References olb::getName().

+ Here is the call graph for this function:

◆ OffDynamics() [2/2]

template<typename T , typename DESCRIPTOR >
olb::legacy::OffDynamics< T, DESCRIPTOR >::OffDynamics ( const T _location[DESCRIPTOR::d],
T _distances[DESCRIPTOR::q] )

Constructor.

Definition at line 308 of file dynamics.h.

309{
310 this->getName() = "OffDynamics";
311 typedef DESCRIPTOR L;
312 for (int iD = 0; iD < L::d; iD++) {
313 location[iD] = _location[iD];
314 }
315 for (int iPop = 0; iPop < L::q; iPop++) {
316 distances[iPop] = _distances[iPop];
317 velocityCoefficient[iPop] = 0;
318 for (int iD = 0; iD < L::d; iD++) {
319 boundaryIntersection[iPop][iD] = _location[iD] - _distances[iPop]*descriptors::c<L>(iPop,iD);
320 _u[iPop][iD] = T();
321 }
322 }
323 _rho=T(1);
324}
constexpr int c(unsigned iPop, unsigned iDim) any_platform
Definition functions.h:83

References olb::descriptors::c(), and olb::getName().

+ Here is the call graph for this function:

Member Function Documentation

◆ computeRho()

template<typename T , typename DESCRIPTOR >
T olb::legacy::OffDynamics< T, DESCRIPTOR >::computeRho ( ConstCell< T, DESCRIPTOR > & cell) const
overridevirtual

Returns local stored rho which is updated if the bc is used as velocity!=0 condition.

Reimplemented from olb::legacy::NoLatticeDynamics< T, DESCRIPTOR >.

Definition at line 327 of file dynamics.h.

328{
329 /*typedef DESCRIPTOR L;
330 T rhoTmp = T();
331 T counter = T();
332 int counter2 = int();
333 for (int iPop = 0; iPop < L::q; iPop++) {
334 if (distances[iPop] != -1) {
335 rhoTmp += (cell[iPop] + descriptors::t<T,L>(iPop))*descriptors::t<T,L>(iPop);
336 counter += descriptors::t<T,L>(iPop);
337 counter2++;
338 }
339 }
340 //if (rhoTmp/counter + 1<0.1999) std::cout << rhoTmp/counter2 + 1 <<std::endl;
341 //if (rhoTmp/counter + 1>1.001) std::cout << rhoTmp/counter2 + 1 <<std::endl;
342 return rhoTmp/counter/counter;*/
343 return _rho;
344}

◆ computeU()

template<typename T , typename DESCRIPTOR >
void olb::legacy::OffDynamics< T, DESCRIPTOR >::computeU ( ConstCell< T, DESCRIPTOR > & cell,
T u[DESCRIPTOR::d] ) const
overridevirtual

Returns an average of the locally stored u.

Reimplemented from olb::legacy::NoLatticeDynamics< T, DESCRIPTOR >.

Definition at line 347 of file dynamics.h.

348{
349 typedef DESCRIPTOR L;
350 for (int iD = 0; iD < L::d; iD++) {
351 u[iD] = T();
352 }
353 int counter = 0;
354 for (int iPop = 0; iPop < L::q; iPop++) {
355 if ( !util::nearZero(distances[iPop]+1) ) {
356 for (int iD = 0; iD < L::d; iD++) {
357 u[iD] += _u[iPop][iD];
358 }
359 counter++;
360 }
361 }
362 if (counter!=0) {
363 for (int iD = 0; iD < L::d; iD++) {
364 u[iD] /= counter;
365 }
366 }
367 return;
368}
bool nearZero(T a) any_platform
return true if a is close to zero
Definition util.h:402

References olb::util::nearZero().

+ Here is the call graph for this function:

◆ defineRho() [1/2]

template<typename T , typename DESCRIPTOR >
void olb::legacy::OffDynamics< T, DESCRIPTOR >::defineRho ( Cell< T, DESCRIPTOR > & cell,
T rho )
overridevirtual

Set particle density on the cell.

Reimplemented from olb::legacy::NoLatticeDynamics< T, DESCRIPTOR >.

Definition at line 396 of file dynamics.h.

397{
398 _rho=rho;
399}

◆ defineRho() [2/2]

template<typename T , typename DESCRIPTOR >
void olb::legacy::OffDynamics< T, DESCRIPTOR >::defineRho ( int iPop,
T rho )

Set single velocity.

Definition at line 402 of file dynamics.h.

403{
404 _rho=rho;
405}

◆ defineU() [1/3]

template<typename T , typename DESCRIPTOR >
void olb::legacy::OffDynamics< T, DESCRIPTOR >::defineU ( Cell< T, DESCRIPTOR > & cell,
const T u[DESCRIPTOR::d] )
overridevirtual

Set fluid velocity on the cell.

Reimplemented from olb::legacy::NoLatticeDynamics< T, DESCRIPTOR >.

Definition at line 408 of file dynamics.h.

411{
412 defineU(u);
413}
void defineU(Cell< T, DESCRIPTOR > &cell, const T u[DESCRIPTOR::d]) override
Set fluid velocity on the cell.
Definition dynamics.h:408
+ Here is the caller graph for this function:

◆ defineU() [2/3]

template<typename T , typename DESCRIPTOR >
void olb::legacy::OffDynamics< T, DESCRIPTOR >::defineU ( const T u[DESCRIPTOR::d])

Set constant velocity.

Definition at line 416 of file dynamics.h.

417{
418 typedef DESCRIPTOR L;
419 for (int iPop = 0; iPop < L::q; iPop++) {
420 if ( !util::nearZero(distances[iPop]+1) ) {
421 defineU(iPop, u);
422 }
423 }
424}

References olb::util::nearZero().

+ Here is the call graph for this function:

◆ defineU() [3/3]

template<typename T , typename DESCRIPTOR >
void olb::legacy::OffDynamics< T, DESCRIPTOR >::defineU ( int iPop,
const T u[DESCRIPTOR::d] )

Set single velocity.

Bouzidi velocity boundary condition formulas for the Coefficients:

2* invCs2*weight*(c,u) for dist < 1/2 1/dist*invCs2*weight*(c,u) for dist >= 1/2

Definition at line 432 of file dynamics.h.

434{
435 OLB_PRECONDITION(distances[iPop] != -1)
436 typedef DESCRIPTOR L;
437 velocityCoefficient[iPop] = 0;
438 // scalar product of c(iPop) and u
439 for (int sum = 0; sum < L::d; sum++) { // +/- problem because of first stream than postprocess
440 velocityCoefficient[iPop] -= descriptors::c<L>(iPop,sum)*u[sum];
441 }
442 // compute summand for boundary condition
443 velocityCoefficient[iPop] *= 2*descriptors::invCs2<T,L>() * descriptors::t<T,L>(iPop);
444
445 for (int iD = 0; iD < L::d; iD++) {
446 _u[iPop][iD] = u[iD];
447 }
448}
constexpr T invCs2() any_platform
Definition functions.h:107
constexpr T t(unsigned iPop, tag::CUM) any_platform
Definition cum.h:108
#define OLB_PRECONDITION(COND)
Definition olbDebug.h:46

References olb::descriptors::c(), olb::descriptors::invCs2(), OLB_PRECONDITION, and olb::descriptors::t().

+ Here is the call graph for this function:

◆ getBoundaryIntersection()

template<typename T , typename DESCRIPTOR >
bool olb::legacy::OffDynamics< T, DESCRIPTOR >::getBoundaryIntersection ( int iPop,
T intersection[DESCRIPTOR::d] )

Get Intersection of the link and the boundary.

Definition at line 383 of file dynamics.h.

384{
385 typedef DESCRIPTOR L;
386 if ( !util::nearZero(distances[iPop]+1) ) {
387 for (int iD = 0; iD < L::d; iD++) {
388 intersection[iD] = boundaryIntersection[iPop][iD];
389 }
390 return true;
391 }
392 return false;
393}
T intersection(T a, T b) any_platform
Volume which is shared by a and b creates a new object.
Definition sdf.h:381

References olb::util::nearZero().

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

◆ getVelocityCoefficient()

template<typename T , typename DESCRIPTOR >
T olb::legacy::OffDynamics< T, DESCRIPTOR >::getVelocityCoefficient ( int iPop)

Get VelocitySummand for Bouzidi-Boundary Condition.

Definition at line 451 of file dynamics.h.

452{
453 return velocityCoefficient[iPop];
454}

◆ id()

template<typename T , typename DESCRIPTOR >
std::type_index olb::legacy::OffDynamics< T, DESCRIPTOR >::id ( )
inlineoverridevirtual

Expose unique type-identifier for RTTI.

Reimplemented from olb::legacy::NoLatticeDynamics< T, DESCRIPTOR >.

Definition at line 174 of file dynamics.h.

174 {
175 return typeid(OffDynamics<T,DESCRIPTOR>);
176 }
OffDynamics(const T _location[DESCRIPTOR::d])
Constructor.
Definition dynamics.h:289

◆ setBoundaryIntersection()

template<typename T , typename DESCRIPTOR >
void olb::legacy::OffDynamics< T, DESCRIPTOR >::setBoundaryIntersection ( int iPop,
T distance )

Set Intersection of the link and the boundary.

direction points from the fluid node into the solid domain distance is the distance from the fluid node to the solid wall

Definition at line 371 of file dynamics.h.

372{
375 typedef DESCRIPTOR L;
376 distances[iPop] = distance;
377 for (int iD = 0; iD < L::d; iD++) {
378 boundaryIntersection[iPop][iD] = location[iD] - distance*descriptors::c<L>(iPop,iD);
379 }
380}
bool distance(S &distance, const Vector< S, D > &origin, const Vector< S, D > &direction, S precision, S pitch, F1 isInside, F2 isInsideBoundingBox)

References olb::descriptors::c().

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

The documentation for this class was generated from the following file: