Skip to content

Commit

Permalink
Merge pull request #63 from lanl/pdmullen/absorption_coef
Browse files Browse the repository at this point in the history
Modify evaluation of absorption coefficients
  • Loading branch information
Yurlungur authored Jan 17, 2025
2 parents d93837f + 21ca6f0 commit 6ccf891
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ struct FermiDiracDistributionNoMu {
return ThermalNumberDistributionOfT(temp, type, lambda) / pc::c;
}
template <typename Emissivity>
PORTABLE_INLINE_FUNCTION Real AbsorptionCoefficientFromKirkhoff(
PORTABLE_INLINE_FUNCTION Real AbsorptionCoefficientFromKirchhoff(
const Emissivity &J, const Real rho, const Real temp, const Real Ye,
const RadiationType type, const Real nu, Real *lambda = nullptr) const {
const Real Bnu =
Expand All @@ -91,7 +91,7 @@ struct FermiDiracDistributionNoMu {
return singularity_opac::robust::ratio(jnu, Bnu);
}
template <typename Emissivity>
PORTABLE_INLINE_FUNCTION Real AngleAveragedAbsorptionCoefficientFromKirkhoff(
PORTABLE_INLINE_FUNCTION Real AngleAveragedAbsorptionCoefficientFromKirchhoff(
const Emissivity &J, const Real rho, const Real temp, const Real Ye,
const RadiationType type, const Real nu, Real *lambda = nullptr) const {
const Real Bnu =
Expand Down
4 changes: 2 additions & 2 deletions singularity-opac/neutrinos/tophat_emissivity_neutrinos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class TophatEmissivity {
Real AbsorptionCoefficient(const Real rho, const Real temp, const Real Ye,
const RadiationType type, const Real nu,
Real *lambda = nullptr) const {
return dist_.AbsorptionCoefficientFromKirkhoff(*this, rho, temp, Ye, type,
return dist_.AbsorptionCoefficientFromKirchhoff(*this, rho, temp, Ye, type,
nu, lambda) /
(4. * M_PI);
}
Expand All @@ -78,7 +78,7 @@ class TophatEmissivity {
const RadiationType type,
const Real nu,
Real *lambda = nullptr) const {
return dist_.AngleAveragedAbsorptionCoefficientFromKirkhoff(
return dist_.AngleAveragedAbsorptionCoefficientFromKirchhoff(
*this, rho, temp, Ye, type, nu, lambda);
}

Expand Down
4 changes: 2 additions & 2 deletions singularity-opac/photons/epbremsstrahlung_opacity_photons.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class EPBremsstrahlungOpacity {
PORTABLE_INLINE_FUNCTION
Real AbsorptionCoefficient(const Real rho, const Real temp, const Real nu,
Real *lambda = nullptr) const {
return dist_.AbsorptionCoefficientFromKirkhoff(*this, rho, temp, nu,
return dist_.AbsorptionCoefficientFromKirchhoff(*this, rho, temp, nu,
lambda);
}

Expand All @@ -71,7 +71,7 @@ class EPBremsstrahlungOpacity {
Real AngleAveragedAbsorptionCoefficient(const Real rho, const Real temp,
const Real nu,
Real *lambda = nullptr) const {
return dist_.AngleAveragedAbsorptionCoefficientFromKirkhoff(
return dist_.AngleAveragedAbsorptionCoefficientFromKirchhoff(
*this, rho, temp, nu, lambda);
}

Expand Down
6 changes: 2 additions & 4 deletions singularity-opac/photons/gray_opacity_photons.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ class GrayOpacity {
PORTABLE_INLINE_FUNCTION
Real AbsorptionCoefficient(const Real rho, const Real temp, const Real nu,
Real *lambda = nullptr) const {
return dist_.AbsorptionCoefficientFromKirkhoff(*this, rho, temp, nu,
lambda);
return rho * kappa_;
}

template <typename FrequencyIndexer, typename DataIndexer>
Expand All @@ -67,8 +66,7 @@ class GrayOpacity {
Real AngleAveragedAbsorptionCoefficient(const Real rho, const Real temp,
const Real nu,
Real *lambda = nullptr) const {
return dist_.AngleAveragedAbsorptionCoefficientFromKirkhoff(
*this, rho, temp, nu, lambda);
return AbsorptionCoefficient(rho, temp, nu, lambda);
}

template <typename FrequencyIndexer, typename DataIndexer>
Expand Down
6 changes: 2 additions & 4 deletions singularity-opac/photons/powerlaw_opacity_photons.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ class PowerLawOpacity {
PORTABLE_INLINE_FUNCTION
Real AbsorptionCoefficient(const Real rho, const Real temp, const Real nu,
Real *lambda = nullptr) const {
return dist_.AbsorptionCoefficientFromKirkhoff(*this, rho, temp, nu,
lambda);
return rho * (kappa0_ * std::pow(rho, rho_exp_) * std::pow(temp, temp_exp_));
}

template <typename FrequencyIndexer, typename DataIndexer>
Expand All @@ -70,8 +69,7 @@ class PowerLawOpacity {
Real AngleAveragedAbsorptionCoefficient(const Real rho, const Real temp,
const Real nu,
Real *lambda = nullptr) const {
return dist_.AngleAveragedAbsorptionCoefficientFromKirkhoff(
*this, rho, temp, nu, lambda);
return AbsorptionCoefficient(rho, temp, nu, lambda);
}

template <typename FrequencyIndexer, typename DataIndexer>
Expand Down
4 changes: 2 additions & 2 deletions singularity-opac/photons/thermal_distributions_photons.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ struct PlanckDistribution {
return ThermalNumberDistributionOfT(temp, lambda) / pc::c;
}
template <typename Emissivity>
PORTABLE_INLINE_FUNCTION Real AbsorptionCoefficientFromKirkhoff(
PORTABLE_INLINE_FUNCTION Real AbsorptionCoefficientFromKirchhoff(
const Emissivity &J, const Real rho, const Real temp, const Real nu,
Real *lambda = nullptr) const {
Real Bnu = ThermalDistributionOfTNu(temp, nu, lambda);
Real jnu = J.EmissivityPerNuOmega(rho, temp, nu, lambda);
return singularity_opac::robust::ratio(jnu, Bnu);
}
template <typename Emissivity>
PORTABLE_INLINE_FUNCTION Real AngleAveragedAbsorptionCoefficientFromKirkhoff(
PORTABLE_INLINE_FUNCTION Real AngleAveragedAbsorptionCoefficientFromKirchhoff(
const Emissivity &J, const Real rho, const Real temp, const Real nu,
Real *lambda = nullptr) const {
Real Bnu = ThermalDistributionOfTNu(temp, nu, lambda);
Expand Down

0 comments on commit 6ccf891

Please sign in to comment.