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

Using Ladd mechanism. More...

#include <twoWayHelperFunctionals.h>

+ Inheritance diagram for olb::LaddMomentumExchange< T, Lattice >:
+ Collaboration diagram for olb::LaddMomentumExchange< T, Lattice >:

Public Member Functions

 LaddMomentumExchange (UnitConverter< T, Lattice > &converter, SuperLattice< T, Lattice > &sLattice, std::shared_ptr< SuperLatticeInterpDensity3Degree3D< T, Lattice > > interpLatticeDensity, std::shared_ptr< SuperLatticeInterpPhysVelocity3D< T, Lattice > > interpLatticeVelocity)
 Constructor.
 
virtual bool operator() (T gF[], T latticeVelF[], T latticeVelP[], T physPosP[], int latticeRoundedP[], int globic) override
 Computes the momentum transfer from fluid to particle.
 
- Public Member Functions inherited from olb::TwoWayHelperFunctional< T, Lattice >
virtual ~TwoWayHelperFunctional ()
 

Additional Inherited Members

- Protected Member Functions inherited from olb::TwoWayHelperFunctional< T, Lattice >
 TwoWayHelperFunctional (UnitConverter< T, Lattice > &converter, SuperLattice< T, Lattice > &sLattice)
 Constructor.
 
- Protected Attributes inherited from olb::TwoWayHelperFunctional< T, Lattice >
UnitConverter< T, Lattice > & _converter
 
SuperLattice< T, Lattice > & _sLattice
 
std::shared_ptr< SuperLatticeInterpDensity3Degree3D< T, Lattice > > _interpLatticeDensity
 
std::shared_ptr< SuperLatticeInterpPhysVelocity3D< T, Lattice > > _interpLatticeVelocity
 

Detailed Description

template<typename T, typename Lattice>
class olb::LaddMomentumExchange< T, Lattice >

Using Ladd mechanism.

Definition at line 76 of file twoWayHelperFunctionals.h.

Constructor & Destructor Documentation

◆ LaddMomentumExchange()

template<typename T , typename Lattice >
olb::LaddMomentumExchange< T, Lattice >::LaddMomentumExchange ( UnitConverter< T, Lattice > & converter,
SuperLattice< T, Lattice > & sLattice,
std::shared_ptr< SuperLatticeInterpDensity3Degree3D< T, Lattice > > interpLatticeDensity,
std::shared_ptr< SuperLatticeInterpPhysVelocity3D< T, Lattice > > interpLatticeVelocity )

Constructor.

Definition at line 89 of file twoWayHelperFunctionals.hh.

94 : TwoWayHelperFunctional<T, Lattice>(converter, sLattice)
95{
96 this->_interpLatticeDensity = interpLatticeDensity;
97 this->_interpLatticeVelocity = interpLatticeVelocity;
98}
std::shared_ptr< SuperLatticeInterpDensity3Degree3D< T, Lattice > > _interpLatticeDensity
std::shared_ptr< SuperLatticeInterpPhysVelocity3D< T, Lattice > > _interpLatticeVelocity

References olb::TwoWayHelperFunctional< T, Lattice >::_interpLatticeDensity, and olb::TwoWayHelperFunctional< T, Lattice >::_interpLatticeVelocity.

Member Function Documentation

◆ operator()()

template<typename T , typename Lattice >
bool olb::LaddMomentumExchange< T, Lattice >::operator() ( T gF[],
T latticeVelF[],
T latticeVelP[],
T physPosP[],
int latticeRoundedP[],
int globic )
overridevirtual

Computes the momentum transfer from fluid to particle.

Implements olb::TwoWayHelperFunctional< T, Lattice >.

Definition at line 101 of file twoWayHelperFunctionals.hh.

104{
105 T physLatticeL = this->_converter.getConversionFactorLength();
106
107 // force density gF
108 gF[0] = T();
109 gF[1] = T();
110 gF[2] = T();
111
112 T fiPop = T();
113 T sp = T(); // dot product for particle velocity
114 T faPos[3] = {T(), T(), T()}; // fAlphaPosition = particle position
115 T fbPos[3] = {T(), T(), T()}; // fBetaPosition = neighbor position to particle position in direction iPop
116
117 T fa[Lattice::q] = { T() }; // fAlpha = interpolated density to fAlphaPosition
118 T fb[Lattice::q] = { T() }; // fBeta = interpolated density to fBetaPosition
119 T lFU[3] = {T(), T(), T()};
120
121 // runs through all q discrete velocity directions
122 for (unsigned iPop = 0; iPop < Lattice::q; ++iPop) {
123 // physical position on neighbor to get pre-streaming collision part
124 faPos[0] = physPosP[0] + physLatticeL * descriptors::c<Lattice>(iPop,0);
125 faPos[1] = physPosP[1] + physLatticeL * descriptors::c<Lattice>(iPop,1);
126 faPos[2] = physPosP[2] + physLatticeL * descriptors::c<Lattice>(iPop,2);
127 // Lagrange interpolated polynomial to get density on particle position
128 this->_interpLatticeDensity->operator() (fa, faPos, globic);
129
130 // physical position on neighbor to get pre-streaming collision part
131 fbPos[0] = physPosP[0] - physLatticeL * descriptors::c<Lattice>(iPop,0);
132 fbPos[1] = physPosP[1] - physLatticeL * descriptors::c<Lattice>(iPop,1);
133 fbPos[2] = physPosP[2] - physLatticeL * descriptors::c<Lattice>(iPop,2);
134 // Lagrange interpolated polynomial to get density on particle position
135 this->_interpLatticeDensity->operator() (fb, fbPos, globic);
136
137 // fiPop = density on fBetaPosition in direction iPop
138 fiPop = fb[descriptors::opposite<Lattice >(iPop)];
139 // Get f_l of the boundary cell
140 // add density fAlphaL of opposite direction to iPop
141 fiPop -= fa[iPop];
142
143 // physical velocity
144 lFU[0] = -descriptors::c<Lattice>(iPop,0) * fiPop;
145 lFU[1] = -descriptors::c<Lattice>(iPop,1) * fiPop;
146 lFU[2] = -descriptors::c<Lattice>(iPop,2) * fiPop;
147
148 // point product
149 sp = descriptors::c<Lattice>(iPop,0) * latticeVelP[0] + descriptors::c<Lattice>(iPop,1) * latticeVelP[1]
150 + descriptors::c<Lattice>(iPop,2) * latticeVelP[2];
151 sp *= 2. * descriptors::invCs2<T,Lattice>()
152 * descriptors::t<T,Lattice>(iPop);
153
154 // external force density that acts on particles
155 gF[0] += (lFU[0] - descriptors::c<Lattice>(iPop,0) * (sp));
156 gF[1] += (lFU[1] - descriptors::c<Lattice>(iPop,1) * (sp));
157 gF[2] += (lFU[2] - descriptors::c<Lattice>(iPop,2) * (sp));
158 }
159 gF[0] = util::fabs(gF[0]);
160 gF[1] = util::fabs(gF[1]);
161 gF[2] = util::fabs(gF[2]);
162
163 return true;
164}
UnitConverter< T, Lattice > & _converter
constexpr T getConversionFactorLength() const
access (read-only) to private member variable
cpu::simd::Pack< T > fabs(cpu::simd::Pack< T > value)
Definition pack.h:106

References olb::util::fabs().

+ Here is the call graph for this function:

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