[601] | 1 | //--------------------------------------------------------------------------
|
---|
| 2 | // File and Version Information:
|
---|
[607] | 3 | // $Id: blackbody.cc,v 1.2 1999-11-20 21:00:47 ansari Exp $
|
---|
[601] | 4 | //
|
---|
| 5 | // Description:
|
---|
| 6 | // Aim of the class: To give the energy density for a blackbody
|
---|
| 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 | //---------------
|
---|
| 17 | #include "machdefs.h"
|
---|
| 18 | #include <iostream.h>
|
---|
| 19 | #include <math.h>
|
---|
| 20 | #include "blackbody.h"
|
---|
| 21 |
|
---|
| 22 | //----------------
|
---|
| 23 | // Constructor --
|
---|
| 24 | //----------------
|
---|
| 25 | BlackBody::BlackBody(double temperature)
|
---|
| 26 | : RadSpectra(0., 10000.)
|
---|
| 27 | {
|
---|
| 28 | _temperature = temperature;
|
---|
| 29 | }
|
---|
| 30 |
|
---|
| 31 |
|
---|
| 32 | BlackBody::~BlackBody()
|
---|
| 33 | {
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 |
|
---|
| 37 | double
|
---|
| 38 | BlackBody::flux(double nu) const
|
---|
| 39 | {
|
---|
| 40 | if(nu < -1.e99) nu = -1.e99;
|
---|
| 41 | if(nu > 1.e99) nu = 1.e99;
|
---|
| 42 | double temperature = getTemperature();
|
---|
| 43 | if(nu==0.) return 0.;
|
---|
| 44 | double hpl = ConvTools::hpl;
|
---|
| 45 | double cel = ConvTools::cel;
|
---|
| 46 | double kb = ConvTools::kb;
|
---|
| 47 | double puiss1 = nu*pow(10,9);
|
---|
| 48 | if(puiss1 > 1.e99) puiss1=1.e99;
|
---|
| 49 | if(puiss1 < -1.e99) puiss1=-1.e99;
|
---|
| 50 | double puiss2 = hpl*nu*pow(10,9)/(kb*temperature);
|
---|
| 51 | if(puiss2 > 1.e99) puiss2=1.e99;
|
---|
| 52 | if(puiss2 < -1.e99) puiss2=-1.e99;
|
---|
| 53 |
|
---|
| 54 | double result=
|
---|
| 55 | (2*hpl* pow( puiss1 ,3))/( pow(cel,2)*(exp(puiss2)-1));
|
---|
| 56 | return result;
|
---|
| 57 | }
|
---|
| 58 |
|
---|
| 59 | void
|
---|
| 60 | BlackBody::Print(ostream& os) const
|
---|
| 61 | {
|
---|
| 62 | os << "BlackBody::Print Temp= " << getTemperature()
|
---|
| 63 | << " - Fmin,Fmax= " << minFreq() << "," << maxFreq() << endl;
|
---|
| 64 | os << "MeanFreq= " << meanFreq() << " Emission= " << flux(meanFreq()) << endl;
|
---|
| 65 | os << "PeakFreq= " << peakFreq() << " Emission= " << flux(peakFreq()) << endl;
|
---|
| 66 |
|
---|
| 67 | }
|
---|