1 #ifndef COOLING_GRACKLE_HINCLUDED
2 #define COOLING_GRACKLE_HINCLUDED
12 #include <sys/param.h>
14 #define MAXPATHLEN 256
18 #define CONFIG_BFLOAT_8
23 #ifndef GRACKLE_PRIMORDIAL_CHEMISTRY_MAX
24 #define GRACKLE_PRIMORDIAL_CHEMISTRY_MAX 1
27 #define CL_NMAXBYTETABLE 56000
36 int with_radiative_cooling;
37 int primordial_chemistry;
40 int cmb_temperature_floor;
41 int bBrokenGrackleFloor;
47 char grackle_data_file[MAXPATHLEN];
52 #if (GRACKLE_PRIMORDIAL_CHEMISTRY_MAX<1)
55 #if (GRACKLE_PRIMORDIAL_CHEMISTRY_MAX>=1)
56 gr_float HI, HII, HeI, HeII, HeIII, e;
57 #if (GRACKLE_PRIMORDIAL_CHEMISTRY_MAX>=2)
58 gr_float HM, H2I, H2II;
59 #if (GRACKLE_PRIMORDIAL_CHEMISTRY_MAX>=3)
73 double dComovingGmPerCcUnit;
75 double diErgPerGmUnit;
76 double dErgPerGmPerSecUnit;
78 char grackle_data_file[MAXPATHLEN];
79 chemistry_data *pgrackle_data;
82 #if defined(COOLDEBUG)
95 void CoolFinalize(
COOL *cl );
99 void clInitConstants(
COOL *cl,
double dGMPerCcunit,
double dComovingGmPerCcUnit,
100 double dErgPerGmUnit,
double dSecUnit,
double dKpcUnit,
COOLPARAM CoolParam);
104 void CoolLogParams(
COOLPARAM *CoolParam, FILE *fp );
105 void CoolOutputArray(
COOLPARAM *CoolParam,
int,
int *,
char * );
108 #define COOL_ARRAY0_EXT "HI"
110 void COOL_SET_ARRAY0(
COOL *cl,
COOLPARTICLE *cp,
double ZMetal,
double Data);
112 #define COOL_ARRAY1_EXT "HII"
114 void COOL_SET_ARRAY1(
COOL *cl,
COOLPARTICLE *cp,
double ZMetal,
double Data);
116 #define COOL_ARRAY2_EXT "HeI"
118 void COOL_SET_ARRAY2(
COOL *cl,
COOLPARTICLE *cp,
double ZMetal,
double Data);
120 #define COOL_ARRAY3_EXT "HeII"
122 void COOL_SET_ARRAY3(
COOL *cl,
COOLPARTICLE *cp,
double ZMetal,
double Data);
123 #define COOL_SET_ARRAY3( cl_, cp, aa, bb_val ) (assert(0))
125 #define COOL_ARRAY4_EXT "HeIII"
127 void COOL_IN_ARRAY4(
COOL *cl,
COOLPARTICLE *cp,
double ZMetal,
double Data);
128 #define COOL_IN_ARRAY4(w,x,y,z)
130 #define COOL_ARRAY5_EXT "e"
132 void COOL_IN_ARRAY5(
COOL *cl,
COOLPARTICLE *cp,
double ZMetal,
double Data);
133 #define COOL_IN_ARRAY5(w,x,y,z)
136 #define COOL_ARRAY6_EXT "HM"
138 void COOL_IN_ARRAY6(
COOL *cl,
COOLPARTICLE *cp,
double ZMetal,
double Data);
139 #define COOL_IN_ARRAY6(w,x,y,z)
141 #define COOL_ARRAY7_EXT "H2I"
143 void COOL_IN_ARRAY7(
COOL *cl,
COOLPARTICLE *cp,
double ZMetal,
double Data);
144 #define COOL_IN_ARRAY7(w,x,y,z)
146 #define COOL_ARRAY8_EXT "H2II"
148 void COOL_IN_ARRAY8(
COOL *cl,
COOLPARTICLE *cp,
double ZMetal,
double Data);
149 #define COOL_IN_ARRAY8(w,x,y,z)
152 #define COOL_ARRAY9_EXT "DI"
154 void COOL_IN_ARRAY9(
COOL *cl,
COOLPARTICLE *cp,
double ZMetal,
double Data);
155 #define COOL_IN_ARRAY9(w,x,y,z)
157 #define COOL_ARRAY10_EXT "DII"
159 void COOL_IN_ARRAY10(
COOL *cl,
COOLPARTICLE *cp,
double ZMetal,
double Data);
160 #define COOL_IN_ARRAY10(w,x,y,z)
162 #define COOL_ARRAY11_EXT "HDI"
164 void COOL_IN_ARRAY11(
COOL *cl,
COOLPARTICLE *cp,
double ZMetal,
double Data);
165 #define COOL_IN_ARRAY11(w,x,y,z)
167 #define COOL_ARRAY12_EXT "dummy"
168 #define COOL_ARRAY12(x,y,z) 0
169 #define COOL_IN_ARRAY12(w,x,y,z)
171 #define COOL_ARRAY13_EXT "dummy"
172 #define COOL_ARRAY13(x,y,z) 0
173 #define COOL_IN_ARRAY13(w,x,y,z)
175 #define COOL_ARRAY14_EXT "dummy"
176 #define COOL_ARRAY14(x,y,z) 0
177 #define COOL_IN_ARRAY14(w,x,y,z)
179 #define COOL_ARRAY15_EXT "dummy"
180 #define COOL_ARRAY15(x,y,z) 0
181 #define COOL_IN_ARRAY15(w,x,y,z)
183 double COOL_EDOT(
COOL *cl_,
COOLPARTICLE *cp_,
double ECode_,
double rhoCode_,
double ZMetal_,
double *posCode_ );
184 #define COOL_EDOT( cl_, cp_, ECode_, rhoCode_, ZMetal_, posCode_) (CoolCodeWorkToErgPerGmPerSec( cl_, CoolEdotInstantCode( cl_, cp_, ECode_, rhoCode_, ZMetal_, posCode_ )))
186 double COOL_COOLING(
COOL *cl_,
COOLPARTICLE *cp_,
double ECode_,
double rhoCode_,
double ZMetal_,
double *posCode_ );
187 #define COOL_COOLING( cl_, cp_, ECode_, rhoCode_, ZMetal_, posCode_) (CoolCodeWorkToErgPerGmPerSec( cl_, CoolCoolingCode( cl_, cp_, ECode_, rhoCode_, ZMetal_, posCode_ )))
189 double COOL_HEATING(
COOL *cl_,
COOLPARTICLE *cp_,
double ECode_,
double rhoCode_,
double ZMetal_,
double *posCode_ );
190 #define COOL_HEATING( cl_, cp_, ECode_, rhoCode_, ZMetal_, posCode_) (CoolCodeWorkToErgPerGmPerSec( cl_, CoolHeatingCode( cl_, cp_, ECode_, rhoCode_, ZMetal_, posCode_ )))
195 double CoolEnergyToTemperature(
COOL *Cool,
COOLPARTICLE *cp,
double E,
double,
double ZMetal);
197 double rho,
double ZMetal);
200 void CoolSetTime(
COOL *Cool,
double dTime,
double z );
202 double CoolCodeTimeToSeconds(
COOL *Cool,
double dCodeTime );
204 #define CoolCodeTimeToSeconds( Cool, dCodeTime ) ((Cool)->dSecUnit*(dCodeTime))
206 double CoolSecondsToCodeTime(
COOL *Cool,
double dTime );
208 #define CoolSecondsToCodeTime( Cool, dTime ) ((dTime)/(Cool)->dSecUnit)
210 double CoolCodeEnergyToErgPerGm(
COOL *Cool,
double dCodeEnergy );
212 #define CoolCodeEnergyToErgPerGm( Cool, dCodeEnergy ) ((Cool)->dErgPerGmUnit*(dCodeEnergy))
214 double CoolErgPerGmToCodeEnergy(
COOL *Cool,
double dEnergy );
216 #define CoolErgPerGmToCodeEnergy( Cool, dEnergy ) ((Cool)->diErgPerGmUnit*(dEnergy))
218 double CoolCodeWorkToErgPerGmPerSec(
COOL *Cool,
double dCodeWork );
220 #define CoolCodeWorkToErgPerGmPerSec( Cool, dCodeWork ) ((Cool)->dErgPerGmPerSecUnit*(dCodeWork))
222 double CoolErgPerGmPerSecToCodeWork(
COOL *Cool,
double dWork );
224 #define CoolErgPerGmPerSecToCodeWork( Cool, dWork ) ((dWork)/(Cool)->dErgPerGmPerSecUnit)
226 double CodeDensityToComovingGmPerCc(
COOL *Cool,
double dCodeDensity );
228 #define CodeDensityToComovingGmPerCc( Cool, dCodeDensity ) ((Cool)->dComovingGmPerCcUnit*(dCodeDensity))
231 double ExternalHeating,
double rho,
double ZMetal,
double *rp,
double tStep );
234 double ExternalHeating,
double rho,
double ZMetal,
double *r,
double tStep );
238 void CoolInitEnergyAndParticleData(
COOL *cl,
COOLPARTICLE *cp,
double *E,
double dDensity,
double dTemp,
double ZMetal);
241 double CoolHeatingRate(
COOL *cl,
COOLPARTICLE *cp,
double E,
double dDensity,
double ZMetal,
double rkpc);
244 double rhoCode,
double ZMetal,
double *posCode );
246 double rhoCode,
double ZMetal,
double *posCode );
248 double rhoCode,
double ZMetal,
double *posCode );
250 void CoolCodePressureOnDensitySoundSpeed(
COOL *cl,
COOLPARTICLE *cp,
double uPred,
double fDensity,
double gamma,
double gammam1,
double *PoverRho,
double *c );
253 #define CoolCodePressureOnDensitySoundSpeed( cl__, cp__, uPred__, fDensity__, gamma__, gammam1__, PoverRho__, c__ ) { \
254 *(PoverRho__) = ((5./3.-1)*(uPred__)); \
255 *(c__) = sqrt((5./3.)*(*(PoverRho__))); }
263 void CoolTableReadInfo(
COOLPARAM *CoolParam,
int cntTable,
int *nTableColumns,
char *suffix );
265 void CoolTableRead(
COOL *Cool,
int nData,
void *vData);
COOL * cl
pointer to cooling context
Definition: cooling_boley.h:110
Object containing the parameter information.
Definition: param.h:38
Heating/Cooling context: parameters and tables.
Definition: cooling_boley.h:83
per-particle cooling data
Definition: cooling_boley.h:68
context for calculating cooling derivatives
Definition: cooling_boley.h:108