25#ifndef LATTICE_PHYS_WALL_SHEAR_STRESS_3D_HH
26#define LATTICE_PHYS_WALL_SHEAR_STRESS_3D_HH
44template<
typename T,
typename DESCRIPTOR>
50 _superGeometry(superGeometry), _material(material)
52 this->
getName() =
"physWallShearStress";
53 const int maxC = this->
_sLattice.getLoadBalancer().size();
55 for (
int iC = 0; iC < maxC; iC++) {
67template <
typename T,
typename DESCRIPTOR>
75 _blockGeometry(blockGeometry),
77 _discreteNormal(blockGeometry.getNcells()),
78 _normal(blockGeometry.getNcells())
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();
85 _physFactor = -omega * descriptors::invCs2<T,DESCRIPTOR>() / dt * this->
_converter.getPhysDensity() * this->
_converter.getPhysViscosity();
86 std::vector<int> discreteNormalOutwards(4, 0);
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 auto discreteNormal = -1 *
Vector<int,3>(&discreteNormalOutwards[1]);
93 _discreteNormal.
getRowPointer(blockGeometryStructure.getCellId(iX,iY,iZ)) = discreteNormal;
96 _blockGeometry.
getPhysR(physR,{iX, iY, iZ});
99 -discreteNormal[1] * scaling,
100 -discreteNormal[2] * scaling);
102 origin[0] = physR[0];
103 origin[1] = physR[1];
104 origin[2] = physR[2];
106 indicator.
normal(normal, origin, direction);
115template<
typename T,
typename DESCRIPTOR>
119 if (_blockGeometry.get({input[0],input[1],input[2]}) == _material) {
120 auto discreteNormal = _discreteNormal.getRowPointer(_blockGeometry.getCellId(
LatticeR<3>(input)));
121 auto normal = _normal.getRowPointer(_blockGeometry.getCellId(
LatticeR<3>(input)));
125 T rho = this->_blockLattice.get(input[0] + discreteNormal[0],
126 input[1] + discreteNormal[1],
127 input[2] + discreteNormal[2]).computeRho();
128 this->_blockLattice.get(input[0] + discreteNormal[0],
129 input[1] + discreteNormal[1],
130 input[2] + discreteNormal[2]).computeStress(stress);
132 traction[0] = stress[0]*_physFactor/rho*normal[0] +
133 stress[1]*_physFactor/rho*normal[1] +
134 stress[2]*_physFactor/rho*normal[2];
135 traction[1] = stress[1]*_physFactor/rho*normal[0] +
136 stress[3]*_physFactor/rho*normal[1] +
137 stress[4]*_physFactor/rho*normal[2];
138 traction[2] = stress[2]*_physFactor/rho*normal[0] +
139 stress[4]*_physFactor/rho*normal[1] +
140 stress[5]*_physFactor/rho*normal[2];
142 T traction_normal_SP;
143 T tractionNormalComponent[3];
145 traction_normal_SP = traction[0] * normal[0] +
146 traction[1] * normal[1] +
147 traction[2] * normal[2];
148 tractionNormalComponent[0] = traction_normal_SP * normal[0];
149 tractionNormalComponent[1] = traction_normal_SP * normal[1];
150 tractionNormalComponent[2] = traction_normal_SP * normal[2];
153 WSS[0] = traction[0] - tractionNormalComponent[0];
154 WSS[1] = traction[1] - tractionNormalComponent[1];
155 WSS[2] = traction[2] - tractionNormalComponent[2];
157 output[0] = util::sqrt(WSS[0]*WSS[0] + WSS[1]*WSS[1] + WSS[2]*WSS[2]);
Representation of a block geometry.
Vector< T, D > getPhysR(LatticeR< D > latticeR)
represents all functors that operate on a DESCRIPTOR with output in Phys, e.g. physVelocity(),...
const UnitConverter< T, DESCRIPTOR > & _converter
functor returns pointwise phys wall shear stress acting on a boundary with a given material on local ...
BlockLatticePhysWallShearStress3D(BlockLattice< T, DESCRIPTOR > &blockLattice, BlockGeometry< T, 3 > &blockGeometry, int material, const UnitConverter< T, DESCRIPTOR > &converter, IndicatorF3D< T > &indicator)
Platform-abstracted block lattice for external access and inter-block interaction.
ptr getRowPointer(std::size_t i)
std::string & getName()
read and write access to name
IndicatorF3D is an application from .
virtual bool normal(Vector< S, 3 > &normal, const Vector< S, 3 > &origin, const Vector< S, 3 > &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< BlockF3D< T > > > _blockF
Super functors may consist of several BlockF3D<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(),...
SuperLatticePhysWallShearStress3D(SuperLattice< T, DESCRIPTOR > &sLattice, SuperGeometry< T, 3 > &superGeometry, const int material, const UnitConverter< T, DESCRIPTOR > &converter, IndicatorF3D< T > &indicator)
Super class maintaining block lattices for a cuboid decomposition.
Conversion between physical and lattice units, as well as discretization.
Wrapper functions that simplify the use of MPI.
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.