source: Sophya/trunk/Cosmo/SimLSS/schechter.cc@ 3193

Last change on this file since 3193 was 3193, checked in by cmv, 19 years ago

petis changements cmv 21/03/2007

File size: 2.6 KB
Line 
1#include "sopnamsp.h"
2#include "machdefs.h"
3#include <iostream>
4#include <stdlib.h>
5#include <stdio.h>
6#include <string.h>
7#include <math.h>
8
9#include "pexceptions.h"
10
11#include "constcosmo.h"
12#include "schechter.h"
13
14///////////////////////////////////////////////////////////
15//***************** Schechter Functions *****************//
16///////////////////////////////////////////////////////////
17
18// HI mass function:
19// see M.Zwaan astroph-0502257 (MNRAS Letters, Volume 359, Issue 1, pp. L30-L34.)
20// see M.Zwaan astroph-9707109 (ApJ, Volume 509, Issue 2, pp. 687-702.)
21
22Schechter::Schechter(double nstar,double mstar,double alpha)
23 : nstar_(nstar) , mstar_(mstar) , alpha_(alpha) , outvalue_(0)
24{
25}
26
27Schechter::Schechter(Schechter& f)
28 : nstar_(f.nstar_) , mstar_(f.mstar_) , alpha_(f.alpha_) , outvalue_(f.outvalue_)
29{
30}
31
32Schechter::~Schechter(void)
33{
34}
35
36void Schechter::SetOutValue(unsigned short outvalue)
37// outvalue = 0 : give dn/dm
38// = 1 : give m*dn/dm
39{
40 if(outvalue>1) {
41 cout<<"Schechter::SetOutValue: Error bad outvalue: "<<outvalue<<endl;
42 throw ParmError("Schechter::SetOutValue: Error bad outvalue");
43 }
44 outvalue_ = outvalue;
45}
46
47double Schechter::operator() (double m)
48// Return : "dn/dm = f(m)" or "m*dn/dm = f(m)"
49{
50 double x = m/mstar_;
51 double dndm = nstar_/mstar_ * pow(x,alpha_) * exp(-x);
52 if(outvalue_) dndm *= m; // on veut m*dn/dm
53 return dndm;
54}
55
56void Schechter::Print(void)
57{
58 cout<<"Schechter::Print: nstar="<<nstar_<<" Mpc^-3"
59 <<" mstar="<<mstar_<<" MSol"
60 <<" alpha="<<alpha_
61 <<" (outvalue="<<outvalue_<<" -> return ";
62 if(outvalue_) cout<<"m*dn/dm)"; else cout<<"dn/dm)";
63 cout<<endl;
64}
65
66///////////////////////////////////////////////////////////
67//******************* Le Flux a 21cm ********************//
68///////////////////////////////////////////////////////////
69
70double FluxHI(double m,double d)
71// Input:
72// m : masse de HI en "Msol"
73// d : distance en "Mpc" (si cosmo d=DLum(z))
74// Return:
75// le flux total emis a 21 cm en W/m^2
76// Ref:
77// -- Binney & Merrifield, Galactic Astronomy p474 (ed:1998)
78// S(W/m^2) = 1e-26 * Nu_21cm(Hz) * m(en masse solaire) /(2.35e5 * C(km/s) * Dlum^2)
79// = 2.0e-28 * m / Dlum^2
80// -- J.Peterson & K.Bandura, astroph-0606104 (eq 7)
81// F.Abdalla & Rawlings, astroph-0411342 (eq 7 mais pb de d'unites?)
82// (A_21cm = 2.86888e-15 s^-1)
83// S(W/m^2) = 3/4 * h(J.s) * Nu_21cm(Hz) * A_21cm(s^-1) * Msol(kg)/m_proton(kg)
84// / (4 Pi) / (Dlum(Mpc) * 3.0857e22(m/Mpc))^2
85// = 2.0e-28 * m / Dlum^2
86//-------------
87{
88 return 2.0e-28 * m / (d*d);
89}
Note: See TracBrowser for help on using the repository browser.