OpenLB 1.7
Loading...
Searching...
No Matches
thermalUnitConverter.h
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2017 Max Gaedtke, Albert Mink
4 * E-mail contact: info@openlb.net
5 * The most recent release of OpenLB can be downloaded at
6 * <http://www.openlb.net/>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public
19 * License along with this program; if not, write to the Free
20 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22*/
23
28#ifndef THERMALUNITCONVERTER_H
29#define THERMALUNITCONVERTER_H
30
31
32#include <math.h>
33#include "io/ostreamManager.h"
34#include "core/util.h"
35#include "io/xmlReader.h"
36#include "core/unitConverter.h"
37
38// All OpenLB code is contained in this namespace.
39namespace olb {
40
41
42
53template <typename T, typename DESCRIPTOR, typename ThermalLattice>
54class ThermalUnitConverter : public UnitConverter<T, DESCRIPTOR> {
55public:
60 T physDeltaX,
61 T physDeltaT,
62 T charPhysLength,
63 T charPhysVelocity,
64 T physViscosity,
65 T physDensity,
66 T physThermalConductivity,
67 T physSpecificHeatCapacity,
68 T physThermalExpansionCoefficient,
69 T charPhysLowTemperature,
70 T charPhysHighTemperature,
71 T charPhysPressure = 0 )
72 : UnitConverter<T, DESCRIPTOR>(
73 physDeltaX, physDeltaT, charPhysLength, charPhysVelocity,
74 physViscosity, physDensity, charPhysPressure),
75 _conversionTemperature(charPhysHighTemperature - charPhysLowTemperature),
79 _conversionHeatFlux(this->_conversionMass / util::pow(this->_conversionTime, 3)),
80 _charPhysLowTemperature(charPhysLowTemperature),
81 _charPhysHighTemperature(charPhysHighTemperature),
82 _charPhysTemperatureDifference(charPhysHighTemperature - charPhysLowTemperature),
83 _physThermalExpansionCoefficient(physThermalExpansionCoefficient),
84 _physThermalDiffusivity(physThermalConductivity / (physDensity * physSpecificHeatCapacity)),
85 _physSpecificHeatCapacity(physSpecificHeatCapacity),
86 _physThermalConductivity(physThermalConductivity),
87 _latticeThermalRelaxationTime( (_physThermalDiffusivity / _conversionThermalDiffusivity * descriptors::invCs2<T,ThermalLattice>()) + 0.5 ),
88 clout(std::cout,"ThermalUnitConv")
89 {
90 };
91
94 {
96 };
99 {
101 };
102
104 constexpr T getCharPhysLowTemperature( ) const
105 {
107 };
109 constexpr T getCharPhysHighTemperature( ) const
110 {
112 };
115 {
117 };
120 {
122 };
124 constexpr T getPhysThermalDiffusivity( ) const
125 {
127 };
129 constexpr T getPhysSpecificHeatCapacity( ) const
130 {
132 };
134 constexpr T getThermalConductivity( ) const
135 {
137 };
138
140 constexpr T getPhysTemperature( T latticeTemperature ) const
141 {
142 return _conversionTemperature * (latticeTemperature - 0.5) + _charPhysLowTemperature;
143 };
145 constexpr T getLatticeTemperature( T physTemperature ) const
146 {
147 return (physTemperature - _charPhysLowTemperature) / _conversionTemperature + 0.5;
148 };
151 {
153 };
154
156 constexpr T getPhysThermalDiffusivity( T latticeThermalDiffusivity ) const
157 {
158 return _conversionThermalDiffusivity * latticeThermalDiffusivity;
159 };
161 constexpr T getLatticeThermalDiffusivity( T physThermalDiffusivity ) const
162 {
163 return physThermalDiffusivity / _conversionThermalDiffusivity;
164 };
167 {
169 };
170
171
173 constexpr T getPhysSpecificHeatCapacity( T latticeSpecificHeatCapacity ) const
174 {
175 return _conversionSpecificHeatCapacity * latticeSpecificHeatCapacity;
176 };
178 constexpr T getLatticeSpecificHeatCapacity( T physSpecificHeatCapacity ) const
179 {
180 return physSpecificHeatCapacity / _conversionSpecificHeatCapacity;
181 };
187
189 constexpr T getPhysThermalConductivity( T latticeThermalConductivity ) const
190 {
191 return _conversionThermalConductivity * latticeThermalConductivity;
192 };
194 constexpr T getLatticeThermalConductivity( T physThermalConductivity ) const
195 {
196 return physThermalConductivity / _conversionThermalConductivity;
197 };
200 {
202 };
203
205 constexpr T getPhysHeatFlux( T latticeHeatFlux ) const
206 {
207 return _conversionHeatFlux * latticeHeatFlux;
208 };
210 constexpr T getLatticeHeatFlux( T physHeatFlux ) const
211 {
212 return physHeatFlux / _conversionHeatFlux;
213 };
215 constexpr T getConversionFactorHeatFlux() const
216 {
217 return _conversionHeatFlux;
218 };
219 constexpr T getPrandtlNumber() const
220 {
222 };
228 void print() const override;
229
230
231
232protected:
233 // conversion factors
236 const T _conversionSpecificHeatCapacity; // J / kg K = m^2 / s^2 K
237 const T _conversionThermalConductivity; // W / m K = kg m / s^3 K
238 const T _conversionHeatFlux; // W / m^2 = kg / s^3
239
240 // physical units, e.g characteristic or reference values
245 const T _physThermalDiffusivity; // m^2 / s
246 const T _physSpecificHeatCapacity; // J / kg K = m^2 / s^2 K
247 const T _physThermalConductivity; // W / m K = kg m / s^3 K
248
249 // lattice units, discretization parameters
251
252private:
253 mutable OstreamManager clout;
254};
255
256} // namespace olb
257
258#endif
class for marking output with some text
Conversion between physical and lattice units, as well as discretization specialized for thermal appl...
constexpr T getPhysThermalDiffusivity(T latticeThermalDiffusivity) const
conversion from lattice to physical thermal diffusivity
constexpr T getPhysHeatFlux(T latticeHeatFlux) const
conversion from lattice to physical heat flux
constexpr T getConversionFactorSpecificHeatCapacity() const
access (read-only) to private member variable
constexpr T getPhysTemperature(T latticeTemperature) const
conversion from lattice to physical temperature
constexpr T getThermalConductivity() const
return thermal conductivity in physical units
constexpr T getPrandtlNumber() const
constexpr T getPhysThermalExpansionCoefficient() const
return thermal expansion coefficient in physical units
constexpr T getPhysThermalDiffusivity() const
return thermal diffusivity in physical units
constexpr ThermalUnitConverter(T physDeltaX, T physDeltaT, T charPhysLength, T charPhysVelocity, T physViscosity, T physDensity, T physThermalConductivity, T physSpecificHeatCapacity, T physThermalExpansionCoefficient, T charPhysLowTemperature, T charPhysHighTemperature, T charPhysPressure=0)
Documentation of constructor: TODO: Extend constructur documentation.
constexpr T getConversionFactorTemperature() const
access (read-only) to private member variable
constexpr T getPhysSpecificHeatCapacity() const
return specific heat capacity in physical units
constexpr T getPhysSpecificHeatCapacity(T latticeSpecificHeatCapacity) const
conversion from lattice to physical specific heat capacity
constexpr T getLatticeThermalRelaxationTime() const
return thermal relaxation time in lattice units
constexpr T getCharPhysTemperatureDifference() const
return characteristic temperature difference in physical units
constexpr T getRayleighNumber() const
constexpr T getLatticeThermalConductivity(T physThermalConductivity) const
conversion from physical to lattice thermal conductivity
constexpr T getLatticeTemperature(T physTemperature) const
conversion from physical to lattice temperature
constexpr T getConversionFactorThermalConductivity() const
access (read-only) to private member variable
constexpr T getCharPhysHighTemperature() const
return characteristic high temperature in physical units
constexpr T getCharPhysLowTemperature() const
return characteristic low temperature in physical units
constexpr T getLatticeHeatFlux(T physHeatFlux) const
conversion from physical to lattice heat flux
constexpr T getConversionFactorThermalDiffusivity() const
access (read-only) to private member variable
constexpr T getConversionFactorHeatFlux() const
access (read-only) to private member variable
constexpr T getLatticeSpecificHeatCapacity(T physSpecificHeatCapacity) const
conversion from physical to lattice specific heat capacity
void print() const override
nice terminal output for conversion factors, characteristical and physical data
constexpr T getLatticeThermalDiffusivity(T physThermalDiffusivity) const
conversion from physical to lattice thermal diffusivity
constexpr T getPhysThermalConductivity(T latticeThermalConductivity) const
conversion from lattice to physical thermal conductivity
constexpr T getLatticeThermalRelaxationFrequency() const
return thermal relaxation frequency in lattice units
Conversion between physical and lattice units, as well as discretization.
cpu::simd::Pack< T > pow(cpu::simd::Pack< T > base, cpu::simd::Pack< T > exp)
Definition pack.h:112
Top level namespace for all of OpenLB.
Unit conversion handling – header file.
Set of functions commonly used in LB computations – header file.
Input/Output in XML format – header file.