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

functor returns pointwise phys wall shear stress acting on a boundary with a given material on local lattice More...

#include <latticePhysWallShearStress3D.h>

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

Public Member Functions

 BlockLatticePhysWallShearStress3D (BlockLattice< T, DESCRIPTOR > &blockLattice, BlockGeometry< T, 3 > &blockGeometry, int material, const UnitConverter< T, DESCRIPTOR > &converter, IndicatorF3D< T > &indicator)
 
bool operator() (T output[], const int input[]) override
 has to be implemented for 'every' derived class
 
- Public Member Functions inherited from olb::BlockLatticeF3D< T, DESCRIPTOR >
BlockLattice< T, DESCRIPTOR > & getBlock ()
 Copy Constructor.
 
- Public Member Functions inherited from olb::BlockF3D< T >
 ~BlockF3D () override
 virtual destructor for defined behaviour
 
virtual BlockStructureD< 3 > & getBlockStructure () const
 
BlockF3D< T > & operator- (BlockF3D< T > &rhs)
 
BlockF3D< T > & operator+ (BlockF3D< T > &rhs)
 
BlockF3D< T > & operator* (BlockF3D< T > &rhs)
 
BlockF3D< T > & operator/ (BlockF3D< T > &rhs)
 
- Public Member Functions inherited from olb::GenericF< T, int >
virtual ~GenericF ()=default
 
int getSourceDim () const
 read only access to member variable _m
 
int getTargetDim () const
 read only access to member variable _n
 
std::string & getName ()
 read and write access to name
 
std::string const & getName () const
 read only access to name
 
bool operator() (T output[])
 wrapper that call the pure virtual operator() (T output[], const S input[]) from above
 
bool operator() (T output[], int input0)
 
bool operator() (T output[], int input0, int input1)
 
bool operator() (T output[], int input0, int input1, int input2)
 
bool operator() (T output[], int input0, int input1, int input2, int input3)
 

Additional Inherited Members

- Public Types inherited from olb::GenericF< T, int >
using targetType
 
using sourceType
 
- Public Attributes inherited from olb::GenericF< T, int >
std::shared_ptr< GenericF< T, int > > _ptrCalcC
 memory management, frees resouces (calcClass)
 
- Protected Member Functions inherited from olb::BlockLatticePhysF3D< T, DESCRIPTOR >
 BlockLatticePhysF3D (BlockLattice< T, DESCRIPTOR > &blockLattice, const UnitConverter< T, DESCRIPTOR > &converter, int targetDim)
 
- Protected Member Functions inherited from olb::BlockLatticeF3D< T, DESCRIPTOR >
 BlockLatticeF3D (BlockLattice< T, DESCRIPTOR > &blockLattice, int targetDim)
 
- Protected Member Functions inherited from olb::BlockF3D< T >
 BlockF3D (BlockStructureD< 3 > &blockStructure, int targetDim)
 
- Protected Member Functions inherited from olb::GenericF< T, int >
 GenericF (int targetDim, int sourceDim)
 
- Protected Attributes inherited from olb::BlockLatticePhysF3D< T, DESCRIPTOR >
const UnitConverter< T, DESCRIPTOR > & _converter
 
- Protected Attributes inherited from olb::BlockLatticeF3D< T, DESCRIPTOR >
BlockLattice< T, DESCRIPTOR > & _blockLattice
 
- Protected Attributes inherited from olb::BlockF3D< T >
BlockStructureD< 3 > & _blockStructure
 

Detailed Description

template<typename T, typename DESCRIPTOR>
class olb::BlockLatticePhysWallShearStress3D< T, DESCRIPTOR >

functor returns pointwise phys wall shear stress acting on a boundary with a given material on local lattice

Definition at line 65 of file latticePhysWallShearStress3D.h.

Constructor & Destructor Documentation

◆ BlockLatticePhysWallShearStress3D()

template<typename T , typename DESCRIPTOR >
olb::BlockLatticePhysWallShearStress3D< T, DESCRIPTOR >::BlockLatticePhysWallShearStress3D ( BlockLattice< T, DESCRIPTOR > & blockLattice,
BlockGeometry< T, 3 > & blockGeometry,
int material,
const UnitConverter< T, DESCRIPTOR > & converter,
IndicatorF3D< T > & indicator )

Definition at line 68 of file latticePhysWallShearStress3D.hh.

74 : BlockLatticePhysF3D<T,DESCRIPTOR>(blockLattice,converter,1),
75 _blockGeometry(blockGeometry),
76 _material(material),
77 _discreteNormal(blockGeometry.getNcells()),
78 _normal(blockGeometry.getNcells())
79{
80 this->getName() = "physWallShearStress";
81 const T scaling = this->_converter.getConversionFactorLength() * 0.1;
82 const T omega = 1. / this->_converter.getLatticeRelaxationTime();
83 const T dt = this->_converter.getConversionFactorTime();
84 const auto& blockGeometryStructure = const_cast<BlockGeometry<T,3>&>(_blockGeometry);
85 _physFactor = -omega * descriptors::invCs2<T,DESCRIPTOR>() / dt * this->_converter.getPhysDensity() * this->_converter.getPhysViscosity();
86 std::vector<int> discreteNormalOutwards(4, 0);
87
88 blockGeometryStructure.forSpatialLocations([&](auto iX, auto iY, auto iZ) {
89 if (blockGeometryStructure.getNeighborhoodRadius({iX,iY,iZ}) >= 1) {
90 if (_blockGeometry.get({iX, iY, iZ}) == _material) {
91 discreteNormalOutwards = blockGeometryStructure.getStatistics().getType(iX, iY, iZ);
92 if (!( discreteNormalOutwards[0] == 0
93 && discreteNormalOutwards[1] == 0
94 && discreteNormalOutwards[2] == 0)) {
95 auto discreteNormal = -1 * Vector<int,3>(discreteNormalOutwards.data()+1);
96 _discreteNormal.getRowPointer(blockGeometryStructure.getCellId(iX,iY,iZ)) = discreteNormal;
97
98 Vector<T,3> physR;
99 _blockGeometry.getPhysR(physR, {iX, iY, iZ});
100 Vector<T,3> direction = discreteNormal * -scaling;
101 Vector<T,3> normal{};
102
103 if (indicator.normal(normal, physR, direction)) {
104 normal = normalize(normal);
105 _normal.getRowPointer(blockGeometryStructure.getCellId(iX,iY,iZ)) = Vector<T,3>(normal);
106 }
107 }
108 }
109 }
110 });
111}
Vector< T, D > getPhysR(LatticeR< D > latticeR) const
std::enable_if_t< sizeof...(L)==D, int > get(L... latticeR) const
Read-only access to a material number.
const UnitConverter< T, DESCRIPTOR > & _converter
BlockLatticePhysF3D(BlockLattice< T, DESCRIPTOR > &blockLattice, const UnitConverter< T, DESCRIPTOR > &converter, int targetDim)
ptr getRowPointer(std::size_t i)
std::string & getName()
Definition genericF.hh:51
constexpr T invCs2() any_platform
Definition functions.h:107
Distribution< T > normal(T mean, T stddev)
constexpr Vector< T, D > normalize(const ScalarVector< T, D, IMPL > &a, T scale=T{1})
Definition vector.h:284

References olb::BlockLatticePhysF3D< T, DESCRIPTOR >::_converter, olb::BlockGeometry< T, D >::get(), olb::GenericF< T, int >::getName(), olb::BlockGeometry< T, D >::getPhysR(), olb::ColumnVector< COLUMN, D >::getRowPointer(), olb::descriptors::invCs2(), olb::IndicatorF3D< T >::normal(), and olb::normalize().

+ Here is the call graph for this function:

Member Function Documentation

◆ operator()()

template<typename T , typename DESCRIPTOR >
bool olb::BlockLatticePhysWallShearStress3D< T, DESCRIPTOR >::operator() ( T output[],
const int input[] )
overridevirtual

has to be implemented for 'every' derived class

Implements olb::GenericF< T, int >.

Definition at line 114 of file latticePhysWallShearStress3D.hh.

115{
116 output[0] = T();
117 if (_blockGeometry.get({input[0],input[1],input[2]}) == _material) {
118 auto discreteNormal = _discreteNormal.getRowPointer(_blockGeometry.getCellId(LatticeR<3>(input)));
119 auto normal = _normal.getRowPointer(_blockGeometry.getCellId(LatticeR<3>(input)));
120
121 T traction[3];
122 T stress[6];
123 T rho = this->_blockLattice.get(input[0] + discreteNormal[0],
124 input[1] + discreteNormal[1],
125 input[2] + discreteNormal[2]).computeRho();
126 this->_blockLattice.get(input[0] + discreteNormal[0],
127 input[1] + discreteNormal[1],
128 input[2] + discreteNormal[2]).computeStress(stress);
129
130 traction[0] = stress[0]*_physFactor/rho*normal[0] +
131 stress[1]*_physFactor/rho*normal[1] +
132 stress[2]*_physFactor/rho*normal[2];
133 traction[1] = stress[1]*_physFactor/rho*normal[0] +
134 stress[3]*_physFactor/rho*normal[1] +
135 stress[4]*_physFactor/rho*normal[2];
136 traction[2] = stress[2]*_physFactor/rho*normal[0] +
137 stress[4]*_physFactor/rho*normal[1] +
138 stress[5]*_physFactor/rho*normal[2];
139
140 T traction_normal_SP;
141 T tractionNormalComponent[3];
142 // scalar product of traction and normal vector
143 traction_normal_SP = traction[0] * normal[0] +
144 traction[1] * normal[1] +
145 traction[2] * normal[2];
146 tractionNormalComponent[0] = traction_normal_SP * normal[0];
147 tractionNormalComponent[1] = traction_normal_SP * normal[1];
148 tractionNormalComponent[2] = traction_normal_SP * normal[2];
149
150 T WSS[3];
151 WSS[0] = traction[0] - tractionNormalComponent[0];
152 WSS[1] = traction[1] - tractionNormalComponent[1];
153 WSS[2] = traction[2] - tractionNormalComponent[2];
154 // magnitude of the wall shear stress vector
155 output[0] = util::sqrt(WSS[0]*WSS[0] + WSS[1]*WSS[1] + WSS[2]*WSS[2]);
156
157 return true;
158 }
159 else {
160 return true;
161 }
162}
BlockLattice< T, DESCRIPTOR > & _blockLattice
Cell< T, DESCRIPTOR > get(CellID iCell)
Get Cell interface for index iCell.
CellID getCellId(LatticeR< D > latticeR) const
Get 1D cell ID.
T computeRho() const
Compute particle density on the cell.
Definition cell.hh:196
void computeStress(T pi[util::TensorVal< DESCRIPTOR >::n]) const
Compute components of the stress tensor on the cell.
Definition cell.hh:214
Expr sqrt(Expr x)
Definition expr.cpp:225
Vector< std::int32_t, D > LatticeR
Type for spatial block-local lattice coordinates.

References olb::util::sqrt().

+ Here is the call graph for this function:

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