24#ifndef ADVECTION_DIFFUSION_FORCES_HH
25#define ADVECTION_DIFFUSION_FORCES_HH
31template<
typename T,
typename DESCRIPTOR,
39template<
typename T,
typename DESCRIPTOR,
47template<
typename T,
typename DESCRIPTOR,
51 T velF[3] = {0.,0.,0.};
53 for (
int i=0; i < DESCRIPTOR::d; i++) {
54 force[i] += dragCoeff*(velF[i]-vel[i]);
58template<
typename T,
typename DESCRIPTOR,
67template<
typename T,
typename DESCRIPTOR,
71 T velF[3] = {0.,0.,0.};
73 T magVelF = pow((pow(velF[0],2.)+pow(velF[1],2.)+pow(velF[2],2.)),0.5);
74 T magVel = pow((pow(vel[0],2.)+pow(vel[1],2.)+pow(vel[2],2.)),0.5);
75 T Re_p = Re_pCoeff*
abs(magVelF - magVel);
76 for (
int i=0; i < DESCRIPTOR::d; i++) {
77 force[i] += dragCoeff*(1. + 0.15*pow(Re_p,0.687))*(velF[i]-vel[i]);
81template<
typename T,
typename DESCRIPTOR,
92template<
typename T,
typename DESCRIPTOR,
96 for (
int i=0; i < DESCRIPTOR::d; i++) {
97 force[i] += densDiff*gravity[i];
101template<
typename T,
typename DESCRIPTOR,
105 T w_, T* frac_,
bool centrifugeForceOn_,
bool coriolisForceOn_) :
106 sg(superGeometry_), axisPoint(axisPoint_), axisDirection(axisDirection_),
107 w(w_), frac(frac_), centrifugeForceOn(centrifugeForceOn_), coriolisForceOn(coriolisForceOn_)
112template<
typename T,
typename DESCRIPTOR,
116 std::vector<T> F_centri(3,0);
117 std::vector<T> F_coriolis(3,0);
121 std::vector<T> physR(3,T());
122 this->sg.getCuboidGeometry().getPhysR(&(physR[0]),&(latticeR[0]));
124 T scalar = (physR[0]-axisPoint[0])*axisDirection[0]
125 +(physR[1]-axisPoint[1])*axisDirection[1]
126 +(physR[2]-axisPoint[2])*axisDirection[2];
128 if (centrifugeForceOn) {
129 F_centri[0] = wf*wf*(physR[0]-axisPoint[0]-scalar*axisDirection[0]);
130 F_centri[1] = wf*wf*(physR[1]-axisPoint[1]-scalar*axisDirection[1]);
131 F_centri[2] = wf*wf*(physR[2]-axisPoint[2]-scalar*axisDirection[2]);
133 if (coriolisForceOn) {
134 F_coriolis[0] = -2*wf*(axisDirection[1]*vel[2]-axisDirection[2]*vel[1]);
135 F_coriolis[1] = -2*wf*(axisDirection[2]*vel[0]-axisDirection[0]*vel[2]);
136 F_coriolis[2] = -2*wf*(axisDirection[0]*vel[1]-axisDirection[1]*vel[0]);
138 force[0] += (F_coriolis[0]+F_centri[0])*invMassLessForce;
139 force[1] += (F_coriolis[1]+F_centri[1])*invMassLessForce;
140 force[2] += (F_coriolis[2]+F_centri[2])*invMassLessForce;
144template<
typename T,
typename DESCRIPTOR,
146AdvDiffMagneticWireForce3D<T,DESCRIPTOR,ADLattice>::AdvDiffMagneticWireForce3D(
SuperGeometry<T,3>& superGeometry_,
UnitConverter<T,DESCRIPTOR> const& converter_, T pMass,
AnalyticalF<3,T, T>& getMagForce) : sg(superGeometry_), _getMagForce(getMagForce)
153template<
typename T,
typename DESCRIPTOR,
157 std::vector<T> physR(3,T());
158 this->sg.getCuboidGeometry().getPhysR(&(physR[0]),&(latticeR[0]));
159 T pos[3] = { T(), T(), T() };
163 T forceHelp[3] = { T(), T(), T() };
164 _getMagForce(forceHelp, pos);
165 for (
int i=0; i < DESCRIPTOR::d; i++) {
166 force[i] += forceHelp[i] * _pMass / _conversionVelocity;
AdvDiffBuoyancyForce3D(UnitConverter< T, DESCRIPTOR > const &converter_, Vector< T, 3 > g, T pRho_)
void applyForce(T force[], Cell< T, DESCRIPTOR > *nsCell, Cell< T, ADLattice > *adCell, T vel[], int latticeR[]) override
AdvDiffDragForce3D(UnitConverter< T, DESCRIPTOR > const &converter_, T St_)
void applyForce(T force[], Cell< T, DESCRIPTOR > *nsCell, Cell< T, ADLattice > *adCell, T vel[], int latticeR[]) override
AdvDiffMagneticWireForce3D(SuperGeometry< T, 3 > &superGeometry_, UnitConverter< T, DESCRIPTOR > const &converter_, T pMass, AnalyticalF< 3, T, T > &getMagForce)
void applyForce(T force[], Cell< T, DESCRIPTOR > *nsCell, Cell< T, ADLattice > *adCell, T vel[], int latticeR[]) override
void applyForce(T force[], Cell< T, DESCRIPTOR > *nsCell, Cell< T, ADLattice > *adCell, T vel[], int latticeR[])
AdvDiffRotatingForce3D(SuperGeometry< T, 3 > &superGeometry_, const UnitConverter< T, DESCRIPTOR > &converter_, std::vector< T > axisPoint_, std::vector< T > axisDirection_, T w_, T *frac_, bool centrifugeForceOn_=true, bool coriolisForceOn_=true)
void applyForce(T force[], Cell< T, DESCRIPTOR > *nsCell, Cell< T, ADLattice > *adCell, T vel[], int latticeR[]) override
AdvDiffSNDragForce3D(UnitConverter< T, DESCRIPTOR > const &converter_, T pRadius_, T pRho_)
AnalyticalF are applications from DD to XD, where X is set by the constructor.
Highest-level interface to Cell data.
void computeU(T u[descriptors::d< DESCRIPTOR >()]) const
Compute fluid velocity on the cell.
Representation of a statistic for a parallel 2D geometry.
Conversion between physical and lattice units, as well as discretization.
constexpr T getCharPhysLength() const
return characteristic length in physical units
constexpr T getPhysDensity() const
return density in physical units
constexpr T getConversionFactorLength() const
access (read-only) to private member variable
constexpr T getConversionFactorVelocity() const
access (read-only) to private member variable
constexpr T getPhysViscosity() const
return viscosity in physical units
constexpr T getLatticeVelocity(T physVelocity) const
conversion from physical to lattice velocity
constexpr T getCharPhysVelocity() const
return characteristic velocity in physical units
constexpr T getConversionFactorTime() const
access (read-only) to private member variable
Top level namespace for all of OpenLB.
std::enable_if_t< std::is_arithmetic< T >::type::value, T > abs(T x)