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

This class computes the finite difference approximation to LB boundary conditions on a flat wall in 2D with all the terms of the CE expansion. More...

#include <extendedFiniteDifferenceBoundary2D.h>

+ Inheritance diagram for olb::ExtendedStraightFdBoundaryPostProcessor2D< T, DESCRIPTOR, direction, orientation >:
+ Collaboration diagram for olb::ExtendedStraightFdBoundaryPostProcessor2D< T, DESCRIPTOR, direction, orientation >:

Public Member Functions

 ExtendedStraightFdBoundaryPostProcessor2D (int x0_, int x1_, int y0_, int y1_)
 
int extent () const override
 Extent of application area (0 for purely local operations)
 
int extent (int whichDirection) const override
 Extent of application area along a direction (0 or 1)
 
void process (BlockLattice< T, DESCRIPTOR > &blockLattice) override
 Execute post-processing step.
 
void processSubDomain (BlockLattice< T, DESCRIPTOR > &blockLattice, int x0_, int x1_, int y0_, int y1_) override
 Execute post-processing step on a sublattice.
 
- Public Member Functions inherited from olb::PostProcessor2D< T, DESCRIPTOR >
 PostProcessor2D ()
 
virtual ~PostProcessor2D ()
 
std::string & getName ()
 read and write access to name
 
std::string const & getName () const
 read only access to name
 
int getPriority () const
 read only access to priority
 

Additional Inherited Members

- Protected Attributes inherited from olb::PostProcessor2D< T, DESCRIPTOR >
int _priority
 

Detailed Description

template<typename T, typename DESCRIPTOR, int direction, int orientation>
class olb::ExtendedStraightFdBoundaryPostProcessor2D< T, DESCRIPTOR, direction, orientation >

This class computes the finite difference approximation to LB boundary conditions on a flat wall in 2D with all the terms of the CE expansion.

The details on the computations can be found in the thesis of Jonas Latt, "Hydrodynamic limit of lattice Boltzmann equations", University of Geneva, (2007).

Definition at line 42 of file extendedFiniteDifferenceBoundary2D.h.

Constructor & Destructor Documentation

◆ ExtendedStraightFdBoundaryPostProcessor2D()

template<typename T , typename DESCRIPTOR , int direction, int orientation>
olb::ExtendedStraightFdBoundaryPostProcessor2D< T, DESCRIPTOR, direction, orientation >::ExtendedStraightFdBoundaryPostProcessor2D ( int x0_,
int x1_,
int y0_,
int y1_ )

Definition at line 39 of file extendedFiniteDifferenceBoundary2D.hh.

41 : x0(x0_), x1(x1_), y0(y0_), y1(y1_)
42{
43 OLB_PRECONDITION(x0==x1 || y0==y1);
44 this->getName() = "ExtendedStraightFdBoundaryPostProcessor2D";
45}
std::string & getName()
read and write access to name
#define OLB_PRECONDITION(COND)
Definition olbDebug.h:46

References olb::PostProcessor2D< T, DESCRIPTOR >::getName(), and OLB_PRECONDITION.

+ Here is the call graph for this function:

Member Function Documentation

◆ extent() [1/2]

template<typename T , typename DESCRIPTOR , int direction, int orientation>
int olb::ExtendedStraightFdBoundaryPostProcessor2D< T, DESCRIPTOR, direction, orientation >::extent ( ) const
inlineoverridevirtual

Extent of application area (0 for purely local operations)

Implements olb::PostProcessor2D< T, DESCRIPTOR >.

Definition at line 45 of file extendedFiniteDifferenceBoundary2D.h.

46 {
47 return 1;
48 }

◆ extent() [2/2]

template<typename T , typename DESCRIPTOR , int direction, int orientation>
int olb::ExtendedStraightFdBoundaryPostProcessor2D< T, DESCRIPTOR, direction, orientation >::extent ( int direction) const
inlineoverridevirtual

Extent of application area along a direction (0 or 1)

Implements olb::PostProcessor2D< T, DESCRIPTOR >.

Definition at line 49 of file extendedFiniteDifferenceBoundary2D.h.

50 {
51 return 1;
52 }

◆ process()

template<typename T , typename DESCRIPTOR , int direction, int orientation>
void olb::ExtendedStraightFdBoundaryPostProcessor2D< T, DESCRIPTOR, direction, orientation >::process ( BlockLattice< T, DESCRIPTOR > & blockLattice)
overridevirtual

Execute post-processing step.

Implements olb::PostProcessor2D< T, DESCRIPTOR >.

Definition at line 145 of file extendedFiniteDifferenceBoundary2D.hh.

147{
148 processSubDomain(blockLattice, x0, x1, y0, y1);
149}
void processSubDomain(BlockLattice< T, DESCRIPTOR > &blockLattice, int x0_, int x1_, int y0_, int y1_) override
Execute post-processing step on a sublattice.

◆ processSubDomain()

template<typename T , typename DESCRIPTOR , int direction, int orientation>
void olb::ExtendedStraightFdBoundaryPostProcessor2D< T, DESCRIPTOR, direction, orientation >::processSubDomain ( BlockLattice< T, DESCRIPTOR > & blockLattice,
int x0_,
int x1_,
int y0_,
int y1_ )
overridevirtual

Execute post-processing step on a sublattice.

Implements olb::PostProcessor2D< T, DESCRIPTOR >.

Definition at line 48 of file extendedFiniteDifferenceBoundary2D.hh.

50{
51 using namespace olb::util::tensorIndices2D;
52 typedef lbm<DESCRIPTOR> lbH;
53 typedef DESCRIPTOR L;
54 enum {x,y};
55
56 for (int iX=x0; iX<=x1; ++iX) {
57 for (int iY=y0; iY<=y1; ++iY) {
58 Cell<T,DESCRIPTOR> cell = blockLattice.get(iX,iY);
59 T rho, u[L::d];
60 cell.computeRhoU(rho,u);
61
62 T uSqr = util::normSqr<T,DESCRIPTOR::d>(u);
63
64 T dx_U[L::d], dy_U[L::d];
65 interpolateGradients<0>(blockLattice, dx_U, iX, iY);
66 interpolateGradients<1>(blockLattice, dy_U, iX, iY);
67
68 T rhoGradU[L::d][L::d];
69 rhoGradU[x][x] = rho * dx_U[x];
70 rhoGradU[x][y] = rho * dx_U[y];
71 rhoGradU[y][x] = rho * dy_U[x];
72 rhoGradU[y][y] = rho * dy_U[y];
73
74 T omega = blockLattice.getDynamics(iX, iY) -> getOmega();
75 T sToPi = - (T)1 / descriptors::invCs2<T,DESCRIPTOR>() / omega;
76
78 pi[xx] = (T)2 * rhoGradU[x][x] * sToPi;
79 pi[yy] = (T)2 * rhoGradU[y][y] * sToPi;
80 pi[xy] = (rhoGradU[x][y] + rhoGradU[y][x]) * sToPi;
81 // here ends the "regular" fdBoudaryCondition
82 // implemented in OpenLB
83
84 // first we compute the term
85 // (c_{i\alpha} \nabla_\beta)(rho*u_\alpha*u_\beta)
86 T dx_rho, dy_rho;
87 interpolateGradients<0>(blockLattice, dx_rho, iX, iY);
88 interpolateGradients<1>(blockLattice, dy_rho, iX, iY);
89 for (int iPop = 0; iPop < L::q; ++iPop) {
90 T cGradRhoUU = T();
91 for (int iAlpha=0; iAlpha < L::d; ++iAlpha) {
92 cGradRhoUU += descriptors::c<L>(iPop,iAlpha) * (
93 dx_rho*u[iAlpha]*u[x] +
94 dx_U[iAlpha]*rho*u[x] +
95 dx_U[x]*rho*u[iAlpha] + //end of dx derivatice
96 dy_rho*u[iAlpha]*u[y] +
97 dy_U[iAlpha]*rho*u[y] +
98 dy_U[y]*rho*u[iAlpha]);
99 }
100
101 // then we compute the term
102 // c_{i\gamma}\nabla_{\gamma}(\rho*u_\alpha * u_\beta)
103 T cDivRhoUU[L::d][L::d]; //first step towards QcdivRhoUU
104 for (int iAlpha = 0; iAlpha < L::d; ++iAlpha) {
105 for (int iBeta = 0; iBeta < L::d; ++iBeta) {
106 cDivRhoUU[iAlpha][iBeta] = descriptors::c<L>(iPop,x) *
107 (dx_rho*u[iAlpha]*u[iBeta] +
108 dx_U[iAlpha]*rho*u[iBeta] +
109 dx_U[iBeta]*rho*u[iAlpha])
110 + descriptors::c<L>(iPop,y) *
111 (dy_rho*u[iAlpha]*u[iBeta] +
112 dy_U[iAlpha]*rho*u[iBeta] +
113 dy_U[iBeta]*rho*u[iAlpha]);
114 }
115 }
116
117 //Finally we can compute
118 // Q_{i\alpha\beta}c_{i\gamma}\nabla_{\gamma}(\rho*u_\alpha * u_\beta)
119 // and Q_{i\alpha\beta}\rho\nabla_{\alpha}u_\beta
120 T qCdivRhoUU = T();
121 T qRhoGradU = T();
122 for (int iAlpha = 0; iAlpha < L::d; ++iAlpha) {
123 for (int iBeta = 0; iBeta < L::d; ++iBeta) {
124 int ci_ci = descriptors::c<L>(iPop,iAlpha)*descriptors::c<L>(iPop,iBeta);
125 qCdivRhoUU += ci_ci * cDivRhoUU[iAlpha][iBeta];
126 qRhoGradU += ci_ci * rhoGradU[iAlpha][iBeta];
127 if (iAlpha == iBeta) {
128 qCdivRhoUU -= cDivRhoUU[iAlpha][iBeta]/descriptors::invCs2<T,L>();
129 qRhoGradU -= rhoGradU[iAlpha][iBeta]/descriptors::invCs2<T,L>();
130 }
131 }
132 }
133
134 // we then can reconstruct the value of the populations
135 // according to the complete C-E expansion term
136 cell[iPop] = lbH::equilibrium(iPop,rho,u,uSqr)
137 - descriptors::t<T,L>(iPop) * descriptors::invCs2<T,L>() / omega
138 * (qRhoGradU - cGradRhoUU + 0.5*descriptors::invCs2<T,L>()*qCdivRhoUU);
139 }
140 }
141 }
142}
Highest-level interface to Cell data.
Definition cell.h:148
void computeRhoU(T &rho, T u[descriptors::d< DESCRIPTOR >()]) const
Compute fluid velocity and particle density on the cell.
Definition cell.hh:232
Collection of common computations for LBM.
Definition lbm.h:182
Compute number of elements of a symmetric d-dimensional tensor.
Definition util.h:210

References olb::ConstCell< T, DESCRIPTOR >::computeRhoU(), olb::BlockLattice< T, DESCRIPTOR >::get(), and olb::BlockLattice< T, DESCRIPTOR >::getDynamics().

+ Here is the call graph for this function:

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