28#ifndef RADIATIVEUNITCONVERTER_H
29#define RADIATIVEUNITCONVERTER_H
42double getThetaRefracted(
double const& thetaIncident,
double const& refractiveRelative);
44double R_phi_diff (
double const& theta,
double const& refractiveRelative);
45double R_j_diff (
double const& theta,
double const& refractiveRelative);
48double getPartialBBCoefficient(
double const& latticeDiffusionCoefficient,
double const& relativeRefractiveIndex );
51template<
typename T,
typename DESCRIPTOR>
class RadiativeUnitConverter;
54template <
typename T,
typename DESCRIPTOR>
61template <
typename T,
typename DESCRIPTOR>
74template <
typename T,
typename DESCRIPTOR>
83 constexpr RadiativeUnitConverter(
int resolution, T latticeRelaxationTime, T physAbsorption, T physScattering, T anisotropyFactor=0, T charPhysLength=1, T refractiveMedia=1, T refractiveAmbient=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),
101 return _physAbsorption;
106 return _physScattering;
111 return _anisotropyFactor;
121 return _scatteringAlbedo;
126 return _physDiffusion;
131 return _effectiveAttenuation;
136 return _latticeAbsorption;
141 return _latticeScattering;
146 return _latticeDiffusion;
151 return _refractiveRelative;
154 void print()
const override;
155 void print(std::ostream& fout)
const;
161 double _physAbsorption;
162 double _physScattering;
163 double _anisotropyFactor;
165 double _scatteringAlbedo;
166 double _physDiffusion;
167 double _effectiveAttenuation;
169 double _refractiveRelative;
171 double _latticeAbsorption;
172 double _latticeScattering;
173 double _latticeDiffusion;
176template <
typename T,
class DESCRIPTOR>
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;
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;
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;
210template <
typename T,
class DESCRIPTOR>
216template <
typename T,
class DESCRIPTOR>
221 std::ofstream fout(dataFile.c_str(), std::ios::trunc);
223 clout <<
"error write() function: can not open std::ofstream" << std::endl;
237 double thetaRefracted =
M_PI/2.;
238 if ( refractiveRelative *
util::sin(thetaIncident) < 1 ) {
241 return thetaRefracted;
254double R_phi_diff (
double const& theta,
double const& refractiveRelative)
259double R_j_diff (
double const& theta,
double const& refractiveRelative)
267 double h = (
M_PI / 2.) /
double(N);
270 for (
int i = 0; i < N; i++) {
271 R_phi += h*(
R_phi_diff(0.5*h + h*i,refractiveRelative));
272 R_j += h*(
R_j_diff (0.5*h + h*i,refractiveRelative));
274 double R_eff = (R_phi + R_j) / (2 - R_phi + R_j);
275 return (1 + R_eff) / (1 - R_eff);
281 return 2 - 2/(4*latticeDiffusionCoefficient*C_R +1);
class for marking output with some text
Conversion between physical and lattice units, as well as discretization.
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 getLatticeScattering() const
void print() const override
nice terminal output for conversion factors, characteristical and physical data
constexpr T getAnisotropyFactor() const
constexpr T getScatteringAlbedo() const
constexpr T getPhysScattering() const
constexpr T getEffectiveAttenuation() const
constexpr T getLatticeDiffusion() const
constexpr T getPhysAbsorption() const
constexpr T getRefractiveRelative() const
constexpr T getLatticeAbsorption() const
constexpr T getPhysDiffusion() const
constexpr T getExtinction() const
constexpr T getConversionFactorLength() const
access (read-only) to private member variable
std::string getLogOutDir() const
Directories & directories()
ADf< T, DIM > sin(const ADf< T, DIM > &a)
ADf< T, DIM > asin(const ADf< T, DIM > &a)
cpu::simd::Pack< T > pow(cpu::simd::Pack< T > base, cpu::simd::Pack< T > exp)
ADf< T, DIM > cos(const ADf< T, DIM > &a)
Top level namespace for all of OpenLB.
double getThetaRefracted(double const &thetaIncident, double const &refractiveRelative)
Documentation of implemented functions found in 5.2.2 Biomedical Optics, Principles and Imaging; Wang...
double getPartialBBCoefficient(double const &latticeDiffusionCoefficient, double const &relativeRefractiveIndex)
double R_j_diff(double const &theta, double const &refractiveRelative)
double getFresnelFunction(double const &theta, double const &refractiveRelative)
double getRefractionFunction(const double &refractiveRelative)
double R_phi_diff(double const &theta, double const &refractiveRelative)
Definition of singletons: global, publicly available information.
Unit conversion handling – header file.