source: Sophya/trunk/SophyaLib/SkyT/derivblackbody.cc@ 909

Last change on this file since 909 was 909, checked in by ansari, 25 years ago

Sophie: adding documentation for Doxygen in the .cc files:wq

File size: 2.7 KB
Line 
1//--------------------------------------------------------------------------
2// File and Version Information:
3// $Id: derivblackbody.cc,v 1.3 2000-04-13 14:10:44 ansari Exp $
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//---------------
17#include "machdefs.h"
18#include <iostream.h>
19#include <math.h>
20#include "derivblackbody.h"
21
22
23
24/*! \class SOPHYA::DerivBlackBody <BR>
25 * This class corresponds to the emission spectrum of a
26 * dipole (since its emission spectrum is the derivation
27 * of a blackbody spectrum wrt the temperature).
28 */
29
30/*! Constructor: needs a temperature. Otherwise set to ConvTools::tcmb */
31DerivBlackBody::DerivBlackBody(double temperature)
32 : RadSpectra(10., 10000.)
33{
34 _temperature = temperature;
35}
36
37
38DerivBlackBody::~DerivBlackBody()
39{
40}
41
42/*!
43 The flux function is the derivation of the BlackBody
44 flux function wrt the temperature (used e.g. for a Dipole)
45 \f[
46 I_\nu = {2 h_{pl} (1.10^9*\nu)^3 {h_{pl}1.10^9*\nu \over k T^2}
47 {e^{{h_{pl}(1.10^9*\nu) \over kT}}\over c^2 (e^{{h_{pl}(1.10^9*\nu) \over kT}} -1)^2}}
48 \f]
49*/
50double
51DerivBlackBody::flux(double nu) const
52{
53 if(nu < -1.e99) nu = -1.e99;
54 if(nu > 1.e99) nu = 1.e99;
55 double temperature = getTemperature();
56 if(nu==0.) return 0.;
57 double hpl = ConvTools::hpl;
58 double cel = ConvTools::cel;
59 double kb = ConvTools::kb;
60 double puiss1 = nu*pow(10,9);
61 if(puiss1 > 1.e99) puiss1=1.e99;
62 if(puiss1 < -1.e99) puiss1=-1.e99;
63 double puiss2 = hpl*nu*pow(10,9)/(kb*temperature);
64 if(puiss2 > 1.e99) puiss2=1.e99;
65 if(puiss2 < -1.e99) puiss2=-1.e99;
66
67 double result=
68 (2*hpl* pow( puiss1 ,3))*(hpl*puiss1/kb)*(1/(temperature*temperature))
69 *exp(puiss2)
70 /(pow(cel,2)*pow(( (exp(puiss2)-1)),2));
71 // result = 1500e3*result/400e6;
72 return result;
73}
74
75
76void
77DerivBlackBody::Print(ostream& os) const
78{
79 os << "DerivBlackBody::Print Temp= " << getTemperature()
80 << " - Fmin,Fmax= " << minFreq() << "," << maxFreq() << endl;
81 os << "MeanFreq= " << meanFreq() << " Emission= " << flux(meanFreq()) << endl;
82 os << "PeakFreq= " << peakFreq() << " Emission= " << flux(peakFreq()) << endl;
83
84}
85
86/*
87void
88DerivBlackBody::WriteSelf(POutPersist& s)
89{
90 s.PutR8(this->getTemperature());
91 s.PutR8(this->minFreq());
92 s.PutR8(this->maxFreq());
93}
94
95void
96DerivBlackBody::ReadSelf(PInPersist& s)
97{
98 s.GetR8(_temperature);
99 s.GetR8(_numin);
100 s.GetR8(_numax);
101 cout << " Temperature - minFreq - maxFreq " << endl;
102 cout << _temperature << "-" << _numin << "-" << _numax << endl;
103}
104
105*/
Note: See TracBrowser for help on using the repository browser.