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

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

#include <freeEnergyPostProcessor3D.h>

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

Public Member Functions

 FreeEnergyForceCoupling3D (int x0_, int x1_, int y0_, int y1_, int z0_, int z1_, std::vector< BlockStructureD< 3 > * > partners_)
 
 FreeEnergyForceCoupling3D (std::vector< BlockStructureD< 3 > * > 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_, int z0_, int z1_) override
 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::FreeEnergyForceCoupling3D< 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.

Definition at line 81 of file freeEnergyPostProcessor3D.h.

Constructor & Destructor Documentation

◆ FreeEnergyForceCoupling3D() [1/2]

template<typename T , typename DESCRIPTOR >
olb::FreeEnergyForceCoupling3D< T, DESCRIPTOR >::FreeEnergyForceCoupling3D ( int x0_,
int x1_,
int y0_,
int y1_,
int z0_,
int z1_,
std::vector< BlockStructureD< 3 > * > partners_ )

Definition at line 218 of file freeEnergyPostProcessor3D.hh.

221 : x0(x0_), x1(x1_), y0(y0_), y1(y1_), z0(z0_), z1(z1_), partners(partners_)
222{
223 this->getName() = "FreeEnergyForceCoupling3D";
224}
std::string & getName()
read and write access to name

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

+ Here is the call graph for this function:

◆ FreeEnergyForceCoupling3D() [2/2]

template<typename T , typename DESCRIPTOR >
olb::FreeEnergyForceCoupling3D< T, DESCRIPTOR >::FreeEnergyForceCoupling3D ( std::vector< BlockStructureD< 3 > * > partners_)

Definition at line 227 of file freeEnergyPostProcessor3D.hh.

229 : x0(0), x1(0), y0(0), y1(0), z0(0), z1(0), partners(partners_)
230{
231 this->getName() = "FreeEnergyForceCoupling3D";
232}

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

Extent of application area (0 for purely local operations)

Implements olb::PostProcessor3D< T, DESCRIPTOR >.

Definition at line 86 of file freeEnergyPostProcessor3D.h.

87 {
88 return 1;
89 }

◆ extent() [2/2]

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

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

Implements olb::PostProcessor3D< T, DESCRIPTOR >.

Definition at line 90 of file freeEnergyPostProcessor3D.h.

91 {
92 return 1;
93 }

◆ process()

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

Execute post-processing step.

Implements olb::PostProcessor3D< T, DESCRIPTOR >.

Definition at line 375 of file freeEnergyPostProcessor3D.hh.

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

◆ processSubDomain()

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

Execute post-processing step on a sublattice.

Implements olb::PostProcessor3D< T, DESCRIPTOR >.

Definition at line 235 of file freeEnergyPostProcessor3D.hh.

238{
239 // If partners.size() == 1: two fluid components
240 // If partners.size() == 2: three fluid components
241 BlockLattice<T,DESCRIPTOR> *partnerLattice1 = static_cast<BlockLattice<T,DESCRIPTOR> *>(partners[0]);
242 BlockLattice<T,DESCRIPTOR> *partnerLattice2 = 0;
243 if (partners.size() > 1) {
244 partnerLattice2 = static_cast<BlockLattice<T,DESCRIPTOR> *>(partners[1]);
245 }
246
247 int newX0, newX1, newY0, newY1, newZ0, newZ1;
248 if ( util::intersect ( x0, x1, y0, y1, z0, z1,
249 x0_, x1_, y0_, y1_, z0_, z1_,
250 newX0, newX1, newY0, newY1, newZ0, newZ1 ) ) {
251
252 for (int iX=newX0; iX<=newX1; ++iX) {
253 for (int iY=newY0; iY<=newY1; ++iY) {
254 for (int iZ=newZ0; iZ<=newZ1; ++iZ) {
255 T phi = blockLattice.get(iX,iY,iZ).computeRho();
256 T rho = partnerLattice1->get(iX,iY,iZ).computeRho();
257
258 T gradMuPhiX = 1./12. * ( -blockLattice.get(iX-1,iY,iZ-1).template getField<descriptors::CHEM_POTENTIAL>()
259 - blockLattice.get(iX-1,iY,iZ+1).template getField<descriptors::CHEM_POTENTIAL>()
260 - blockLattice.get(iX-1,iY-1,iZ ).template getField<descriptors::CHEM_POTENTIAL>()
261 - 2.* blockLattice.get(iX-1,iY,iZ ).template getField<descriptors::CHEM_POTENTIAL>()
262 - blockLattice.get(iX-1,iY+1,iZ ).template getField<descriptors::CHEM_POTENTIAL>()
263 + blockLattice.get(iX+1,iY-1,iZ ).template getField<descriptors::CHEM_POTENTIAL>()
264 + 2.* blockLattice.get(iX+1,iY,iZ ).template getField<descriptors::CHEM_POTENTIAL>()
265 + blockLattice.get(iX+1,iY+1,iZ ).template getField<descriptors::CHEM_POTENTIAL>()
266 + blockLattice.get(iX+1,iY,iZ-1).template getField<descriptors::CHEM_POTENTIAL>()
267 + blockLattice.get(iX+1,iY,iZ+1).template getField<descriptors::CHEM_POTENTIAL>() );
268 T gradMuPhiY = 1./12. * ( -blockLattice.get(iX-1,iY-1,iZ ).template getField<descriptors::CHEM_POTENTIAL>()
269 - blockLattice.get(iX+1,iY-1,iZ ).template getField<descriptors::CHEM_POTENTIAL>()
270 - blockLattice.get(iX,iY-1,iZ-1).template getField<descriptors::CHEM_POTENTIAL>()
271 - 2.* blockLattice.get(iX,iY-1,iZ ).template getField<descriptors::CHEM_POTENTIAL>()
272 - blockLattice.get(iX,iY-1,iZ+1).template getField<descriptors::CHEM_POTENTIAL>()
273 + blockLattice.get(iX,iY+1,iZ-1).template getField<descriptors::CHEM_POTENTIAL>()
274 + 2.* blockLattice.get(iX,iY+1,iZ ).template getField<descriptors::CHEM_POTENTIAL>()
275 + blockLattice.get(iX,iY+1,iZ+1).template getField<descriptors::CHEM_POTENTIAL>()
276 + blockLattice.get(iX-1,iY+1,iZ ).template getField<descriptors::CHEM_POTENTIAL>()
277 + blockLattice.get(iX+1,iY+1,iZ ).template getField<descriptors::CHEM_POTENTIAL>() );
278 T gradMuPhiZ = 1./12. * ( -blockLattice.get(iX,iY-1,iZ-1).template getField<descriptors::CHEM_POTENTIAL>()
279 - blockLattice.get(iX,iY+1,iZ-1).template getField<descriptors::CHEM_POTENTIAL>()
280 - blockLattice.get(iX-1,iY,iZ-1).template getField<descriptors::CHEM_POTENTIAL>()
281 - 2.* blockLattice.get(iX,iY,iZ-1).template getField<descriptors::CHEM_POTENTIAL>()
282 - blockLattice.get(iX+1,iY,iZ-1).template getField<descriptors::CHEM_POTENTIAL>()
283 + blockLattice.get(iX-1,iY,iZ+1).template getField<descriptors::CHEM_POTENTIAL>()
284 + 2.* blockLattice.get(iX,iY,iZ+1).template getField<descriptors::CHEM_POTENTIAL>()
285 + blockLattice.get(iX+1,iY,iZ+1).template getField<descriptors::CHEM_POTENTIAL>()
286 + blockLattice.get(iX,iY-1,iZ+1).template getField<descriptors::CHEM_POTENTIAL>()
287 + blockLattice.get(iX,iY+1,iZ+1).template getField<descriptors::CHEM_POTENTIAL>() );
288
289 T gradMuRhoX = 1./12. * ( -partnerLattice1->get(iX-1,iY,iZ-1).template getField<descriptors::CHEM_POTENTIAL>()
290 - partnerLattice1->get(iX-1,iY,iZ+1).template getField<descriptors::CHEM_POTENTIAL>()
291 - partnerLattice1->get(iX-1,iY-1,iZ ).template getField<descriptors::CHEM_POTENTIAL>()
292 - 2.* partnerLattice1->get(iX-1,iY,iZ ).template getField<descriptors::CHEM_POTENTIAL>()
293 - partnerLattice1->get(iX-1,iY+1,iZ ).template getField<descriptors::CHEM_POTENTIAL>()
294 + partnerLattice1->get(iX+1,iY-1,iZ ).template getField<descriptors::CHEM_POTENTIAL>()
295 + 2.* partnerLattice1->get(iX+1,iY,iZ ).template getField<descriptors::CHEM_POTENTIAL>()
296 + partnerLattice1->get(iX+1,iY+1,iZ ).template getField<descriptors::CHEM_POTENTIAL>()
297 + partnerLattice1->get(iX+1,iY,iZ-1).template getField<descriptors::CHEM_POTENTIAL>()
298 + partnerLattice1->get(iX+1,iY,iZ+1).template getField<descriptors::CHEM_POTENTIAL>() );
299 T gradMuRhoY = 1./12. * ( -partnerLattice1->get(iX-1,iY-1,iZ ).template getField<descriptors::CHEM_POTENTIAL>()
300 - partnerLattice1->get(iX+1,iY-1,iZ ).template getField<descriptors::CHEM_POTENTIAL>()
301 - partnerLattice1->get(iX,iY-1,iZ-1).template getField<descriptors::CHEM_POTENTIAL>()
302 - 2.* partnerLattice1->get(iX,iY-1,iZ ).template getField<descriptors::CHEM_POTENTIAL>()
303 - partnerLattice1->get(iX,iY-1,iZ+1).template getField<descriptors::CHEM_POTENTIAL>()
304 + partnerLattice1->get(iX,iY+1,iZ-1).template getField<descriptors::CHEM_POTENTIAL>()
305 + 2.* partnerLattice1->get(iX,iY+1,iZ ).template getField<descriptors::CHEM_POTENTIAL>()
306 + partnerLattice1->get(iX,iY+1,iZ+1).template getField<descriptors::CHEM_POTENTIAL>()
307 + partnerLattice1->get(iX-1,iY+1,iZ ).template getField<descriptors::CHEM_POTENTIAL>()
308 + partnerLattice1->get(iX+1,iY+1,iZ ).template getField<descriptors::CHEM_POTENTIAL>() );
309 T gradMuRhoZ = 1./12. * ( -partnerLattice1->get(iX,iY-1,iZ-1).template getField<descriptors::CHEM_POTENTIAL>()
310 - partnerLattice1->get(iX,iY+1,iZ-1).template getField<descriptors::CHEM_POTENTIAL>()
311 - partnerLattice1->get(iX-1,iY,iZ-1).template getField<descriptors::CHEM_POTENTIAL>()
312 - 2.* partnerLattice1->get(iX,iY,iZ-1).template getField<descriptors::CHEM_POTENTIAL>()
313 - partnerLattice1->get(iX+1,iY,iZ-1).template getField<descriptors::CHEM_POTENTIAL>()
314 + partnerLattice1->get(iX-1,iY,iZ+1).template getField<descriptors::CHEM_POTENTIAL>()
315 + 2.* partnerLattice1->get(iX,iY,iZ+1).template getField<descriptors::CHEM_POTENTIAL>()
316 + partnerLattice1->get(iX+1,iY,iZ+1).template getField<descriptors::CHEM_POTENTIAL>()
317 + partnerLattice1->get(iX,iY-1,iZ+1).template getField<descriptors::CHEM_POTENTIAL>()
318 + partnerLattice1->get(iX,iY+1,iZ+1).template getField<descriptors::CHEM_POTENTIAL>() );
319
320 T psi = 0.;
321 T gradMuPsiX = 0.;
322 T gradMuPsiY = 0.;
323 T gradMuPsiZ = 0.;
324 if (partners.size() > 1) {
325 psi = partnerLattice2->get(iX,iY,iZ).computeRho();
326 gradMuPsiX = 1./12. * ( -partnerLattice2->get(iX-1,iY,iZ-1).template getField<descriptors::CHEM_POTENTIAL>()
327 - partnerLattice2->get(iX-1,iY,iZ+1).template getField<descriptors::CHEM_POTENTIAL>()
328 - partnerLattice2->get(iX-1,iY-1,iZ ).template getField<descriptors::CHEM_POTENTIAL>()
329 - 2.* partnerLattice2->get(iX-1,iY,iZ ).template getField<descriptors::CHEM_POTENTIAL>()
330 - partnerLattice2->get(iX-1,iY+1,iZ ).template getField<descriptors::CHEM_POTENTIAL>()
331 + partnerLattice2->get(iX+1,iY-1,iZ ).template getField<descriptors::CHEM_POTENTIAL>()
332 + 2.* partnerLattice2->get(iX+1,iY,iZ ).template getField<descriptors::CHEM_POTENTIAL>()
333 + partnerLattice2->get(iX+1,iY+1,iZ ).template getField<descriptors::CHEM_POTENTIAL>()
334 + partnerLattice2->get(iX+1,iY,iZ-1).template getField<descriptors::CHEM_POTENTIAL>()
335 + partnerLattice2->get(iX+1,iY,iZ+1).template getField<descriptors::CHEM_POTENTIAL>() );
336 gradMuPsiY = 1./12. * ( -partnerLattice2->get(iX-1,iY-1,iZ ).template getField<descriptors::CHEM_POTENTIAL>()
337 - partnerLattice2->get(iX+1,iY-1,iZ ).template getField<descriptors::CHEM_POTENTIAL>()
338 - partnerLattice2->get(iX,iY-1,iZ-1).template getField<descriptors::CHEM_POTENTIAL>()
339 - 2.* partnerLattice2->get(iX,iY-1,iZ ).template getField<descriptors::CHEM_POTENTIAL>()
340 - partnerLattice2->get(iX,iY-1,iZ+1).template getField<descriptors::CHEM_POTENTIAL>()
341 + partnerLattice2->get(iX,iY+1,iZ-1).template getField<descriptors::CHEM_POTENTIAL>()
342 + 2.* partnerLattice2->get(iX,iY+1,iZ ).template getField<descriptors::CHEM_POTENTIAL>()
343 + partnerLattice2->get(iX,iY+1,iZ+1).template getField<descriptors::CHEM_POTENTIAL>()
344 + partnerLattice2->get(iX-1,iY+1,iZ ).template getField<descriptors::CHEM_POTENTIAL>()
345 + partnerLattice2->get(iX+1,iY+1,iZ ).template getField<descriptors::CHEM_POTENTIAL>() );
346 gradMuPsiZ = 1./12. * ( -partnerLattice2->get(iX,iY-1,iZ-1).template getField<descriptors::CHEM_POTENTIAL>()
347 - partnerLattice2->get(iX,iY+1,iZ-1).template getField<descriptors::CHEM_POTENTIAL>()
348 - partnerLattice2->get(iX-1,iY,iZ-1).template getField<descriptors::CHEM_POTENTIAL>()
349 - 2.* partnerLattice2->get(iX,iY,iZ-1).template getField<descriptors::CHEM_POTENTIAL>()
350 - partnerLattice2->get(iX+1,iY,iZ-1).template getField<descriptors::CHEM_POTENTIAL>()
351 + partnerLattice2->get(iX-1,iY,iZ+1).template getField<descriptors::CHEM_POTENTIAL>()
352 + 2.* partnerLattice2->get(iX,iY,iZ+1).template getField<descriptors::CHEM_POTENTIAL>()
353 + partnerLattice2->get(iX+1,iY,iZ+1).template getField<descriptors::CHEM_POTENTIAL>()
354 + partnerLattice2->get(iX,iY-1,iZ+1).template getField<descriptors::CHEM_POTENTIAL>()
355 + partnerLattice2->get(iX,iY+1,iZ+1).template getField<descriptors::CHEM_POTENTIAL>() );
356 }
357
358 T forceX = -rho*gradMuRhoX - phi*gradMuPhiX - psi*gradMuPsiX;
359 T forceY = -rho*gradMuRhoY - phi*gradMuPhiY - psi*gradMuPsiY;
360 T forceZ = -rho*gradMuRhoZ - phi*gradMuPhiZ - psi*gradMuPsiZ;
361 partnerLattice1->get(iX,iY,iZ).template setField<descriptors::FORCE>({forceX, forceY, forceZ});
362 T u[3];
363 partnerLattice1->get(iX,iY,iZ).computeU(u);
364 blockLattice.get(iX,iY,iZ).template setField<descriptors::FORCE>(u);
365 if (partners.size() > 1) {
366 partnerLattice2->get(iX,iY,iZ).template setField<descriptors::FORCE>(u);
367 }
368 }
369 }
370 }
371 }
372}
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: