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

This class computes a convection BC on a flat wall in 2D. More...

#include <boundaryPostProcessors2D.h>

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

Public Member Functions

 StraightConvectionBoundaryProcessor2D (int x0_, int x1_, int y0_, int y1_, T *uAv_=NULL)
 
 ~StraightConvectionBoundaryProcessor2D () override
 
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::StraightConvectionBoundaryProcessor2D< T, DESCRIPTOR, direction, orientation >

This class computes a convection BC on a flat wall in 2D.

Definition at line 140 of file boundaryPostProcessors2D.h.

Constructor & Destructor Documentation

◆ StraightConvectionBoundaryProcessor2D()

template<typename T , typename DESCRIPTOR , int direction, int orientation>
olb::StraightConvectionBoundaryProcessor2D< T, DESCRIPTOR, direction, orientation >::StraightConvectionBoundaryProcessor2D ( int x0_,
int x1_,
int y0_,
int y1_,
T * uAv_ = NULL )

Definition at line 86 of file boundaryPostProcessors2D.hh.

88 : x0(x0_), x1(x1_), y0(y0_), y1(y1_), uAv(uAv_)
89{
90 OLB_PRECONDITION(x0==x1 || y0==y1);
91
92 this->getName() = "StraightConvectionBoundaryProcessor2D";
93 saveCell = new T** [(size_t)(x1_-x0_+1)];
94 for (int iX=0; iX<=x1_-x0_; ++iX) {
95 saveCell[iX] = new T* [(size_t)(y1_-y0_+1)];
96 for (int iY=0; iY<=y1_-y0_; ++iY) {
97 saveCell[iX][iY] = new T [(size_t)(DESCRIPTOR::q)];
98 for (int iPop=0; iPop<DESCRIPTOR::q; ++iPop) {
99 // default set to -1 in order to avoid wrong results at first call
100 saveCell[iX][iY][iPop] = T(-1);
101 }
102 }
103 }
104}
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:

◆ ~StraightConvectionBoundaryProcessor2D()

template<typename T , typename DESCRIPTOR , int direction, int orientation>
olb::StraightConvectionBoundaryProcessor2D< T, DESCRIPTOR, direction, orientation >::~StraightConvectionBoundaryProcessor2D ( )
override

Definition at line 107 of file boundaryPostProcessors2D.hh.

109{
110 for (int iX=0; iX<=x1-x0; ++iX) {
111 for (int iY=0; iY<=y1-y0; ++iY) {
112 delete [] saveCell[iX][iY];
113 }
114 delete [] saveCell[iX];
115 }
116 delete [] saveCell;
117}

Member Function Documentation

◆ extent() [1/2]

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

Extent of application area (0 for purely local operations)

Implements olb::PostProcessor2D< T, DESCRIPTOR >.

Definition at line 144 of file boundaryPostProcessors2D.h.

145 {
146 return 1;
147 }

◆ extent() [2/2]

template<typename T , typename DESCRIPTOR , int direction, int orientation>
int olb::StraightConvectionBoundaryProcessor2D< 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 148 of file boundaryPostProcessors2D.h.

149 {
150 return 1;
151 }

◆ process()

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

Execute post-processing step.

Implements olb::PostProcessor2D< T, DESCRIPTOR >.

Definition at line 182 of file boundaryPostProcessors2D.hh.

184{
185 processSubDomain(blockLattice, x0, x1, y0, y1);
186}
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::StraightConvectionBoundaryProcessor2D< 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 120 of file boundaryPostProcessors2D.hh.

122{
123 using namespace olb::util::tensorIndices2D;
124
125 int newX0, newX1, newY0, newY1;
126 if ( util::intersect (
127 x0, x1, y0, y1,
128 x0_, x1_, y0_, y1_,
129 newX0, newX1, newY0, newY1 ) ) {
130
131 int iX;
132#ifdef PARALLEL_MODE_OMP
133 #pragma omp parallel for
134#endif
135 for (iX=newX0; iX<=newX1; ++iX) {
136 for (int iY=newY0; iY<=newY1; ++iY) {
137 Cell<T,DESCRIPTOR> cell = blockLattice.get(iX,iY);
138 for (int iPop = 0; iPop < DESCRIPTOR::q ; ++iPop) {
139 if (descriptors::c<DESCRIPTOR>(iPop,direction)==-orientation) {
140 // using default -1 avoids wrong first call
141 if (!util::nearZero(1 + saveCell[iX-newX0][iY-newY0][iPop]) ) {
142 cell[iPop] = saveCell[iX-newX0][iY-newY0][iPop];
143 }
144 }
145 }
146
147 T rho0, u0[2];
148 T rho1, u1[2];
149 T rho2, u2[2];
150 if (direction==0) {
151 blockLattice.get(iX,iY).computeRhoU(rho0,u0);
152 blockLattice.get(iX-orientation,iY).computeRhoU(rho1,u1);
153 blockLattice.get(iX-orientation*2,iY).computeRhoU(rho2,u2);
154 }
155 else {
156 blockLattice.get(iX,iY).computeRhoU(rho0,u0);
157 blockLattice.get(iX,iY-orientation).computeRhoU(rho1,u1);
158 blockLattice.get(iX,iY-orientation*2).computeRhoU(rho2,u2);
159 }
160
161 // rho0 = T(1); rho1 = T(1); rho2 = T(1);
162
163 T uDelta[2];
164 T uAverage = rho0*u0[direction];
165 if (uAv!=nullptr) {
166 uAverage = *uAv;
167 }
168 uDelta[0]=-uAverage*0.5*(3*rho0*u0[0]-4*rho1*u1[0]+rho2*u2[0]);
169 uDelta[1]=-uAverage*0.5*(3*rho0*u0[1]-4*rho1*u1[1]+rho2*u2[1]);
170
171 for (int iPop = 0; iPop < DESCRIPTOR::q ; ++iPop) {
172 if (descriptors::c<DESCRIPTOR>(iPop,direction) == -orientation) {
173 saveCell[iX-newX0][iY-newY0][iPop] = cell[iPop] + descriptors::invCs2<T,DESCRIPTOR>()*descriptors::t<T,DESCRIPTOR>(iPop)*(uDelta[0]*descriptors::c<DESCRIPTOR>(iPop,0)+uDelta[1]*descriptors::c<DESCRIPTOR>(iPop,1));
174 }
175 }
176 }
177 }
178 }
179}
Highest-level interface to Cell data.
Definition cell.h:148
bool intersect(int x0, int x1, int y0, int y1, int x0_, int x1_, int y0_, int y1_, int &newX0, int &newX1, int &newY0, int &newY1)
Definition util.h:89
bool nearZero(const ADf< T, DIM > &a)
Definition aDiff.h:1087

References olb::BlockLattice< T, DESCRIPTOR >::get(), olb::util::intersect(), and olb::util::nearZero().

+ Here is the call graph for this function:

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