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

BlockLatticePhysBoundaryForce2D returns pointwise wall shear stress. More...

#include <latticePhysWallShearStress2D.h>

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

Public Member Functions

 BlockLatticePhysWallShearStress2D (BlockLattice< T, DESCRIPTOR > &blockLattice, BlockGeometry< T, 2 > &blockGeometry, int material, const UnitConverter< T, DESCRIPTOR > &converter, IndicatorF2D< T > &indicator)
 
bool operator() (T output[], const int input[]) override
 has to be implemented for 'every' derived class
 
- Public Member Functions inherited from olb::BlockLatticeF2D< T, DESCRIPTOR >
BlockLattice< T, DESCRIPTOR > & getBlock ()
 Copy Constructor.
 
- Public Member Functions inherited from olb::BlockF2D< T >
virtual BlockStructureD< 2 > & getBlockStructure ()
 virtual destructor for defined behaviour
 
void setBlockStructure (BlockStructureD< 2 > *blockStructure)
 
BlockF2D< T > & operator- (BlockF2D< T > &rhs)
 
BlockF2D< T > & operator+ (BlockF2D< T > &rhs)
 
BlockF2D< T > & operator* (BlockF2D< T > &rhs)
 
BlockF2D< T > & operator/ (BlockF2D< 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::BlockLatticePhysF2D< T, DESCRIPTOR >
 BlockLatticePhysF2D (BlockLattice< T, DESCRIPTOR > &blockLattice, const UnitConverter< T, DESCRIPTOR > &converter, int targetDim)
 
- Protected Member Functions inherited from olb::BlockLatticeF2D< T, DESCRIPTOR >
 BlockLatticeF2D (BlockLattice< T, DESCRIPTOR > &blockLattice, int targetDim)
 
- Protected Member Functions inherited from olb::BlockF2D< T >
 BlockF2D (BlockStructureD< 2 > &blockStructure, int targetDim)
 
 BlockF2D (int targetDim)
 
- Protected Member Functions inherited from olb::GenericF< T, int >
 GenericF (int targetDim, int sourceDim)
 
- Protected Attributes inherited from olb::BlockLatticePhysF2D< T, DESCRIPTOR >
const UnitConverter< T, DESCRIPTOR > & _converter
 
- Protected Attributes inherited from olb::BlockLatticeF2D< T, DESCRIPTOR >
BlockLattice< T, DESCRIPTOR > & _blockLattice
 
- Protected Attributes inherited from olb::BlockF2D< T >
BlockStructureD< 2 > * _blockStructure
 

Detailed Description

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

BlockLatticePhysBoundaryForce2D returns pointwise wall shear stress.

Definition at line 57 of file latticePhysWallShearStress2D.h.

Constructor & Destructor Documentation

◆ BlockLatticePhysWallShearStress2D()

template<typename T , typename DESCRIPTOR >
olb::BlockLatticePhysWallShearStress2D< T, DESCRIPTOR >::BlockLatticePhysWallShearStress2D ( BlockLattice< T, DESCRIPTOR > & blockLattice,
BlockGeometry< T, 2 > & blockGeometry,
int material,
const UnitConverter< T, DESCRIPTOR > & converter,
IndicatorF2D< T > & indicator )

Definition at line 67 of file latticePhysWallShearStress2D.hh.

73 : BlockLatticePhysF2D<T,DESCRIPTOR>(blockLattice,converter,1),
74 _blockGeometry(blockGeometry), _material(material)
75{
76 this->getName() = "physWallShearStress";
77 const T scaling = this->_converter.getConversionFactorLength() * 0.1;
78 const T omega = 1. / this->_converter.getLatticeRelaxationTime();
79 const T dt = this->_converter.getConversionFactorTime();
80 _physFactor = -omega * descriptors::invCs2<T,DESCRIPTOR>() / dt * this->_converter.getPhysDensity() * this->_converter.getPhysViscosity();
81 std::vector<int> discreteNormalOutwards(3, 0);
82
83 for (int iX = 1; iX < _blockGeometry.getNx() - 1; iX++) {
84 _discreteNormal.resize(_blockGeometry.getNx() - 2);
85 _normal.resize(_blockGeometry.getNx() - 2);
86
87 for (int iY = 1; iY < _blockGeometry.getNy() - 1; iY++) {
88 _discreteNormal[iX-1].resize(_blockGeometry.getNy() - 2);
89 _normal[iX-1].resize(_blockGeometry.getNy() - 2);
90
91 if (_blockGeometry.get({iX, iY}) == _material) {
92 discreteNormalOutwards = _blockGeometry.getStatistics().getType(iX, iY);
93 _discreteNormal[iX-1][iY-1].resize(2);
94 _normal[iX-1][iY-1].resize(2);
95
96 _discreteNormal[iX-1][iY-1][0] = -discreteNormalOutwards[1];
97 _discreteNormal[iX-1][iY-1][1] = -discreteNormalOutwards[2];
98
99 T physR[2];
100 _blockGeometry.getPhysR(physR, {iX, iY});
101 Vector<T,2> origin(physR[0],physR[1]);
102 Vector<T,2> direction(-_discreteNormal[iX-1][iY-1][0] * scaling,
103 -_discreteNormal[iX-1][iY-1][1] * scaling);
104 Vector<T,2> normal(0.,0.);
105 origin[0] = physR[0];
106 origin[1] = physR[1];
107
108 indicator.normal(normal, origin, direction);
109 normal = normalize(normal);
110
111 _normal[iX-1][iY-1][0] = normal[0];
112 _normal[iX-1][iY-1][1] = normal[0];
113 }
114 }
115 }
116}
const BlockGeometryStatistics< T, D > & getStatistics() const
Read only access to the associated block statistic.
Vector< T, D > getPhysR(LatticeR< D > latticeR)
std::enable_if_t< sizeof...(L)==D, int > get(L... latticeR) const
Read-only access to a material number.
const UnitConverter< T, DESCRIPTOR > & _converter
int getNy() const
Read only access to block height.
int getNx() const
Read only access to block width.
std::string & getName()
read and write access to name
Definition genericF.hh:51
virtual bool normal(Vector< S, 2 > &normal, const Vector< S, 2 > &origin, const Vector< S, 2 > &direction, int iC=-1)
returns true and the normal if there was one found for an given origin and direction
constexpr Vector< T, D > normalize(const ScalarVector< T, D, IMPL > &a, T scale=T{1})
Definition vector.h:245

References olb::BlockLatticePhysF2D< T, DESCRIPTOR >::_converter, olb::BlockGeometry< T, D >::get(), olb::GenericF< T, int >::getName(), olb::BlockStructureD< D >::getNx(), olb::BlockStructureD< D >::getNy(), olb::BlockGeometry< T, D >::getPhysR(), olb::BlockGeometry< T, D >::getStatistics(), olb::IndicatorF2D< S >::normal(), and olb::normalize().

+ Here is the call graph for this function:

Member Function Documentation

◆ operator()()

template<typename T , typename DESCRIPTOR >
bool olb::BlockLatticePhysWallShearStress2D< 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 119 of file latticePhysWallShearStress2D.hh.

120{
121 output[0] = T();
122
123 if (_blockGeometry.getNeighborhoodRadius(input) < 1) {
124#ifdef OLB_DEBUG
125 std::cout << "Input address not mapped by _discreteNormal, overlap too small" << std::endl;
126#endif
127 return true;
128 }
129
130 if (this->_blockGeometry.get(input)==_material) {
131
132 T traction[2];
133 T stress[3];
134 T rho = this->_blockLattice.get(input[0] + _discreteNormal[input[0]-1][input[1]-1][0],
135 input[1] + _discreteNormal[input[0]-1][input[1]-1][1]).computeRho();
136
137 this->_blockLattice.get(input[0] + _discreteNormal[input[0]-1][input[1]-1][0],
138 input[1] + _discreteNormal[input[0]-1][input[1]-1][1]).computeStress(stress);
139
140 traction[0] = stress[0]*_physFactor/rho*_normal[input[0]-1][input[1]-1][0] +
141 stress[1]*_physFactor/rho*_normal[input[0]-1][input[1]-1][1];
142 traction[1] = stress[1]*_physFactor/rho*_normal[input[0]-1][input[1]-1][0] +
143 stress[2]*_physFactor/rho*_normal[input[0]-1][input[1]-1][1];
144
145 T traction_normal_SP;
146 T tractionNormalComponent[2];
147 // scalar product of traction and normal vector
148 traction_normal_SP = traction[0] * _normal[input[0]-1][input[1]-1][0] +
149 traction[1] * _normal[input[0]-1][input[1]-1][1];
150 tractionNormalComponent[0] = traction_normal_SP * _normal[input[0]-1][input[1]-1][0];
151 tractionNormalComponent[1] = traction_normal_SP * _normal[input[0]-1][input[1]-1][1];
152
153 T WSS[2];
154 WSS[0] = traction[0] - tractionNormalComponent[0];
155 WSS[1] = traction[1] - tractionNormalComponent[1];
156 // magnitude of the wall shear stress vector
157 output[0] = util::sqrt(WSS[0]*WSS[0] + WSS[1]*WSS[1]);
158 return true;
159 }
160 else {
161 return true;
162 }
163}
BlockLattice< T, DESCRIPTOR > & _blockLattice
CellDistance getNeighborhoodRadius(LatticeR< D > latticeR) const
Return maximum valid neighborhood sphere radius w.r.t. latticeR.
cpu::simd::Pack< T > sqrt(cpu::simd::Pack< T > value)
Definition pack.h:100

References olb::util::sqrt().

+ Here is the call graph for this function:

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