28#ifndef LB_FORWARD_COUPLING_MODELS_HH
29#define LB_FORWARD_COUPLING_MODELS_HH
36template<
typename T,
template<
typename V>
class Particle>
40 : _sGeometry(sGeometry),
47template<
typename T,
typename Lattice,
template<
typename V>
class Particle>
54 _converter(converter),
66template<
typename T,
typename Lattice,
template<
typename V>
class Particle>
75template<
typename T,
typename Lattice,
template<
typename V>
class Particle>
79 T physPosP[3] = { p->getPos()[0],
84 int latticeRoundedPosP[3] = {0, 0, 0};
85 this->_sLattice.getCuboidGeometry().get(globic).getLatticeR (
86 latticeRoundedPosP, physPosP );
88 int globicFull[4] = { globic,
89 latticeRoundedPosP[0],
90 latticeRoundedPosP[1],
95 T physVelP[3] = { p->getVel()[0],
100 T latticeVelP[3] = { this->_converter.getLatticeVelocity(physVelP[0]),
101 this->_converter.getLatticeVelocity(physVelP[1]),
102 this->_converter.getLatticeVelocity(physVelP[2])
106 T physVelF[3] = {T(), T(), T()};
107 this->_interpLatticeVelocity->operator() (physVelF, physPosP, globic);
109 T latticeVelF[3] = { this->_converter.getLatticeVelocity(physVelF[0]),
110 this->_converter.getLatticeVelocity(physVelF[1]),
111 this->_converter.getLatticeVelocity(physVelF[2])
115 T gF[3] = {T(), T(), T()};
116 this->_momentumExchange->operator() (gF, latticeVelF, latticeVelP, physPosP, latticeRoundedPosP, globic);
119 T Cd = this->_dragModel->operator()(p, latticeVelF, latticeVelP, globicFull);
122 <<
" physPosP=(" << physPosP[0] <<
", " << physPosP[1] <<
", " << physPosP[2] <<
") "
123 <<
" physVelP=(" << physVelP[0] <<
", " << physVelP[1] <<
", " << physVelP[2] <<
") "
124 <<
" physVelF=(" << physVelF[0] <<
", " << physVelF[1] <<
", " << physVelF[2] <<
") "
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])
143 std::vector<T> physForceP(3, T());
144 physForceP[0] = latticeForceP[0] * this->_converter.getConversionFactorForce();
145 physForceP[1] = latticeForceP[1] * this->_converter.getConversionFactorForce();
146 physForceP[2] = latticeForceP[2] * this->_converter.getConversionFactorForce();
149 p->setStoreForce(physForceP);
164template<
typename T,
typename Lattice,
template<
typename V>
class Particle>
179template<
typename T,
typename Lattice,
template<
typename V>
class Particle>
195template<
typename T,
typename Lattice,
template<
typename V>
class Particle>
203 _smoothingFunctional(smoothingFunctional)
206template<
typename T,
typename Lattice,
template<
typename V>
class Particle>
210 T physPosP[3] = { p->getPos()[0],
215 int latticeRoundedPosP[3] = {0, 0, 0};
216 this->_sLattice.getCuboidGeometry().get(globic).getLatticeR (
217 latticeRoundedPosP, physPosP );
219 int globicFull[4] = { globic,
220 latticeRoundedPosP[0],
221 latticeRoundedPosP[1],
222 latticeRoundedPosP[2]
226 T physVelP[3] = { p->getVel()[0],
231 T latticeVelP[3] = { this->_converter.getLatticeVelocity(physVelP[0]),
232 this->_converter.getLatticeVelocity(physVelP[1]),
233 this->_converter.getLatticeVelocity(physVelP[2])
237 if ( ! this->_smoothingFunctional->update(physPosP, globic)) {
238 std::cout <<
"ERROR: no lattice point enclosed in particle's kernel length!" << std::endl;
243 T latticeForceP[3] = {T(), T(), T()};
244 for (
auto&& i : this->_smoothingFunctional->getData()) {
247 int iLatticePosF[3] = {i.latticePos[0], i.latticePos[1], i.latticePos[2]};
249 T iPhysPosF[3] = {T(), T(), T()};
250 this->_sLattice.getCuboidGeometry().get(globic).getPhysR (
251 iPhysPosF, iLatticePosF );
254 T iPhysVelF[3] = {T(), T(), T()};
255 this->_interpLatticeVelocity->operator() (iPhysVelF, iPhysPosF, globic);
257 T iLatticeVelF[3] = { this->_converter.getLatticeVelocity(iPhysVelF[0]),
258 this->_converter.getLatticeVelocity(iPhysVelF[1]),
259 this->_converter.getLatticeVelocity(iPhysVelF[2])
263 T gF[3] = {T(), T(), T()};
264 this->_momentumExchange->operator() ( gF, iLatticeVelF, latticeVelP, physPosP, iLatticePosF, globic);
267 T Cd = this->_dragModel->operator()(p, iLatticeVelF, latticeVelP, globicFull);
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;
277 std::vector<T> physForceP(3, T());
278 physForceP[0] = latticeForceP[0] * this->_converter.getConversionFactorForce();
279 physForceP[1] = latticeForceP[1] * this->_converter.getConversionFactorForce();
280 physForceP[2] = latticeForceP[2] * this->_converter.getConversionFactorForce();
283 p->setStoreForce(physForceP);
290template<
typename T,
typename Lattice,
template<
typename V>
class Particle>
306template<
typename T,
typename Lattice,
template<
typename V>
class Particle>
314 _smoothingFunctional(smoothingFunctional)
320template<
typename T,
typename Lattice,
template<
typename V>
class Particle>
324 T physPosP[3] = { p->getPos()[0],
329 int latticeRoundedPosP[3] = {0, 0, 0};
330 this->_sLattice.getCuboidGeometry().get(globic).getLatticeR (
331 latticeRoundedPosP, physPosP );
333 int globicFull[4] = { globic,
334 latticeRoundedPosP[0],
335 latticeRoundedPosP[1],
336 latticeRoundedPosP[2]
340 T physVelP[3] = { p->getVel()[0],
345 T latticeVelP[3] = { this->_converter.getLatticeVelocity(physVelP[0]),
346 this->_converter.getLatticeVelocity(physVelP[1]),
347 this->_converter.getLatticeVelocity(physVelP[2])
351 T physVelF[3] = {T(), T(), T()};
352 this->_interpLatticeVelocity->operator() (physVelF, physPosP, globic);
354 T latticeVelF[3] = { this->_converter.getLatticeVelocity(physVelF[0]),
355 this->_converter.getLatticeVelocity(physVelF[1]),
356 this->_converter.getLatticeVelocity(physVelF[2])
360 T gF[3] = {T(), T(), T()};
361 this->_momentumExchange->operator() (gF, latticeVelF, latticeVelP, physPosP, latticeRoundedPosP, globic);
364 if ( ! this->_smoothingFunctional->update(physPosP, globic)) {
365 std::cout <<
"ERROR: no lattice point enclosed in particle's kernel length!" << std::endl;
370 T continuousPhaseFraction = T();
371 for (
auto&& i : this->_smoothingFunctional->getData()) {
372 continuousPhaseFraction += i.continuousPhaseFraction * i.weight;
376 T Cd = this->_dragModel->operator()(p, latticeVelF, latticeVelP, globicFull, continuousPhaseFraction);
379 <<
" physPosP=(" << physPosP[0] <<
", " << physPosP[1] <<
", " << physPosP[2] <<
") "
380 <<
" physVelP=(" << physVelP[0] <<
", " << physVelP[1] <<
", " << physVelP[2] <<
") "
381 <<
" physVelF=(" << physVelF[0] <<
", " << physVelF[1] <<
", " << physVelF[2] <<
") "
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)
400 std::vector<T> physForceP(3, T());
401 physForceP[0] = latticeForceP[0] * this->_converter.getConversionFactorForce();
402 physForceP[1] = latticeForceP[1] * this->_converter.getConversionFactorForce();
403 physForceP[2] = latticeForceP[2] * this->_converter.getConversionFactorForce();
406 p->setStoreForce(physForceP);
Abstact base class for all the local/non-local forward-coupling models.
UnitConverter< T, Lattice > & _converter
std::shared_ptr< TwoWayHelperFunctional< T, Lattice > > _momentumExchange
std::shared_ptr< SuperLatticeInterpPhysVelocity3D< T, Lattice > > _interpLatticeVelocity
BaseForwardCouplingModel(UnitConverter< T, Lattice > &converter, SuperLattice< T, Lattice > &sLattice, SuperGeometry< T, 3 > &sGeometry, std::shared_ptr< DragModel< T, Particle > > dragModel)
Constructor.
std::shared_ptr< SuperLatticeInterpDensity3Degree3D< T, Lattice > > _interpLatticeDensity
SuperLattice< T, Lattice > & _sLattice
Abstact base class for DragModelBase.
Abstact base class for all the forward-coupling models Its raison d'etre consists of not being temple...
ForwardCouplingModel(SuperGeometry< T, 3 > &sGeometry, std::shared_ptr< DragModel< T, Particle > > dragModel)
Constructor.
SuperGeometry< T, 3 > & _sGeometry
LaddForwardCouplingModel(UnitConverter< T, Lattice > &converter, SuperLattice< T, Lattice > &sLattice, SuperGeometry< T, 3 > &sGeometry, std::shared_ptr< DragModel< T, Particle > > dragModel)
Constructor.
Abstact class for all the local forward-coupling models, viz., momentum coupling from fluid to partic...
LocalBaseForwardCouplingModel(UnitConverter< T, Lattice > &converter, SuperLattice< T, Lattice > &sLattice, SuperGeometry< T, 3 > &sGeometry, std::shared_ptr< DragModel< T, Particle > > dragModel)
Constructor.
virtual bool operator()(Particle< T > *p, int globic) override
Class operator to apply the coupling, for overload.
NaiveForwardCouplingModel(UnitConverter< T, Lattice > &converter, SuperLattice< T, Lattice > &sLattice, SuperGeometry< T, 3 > &sGeometry, std::shared_ptr< DragModel< T, Particle > > dragModel)
Constructor.
NaiveNonLocalForwardCouplingModel(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.
Abstact class for all the non-local forward-coupling models, viz., momentum coupling from fluid to pa...
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.
virtual bool operator()(Particle< T > *p, int globic) override
Class operator to apply the coupling, for overload.
Abstact class for all the smoothing functionals.
Representation of a statistic for a parallel 2D geometry.
Super class maintaining block lattices for a cuboid decomposition.
Conversion between physical and lattice units, as well as discretization.
virtual bool operator()(Particle< T > *p, int globic) override
Class operator to apply the coupling, for overload.
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.
cpu::simd::Pack< T > pow(cpu::simd::Pack< T > base, cpu::simd::Pack< T > exp)
Top level namespace for all of OpenLB.