OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
olb::AdvectionDiffusionParticleCouplingPostProcessor3D< T, DESCRIPTOR, ADLattice, FIELD_A, FIELD_B > Class Template Reference

#include <navierStokesAdvectionDiffusionCouplingPostProcessor3D.h>

+ Inheritance diagram for olb::AdvectionDiffusionParticleCouplingPostProcessor3D< T, DESCRIPTOR, ADLattice, FIELD_A, FIELD_B >:
+ Collaboration diagram for olb::AdvectionDiffusionParticleCouplingPostProcessor3D< T, DESCRIPTOR, ADLattice, FIELD_A, FIELD_B >:

Public Member Functions

 AdvectionDiffusionParticleCouplingPostProcessor3D (int x0_, int x1_, int y0_, int y1_, int z0_, int z1_, int iC_, std::vector< BlockStructureD< 3 > * > partners_, std::vector< std::reference_wrapper< AdvectionDiffusionForce3D< T, DESCRIPTOR, ADLattice > > > forces_)
 
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
 

Protected Attributes

std::vector< std::reference_wrapper< AdvectionDiffusionForce3D< T, DESCRIPTOR, ADLattice > > > _forces
 
- Protected Attributes inherited from olb::PostProcessor3D< T, DESCRIPTOR >
int _priority
 

Detailed Description

template<typename T, typename DESCRIPTOR, typename ADLattice, typename FIELD_A, typename FIELD_B>
class olb::AdvectionDiffusionParticleCouplingPostProcessor3D< T, DESCRIPTOR, ADLattice, FIELD_A, FIELD_B >

Definition at line 193 of file navierStokesAdvectionDiffusionCouplingPostProcessor3D.h.

Constructor & Destructor Documentation

◆ AdvectionDiffusionParticleCouplingPostProcessor3D()

template<typename T , typename DESCRIPTOR , typename ADLattice , typename FIELD_A , typename FIELD_B >
olb::AdvectionDiffusionParticleCouplingPostProcessor3D< T, DESCRIPTOR, ADLattice, FIELD_A, FIELD_B >::AdvectionDiffusionParticleCouplingPostProcessor3D ( int x0_,
int x1_,
int y0_,
int y1_,
int z0_,
int z1_,
int iC_,
std::vector< BlockStructureD< 3 > * > partners_,
std::vector< std::reference_wrapper< AdvectionDiffusionForce3D< T, DESCRIPTOR, ADLattice > > > forces_ )

Definition at line 428 of file navierStokesAdvectionDiffusionCouplingPostProcessor3D.hh.

432 : _forces(forces_),
433 x0(x0_), x1(x1_), y0(y0_), y1(y1_), z0(z0_), z1(z1_), iC(iC_),
434 _partnerLattice(static_cast<BlockLattice<T,ADLattice> *>(partners_[0])),
435 _cell(_partnerLattice->get(x0,y0,z0)),
436 _cellXp(_partnerLattice->get(x0+1,y0,z0)),
437 _cellXn(_partnerLattice->get(x0-1,y0,z0)),
438 _cellYp(_partnerLattice->get(x0,y0+1,z0)),
439 _cellYn(_partnerLattice->get(x0,y0-1,z0)),
440 _cellZp(_partnerLattice->get(x0,y0,z0+1)),
441 _cellZn(_partnerLattice->get(x0,y0,z0-1))
442{
443 this->getName() = "AdvectionDiffusionParticleCouplingPostProcessor3D";
444}
std::vector< std::reference_wrapper< AdvectionDiffusionForce3D< T, DESCRIPTOR, ADLattice > > > _forces
Cell< T, DESCRIPTOR > get(CellID iCell)
Get Cell interface for index iCell.
std::string & getName()
read and write access to name

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 , typename ADLattice , typename FIELD_A , typename FIELD_B >
int olb::AdvectionDiffusionParticleCouplingPostProcessor3D< T, DESCRIPTOR, ADLattice, FIELD_A, FIELD_B >::extent ( ) const
inlineoverridevirtual

Extent of application area (0 for purely local operations)

Implements olb::PostProcessor3D< T, DESCRIPTOR >.

Definition at line 200 of file navierStokesAdvectionDiffusionCouplingPostProcessor3D.h.

201 {
202 return 1;
203 }

◆ extent() [2/2]

template<typename T , typename DESCRIPTOR , typename ADLattice , typename FIELD_A , typename FIELD_B >
int olb::AdvectionDiffusionParticleCouplingPostProcessor3D< T, DESCRIPTOR, ADLattice, FIELD_A, FIELD_B >::extent ( int direction) const
inlineoverridevirtual

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

Implements olb::PostProcessor3D< T, DESCRIPTOR >.

Definition at line 204 of file navierStokesAdvectionDiffusionCouplingPostProcessor3D.h.

205 {
206 return 1;
207 }

◆ process()

template<typename T , typename DESCRIPTOR , typename ADLattice , typename FIELD_A , typename FIELD_B >
void olb::AdvectionDiffusionParticleCouplingPostProcessor3D< T, DESCRIPTOR, ADLattice, FIELD_A, FIELD_B >::process ( BlockLattice< T, DESCRIPTOR > & blockLattice)
overridevirtual

Execute post-processing step.

Implements olb::PostProcessor3D< T, DESCRIPTOR >.

Definition at line 556 of file navierStokesAdvectionDiffusionCouplingPostProcessor3D.hh.

558{
559 processSubDomain(blockLattice, x0, x1, y0, y1, z0, z1);
560}
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 , typename ADLattice , typename FIELD_A , typename FIELD_B >
void olb::AdvectionDiffusionParticleCouplingPostProcessor3D< T, DESCRIPTOR, ADLattice, FIELD_A, FIELD_B >::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 447 of file navierStokesAdvectionDiffusionCouplingPostProcessor3D.hh.

450{
451 auto vel = par ? _cell.template getField<FIELD_B>() : _cell.template getField<FIELD_A>();
452 //auto vel_new = par ? _cell.template getFieldPointer<FIELD_A>() : _cell.template getFieldPointer<FIELD_B>();
453
454 auto velXp = par ? _cellXp.template getField<FIELD_B>() : _cellXp.template getField<FIELD_A>();
455 auto velXn = par ? _cellXn.template getField<FIELD_B>() : _cellXn.template getField<FIELD_A>();
456 auto velYp = par ? _cellYp.template getField<FIELD_B>() : _cellYp.template getField<FIELD_A>();
457 auto velYn = par ? _cellYn.template getField<FIELD_B>() : _cellYn.template getField<FIELD_A>();
458 auto velZp = par ? _cellZp.template getField<FIELD_B>() : _cellZp.template getField<FIELD_A>();
459 auto velZn = par ? _cellZn.template getField<FIELD_B>() : _cellZn.template getField<FIELD_A>();
460
461 int newX0, newX1, newY0, newY1, newZ0, newZ1;
462
463 if ( util::intersect (
464 x0, x1, y0, y1, z0, z1,
465 x0_, x1_, y0_, y1_, z0_, z1_,
466 newX0, newX1, newY0, newY1, newZ0, newZ1 ) ) {
467
468 for (int iX=newX0; iX<=newX1; ++iX) {
469 for (int iY=newY0; iY<=newY1; ++iY) {
470 for (int iZ=newZ0; iZ<=newZ1; ++iZ) {
471 int latticeR[4] = {iC, iX, iY, iZ};
472 T velGrad[3] = {0.,0.,0.};
473 T forceValue[3] = {0.,0.,0.};
474 T velF[3] = {0.,0.,0.};
475
476 auto nsCell = blockLattice.get(iX,iY,iZ);
477
478 if (_forces.begin() != _forces.end()) {
479 // calculating upwind Gradient
480 // vel contains velocity information on ADlattice
481 // velGrad contains upwind vel on ADlattice
482 if (vel[0]<0.) {
483 velGrad[0] = vel[0]*(velXp[0]-vel[0]);
484 velGrad[1] = vel[0]*(velXp[1]-vel[1]);
485 velGrad[2] = vel[0]*(velXp[2]-vel[2]);
486 }
487 else {
488 velGrad[0] = vel[0]*(vel[0]-velXn[0]);
489 velGrad[1] = vel[0]*(vel[1]-velXn[1]);
490 velGrad[2] = vel[0]*(vel[2]-velXn[2]);
491 }
492 if (vel[1]<0.) {
493 velGrad[0] += vel[1]*(velYp[0]-vel[0]);
494 velGrad[1] += vel[1]*(velYp[1]-vel[1]);
495 velGrad[2] += vel[1]*(velYp[2]-vel[2]);
496 }
497 else {
498 velGrad[0] += vel[1]*(vel[0]-velYn[0]);
499 velGrad[1] += vel[1]*(vel[1]-velYn[1]);
500 velGrad[2] += vel[1]*(vel[2]-velYn[2]);
501 }
502 if (vel[2]<0.) {
503 velGrad[0] += vel[2]*(velZp[0]-vel[0]);
504 velGrad[1] += vel[2]*(velZp[1]-vel[1]);
505 velGrad[2] += vel[2]*(velZp[2]-vel[2]);
506 }
507 else {
508 velGrad[0] += vel[2]*(vel[0]-velZn[0]);
509 velGrad[1] += vel[2]*(vel[1]-velZn[1]);
510 velGrad[2] += vel[2]*(vel[2]-velZn[2]);
511 }
512
513 for (AdvectionDiffusionForce3D<T, DESCRIPTOR, ADLattice>& f : _forces) {
514 // writes force in forceValues, vel refers to ADlattice
515 auto adCell = _partnerLattice->get(x0,y0,z0);
516 f.applyForce(forceValue, &nsCell, &adCell, vel.data(), latticeR);
517 if (par) {
518 _cell.template setField<FIELD_B>(vel);
519 }
520 else {
521 _cell.template setField<FIELD_A>(vel);
522 }
523 }
524
525 // compute new particle velocity
526 Vector<T,DESCRIPTOR::d> newVel;
527 for (int i=0; i < DESCRIPTOR::d; i++) {
528 newVel[i] = vel[i] + forceValue[i] - velGrad[i];
529 }
530 if (par) {
531 _cell.template setField<FIELD_A>(newVel);
532 } else {
533 _cell.template setField<FIELD_B>(newVel);
534 }
535 }
536 else { // set particle velocity to fluid velocity
537 nsCell.computeU(velF);
538 Vector<T,DESCRIPTOR::d> newVel;
539 for (int i = 0; i < DESCRIPTOR::d; i++) {
540 newVel[i] = velF[i];
541 }
542 if (par) {
543 _cell.template setField<FIELD_A>(newVel);
544 } else {
545 _cell.template setField<FIELD_B>(newVel);
546 }
547 }
548 }
549 }
550 }
551 }
552 par = !par;
553}
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:

Member Data Documentation

◆ _forces

template<typename T , typename DESCRIPTOR , typename ADLattice , typename FIELD_A , typename FIELD_B >
std::vector<std::reference_wrapper<AdvectionDiffusionForce3D<T, DESCRIPTOR, ADLattice> > > olb::AdvectionDiffusionParticleCouplingPostProcessor3D< T, DESCRIPTOR, ADLattice, FIELD_A, FIELD_B >::_forces
protected

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