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

Multiphysics class for coupling between different lattices. More...

#include <shanChenForcedSingleComponentPostProcessor2D.h>

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

Public Member Functions

 ShanChenForcedSingleComponentPostProcessor2D (int x0_, int x1_, int y0_, int y1_, T G_, std::vector< T > rho0_, AnalyticalF< 1, T, T > &iP_, std::vector< BlockStructureD< 2 > * > partners_)
 
 ShanChenForcedSingleComponentPostProcessor2D (T G_, std::vector< T > rho0_, AnalyticalF< 1, T, T > &iP_, std::vector< BlockStructureD< 2 > * > partners_)
 
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>
class olb::ShanChenForcedSingleComponentPostProcessor2D< T, DESCRIPTOR >

Multiphysics class for coupling between different lattices.

Definition at line 42 of file shanChenForcedSingleComponentPostProcessor2D.h.

Constructor & Destructor Documentation

◆ ShanChenForcedSingleComponentPostProcessor2D() [1/2]

template<typename T , typename DESCRIPTOR >
olb::ShanChenForcedSingleComponentPostProcessor2D< T, DESCRIPTOR >::ShanChenForcedSingleComponentPostProcessor2D ( int x0_,
int x1_,
int y0_,
int y1_,
T G_,
std::vector< T > rho0_,
AnalyticalF< 1, T, T > & iP_,
std::vector< BlockStructureD< 2 > * > partners_ )

Definition at line 38 of file shanChenForcedSingleComponentPostProcessor2D.hh.

43 : x0(x0_), x1(x1_), y0(y0_), y1(y1_), G(G_), rho0(rho0_), interactionPotential(iP_), partners(partners_)
44{
45 this->getName() = "ShanChenForcedSingleComponentPostProcessor2D";
46}
std::string & getName()
read and write access to name

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

+ Here is the call graph for this function:

◆ ShanChenForcedSingleComponentPostProcessor2D() [2/2]

template<typename T , typename DESCRIPTOR >
olb::ShanChenForcedSingleComponentPostProcessor2D< T, DESCRIPTOR >::ShanChenForcedSingleComponentPostProcessor2D ( T G_,
std::vector< T > rho0_,
AnalyticalF< 1, T, T > & iP_,
std::vector< BlockStructureD< 2 > * > partners_ )

Definition at line 49 of file shanChenForcedSingleComponentPostProcessor2D.hh.

54 : x0(0), x1(0), y0(0), y1(0), G(G_), rho0(rho0_), interactionPotential(iP_), partners(partners_)
55{
56 this->getName() = "ShanChenForcedSingleComponentPostProcessor2D";
57}

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

+ Here is the call graph for this function:

Member Function Documentation

◆ extent() [1/2]

template<typename T , typename DESCRIPTOR >
int olb::ShanChenForcedSingleComponentPostProcessor2D< T, DESCRIPTOR >::extent ( ) const
inlineoverridevirtual

Extent of application area (0 for purely local operations)

Implements olb::PostProcessor2D< T, DESCRIPTOR >.

Definition at line 52 of file shanChenForcedSingleComponentPostProcessor2D.h.

53 {
54 return 1;
55 }

◆ extent() [2/2]

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

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

Implements olb::PostProcessor2D< T, DESCRIPTOR >.

Definition at line 56 of file shanChenForcedSingleComponentPostProcessor2D.h.

57 {
58 return 1;
59 }

◆ process()

template<typename T , typename DESCRIPTOR >
void olb::ShanChenForcedSingleComponentPostProcessor2D< T, DESCRIPTOR >::process ( BlockLattice< T, DESCRIPTOR > & blockLattice)
overridevirtual

Execute post-processing step.

Implements olb::PostProcessor2D< T, DESCRIPTOR >.

Definition at line 126 of file shanChenForcedSingleComponentPostProcessor2D.hh.

128{
129 processSubDomain(blockLattice, x0, x1, y0, y1);
130}
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 >
void olb::ShanChenForcedSingleComponentPostProcessor2D< T, DESCRIPTOR >::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 60 of file shanChenForcedSingleComponentPostProcessor2D.hh.

63{
64 typedef DESCRIPTOR L;
65
66 int newX0, newX1, newY0, newY1;
67 if ( util::intersect ( x0, x1, y0, y1,
68 x0_, x1_, y0_, y1_,
69 newX0, newX1, newY0, newY1 ) ) {
70
71 auto& rhoField = blockLattice.template getField<RHO_CACHE>()[0];
72
73 // Compute density and velocity on every site of first lattice, and store result
74 // in external scalars; envelope cells are included, because they are needed
75 // to compute the interaction potential in what follows.
76 for (int iX=newX0-1; iX<=newX1+1; ++iX) {
77 for (int iY=newY0-1; iY<=newY1+1; ++iY) {
78 Cell<T,DESCRIPTOR> cell = blockLattice.get(iX,iY);
79 rhoField[cell.getCellId()] = cell.computeRho()*rho0[0];
80 }
81 }
82
83 for (int iX=newX0; iX<=newX1; ++iX) {
84 for (int iY=newY0; iY<=newY1; ++iY) {
85 Cell<T,DESCRIPTOR> blockCell = blockLattice.get(iX,iY);
86
87 auto j = blockCell.template getField<descriptors::VELOCITY>();
88 lbm<DESCRIPTOR>::computeJ(blockCell,j);
89 blockCell.template setField<descriptors::VELOCITY>(j);
90
91 T blockOmega = blockCell.getDynamics()->getParameters(blockLattice).template getOrFallback<descriptors::OMEGA>(0);
92
93 // Computation of the common velocity, shared among the two populations
94 T rhoTot = rhoField[blockCell.getCellId()]*blockOmega;
95
96 Vector<T, 2> uTot;
97 auto blockU = blockCell.template getField<descriptors::VELOCITY>(); // contains precomputed value rho*u
98 uTot = (blockU*rho0[0]*blockOmega) / rhoTot;
99
100 // Computation of the interaction potential
101 Vector<T, 2> rhoBlockContribution;
102 T psi;
103 interactionPotential(&psi, &rhoField[blockCell.getCellId()]);
104 for (int iPop = 0; iPop < L::q; ++iPop) {
105 int nextX = iX + descriptors::c<L>(iPop,0);
106 int nextY = iY + descriptors::c<L>(iPop,1);
107 T blockRho;
108 interactionPotential(&blockRho, &rhoField[blockLattice.getCellId(nextX, nextY)]);//rho0[0];
109 rhoBlockContribution += psi * blockRho * descriptors::c<L>(iPop)* descriptors::t<T,L>(iPop);
110 }
111
112 // Computation and storage of the final velocity, consisting
113 // of u and the momentum difference due to interaction
114 // potential plus external force
115 auto externalBlockForce = blockCell.template getField<descriptors::EXTERNAL_FORCE>();
116
117 blockCell.template setField<descriptors::VELOCITY>(uTot);
118 blockCell.template setField<descriptors::FORCE>(externalBlockForce
119 - G*rhoBlockContribution/rhoField[blockCell.getCellId()]);
120 }
121 }
122 }
123}
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
static void computeJ(CELL &cell, J &j) any_platform
Computation of momentum.
Definition lbm.h:197

References olb::lbm< DESCRIPTOR >::computeJ(), olb::ConstCell< T, DESCRIPTOR >::computeRho(), olb::BlockLattice< T, DESCRIPTOR >::get(), olb::ConstCell< T, DESCRIPTOR >::getCellId(), olb::BlockStructureD< D >::getCellId(), olb::Cell< T, DESCRIPTOR >::getDynamics(), and olb::util::intersect().

+ Here is the call graph for this function:

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