changa  3.5
 All Classes Files Functions Variables Typedefs Enumerations Friends Macros Groups Pages
imf.h
1 #ifndef IMF_HINCLUDED
2 #define IMF_HINCLUDED
3 
4 // Please see
5 // http://charm.cs.uiuc.edu/manuals/html/charm++/3_17.html#SECTION000317400000000000000
6 // for details about PUPing child and parent classes.
7 
8 // http://www.parashift.com/c++-faq-lite/abcs.html#faq-22.5
9 // for copy constructors in inherited abstract classes and a
10 // description of pure virtual functions
11 
15 class IMF : public PUP::able {
16 
17  public:
18  IMF() {};
22  virtual double returnimf(double mass) const = 0;
26  IMF(CkMigrateMessage *m) : PUP::able(m) {}
28  virtual void pup(PUP::er &p) = 0;
31  virtual double CumNumber(double mass) = 0;
34  virtual double CumMass(double mass) = 0;
36  virtual IMF* clone() const = 0;
37  ~IMF() {};
38 };
39 
40 
55 class MillerScalo : public IMF {
56 
57  double a1, b1, m1;
58  double a2, b2, m2;
59  double a3, b3, m3;
60  double mmax;
61 
62  public:
63  /* normalization, index, minimum mass */
64  MillerScalo() {
65  a1=42.0; b1=-0.4;m1=0.1; /* parameters from Ap.J. Supp., 41,1979 */
66  a2=42.0;b2=-1.5;m2=1.0; /* This is discontinuous, but is what */
67  a3=240.0;b3=-2.3;m3=10.0;/* they report in paper, so we leave it.*/
68  mmax=100.0;
69  }
73  MillerScalo(CkMigrateMessage *m) : IMF(m) {}
74  virtual double returnimf(double mass) const;
75  virtual double CumNumber(double mass);
76  virtual double CumMass(double mass);
77  virtual MillerScalo* clone() const;
78  virtual void pup(PUP::er &p) {
79  PUP::able::pup(p);
80  p|a1; p|b1; p|m1;
81  p|a2; p|b2; p|m2;
82  p|a3; p|b3; p|m3;
83  p|mmax;
84  }
85  };
86 
90 class Kroupa93 : public IMF {
91  double a1, b1, m1;
92  double a2, b2, m2;
93  double a3, b3, m3;
94  double mmax;
95  public:
96 /* parameters from Raiteri et. al. A&A, 315,1996, eq. 2; See also the
97  conclusions of Kroupa, Tout & Gilmore, 1993. */
98 /* To convert to the IMF(log10(M)) convention of Miller-Scale, we
99  increase the power law by 1 and multiply the coefficient by
100  ln(10.0). See, eg., Chabrier 2003, eq. 2 */
101  Kroupa93() {a1=0.3029*1.86606*log(10.0);b1=-0.3;m1=.08;
102  a2=0.3029*log(10.0);b2=-1.2;m2=0.5;
103  a3=0.3029*log(10.0); b3=-1.7; m3=1.0;
104  mmax=100.0; }
108  Kroupa93(CkMigrateMessage *m) : IMF(m) {}
109  virtual double returnimf(double mass) const;
110  virtual double CumNumber(double mass);
111  virtual double CumMass(double mass);
112  virtual Kroupa93* clone() const;
113  virtual void pup(PUP::er &p) {
114  PUP::able::pup(p);
115  p|a1; p|b1; p|m1;
116  p|a2; p|b2; p|m2;
117  p|a3; p|b3; p|m3;
118  p|mmax;
119  }
120 };
121 
125 class Kroupa01 : public IMF {
126  double a1, b1, m1;
127  double a2, b2, m2;
128  double mmax;
129  public:
130 /* parameters from Kroupa 2001, equation 2, and ignoring brown dwarfs,
131  Also normalized so that the mass integral is 1. */
132 /* NOTE BENE: Kroupa 2001 has a revised IMF in section 6.2 which is
133  different than this; however, below is what is used as the default in
134  Starburst99
135  (http://www.stsci.edu/science/starburst99/mappings/docs/run.html)
136  with the exception that the low mass cutoff is .1 instead of the .08
137  below and in the Kroupa paper.
138  */
139 /* To convert to the IMF(log10(M)) convention of Miller-Scalo, we
140  increase the power law by 1 and multiply the coefficient by
141  ln(10.0). See, eg., Chabrier 2003, eq. 2 */
142  Kroupa01() {
143  a1=0.22038*2.0*log(10.0);b1=-0.3;m1=.08;
144  a2=0.22038*log(10.0);b2=-1.3;m2=0.5;
145  mmax=100.0; }
149  Kroupa01(CkMigrateMessage *m) : IMF(m) {}
150  virtual double returnimf(double mass) const;
151  virtual double CumNumber(double mass);
152  virtual double CumMass(double mass);
153  virtual Kroupa01* clone() const;
154  virtual void pup(PUP::er &p) {
155  PUP::able::pup(p);
156  p|a1; p|b1; p|m1;
157  p|a2; p|b2; p|m2;
158  p|mmax;
159  }
160 };
161 
167 class Chabrier : public IMF {
168  double a1, b1, m1;
169  double a2, b2, m2;
170  double mmax;
171  public:
172  /*
173  Chabrier low mass formula:
174  \xi(log m) = A exp [ - (log m - log m_c)^2/2 \sigma^2]
175  double a1, sigma, mc; (b1 is sigma, m1 is mc)
176  */
177  Chabrier() {
178  a1=0.158;b1=0.69;m1=.079;
179  /* For high mass: normalization, index, minimum mass */
180  /* Parameters from Table 1 of Chabrier, 2003. */
181  a2=4.43e-2;b2=-1.3; m2=1.0;
182  mmax=100.0;
183  }
184  virtual double returnimf(double mass) const;
185  virtual double CumNumber(double mass);
186  virtual double CumMass(double mass);
187  virtual Chabrier* clone() const;
191  Chabrier(CkMigrateMessage *m) : IMF(m) {}
192  virtual void pup(PUP::er &p) {
193  PUP::able::pup(p);
194  p|a1; p|b1; p|m1;
195  p|a2; p|b2; p|m2;
196  p|mmax;
197  }
198 };
199 
200 #endif
Implement IMF from Kroupa, Tout & Gilmore, 1993.
Definition: imf.h:90
virtual double CumMass(double mass)
Cumulative mass of stars with mass greater than mass.
Definition: imf.cpp:221
virtual Kroupa93 * clone() const
copy IMF object
Definition: imf.cpp:149
PUPable_decl(Chabrier)
Charm++ method for migrating derived classes.
virtual Kroupa01 * clone() const
copy IMF object
Definition: imf.cpp:154
virtual double CumNumber(double mass)
Cumulative number of stars with mass greater than mass.
Definition: imf.cpp:89
virtual double CumMass(double mass)=0
Cumulative mass of stars with mass greater than mass.
Implement Miller-Scalo IMF Uses the 3 segment power law fit for the Miller-Scalo IMF (Ap...
Definition: imf.h:55
virtual MillerScalo * clone() const
copy IMF object
Definition: imf.cpp:144
virtual void pup(PUP::er &p)=0
Charm++ Pack-UnPack method.
virtual double CumMass(double mass)
Cumulative mass of stars with mass greater than mass.
Definition: imf.cpp:275
virtual double CumMass(double mass)
Cumulative mass of stars with mass greater than mass.
Definition: imf.cpp:191
virtual double returnimf(double mass) const
return stars per unit logarithmic mass
Definition: imf.cpp:31
PUPable_decl(MillerScalo)
Charm++ method for migrating derived classes.
Kroupa01(CkMigrateMessage *m)
Charm++ migration constructor.
Definition: imf.h:149
Interface class for initial mass function.
Definition: imf.h:15
virtual double returnimf(double mass) const
return stars per unit logarithmic mass
Definition: imf.cpp:14
virtual double returnimf(double mass) const
return stars per unit logarithmic mass
Definition: imf.cpp:48
Kroupa93(CkMigrateMessage *m)
Charm++ migration constructor.
Definition: imf.h:108
PUPable_decl(Kroupa01)
Charm++ method for migrating derived classes.
Chabrier(CkMigrateMessage *m)
Charm++ migration constructor.
Definition: imf.h:191
virtual double CumNumber(double mass)
Cumulative number of stars with mass greater than mass.
Definition: imf.cpp:108
virtual IMF * clone() const =0
copy IMF object
virtual void pup(PUP::er &p)
Charm++ Pack-UnPack method.
Definition: imf.h:78
virtual double returnimf(double mass) const =0
return stars per unit logarithmic mass
IMF(CkMigrateMessage *m)
Charm++ migrate constructor.
Definition: imf.h:26
virtual void pup(PUP::er &p)
Charm++ Pack-UnPack method.
Definition: imf.h:154
virtual Chabrier * clone() const
copy IMF object
Definition: imf.cpp:159
PUPable_decl(Kroupa93)
Charm++ method for migrating derived classes.
Implement Chabrier IMF Use the log normal + power law fit of Chabrier, 2003, Galactic Stellar and Sub...
Definition: imf.h:167
Implement IMF from Kroupa 2001.
Definition: imf.h:125
PUPable_abstract(IMF)
Charm++ requirement for passing polymorphic objects.
virtual double CumNumber(double mass)
Cumulative number of stars with mass greater than mass.
Definition: imf.cpp:127
virtual void pup(PUP::er &p)
Charm++ Pack-UnPack method.
Definition: imf.h:113
virtual void pup(PUP::er &p)
Charm++ Pack-UnPack method.
Definition: imf.h:192
virtual double CumMass(double mass)
Cumulative mass of stars with mass greater than mass.
Definition: imf.cpp:251
virtual double returnimf(double mass) const
return stars per unit logarithmic mass
Definition: imf.cpp:64
virtual double CumNumber(double mass)=0
Cumulative number of stars with mass greater than mass.
MillerScalo(CkMigrateMessage *m)
Charm++ migration constructor.
Definition: imf.h:73
virtual double CumNumber(double mass)
Cumulative number of stars with mass greater than mass.
Definition: imf.cpp:164