38ShanChenDynOmegaForcedPostProcessor2D <T,DESCRIPTOR>::
39ShanChenDynOmegaForcedPostProcessor2D(
int x0_,
int x1_,
int y0_,
int y1_, T G_,
42 : x0(x0_), x1(x1_), y0(y0_), y1(y1_), G(G_), rho0(rho0_), interactionPotential(iP_), partners(partners_)
44 this->
getName() =
"ShanChenDynOmegaForcedPostProcessor2D";
48ShanChenDynOmegaForcedPostProcessor2D <T,DESCRIPTOR>::
49ShanChenDynOmegaForcedPostProcessor2D(T G_,
52 : x0(0), x1(0), y0(0), y1(0), G(G_), rho0(rho0_), interactionPotential(iP_), partners(partners_)
54 this->
getName() =
"ShanChenDynOmegaForcedPostProcessor2D";
60 int x0_,
int x1_,
int y0_,
int y1_ )
66 int newX0, newX1, newY0, newY1;
69 newX0, newX1, newY0, newY1 ) ) {
71 auto& rhoField = blockLattice.template getField<RHO_CACHE>();
76 for (
int iX=newX0-1; iX<=newX1+1; ++iX) {
77 for (
int iY=newY0-1; iY<=newY1+1; ++iY) {
86 for (
int iX=newX0-1; iX<=newX1+1; ++iX) {
87 for (
int iY=newY0-1; iY<=newY1+1; ++iY) {
93 for (
int iX=newX0; iX<=newX1; ++iX) {
94 for (
int iY=newY0; iY<=newY1; ++iY) {
101 blockCell.template setField<descriptors::VELOCITY>(j);
104 partnerCell.template setField<descriptors::VELOCITY>(j);
106 T blockOmega = blockCell.template getField<descriptors::OMEGA>();
107 T partnerOmega = partnerCell.template getField<descriptors::OMEGA>();
109 T rhoTot = rhoField[0][blockCell.
getCellId()]*blockOmega +
110 rhoField[1][blockCell.
getCellId()]*partnerOmega;
113 auto blockU = blockCell.template getField<descriptors::VELOCITY>();
114 auto partnerU = partnerCell.template getField<descriptors::VELOCITY>();
115 uTot = (blockU*rho0[0]*blockOmega + partnerU*rho0[1]*partnerOmega) / rhoTot;
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);
130 interactionPotential(&blockRho, &rhoField[0][blockLattice.
getCellId(nextX, nextY)]);
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);
139 auto externalBlockForce = blockCell.template getField<descriptors::EXTERNAL_FORCE>();
140 auto externalPartnerForce = partnerCell.template getField<descriptors::EXTERNAL_FORCE>();
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()]);
Interface of 2D post-processing steps.
std::string & getName()
read and write access to name
ShanChenDynOmegaForcedGenerator2D(int x0_, int x1_, int y0_, int y1_, T G_, std::vector< T > rho0_, AnalyticalF< 1, T, T > &iP_)
LatticeCouplingGenerator for NS coupling.
Multiphysics class for coupling between different lattices.
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.
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)