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

#include <adeUnitConverter.h>

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

Public Member Functions

constexpr AdeUnitConverter (T physDeltaX, T physDeltaT, T charPhysLength, T charPhysVelocity, T physDiffusivity, T physDensity)
 
constexpr T getLatticeAdeRelaxationTime () const
 return thermal relaxation time in lattice units
 
constexpr T getLatticeAdeRelaxationFrequency () const
 return thermal relaxation frequency in lattice units
 
constexpr T getPhysDiffusivity () const
 
constexpr T getLatticeDiffusivity () const
 
constexpr T getConversionFactorDiffusivity () const
 
constexpr T getPecletNumber () const
 
constexpr T getKnudsenNumber () const
 
void print () const override
 nice terminal output for conversion factors, characteristical and physical data
 
void write (std::string const &fileName="AdeUnitConverter") const override
 
- Public Member Functions inherited from olb::UnitConverter< T, DESCRIPTOR >
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
 
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 _physDiffusivity
 
const T _conversionDiffusivity
 
const T _latticeAdeRelaxationTime
 
- Protected Attributes inherited from olb::UnitConverter< T, DESCRIPTOR >
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::AdeUnitConverter< T, DESCRIPTOR >

Definition at line 46 of file adeUnitConverter.h.

Constructor & Destructor Documentation

◆ AdeUnitConverter()

template<typename T , typename DESCRIPTOR >
constexpr olb::AdeUnitConverter< T, DESCRIPTOR >::AdeUnitConverter ( T physDeltaX,
T physDeltaT,
T charPhysLength,
T charPhysVelocity,
T physDiffusivity,
T physDensity )
inlineconstexpr

Definition at line 49 of file adeUnitConverter.h.

58 :UnitConverter<T, DESCRIPTOR>(
59 physDeltaX, physDeltaT, charPhysLength, charPhysVelocity,
60 physDiffusivity, physDensity),
61 _physDiffusivity(physDiffusivity),
62 _conversionDiffusivity(physDeltaX * physDeltaX / physDeltaT),
63 _latticeAdeRelaxationTime( (physDiffusivity/ _conversionDiffusivity * descriptors::invCs2<T,DESCRIPTOR>()) + 0.5 ),
64 clout(std::cout,"AdeUnitConv")
65 {
66 };

Member Function Documentation

◆ getConversionFactorDiffusivity()

template<typename T , typename DESCRIPTOR >
constexpr T olb::AdeUnitConverter< T, DESCRIPTOR >::getConversionFactorDiffusivity ( ) const
inlineconstexpr

◆ getKnudsenNumber()

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

Definition at line 101 of file adeUnitConverter.h.

102 {
103 return this->getMachNumber()/getPecletNumber();
104 }
constexpr T getPecletNumber() const
constexpr T getMachNumber() const
return Mach number

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

+ Here is the call graph for this function:

◆ getLatticeAdeRelaxationFrequency()

template<typename T , typename DESCRIPTOR >
constexpr T olb::AdeUnitConverter< T, DESCRIPTOR >::getLatticeAdeRelaxationFrequency ( ) const
inlineconstexpr

return thermal relaxation frequency in lattice units

Definition at line 75 of file adeUnitConverter.h.

76 {
77 return 1.0 / _latticeAdeRelaxationTime;
78 };

References olb::AdeUnitConverter< T, DESCRIPTOR >::_latticeAdeRelaxationTime.

◆ getLatticeAdeRelaxationTime()

template<typename T , typename DESCRIPTOR >
constexpr T olb::AdeUnitConverter< T, DESCRIPTOR >::getLatticeAdeRelaxationTime ( ) const
inlineconstexpr

return thermal relaxation time in lattice units

Definition at line 69 of file adeUnitConverter.h.

70 {
72 };

References olb::AdeUnitConverter< T, DESCRIPTOR >::_latticeAdeRelaxationTime.

◆ getLatticeDiffusivity()

template<typename T , typename DESCRIPTOR >
constexpr T olb::AdeUnitConverter< T, DESCRIPTOR >::getLatticeDiffusivity ( ) const
inlineconstexpr

◆ getPecletNumber()

template<typename T , typename DESCRIPTOR >
constexpr T olb::AdeUnitConverter< T, DESCRIPTOR >::getPecletNumber ( ) const
inlineconstexpr

Definition at line 96 of file adeUnitConverter.h.

97 {
98 return this->getCharPhysVelocity() * this->getCharPhysLength() / this->getPhysDiffusivity();
99 }
constexpr T getPhysDiffusivity() const
constexpr T getCharPhysLength() const
return characteristic length in physical units
constexpr T getCharPhysVelocity() const
return characteristic velocity in physical units

References olb::UnitConverter< T, DESCRIPTOR >::getCharPhysLength(), olb::UnitConverter< T, DESCRIPTOR >::getCharPhysVelocity(), and olb::AdeUnitConverter< T, DESCRIPTOR >::getPhysDiffusivity().

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

◆ getPhysDiffusivity()

template<typename T , typename DESCRIPTOR >
constexpr T olb::AdeUnitConverter< T, DESCRIPTOR >::getPhysDiffusivity ( ) const
inlineconstexpr

Definition at line 80 of file adeUnitConverter.h.

81 {
82 return _physDiffusivity;
83 }

References olb::AdeUnitConverter< T, DESCRIPTOR >::_physDiffusivity.

+ Here is the caller graph for this function:

◆ print()

template<typename T , class DESCRIPTOR >
void olb::AdeUnitConverter< T, DESCRIPTOR >::print ( ) const
overridevirtual

nice terminal output for conversion factors, characteristical and physical data

Reimplemented from olb::UnitConverter< T, DESCRIPTOR >.

Definition at line 121 of file adeUnitConverter.h.

123{
124 clout << "----------------- UnitConverter information -----------------" << std::endl;
125 clout << "-- Parameters:" << std::endl;
126 clout << "Resolution: N= " << this->getResolution() << std::endl;
127 clout << "Lattice velocity: latticeU= " << this->getCharLatticeVelocity() << std::endl;
128 clout << "Lattice relaxation frequency: omega= " << this->getLatticeRelaxationFrequency() << std::endl;
129 clout << "Lattice relaxation time: tau= " << this->getLatticeRelaxationTime() << std::endl;
130 clout << "Characteristical length(m): charL= " << this->getCharPhysLength() << std::endl;
131 clout << "Characteristical speed(m/s): charU= " << this->getCharPhysVelocity() << std::endl;
132 clout << "Phys. density(kg/m^d): charRho= " << this->getPhysDensity() << std::endl;
133 clout << "Peclet Number: Pe= " << getPecletNumber() << std::endl;
134 clout << "Phys. diffusivity (m^2/s): charNu= " << this->getPhysDiffusivity() << std::endl;
135 clout << "Mach number: machNumber= " << this->getMachNumber() << std::endl;
136 clout << "Knudsen number: knudsenNumber= " << getKnudsenNumber() << std::endl;
137 clout << std::endl;
138
139 clout << std::endl;
140 clout << "-- Conversion factors:" << std::endl;
141 clout << "Voxel length(m): physDeltaX= " << this->getConversionFactorLength() << std::endl;
142 clout << "Time step(s): physDeltaT= " << this->getConversionFactorTime() << std::endl;
143 clout << "Velocity factor(m/s): physVelocity= " << this->getConversionFactorVelocity() << std::endl;
144 clout << "Density factor(kg/m^3): physDensity= " << this->getConversionFactorDensity() << std::endl;
145 clout << "Mass factor(kg): physMass= " << this->getConversionFactorMass() << std::endl;
146 clout << "Viscosity factor(m^2/s): physViscosity= " << this->getConversionFactorViscosity() << std::endl;
147 clout << "Force factor(N): physForce= " << this->getConversionFactorForce() << std::endl;
148 clout << "Pressure factor(N/m^2): physPressure= " << this->getConversionFactorPressure() << std::endl;
149 clout << "-------------------------------------------------------------" << std::endl;
150
151}
constexpr T getKnudsenNumber() const
constexpr T getConversionFactorViscosity() const
access (read-only) to private member variable
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 getCharLatticeVelocity() const
return characteristic velocity in lattice units
constexpr T getConversionFactorVelocity() const
access (read-only) to private member variable
constexpr T getConversionFactorMass() const
access (read-only) to private member variable
constexpr T getConversionFactorForce() const
access (read-only) to private member variable
constexpr T getConversionFactorPressure() const
access (read-only) to private member variable
constexpr T getConversionFactorTime() const
access (read-only) to private member variable
constexpr T getLatticeRelaxationTime() const
return relaxation time in lattice units

◆ write()

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

Implements olb::UnitConverterBase.

Definition at line 154 of file adeUnitConverter.h.

155{
156 std::string dataFile = singleton::directories().getLogOutDir() + fileName + ".dat";
157
158 if (singleton::mpi().isMainProcessor()) {
159 std::ofstream fout;
160 fout.open(dataFile.c_str(), std::ios::trunc);
161
162 fout << "UnitConverter information\n\n";
163 fout << "----------------- UnitConverter information -----------------\n";
164 fout << "-- Parameters:" << std::endl;
165 fout << "Resolution: N= " << this->getResolution() << "\n";
166 fout << "Lattice velocity: latticeU= " << this->getCharLatticeVelocity() << "\n";
167 fout << "Lattice relaxation frequency: omega= " << this->getLatticeRelaxationFrequency() << "\n";
168 fout << "Lattice relaxation time: tau= " << this->getLatticeRelaxationTime() << "\n";
169 fout << "Characteristical length(m): charL= " << this->getCharPhysLength() << "\n";
170 fout << "Characteristical speed(m/s): charU= " << this->getCharPhysVelocity() << "\n";
171 fout << "Phys. diffusivity (m^2/s): charNu= " << this->getPhysDiffusivity() << "\n";
172 fout << "Phys. density(kg/m^d): charRho= " << this->getPhysDensity() << "\n";
173 fout << "Characteristical pressure(N/m^2): charPressure= " << this->getCharPhysPressure() << "\n";
174 fout << "Mach number: machNumber= " << this->getMachNumber() << "\n";
175 fout << "Knudsen number: knudsenNumber= " << this->getKnudsenNumber() << "\n";
176 fout << "Peclet Number: Pe= " << getPecletNumber() << "\n";
177 fout << "\n";
178 fout << "-- Conversion factors:" << "\n";
179 fout << "Voxel length(m): physDeltaX= " << this->getConversionFactorLength() << "\n";
180 fout << "Time step(s): physDeltaT= " << this->getConversionFactorTime() << "\n";
181 fout << "Velocity factor(m/s): physVelocity= " << this->getConversionFactorVelocity() << "\n";
182 fout << "Density factor(kg/m^3): physDensity= " << this->getConversionFactorDensity() << "\n";
183 fout << "Mass factor(kg): physMass= " << this->getConversionFactorMass() << "\n";
184 fout << "Diffusion factor(m^2/s): physDiffusion= " << this->getConversionFactorDiffusivity() << "\n";
185 fout << "Force factor(N): physForce= " << this->getConversionFactorForce() << "\n";
186
187 fout << "-------------------------------------------------------------" << "\n";
188
189 fout.close();
190 }
191}
constexpr T getConversionFactorDiffusivity() const
constexpr T getCharPhysPressure() const
return characteristic pressure in physical units
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

◆ _conversionDiffusivity

template<typename T , typename DESCRIPTOR >
const T olb::AdeUnitConverter< T, DESCRIPTOR >::_conversionDiffusivity
protected

Definition at line 113 of file adeUnitConverter.h.

◆ _latticeAdeRelaxationTime

template<typename T , typename DESCRIPTOR >
const T olb::AdeUnitConverter< T, DESCRIPTOR >::_latticeAdeRelaxationTime
protected

Definition at line 114 of file adeUnitConverter.h.

◆ _physDiffusivity

template<typename T , typename DESCRIPTOR >
const T olb::AdeUnitConverter< T, DESCRIPTOR >::_physDiffusivity
protected

Definition at line 112 of file adeUnitConverter.h.


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