-
Notifications
You must be signed in to change notification settings - Fork 0
/
thermodynamics.h
executable file
·180 lines (120 loc) · 4.52 KB
/
thermodynamics.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
// ############ THERMODYNAMICS ##############
extern double anr;
extern double sigmaoverm;
extern double Varr[npointsv];
extern double deltaDMprefNR[npointsv];
extern double vDMprefNR[npointsv];
extern double viscprefNR[npointsv];
extern double deltaDMprefwdm[npointsv];
extern double vDMprefwdm[npointsv];
extern double viscprefwdm[npointsv];
extern double dlogfNRarr[npointsv];
extern double dlogfoverVNRarr[npointsv];
extern double dlogfrelarr[npointsv];
extern double dlogfoverVrelarr[npointsv];
extern double mrel;
extern double T0r;
#define csovar 1/sqrt(3.)*anr
#define tau(a) (1/(sigmaoverm*rhoDMafun(a)*velfun(a)))
#define taucomov(a) (1/(a*sigmaoverm*rhoDMafun(a)*velfun(a)))
#define oneovertaucomov(a) (velfun(a)*a*sigmaoverm*rhoDMafun(a))
#define f0m4(V) (rhoDM*pow(gamma,3./2.)/pow(2.*M_PI*square(anr)/3.,3./2.)*exp(-3*gamma*square(V)/(2*square(anr)))) //Note that it is mass independent
#define dlogfNR(V) (-3*gamma*square(V)/(square(anr))) // This is dlogf/dlogV=dlogf/dV*V
#define dlogfoverVNR(V) (-3*gamma*V/(square(anr)))
// Old #define f0m4rel(V) ((1/cube(2*M_PI))*square(mrel)*square(mrel)*gf/(exp(3.*gamma*V/anr)+1.))
/* Relativistic fermi distro */
#define frelexppref sqrt(2.*gamma*xirho*zeta5/(xin*zeta3))
#define f0m4rel(V) ((1/cube(2*M_PI))*square(mrel)*square(mrel)*gf/(exp(frelexppref*V/anr)+1.))
#define dlogfrel(V) (-frelexppref*V/anr/(1.+exp(-frelexppref*V/anr)))
#define dlogfoverVrel(V) (-frelexppref/anr/(1.+exp(-frelexppref*V/anr)))
/* Relativistic bose distro. Uncomment for bosons
#define f0m4rel(V) ((1/cube(2*M_PI))*square(mrel)*square(mrel)*gf/(exp(frelexppref*V/anr)-1.))
#define dlogfrel(V) (-frelexppref*V/anr/(1.-exp(-frelexppref*V/anr)))
#define dlogfoverVrel(V) (-frelexppref/anr/(1.-exp(-frelexppref*V/anr)))
*/
double velfun(double a){
double velvar;
if (a>anr) {
velvar=1./a*anr;
} else {
velvar=1.;
}
return velvar;
}
double cbsfun(double TM, double dlogTM){
return TM/muGeV*(1.-1./3.*dlogTM);
}
double ussqfun(double decoupl, double a){
// decoupl=0 when fluid is still coupled, taucomov(sigmaoverm, a , anr ) < 1./(Heta)
double usvar;
if (decoupl==0) {
if (a>anr) {
usvar=csovar/a;
} else {
usvar=csovar/anr;
}
} else {
usvar=0.;
}
return square(usvar);
}
double epsilon(struct paramsstepstruct *paramsstep){
return sqrt(square((*paramsstep).a*mrel)+square(Varr[(*paramsstep).n]*mrel));
}
double qoverepsilon(struct paramsstepstruct *paramsstep){
/* if ((*paramsstep).a<anr){
return 1.;
} else {
return Varr[(*paramsstep).n]/(*paramsstep).a;
} */
return Varr[(*paramsstep).n]*mrel/sqrt(square((*paramsstep).a*mrel)+square(Varr[(*paramsstep).n]*mrel));
}
double epsilonoverqtimesV(struct paramsstepstruct *paramsstep){
/* if ((*paramsstep).a<anr){
return Varr[(*paramsstep).n];
} else {
return (*paramsstep).a;
}*/
return sqrt(square((*paramsstep).a*mrel)+square(Varr[(*paramsstep).n]*mrel))/mrel;
}
double dlogf(struct paramsstepstruct *paramsstep){
if ((*paramsstep).wdmflag==0){
return dlogfNRarr[(*paramsstep).n];
}
else{
return dlogfrelarr[(*paramsstep).n];
}
}
double dlogfoverV(struct paramsstepstruct *paramsstep){
if ((*paramsstep).wdmflag==0){
return dlogfoverVNRarr[(*paramsstep).n];
} else {
return dlogfoverVrelarr[(*paramsstep).n];
}
}
double deltaDMpreffun(struct paramsstepstruct *paramsstep){
double ddmpref;
if ((*paramsstep).wdmflag==0){
ddmpref=deltaDMprefNR[(*paramsstep).n];
} else {
ddmpref= deltaDMprefwdm[(*paramsstep).n]*epsilon(paramsstep)/((*paramsstep).rhoDMa*square((*paramsstep).a)*square((*paramsstep).a));
}
return ddmpref;
}
double vDMpreffun(struct paramsstepstruct *paramsstep){
if ((*paramsstep).wdmflag==0){
return vDMprefNR[(*paramsstep).n]/
((*paramsstep).k*(*paramsstep).a);
} else {
return vDMprefwdm[(*paramsstep).n]/
((*paramsstep).k*(*paramsstep).rhoDMa*(1+(*paramsstep).wDM)*square((*paramsstep).a)*square((*paramsstep).a));
}
}
double viscpreffun
(struct paramsstepstruct *paramsstep){
if ((*paramsstep).wdmflag==0){
return 1/square((*paramsstep).a)*viscprefNR[(*paramsstep).n];
} else {
return viscprefwdm[(*paramsstep).n]/ (epsilon(paramsstep)*(*paramsstep).rhoDMa*(1+(*paramsstep).wDM)*square((*paramsstep).a)*square((*paramsstep).a));
}
}