[Debian-astro-commits] [gyoto] 86/221: Updating ThermalBrems
Thibaut Jean-Claude Paumard
thibaut at moszumanska.debian.org
Fri May 22 20:52:36 UTC 2015
This is an automated email from the git hooks/post-receive script.
thibaut pushed a commit to branch master
in repository gyoto.
commit f1d40ddc477ee70270914e442475a34711b16882
Author: Frederic <frederic at MacFrederic.local>
Date: Fri Nov 7 17:33:04 2014 +0100
Updating ThermalBrems
---
include/GyotoThermalBremsstrahlungSpectrum.h | 41 +++++++++++++++++-
lib/ThermalBremsstrahlungSpectrum.C | 62 ++++++++++++++++++----------
2 files changed, 79 insertions(+), 24 deletions(-)
diff --git a/include/GyotoThermalBremsstrahlungSpectrum.h b/include/GyotoThermalBremsstrahlungSpectrum.h
index 669fc14..feb8bec 100644
--- a/include/GyotoThermalBremsstrahlungSpectrum.h
+++ b/include/GyotoThermalBremsstrahlungSpectrum.h
@@ -51,6 +51,10 @@ class Gyoto::Spectrum::ThermalBremsstrahlung : public Gyoto::Spectrum::Generic {
protected:
SmartPointer<Spectrum::BlackBody> spectrumBB_; ///< blackbody emission
double cst_; ///< Scaling constant
+ double T_; ///< Temperature
+ double Tm1_; ///< 1/T
+ double Tm05_; ///< 1/sqrt(T)
+ double massdensityCGS_; ///< Mass density in CGS UNITS (careful)
public:
ThermalBremsstrahlung();
@@ -61,10 +65,43 @@ class Gyoto::Spectrum::ThermalBremsstrahlung : public Gyoto::Spectrum::Generic {
virtual ThermalBremsstrahlung * clone() const; ///< Cloner
using Gyoto::Spectrum::Generic::operator();
+ /**
+ * This function returns the optically thick Inu
+ * which is not defined here, returns an error
+ *
+ * \param nu frequency in Hz
+ */
virtual double operator()(double nu) const;
+ /**
+ * This function returns the optically thin increment
+ * to intensity dI_nu = j_nu*ds*exp(-alpha_nu*ds)
+ * in SI units
+ *
+ * \param nu frequency in Hz
+ * \param ds length element in SI (careful to this)
+ */
+ virtual double operator()(double nu,double ,double ds) const;
+ // NB: the second argument, opacity in the Spectrum API
+ // is useless here
+
+ double temperature() const;
+ void temperature(double tt);
+ double massdensityCGS() const;
+ void massdensityCGS(double rho);
- double jnu(double nu, double temp,double massdensity);
- double alphanu(double nu, double temp,double massdensity);
+ /**
+ * Returns the emission coefficient j_nu in cgs units
+ * i.e. erg cm^-3 s^-1 ster^-1 Hz^-1
+ *
+ * \param nu frequency in Hz
+ */
+ double jnuCGS(double nu) const;
+ /**
+ * Returns the absorption coefficient alpha_nu in cgs units [cm^-1]
+ *
+ * \param nu frequency in Hz
+ */
+ double alphanuCGS(double nu) const;
#ifdef GYOTO_USE_XERCES
virtual void fillElement(FactoryMessenger *fmp) const ;
diff --git a/lib/ThermalBremsstrahlungSpectrum.C b/lib/ThermalBremsstrahlungSpectrum.C
index f875214..185587a 100644
--- a/lib/ThermalBremsstrahlungSpectrum.C
+++ b/lib/ThermalBremsstrahlungSpectrum.C
@@ -1,21 +1,21 @@
/*
- Copyright 2014 Frederic Vincent
+ Copyright 2014 Frederic Vincent
- This file is part of Gyoto.
+ This file is part of Gyoto.
- Gyoto is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ Gyoto is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- Gyoto is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ Gyoto is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with Gyoto. If not, see <http://www.gnu.org/licenses/>.
- */
+ You should have received a copy of the GNU General Public License
+ along with Gyoto. If not, see <http://www.gnu.org/licenses/>.
+*/
#include "GyotoThermalBremsstrahlungSpectrum.h"
#include "GyotoDefs.h"
@@ -28,7 +28,9 @@
using namespace Gyoto;
Spectrum::ThermalBremsstrahlung::ThermalBremsstrahlung() :
+ T_(10000.), massdensityCGS_(0.),
spectrumBB_(NULL),Spectrum::Generic("ThermalBremsstrahlung") {
+ Tm1_=1./T_; Tm05_=sqrt(Tm1_);
// This awful constant is the constant part of the thermal brems j_nu
cst_ = 1/(4.*M_PI)
*(pow(2.,5)*M_PI*pow(GYOTO_ELEMENTARY_CHARGE_CGS,6))
@@ -38,30 +40,46 @@ Spectrum::ThermalBremsstrahlung::ThermalBremsstrahlung() :
// A BB spectrum is needed to compute alpha_nu=j_nu/BB
spectrumBB_ = new Spectrum::BlackBody();
}
+
+double Spectrum::ThermalBremsstrahlung::temperature() const { return T_; }
+void Spectrum::ThermalBremsstrahlung::temperature(double tt) {
+ T_ = tt; Tm1_=1./T_;
+ spectrumBB_->temperature(T_);
+}
+double Spectrum::ThermalBremsstrahlung::massdensityCGS() const {
+ return massdensityCGS_; }
+void Spectrum::ThermalBremsstrahlung::massdensityCGS(double rho) {
+ massdensityCGS_ = rho; }
Spectrum::ThermalBremsstrahlung * Spectrum::ThermalBremsstrahlung::clone() const
{ return new Spectrum::ThermalBremsstrahlung(*this); }
double Spectrum::ThermalBremsstrahlung::operator()(double nu) const {
- return 0.; // what should this return in opt thin case?
+ throwError("In ThermalBrems: "
+ "Bremsstrahlung emission not defined for optically thick case");
+ return 0.;
+}
+double Spectrum::ThermalBremsstrahlung::operator()(double nu,
+ double ,
+ double ds) const{
+ double dsCGS = ds*100.; // ds should be given in SI
+ // Returns intensity increment in SI:
+ return jnuCGS(nu)*dsCGS*exp(-alphanuCGS(nu)*dsCGS)*GYOTO_INU_CGS_TO_SI;
}
-double Spectrum::ThermalBremsstrahlung::jnu(double nu, double temp,
- double massdensity) {
- return cst_*1./sqrt(temp)*massdensity*massdensity
- *exp(-GYOTO_PLANCK_CGS*nu/(GYOTO_BOLTZMANN_CGS*temp));
+double Spectrum::ThermalBremsstrahlung::jnuCGS(double nu) const{
+ return cst_*Tm05_*massdensityCGS_*massdensityCGS_
+ *exp(-GYOTO_PLANCK_OVER_BOLTZMANN*nu*Tm1_);
}
-double Spectrum::ThermalBremsstrahlung::alphanu(double nu, double temp,
- double massdensity) {
- spectrumBB_->temperature(temp);
+double Spectrum::ThermalBremsstrahlung::alphanuCGS(double nu) const{
double BB=(*spectrumBB_)(nu)/GYOTO_INU_CGS_TO_SI; // B_nu in cgs
if (BB==0.){
throwError("In ThermalBrems: "
"bad temperature");
}
// Kirchhoff's law:
- return jnu(nu,temp,massdensity)/BB;
+ return jnuCGS(nu)/BB;
}
#ifdef GYOTO_USE_XERCES
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-astro/packages/gyoto.git
More information about the Debian-astro-commits
mailing list