27#ifndef ADE_UNITCONVERTER_H
28#define ADE_UNITCONVERTER_H
45template <
typename T,
typename DESCRIPTOR>
59 physDeltaX, physDeltaT, charPhysLength, charPhysVelocity,
60 physDiffusivity, physDensity),
64 clout(std::cout,
"AdeUnitConv")
106 void print()
const override;
108 void write(std::string
const& fileName =
"AdeUnitConverter")
const override;
120template <
typename T,
class DESCRIPTOR>
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;
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;
153template <
typename T,
typename DESCRIPTOR>
160 fout.open(dataFile.c_str(), std::ios::trunc);
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";
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";
187 fout <<
"-------------------------------------------------------------" <<
"\n";
193template <
typename T,
typename DESCRIPTOR>
198 T latticeRelaxationTime,
203 (charPhysLength/resolution),
204 (latticeRelaxationTime - 0.5) / descriptors::invCs2<T,DESCRIPTOR>() * util::pow((charPhysLength/resolution),2) / physDiffusivity,
213template <
typename T,
typename DESCRIPTOR>
219 T charLatticeVelocity,
224 (charPhysLength/resolution),
225 (charLatticeVelocity / charPhysVelocity * charPhysLength / resolution),
constexpr AdeUnitConverterFromResolutionAndLatticeVelocity(size_t resolution, T charLatticeVelocity, T charPhysLength, T charPhysVelocity, T physViscosity, T physDensity)
constexpr AdeUnitConverterFromResolutionAndRelaxationTime(size_t resolution, T latticeRelaxationTime, T charPhysLength, T charPhysVelocity, T physDiffusivity, T physDensity)
constexpr T getLatticeAdeRelaxationTime() const
return thermal relaxation time in lattice units
constexpr T getKnudsenNumber() const
constexpr T getLatticeAdeRelaxationFrequency() const
return thermal relaxation frequency in lattice units
void write(std::string const &fileName="AdeUnitConverter") const override
constexpr AdeUnitConverter(T physDeltaX, T physDeltaT, T charPhysLength, T charPhysVelocity, T physDiffusivity, T physDensity)
const T _conversionDiffusivity
constexpr T getLatticeDiffusivity() const
constexpr T getPecletNumber() const
void print() const override
nice terminal output for conversion factors, characteristical and physical data
const T _latticeAdeRelaxationTime
constexpr T getPhysDiffusivity() const
constexpr T getConversionFactorDiffusivity() const
class for marking output with some text
Conversion between physical and lattice units, as well as discretization.
constexpr T getCharPhysLength() const
return characteristic length in physical units
constexpr T getMachNumber() const
return Mach number
constexpr T getCharPhysVelocity() const
return characteristic velocity in physical units
std::string getLogOutDir() const
These functions help you to create file names.
Directories & directories()
Top level namespace for all of OpenLB.
Definition of singletons: global, publicly available information.
Unit conversion handling – header file.
Set of functions commonly used in LB computations – header file.