OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | List of all members
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.
 
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.
 
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.
 
computeEquilibrium (int iPop, T rho, const T u[DESCRIPTOR::d]) 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 145 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 287 of file dynamics.h.

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

◆ 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 306 of file dynamics.h.

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

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 325 of file dynamics.h.

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

◆ 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 345 of file dynamics.h.

346{
347 typedef DESCRIPTOR L;
348 for (int iD = 0; iD < L::d; iD++) {
349 u[iD] = T();
350 }
351 int counter = 0;
352 for (int iPop = 0; iPop < L::q; iPop++) {
353 if ( !util::nearZero(distances[iPop]+1) ) {
354 for (int iD = 0; iD < L::d; iD++) {
355 u[iD] += _u[iPop][iD];
356 }
357 counter++;
358 }
359 }
360 if (counter!=0) {
361 for (int iD = 0; iD < L::d; iD++) {
362 u[iD] /= counter;
363 }
364 }
365 return;
366}
bool nearZero(const ADf< T, DIM > &a)
Definition aDiff.h:1087

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 394 of file dynamics.h.

395{
396 _rho=rho;
397}

◆ 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 400 of file dynamics.h.

401{
402 _rho=rho;
403}

◆ 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 406 of file dynamics.h.

409{
410 defineU(u);
411}
void defineU(Cell< T, DESCRIPTOR > &cell, const T u[DESCRIPTOR::d]) override
Set fluid velocity on the cell.
Definition dynamics.h:406

◆ 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 414 of file dynamics.h.

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

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 430 of file dynamics.h.

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

References OLB_PRECONDITION.

◆ 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 381 of file dynamics.h.

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

References olb::util::nearZero().

+ Here is the call 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 449 of file dynamics.h.

450{
451 return velocityCoefficient[iPop];
452}
+ Here is the caller graph for this function:

◆ 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 172 of file dynamics.h.

172 {
173 return typeid(OffDynamics<T,DESCRIPTOR>);
174 }

◆ 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 369 of file dynamics.h.

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

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