OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
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 359 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 998 of file navierStokesAdvectionDiffusionCouplingPostProcessor3D.hh.

1002 : _forces(forces_),
1003 x0(x0_), x1(x1_), y0(y0_), y1(y1_), z0(z0_), z1(z1_), iC(iC_),
1004 _partnerLattice(static_cast<BlockLattice<T,ADLattice> *>(partners_[0])),
1005 _cell(_partnerLattice->get(x0,y0,z0)),
1006 _cellXp(_partnerLattice->get(x0+1,y0,z0)),
1007 _cellXn(_partnerLattice->get(x0-1,y0,z0)),
1008 _cellYp(_partnerLattice->get(x0,y0+1,z0)),
1009 _cellYn(_partnerLattice->get(x0,y0-1,z0)),
1010 _cellZp(_partnerLattice->get(x0,y0,z0+1)),
1011 _cellZn(_partnerLattice->get(x0,y0,z0-1))
1012{
1013 this->getName() = "VolumeAveragedNavierStokesAdvectionDiffusionParticleCouplingPostProcessor3D";
1014}
Cell< T, DESCRIPTOR > get(CellID iCell)
Get Cell interface for index iCell.
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 366 of file navierStokesAdvectionDiffusionCouplingPostProcessor3D.h.

367 {
368 return 1;
369 }

◆ 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 370 of file navierStokesAdvectionDiffusionCouplingPostProcessor3D.h.

371 {
372 return 1;
373 }

◆ 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 1153 of file navierStokesAdvectionDiffusionCouplingPostProcessor3D.hh.

1155{
1156 processSubDomain(blockLattice, x0, x1, y0, y1, z0, z1);
1157}
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 1017 of file navierStokesAdvectionDiffusionCouplingPostProcessor3D.hh.

1020{
1021 auto vel = par ? _cell.template getField<FIELD_B>() : _cell.template getField<FIELD_A>();
1022 auto vel_new = par ? _cell.template getFieldPointer<FIELD_A>() : _cell.template getFieldPointer<FIELD_B>();
1023
1024 auto velXp = par ? _cellXp.template getFieldPointer<FIELD_B>() : _cellXp.template getFieldPointer<FIELD_A>();
1025 auto velXn = par ? _cellXn.template getFieldPointer<FIELD_B>() : _cellXn.template getFieldPointer<FIELD_A>();
1026 auto velYp = par ? _cellYp.template getFieldPointer<FIELD_B>() : _cellYp.template getFieldPointer<FIELD_A>();
1027 auto velYn = par ? _cellYn.template getFieldPointer<FIELD_B>() : _cellYn.template getFieldPointer<FIELD_A>();
1028 auto velZp = par ? _cellZp.template getFieldPointer<FIELD_B>() : _cellZp.template getFieldPointer<FIELD_A>();
1029 auto velZn = par ? _cellZn.template getFieldPointer<FIELD_B>() : _cellZn.template getFieldPointer<FIELD_A>();
1030
1031 auto forceNS = blockLattice.get(x0,y0,z0).template getFieldPointer<descriptors::FORCE>();
1032
1033 auto _cellNSXp = blockLattice.get(x0+1,y0,z0);
1034 auto _cellNSXn = blockLattice.get(x0-1,y0,z0);
1035 auto _cellNSYp = blockLattice.get(x0,y0+1,z0);
1036 auto _cellNSYn = blockLattice.get(x0,y0-1,z0);
1037 auto _cellNSZp = blockLattice.get(x0,y0,z0+1);
1038 auto _cellNSZn = blockLattice.get(x0,y0,z0-1);
1039
1040 int newX0, newX1, newY0, newY1, newZ0, newZ1;
1041 T porosityForce[3];
1042 T pressure;
1043
1044 if ( util::intersect (
1045 x0, x1, y0, y1, z0, z1,
1046 x0_, x1_, y0_, y1_, z0_, z1_,
1047 newX0, newX1, newY0, newY1, newZ0, newZ1 ) ) {
1048
1049 for (int iX=newX0; iX<=newX1; ++iX) {
1050 for (int iY=newY0; iY<=newY1; ++iY) {
1051 for (int iZ=newZ0; iZ<=newZ1; ++iZ) {
1052 auto nsCell = blockLattice.get(iX,iY,iZ);
1053 T porosityNS = 1. - _cell.computeRho();
1054 nsCell.template setField<POROSITY>(porosityNS);
1055 }
1056 }
1057 }
1058
1059 for (int iX=newX0; iX<=newX1; ++iX) {
1060 for (int iY=newY0; iY<=newY1; ++iY) {
1061 for (int iZ=newZ0; iZ<=newZ1; ++iZ) {
1062 int latticeR[4] = {iC, iX, iY, iZ};
1063 T velGrad[3] = {0.,0.,0.};
1064 T forceValue[3] = {0.,0.,0.};
1065 T velF[3] = {0.,0.,0.};
1066
1067 auto nsCell = blockLattice.get(iX,iY,iZ);
1068 pressure = nsCell.computeRho() / descriptors::invCs2<T,DESCRIPTOR>();
1069
1070 if (_forces.begin() != _forces.end()) {
1071 // calculating upwind Gradient
1072 // vel contains velocity information on ADlattice
1073 // velGrad contains upwind vel on ADlattice
1074 if (vel[0]<0.) {
1075 velGrad[0] = vel[0]*(velXp[0]-vel[0]);
1076 velGrad[1] = vel[0]*(velXp[1]-vel[1]);
1077 velGrad[2] = vel[0]*(velXp[2]-vel[2]);
1078 }
1079 else {
1080 velGrad[0] = vel[0]*(vel[0]-velXn[0]);
1081 velGrad[1] = vel[0]*(vel[1]-velXn[1]);
1082 velGrad[2] = vel[0]*(vel[2]-velXn[2]);
1083 }
1084 if (vel[1]<0.) {
1085 velGrad[0] += vel[1]*(velYp[0]-vel[0]);
1086 velGrad[1] += vel[1]*(velYp[1]-vel[1]);
1087 velGrad[2] += vel[1]*(velYp[2]-vel[2]);
1088 }
1089 else {
1090 velGrad[0] += vel[1]*(vel[0]-velYn[0]);
1091 velGrad[1] += vel[1]*(vel[1]-velYn[1]);
1092 velGrad[2] += vel[1]*(vel[2]-velYn[2]);
1093 }
1094 if (vel[2]<0.) {
1095 velGrad[0] += vel[2]*(velZp[0]-vel[0]);
1096 velGrad[1] += vel[2]*(velZp[1]-vel[1]);
1097 velGrad[2] += vel[2]*(velZp[2]-vel[2]);
1098 }
1099 else {
1100 velGrad[0] += vel[2]*(vel[0]-velZn[0]);
1101 velGrad[1] += vel[2]*(vel[1]-velZn[1]);
1102 velGrad[2] += vel[2]*(vel[2]-velZn[2]);
1103 }
1104
1105 for (AdvectionDiffusionForce3D<T, DESCRIPTOR, ADLattice>& f : _forces) {
1106 // writes force in forceValues, vel refers to ADlattice
1107 auto adCell = _partnerLattice->get(x0,y0,z0);
1108 f.applyForce(forceValue, &nsCell, &adCell, vel.data(), latticeR);
1109 if (par) {
1110 _cell.template setField<FIELD_B>(vel);
1111 } else {
1112 _cell.template setField<FIELD_A>(vel);
1113 }
1114 }
1115
1116 // compute new particle velocity and opposite fluid force
1117 for (int i=0; i < DESCRIPTOR::d; i++) {
1118 vel_new[i] = vel[i] + forceValue[i] - velGrad[i];
1119 forceNS[i] = -forceValue[i];
1120 }
1121 }
1122 else {
1123
1124 T porXp = _cellNSXp.template getField<POROSITY>();
1125 T porXn = _cellNSXn.template getField<POROSITY>();
1126 T porYp = _cellNSYp.template getField<POROSITY>();
1127 T porYn = _cellNSYn.template getField<POROSITY>();
1128 T porZp = _cellNSZp.template getField<POROSITY>();
1129 T porZn = _cellNSZn.template getField<POROSITY>();
1130
1131 porosityForce[0] = 0.5 * pressure * (porXp - porXn);
1132 porosityForce[1] = 0.5 * pressure * (porYp - porYn);
1133 porosityForce[2] = 0.5 * pressure * (porZp - porZn);
1134
1135 for (int i = 0; i < DESCRIPTOR::d; i++) {
1136 forceNS[i] += porosityForce[i];
1137 }
1138
1139 nsCell.computeU(velF);
1140
1141 for (int i = 0; i < DESCRIPTOR::d; i++) { // set particle velocity to fluid velocity
1142 vel_new[i] = velF[i];
1143 }
1144 }
1145 }
1146 }
1147 }
1148 }
1149 par = !par;
1150}
T computeRho() const
Compute particle density on the cell.
Definition cell.hh:206
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 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: