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

PostProcessor calculating the interfacial force in the free energy model. More...

#include <freeEnergyPostProcessor2D.h>

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

Public Member Functions

 FreeEnergyForceCoupling2D (int x0_, int x1_, int y0_, int y1_, std::vector< BlockStructureD< 2 > * > partners_)
 
 FreeEnergyForceCoupling2D (std::vector< BlockStructureD< 2 > * > 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_) override
 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::FreeEnergyForceCoupling2D< T, DESCRIPTOR >

PostProcessor calculating the interfacial force in the free energy model.

On the fist lattice the force is stored for the Guo forcing scheme. On the other lattices a velocity, calculated from that force, is stored which is used in the equilibrium distribution function. This should be assigned to the second lattice, with the first lattice being the first partner lattice.

Definition at line 87 of file freeEnergyPostProcessor2D.h.

Constructor & Destructor Documentation

◆ FreeEnergyForceCoupling2D() [1/2]

template<typename T , typename DESCRIPTOR >
olb::FreeEnergyForceCoupling2D< T, DESCRIPTOR >::FreeEnergyForceCoupling2D ( int x0_,
int x1_,
int y0_,
int y1_,
std::vector< BlockStructureD< 2 > * > partners_ )
Parameters
[in]partners_- Contains one partner lattice for two fluid components, or two lattices for three components.

Definition at line 181 of file freeEnergyPostProcessor2D.hh.

184 : x0(x0_), x1(x1_), y0(y0_), y1(y1_), partners(partners_)
185{
186 this->getName() = "FreeEnergyForceCoupling2D";
187}
std::string & getName()
read and write access to name

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

+ Here is the call graph for this function:

◆ FreeEnergyForceCoupling2D() [2/2]

template<typename T , typename DESCRIPTOR >
olb::FreeEnergyForceCoupling2D< T, DESCRIPTOR >::FreeEnergyForceCoupling2D ( std::vector< BlockStructureD< 2 > * > partners_)
Parameters
[in]partners_- Contains one partner lattice for two fluid components, or two lattices for three components.

Definition at line 190 of file freeEnergyPostProcessor2D.hh.

192 : x0(0), x1(0), y0(0), y1(0), partners(partners_)
193{
194 this->getName() = "FreeEnergyForceCoupling2D";
195}

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 >
int olb::FreeEnergyForceCoupling2D< T, DESCRIPTOR >::extent ( ) const
inlineoverridevirtual

Extent of application area (0 for purely local operations)

Implements olb::PostProcessor2D< T, DESCRIPTOR >.

Definition at line 94 of file freeEnergyPostProcessor2D.h.

95 {
96 return 1;
97 }

◆ extent() [2/2]

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

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

Implements olb::PostProcessor2D< T, DESCRIPTOR >.

Definition at line 98 of file freeEnergyPostProcessor2D.h.

99 {
100 return 1;
101 }

◆ process()

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

Execute post-processing step.

Implements olb::PostProcessor2D< T, DESCRIPTOR >.

Definition at line 278 of file freeEnergyPostProcessor2D.hh.

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

◆ processSubDomain()

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

Execute post-processing step on a sublattice.

Implements olb::PostProcessor2D< T, DESCRIPTOR >.

Definition at line 198 of file freeEnergyPostProcessor2D.hh.

200{
201 // If partners.size() == 1: two fluid components
202 // If partners.size() == 2: three fluid components
203 BlockLattice<T,DESCRIPTOR> *partnerLattice1 = static_cast<BlockLattice<T,DESCRIPTOR> *>(partners[0]);
204 BlockLattice<T,DESCRIPTOR> *partnerLattice2 = nullptr;
205 if (partners.size() > 1) {
206 partnerLattice2 = static_cast<BlockLattice<T,DESCRIPTOR> *>(partners[1]);
207 }
208
209 int newX0, newX1, newY0, newY1;
210 if ( util::intersect(x0, x1, y0, y1,
211 x0_, x1_, y0_, y1_,
212 newX0, newX1, newY0, newY1) ) {
213
214 for (int iX=newX0; iX<=newX1; ++iX) {
215 for (int iY=newY0; iY<=newY1; ++iY) {
216 T phi = blockLattice.get(iX,iY).computeRho();
217 T rho = partnerLattice1->get(iX,iY).computeRho();
218 T gradMuPhiX = 1./12. * ( -blockLattice.get(iX-1,iY-1).template getField<descriptors::CHEM_POTENTIAL>()
219 - 4.* blockLattice.get(iX-1,iY ).template getField<descriptors::CHEM_POTENTIAL>()
220 - blockLattice.get(iX-1,iY+1).template getField<descriptors::CHEM_POTENTIAL>()
221 + blockLattice.get(iX+1,iY-1).template getField<descriptors::CHEM_POTENTIAL>()
222 + 4.* blockLattice.get(iX+1,iY ).template getField<descriptors::CHEM_POTENTIAL>()
223 + blockLattice.get(iX+1,iY+1).template getField<descriptors::CHEM_POTENTIAL>() );
224 T gradMuPhiY = 1./12. * ( -blockLattice.get(iX-1,iY-1).template getField<descriptors::CHEM_POTENTIAL>()
225 - 4.* blockLattice.get(iX,iY-1).template getField<descriptors::CHEM_POTENTIAL>()
226 - blockLattice.get(iX+1,iY-1).template getField<descriptors::CHEM_POTENTIAL>()
227 + blockLattice.get(iX-1,iY+1).template getField<descriptors::CHEM_POTENTIAL>()
228 + 4.* blockLattice.get(iX,iY+1).template getField<descriptors::CHEM_POTENTIAL>()
229 + blockLattice.get(iX+1,iY+1).template getField<descriptors::CHEM_POTENTIAL>() );
230 T gradMuRhoX = 1./12. * ( -partnerLattice1->get(iX-1,iY-1).template getField<descriptors::CHEM_POTENTIAL>()
231 - 4.* partnerLattice1->get(iX-1,iY ).template getField<descriptors::CHEM_POTENTIAL>()
232 - partnerLattice1->get(iX-1,iY+1).template getField<descriptors::CHEM_POTENTIAL>()
233 + partnerLattice1->get(iX+1,iY-1).template getField<descriptors::CHEM_POTENTIAL>()
234 + 4.* partnerLattice1->get(iX+1,iY ).template getField<descriptors::CHEM_POTENTIAL>()
235 + partnerLattice1->get(iX+1,iY+1).template getField<descriptors::CHEM_POTENTIAL>() );
236 T gradMuRhoY = 1./12. * ( -partnerLattice1->get(iX-1,iY-1).template getField<descriptors::CHEM_POTENTIAL>()
237 - 4.* partnerLattice1->get(iX,iY-1).template getField<descriptors::CHEM_POTENTIAL>()
238 - partnerLattice1->get(iX+1,iY-1).template getField<descriptors::CHEM_POTENTIAL>()
239 + partnerLattice1->get(iX-1,iY+1).template getField<descriptors::CHEM_POTENTIAL>()
240 + 4.* partnerLattice1->get(iX,iY+1).template getField<descriptors::CHEM_POTENTIAL>()
241 + partnerLattice1->get(iX+1,iY+1).template getField<descriptors::CHEM_POTENTIAL>() );
242 T psi = 0.;
243 T gradMuPsiX = 0.;
244 T gradMuPsiY = 0.;
245 if (partners.size() > 1) {
246 psi = partnerLattice2->get(iX,iY).computeRho();
247 gradMuPsiX = 1./12. * ( -partnerLattice2->get(iX-1,iY-1).template getField<descriptors::CHEM_POTENTIAL>()
248 - 4.* partnerLattice2->get(iX-1,iY ).template getField<descriptors::CHEM_POTENTIAL>()
249 - partnerLattice2->get(iX-1,iY+1).template getField<descriptors::CHEM_POTENTIAL>()
250 + partnerLattice2->get(iX+1,iY-1).template getField<descriptors::CHEM_POTENTIAL>()
251 + 4.* partnerLattice2->get(iX+1,iY ).template getField<descriptors::CHEM_POTENTIAL>()
252 + partnerLattice2->get(iX+1,iY+1).template getField<descriptors::CHEM_POTENTIAL>() );
253 gradMuPsiY = 1./12. * ( -partnerLattice2->get(iX-1,iY-1).template getField<descriptors::CHEM_POTENTIAL>()
254 - 4.* partnerLattice2->get(iX,iY-1).template getField<descriptors::CHEM_POTENTIAL>()
255 - partnerLattice2->get(iX+1,iY-1).template getField<descriptors::CHEM_POTENTIAL>()
256 + partnerLattice2->get(iX-1,iY+1).template getField<descriptors::CHEM_POTENTIAL>()
257 + 4.* partnerLattice2->get(iX,iY+1).template getField<descriptors::CHEM_POTENTIAL>()
258 + partnerLattice2->get(iX+1,iY+1).template getField<descriptors::CHEM_POTENTIAL>() );
259 }
260
261 auto partnerCell = partnerLattice1->get(iX, iY);
262 partnerCell.template setField<descriptors::FORCE>({
263 -rho*gradMuRhoX - phi*gradMuPhiX - psi*gradMuPsiX,
264 -rho*gradMuRhoY - phi*gradMuPhiY - psi*gradMuPsiY
265 });
266 T u[2] { };
267 partnerCell.computeU(u);
268 blockLattice.get(iX, iY).template setField<descriptors::FORCE>(u);
269 if (partners.size() > 1) {
270 partnerLattice2->get(iX, iY).template setField<descriptors::FORCE>(u);
271 }
272 }
273 }
274 }
275}
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

References olb::BlockLattice< T, DESCRIPTOR >::get(), and olb::util::intersect().

+ Here is the call graph for this function:

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