OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
olb::UnitConverter< T, DESCRIPTOR > Class Template Reference

Conversion between physical and lattice units, as well as discretization. More...

#include <unitConverter.h>

+ Inheritance diagram for olb::UnitConverter< T, DESCRIPTOR >:
+ Collaboration diagram for olb::UnitConverter< T, DESCRIPTOR >:

Public Member Functions

constexpr UnitConverter (T physDeltaX, T physDeltaT, T charPhysLength, T charPhysVelocity, T physViscosity, T physDensity, T charPhysPressure=0)
 Documentation of constructor:
 
virtual ~UnitConverter ()=default
 
constexpr int getResolution () const
 return resolution
 
constexpr T getLatticeRelaxationTime () const
 return relaxation time in lattice units
 
constexpr T getLatticeRelaxationFrequency () const
 return relaxation frequency in lattice units
 
template<typename DESCRIPTOR_ >
constexpr T getLatticeRelaxationFrequencyFromDiffusivity (const T physDiffusivity) const
 return relaxation frequency in lattice units computed from given physical diffusivity in m^2 / s
 
constexpr T getCharPhysLength () const
 return characteristic length in physical units
 
constexpr T getCharPhysVelocity () const
 return characteristic velocity in physical units
 
constexpr T getCharLatticeVelocity () const
 return characteristic velocity in lattice units
 
constexpr T getPhysViscosity () const
 return viscosity in physical units
 
constexpr T getPhysDensity () const
 return density in physical units
 
constexpr T getCharPhysPressure () const
 return characteristic pressure in physical units
 
constexpr T getReynoldsNumber () const
 return Reynolds number
 
constexpr T getMachNumber () const
 return Mach number
 
constexpr T getKnudsenNumber () const
 return Knudsen number
 
constexpr T getPhysLength (int latticeLength) const
 conversion from lattice to physical length
 
constexpr int getLatticeLength (T physLength) const
 conversion from physical to lattice length, returns number of voxels for given physical length
 
constexpr T getConversionFactorLength () const
 access (read-only) to private member variable
 
constexpr T getPhysDeltaX () const
 returns grid spacing (voxel length) in m
 
constexpr T getPhysTime (size_t latticeTime) const
 conversion from lattice to physical time
 
constexpr size_t getLatticeTime (T physTime) const
 conversion from physical to lattice time
 
constexpr T getConversionFactorTime () const
 access (read-only) to private member variable
 
constexpr T getPhysDeltaT () const
 returns time spacing (timestep length) in s
 
constexpr T getPhysVelocity (T latticeVelocity) const
 conversion from lattice to physical velocity
 
constexpr T getLatticeVelocity (T physVelocity) const
 conversion from physical to lattice velocity
 
constexpr T getConversionFactorVelocity () const
 access (read-only) to private member variable
 
constexpr T getPhysDensity (T latticeDensity) const
 conversion from lattice to physical density
 
constexpr T getLatticeDensity (T physDensity) const
 conversion from physical to lattice density
 
constexpr T getLatticeDensityFromPhysPressure (T physPressure) const
 
constexpr T getConversionFactorDensity () const
 access (read-only) to private member variable
 
constexpr T getPhysMass (T latticeMass) const
 conversion from lattice to physical mass
 
constexpr T getLatticeMass (T physMass) const
 conversion from physical to lattice mass
 
constexpr T getConversionFactorMass () const
 access (read-only) to private member variable
 
constexpr T getPhysViscosity (T latticeViscosity) const
 conversion from lattice to physical viscosity
 
constexpr T getLatticeViscosity () const
 conversion from physical to lattice viscosity
 
constexpr T getConversionFactorViscosity () const
 access (read-only) to private member variable
 
constexpr T getPhysForce (T latticeForce) const
 conversion from lattice to physical force
 
constexpr T getLatticeForce (T physForce) const
 conversion from physical to lattice force
 
constexpr T getConversionFactorForce () const
 access (read-only) to private member variable
 
constexpr T getPhysTorque (T latticeTorque) const
 conversion from lattice to physical torque
 
constexpr T getLatticeTorque (T physTorque) const
 conversion from physical to lattice torque
 
constexpr T getConversionFactorTorque () const
 access (read-only) to private member variable
 
constexpr T getPhysPressure (T latticePressure) const
 conversion from lattice to physical pressure
 
constexpr T getLatticePressure (T physPressure) const
 conversion from physical to lattice pressure
 
constexpr T getConversionFactorPressure () const
 access (read-only) to private member variable
 
virtual void print () const
 nice terminal output for conversion factors, characteristical and physical data
 
void print (std::ostream &fout) const
 
void write (std::string const &fileName="unitConverter") const
 
- Public Member Functions inherited from olb::UnitConverterBase
virtual ~UnitConverterBase ()=default
 

Protected Attributes

const T _conversionLength
 
const T _conversionTime
 
const T _conversionVelocity
 
const T _conversionDensity
 
const T _conversionMass
 
const T _conversionViscosity
 
const T _conversionForce
 
const T _conversionTorque
 
const T _conversionPressure
 
const T _charPhysLength
 
const T _charPhysVelocity
 
const T _physViscosity
 
const T _physDensity
 
const T _charPhysPressure
 
const size_t _resolution
 
const T _latticeRelaxationTime
 
const T _charLatticeVelocity
 

Detailed Description

template<typename T, typename DESCRIPTOR>
class olb::UnitConverter< T, DESCRIPTOR >

Conversion between physical and lattice units, as well as discretization.

Be aware of the nomenclature: We distingish between physical (dimensioned) and lattice (dimensionless) values. A specific conversion factor maps the two different scopes, e.g. physLength = conversionLength * latticeLength

For pressure and temperature we first shift the physical values by a characteristic value to asure a lattice pressure and lattice temperature between 0 and 1, e.g. physPressure - charPhysPressure = conversionPressure * latticePressure

Parameters
latticeRelaxationTimerelaxation time, have to be greater than 0.5!
physViscosityphysical kinematic viscosity in m^2 / s
physDensityphysical density in kg / m^3
conversionLengthconversion factor for length m
conversionTimeconversion factor for time s
conversionMassconversion factor for mass kg
conversionVelocityconversion velocity m / s
conversionViscosityconversion kinematic viscosity m^2 / s
conversionDensityconversion density kg / m^3
conversionForceconversion force kg m / s^2
conversionPressureconversion pressure kg / m s^2
resolutionnumber of grid points per charPhysLength
charLatticeVelocity

Definition at line 85 of file unitConverter.h.

Constructor & Destructor Documentation

◆ UnitConverter()

template<typename T , typename DESCRIPTOR >
constexpr olb::UnitConverter< T, DESCRIPTOR >::UnitConverter ( T physDeltaX,
T physDeltaT,
T charPhysLength,
T charPhysVelocity,
T physViscosity,
T physDensity,
T charPhysPressure = 0 )
inlineconstexpr

Documentation of constructor:

Parameters
physDeltaXspacing between two lattice cells in m
physDeltaTtime step in s
charPhysLengthreference/characteristic length of simulation geometry in m
charPhysVelocitymaximal or highest expected velocity during simulation in m / s
physViscosityphysical kinematic viscosity in m^2 / s
physDensityphysical density in kg / m^3
charPhysPressurereference/characteristic physical pressure in Pa = kg / m s^2

Definition at line 96 of file unitConverter.h.

98 : _conversionLength(physDeltaX),
99 _conversionTime(physDeltaT),
101 _conversionDensity(physDensity),
107 _charPhysLength(charPhysLength),
108 _charPhysVelocity(charPhysVelocity),
109 _physViscosity(physViscosity),
110 _physDensity(physDensity),
111 _charPhysPressure(charPhysPressure),
113 _latticeRelaxationTime( (_physViscosity / _conversionViscosity * descriptors::invCs2<T,DESCRIPTOR>()) + 0.5 ),
115 clout(std::cout,"UnitConverter")
116 {
117 }
const size_t _resolution
const T _latticeRelaxationTime
cpu::simd::Pack< T > pow(cpu::simd::Pack< T > base, cpu::simd::Pack< T > exp)
Definition pack.h:112

◆ ~UnitConverter()

template<typename T , typename DESCRIPTOR >
virtual olb::UnitConverter< T, DESCRIPTOR >::~UnitConverter ( )
virtualdefault

Member Function Documentation

◆ getCharLatticeVelocity()

template<typename T , typename DESCRIPTOR >
constexpr T olb::UnitConverter< T, DESCRIPTOR >::getCharLatticeVelocity ( ) const
inlineconstexpr

return characteristic velocity in lattice units

Definition at line 153 of file unitConverter.h.

154 {
156 }

References olb::UnitConverter< T, DESCRIPTOR >::_charLatticeVelocity.

+ Here is the caller graph for this function:

◆ getCharPhysLength()

template<typename T , typename DESCRIPTOR >
constexpr T olb::UnitConverter< T, DESCRIPTOR >::getCharPhysLength ( ) const
inlineconstexpr

return characteristic length in physical units

Definition at line 143 of file unitConverter.h.

144 {
145 return _charPhysLength;
146 }

References olb::UnitConverter< T, DESCRIPTOR >::_charPhysLength.

+ Here is the caller graph for this function:

◆ getCharPhysPressure()

template<typename T , typename DESCRIPTOR >
constexpr T olb::UnitConverter< T, DESCRIPTOR >::getCharPhysPressure ( ) const
inlineconstexpr

return characteristic pressure in physical units

Definition at line 168 of file unitConverter.h.

169 {
170 return _charPhysPressure;
171 }

References olb::UnitConverter< T, DESCRIPTOR >::_charPhysPressure.

+ Here is the caller graph for this function:

◆ getCharPhysVelocity()

template<typename T , typename DESCRIPTOR >
constexpr T olb::UnitConverter< T, DESCRIPTOR >::getCharPhysVelocity ( ) const
inlineconstexpr

return characteristic velocity in physical units

Definition at line 148 of file unitConverter.h.

149 {
150 return _charPhysVelocity;
151 }

References olb::UnitConverter< T, DESCRIPTOR >::_charPhysVelocity.

+ Here is the caller graph for this function:

◆ getConversionFactorDensity()

template<typename T , typename DESCRIPTOR >
constexpr T olb::UnitConverter< T, DESCRIPTOR >::getConversionFactorDensity ( ) const
inlineconstexpr

access (read-only) to private member variable

Definition at line 262 of file unitConverter.h.

263 {
264 return _conversionDensity;
265 }

References olb::UnitConverter< T, DESCRIPTOR >::_conversionDensity.

+ Here is the caller graph for this function:

◆ getConversionFactorForce()

template<typename T , typename DESCRIPTOR >
constexpr T olb::UnitConverter< T, DESCRIPTOR >::getConversionFactorForce ( ) const
inlineconstexpr

access (read-only) to private member variable

Definition at line 310 of file unitConverter.h.

311 {
312 return _conversionForce;
313 }

References olb::UnitConverter< T, DESCRIPTOR >::_conversionForce.

+ Here is the caller graph for this function:

◆ getConversionFactorLength()

template<typename T , typename DESCRIPTOR >
constexpr T olb::UnitConverter< T, DESCRIPTOR >::getConversionFactorLength ( ) const
inlineconstexpr

access (read-only) to private member variable

Definition at line 200 of file unitConverter.h.

201 {
202 return _conversionLength;
203 }

References olb::UnitConverter< T, DESCRIPTOR >::_conversionLength.

+ Here is the caller graph for this function:

◆ getConversionFactorMass()

template<typename T , typename DESCRIPTOR >
constexpr T olb::UnitConverter< T, DESCRIPTOR >::getConversionFactorMass ( ) const
inlineconstexpr

access (read-only) to private member variable

Definition at line 278 of file unitConverter.h.

279 {
280 return _conversionMass;
281 }

References olb::UnitConverter< T, DESCRIPTOR >::_conversionMass.

+ Here is the caller graph for this function:

◆ getConversionFactorPressure()

template<typename T , typename DESCRIPTOR >
constexpr T olb::UnitConverter< T, DESCRIPTOR >::getConversionFactorPressure ( ) const
inlineconstexpr

access (read-only) to private member variable

Definition at line 342 of file unitConverter.h.

343 {
344 return _conversionPressure;
345 }

References olb::UnitConverter< T, DESCRIPTOR >::_conversionPressure.

+ Here is the caller graph for this function:

◆ getConversionFactorTime()

template<typename T , typename DESCRIPTOR >
constexpr T olb::UnitConverter< T, DESCRIPTOR >::getConversionFactorTime ( ) const
inlineconstexpr

access (read-only) to private member variable

Definition at line 221 of file unitConverter.h.

222 {
223 return _conversionTime;
224 }

References olb::UnitConverter< T, DESCRIPTOR >::_conversionTime.

+ Here is the caller graph for this function:

◆ getConversionFactorTorque()

template<typename T , typename DESCRIPTOR >
constexpr T olb::UnitConverter< T, DESCRIPTOR >::getConversionFactorTorque ( ) const
inlineconstexpr

access (read-only) to private member variable

Definition at line 326 of file unitConverter.h.

327 {
328 return _conversionTorque;
329 }

References olb::UnitConverter< T, DESCRIPTOR >::_conversionTorque.

◆ getConversionFactorVelocity()

template<typename T , typename DESCRIPTOR >
constexpr T olb::UnitConverter< T, DESCRIPTOR >::getConversionFactorVelocity ( ) const
inlineconstexpr

access (read-only) to private member variable

Definition at line 242 of file unitConverter.h.

243 {
244 return _conversionVelocity;
245 }

References olb::UnitConverter< T, DESCRIPTOR >::_conversionVelocity.

+ Here is the caller graph for this function:

◆ getConversionFactorViscosity()

template<typename T , typename DESCRIPTOR >
constexpr T olb::UnitConverter< T, DESCRIPTOR >::getConversionFactorViscosity ( ) const
inlineconstexpr

access (read-only) to private member variable

Definition at line 294 of file unitConverter.h.

295 {
297 }

References olb::UnitConverter< T, DESCRIPTOR >::_conversionViscosity.

+ Here is the caller graph for this function:

◆ getKnudsenNumber()

template<typename T , typename DESCRIPTOR >
constexpr T olb::UnitConverter< T, DESCRIPTOR >::getKnudsenNumber ( ) const
inlineconstexpr

return Knudsen number

Definition at line 183 of file unitConverter.h.

184 {
185 // This calculates the lattice Knudsen number.
186 // See e.g. (7.22) in "The Lattice Boltzmann Method: Principles and Practice" [kruger2017lattice].
187 return getMachNumber() / getReynoldsNumber();
188 }
constexpr T getMachNumber() const
return Mach number
constexpr T getReynoldsNumber() const
return Reynolds number

References olb::UnitConverter< T, DESCRIPTOR >::getMachNumber(), and olb::UnitConverter< T, DESCRIPTOR >::getReynoldsNumber().

+ Here is the call graph for this function:

◆ getLatticeDensity()

template<typename T , typename DESCRIPTOR >
constexpr T olb::UnitConverter< T, DESCRIPTOR >::getLatticeDensity ( T physDensity) const
inlineconstexpr

conversion from physical to lattice density

Definition at line 253 of file unitConverter.h.

254 {
255 return physDensity / _conversionDensity;
256 }

References olb::UnitConverter< T, DESCRIPTOR >::_conversionDensity.

◆ getLatticeDensityFromPhysPressure()

template<typename T , typename DESCRIPTOR >
constexpr T olb::UnitConverter< T, DESCRIPTOR >::getLatticeDensityFromPhysPressure ( T physPressure) const
inlineconstexpr

Definition at line 257 of file unitConverter.h.

258 {
259 return util::densityFromPressure<T,DESCRIPTOR>( getLatticePressure( physPressure ) );
260 }
constexpr T getLatticePressure(T physPressure) const
conversion from physical to lattice pressure

References olb::UnitConverter< T, DESCRIPTOR >::getLatticePressure().

+ Here is the call graph for this function:

◆ getLatticeForce()

template<typename T , typename DESCRIPTOR >
constexpr T olb::UnitConverter< T, DESCRIPTOR >::getLatticeForce ( T physForce) const
inlineconstexpr

conversion from physical to lattice force

Definition at line 305 of file unitConverter.h.

306 {
307 return physForce / _conversionForce;
308 }

References olb::UnitConverter< T, DESCRIPTOR >::_conversionForce.

◆ getLatticeLength()

template<typename T , typename DESCRIPTOR >
constexpr int olb::UnitConverter< T, DESCRIPTOR >::getLatticeLength ( T physLength) const
inlineconstexpr

conversion from physical to lattice length, returns number of voxels for given physical length

Definition at line 195 of file unitConverter.h.

196 {
197 return int( physLength / _conversionLength + 0.5 );
198 }

References olb::UnitConverter< T, DESCRIPTOR >::_conversionLength.

◆ getLatticeMass()

template<typename T , typename DESCRIPTOR >
constexpr T olb::UnitConverter< T, DESCRIPTOR >::getLatticeMass ( T physMass) const
inlineconstexpr

conversion from physical to lattice mass

Definition at line 273 of file unitConverter.h.

274 {
275 return physMass / _conversionMass;
276 }

References olb::UnitConverter< T, DESCRIPTOR >::_conversionMass.

◆ getLatticePressure()

template<typename T , typename DESCRIPTOR >
constexpr T olb::UnitConverter< T, DESCRIPTOR >::getLatticePressure ( T physPressure) const
inlineconstexpr

conversion from physical to lattice pressure

Definition at line 337 of file unitConverter.h.

338 {
339 return ( physPressure - _charPhysPressure ) / _conversionPressure;
340 }

References olb::UnitConverter< T, DESCRIPTOR >::_charPhysPressure, and olb::UnitConverter< T, DESCRIPTOR >::_conversionPressure.

+ Here is the caller graph for this function:

◆ getLatticeRelaxationFrequency()

template<typename T , typename DESCRIPTOR >
constexpr T olb::UnitConverter< T, DESCRIPTOR >::getLatticeRelaxationFrequency ( ) const
inlineconstexpr

return relaxation frequency in lattice units

Definition at line 132 of file unitConverter.h.

133 {
134 return 1./_latticeRelaxationTime;
135 }

References olb::UnitConverter< T, DESCRIPTOR >::_latticeRelaxationTime.

+ Here is the caller graph for this function:

◆ getLatticeRelaxationFrequencyFromDiffusivity()

template<typename T , typename DESCRIPTOR >
template<typename DESCRIPTOR_ >
constexpr T olb::UnitConverter< T, DESCRIPTOR >::getLatticeRelaxationFrequencyFromDiffusivity ( const T physDiffusivity) const
inlineconstexpr

return relaxation frequency in lattice units computed from given physical diffusivity in m^2 / s

Definition at line 138 of file unitConverter.h.

139 {
140 return 1.0 / ( physDiffusivity / _conversionViscosity * descriptors::invCs2<T,DESCRIPTOR_>() + 0.5 );
141 }

References olb::UnitConverter< T, DESCRIPTOR >::_conversionViscosity.

◆ getLatticeRelaxationTime()

template<typename T , typename DESCRIPTOR >
constexpr T olb::UnitConverter< T, DESCRIPTOR >::getLatticeRelaxationTime ( ) const
inlineconstexpr

return relaxation time in lattice units

Definition at line 127 of file unitConverter.h.

128 {
130 }

References olb::UnitConverter< T, DESCRIPTOR >::_latticeRelaxationTime.

+ Here is the caller graph for this function:

◆ getLatticeTime()

template<typename T , typename DESCRIPTOR >
constexpr size_t olb::UnitConverter< T, DESCRIPTOR >::getLatticeTime ( T physTime) const
inlineconstexpr

conversion from physical to lattice time

Definition at line 216 of file unitConverter.h.

217 {
218 return size_t(physTime / _conversionTime + 0.5);
219 }

References olb::UnitConverter< T, DESCRIPTOR >::_conversionTime.

+ Here is the caller graph for this function:

◆ getLatticeTorque()

template<typename T , typename DESCRIPTOR >
constexpr T olb::UnitConverter< T, DESCRIPTOR >::getLatticeTorque ( T physTorque) const
inlineconstexpr

conversion from physical to lattice torque

Definition at line 321 of file unitConverter.h.

322 {
323 return physTorque / _conversionTorque;
324 }

References olb::UnitConverter< T, DESCRIPTOR >::_conversionTorque.

◆ getLatticeVelocity()

template<typename T , typename DESCRIPTOR >
constexpr T olb::UnitConverter< T, DESCRIPTOR >::getLatticeVelocity ( T physVelocity) const
inlineconstexpr

conversion from physical to lattice velocity

Definition at line 237 of file unitConverter.h.

238 {
239 return physVelocity / _conversionVelocity;
240 }

References olb::UnitConverter< T, DESCRIPTOR >::_conversionVelocity.

+ Here is the caller graph for this function:

◆ getLatticeViscosity()

template<typename T , typename DESCRIPTOR >
constexpr T olb::UnitConverter< T, DESCRIPTOR >::getLatticeViscosity ( ) const
inlineconstexpr

conversion from physical to lattice viscosity

Definition at line 289 of file unitConverter.h.

290 {
292 }

References olb::UnitConverter< T, DESCRIPTOR >::_conversionViscosity, and olb::UnitConverter< T, DESCRIPTOR >::_physViscosity.

+ Here is the caller graph for this function:

◆ getMachNumber()

template<typename T , typename DESCRIPTOR >
constexpr T olb::UnitConverter< T, DESCRIPTOR >::getMachNumber ( ) const
inlineconstexpr

return Mach number

Definition at line 178 of file unitConverter.h.

179 {
180 return getCharLatticeVelocity() * util::sqrt(descriptors::invCs2<T,DESCRIPTOR>());
181 }
constexpr T getCharLatticeVelocity() const
return characteristic velocity in lattice units
cpu::simd::Pack< T > sqrt(cpu::simd::Pack< T > value)
Definition pack.h:100

References olb::UnitConverter< T, DESCRIPTOR >::getCharLatticeVelocity(), and olb::util::sqrt().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPhysDeltaT()

template<typename T , typename DESCRIPTOR >
constexpr T olb::UnitConverter< T, DESCRIPTOR >::getPhysDeltaT ( ) const
inlineconstexpr

returns time spacing (timestep length) in s

Definition at line 226 of file unitConverter.h.

227 {
228 return _conversionTime;
229 }

References olb::UnitConverter< T, DESCRIPTOR >::_conversionTime.

+ Here is the caller graph for this function:

◆ getPhysDeltaX()

template<typename T , typename DESCRIPTOR >
constexpr T olb::UnitConverter< T, DESCRIPTOR >::getPhysDeltaX ( ) const
inlineconstexpr

returns grid spacing (voxel length) in m

Definition at line 205 of file unitConverter.h.

206 {
207 return _conversionLength;
208 }

References olb::UnitConverter< T, DESCRIPTOR >::_conversionLength.

+ Here is the caller graph for this function:

◆ getPhysDensity() [1/2]

template<typename T , typename DESCRIPTOR >
constexpr T olb::UnitConverter< T, DESCRIPTOR >::getPhysDensity ( ) const
inlineconstexpr

return density in physical units

Definition at line 163 of file unitConverter.h.

164 {
165 return _physDensity;
166 }

References olb::UnitConverter< T, DESCRIPTOR >::_physDensity.

+ Here is the caller graph for this function:

◆ getPhysDensity() [2/2]

template<typename T , typename DESCRIPTOR >
constexpr T olb::UnitConverter< T, DESCRIPTOR >::getPhysDensity ( T latticeDensity) const
inlineconstexpr

conversion from lattice to physical density

Definition at line 248 of file unitConverter.h.

249 {
250 return _conversionDensity * latticeDensity;
251 }

References olb::UnitConverter< T, DESCRIPTOR >::_conversionDensity.

◆ getPhysForce()

template<typename T , typename DESCRIPTOR >
constexpr T olb::UnitConverter< T, DESCRIPTOR >::getPhysForce ( T latticeForce) const
inlineconstexpr

conversion from lattice to physical force

Definition at line 300 of file unitConverter.h.

301 {
302 return _conversionForce * latticeForce;
303 }

References olb::UnitConverter< T, DESCRIPTOR >::_conversionForce.

+ Here is the caller graph for this function:

◆ getPhysLength()

template<typename T , typename DESCRIPTOR >
constexpr T olb::UnitConverter< T, DESCRIPTOR >::getPhysLength ( int latticeLength) const
inlineconstexpr

conversion from lattice to physical length

Definition at line 190 of file unitConverter.h.

191 {
192 return _conversionLength * latticeLength;
193 }

References olb::UnitConverter< T, DESCRIPTOR >::_conversionLength.

◆ getPhysMass()

template<typename T , typename DESCRIPTOR >
constexpr T olb::UnitConverter< T, DESCRIPTOR >::getPhysMass ( T latticeMass) const
inlineconstexpr

conversion from lattice to physical mass

Definition at line 268 of file unitConverter.h.

269 {
270 return _conversionMass * latticeMass;
271 }

References olb::UnitConverter< T, DESCRIPTOR >::_conversionMass.

◆ getPhysPressure()

template<typename T , typename DESCRIPTOR >
constexpr T olb::UnitConverter< T, DESCRIPTOR >::getPhysPressure ( T latticePressure) const
inlineconstexpr

conversion from lattice to physical pressure

Definition at line 332 of file unitConverter.h.

333 {
334 return _conversionPressure * latticePressure + _charPhysPressure;
335 }

References olb::UnitConverter< T, DESCRIPTOR >::_charPhysPressure, and olb::UnitConverter< T, DESCRIPTOR >::_conversionPressure.

◆ getPhysTime()

template<typename T , typename DESCRIPTOR >
constexpr T olb::UnitConverter< T, DESCRIPTOR >::getPhysTime ( size_t latticeTime) const
inlineconstexpr

conversion from lattice to physical time

Definition at line 211 of file unitConverter.h.

212 {
213 return _conversionTime * latticeTime;
214 }

References olb::UnitConverter< T, DESCRIPTOR >::_conversionTime.

+ Here is the caller graph for this function:

◆ getPhysTorque()

template<typename T , typename DESCRIPTOR >
constexpr T olb::UnitConverter< T, DESCRIPTOR >::getPhysTorque ( T latticeTorque) const
inlineconstexpr

conversion from lattice to physical torque

Definition at line 316 of file unitConverter.h.

317 {
318 return _conversionTorque * latticeTorque;
319 }

References olb::UnitConverter< T, DESCRIPTOR >::_conversionTorque.

◆ getPhysVelocity()

template<typename T , typename DESCRIPTOR >
constexpr T olb::UnitConverter< T, DESCRIPTOR >::getPhysVelocity ( T latticeVelocity) const
inlineconstexpr

conversion from lattice to physical velocity

Definition at line 232 of file unitConverter.h.

233 {
234 return _conversionVelocity * latticeVelocity;
235 }

References olb::UnitConverter< T, DESCRIPTOR >::_conversionVelocity.

◆ getPhysViscosity() [1/2]

template<typename T , typename DESCRIPTOR >
constexpr T olb::UnitConverter< T, DESCRIPTOR >::getPhysViscosity ( ) const
inlineconstexpr

return viscosity in physical units

Definition at line 158 of file unitConverter.h.

159 {
160 return _physViscosity;
161 }

References olb::UnitConverter< T, DESCRIPTOR >::_physViscosity.

+ Here is the caller graph for this function:

◆ getPhysViscosity() [2/2]

template<typename T , typename DESCRIPTOR >
constexpr T olb::UnitConverter< T, DESCRIPTOR >::getPhysViscosity ( T latticeViscosity) const
inlineconstexpr

conversion from lattice to physical viscosity

Definition at line 284 of file unitConverter.h.

285 {
286 return _conversionViscosity * latticeViscosity;
287 }

References olb::UnitConverter< T, DESCRIPTOR >::_conversionViscosity.

◆ getResolution()

template<typename T , typename DESCRIPTOR >
constexpr int olb::UnitConverter< T, DESCRIPTOR >::getResolution ( ) const
inlineconstexpr

return resolution

Definition at line 122 of file unitConverter.h.

123 {
124 return _resolution;
125 }

References olb::UnitConverter< T, DESCRIPTOR >::_resolution.

+ Here is the caller graph for this function:

◆ getReynoldsNumber()

template<typename T , typename DESCRIPTOR >
constexpr T olb::UnitConverter< T, DESCRIPTOR >::getReynoldsNumber ( ) const
inlineconstexpr

return Reynolds number

Definition at line 173 of file unitConverter.h.

174 {
176 }

References olb::UnitConverter< T, DESCRIPTOR >::_charPhysLength, olb::UnitConverter< T, DESCRIPTOR >::_charPhysVelocity, and olb::UnitConverter< T, DESCRIPTOR >::_physViscosity.

+ Here is the caller graph for this function:

◆ print() [1/2]

template<typename T , class DESCRIPTOR >
void olb::UnitConverter< T, DESCRIPTOR >::print ( ) const
virtual

nice terminal output for conversion factors, characteristical and physical data

Implements olb::UnitConverterBase.

Reimplemented in olb::AdsorptionConverter< T, DESCRIPTOR >, olb::AdsorptionConverter< T, ADEDESCRIPTOR >, olb::AdeUnitConverter< T, DESCRIPTOR >, olb::MultiPhaseUnitConverter< T, DESCRIPTOR >, olb::RadiativeUnitConverter< T, DESCRIPTOR >, olb::ThermalUnitConverter< T, DESCRIPTOR, ThermalLattice >, and olb::ThermalUnitConverter< T, DESCRIPTOR, TDESCRIPTOR >.

Definition at line 72 of file unitConverter.hh.

73{
74 print(clout);
75}
virtual void print() const
nice terminal output for conversion factors, characteristical and physical data

◆ print() [2/2]

template<typename T , typename DESCRIPTOR >
void olb::UnitConverter< T, DESCRIPTOR >::print ( std::ostream & fout) const
virtual

Implements olb::UnitConverterBase.

Definition at line 39 of file unitConverter.hh.

40{
41 clout << "----------------- UnitConverter information -----------------" << std::endl;
42 clout << "-- Parameters:" << std::endl;
43 clout << "Resolution: N= " << getResolution() << std::endl;
44 clout << "Lattice velocity: latticeU= " << getCharLatticeVelocity() << std::endl;
45 clout << "Lattice relaxation frequency: omega= " << getLatticeRelaxationFrequency( ) << std::endl;
46 clout << "Lattice relaxation time: tau= " << getLatticeRelaxationTime() << std::endl;
47 clout << "Characteristical length(m): charL= " << getCharPhysLength() << std::endl;
48 clout << "Characteristical speed(m/s): charU= " << getCharPhysVelocity() << std::endl;
49 clout << "Phys. kinematic viscosity(m^2/s): charNu= " << getPhysViscosity() << std::endl;
50 clout << "Phys. density(kg/m^d): charRho= " << getPhysDensity() << std::endl;
51 clout << "Characteristical pressure(N/m^2): charPressure= " << getCharPhysPressure() << std::endl;
52 clout << "Mach number: machNumber= " << getMachNumber() << std::endl;
53 clout << "Reynolds number: reynoldsNumber= " << getReynoldsNumber() << std::endl;
54 clout << "Knudsen number: knudsenNumber= " << getKnudsenNumber() << std::endl;
55
56 clout << std::endl;
57 clout << "-- Conversion factors:" << std::endl;
58 clout << "Voxel length(m): physDeltaX= " << getConversionFactorLength() << std::endl;
59 clout << "Time step(s): physDeltaT= " << getConversionFactorTime() << std::endl;
60 clout << "Velocity factor(m/s): physVelocity= " << getConversionFactorVelocity() << std::endl;
61 clout << "Density factor(kg/m^3): physDensity= " << getConversionFactorDensity() << std::endl;
62 clout << "Mass factor(kg): physMass= " << getConversionFactorMass() << std::endl;
63 clout << "Viscosity factor(m^2/s): physViscosity= " << getConversionFactorViscosity() << std::endl;
64 clout << "Force factor(N): physForce= " << getConversionFactorForce() << std::endl;
65 clout << "Pressure factor(N/m^2): physPressure= " << getConversionFactorPressure() << std::endl;
66
67 clout << "-------------------------------------------------------------" << std::endl;
68
69}
constexpr T getConversionFactorViscosity() const
access (read-only) to private member variable
constexpr T getCharPhysLength() const
return characteristic length in physical units
constexpr int getResolution() const
return resolution
constexpr T getConversionFactorDensity() const
access (read-only) to private member variable
constexpr T getPhysDensity() const
return density in physical units
constexpr T getLatticeRelaxationFrequency() const
return relaxation frequency in lattice units
constexpr T getConversionFactorLength() const
access (read-only) to private member variable
constexpr T getConversionFactorVelocity() const
access (read-only) to private member variable
constexpr T getConversionFactorMass() const
access (read-only) to private member variable
constexpr T getPhysViscosity() const
return viscosity in physical units
constexpr T getConversionFactorForce() const
access (read-only) to private member variable
constexpr T getConversionFactorPressure() const
access (read-only) to private member variable
constexpr T getKnudsenNumber() const
return Knudsen number
constexpr T getCharPhysVelocity() const
return characteristic velocity in physical units
constexpr T getConversionFactorTime() const
access (read-only) to private member variable
constexpr T getCharPhysPressure() const
return characteristic pressure in physical units
constexpr T getLatticeRelaxationTime() const
return relaxation time in lattice units

◆ write()

template<typename T , typename DESCRIPTOR >
void olb::UnitConverter< T, DESCRIPTOR >::write ( std::string const & fileName = "unitConverter") const
virtual

Implements olb::UnitConverterBase.

Definition at line 78 of file unitConverter.hh.

79{
80 std::string dataFile = singleton::directories().getLogOutDir() + fileName + ".dat";
81
82 if (singleton::mpi().isMainProcessor()) {
83 std::ofstream fout(dataFile.c_str(), std::ios::trunc);
84 if (!fout) {
85 clout << "error write() function: can not open std::ofstream" << std::endl;
86 }
87 else {
88 print( fout );
89 fout.close();
90 }
91 }
92}
std::string getLogOutDir() const
Definition singleton.h:89
MpiManager & mpi()
Directories & directories()
Definition singleton.h:150

References olb::singleton::directories(), olb::singleton::Directories::getLogOutDir(), and olb::singleton::mpi().

+ Here is the call graph for this function:

Member Data Documentation

◆ _charLatticeVelocity

template<typename T , typename DESCRIPTOR >
const T olb::UnitConverter< T, DESCRIPTOR >::_charLatticeVelocity
protected

Definition at line 374 of file unitConverter.h.

◆ _charPhysLength

template<typename T , typename DESCRIPTOR >
const T olb::UnitConverter< T, DESCRIPTOR >::_charPhysLength
protected

Definition at line 365 of file unitConverter.h.

◆ _charPhysPressure

template<typename T , typename DESCRIPTOR >
const T olb::UnitConverter< T, DESCRIPTOR >::_charPhysPressure
protected

Definition at line 369 of file unitConverter.h.

◆ _charPhysVelocity

template<typename T , typename DESCRIPTOR >
const T olb::UnitConverter< T, DESCRIPTOR >::_charPhysVelocity
protected

Definition at line 366 of file unitConverter.h.

◆ _conversionDensity

template<typename T , typename DESCRIPTOR >
const T olb::UnitConverter< T, DESCRIPTOR >::_conversionDensity
protected

Definition at line 357 of file unitConverter.h.

◆ _conversionForce

template<typename T , typename DESCRIPTOR >
const T olb::UnitConverter< T, DESCRIPTOR >::_conversionForce
protected

Definition at line 360 of file unitConverter.h.

◆ _conversionLength

template<typename T , typename DESCRIPTOR >
const T olb::UnitConverter< T, DESCRIPTOR >::_conversionLength
protected

Definition at line 354 of file unitConverter.h.

◆ _conversionMass

template<typename T , typename DESCRIPTOR >
const T olb::UnitConverter< T, DESCRIPTOR >::_conversionMass
protected

Definition at line 358 of file unitConverter.h.

◆ _conversionPressure

template<typename T , typename DESCRIPTOR >
const T olb::UnitConverter< T, DESCRIPTOR >::_conversionPressure
protected

Definition at line 362 of file unitConverter.h.

◆ _conversionTime

template<typename T , typename DESCRIPTOR >
const T olb::UnitConverter< T, DESCRIPTOR >::_conversionTime
protected

Definition at line 355 of file unitConverter.h.

◆ _conversionTorque

template<typename T , typename DESCRIPTOR >
const T olb::UnitConverter< T, DESCRIPTOR >::_conversionTorque
protected

Definition at line 361 of file unitConverter.h.

◆ _conversionVelocity

template<typename T , typename DESCRIPTOR >
const T olb::UnitConverter< T, DESCRIPTOR >::_conversionVelocity
protected

Definition at line 356 of file unitConverter.h.

◆ _conversionViscosity

template<typename T , typename DESCRIPTOR >
const T olb::UnitConverter< T, DESCRIPTOR >::_conversionViscosity
protected

Definition at line 359 of file unitConverter.h.

◆ _latticeRelaxationTime

template<typename T , typename DESCRIPTOR >
const T olb::UnitConverter< T, DESCRIPTOR >::_latticeRelaxationTime
protected

Definition at line 373 of file unitConverter.h.

◆ _physDensity

template<typename T , typename DESCRIPTOR >
const T olb::UnitConverter< T, DESCRIPTOR >::_physDensity
protected

Definition at line 368 of file unitConverter.h.

◆ _physViscosity

template<typename T , typename DESCRIPTOR >
const T olb::UnitConverter< T, DESCRIPTOR >::_physViscosity
protected

Definition at line 367 of file unitConverter.h.

◆ _resolution

template<typename T , typename DESCRIPTOR >
const size_t olb::UnitConverter< T, DESCRIPTOR >::_resolution
protected

Definition at line 372 of file unitConverter.h.


The documentation for this class was generated from the following files: