OpenLB 1.8.1
Loading...
Searching...
No Matches
olb::BlockLatticeStokesSpheroidDragForce< T, DESCRIPTOR, PARTICLETYPE > Class Template Referencefinal

#include <latticeStokesSpheroidDragForce.h>

+ Inheritance diagram for olb::BlockLatticeStokesSpheroidDragForce< T, DESCRIPTOR, PARTICLETYPE >:
+ Collaboration diagram for olb::BlockLatticeStokesSpheroidDragForce< T, DESCRIPTOR, PARTICLETYPE >:

Public Member Functions

 BlockLatticeStokesSpheroidDragForce (BlockLattice< T, DESCRIPTOR > &blockLattice, const BlockGeometry< T, DESCRIPTOR::d > &blockGeometry, particles::ParticleSystem< T, PARTICLETYPE > &particleSystem, const UnitConverter< T, DESCRIPTOR > &converter, PhysR< T, DESCRIPTOR::d > cellMin=PhysR< T, DESCRIPTOR::d >(0.), PhysR< T, DESCRIPTOR::d > cellMax=PhysR< T, DESCRIPTOR::d >(0.), Vector< bool, DESCRIPTOR::d > periodic=Vector< bool, DESCRIPTOR::d >(false), std::size_t iP0=0)
 
void evaluate (T output[], particles::Particle< T, PARTICLETYPE > &particle, int iP)
 
bool operator() (T output[], const int input[]) override
 

Static Public Attributes

static constexpr bool serializeForce = false
 

Detailed Description

template<typename T, typename DESCRIPTOR, typename PARTICLETYPE>
class olb::BlockLatticeStokesSpheroidDragForce< T, DESCRIPTOR, PARTICLETYPE >

Definition at line 56 of file latticeStokesSpheroidDragForce.h.

Constructor & Destructor Documentation

◆ BlockLatticeStokesSpheroidDragForce()

template<typename T , typename DESCRIPTOR , typename PARTICLETYPE >
olb::BlockLatticeStokesSpheroidDragForce< T, DESCRIPTOR, PARTICLETYPE >::BlockLatticeStokesSpheroidDragForce ( BlockLattice< T, DESCRIPTOR > & blockLattice,
const BlockGeometry< T, DESCRIPTOR::d > & blockGeometry,
particles::ParticleSystem< T, PARTICLETYPE > & particleSystem,
const UnitConverter< T, DESCRIPTOR > & converter,
PhysR< T, DESCRIPTOR::d > cellMin = PhysR<T,DESCRIPTOR::d> (0.),
PhysR< T, DESCRIPTOR::d > cellMax = PhysR<T,DESCRIPTOR::d> (0.),
Vector< bool, DESCRIPTOR::d > periodic = Vector<bool,DESCRIPTOR::d> (false),
std::size_t iP0 = 0 )

Definition at line 33 of file latticeStokesSpheroidDragForce.hh.

41 : BlockLatticePhysF<T,DESCRIPTOR>(blockLattice, converter,
42 (DESCRIPTOR::d)*(particleSystem.size()-iP0)),
43 _blockGeometry(blockGeometry), _blockLattice(blockLattice),
44 _particleSystem(particleSystem),
45 _cellMin(cellMin), _cellMax(cellMax), _periodic(periodic), _iP0(iP0)
46{
47 this->getName() = "physStokesSpheroidDragForce";
48}
std::conditional_t< DESCRIPTOR::d==2, BlockLatticePhysF2D< T, DESCRIPTOR >, BlockLatticePhysF3D< T, DESCRIPTOR > > BlockLatticePhysF
Definition aliases.h:328
std::string getName(OperatorScope scope)
Returns human-readable name of scope.

References olb::getName().

+ Here is the call graph for this function:

Member Function Documentation

◆ evaluate()

template<typename T , typename DESCRIPTOR , typename PARTICLETYPE >
void olb::BlockLatticeStokesSpheroidDragForce< T, DESCRIPTOR, PARTICLETYPE >::evaluate ( T output[],
particles::Particle< T, PARTICLETYPE > & particle,
int iP )

Definition at line 51 of file latticeStokesSpheroidDragForce.hh.

52{
53 constexpr unsigned D = DESCRIPTOR::d;
54
55 using namespace descriptors;
56 using namespace eler;
57 static_assert(PARTICLETYPE::template providesNested<MOBILITY, FLUIDVEL>(), "Field MOBILITY:FLUIDVEL has to be provided");
58 //Retrieve particle quantities
59 Vector<T,D> position = particle.template getField<GENERAL,POSITION>();
60 Vector<T,D> velocity = particle.template getField<MOBILITY,VELOCITY>();
61 T* positionArray = position.data();
62
63 //TODO: check, whether creation can be avoided by using a second _blockF list
64 const auto& cuboid = _blockGeometry.getCuboid();
66 _blockLattice, this->_converter, cuboid);
67
68 //Calculate general constants
69 T Const = this->_converter.getPhysViscosity()*this->_converter.getPhysDensity()*M_PI*particle.template getField<PHYSPROPERTIES,RADIUS>();
70 //Calculate particle coefficiants
71
72 T fluidVelArray[D] = {0.};
73
74 //Check whether inside cuboid (when not parallelized)
75 bool inside = true;
77 inside = cuboid.isInside(position);
78 }
79 if (inside){
80 //Force computation
81 //Retrieve interpolated velocity at position
82 blockInterpPhysVelF(fluidVelArray, positionArray);
83 particle.template setField<MOBILITY, FLUIDVEL>(fluidVelArray);
84
85 Vector<T,3> fvel = particle.template getField<MOBILITY, FLUIDVEL>();
86
87 Vector<T,9> rotmat = particle.template getField<NUMERICPROPERTIES,ROT_MATRIX>();
88
89 Vector<T,9> Khathat (0.);
90Khathat = eler::matrixMultiply(eler::inverseTransformMatrix(rotmat),
91eler::matrixMultiply(particle.template getField<NUMERICPROPERTIES,TRANSLATIONAL_DYADIC>(), rotmat));
92Vector<T,3> Khathatvelo (0.);
93Khathatvelo = eler::matrixVectorMultiply(Khathat, fvel - velocity);
94Vector<T,3> force = Const*Khathatvelo;
95
96 T dynvisc = this->_converter.getPhysViscosity()*this->_converter.getPhysDensity();
97
98
99 //Torque computation
100 Vector <T,3> torq (0.);
101 Vector <T,3> posVector (0.);
102 posVector = positionArray;
103 Vector<T,3> x (1.,0.,0.);
104 Vector<T,3> y (0.,1.,0.);
105 Vector<T,3> z (0.,0.,1.);
106 Vector<T,3> gradx (0.);
107 Vector<T,3> grady (0.);
108 Vector<T,3> gradz (0.);
109
110
111 veloGradientInterpFD<T,DESCRIPTOR>(gradx,blockInterpPhysVelF, x,posVector, this->_converter.getPhysDeltaX()/100.);
112 veloGradientInterpFD<T,DESCRIPTOR>(grady,blockInterpPhysVelF, y,posVector, this->_converter.getPhysDeltaX()/100.);
113 veloGradientInterpFD<T,DESCRIPTOR>(gradz,blockInterpPhysVelF, z,posVector, this->_converter.getPhysDeltaX()/100.);
114
115
116 /* / 0 1 2 \ vx/dx vx/dy vx/dz
117 | 3 4 5 | vy/dx vy/dy vy/dz
118 \ 6 7 8 / vz/dx vz/dy vz/dz */
119 Vector <T,9> gradvel (0.);
120 gradvel[0] = gradx[0];
121 gradvel[3] = gradx[1];
122 gradvel[6] = gradx[2];
123 gradvel[1] = grady[0];
124 gradvel[4] = grady[1];
125 gradvel[7] = grady[2];
126 gradvel[2] = gradz[0];
127 gradvel[5] = gradz[1];
128 gradvel[8] = gradz[2];
129
130 Vector<T,3> abg0 =particle.template getField<NUMERICPROPERTIES,ABG0> ();
131 T beta = particle.template getField<NUMERICPROPERTIES,BETA> ();
132 Vector<T,3> ang_vel = particle.template getField<NUMERICPROPERTIES,ANG_VELOCITY> ();
133 T rad = particle.template getField<PHYSPROPERTIES,RADIUS> ();
134
135 gradvel = matrixMultiply(rotmat,matrixMultiply(gradvel, inverseTransformMatrix(rotmat)));
136
137 torq[0] = (16*M_PI*dynvisc*util::pow(rad,3)*beta)/
138 (3*(abg0[1]+util::pow(beta,2)*abg0[2]))*
139 ((1- util::pow(beta,2))*(0.5*(gradvel[7]+gradvel[5]))+ (1+ util::pow(beta,2))*
140 (0.5*(gradvel[7]-gradvel[5])- ang_vel[0]));
141
142 torq[1] = (16*M_PI*dynvisc*util::pow(rad,3)*beta)/
143 (3*(abg0[0]+util::pow(beta,2)*abg0[2]))*
144 ((util::pow(beta,2)-1)*(0.5*(gradvel[2]+gradvel[6]))+ (1+ util::pow(beta,2))*
145 (0.5*(gradvel[2]-gradvel[6])-ang_vel[1]));
146
147 torq[2] = (32*M_PI*dynvisc*util::pow(rad,3)*beta)/
148 (3*(abg0[0]+abg0[1]))*
149 (0.5*(gradvel[3]-gradvel[1])-ang_vel[2]);
150
151 particle.template setField<FORCING,TORQUE> ( particle.template getField<FORCING,TORQUE>()+torq);
152 particle.template setField<FORCING,FORCE> ( particle.template getField<FORCING,FORCE>()+force);
153
154
155
156 }
157}
#define M_PI
Cuboid< T, D > & getCuboid()
constexpr bool providesParallelization()
Provides group PARALLELIZATION.
Expr pow(Expr base, Expr exp)
Definition expr.cpp:235
std::conditional_t< DESCRIPTOR::d==2, BlockLatticeInterpPhysVelocity2D< T, DESCRIPTOR >, BlockLatticeInterpPhysVelocity3D< T, DESCRIPTOR > > BlockLatticeInterpPhysVelocity
Definition aliases.h:349
Vector(T &&t, Ts &&... ts) -> Vector< std::remove_cvref_t< T >, 1+sizeof...(Ts)>

References olb::Vector< T, Size >::data(), M_PI, olb::util::pow(), olb::particles::access::providesParallelization(), and olb::Vector().

+ Here is the call graph for this function:

◆ operator()()

template<typename T , typename DESCRIPTOR , typename PARTICLETYPE >
bool olb::BlockLatticeStokesSpheroidDragForce< T, DESCRIPTOR, PARTICLETYPE >::operator() ( T output[],
const int input[] )
override

Definition at line 162 of file latticeStokesSpheroidDragForce.hh.

163{
164 using namespace descriptors;
165 using namespace particles;
166 // iterate over all particles in _indicator //TODO: add periodic treatment analogous to momentum exchange
167 forParticlesInParticleSystem<T,PARTICLETYPE,conditions::valid_particles>( _particleSystem,
168 [&](Particle<T,PARTICLETYPE>& particle){
169
170 evaluate(output, particle, particle.getId());
171
172
173 });
174 // forParticlesInSuperParticleSystem(
175
176 return true;
177}
void evaluate(T output[], particles::Particle< T, PARTICLETYPE > &particle, int iP)

Member Data Documentation

◆ serializeForce

template<typename T , typename DESCRIPTOR , typename PARTICLETYPE >
bool olb::BlockLatticeStokesSpheroidDragForce< T, DESCRIPTOR, PARTICLETYPE >::serializeForce = false
staticconstexpr

Definition at line 76 of file latticeStokesSpheroidDragForce.h.


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