Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify evaluation of absorption coefficients #63

Merged
merged 2 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops thank you for the spelling fix...

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_;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

}

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
Loading