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

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

#include <forwardCouplingModels3D.h>

+ Inheritance diagram for olb::LocalBaseForwardCouplingModel< T, Lattice, Particle >:
+ Collaboration diagram for olb::LocalBaseForwardCouplingModel< 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

 LocalBaseForwardCouplingModel (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::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.
 

Additional Inherited Members

- 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::LocalBaseForwardCouplingModel< T, Lattice, Particle >

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

Input parameters in attice units.

Definition at line 78 of file forwardCouplingModels3D.h.

Constructor & Destructor Documentation

◆ LocalBaseForwardCouplingModel()

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

Constructor.

Definition at line 67 of file forwardCouplingModels3D.hh.

72 : BaseForwardCouplingModel<T,Lattice,Particle>(converter, sLattice, sGeometry, dragModel)
73{}

Member Function Documentation

◆ operator()()

template<typename T , typename Lattice , template< typename V > class Particle>
bool olb::LocalBaseForwardCouplingModel< 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 76 of file forwardCouplingModels3D.hh.

77{
79 T physPosP[3] = { p->getPos()[0],
80 p->getPos()[1],
81 p->getPos()[2]
82 }; // particle's physical position
83 // particle's dimensionless position, rounded at neighbouring voxel
84 int latticeRoundedPosP[3] = {0, 0, 0};
85 this->_sLattice.getCuboidGeometry().get(globic).getLatticeR (
86 latticeRoundedPosP, physPosP );
87 // { globic, latticeRoundedP[0, ..., 2] }
88 int globicFull[4] = { globic,
89 latticeRoundedPosP[0],
90 latticeRoundedPosP[1],
91 latticeRoundedPosP[2]
92 };
93
94 // Particle's velocity
95 T physVelP[3] = { p->getVel()[0],
96 p->getVel()[1],
97 p->getVel()[2]
98 }; // Physical
99 // Lattice
100 T latticeVelP[3] = { this->_converter.getLatticeVelocity(physVelP[0]),
101 this->_converter.getLatticeVelocity(physVelP[1]),
102 this->_converter.getLatticeVelocity(physVelP[2])
103 }; // particle's dimensionless velocity
104
105 // Lattice's velocity at particle's location
106 T physVelF[3] = {T(), T(), T()}; // Physical
107 this->_interpLatticeVelocity->operator() (physVelF, physPosP, globic);
108 // Lattice
109 T latticeVelF[3] = { this->_converter.getLatticeVelocity(physVelF[0]),
110 this->_converter.getLatticeVelocity(physVelF[1]),
111 this->_converter.getLatticeVelocity(physVelF[2])
112 }; // Lattice's dimensionless velocity at particle's location
113
114 // Computing fluid-particle momentum transfer
115 T gF[3] = {T(), T(), T()}; // force density gF
116 this->_momentumExchange->operator() (gF, latticeVelF, latticeVelP, physPosP, latticeRoundedPosP, globic);
117
118 // Computing drag coefficient
119 T Cd = this->_dragModel->operator()(p, latticeVelF, latticeVelP, globicFull);
120#ifdef VERBOSE
121 std:: cout << Cd
122 << " physPosP=(" << physPosP[0] << ", " << physPosP[1] << ", " << physPosP[2] << ") "
123 << " physVelP=(" << physVelP[0] << ", " << physVelP[1] << ", " << physVelP[2] << ") "
124 << " physVelF=(" << physVelF[0] << ", " << physVelF[1] << ", " << physVelF[2] << ") "
125 << std::endl;
126#endif
127 /*
128 if (Cd > 100.)
129 throw std::range_error ( "LocalBaseForwardCouplingModel::operator(). Cd="+std::to_string(Cd)
130 + "\nphysVelP=(" + std::to_string(physVelP[0]) + ", " + std::to_string(physVelP[1]) + ", " + std::to_string(physVelP[2]) + ")"
131 + "\nphysVelF=(" + std::to_string(physVelF[0]) + ", " + std::to_string(physVelF[1]) + ", " + std::to_string(physVelF[2]) + ")"
132 + "\n");
133 */
134
136 T latticePRad = p->getRad() / this->_converter.getConversionFactorLength();
137 T latticeForceP[3] = { .5 * Cd * M_PI*util::pow(latticePRad,2) * gF[0] * (latticeVelF[0] - latticeVelP[0]),
138 .5 * Cd * M_PI*util::pow(latticePRad,2) * gF[1] * (latticeVelF[1] - latticeVelP[1]),
139 .5 * Cd * M_PI*util::pow(latticePRad,2) * gF[2] * (latticeVelF[2] - latticeVelP[2])
140 }; // dimensionless force acting on the particle
141
143 std::vector<T> physForceP(3, T()); // physical force acting on the particle
144 physForceP[0] = latticeForceP[0] * this->_converter.getConversionFactorForce();
145 physForceP[1] = latticeForceP[1] * this->_converter.getConversionFactorForce();
146 physForceP[2] = latticeForceP[2] * this->_converter.getConversionFactorForce();
147
149 p->setStoreForce(physForceP);
150 return true;
151}
#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:

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