changa 3.5
Loading...
Searching...
No Matches
lymanwerner.h
Go to the documentation of this file.
1
3
4#ifndef LYMANWERNER_INC
5#define LYMANWERNER_INC
6
7#include <math.h>
8#include <stdlib.h>
9
10/* inline function used in feedback.C and starform.C to calculate the Lyman Werner luminosity for a star particle of a given age and mass*/
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16typedef struct lwDataStruct {
17 float **lwLuminosity;
18 int nrows; // rows in LW data table
19 int ncols; // columns in LW data table
20} LWDATA;
21
22LWDATA *LymanWernerTableInit( );
23void LymanWernerTableFinalize(LWDATA *lwd);
24void lwInitData(LWDATA *lwd);
25
26double calcLogStochLymanWerner(double dAgelog, double *rgdHMStars, LWDATA *lwd);
27
28inline double calcLogSSPLymanWerner(double dAgelog, double dMassLog)
29{
30 /* Variables below are to a polynomial fit for data representing a SSP generated by Starburst99*/
31 double a0 = -84550.812,
32 a1 = 54346.066,
33 a2 = -13934.144,
34 a3 = 1782.1741,
35 a4 = -113.68717,
36 a5 = 2.8930795;
37 return a0
38 + a1*dAgelog
39 + a2*dAgelog*dAgelog
40 + a3*dAgelog*dAgelog*dAgelog
41 + a4*dAgelog*dAgelog*dAgelog*dAgelog
42 + a5*dAgelog*dAgelog*dAgelog*dAgelog*dAgelog + dMassLog;
43}
44
45inline double calcLogMax8LymanWerner(double dAgelog, double loglownorm)
46{
47/* The SSP portion is a polynomial fit for data generated by Starburst99 (t>10^6.5 yr), with a maximum stellar mass
48 * of 8 Msol. The high mass portion was generated from a series of Starburst99 "SSPs" consisting of
49 * only a single mass. A lookup table is used to estimate the LW feedback for these stars
50 *
51 * Recall, lownorm (dLowNorm) is the normalization for the continuous part of the stochastic IMF, or the mass
52 * the whole star particle would have if scaled by the same amount as the low mass portion*/
53
54 double a0 = -39793.789,
55 a1 = 26397.519,
56 a2 = -6970.825,
57 a3 = 916.93434,
58 a4 = -60.0680528,
59 a5 = 1.567325918;
60 return a0
61 + a1*dAgelog
62 + a2*dAgelog*dAgelog
63 + a3*dAgelog*dAgelog*dAgelog
64 + a4*dAgelog*dAgelog*dAgelog*dAgelog
65 + a5*dAgelog*dAgelog*dAgelog*dAgelog*dAgelog + loglownorm;
66}
67#ifdef __cplusplus
68}
69#endif
70#endif
double calcLogStochLymanWerner(double dAgelog, double *rgdHMStars, LWDATA *lwd)
Calculate LW flux from a set of HM stars.
Definition lymanwerner.c:65
Definition lymanwerner.h:16