[879] | 1 | //--------------------------------------------------------------------------
|
---|
| 2 | // File and Version Information:
|
---|
[2615] | 3 | // $Id: derivblackbody.cc,v 1.7 2004-09-10 09:54:40 cmv Exp $
|
---|
[879] | 4 | //
|
---|
| 5 | // Description:
|
---|
| 6 | // Aim of the class: To give the derivative spectrum
|
---|
| 7 | // The unity used here is W/m^2/Hz/sr
|
---|
| 8 | //
|
---|
| 9 | // History (add to end):
|
---|
| 10 | // Sophie Oct, 1999 - creation
|
---|
| 11 | //
|
---|
| 12 | //------------------------------------------------------------------------
|
---|
| 13 |
|
---|
| 14 | //---------------
|
---|
| 15 | // C++ Headers --
|
---|
| 16 | //---------------
|
---|
[2615] | 17 | #include "sopnamsp.h"
|
---|
[879] | 18 | #include "machdefs.h"
|
---|
[2322] | 19 | #include <iostream>
|
---|
[879] | 20 | #include <math.h>
|
---|
| 21 | #include "derivblackbody.h"
|
---|
| 22 |
|
---|
[909] | 23 |
|
---|
| 24 |
|
---|
[927] | 25 | /*! \class SOPHYA::DerivBlackBody
|
---|
| 26 | \ingroup SkyT
|
---|
[909] | 27 | * This class corresponds to the emission spectrum of a
|
---|
| 28 | * dipole (since its emission spectrum is the derivation
|
---|
| 29 | * of a blackbody spectrum wrt the temperature).
|
---|
| 30 | */
|
---|
| 31 |
|
---|
| 32 | /*! Constructor: needs a temperature. Otherwise set to ConvTools::tcmb */
|
---|
[879] | 33 | DerivBlackBody::DerivBlackBody(double temperature)
|
---|
| 34 | : RadSpectra(10., 10000.)
|
---|
| 35 | {
|
---|
| 36 | _temperature = temperature;
|
---|
| 37 | }
|
---|
| 38 |
|
---|
| 39 |
|
---|
| 40 | DerivBlackBody::~DerivBlackBody()
|
---|
| 41 | {
|
---|
| 42 | }
|
---|
| 43 |
|
---|
[909] | 44 | /*!
|
---|
| 45 | The flux function is the derivation of the BlackBody
|
---|
| 46 | flux function wrt the temperature (used e.g. for a Dipole)
|
---|
| 47 | \f[
|
---|
| 48 | I_\nu = {2 h_{pl} (1.10^9*\nu)^3 {h_{pl}1.10^9*\nu \over k T^2}
|
---|
| 49 | {e^{{h_{pl}(1.10^9*\nu) \over kT}}\over c^2 (e^{{h_{pl}(1.10^9*\nu) \over kT}} -1)^2}}
|
---|
| 50 | \f]
|
---|
| 51 | */
|
---|
[879] | 52 | double
|
---|
| 53 | DerivBlackBody::flux(double nu) const
|
---|
| 54 | {
|
---|
| 55 | if(nu < -1.e99) nu = -1.e99;
|
---|
| 56 | if(nu > 1.e99) nu = 1.e99;
|
---|
| 57 | double temperature = getTemperature();
|
---|
| 58 | if(nu==0.) return 0.;
|
---|
| 59 | double hpl = ConvTools::hpl;
|
---|
| 60 | double cel = ConvTools::cel;
|
---|
| 61 | double kb = ConvTools::kb;
|
---|
[2144] | 62 | double puiss1 = nu*pow(10.,9);
|
---|
[879] | 63 | if(puiss1 > 1.e99) puiss1=1.e99;
|
---|
| 64 | if(puiss1 < -1.e99) puiss1=-1.e99;
|
---|
[2144] | 65 | double puiss2 = hpl*nu*pow(10.,9)/(kb*temperature);
|
---|
[879] | 66 | if(puiss2 > 1.e99) puiss2=1.e99;
|
---|
| 67 | if(puiss2 < -1.e99) puiss2=-1.e99;
|
---|
| 68 |
|
---|
| 69 | double result=
|
---|
| 70 | (2*hpl* pow( puiss1 ,3))*(hpl*puiss1/kb)*(1/(temperature*temperature))
|
---|
| 71 | *exp(puiss2)
|
---|
| 72 | /(pow(cel,2)*pow(( (exp(puiss2)-1)),2));
|
---|
[893] | 73 | // result = 1500e3*result/400e6;
|
---|
[879] | 74 | return result;
|
---|
| 75 | }
|
---|
| 76 |
|
---|
| 77 |
|
---|
| 78 | void
|
---|
| 79 | DerivBlackBody::Print(ostream& os) const
|
---|
| 80 | {
|
---|
| 81 | os << "DerivBlackBody::Print Temp= " << getTemperature()
|
---|
| 82 | << " - Fmin,Fmax= " << minFreq() << "," << maxFreq() << endl;
|
---|
| 83 | os << "MeanFreq= " << meanFreq() << " Emission= " << flux(meanFreq()) << endl;
|
---|
| 84 | os << "PeakFreq= " << peakFreq() << " Emission= " << flux(peakFreq()) << endl;
|
---|
| 85 |
|
---|
| 86 | }
|
---|
| 87 |
|
---|
| 88 | /*
|
---|
| 89 | void
|
---|
| 90 | DerivBlackBody::WriteSelf(POutPersist& s)
|
---|
| 91 | {
|
---|
| 92 | s.PutR8(this->getTemperature());
|
---|
| 93 | s.PutR8(this->minFreq());
|
---|
| 94 | s.PutR8(this->maxFreq());
|
---|
| 95 | }
|
---|
| 96 |
|
---|
| 97 | void
|
---|
| 98 | DerivBlackBody::ReadSelf(PInPersist& s)
|
---|
| 99 | {
|
---|
| 100 | s.GetR8(_temperature);
|
---|
| 101 | s.GetR8(_numin);
|
---|
| 102 | s.GetR8(_numax);
|
---|
| 103 | cout << " Temperature - minFreq - maxFreq " << endl;
|
---|
| 104 | cout << _temperature << "-" << _numin << "-" << _numax << endl;
|
---|
| 105 | }
|
---|
| 106 |
|
---|
| 107 | */
|
---|