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

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

#include <shanChenDynOmegaForcedPostProcessor3D.h>

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

Public Member Functions

 ShanChenDynOmegaForcedPostProcessor3D (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_)
 
 ShanChenDynOmegaForcedPostProcessor3D (T G_, std::vector< T > rho0_, AnalyticalF< 1, T, T > &iP_, std::vector< BlockStructureD< 3 > * > partners_)
 
virtual int extent () const
 Extent of application area (0 for purely local operations)
 
virtual int extent (int whichDirection) const
 Extent of application area along a direction (0 or 1)
 
virtual void process (BlockLattice< T, DESCRIPTOR > &blockLattice)
 Execute post-processing step.
 
virtual void processSubDomain (BlockLattice< T, DESCRIPTOR > &blockLattice, int x0_, int x1_, int y0_, int y1_, int z0_, int z1_)
 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::ShanChenDynOmegaForcedPostProcessor3D< T, DESCRIPTOR >

Multiphysics class for coupling between different lattices.

Definition at line 42 of file shanChenDynOmegaForcedPostProcessor3D.h.

Constructor & Destructor Documentation

◆ ShanChenDynOmegaForcedPostProcessor3D() [1/2]

template<typename T , typename DESCRIPTOR >
olb::ShanChenDynOmegaForcedPostProcessor3D< T, DESCRIPTOR >::ShanChenDynOmegaForcedPostProcessor3D ( 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 shanChenDynOmegaForcedPostProcessor3D.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() = "ShanChenDynOmegaForcedPostProcessor3D";
46}
std::string & getName()
read and write access to name

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

+ Here is the call graph for this function:

◆ ShanChenDynOmegaForcedPostProcessor3D() [2/2]

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

Definition at line 49 of file shanChenDynOmegaForcedPostProcessor3D.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() = "ShanChenDynOmegaForcedPostProcessor3D";
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 >
virtual int olb::ShanChenDynOmegaForcedPostProcessor3D< T, DESCRIPTOR >::extent ( ) const
inlinevirtual

Extent of application area (0 for purely local operations)

Implements olb::PostProcessor3D< T, DESCRIPTOR >.

Definition at line 50 of file shanChenDynOmegaForcedPostProcessor3D.h.

51 {
52 return 1;
53 }

◆ extent() [2/2]

template<typename T , typename DESCRIPTOR >
virtual int olb::ShanChenDynOmegaForcedPostProcessor3D< T, DESCRIPTOR >::extent ( int direction) const
inlinevirtual

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

Implements olb::PostProcessor3D< T, DESCRIPTOR >.

Definition at line 54 of file shanChenDynOmegaForcedPostProcessor3D.h.

55 {
56 return 1;
57 }

◆ process()

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

Execute post-processing step.

Implements olb::PostProcessor3D< T, DESCRIPTOR >.

Definition at line 161 of file shanChenDynOmegaForcedPostProcessor3D.hh.

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

◆ processSubDomain()

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

Execute post-processing step on a sublattice.

Implements olb::PostProcessor3D< T, DESCRIPTOR >.

Definition at line 58 of file shanChenDynOmegaForcedPostProcessor3D.hh.

61{
62 typedef DESCRIPTOR L;
63
64 BlockLattice<T,DESCRIPTOR> *partnerLattice = static_cast<BlockLattice<T,DESCRIPTOR> *>(partners[0]);
65
66 int newX0, newX1, newY0, newY1, newZ0, newZ1;
67 if ( util::intersect ( x0, x1, y0, y1, z0, z1,
68 x0_, x1_, y0_, y1_, z0_, z1_,
69 newX0, newX1, newY0, newY1, newZ0, newZ1 ) ) {
70
71 auto& rhoField = blockLattice.template getField<RHO_CACHE>();
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 for (int iZ=newZ0-1; iZ<=newZ1+1; ++iZ) {
79 Cell<T,DESCRIPTOR> cell = blockLattice.get(iX,iY,iZ);
80 rhoField[0][cell.getCellId()] = cell.computeRho()*rho0[0];
81 }
82 }
83 }
84
85 // Compute density and velocity on every site of second lattice, and store result
86 // in external scalars; envelope cells are included, because they are needed
87 // to compute the interaction potential in what follows.
88 for (int iX=newX0-1; iX<=newX1+1; ++iX) {
89 for (int iY=newY0-1; iY<=newY1+1; ++iY) {
90 for (int iZ=newZ0-1; iZ<=newZ1+1; ++iZ) {
91 Cell<T,DESCRIPTOR> cell = partnerLattice->get(iX,iY,iZ);
92 rhoField[1][cell.getCellId()] = cell.computeRho()*rho0[1];
93 }
94 }
95 }
96
97 for (int iX=newX0; iX<=newX1; ++iX) {
98 for (int iY=newY0; iY<=newY1; ++iY) {
99 for (int iZ=newZ0; iZ<=newZ1; ++iZ) {
100 Cell<T,DESCRIPTOR> blockCell = blockLattice.get(iX,iY,iZ);
101 Cell<T,DESCRIPTOR> partnerCell = partnerLattice->get(iX,iY,iZ);
102
103 FieldD<T,DESCRIPTOR,descriptors::VELOCITY> j;
104
105 lbm<DESCRIPTOR>::computeJ(blockCell,j);
106 blockCell.template setField<descriptors::VELOCITY>(j);
107
108 lbm<DESCRIPTOR>::computeJ(partnerCell,j);
109 partnerCell.template setField<descriptors::VELOCITY>(j);
110
111
112 T blockOmega = blockCell.template getField<descriptors::OMEGA>(); //blockLattice.getDynamics(iX, iY, iZ)->getOmega();
113 T partnerOmega = partnerCell.template getField<descriptors::OMEGA>(); //partnerLattice.getDynamics(iX, iY, iZ)->getOmega();
114 // Computation of the common velocity, shared among the two populations
115 T rhoTot = rhoField[0][blockCell.getCellId()]*blockOmega +
116 rhoField[1][blockCell.getCellId()]*partnerOmega;
117
118 Vector<T, 3> uTot;
119 auto blockU = blockCell.template getField<descriptors::VELOCITY>(); // contains precomputed value rho*u
120 auto partnerU = partnerCell.template getField<descriptors::VELOCITY>(); // contains precomputed value rho*u
121 uTot = (blockU*rho0[0]*blockOmega + partnerU*rho0[1]*partnerOmega) / rhoTot;
122
123 // Computation of the interaction potential
124 Vector<T, 3> rhoBlockContribution = {T(), T(), T()};
125 Vector<T, 3> rhoPartnerContribution = {T(), T(), T()};
126 T psi2;
127 T psi1;
128 interactionPotential(&psi2, &rhoField[1][blockCell.getCellId()]);
129 interactionPotential(&psi1, &rhoField[0][blockCell.getCellId()]);
130 for (int iPop = 0; iPop < L::q; ++iPop) {
131 int nextX = iX + descriptors::c<L>(iPop,0);
132 int nextY = iY + descriptors::c<L>(iPop,1);
133 int nextZ = iZ + descriptors::c<L>(iPop,2);
134 T blockRho;
135 T partnerRho;
136 interactionPotential(&blockRho, &rhoField[0][blockLattice.getCellId(nextX, nextY, nextZ)]);
137 interactionPotential(&partnerRho, &rhoField[1][blockLattice.getCellId(nextX, nextY, nextZ)]);
138 rhoBlockContribution += psi2 * blockRho * descriptors::c<L>(iPop) * descriptors::t<T, L>(iPop);
139 rhoPartnerContribution += psi1 * partnerRho * descriptors::c<L>(iPop) * descriptors::t<T, L>(iPop);
140 }
141
142 // Computation and storage of the final velocity, consisting
143 // of u and the momentum difference due to interaction
144 // potential plus external force
145 auto externalBlockForce = blockCell.template getField<descriptors::EXTERNAL_FORCE>();
146 auto externalPartnerForce = partnerCell.template getField<descriptors::EXTERNAL_FORCE>();
147
148 blockCell.template setField<descriptors::VELOCITY>(uTot);
149 partnerCell.template setField<descriptors::VELOCITY>(uTot);
150 blockCell.template setField<descriptors::FORCE>(externalBlockForce
151 - G*rhoPartnerContribution/rhoField[0][blockCell.getCellId()]);
152 partnerCell.template setField<descriptors::FORCE>(externalPartnerForce
153 - G*rhoBlockContribution/rhoField[1][blockCell.getCellId()]);
154 }
155 }
156 }
157 }
158}
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(), and olb::util::intersect().

+ Here is the call graph for this function:

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