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

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

#include <shanChenDynOmegaForcedPostProcessor2D.h>

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

Public Member Functions

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

Multiphysics class for coupling between different lattices.

Definition at line 42 of file shanChenDynOmegaForcedPostProcessor2D.h.

Constructor & Destructor Documentation

◆ ShanChenDynOmegaForcedPostProcessor2D() [1/2]

template<typename T , typename DESCRIPTOR >
olb::ShanChenDynOmegaForcedPostProcessor2D< T, DESCRIPTOR >::ShanChenDynOmegaForcedPostProcessor2D ( 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 shanChenDynOmegaForcedPostProcessor2D.hh.

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

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

+ Here is the call graph for this function:

◆ ShanChenDynOmegaForcedPostProcessor2D() [2/2]

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

Definition at line 48 of file shanChenDynOmegaForcedPostProcessor2D.hh.

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

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 >
virtual int olb::ShanChenDynOmegaForcedPostProcessor2D< T, DESCRIPTOR >::extent ( ) const
inlinevirtual

Extent of application area (0 for purely local operations)

Implements olb::PostProcessor2D< T, DESCRIPTOR >.

Definition at line 50 of file shanChenDynOmegaForcedPostProcessor2D.h.

51 {
52 return 1;
53 }

◆ extent() [2/2]

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

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

Implements olb::PostProcessor2D< T, DESCRIPTOR >.

Definition at line 54 of file shanChenDynOmegaForcedPostProcessor2D.h.

55 {
56 return 1;
57 }

◆ process()

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

Execute post-processing step.

Implements olb::PostProcessor2D< T, DESCRIPTOR >.

Definition at line 154 of file shanChenDynOmegaForcedPostProcessor2D.hh.

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

◆ processSubDomain()

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

Execute post-processing step on a sublattice.

rho0[1];

Implements olb::PostProcessor2D< T, DESCRIPTOR >.

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