[Debian-astro-commits] [gyoto] 85/221: Adding Thermal Bremsstrahlung spectrum
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 579960ae455c568a1678325a02198b7c8f478ebb
Author: Frederic <frederic at MacFrederic.local>
Date: Fri Nov 7 13:32:32 2014 +0100
Adding Thermal Bremsstrahlung spectrum
---
include/GyotoThermalBremsstrahlungSpectrum.h | 74 ++++++++++++++++++++++++++++
lib/Makefile.am | 1 +
lib/StdPlug.C | 3 ++
lib/ThermalBremsstrahlungSpectrum.C | 72 +++++++++++++++++++++++++++
4 files changed, 150 insertions(+)
diff --git a/include/GyotoThermalBremsstrahlungSpectrum.h b/include/GyotoThermalBremsstrahlungSpectrum.h
new file mode 100644
index 0000000..669fc14
--- /dev/null
+++ b/include/GyotoThermalBremsstrahlungSpectrum.h
@@ -0,0 +1,74 @@
+/**
+ * \file GyotoThermalBremsstrahlungSpectrum.h
+ * \brief Thermal brems spectrum
+ *
+ */
+
+/*
+ Copyright 2014 Frederic Vincent
+
+ 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 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/>.
+ */
+
+#ifndef __GyotoThermalBremsstrahlungSpectrum_H_
+#define __GyotoThermalBremsstrahlungSpectrum_H_
+#include "GyotoSpectrum.h"
+#include <GyotoBlackBodySpectrum.h>
+
+namespace Gyoto {
+ namespace Spectrum {
+ class ThermalBremsstrahlung;
+ }
+}
+
+/**
+ * \class Gyoto::Spectrum::ThermalBremsstrahlung
+ * \brief Thermal brems spectrum
+ *
+ *
+ * Example XML entity:
+ * \code
+ * <Spectrum kind="ThermalBremsstrahlung">
+ * </Spectrum>
+ * \endcode
+ *
+ */
+class Gyoto::Spectrum::ThermalBremsstrahlung : public Gyoto::Spectrum::Generic {
+ friend class Gyoto::SmartPointer<Gyoto::Spectrum::ThermalBremsstrahlung>;
+ protected:
+ SmartPointer<Spectrum::BlackBody> spectrumBB_; ///< blackbody emission
+ double cst_; ///< Scaling constant
+
+ public:
+ ThermalBremsstrahlung();
+
+ /**
+ * \brief Constructor setting T_ and cst_
+ */
+ virtual ThermalBremsstrahlung * clone() const; ///< Cloner
+
+ using Gyoto::Spectrum::Generic::operator();
+ virtual double operator()(double nu) const;
+
+ double jnu(double nu, double temp,double massdensity);
+ double alphanu(double nu, double temp,double massdensity);
+
+#ifdef GYOTO_USE_XERCES
+ virtual void fillElement(FactoryMessenger *fmp) const ;
+#endif
+};
+
+#endif
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 676e1c0..0007040 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -28,6 +28,7 @@ sover_LTLIBRARIES = libgyoto-stdplug.la
libgyoto_stdplug_la_SOURCES = KerrBL.C KerrKS.C Minkowski.C \
Star.C StarTrace.C FixedStar.C Torus.C \
PowerLawSpectrum.C BlackBodySpectrum.C \
+ ThermalBremsstrahlungSpectrum.C \
ComplexAstrobj.C UniformSphere.C \
StandardAstrobj.C PageThorneDisk.C \
ThinDiskPL.C PolishDoughnut.C ThinDiskIronLine.C\
diff --git a/lib/StdPlug.C b/lib/StdPlug.C
index 9d82f09..f1746fa 100644
--- a/lib/StdPlug.C
+++ b/lib/StdPlug.C
@@ -43,6 +43,7 @@
// include Spectrum headers
#include "GyotoPowerLawSpectrum.h"
#include "GyotoBlackBodySpectrum.h"
+#include "GyotoThermalBremsstrahlungSpectrum.h"
using namespace Gyoto;
@@ -83,4 +84,6 @@ extern "C" void __GyotostdplugInit() {
&(Spectrum::Subcontractor<Spectrum::PowerLaw>));
Spectrum::Register("BlackBody",
&(Spectrum::Subcontractor<Spectrum::BlackBody>));
+ Spectrum::Register("ThermalBremsstrahlung",
+ &(Spectrum::Subcontractor<Spectrum::ThermalBremsstrahlung>));
}
diff --git a/lib/ThermalBremsstrahlungSpectrum.C b/lib/ThermalBremsstrahlungSpectrum.C
new file mode 100644
index 0000000..f875214
--- /dev/null
+++ b/lib/ThermalBremsstrahlungSpectrum.C
@@ -0,0 +1,72 @@
+/*
+ Copyright 2014 Frederic Vincent
+
+ 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 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/>.
+ */
+
+#include "GyotoThermalBremsstrahlungSpectrum.h"
+#include "GyotoDefs.h"
+#include <cmath>
+#include <cstdlib> /* atof */
+#ifdef GYOTO_USE_XERCES
+#include "GyotoFactory.h"
+#include "GyotoFactoryMessenger.h"
+#endif
+using namespace Gyoto;
+
+Spectrum::ThermalBremsstrahlung::ThermalBremsstrahlung() :
+ spectrumBB_(NULL),Spectrum::Generic("ThermalBremsstrahlung") {
+ // 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))
+ /(3.*GYOTO_ELECTRON_MASS_CGS*pow(GYOTO_C_CGS,3))
+ *sqrt(2*M_PI/(3.*GYOTO_BOLTZMANN_CGS*GYOTO_ELECTRON_MASS_CGS))
+ *1./pow(GYOTO_ATOMIC_MASS_UNIT_CGS,2);
+ // A BB spectrum is needed to compute alpha_nu=j_nu/BB
+ spectrumBB_ = new Spectrum::BlackBody();
+}
+
+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?
+}
+
+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::alphanu(double nu, double temp,
+ double massdensity) {
+ spectrumBB_->temperature(temp);
+ 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;
+}
+
+#ifdef GYOTO_USE_XERCES
+void Spectrum::ThermalBremsstrahlung::fillElement(FactoryMessenger *fmp) const {
+ Spectrum::Generic::fillElement(fmp);
+}
+
+#endif
--
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