source: Sophya/trunk/SophyaLib/SkyT/blackbody.cc@ 760

Last change on this file since 760 was 669, checked in by ansari, 26 years ago

Adaptation a PPersist de SpectralResponse - Suite 1 , Sophie 29/11/99

File size: 2.1 KB
Line 
1//--------------------------------------------------------------------------
2// File and Version Information:
3// $Id: blackbody.cc,v 1.4 1999-11-29 16:59:09 ansari Exp $
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//----------------
25BlackBody::BlackBody(double temperature)
26 : RadSpectra(10., 10000.)
27{
28 _temperature = temperature;
29}
30
31
32BlackBody::~BlackBody()
33{
34}
35
36
37double
38BlackBody::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
60void
61BlackBody::Print(ostream& os) const
62{
63 os << "BlackBody::Print Temp= " << getTemperature()
64 << " - Fmin,Fmax= " << minFreq() << "," << maxFreq() << endl;
65 os << "MeanFreq= " << meanFreq() << " Emission= " << flux(meanFreq()) << endl;
66 os << "PeakFreq= " << peakFreq() << " Emission= " << flux(peakFreq()) << endl;
67
68}
69
70/*
71void
72BlackBody::WriteSelf(POutPersist& s)
73{
74 s.PutR8(this->getTemperature());
75 s.PutR8(this->minFreq());
76 s.PutR8(this->maxFreq());
77}
78
79void
80BlackBody::ReadSelf(PInPersist& s)
81{
82 s.GetR8(_temperature);
83 s.GetR8(_numin);
84 s.GetR8(_numax);
85 cout << " Temperature - minFreq - maxFreq " << endl;
86 cout << _temperature << "-" << _numin << "-" << _numax << endl;
87}
88
89*/
Note: See TracBrowser for help on using the repository browser.