24#ifndef SHAN_CHEN_FORCED_SINGLE_COMPONENT_POST_PROCESSOR_2D_HH
25#define SHAN_CHEN_FORCED_SINGLE_COMPONENT_POST_PROCESSOR_2D_HH
37template<
typename T,
typename DESCRIPTOR>
38ShanChenForcedSingleComponentPostProcessor2D <T,DESCRIPTOR>::
39ShanChenForcedSingleComponentPostProcessor2D(
int x0_,
int x1_,
int y0_,
int y1_, T G_,
43 : x0(x0_), x1(x1_), y0(y0_), y1(y1_), G(G_), rho0(rho0_), interactionPotential(iP_), partners(partners_)
45 this->
getName() =
"ShanChenForcedSingleComponentPostProcessor2D";
48template<
typename T,
typename DESCRIPTOR>
49ShanChenForcedSingleComponentPostProcessor2D <T,DESCRIPTOR>::
50ShanChenForcedSingleComponentPostProcessor2D(T G_,
54 : x0(0), x1(0), y0(0), y1(0), G(G_), rho0(rho0_), interactionPotential(iP_), partners(partners_)
56 this->
getName() =
"ShanChenForcedSingleComponentPostProcessor2D";
59template<
typename T,
typename DESCRIPTOR>
62 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>()[0];
76 for (
int iX=newX0-1; iX<=newX1+1; ++iX) {
77 for (
int iY=newY0-1; iY<=newY1+1; ++iY) {
83 for (
int iX=newX0; iX<=newX1; ++iX) {
84 for (
int iY=newY0; iY<=newY1; ++iY) {
87 auto j = blockCell.template getField<descriptors::VELOCITY>();
89 blockCell.template setField<descriptors::VELOCITY>(j);
91 T blockOmega = blockCell.
getDynamics()->getParameters(blockLattice).template getOrFallback<descriptors::OMEGA>(0);
94 T rhoTot = rhoField[blockCell.
getCellId()]*blockOmega;
97 auto blockU = blockCell.template getField<descriptors::VELOCITY>();
98 uTot = (blockU*rho0[0]*blockOmega) / rhoTot;
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);
108 interactionPotential(&blockRho, &rhoField[blockLattice.
getCellId(nextX, nextY)]);
109 rhoBlockContribution += psi * blockRho * descriptors::c<L>(iPop)* descriptors::t<T,L>(iPop);
115 auto externalBlockForce = blockCell.template getField<descriptors::EXTERNAL_FORCE>();
117 blockCell.template setField<descriptors::VELOCITY>(uTot);
118 blockCell.template setField<descriptors::FORCE>(externalBlockForce
119 - G*rhoBlockContribution/rhoField[blockCell.
getCellId()]);
125template<
typename T,
typename DESCRIPTOR>
129 processSubDomain(blockLattice, x0, x1, y0, y1);
135template<
typename T,
typename DESCRIPTOR>
137 int x0_,
int x1_,
int y0_,
int y1_, T G_, std::vector<T> rho0_,
AnalyticalF<1,T,T>& iP_ )
141template<
typename T,
typename DESCRIPTOR>
147template<
typename T,
typename DESCRIPTOR>
152 this->x0,this->x1,this->y0,this->y1,G, rho0, interactionPotential, partners);
155template<
typename T,
typename DESCRIPTOR>
AnalyticalF are applications from DD to XD, where X is set by the constructor.
Platform-abstracted block lattice for external access and inter-block interaction.
Cell< T, DESCRIPTOR > get(CellID iCell)
Get Cell interface for index iCell.
CellID getCellId(LatticeR< D > latticeR) const
Get 1D cell ID.
Highest-level interface to Cell data.
Dynamics< T, DESCRIPTOR > * getDynamics()
Get a pointer to the dynamics.
T computeRho() const
Compute particle density on the cell.
std::size_t getCellId() const
Return memory ID of the currently represented cell.
Interface of 2D post-processing steps.
std::string & getName()
read and write access to name
ShanChenForcedSingleComponentGenerator2D(int x0_, int x1_, int y0_, int y1_, T G_, std::vector< T > rho0_, AnalyticalF< 1, T, T > &iP_)
LatticeCouplingGenerator for NS coupling.
LatticeCouplingGenerator2D< T, DESCRIPTOR > * clone() const override
PostProcessor2D< T, DESCRIPTOR > * generate(std::vector< BlockStructureD< 2 > * > partners) const override
Multiphysics class for coupling between different lattices.
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.
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)
Top level namespace for all of OpenLB.
static void computeJ(CELL &cell, J &j) any_platform
Computation of momentum.
Set of functions commonly used in LB computations – header file.