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

Abstact class for all the non-local forward-coupling models, viz., momentum coupling from fluid to particle. More...

#include <forwardCouplingModels3D.h>

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

Public Member Functions

virtual bool operator() (Particle< T > *p, int globic) override
 Class operator to apply the coupling, for overload.
 

Protected Member Functions

 NonLocalBaseForwardCouplingModel (UnitConverter< T, Lattice > &converter, SuperLattice< T, Lattice > &sLattice, SuperGeometry< T, 3 > &sGeometry, std::shared_ptr< DragModel< T, Particle > > dragModel, std::shared_ptr< SmoothingFunctional< T, Lattice > > smoothingFunctional)
 Constructor.
 
- Protected Member Functions inherited from olb::BaseForwardCouplingModel< T, Lattice, Particle >
 BaseForwardCouplingModel (UnitConverter< T, Lattice > &converter, SuperLattice< T, Lattice > &sLattice, SuperGeometry< T, 3 > &sGeometry, std::shared_ptr< DragModel< T, Particle > > dragModel)
 Constructor.
 
- Protected Member Functions inherited from olb::ForwardCouplingModel< T, Particle >
 ForwardCouplingModel (SuperGeometry< T, 3 > &sGeometry, std::shared_ptr< DragModel< T, Particle > > dragModel)
 Constructor.
 

Protected Attributes

std::shared_ptr< SmoothingFunctional< T, Lattice > > _smoothingFunctional
 
- Protected Attributes inherited from olb::BaseForwardCouplingModel< T, Lattice, Particle >
UnitConverter< T, Lattice > & _converter
 
SuperLattice< T, Lattice > & _sLattice
 
std::shared_ptr< SuperLatticeInterpDensity3Degree3D< T, Lattice > > _interpLatticeDensity
 
std::shared_ptr< SuperLatticeInterpPhysVelocity3D< T, Lattice > > _interpLatticeVelocity
 
std::shared_ptr< TwoWayHelperFunctional< T, Lattice > > _momentumExchange
 
- Protected Attributes inherited from olb::ForwardCouplingModel< T, Particle >
SuperGeometry< T, 3 > & _sGeometry
 
std::shared_ptr< DragModel< T, Particle > > _dragModel
 

Detailed Description

template<typename T, typename Lattice, template< typename V > class Particle>
class olb::NonLocalBaseForwardCouplingModel< T, Lattice, Particle >

Abstact class for all the non-local forward-coupling models, viz., momentum coupling from fluid to particle.

Input parameters in attice units.

Definition at line 122 of file forwardCouplingModels3D.h.

Constructor & Destructor Documentation

◆ NonLocalBaseForwardCouplingModel()

template<typename T , typename Lattice , template< typename V > class Particle>
olb::NonLocalBaseForwardCouplingModel< T, Lattice, Particle >::NonLocalBaseForwardCouplingModel ( UnitConverter< T, Lattice > & converter,
SuperLattice< T, Lattice > & sLattice,
SuperGeometry< T, 3 > & sGeometry,
std::shared_ptr< DragModel< T, Particle > > dragModel,
std::shared_ptr< SmoothingFunctional< T, Lattice > > smoothingFunctional )
protected

Constructor.

Definition at line 196 of file forwardCouplingModels3D.hh.

202 : BaseForwardCouplingModel<T,Lattice,Particle>(converter, sLattice, sGeometry, dragModel),
203 _smoothingFunctional(smoothingFunctional)
204{}
std::shared_ptr< SmoothingFunctional< T, Lattice > > _smoothingFunctional

Member Function Documentation

◆ operator()()

template<typename T , typename Lattice , template< typename V > class Particle>
bool olb::NonLocalBaseForwardCouplingModel< T, Lattice, Particle >::operator() ( Particle< T > * p,
int globic )
overridevirtual

Class operator to apply the coupling, for overload.

Getting the particle and its containing cell's position

Computing dimensionless drag force through smoothed average within the kernel smoothing length

Computing drag force in dimensionless units

Computing physical drag force

Updating the particle

Implements olb::ForwardCouplingModel< T, Particle >.

Definition at line 207 of file forwardCouplingModels3D.hh.

208{
210 T physPosP[3] = { p->getPos()[0],
211 p->getPos()[1],
212 p->getPos()[2]
213 }; // particle's physical position
214 // particle's dimensionless position, rounded at neighbouring voxel
215 int latticeRoundedPosP[3] = {0, 0, 0};
216 this->_sLattice.getCuboidGeometry().get(globic).getLatticeR (
217 latticeRoundedPosP, physPosP );
218 // { globic, latticeRoundedP[0, ..., 2] }
219 int globicFull[4] = { globic,
220 latticeRoundedPosP[0],
221 latticeRoundedPosP[1],
222 latticeRoundedPosP[2]
223 };
224
225 // Particle's velocity
226 T physVelP[3] = { p->getVel()[0],
227 p->getVel()[1],
228 p->getVel()[2]
229 }; // Physical
230 // Lattice
231 T latticeVelP[3] = { this->_converter.getLatticeVelocity(physVelP[0]),
232 this->_converter.getLatticeVelocity(physVelP[1]),
233 this->_converter.getLatticeVelocity(physVelP[2])
234 }; // particle's dimensionless velocity
235
236 // Update the smoothing functional
237 if ( ! this->_smoothingFunctional->update(physPosP, globic)) {
238 std::cout << "ERROR: no lattice point enclosed in particle's kernel length!" << std::endl;
239 return false;
240 }
241
243 T latticeForceP[3] = {T(), T(), T()}; // dimensionless force acting on the particle
244 for (auto&& i : this->_smoothingFunctional->getData()) {
245
246 // Position of the iterated voxel
247 int iLatticePosF[3] = {i.latticePos[0], i.latticePos[1], i.latticePos[2]};
248 // Physical
249 T iPhysPosF[3] = {T(), T(), T()};
250 this->_sLattice.getCuboidGeometry().get(globic).getPhysR (
251 iPhysPosF, iLatticePosF );
252
253 // Fluid velocity at the iterated voxel
254 T iPhysVelF[3] = {T(), T(), T()}; // Physical
255 this->_interpLatticeVelocity->operator() (iPhysVelF, iPhysPosF, globic);
256 // Lattice
257 T iLatticeVelF[3] = { this->_converter.getLatticeVelocity(iPhysVelF[0]),
258 this->_converter.getLatticeVelocity(iPhysVelF[1]),
259 this->_converter.getLatticeVelocity(iPhysVelF[2])
260 }; // Lattice's dimensionless velocity at particle's location
261
262 // Computing fluid-particle momentum transfer
263 T gF[3] = {T(), T(), T()}; // force density gF
264 this->_momentumExchange->operator() ( gF, iLatticeVelF, latticeVelP, physPosP, iLatticePosF, globic);
265
266 // Computing drag coefficient
267 T Cd = this->_dragModel->operator()(p, iLatticeVelF, latticeVelP, globicFull);
268
270 T latticePRad = p->getRad() / this->_converter.getConversionFactorLength();
271 latticeForceP[0] += .5 * Cd * M_PI*util::pow(latticePRad,2) * gF[0] * (iLatticeVelF[0] - latticeVelP[0]) * i.weight;
272 latticeForceP[1] += .5 * Cd * M_PI*util::pow(latticePRad,2) * gF[1] * (iLatticeVelF[1] - latticeVelP[1]) * i.weight;
273 latticeForceP[2] += .5 * Cd * M_PI*util::pow(latticePRad,2) * gF[2] * (iLatticeVelF[2] - latticeVelP[2]) * i.weight;
274 }
275
277 std::vector<T> physForceP(3, T()); // physical force acting on the particle
278 physForceP[0] = latticeForceP[0] * this->_converter.getConversionFactorForce();
279 physForceP[1] = latticeForceP[1] * this->_converter.getConversionFactorForce();
280 physForceP[2] = latticeForceP[2] * this->_converter.getConversionFactorForce();
281
283 p->setStoreForce(physForceP);
284 return true;
285}
#define M_PI
UnitConverter< T, Lattice > & _converter
std::shared_ptr< TwoWayHelperFunctional< T, Lattice > > _momentumExchange
std::shared_ptr< SuperLatticeInterpPhysVelocity3D< T, Lattice > > _interpLatticeVelocity
SuperLattice< T, Lattice > & _sLattice
std::shared_ptr< DragModel< T, Particle > > _dragModel
CuboidGeometry< T, D > & getCuboidGeometry()
Read and write access to cuboid geometry.
constexpr T getConversionFactorLength() const
access (read-only) to private member variable
constexpr T getConversionFactorForce() const
access (read-only) to private member variable
constexpr T getLatticeVelocity(T physVelocity) const
conversion from physical to lattice velocity
cpu::simd::Pack< T > pow(cpu::simd::Pack< T > base, cpu::simd::Pack< T > exp)
Definition pack.h:112

References M_PI, and olb::util::pow().

+ Here is the call graph for this function:

Member Data Documentation

◆ _smoothingFunctional

template<typename T , typename Lattice , template< typename V > class Particle>
std::shared_ptr<SmoothingFunctional<T, Lattice> > olb::NonLocalBaseForwardCouplingModel< T, Lattice, Particle >::_smoothingFunctional
protected

Definition at line 134 of file forwardCouplingModels3D.h.


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