24#ifndef LATTICE_PHYS_WALL_SHEAR_STRESS_2D_HH
25#define LATTICE_PHYS_WALL_SHEAR_STRESS_2D_HH
43template<
typename T,
typename DESCRIPTOR>
49 _superGeometry(superGeometry), _material(material)
51 this->
getName() =
"physWallShearStress";
52 const int maxC = this->
_sLattice.getLoadBalancer().size();
54 for (
int iC = 0; iC < maxC; iC++) {
66template <
typename T,
typename DESCRIPTOR>
74 _blockGeometry(blockGeometry), _material(material)
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);
83 for (
int iX = 1; iX < _blockGeometry.
getNx() - 1; iX++) {
84 _discreteNormal.resize(_blockGeometry.
getNx() - 2);
85 _normal.resize(_blockGeometry.
getNx() - 2);
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);
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);
96 _discreteNormal[iX-1][iY-1][0] = -discreteNormalOutwards[1];
97 _discreteNormal[iX-1][iY-1][1] = -discreteNormalOutwards[2];
100 _blockGeometry.
getPhysR(physR, {iX, iY});
102 Vector<T,2> direction(-_discreteNormal[iX-1][iY-1][0] * scaling,
103 -_discreteNormal[iX-1][iY-1][1] * scaling);
105 origin[0] = physR[0];
106 origin[1] = physR[1];
108 indicator.
normal(normal, origin, direction);
111 _normal[iX-1][iY-1][0] = normal[0];
112 _normal[iX-1][iY-1][1] = normal[0];
118template <
typename T,
typename DESCRIPTOR>
123 if (_blockGeometry.getNeighborhoodRadius(input) < 1) {
125 std::cout <<
"Input address not mapped by _discreteNormal, overlap too small" << std::endl;
130 if (this->_blockGeometry.get(input)==_material) {
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();
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);
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];
145 T traction_normal_SP;
146 T tractionNormalComponent[2];
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];
154 WSS[0] = traction[0] - tractionNormalComponent[0];
155 WSS[1] = traction[1] - tractionNormalComponent[1];
157 output[0] =
util::sqrt(WSS[0]*WSS[0] + WSS[1]*WSS[1]);
Representation of a block geometry.
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.
represents all functors that operate on a DESCRIPTOR with output in Phys, e.g. physVelocity(),...
const UnitConverter< T, DESCRIPTOR > & _converter
BlockLatticePhysBoundaryForce2D returns pointwise wall shear stress.
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
Platform-abstracted block lattice for external access and inter-block interaction.
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
IndicatorF2D is an application from .
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
std::vector< std::unique_ptr< BlockF2D< T > > > _blockF
Super functors may consist of several BlockF2D<W> derived functors.
Representation of a statistic for a parallel 2D geometry.
BlockGeometry< T, D > & getBlockGeometry(int locIC)
Read and write access to a single block geometry.
SuperLattice< T, DESCRIPTOR > & _sLattice
represents all functors that operate on a DESCRIPTOR with output in Phys, e.g. physVelocity(),...
SuperLatticePhysWallShearStress2D(SuperLattice< T, DESCRIPTOR > &sLattice, SuperGeometry< T, 2 > &superGeometry, const int material, const UnitConverter< T, DESCRIPTOR > &converter, IndicatorF2D< T > &indicator)
Super class maintaining block lattices for a cuboid decomposition.
Conversion between physical and lattice units, as well as discretization.
The description of a generic interface for all functor classes – header file.
This file contains indicator functions.
Wrapper functions that simplify the use of MPI.
cpu::simd::Pack< T > sqrt(cpu::simd::Pack< T > value)
Top level namespace for all of OpenLB.
constexpr Vector< T, D > normalize(const ScalarVector< T, D, IMPL > &a, T scale=T{1})
Representation of a parallel 2D geometry – header file.