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

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

Sophie: new classes for dipole implementation

File size: 2.2 KB
RevLine 
[879]1//--------------------------------------------------------------------------
2// File and Version Information:
3// $Id: derivblackbody.cc,v 1.1 2000-04-11 13:26:05 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// Constructor --
24//----------------
25DerivBlackBody::DerivBlackBody(double temperature)
26 : RadSpectra(10., 10000.)
27{
28 _temperature = temperature;
29}
30
31
32DerivBlackBody::~DerivBlackBody()
33{
34}
35
36
37double
38DerivBlackBody::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))*(hpl*puiss1/kb)*(1/(temperature*temperature))
56 *exp(puiss2)
57 /(pow(cel,2)*pow(( (exp(puiss2)-1)),2));
58 result = 1500e3*result/400e6;
59 return result;
60}
61
62
63void
64DerivBlackBody::Print(ostream& os) const
65{
66 os << "DerivBlackBody::Print Temp= " << getTemperature()
67 << " - Fmin,Fmax= " << minFreq() << "," << maxFreq() << endl;
68 os << "MeanFreq= " << meanFreq() << " Emission= " << flux(meanFreq()) << endl;
69 os << "PeakFreq= " << peakFreq() << " Emission= " << flux(peakFreq()) << endl;
70
71}
72
73/*
74void
75DerivBlackBody::WriteSelf(POutPersist& s)
76{
77 s.PutR8(this->getTemperature());
78 s.PutR8(this->minFreq());
79 s.PutR8(this->maxFreq());
80}
81
82void
83DerivBlackBody::ReadSelf(PInPersist& s)
84{
85 s.GetR8(_temperature);
86 s.GetR8(_numin);
87 s.GetR8(_numax);
88 cout << " Temperature - minFreq - maxFreq " << endl;
89 cout << _temperature << "-" << _numin << "-" << _numax << endl;
90}
91
92*/
Note: See TracBrowser for help on using the repository browser.