OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | List of all members
olb::BlockLatticeStokesDragForce< T, DESCRIPTOR, PARTICLETYPE, serialize > Class Template Referencefinal

#include <latticeStokesDragForce.h>

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

Public Member Functions

 BlockLatticeStokesDragForce (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, const std::unordered_set< int > &ignoredMaterials=std::unordered_set< int >{}, const F f=[](auto &, const auto &, const auto &, const auto &){})
 
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 = serialize
 

Detailed Description

template<typename T, typename DESCRIPTOR, typename PARTICLETYPE, bool serialize = true>
class olb::BlockLatticeStokesDragForce< T, DESCRIPTOR, PARTICLETYPE, serialize >

Definition at line 39 of file latticeStokesDragForce.h.

Constructor & Destructor Documentation

◆ BlockLatticeStokesDragForce()

template<typename T , typename DESCRIPTOR , typename PARTICLETYPE , bool serialize>
olb::BlockLatticeStokesDragForce< T, DESCRIPTOR, PARTICLETYPE, serialize >::BlockLatticeStokesDragForce ( 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,
const std::unordered_set< int > & ignoredMaterials = std::unordered_set<int>{},
const F f = [](auto&, const auto&, const auto&, const auto&){} )

Definition at line 33 of file latticeStokesDragForce.hh.

43 : BlockLatticePhysF<T,DESCRIPTOR>(blockLattice, converter,
44 (DESCRIPTOR::d)*(particleSystem.size()-iP0)),
45 _blockGeometry(blockGeometry), _blockLattice(blockLattice),
46 _particleSystem(particleSystem),
47 _cellMin(cellMin), _cellMax(cellMax), _periodic(periodic),
48 _iP0(iP0), _ignoredMaterials(ignoredMaterials), _f(f)
49{
50 this->getName() = "physStokesDragForce";
51 //Calculate precalculated constants
52 _delTinv = 1./this->_converter.getPhysDeltaT();
53 _C1 = 6. * M_PI
54 * converter.getPhysViscosity()
55 * converter.getPhysDensity()
56 * converter.getConversionFactorTime();
57}
#define M_PI

References olb::UnitConverter< T, DESCRIPTOR >::getConversionFactorTime(), olb::UnitConverter< T, DESCRIPTOR >::getPhysDensity(), olb::UnitConverter< T, DESCRIPTOR >::getPhysViscosity(), and M_PI.

+ Here is the call graph for this function:

Member Function Documentation

◆ evaluate()

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

Definition at line 60 of file latticeStokesDragForce.hh.

62{
63 constexpr unsigned D = DESCRIPTOR::d;
64 const int serialSize = D;
65
66 using namespace descriptors;
67
68 //Retrieve particle quantities
69 Vector<T,D> position = particle.template getField<GENERAL,POSITION>();
70 Vector<T,D> velocity = particle.template getField<MOBILITY,VELOCITY>();
71 T radius = particle.template getField<PHYSPROPERTIES,RADIUS>();
72 T mass = particle.template getField<PHYSPROPERTIES,MASS>();
73 T* positionArray = position.data();
74
75 //TODO: check, whether creation can be avoided by using a second _blockF list
76 const auto& cuboid = _blockGeometry.getCuboid();
77 BlockLatticeInterpPhysVelocity<T,DESCRIPTOR> blockInterpPhysVelF(
78 _blockLattice, this->_converter, cuboid);
79
80 //Calculate particle coefficiants
81 T c = _C1 * radius * 1./mass;
82 T C2 = 1. / (1. + c);
83
84 T fluidVelArray[D] = {0.};
85
86 //Check whether inside cuboid (when not parallelized)
87 bool inside = true;
88 if constexpr ( !particles::access::providesParallelization<PARTICLETYPE>() ){
89 inside = cuboid.checkPoint(position);
90 }
91 if (inside){
92
93 //Retrieve interpolated velocity at position
94 blockInterpPhysVelF(fluidVelArray, positionArray);
95
96 //Record interpolated fluid field, if MOBILITY,FLUIDVEL provided
97 if constexpr( PARTICLETYPE::template providesNested<MOBILITY,FLUIDVEL>() ){
98 particle.template setField<MOBILITY, FLUIDVEL>(fluidVelArray);
99 }
100
101 //Calculate stokes force
102 Vector<T,D> tmpForce(0.);
103 for (int iDim = 0; iDim < PARTICLETYPE::d; ++iDim) {
104 tmpForce[iDim] = mass * _delTinv
105 * ((c * fluidVelArray[iDim] + velocity[iDim]) * C2 - velocity[iDim]);
106 }
107
108 _f(particle, position, tmpForce, Vector<T,utilities::dimensions::convert<D>::rotation>(T{0}));
109
110 //Add force and torque to output or apply directly
111 //INFO: serialization only possible to provide analogy to momentumExchange!
112 if constexpr (serialize){
113 std::size_t iPeval = iP-_iP0; //Shifted output index, if iP!=0
114 for (unsigned iDim=0; iDim<D; iDim++) {
115 output[iDim+iPeval*serialSize] += tmpForce[iDim];
116 }
117 } else {
118 //Apply tmpForce as absolute force (no increment, as no empty output[] available)
119 particle.template setField<FORCING,FORCE>( tmpForce );
120 }
121 }
122}
Cuboid< T, D > & getCuboid()
platform_constant int c[Q][D]

References olb::Vector< T, D >::data().

+ Here is the call graph for this function:

◆ operator()()

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

Definition at line 127 of file latticeStokesDragForce.hh.

128{
129 using namespace descriptors;
130 // iterate over all particles in _indicator //TODO: add periodic treatment analogous to momentum exchange
131 for (std::size_t iP=_iP0; iP!=_particleSystem.size(); iP++) {
132 auto particle = _particleSystem.get(iP);
133 if (particles::access::isValid(particle)){
134 evaluate(output, particle, iP);
135 }
136 }
137 return true;
138}
void evaluate(T output[], particles::Particle< T, PARTICLETYPE > &particle, int iP)
bool isValid(Particle< T, PARTICLETYPE > particle)

References olb::particles::access::isValid().

+ Here is the call graph for this function:

Member Data Documentation

◆ serializeForce

template<typename T , typename DESCRIPTOR , typename PARTICLETYPE , bool serialize = true>
constexpr bool olb::BlockLatticeStokesDragForce< T, DESCRIPTOR, PARTICLETYPE, serialize >::serializeForce = serialize
staticconstexpr

Definition at line 69 of file latticeStokesDragForce.h.


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