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

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

#include <shanChenForcedSingleComponentPostProcessor3D.h>

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

Public Member Functions

 ShanChenForcedSingleComponentPostProcessor3D (int x0_, int x1_, int y0_, int y1_, int z0_, int z1_, T G_, std::vector< T > rho0_, AnalyticalF< 1, T, T > &iP_, std::vector< BlockStructureD< 3 > * > partners_)
 
 ShanChenForcedSingleComponentPostProcessor3D (T G_, std::vector< T > rho0_, AnalyticalF< 1, T, T > &iP_, std::vector< BlockStructureD< 3 > * > 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_, int z0_, int z1_) override
 Execute post-processing step on a sublattice.
 
- Public Member Functions inherited from olb::PostProcessor3D< T, DESCRIPTOR >
 PostProcessor3D ()
 
virtual ~PostProcessor3D ()
 
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::PostProcessor3D< T, DESCRIPTOR >
int _priority
 

Detailed Description

template<typename T, typename DESCRIPTOR>
class olb::ShanChenForcedSingleComponentPostProcessor3D< T, DESCRIPTOR >

Multiphysics class for coupling between different lattices.

Definition at line 42 of file shanChenForcedSingleComponentPostProcessor3D.h.

Constructor & Destructor Documentation

◆ ShanChenForcedSingleComponentPostProcessor3D() [1/2]

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

Definition at line 39 of file shanChenForcedSingleComponentPostProcessor3D.hh.

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

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

+ Here is the call graph for this function:

◆ ShanChenForcedSingleComponentPostProcessor3D() [2/2]

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

Definition at line 49 of file shanChenForcedSingleComponentPostProcessor3D.hh.

52 : x0(0), x1(0), y0(0), y1(0), z0(0), z1(0), G(G_), rho0(rho0_), interactionPotential(iP_), partners(partners_)
53{
54 this->getName() = "ShanChenForcedSingleComponentPostProcessor3D";
55}

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

+ Here is the call graph for this function:

Member Function Documentation

◆ extent() [1/2]

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

Extent of application area (0 for purely local operations)

Implements olb::PostProcessor3D< T, DESCRIPTOR >.

Definition at line 50 of file shanChenForcedSingleComponentPostProcessor3D.h.

51 {
52 return 1;
53 }

◆ extent() [2/2]

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

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

Implements olb::PostProcessor3D< T, DESCRIPTOR >.

Definition at line 54 of file shanChenForcedSingleComponentPostProcessor3D.h.

55 {
56 return 1;
57 }

◆ process()

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

Execute post-processing step.

Implements olb::PostProcessor3D< T, DESCRIPTOR >.

Definition at line 129 of file shanChenForcedSingleComponentPostProcessor3D.hh.

131{
132 processSubDomain(blockLattice, x0, x1, y0, y1, z0, z1);
133}
void processSubDomain(BlockLattice< T, DESCRIPTOR > &blockLattice, int x0_, int x1_, int y0_, int y1_, int z0_, int z1_) override
Execute post-processing step on a sublattice.

◆ processSubDomain()

template<typename T , typename DESCRIPTOR >
void olb::ShanChenForcedSingleComponentPostProcessor3D< T, DESCRIPTOR >::processSubDomain ( BlockLattice< T, DESCRIPTOR > & blockLattice,
int x0_,
int x1_,
int y0_,
int y1_,
int z0_,
int z1_ )
overridevirtual

Execute post-processing step on a sublattice.

Implements olb::PostProcessor3D< T, DESCRIPTOR >.

Definition at line 58 of file shanChenForcedSingleComponentPostProcessor3D.hh.

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