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

#include <latticeSchillerNaumannDragForce.h>

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

Public Member Functions

 BlockLatticeSchillerNaumannDragForce (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::BlockLatticeSchillerNaumannDragForce< T, DESCRIPTOR, PARTICLETYPE >

Definition at line 47 of file latticeSchillerNaumannDragForce.h.

Constructor & Destructor Documentation

◆ BlockLatticeSchillerNaumannDragForce()

template<typename T , typename DESCRIPTOR , typename PARTICLETYPE >
olb::BlockLatticeSchillerNaumannDragForce< T, DESCRIPTOR, PARTICLETYPE >::BlockLatticeSchillerNaumannDragForce ( 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 32 of file latticeSchillerNaumannDragForce.hh.

40 : BlockLatticePhysF<T,DESCRIPTOR>(blockLattice, converter,
41 (DESCRIPTOR::d)*(particleSystem.size()-iP0)),
42 _blockGeometry(blockGeometry), _blockLattice(blockLattice),
43 _particleSystem(particleSystem),
44 _cellMin(cellMin), _cellMax(cellMax), _periodic(periodic), _iP0(iP0)
45{
46 this->getName() = "physSchillerNaumannDragForce";
47}
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::BlockLatticeSchillerNaumannDragForce< T, DESCRIPTOR, PARTICLETYPE >::evaluate ( T output[],
particles::Particle< T, PARTICLETYPE > & particle,
int iP )

Definition at line 50 of file latticeSchillerNaumannDragForce.hh.

51{
52 constexpr unsigned D = DESCRIPTOR::d;
53 const int serialSize = D;
54
55 using namespace descriptors;
56 static_assert(PARTICLETYPE::template providesNested<MOBILITY, FLUIDVEL>(), "Field MOBILITY:FLUIDVEL has to be provided");
57
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 radius = particle.template getField<PHYSPROPERTIES,RADIUS>();
62 T mass = particle.template getField<PHYSPROPERTIES,MASS>();
63 T* positionArray = position.data();
64
65 //TODO: check, whether creation can be avoided by using a second _blockF list
66 const auto& cuboid = _blockGeometry.getCuboid();
68 _blockLattice, this->_converter, cuboid);
69
70 //Calculate general constants
71 T part_density = mass/ (4./3.*M_PI*radius*radius*radius);
72
73 T Coeff = 18* this->_converter.getPhysViscosity()*this->_converter.getPhysDensity()/(part_density*2*radius*2*radius);
74
75 //Calculate particle coefficiants
76
77
78 T fluidVelArray[D] = {0.};
79
80 //Check whether inside cuboid (when not parallelized)
81 bool inside = true;
83 inside = cuboid.isInside(position);
84 }
85 if (inside){
86
87 //Retrieve interpolated velocity at position
88 blockInterpPhysVelF(fluidVelArray, positionArray);
89 particle.template setField<MOBILITY, FLUIDVEL>(fluidVelArray);
90 T relVel = std::sqrt((velocity[0]-fluidVelArray[0])*(velocity[0]-fluidVelArray[0])+(velocity[1]-fluidVelArray[1])*(velocity[1]-fluidVelArray[1])+(velocity[2]-fluidVelArray[2])*(velocity[2]-fluidVelArray[2]));
91
92 T Re_p = relVel*2*radius/this->_converter.getPhysViscosity();
93
94 T C_d;
95 if (Re_p < 0.0000000001)
96 C_d=0;
97 else
98 {
99 if (Re_p <1000)
100 C_d = 24./Re_p*(1+0.15*olb::util::pow(Re_p, 0.687));
101 else
102 C_d = 0.44;
103 }
104
105 //Calculate SchillerNaumann force
106 T tmpForce[D] = {0.};
107 for (int iDim = 0; iDim < PARTICLETYPE::d; ++iDim) {
108 tmpForce[iDim] = C_d*Coeff*(fluidVelArray[iDim] - velocity[iDim])*mass/24.*Re_p;
109 }
110
111 particle.template setField<FORCING,FORCE> (tmpForce);
112 }
113}
#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

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

+ Here is the call graph for this function:

◆ operator()()

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

Definition at line 118 of file latticeSchillerNaumannDragForce.hh.

119{
120 using namespace descriptors;
121 // iterate over all particles in _indicator //TODO: add periodic treatment analogous to momentum exchange
122 for (std::size_t iP=_iP0; iP!=_particleSystem.size(); iP++) {
123 auto particle = _particleSystem.get(iP);
124 evaluate(output, particle, iP);
125 }
126 return true;
127}
void evaluate(T output[], particles::Particle< T, PARTICLETYPE > &particle, int iP)

Member Data Documentation

◆ serializeForce

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

Definition at line 67 of file latticeSchillerNaumannDragForce.h.


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