OpenLB 1.7
Loading...
Searching...
No Matches
latticeThermalComfort3D.hh
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2012 Lukas Baron, Tim Dornieden, Mathias J. Krause,
4 * Albert Mink
5 * E-mail contact: info@openlb.net
6 * The most recent release of OpenLB can be downloaded at
7 * <http://www.openlb.net/>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public
20 * License along with this program; if not, write to the Free
21 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301, USA.
23*/
24
25#ifndef LATTICE_THERMAL_COMFORT_3D_HH
26#define LATTICE_THERMAL_COMFORT_3D_HH
27
28#include<vector> // for generic i/o
29#include<cmath> // for lpnorm
30#include<math.h>
31
33#include "superBaseF3D.h"
36#include "dynamics/lbm.h" // for computation of lattice rho and velocity
38#include "blockBaseF3D.h"
41
42namespace olb {
43
44template <typename T, typename DESCRIPTOR, typename TDESCRIPTOR>
47 : SuperLatticeThermalPhysF3D<T,DESCRIPTOR,TDESCRIPTOR>(sLattice, converter, 2)
48{
49 this->getName() = "thermalComfort";
50 int maxC = this->_sLattice.getLoadBalancer().size();
51 this->_blockF.reserve(maxC);
52 for (int iC = 0; iC < maxC; iC++) {
53 this->_blockF.emplace_back(new BlockLatticeThermalComfort3D<T,DESCRIPTOR,TDESCRIPTOR>(this->_sLattice.getBlock(iC), this->_converter));
54 }
55}
56
57template <typename T, typename DESCRIPTOR, typename TDESCRIPTOR>
60 : BlockLatticeThermalPhysF3D<T,DESCRIPTOR,TDESCRIPTOR>(blockLattice,converter,2)
61{
62 this->getName() = "thermalComfort";
63}
64
65
66template <typename T, typename DESCRIPTOR, typename TDESCRIPTOR>
68{
69 OstreamManager clout(std::cout,"thermalComfort");
70
71 // importing the local velocity and temperature for one specific lattice
72 T latticeTemp = this->_blockLattice.get( input[0], input[1], input[2]).computeRho();
73 T physTemp = this->_converter.getPhysTemperature(latticeTemp);
74
75 auto latticeVel = this->_blockLattice.get(input[0], input[1], input[2]).template getFieldPointer<descriptors::VELOCITY>();
76 T physVel[3];
77 physVel[0]= this->_converter.getPhysVelocity(latticeVel[0]);
78 physVel[1]= this->_converter.getPhysVelocity(latticeVel[1]);
79 physVel[2]= this->_converter.getPhysVelocity(latticeVel[2]);
80
81 T pmv; // Predicted Mean Vote
82 T ppd; // Predicted Percantage of Dissatisfied
83
84 T temp_Air; // air temperature [°C]
85 T vel_Air; // local relative air velocity [m/s]
86 T press_Vapor; // pressure of water vapour in ambient air [Pa]
87 T h_c; // convective heat transfer coefficient [W/(m² K)]
88 T f_clo; // ratio of surface area clothed/nude [-]
89 T temp_Clo = temp_Bod; // clothing temperature [°C]
90 T temp_Clo_old = temp_Clo;
91
92 // calculation of the air temperature in °C and the magnitude of the velocity
93 temp_Air = physTemp - 273.15;
94 vel_Air = util::sqrt(physVel[0]*physVel[0] + physVel[1]*physVel[1] + physVel[2]*physVel[2]);
95
97 // ratio of surface area clothed/nude [-]
98 // 1.15 = typical business suit
99 if (i_clo <= 0.078) {
100 f_clo = 1.0 + 1.290 * i_clo;
101 }
102 else {
103 f_clo = 1.05 + 0.645 * i_clo;
104 }
105
107 // however, there is no significant difference between these equations
108 // calculation with simplified equation from a comparable algorithm
109 T ppk = 673.4 - 1.8 * temp_Air;
110 T ppa = (3.2437814 + 0.00326014*ppk) + (2.00658 * 0.000000001 * ppk * ppk * ppk);
111 T ppb = (1165.09 - ppk) * (1.0 + 0.00121547 * ppk);
112 press_Vapor = rel_Hum/100.0 * 22105.8416/util::exp(2.302585 * ppk * ppa / ppb) * 1000.0;
113
114 // calculation like EN ISO 7730
115 //press_Vapor = rel_Hum * 10 * util::exp(16.6536 - 4030.183/(temp_Air+235.0));
116 // calculation with Magnus Equation
117 //press_Vapor = rel_Hum/100.0 * 6.112 * 100 * util::exp((17.62*temp_Air)/(243.12+temp_Air));
118
120 for (int iter = 0; iter < iterMax; iter++) {
121 temp_Clo = 0.8 * temp_Clo_old + 0.2 * temp_Clo;
122
123 h_c = 12.1 * util::sqrt(vel_Air); // pure forced convection
124
125 if (2.38 * util::pow(util::fabs(temp_Clo - temp_Air), 0.25) > h_c) {
126 h_c = 2.38 * util::pow(util::fabs(temp_Clo - temp_Air), 0.25); // pure free convection
127 }
128
129 temp_Clo_old = temp_Clo;
130 temp_Clo = 35.7 - 0.028 * mw -
131 i_clo * (3.96e-8 * f_clo * (util::pow(temp_Clo + 273.0, 4) - util::pow(temp_Mrt + 273.0, 4)) +
132 f_clo * h_c * (temp_Clo - temp_Air));
133
134 if ((util::fabs((temp_Clo_old - temp_Clo) / temp_Clo)) < eps) {
135 break;
136 }
137 if (iter == (iterMax-1)) {
138 clout << "WARNING: Maximal iteration step limit: PMV calculation not possible!" << std::endl;
139 }
140 }
141
142 // calculation of PMV
143 pmv = (0.303 * util::exp(-0.036 * mw) + 0.028) * (mw // heat gain by internal metabolic process
144 -3.05e-3*(5733.0 - 6.99*mw - press_Vapor) // heat loss by skin diffusion
145 -0.42*(mw - 58.15) // heat loss by evaporation of sweat secretion
146 -1.7e-5 * mw * (5867.0 - press_Vapor) - 0.0014 * mw * (34.0 - temp_Air) // heat loss by latent respiration and dry respiration
147 -3.96e-8 * f_clo *(util::pow(temp_Clo + 273.0, 4) - util::pow(temp_Mrt + 273.0, 4)) // heat loss by radiation
148 -f_clo * h_c * (temp_Clo - temp_Air)); // heat loss by convection
149
150 // calculation of PPD
151 ppd = 100.0 - 95.0*util::exp(-0.03353* util::pow(pmv,4.0) - 0.2179*util::pow(pmv,2.0));
152
153 // return of PMV and PPD
154 output[0] = pmv;
155 output[1] = ppd;
156
157 return true;
158}
159
160}
161#endif
BlockLatticeThermalComfort3D returns pointwise PMV and PPD on local lattice.
bool operator()(T output[], const int input[])
has to be implemented for 'every' derived class
BlockLatticeThermalComfort3D(BlockLattice< T, TDESCRIPTOR > &blockLattice, ThermalUnitConverter< T, DESCRIPTOR, TDESCRIPTOR > const &converter)
represents all thermal functors that operate on a DESCRIPTOR with output in Phys, e....
Platform-abstracted block lattice for external access and inter-block interaction.
std::string & getName()
read and write access to name
Definition genericF.hh:51
class for marking output with some text
std::vector< std::unique_ptr< BlockF3D< T > > > _blockF
Super functors may consist of several BlockF3D<W> derived functors.
SuperLattice< T, TDESCRIPTOR > & _sLattice
SuperLatticeThermalComfort3D(SuperLattice< T, TDESCRIPTOR > &sLattice, ThermalUnitConverter< T, DESCRIPTOR, TDESCRIPTOR > const &converter)
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...
Wrapper functions that simplify the use of MPI.
cpu::simd::Pack< T > sqrt(cpu::simd::Pack< T > value)
Definition pack.h:100
cpu::simd::Pack< T > pow(cpu::simd::Pack< T > base, cpu::simd::Pack< T > exp)
Definition pack.h:112
cpu::simd::Pack< T > fabs(cpu::simd::Pack< T > value)
Definition pack.h:106
ADf< T, DIM > exp(const ADf< T, DIM > &a)
Definition aDiff.h:455
Top level namespace for all of OpenLB.
Representation of a parallel 2D geometry – header file.