OpenLB 1.7
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
olb::InamuroAnalyticalDynamics< T, DESCRIPTOR, Dynamics, MOMENTA, direction, orientation > Class Template Reference

Implementation of Inamuro boundary condition following the paper "A non-slip boundary condition for lattice Boltzmann simulations", Inamuro, Takaji; Yoshino, Masato; Ogino, Fumimaru, (1995). More...

#include <inamuroAnalyticalDynamics.h>

+ Inheritance diagram for olb::InamuroAnalyticalDynamics< T, DESCRIPTOR, Dynamics, MOMENTA, direction, orientation >:
+ Collaboration diagram for olb::InamuroAnalyticalDynamics< T, DESCRIPTOR, Dynamics, MOMENTA, direction, orientation >:

Public Types

template<typename M >
using exchange_momenta = InamuroAnalyticalDynamics<T,DESCRIPTOR,Dynamics,M,direction,orientation>
 
- Public Types inherited from olb::dynamics::CustomCollision< T, DESCRIPTOR, MOMENTA >
using value_t = T
 
using descriptor_t = DESCRIPTOR
 
using MomentaF = typename MOMENTA::template type<DESCRIPTOR>
 
- Public Types inherited from olb::Dynamics< T, DESCRIPTOR >
using value_t = T
 
using descriptor_t = DESCRIPTOR
 

Public Member Functions

 InamuroAnalyticalDynamics (T omega)
 Constructor.
 
computeEquilibrium (int iPop, T rho, const T u[DESCRIPTOR::d], T uSqr) const override
 Compute equilibrium distribution function.
 
CellStatistic< T > collide (Cell< T, DESCRIPTOR > &cell, LatticeStatistics< T > &statistics) override
 Collision step.
 
getOmega () const
 Get local relaxation parameter of the dynamics.
 
void setOmega (T omega_)
 Set local relaxation parameter of the dynamics.
 
- Public Member Functions inherited from olb::legacy::BasicDynamics< T, DESCRIPTOR, MOMENTA >
computeEquilibrium (int iPop, T rho, const T u[DESCRIPTOR::d]) const override
 Return iPop equilibrium for given first and second momenta.
 
std::type_index id () override
 Expose unique type-identifier for RTTI.
 
AbstractParameters< T, DESCRIPTOR > & getParameters (BlockLattice< T, DESCRIPTOR > &block) override
 Parameters access for legacy post processors.
 
- Public Member Functions inherited from olb::dynamics::CustomCollision< T, DESCRIPTOR, MOMENTA >
void initialize (Cell< T, DESCRIPTOR > &cell) override
 Initialize dynamics-specific data for cell.
 
computeRho (ConstCell< T, DESCRIPTOR > &cell) const override
 Compute particle density.
 
void computeU (ConstCell< T, DESCRIPTOR > &cell, T u[DESCRIPTOR::d]) const override
 Compute fluid velocity.
 
void computeJ (ConstCell< T, DESCRIPTOR > &cell, T j[DESCRIPTOR::d]) const override
 Compute fluid momentum.
 
void computeStress (ConstCell< T, DESCRIPTOR > &cell, T rho, const T u[DESCRIPTOR::d], T pi[util::TensorVal< DESCRIPTOR >::n]) const override
 Compute stress tensor.
 
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 defineRho (Cell< T, DESCRIPTOR > &cell, T rho) override
 Set particle density.
 
void defineU (Cell< T, DESCRIPTOR > &cell, const T u[DESCRIPTOR::d]) override
 Set fluid velocity.
 
void defineRhoU (Cell< T, DESCRIPTOR > &cell, T rho, const T u[DESCRIPTOR::d]) override
 Define fluid velocity and particle density.
 
void defineAllMomenta (Cell< T, DESCRIPTOR > &cell, T rho, const T u[DESCRIPTOR::d], const T pi[util::TensorVal< DESCRIPTOR >::n]) override
 Define all momenta up to second order.
 
void inverseShiftRhoU (ConstCell< T, DESCRIPTOR > &cell, T &rho, T u[DESCRIPTOR::d]) const override
 Calculate population momenta s.t. the physical momenta are reproduced by the computeRhoU.
 
- Public Member Functions inherited from olb::Dynamics< T, DESCRIPTOR >
virtual ~Dynamics () any_platform
 
virtual std::string getName () const
 Return human-readable name.
 
virtual CellStatistic< T > collide (Cell< T, DESCRIPTOR > &cell)
 Perform purely-local collision step on Cell interface (legacy, to be deprecated)
 
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.
 

Detailed Description

template<typename T, typename DESCRIPTOR, typename Dynamics, typename MOMENTA, int direction, int orientation>
class olb::InamuroAnalyticalDynamics< T, DESCRIPTOR, Dynamics, MOMENTA, direction, orientation >

Implementation of Inamuro boundary condition following the paper "A non-slip boundary condition for lattice Boltzmann simulations", Inamuro, Takaji; Yoshino, Masato; Ogino, Fumimaru, (1995).

This implementation works for the D2Q9 DESCRIPTOR only.

Definition at line 39 of file inamuroAnalyticalDynamics.h.

Member Typedef Documentation

◆ exchange_momenta

template<typename T , typename DESCRIPTOR , typename Dynamics , typename MOMENTA , int direction, int orientation>
template<typename M >
using olb::InamuroAnalyticalDynamics< T, DESCRIPTOR, Dynamics, MOMENTA, direction, orientation >::exchange_momenta = InamuroAnalyticalDynamics<T,DESCRIPTOR,Dynamics,M,direction,orientation>

Definition at line 43 of file inamuroAnalyticalDynamics.h.

Constructor & Destructor Documentation

◆ InamuroAnalyticalDynamics()

template<typename T , typename DESCRIPTOR , typename Dynamics , typename MOMENTA , int direction, int orientation>
olb::InamuroAnalyticalDynamics< T, DESCRIPTOR, Dynamics, MOMENTA, direction, orientation >::InamuroAnalyticalDynamics ( T omega)

Constructor.

Definition at line 36 of file inamuroAnalyticalDynamics.hh.

37 : legacy::BasicDynamics<T,DESCRIPTOR,MOMENTA>(),
38 boundaryDynamics(omega_)
39{
40 this->getName() = "InamuroAnalyticalDynamics";
41}
virtual std::string getName() const
Return human-readable name.
Definition interface.h:63

References olb::Dynamics< T, DESCRIPTOR >::getName().

+ Here is the call graph for this function:

Member Function Documentation

◆ collide()

template<typename T , typename DESCRIPTOR , typename Dynamics , typename MOMENTA , int direction, int orientation>
CellStatistic< T > olb::InamuroAnalyticalDynamics< T, DESCRIPTOR, Dynamics, MOMENTA, direction, orientation >::collide ( Cell< T, DESCRIPTOR > & cell,
LatticeStatistics< T > & statistics )
override

Collision step.

Definition at line 51 of file inamuroAnalyticalDynamics.hh.

54{
55 typedef DESCRIPTOR L;
56
57 // Along all the commented parts of this code there will be an example based
58 // on the situation where the wall's normal vector if (0,1) and the
59 // numerotation of the velocites are done according to the D2Q9
60 // lattice of the OpenLB library.
61
62 // Find all the missing populations
63 // (directions 3,4,5)
64 std::vector<int> missInd =
65 util::subIndexOutgoing<L,direction,orientation>();
66
67 // Will contain the missing poputations that are not normal to the wall.
68 // (directions 3,5)
69 std::vector<int> missDiagInd = missInd;
70
71 for (unsigned iPop = 0; iPop < missInd.size(); ++iPop) {
72 int numOfNonNullComp = 0;
73 for (int iDim = 0; iDim < L::d; ++iDim) {
74 numOfNonNullComp += util::abs(descriptors::c<L>(missInd[iPop],iDim));
75 }
76
77 if (numOfNonNullComp == 1) {
78 missDiagInd.erase(missDiagInd.begin()+iPop);
79 break;
80 }
81 }
82
83 // Will contain the populations normal to the wall's normal vector.
84 // (directions 2,6)
85 std::vector<std::size_t> perpInd = util::populationsContributingToVelocity<L,direction,0>();
86 for (unsigned iPop = 0; iPop < perpInd.size(); ++iPop) {
87 if (descriptors::c<L>(perpInd[iPop],0) == 0 && descriptors::c<L>(perpInd[iPop],1) == 0) {
88 perpInd.erase(perpInd.begin() + iPop);
89 break;
90 }
91 }
92
93 T rho, u[L::d];
94 MOMENTA().computeRhoU(cell, rho, u);
95
96 T rhoCs = T();
97 T uCs[L::d];
98 for (int iDim = 0; iDim < L::d; ++iDim) {
99 uCs[iDim] = T();
100 }
101
102 T fSum = T();
103 for (unsigned iPop = 0; iPop < missInd.size(); ++iPop) {
104 fSum += cell[descriptors::opposite<L>(missInd[iPop])];
105 }
106 // do not forget the "+1" in the rhoCs equation in the numerator (it's
107 // here because fEq = usualfEq - t[i]
108 rhoCs = ((T)6 * (-orientation * rho * u[direction] + fSum) + (T)1) /
109 ((T)3 * u[direction] * u[direction] - orientation * (T)3 * u[direction] + (T)1);
110
111 T fDiffPerp = T();
112 for (unsigned iPop = 0; iPop < perpInd.size(); ++iPop) {
113 fDiffPerp += descriptors::c<L>(perpInd[iPop],(direction + 1)%2) * cell[perpInd[iPop]];
114 }
115 fDiffPerp *= orientation;
116
117 T fDiffDiag = T();
118 for (unsigned iPop = 0; iPop < missDiagInd.size(); ++iPop)
119 fDiffDiag += descriptors::c<L>(descriptors::opposite<L>(missDiagInd[iPop]),(direction + 1)%2)
120 * cell[descriptors::opposite<L>(missDiagInd[iPop])];
121 fDiffDiag *= orientation;
122
123 uCs[(direction + 1)%L::d] = (
124 - orientation * (T)6 * rho * u[(direction+1)%L::d]
125 + orientation * rhoCs * u[(direction+1)%L::d]
126 - (T)3 * rhoCs * u[direction]*u[(direction+1)%L::d]
127 + (T)6*(fDiffPerp + fDiffDiag))
128 / (
129 rhoCs * (-orientation + (T)3 * u[direction]));
130
131 for (int iDim = 0; iDim < L::d; ++iDim) {
132 uCs[iDim] += u[iDim];
133 }
134
135 T uSqr = util::normSqr<T,L::d>(uCs);
136
137 for (unsigned iPop = 0; iPop < missInd.size(); ++iPop) {
138 cell[missInd[iPop]] = computeEquilibrium(missInd[iPop], rhoCs, uCs, uSqr);
139 }
140
141 boundaryDynamics.collide(cell, statistics);
142}
T computeEquilibrium(int iPop, T rho, const T u[DESCRIPTOR::d], T uSqr) const override
Compute equilibrium distribution function.
ADf< T, DIM > abs(const ADf< T, DIM > &a)
Definition aDiff.h:1019
virtual CellStatistic< T > collide(Cell< T, DESCRIPTOR > &cell)
Perform purely-local collision step on Cell interface (legacy, to be deprecated)
Definition interface.h:74

References olb::util::abs().

+ Here is the call graph for this function:

◆ computeEquilibrium()

template<typename T , typename DESCRIPTOR , typename Dynamics , typename MOMENTA , int direction, int orientation>
T olb::InamuroAnalyticalDynamics< T, DESCRIPTOR, Dynamics, MOMENTA, direction, orientation >::computeEquilibrium ( int iPop,
T rho,
const T u[DESCRIPTOR::d],
T uSqr ) const
override

Compute equilibrium distribution function.

Definition at line 44 of file inamuroAnalyticalDynamics.hh.

46{
47 return boundaryDynamics.computeEquilibrium(iPop, rho, u, uSqr);
48}
virtual T computeEquilibrium(int iPop, T rho, const T u[DESCRIPTOR::d]) const any_platform=0
Return iPop equilibrium for given first and second momenta.

◆ getOmega()

template<typename T , typename DESCRIPTOR , typename Dynamics , typename MOMENTA , int direction, int orientation>
T olb::InamuroAnalyticalDynamics< T, DESCRIPTOR, Dynamics, MOMENTA, direction, orientation >::getOmega ( ) const

Get local relaxation parameter of the dynamics.

Definition at line 145 of file inamuroAnalyticalDynamics.hh.

146{
147 return boundaryDynamics.getOmega();
148}

◆ setOmega()

template<typename T , typename DESCRIPTOR , typename Dynamics , typename MOMENTA , int direction, int orientation>
void olb::InamuroAnalyticalDynamics< T, DESCRIPTOR, Dynamics, MOMENTA, direction, orientation >::setOmega ( T omega_)

Set local relaxation parameter of the dynamics.

Definition at line 151 of file inamuroAnalyticalDynamics.hh.

152{
153 boundaryDynamics.setOmega(omega_);
154}

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