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

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

#include <radiativeUnitConverter.h>

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

Public Member Functions

constexpr RadiativeUnitConverter (int resolution, T latticeRelaxationTime, T physAbsorption, T physScattering, T anisotropyFactor=0, T charPhysLength=1, T refractiveMedia=1, T refractiveAmbient=1)
 Documentation of constructor:
 
constexpr T getPhysAbsorption () const
 
constexpr T getPhysScattering () const
 
constexpr T getAnisotropyFactor () const
 
constexpr T getExtinction () const
 
constexpr T getScatteringAlbedo () const
 
constexpr T getPhysDiffusion () const
 
constexpr T getEffectiveAttenuation () const
 
constexpr T getLatticeAbsorption () const
 
constexpr T getLatticeScattering () const
 
constexpr T getLatticeDiffusion () const
 
constexpr T getRefractiveRelative () const
 
void print () const override
 nice terminal output for conversion factors, characteristical and physical data
 
void print (std::ostream &fout) const
 
void write () const
 
- Public Member Functions inherited from olb::UnitConverterFromResolutionAndRelaxationTime< T, DESCRIPTOR >
constexpr UnitConverterFromResolutionAndRelaxationTime (size_t resolution, T latticeRelaxationTime, T charPhysLength, T charPhysVelocity, T physViscosity, T physDensity, T charPhysPressure=0)
 
- 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
 

Additional Inherited Members

- 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::RadiativeUnitConverter< 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

Definition at line 75 of file radiativeUnitConverter.h.

Constructor & Destructor Documentation

◆ RadiativeUnitConverter()

template<typename T , typename DESCRIPTOR >
constexpr olb::RadiativeUnitConverter< T, DESCRIPTOR >::RadiativeUnitConverter ( int resolution,
T latticeRelaxationTime,
T physAbsorption,
T physScattering,
T anisotropyFactor = 0,
T charPhysLength = 1,
T refractiveMedia = 1,
T refractiveAmbient = 1 )
inlineconstexpr

Documentation of constructor:

Parameters
resolutionis number of voxel per 1 meter
latticeRelaxationTimesee class UnitConverterFromResolutionAndRelaxationTime
physAbsorptionphysical absorption in 1/meter
physScatteringphysical scattering in 1/meter

Definition at line 83 of file radiativeUnitConverter.h.

84 : UnitConverterFromResolutionAndRelaxationTime<T, DESCRIPTOR>( resolution, latticeRelaxationTime, charPhysLength, /*visc*/ 1./(3*(physAbsorption+physScattering)), T(1), T(1) ),
85 clout(std::cout, "RadiativeUnitConverter"),
86 _physAbsorption(physAbsorption),
87 _physScattering(physScattering),
88 _anisotropyFactor(anisotropyFactor),
89 _extinction( physAbsorption+physScattering ),
90 _scatteringAlbedo( physScattering/(physAbsorption+physScattering) ),
91 _physDiffusion( 1.0 / (3.0*(physAbsorption+physScattering)) ),
92 _effectiveAttenuation( util::sqrt(3*physAbsorption*(physAbsorption+physScattering)) ),
93 _refractiveRelative(refractiveMedia/refractiveAmbient),
94 _latticeAbsorption( physAbsorption*this->getConversionFactorLength() ),
95 _latticeScattering( physScattering*this->getConversionFactorLength() ),
96 _latticeDiffusion(_physDiffusion/this->getConversionFactorLength())
97 { };
constexpr T getConversionFactorLength() const
access (read-only) to private member variable
cpu::simd::Pack< T > sqrt(cpu::simd::Pack< T > value)
Definition pack.h:100

Member Function Documentation

◆ getAnisotropyFactor()

template<typename T , typename DESCRIPTOR >
constexpr T olb::RadiativeUnitConverter< T, DESCRIPTOR >::getAnisotropyFactor ( ) const
inlineconstexpr

Definition at line 109 of file radiativeUnitConverter.h.

110 {
111 return _anisotropyFactor;
112 };

◆ getEffectiveAttenuation()

template<typename T , typename DESCRIPTOR >
constexpr T olb::RadiativeUnitConverter< T, DESCRIPTOR >::getEffectiveAttenuation ( ) const
inlineconstexpr

Definition at line 129 of file radiativeUnitConverter.h.

130 {
131 return _effectiveAttenuation;
132 };

◆ getExtinction()

template<typename T , typename DESCRIPTOR >
constexpr T olb::RadiativeUnitConverter< T, DESCRIPTOR >::getExtinction ( ) const
inlineconstexpr

Definition at line 114 of file radiativeUnitConverter.h.

115 {
116 return _extinction;
117 };

◆ getLatticeAbsorption()

template<typename T , typename DESCRIPTOR >
constexpr T olb::RadiativeUnitConverter< T, DESCRIPTOR >::getLatticeAbsorption ( ) const
inlineconstexpr

Definition at line 134 of file radiativeUnitConverter.h.

135 {
136 return _latticeAbsorption;
137 };

◆ getLatticeDiffusion()

template<typename T , typename DESCRIPTOR >
constexpr T olb::RadiativeUnitConverter< T, DESCRIPTOR >::getLatticeDiffusion ( ) const
inlineconstexpr

Definition at line 144 of file radiativeUnitConverter.h.

145 {
146 return _latticeDiffusion;
147 };
+ Here is the caller graph for this function:

◆ getLatticeScattering()

template<typename T , typename DESCRIPTOR >
constexpr T olb::RadiativeUnitConverter< T, DESCRIPTOR >::getLatticeScattering ( ) const
inlineconstexpr

Definition at line 139 of file radiativeUnitConverter.h.

140 {
141 return _latticeScattering;
142 };

◆ getPhysAbsorption()

template<typename T , typename DESCRIPTOR >
constexpr T olb::RadiativeUnitConverter< T, DESCRIPTOR >::getPhysAbsorption ( ) const
inlineconstexpr

Definition at line 99 of file radiativeUnitConverter.h.

100 {
101 return _physAbsorption;
102 };

◆ getPhysDiffusion()

template<typename T , typename DESCRIPTOR >
constexpr T olb::RadiativeUnitConverter< T, DESCRIPTOR >::getPhysDiffusion ( ) const
inlineconstexpr

Definition at line 124 of file radiativeUnitConverter.h.

125 {
126 return _physDiffusion;
127 };

◆ getPhysScattering()

template<typename T , typename DESCRIPTOR >
constexpr T olb::RadiativeUnitConverter< T, DESCRIPTOR >::getPhysScattering ( ) const
inlineconstexpr

Definition at line 104 of file radiativeUnitConverter.h.

105 {
106 return _physScattering;
107 };

◆ getRefractiveRelative()

template<typename T , typename DESCRIPTOR >
constexpr T olb::RadiativeUnitConverter< T, DESCRIPTOR >::getRefractiveRelative ( ) const
inlineconstexpr

Definition at line 149 of file radiativeUnitConverter.h.

150 {
151 return _refractiveRelative;
152 };
+ Here is the caller graph for this function:

◆ getScatteringAlbedo()

template<typename T , typename DESCRIPTOR >
constexpr T olb::RadiativeUnitConverter< T, DESCRIPTOR >::getScatteringAlbedo ( ) const
inlineconstexpr

Definition at line 119 of file radiativeUnitConverter.h.

120 {
121 return _scatteringAlbedo;
122 };

◆ print() [1/2]

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

nice terminal output for conversion factors, characteristical and physical data

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

Definition at line 211 of file radiativeUnitConverter.h.

212{
213 print(clout);
214}
void print() const override
nice terminal output for conversion factors, characteristical and physical data

◆ print() [2/2]

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

Implements olb::UnitConverterBase.

Definition at line 177 of file radiativeUnitConverter.h.

178{
179 clout << "----------------- UnitConverter information -----------------" << std::endl;
180 clout << "-- Parameters:" << std::endl;
181 clout << "Resolution: N= " << this->getResolution() << std::endl;
182 clout << "Lattice relaxation frequency: omega= " << this->getLatticeRelaxationFrequency() << std::endl;
183 clout << "Lattice relaxation time: tau= " << this->getLatticeRelaxationTime() << std::endl;
184 clout << "Characteristical length(m): charL= " << this->getCharPhysLength() << std::endl;
185 clout << "Phys. density(kg/m^d): charRho= " << this->getPhysDensity() << std::endl;
186 clout << "Phys. absorption(1/m): mu_a= " << getPhysAbsorption() << std::endl;
187 clout << "Phys. scattering(1/m): mu_s= " << getPhysScattering() << std::endl;
188 clout << "Extinction(1/m): mu_t= " << getExtinction() << std::endl;
189 clout << "Effective attenuation(1/m): mu_eff= " << getEffectiveAttenuation() << std::endl;
190 clout << "Phys. diffusion(m): D= " << getPhysDiffusion() << std::endl;
191 clout << "Single scattering albedo: albedo= " << getScatteringAlbedo() << std::endl;
192 clout << "Anisotropy factor: g= " << getAnisotropyFactor() << std::endl;
193
194 clout << std::endl;
195 clout << "Lattice diffusion: D^*= " << getLatticeDiffusion() << std::endl;
196 clout << "Lattice absorption: absorption= " << getLatticeAbsorption() << std::endl;
197 clout << "Lattice scattering: scattering= " << getLatticeScattering() << std::endl;
198 clout << "Lattice sink: sink= " << 3./8.*getLatticeAbsorption()*(getLatticeScattering()+getLatticeAbsorption()) << std::endl;
199 clout << "C_R: " << getRefractionFunction(getRefractiveRelative()) << std::endl;
200 clout << "r_F: " << getPartialBBCoefficient(getLatticeDiffusion(),getRefractiveRelative()) << std::endl;
201
202 clout << std::endl;
203 clout << "-- Conversion factors:" << std::endl;
204 clout << "Voxel length(m): physDeltaX= " << this->getConversionFactorLength() << std::endl;
205 clout << "Time step(s): physDeltaT= " << this->getConversionFactorTime() << std::endl;
206 clout << "Density factor(kg/m^3): physDensity= " << this->getConversionFactorDensity() << std::endl;
207 clout << "-------------------------------------------------------------" << std::endl;
208}
constexpr T getEffectiveAttenuation() const
constexpr T getRefractiveRelative() const
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 getConversionFactorTime() const
access (read-only) to private member variable
constexpr T getLatticeRelaxationTime() const
return relaxation time in lattice units
double getPartialBBCoefficient(double const &latticeDiffusionCoefficient, double const &relativeRefractiveIndex)
double getRefractionFunction(const double &refractiveRelative)

References olb::getPartialBBCoefficient(), and olb::getRefractionFunction().

+ Here is the call graph for this function:

◆ write()

template<typename T , class DESCRIPTOR >
void olb::RadiativeUnitConverter< T, DESCRIPTOR >::write ( ) const

Definition at line 217 of file radiativeUnitConverter.h.

218{
219 std::string dataFile = singleton::directories().getLogOutDir() + "radiativeUnitConverter.dat";
220 if (singleton::mpi().isMainProcessor()) {
221 std::ofstream fout(dataFile.c_str(), std::ios::trunc);
222 if (!fout) {
223 clout << "error write() function: can not open std::ofstream" << std::endl;
224 }
225 else {
226 print( fout );
227 fout.close();
228 }
229 }
230
231}
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:

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