From 64f970da8329e9e48eeef2d82e11a612a66debda Mon Sep 17 00:00:00 2001 From: Patrick Mullen Date: Thu, 16 Jan 2025 08:56:09 -0500 Subject: [PATCH 1/2] Do not evaluate absorption coefficient via Kirkhoff --- singularity-opac/photons/gray_opacity_photons.hpp | 6 ++---- singularity-opac/photons/powerlaw_opacity_photons.hpp | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/singularity-opac/photons/gray_opacity_photons.hpp b/singularity-opac/photons/gray_opacity_photons.hpp index a22a0f7..d0fa891 100644 --- a/singularity-opac/photons/gray_opacity_photons.hpp +++ b/singularity-opac/photons/gray_opacity_photons.hpp @@ -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 @@ -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 diff --git a/singularity-opac/photons/powerlaw_opacity_photons.hpp b/singularity-opac/photons/powerlaw_opacity_photons.hpp index c971eea..4a55177 100644 --- a/singularity-opac/photons/powerlaw_opacity_photons.hpp +++ b/singularity-opac/photons/powerlaw_opacity_photons.hpp @@ -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 @@ -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 From 21ca6f07a90d2bb171678a2e0ee678024dc23113 Mon Sep 17 00:00:00 2001 From: Patrick Mullen Date: Thu, 16 Jan 2025 09:13:50 -0500 Subject: [PATCH 2/2] Fix spelling mistake --- .../neutrinos/thermal_distributions_neutrinos.hpp | 4 ++-- singularity-opac/neutrinos/tophat_emissivity_neutrinos.hpp | 4 ++-- singularity-opac/photons/epbremsstrahlung_opacity_photons.hpp | 4 ++-- singularity-opac/photons/thermal_distributions_photons.hpp | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/singularity-opac/neutrinos/thermal_distributions_neutrinos.hpp b/singularity-opac/neutrinos/thermal_distributions_neutrinos.hpp index 58cfe38..c31b046 100644 --- a/singularity-opac/neutrinos/thermal_distributions_neutrinos.hpp +++ b/singularity-opac/neutrinos/thermal_distributions_neutrinos.hpp @@ -81,7 +81,7 @@ struct FermiDiracDistributionNoMu { return ThermalNumberDistributionOfT(temp, type, lambda) / pc::c; } template - 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 = @@ -91,7 +91,7 @@ struct FermiDiracDistributionNoMu { return singularity_opac::robust::ratio(jnu, Bnu); } template - 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 = diff --git a/singularity-opac/neutrinos/tophat_emissivity_neutrinos.hpp b/singularity-opac/neutrinos/tophat_emissivity_neutrinos.hpp index a63e325..25df1e9 100644 --- a/singularity-opac/neutrinos/tophat_emissivity_neutrinos.hpp +++ b/singularity-opac/neutrinos/tophat_emissivity_neutrinos.hpp @@ -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); } @@ -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); } diff --git a/singularity-opac/photons/epbremsstrahlung_opacity_photons.hpp b/singularity-opac/photons/epbremsstrahlung_opacity_photons.hpp index 1c85da5..04961cc 100644 --- a/singularity-opac/photons/epbremsstrahlung_opacity_photons.hpp +++ b/singularity-opac/photons/epbremsstrahlung_opacity_photons.hpp @@ -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); } @@ -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); } diff --git a/singularity-opac/photons/thermal_distributions_photons.hpp b/singularity-opac/photons/thermal_distributions_photons.hpp index 8c4d888..1df7a4f 100644 --- a/singularity-opac/photons/thermal_distributions_photons.hpp +++ b/singularity-opac/photons/thermal_distributions_photons.hpp @@ -74,7 +74,7 @@ struct PlanckDistribution { return ThermalNumberDistributionOfT(temp, lambda) / pc::c; } template - 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); @@ -82,7 +82,7 @@ struct PlanckDistribution { return singularity_opac::robust::ratio(jnu, Bnu); } template - 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);