25#ifndef LATTICE_PHYS_HEAT_FLUX_BOUNDARY_3D_HH
26#define LATTICE_PHYS_HEAT_FLUX_BOUNDARY_3D_HH
44template<
typename T,
typename DESCRIPTOR,
typename TDESCRIPTOR>
50 _superGeometry(superGeometry), _material(material)
52 this->
getName() =
"physHeatFluxBoundary";
55 for (
int iC = 0; iC < maxC; iC++) {
68template <
typename T,
typename DESCRIPTOR,
typename TDESCRIPTOR>
76 _blockGeometry(blockGeometry),
79 this->
getName() =
"physHeatFluxBoundary";
81 std::vector<int> discreteNormalOutwards(4, 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 for (
int iZ = 1; iZ < _blockGeometry.
getNz() - 1; iZ++) {
92 _discreteNormal[iX-1][iY-1].resize(_blockGeometry.
getNz() - 2);
93 _normal[iX-1][iY-1].resize(_blockGeometry.
getNz() - 2);
95 if (_blockGeometry.
get({iX, iY, iZ}) == _material) {
96 discreteNormalOutwards = _blockGeometry.
getStatistics().getType(iX, iY, iZ);
97 _discreteNormal[iX - 1][iY - 1][iZ - 1].resize(3);
98 _normal[iX - 1][iY - 1][iZ - 1].resize(3);
100 _discreteNormal[iX - 1][iY- 1][iZ- 1][0] = -discreteNormalOutwards[1];
101 _discreteNormal[iX- 1][iY- 1][iZ- 1][1] = -discreteNormalOutwards[2];
102 _discreteNormal[iX- 1][iY- 1][iZ- 1][2] = -discreteNormalOutwards[3];
105 _blockGeometry.
getPhysR(physR,{iX, iY, iZ});
107 Vector<T,3> direction(-_discreteNormal[iX- 1][iY- 1][iZ- 1][0] * scaling,
108 -_discreteNormal[iX- 1][iY- 1][iZ- 1][1] * scaling,
109 -_discreteNormal[iX- 1][iY- 1][iZ- 1][2] * scaling);
111 origin[0] = physR[0];
112 origin[1] = physR[1];
113 origin[2] = physR[2];
115 indicator.
normal(normal, origin, direction);
118 _normal[iX- 1][iY- 1][iZ- 1][0] = normal[0];
119 _normal[iX- 1][iY- 1][iZ- 1][1] = normal[1];
120 _normal[iX- 1][iY- 1][iZ- 1][2] = normal[2];
128template<
typename T,
typename DESCRIPTOR,
typename TDESCRIPTOR>
133 if (this->_blockLattice.getNeighborhoodRadius(input) < 1) {
135 std::cout <<
"Input address not mapped by _discreteNormal, overlap too small" << std::endl;
140 if (_blockGeometry.get(input) == _material) {
143 T temp1 = this->_blockLattice.get(
144 input[0] + _discreteNormal[input[0]-1][input[1]-1][input[2]-1][0],
145 input[1] + _discreteNormal[input[0]-1][input[1]-1][input[2]-1][1],
146 input[2] + _discreteNormal[input[0]-1][input[1]-1][input[2]-1][2]).computeRho();
149 T temp2 = this->_blockLattice.get(
150 input[0] + 2*_discreteNormal[input[0]-1][input[1]-1][input[2]-1][0],
151 input[1] + 2*_discreteNormal[input[0]-1][input[1]-1][input[2]-1][1],
152 input[2] + 2*_discreteNormal[input[0]-1][input[1]-1][input[2]-1][2]).computeRho();
155 T deltaX =
util::sqrt( _normal[input[0]-1][input[1]-1][input[2]-1][0] *
156 _normal[input[0]-1][input[1]-1][input[2]-1][0] +
157 _normal[input[0]-1][input[1]-1][input[2]-1][1] *
158 _normal[input[0]-1][input[1]-1][input[2]-1][1] +
159 _normal[input[0]-1][input[1]-1][input[2]-1][2] *
160 _normal[input[0]-1][input[1]-1][input[2]-1][2] );
167 output[0] = this->_converter.getThermalConductivity() *
168 this->_converter.getCharPhysTemperatureDifference() *
169 (1.5 * temp0 - 2.0 * temp1 + 0.5 * temp2) /
170 this->_converter.getPhysLength(deltaX);
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.
functor returns pointwise phys heat flux on a boundary with a given material on local lattice
BlockLatticePhysHeatFluxBoundary3D(BlockLattice< T, TDESCRIPTOR > &blockLattice, BlockGeometry< T, 3 > &blockGeometry, int material, const ThermalUnitConverter< T, DESCRIPTOR, TDESCRIPTOR > &converter, IndicatorF3D< T > &indicator)
bool operator()(T output[], const int input[]) override
has to be implemented for 'every' derived class
represents all thermal functors that operate on a DESCRIPTOR with output in Phys, e....
const ThermalUnitConverter< T, DESCRIPTOR, TDESCRIPTOR > & _converter
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.
int getNz() const
Read only access to block height.
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, TDESCRIPTOR > & _sLattice
SuperLatticePhysHeatFluxBoundary3D(SuperLattice< T, TDESCRIPTOR > &sLattice, SuperGeometry< T, 3 > &superGeometry, const int material, const ThermalUnitConverter< T, DESCRIPTOR, TDESCRIPTOR > &converter, IndicatorF3D< T > &indicator)
represents all thermal functors that operate on a DESCRIPTOR with output in Phys, e....
Super class maintaining block lattices for a cuboid decomposition.
BlockLattice< T, DESCRIPTOR > & getBlock(int locC)
Return BlockLattice with local index locC.
LoadBalancer< T > & getLoadBalancer()
Read and write access to the load balancer.
Conversion between physical and lattice units, as well as discretization specialized for thermal appl...
constexpr T getConversionFactorLength() const
access (read-only) to private member variable
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.