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

Class for a forward-coupling model as in Evrard, Denner and van Wachem (2019), but with an extra-normalization of the smoothing function. More...

#include <forwardCouplingModels3D.h>

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

Public Member Functions

 vanWachemForwardCouplingModel (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, int nVoxelInterpPoints)
 Constructor.
 
virtual bool operator() (Particle< T > *p, int globic) override
 Class operator to apply the coupling, for overload.
 

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
 

Additional Inherited Members

- 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.
 

Detailed Description

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

Class for a forward-coupling model as in Evrard, Denner and van Wachem (2019), but with an extra-normalization of the smoothing function.

Input parameters in attice units.

Definition at line 157 of file forwardCouplingModels3D.h.

Constructor & Destructor Documentation

◆ vanWachemForwardCouplingModel()

template<typename T , typename Lattice , template< typename V > class Particle>
olb::vanWachemForwardCouplingModel< T, Lattice, Particle >::vanWachemForwardCouplingModel ( 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,
int nVoxelInterpPoints )

Constructor.

Definition at line 307 of file forwardCouplingModels3D.hh.

313 : BaseForwardCouplingModel<T,Lattice,Particle>(converter, sLattice, sGeometry, dragModel),
314 _smoothingFunctional(smoothingFunctional)
315{
316 this->_momentumExchange = std::make_shared<NaiveMomentumExchange<T, Lattice> > (
317 this->_converter, this->_sLattice, this->_interpLatticeDensity );
318}
UnitConverter< T, Lattice > & _converter
std::shared_ptr< TwoWayHelperFunctional< T, Lattice > > _momentumExchange
std::shared_ptr< SuperLatticeInterpDensity3Degree3D< T, Lattice > > _interpLatticeDensity
SuperLattice< T, Lattice > & _sLattice
std::shared_ptr< SmoothingFunctional< T, Lattice > > _smoothingFunctional

References olb::BaseForwardCouplingModel< T, Lattice, Particle >::_converter, olb::BaseForwardCouplingModel< T, Lattice, Particle >::_interpLatticeDensity, olb::BaseForwardCouplingModel< T, Lattice, Particle >::_momentumExchange, and olb::BaseForwardCouplingModel< T, Lattice, Particle >::_sLattice.

Member Function Documentation

◆ operator()()

template<typename T , typename Lattice , template< typename V > class Particle>
bool olb::vanWachemForwardCouplingModel< 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 drag force in dimensionless units

Computing physical drag force

Updating the particle

Implements olb::ForwardCouplingModel< T, Particle >.

Definition at line 321 of file forwardCouplingModels3D.hh.

322{
324 T physPosP[3] = { p->getPos()[0],
325 p->getPos()[1],
326 p->getPos()[2]
327 }; // particle's physical position
328 // particle's dimensionless position, rounded at neighbouring voxel
329 int latticeRoundedPosP[3] = {0, 0, 0};
330 this->_sLattice.getCuboidGeometry().get(globic).getLatticeR (
331 latticeRoundedPosP, physPosP );
332 // { globic, latticeRoundedP[0, ..., 2] }
333 int globicFull[4] = { globic,
334 latticeRoundedPosP[0],
335 latticeRoundedPosP[1],
336 latticeRoundedPosP[2]
337 };
338
339 // Particle's velocity
340 T physVelP[3] = { p->getVel()[0],
341 p->getVel()[1],
342 p->getVel()[2]
343 }; // Physical
344 // Lattice
345 T latticeVelP[3] = { this->_converter.getLatticeVelocity(physVelP[0]),
346 this->_converter.getLatticeVelocity(physVelP[1]),
347 this->_converter.getLatticeVelocity(physVelP[2])
348 }; // particle's dimensionless velocity
349
350 // Lattice's velocity at particle's location
351 T physVelF[3] = {T(), T(), T()}; // Physical
352 this->_interpLatticeVelocity->operator() (physVelF, physPosP, globic);
353 // Lattice
354 T latticeVelF[3] = { this->_converter.getLatticeVelocity(physVelF[0]),
355 this->_converter.getLatticeVelocity(physVelF[1]),
356 this->_converter.getLatticeVelocity(physVelF[2])
357 }; // Lattice's dimensionless velocity at particle's location
358
359 // Computing fluid-particle momentum transfer
360 T gF[3] = {T(), T(), T()}; // force density gF
361 this->_momentumExchange->operator() (gF, latticeVelF, latticeVelP, physPosP, latticeRoundedPosP, globic);
362
363 // Update the smoothing functional
364 if ( ! this->_smoothingFunctional->update(physPosP, globic)) {
365 std::cout << "ERROR: no lattice point enclosed in particle's kernel length!" << std::endl;
366 return false;
367 }
368
369 // Computing continuous phase fraction across kernel
370 T continuousPhaseFraction = T();
371 for (auto&& i : this->_smoothingFunctional->getData()) {
372 continuousPhaseFraction += i.continuousPhaseFraction * i.weight;
373 }
374
375 // Computing drag coefficient
376 T Cd = this->_dragModel->operator()(p, latticeVelF, latticeVelP, globicFull, continuousPhaseFraction);
377#ifdef VERBOSE
378 std:: cout << Cd
379 << " physPosP=(" << physPosP[0] << ", " << physPosP[1] << ", " << physPosP[2] << ") "
380 << " physVelP=(" << physVelP[0] << ", " << physVelP[1] << ", " << physVelP[2] << ") "
381 << " physVelF=(" << physVelF[0] << ", " << physVelF[1] << ", " << physVelF[2] << ") "
382 << std::endl;
383#endif
384 /*
385 if (Cd > 100.)
386 throw std::range_error ( "LocalBaseForwardCouplingModel::operator(). Cd="+std::to_string(Cd)
387 + "\nphysVelP=(" + std::to_string(physVelP[0]) + ", " + std::to_string(physVelP[1]) + ", " + std::to_string(physVelP[2]) + ")"
388 + "\nphysVelF=(" + std::to_string(physVelF[0]) + ", " + std::to_string(physVelF[1]) + ", " + std::to_string(physVelF[2]) + ")"
389 + "\n");
390 */
391
393 T latticePRad = p->getRad() / this->_converter.getConversionFactorLength();
394 T latticeForceP[3] = { .5 * Cd * M_PI*util::pow(latticePRad,2) * gF[0] * (latticeVelF[0] - latticeVelP[0]) / util::pow(continuousPhaseFraction, 1.65),
395 .5 * Cd * M_PI*util::pow(latticePRad,2) * gF[1] * (latticeVelF[1] - latticeVelP[1]) / util::pow(continuousPhaseFraction, 1.65),
396 .5 * Cd * M_PI*util::pow(latticePRad,2) * gF[2] * (latticeVelF[2] - latticeVelP[2]) / util::pow(continuousPhaseFraction, 1.65)
397 };
398
400 std::vector<T> physForceP(3, T()); // physical force acting on the particle
401 physForceP[0] = latticeForceP[0] * this->_converter.getConversionFactorForce();
402 physForceP[1] = latticeForceP[1] * this->_converter.getConversionFactorForce();
403 physForceP[2] = latticeForceP[2] * this->_converter.getConversionFactorForce();
404
406 p->setStoreForce(physForceP);
407 return true;
408}
#define M_PI
std::shared_ptr< SuperLatticeInterpPhysVelocity3D< T, Lattice > > _interpLatticeVelocity
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::vanWachemForwardCouplingModel< T, Lattice, Particle >::_smoothingFunctional
protected

Definition at line 168 of file forwardCouplingModels3D.h.


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