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

Last change on this file since 2322 was 2322, checked in by cmv, 23 years ago
  • passage xxstream.h en xxstream
  • compile avec gcc_3.2, gcc_2.96 et cxx En 3.2 le seek from ::end semble marcher (voir Eval/COS/pbseekios.cc)

rz+cmv 11/2/2003

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