OpenLB 1.8.1
Loading...
Searching...
No Matches
olb::VolumeAveragedNavierStokesAdvectionDiffusionParticleCouplingPostProcessor3D< T, DESCRIPTOR, POROSITY, ADLattice, FIELD_A, FIELD_B > Class Template Reference

#include <navierStokesAdvectionDiffusionCouplingPostProcessor3D.h>

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

Public Member Functions

 VolumeAveragedNavierStokesAdvectionDiffusionParticleCouplingPostProcessor3D (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 POROSITY, typename ADLattice, typename FIELD_A, typename FIELD_B>
class olb::VolumeAveragedNavierStokesAdvectionDiffusionParticleCouplingPostProcessor3D< T, DESCRIPTOR, POROSITY, ADLattice, FIELD_A, FIELD_B >

Definition at line 352 of file navierStokesAdvectionDiffusionCouplingPostProcessor3D.h.

Constructor & Destructor Documentation

◆ VolumeAveragedNavierStokesAdvectionDiffusionParticleCouplingPostProcessor3D()

template<typename T , typename DESCRIPTOR , typename POROSITY , typename ADLattice , typename FIELD_A , typename FIELD_B >
olb::VolumeAveragedNavierStokesAdvectionDiffusionParticleCouplingPostProcessor3D< T, DESCRIPTOR, POROSITY, ADLattice, FIELD_A, FIELD_B >::VolumeAveragedNavierStokesAdvectionDiffusionParticleCouplingPostProcessor3D ( 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 720 of file navierStokesAdvectionDiffusionCouplingPostProcessor3D.hh.

724 : _forces(forces_),
725 x0(x0_), x1(x1_), y0(y0_), y1(y1_), z0(z0_), z1(z1_), iC(iC_),
726 _partnerLattice(static_cast<BlockLattice<T,ADLattice> *>(partners_[0])),
727 _cell(_partnerLattice->get(x0,y0,z0)),
728 _cellXp(_partnerLattice->get(x0+1,y0,z0)),
729 _cellXn(_partnerLattice->get(x0-1,y0,z0)),
730 _cellYp(_partnerLattice->get(x0,y0+1,z0)),
731 _cellYn(_partnerLattice->get(x0,y0-1,z0)),
732 _cellZp(_partnerLattice->get(x0,y0,z0+1)),
733 _cellZn(_partnerLattice->get(x0,y0,z0-1))
734{
735 this->getName() = "VolumeAveragedNavierStokesAdvectionDiffusionParticleCouplingPostProcessor3D";
736}
std::string & getName()
read and write access to name
std::vector< std::reference_wrapper< AdvectionDiffusionForce3D< T, DESCRIPTOR, ADLattice > > > _forces

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 POROSITY , typename ADLattice , typename FIELD_A , typename FIELD_B >
int olb::VolumeAveragedNavierStokesAdvectionDiffusionParticleCouplingPostProcessor3D< T, DESCRIPTOR, POROSITY, 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 359 of file navierStokesAdvectionDiffusionCouplingPostProcessor3D.h.

360 {
361 return 1;
362 }

◆ extent() [2/2]

template<typename T , typename DESCRIPTOR , typename POROSITY , typename ADLattice , typename FIELD_A , typename FIELD_B >
int olb::VolumeAveragedNavierStokesAdvectionDiffusionParticleCouplingPostProcessor3D< T, DESCRIPTOR, POROSITY, 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 363 of file navierStokesAdvectionDiffusionCouplingPostProcessor3D.h.

364 {
365 return 1;
366 }

◆ process()

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

Execute post-processing step.

Implements olb::PostProcessor3D< T, DESCRIPTOR >.

Definition at line 875 of file navierStokesAdvectionDiffusionCouplingPostProcessor3D.hh.

877{
878 processSubDomain(blockLattice, x0, x1, y0, y1, z0, z1);
879}
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 POROSITY , typename ADLattice , typename FIELD_A , typename FIELD_B >
void olb::VolumeAveragedNavierStokesAdvectionDiffusionParticleCouplingPostProcessor3D< T, DESCRIPTOR, POROSITY, 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 739 of file navierStokesAdvectionDiffusionCouplingPostProcessor3D.hh.

742{
743 auto vel = par ? _cell.template getField<FIELD_B>() : _cell.template getField<FIELD_A>();
744 auto vel_new = par ? _cell.template getFieldPointer<FIELD_A>() : _cell.template getFieldPointer<FIELD_B>();
745
746 auto velXp = par ? _cellXp.template getFieldPointer<FIELD_B>() : _cellXp.template getFieldPointer<FIELD_A>();
747 auto velXn = par ? _cellXn.template getFieldPointer<FIELD_B>() : _cellXn.template getFieldPointer<FIELD_A>();
748 auto velYp = par ? _cellYp.template getFieldPointer<FIELD_B>() : _cellYp.template getFieldPointer<FIELD_A>();
749 auto velYn = par ? _cellYn.template getFieldPointer<FIELD_B>() : _cellYn.template getFieldPointer<FIELD_A>();
750 auto velZp = par ? _cellZp.template getFieldPointer<FIELD_B>() : _cellZp.template getFieldPointer<FIELD_A>();
751 auto velZn = par ? _cellZn.template getFieldPointer<FIELD_B>() : _cellZn.template getFieldPointer<FIELD_A>();
752
753 auto forceNS = blockLattice.get(x0,y0,z0).template getFieldPointer<descriptors::FORCE>();
754
755 auto _cellNSXp = blockLattice.get(x0+1,y0,z0);
756 auto _cellNSXn = blockLattice.get(x0-1,y0,z0);
757 auto _cellNSYp = blockLattice.get(x0,y0+1,z0);
758 auto _cellNSYn = blockLattice.get(x0,y0-1,z0);
759 auto _cellNSZp = blockLattice.get(x0,y0,z0+1);
760 auto _cellNSZn = blockLattice.get(x0,y0,z0-1);
761
762 int newX0, newX1, newY0, newY1, newZ0, newZ1;
763 T porosityForce[3];
764 T pressure;
765
766 if ( util::intersect (
767 x0, x1, y0, y1, z0, z1,
768 x0_, x1_, y0_, y1_, z0_, z1_,
769 newX0, newX1, newY0, newY1, newZ0, newZ1 ) ) {
770
771 for (int iX=newX0; iX<=newX1; ++iX) {
772 for (int iY=newY0; iY<=newY1; ++iY) {
773 for (int iZ=newZ0; iZ<=newZ1; ++iZ) {
774 auto nsCell = blockLattice.get(iX,iY,iZ);
775 T porosityNS = 1. - _cell.computeRho();
776 nsCell.template setField<POROSITY>(porosityNS);
777 }
778 }
779 }
780
781 for (int iX=newX0; iX<=newX1; ++iX) {
782 for (int iY=newY0; iY<=newY1; ++iY) {
783 for (int iZ=newZ0; iZ<=newZ1; ++iZ) {
784 int latticeR[4] = {iC, iX, iY, iZ};
785 T velGrad[3] = {0.,0.,0.};
786 T forceValue[3] = {0.,0.,0.};
787 T velF[3] = {0.,0.,0.};
788
789 auto nsCell = blockLattice.get(iX,iY,iZ);
790 pressure = nsCell.computeRho() / descriptors::invCs2<T,DESCRIPTOR>();
791
792 if (_forces.begin() != _forces.end()) {
793 // calculating upwind Gradient
794 // vel contains velocity information on ADlattice
795 // velGrad contains upwind vel on ADlattice
796 if (vel[0]<0.) {
797 velGrad[0] = vel[0]*(velXp[0]-vel[0]);
798 velGrad[1] = vel[0]*(velXp[1]-vel[1]);
799 velGrad[2] = vel[0]*(velXp[2]-vel[2]);
800 }
801 else {
802 velGrad[0] = vel[0]*(vel[0]-velXn[0]);
803 velGrad[1] = vel[0]*(vel[1]-velXn[1]);
804 velGrad[2] = vel[0]*(vel[2]-velXn[2]);
805 }
806 if (vel[1]<0.) {
807 velGrad[0] += vel[1]*(velYp[0]-vel[0]);
808 velGrad[1] += vel[1]*(velYp[1]-vel[1]);
809 velGrad[2] += vel[1]*(velYp[2]-vel[2]);
810 }
811 else {
812 velGrad[0] += vel[1]*(vel[0]-velYn[0]);
813 velGrad[1] += vel[1]*(vel[1]-velYn[1]);
814 velGrad[2] += vel[1]*(vel[2]-velYn[2]);
815 }
816 if (vel[2]<0.) {
817 velGrad[0] += vel[2]*(velZp[0]-vel[0]);
818 velGrad[1] += vel[2]*(velZp[1]-vel[1]);
819 velGrad[2] += vel[2]*(velZp[2]-vel[2]);
820 }
821 else {
822 velGrad[0] += vel[2]*(vel[0]-velZn[0]);
823 velGrad[1] += vel[2]*(vel[1]-velZn[1]);
824 velGrad[2] += vel[2]*(vel[2]-velZn[2]);
825 }
826
827 for (AdvectionDiffusionForce3D<T, DESCRIPTOR, ADLattice>& f : _forces) {
828 // writes force in forceValues, vel refers to ADlattice
829 auto adCell = _partnerLattice->get(x0,y0,z0);
830 f.applyForce(forceValue, &nsCell, &adCell, vel.data(), latticeR);
831 if (par) {
832 _cell.template setField<FIELD_B>(vel);
833 } else {
834 _cell.template setField<FIELD_A>(vel);
835 }
836 }
837
838 // compute new particle velocity and opposite fluid force
839 for (int i=0; i < DESCRIPTOR::d; i++) {
840 vel_new[i] = vel[i] + forceValue[i] - velGrad[i];
841 forceNS[i] = -forceValue[i];
842 }
843 }
844 else {
845
846 T porXp = _cellNSXp.template getField<POROSITY>();
847 T porXn = _cellNSXn.template getField<POROSITY>();
848 T porYp = _cellNSYp.template getField<POROSITY>();
849 T porYn = _cellNSYn.template getField<POROSITY>();
850 T porZp = _cellNSZp.template getField<POROSITY>();
851 T porZn = _cellNSZn.template getField<POROSITY>();
852
853 porosityForce[0] = 0.5 * pressure * (porXp - porXn);
854 porosityForce[1] = 0.5 * pressure * (porYp - porYn);
855 porosityForce[2] = 0.5 * pressure * (porZp - porZn);
856
857 for (int i = 0; i < DESCRIPTOR::d; i++) {
858 forceNS[i] += porosityForce[i];
859 }
860
861 nsCell.computeU(velF);
862
863 for (int i = 0; i < DESCRIPTOR::d; i++) { // set particle velocity to fluid velocity
864 vel_new[i] = velF[i];
865 }
866 }
867 }
868 }
869 }
870 }
871 par = !par;
872}
constexpr T invCs2() any_platform
Definition functions.h:107
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:85

References olb::util::intersect(), and olb::descriptors::invCs2().

+ Here is the call graph for this function:

Member Data Documentation

◆ _forces

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

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