31 STATIC double cross_section(
double EgammaRyd,
double EthRyd,
long nelem,
long n,
long l,
long s);
41 double He_cross_section(
double EgammaRyd ,
double EthRyd,
long n,
long l,
long S,
long nelem )
44 double cs =
cross_section( EgammaRyd, EthRyd, nelem, n, l, S );
47 if( nelem==
ipHELIUM && n <=5 && l<=2 )
49 static const double rescaled[31] = {
51 5.485, 9.219, 15.985, 15.985, 15.985, 13.504,
52 8.018, 14.417, 28.501, 18.486, 18.132, 27.009,
53 10.721, 20.235, 41.568, 36.717, 35.766, -1.000, -1.000, 41.787,
54 13.527, 26.539, 55.692, 55.010, 53.514, -1.000, -1.000, -1.000, -1.000, 58.120 };
56 ASSERT( rescaled[ipLev] > 0. );
57 cs *= rescaled[ipLev]/
cross_section( EthRyd, EthRyd, nelem, n, l, S );
71 static const double E0[29] = {
72 1.36E+01,2.01E+01,1.76E+01,3.34E+01,4.62E+01,6.94E+01,8.71E+01,1.13E+02,1.59E+02,2.27E+02,
73 2.04E+02,2.74E+02,2.75E+02,3.38E+02,4.39E+02,4.17E+02,4.47E+02,5.18E+02,6.30E+02,6.27E+02,
74 8.66E+02,7.67E+02,9.70E+02,9.66E+02,1.06E+03,1.25E+03,1.35E+03,1.43E+03,1.56E+03};
75 static const double sigma[29] = {
76 9.49E+02,3.20E+02,5.46E+02,2.85E+02,2.34E+02,1.52E+02,1.33E+02,1.04E+02,6.70E+01,4.00E+01,
77 6.14E+01,4.04E+01,4.75E+01,3.65E+01,2.45E+01,3.14E+01,3.11E+01,2.59E+01,1.94E+01,2.18E+01,
78 1.23E+01,1.76E+01,1.19E+01,1.31E+01,1.20E+01,9.05E+00,8.38E+00,8.06E+00,7.17E+00};
79 static const double y_a[29] = {
80 1.47E+00,7.39E+00,1.72E+01,2.16E+01,2.18E+01,2.63E+01,2.54E+01,2.66E+01,3.35E+01,5.32E+01,
81 2.78E+01,3.57E+01,2.85E+01,3.25E+01,4.41E+01,3.16E+01,3.04E+01,3.28E+01,3.92E+01,3.45E+01,
82 5.89E+01,3.88E+01,5.35E+01,4.83E+01,5.77E+01,6.79E+01,7.43E+01,7.91E+01,9.10E+01};
83 static const double P[29] = {
84 3.19E+00,2.92E+00,3.16E+00,2.62E+00,2.58E+00,2.32E+00,2.34E+00,2.26E+00,2.00E+00,1.68E+00,
85 2.16E+00,1.92E+00,2.14E+00,2.00E+00,1.77E+00,2.04E+00,2.09E+00,2.02E+00,1.86E+00,2.00E+00,
86 1.62E+00,1.93E+00,1.70E+00,1.79E+00,1.72E+00,1.61E+00,1.59E+00,1.58E+00,1.54E+00};
87 static const double y_w[29] =
88 {2.039,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
89 static const double yzero[29] =
90 {0.4434,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
91 static const double yone[29] =
92 {2.136,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
94 double pcs,Egamma,y,F,x;
95 double rel_photon_energy;
97 Egamma = EgammaRyd * EVRYD;
102 rel_photon_energy = EgammaRyd / EthRyd;
103 rel_photon_energy =
MAX2( rel_photon_energy , 1. + FLT_EPSILON*2. );
113 if( nelem==
ipHELIUM && n<=25 && l<=4 )
118 else if( nelem==
ipHELIUM && n>25 && l<=2 )
120 static const double scale[3][2] = {
128 pcs *= pow((
double)n/25., scale[l][s]);
135 x = Egamma/E0[nelem-1] - yzero[nelem-1];
136 y = sqrt(x*x + yone[nelem-1]*yone[nelem-1]);
137 F = ((x-1)*(x-1)+y_w[nelem-1]*y_w[nelem-1])
138 * pow(y,0.5*P[nelem-1]-5.5) * pow((1+sqrt(y/y_a[nelem-1])),-P[nelem-1]);
139 pcs = sigma[nelem-1]*F;
145 ASSERT( numDataPoints > 0 );
161 pcs = (1.e18)*
H_photo_cs(rel_photon_energy , n, l, nelem);
164 ASSERT( pcs > 0. && pcs < 1.E10 );
194 double lambda = TE1RYD * nelem * nelem / temp;
197 double x = lambda / n / n;
199 double SzeroOfX = 0.;
202 double SnOfLambda = 0.;
203 double lowerlimit, upperlimit, step;
205 fixit(
"the variant below should be faster and more accurate, but needs more testing");
211 upperlimit = lowerlimit + step;
216 lowerlimit = upperlimit;
218 upperlimit = lowerlimit + step;
220 }
while ( upperlimit < 20. );
229 upperlimit = lowerlimit + step;
230 SoneOfX =
qg32(lowerlimit, upperlimit,
X1Int);
231 StwoOfX =
qg32(lowerlimit, upperlimit,
X2Int);
235 lowerlimit = upperlimit;
237 upperlimit = lowerlimit + step;
238 SoneOfX +=
qg32( lowerlimit, upperlimit,
X1Int);
239 StwoOfX +=
qg32( lowerlimit, upperlimit,
X2Int);
240 }
while ( upperlimit < 200. );
242 SoneOfX *= 0.1728 *
powpq( x, 1, 3 );
243 StwoOfX *= -0.0496 *
powpq( x, 2, 3 );
246 SnOfLambda = SzeroOfX +
powpq(1./lambda, 1, 3)*SoneOfX +
powpq(1./lambda, 2, 3)*StwoOfX;
251 double gamma13 = tgamma(1./3.);
252 double gamma23 = PI2/(sqrt(3.)*gamma13);
253 double x13 = cbrt(x);
254 double x23 =
pow2(x13);
255 double SSoneOfX = 0.1728*((3.*x+1)*
igamc_scaled(1./3.,x)*gamma13 - 3.*x13);
256 double SStwoOfX = -0.0496*(((1.5*x+2.)*x+1.)*
igamc_scaled(2./3.,x)*gamma23 - 1.5*x23*(x+1.));
257 double SSnOfLambda = SSzeroOfX +
powpq(1./lambda, 1, 3)*SSoneOfX +
powpq(1./lambda, 2, 3)*SStwoOfX;
259 dprintf(
ioQQQ,
"%e %e %e %e %e old %e new %e\n", x, SzeroOfX/SSzeroOfX-1., SoneOfX/SSoneOfX-1.,
260 StwoOfX/SStwoOfX-1., SnOfLambda/SSnOfLambda-1., SnOfLambda, SSnOfLambda );
263 AlphaN = 5.197E-14 * nelem *
powpq(x, 3, 2) * SnOfLambda;
272 Integrand = exp( -v +
Xn_S59) / v;
281 Integrand =
powpq(1./(u + 1.), 5, 3) * (u - 1.) * exp( -
Xn_S59 * u );
290 Integrand =
powpq(1./(u + 1.), 7, 3) * (u*u + 4./3.*u + 1.) * exp( -
Xn_S59 * u );
298 double lambda = TE1RYD * nelem * nelem / temp;
301 double x = lambda / n / n;
307 double gamma13 = tgamma(1./3.);
308 double gamma23 = PI2/(sqrt(3.)*gamma13);
309 double x13 = cbrt(x);
310 double x23 =
pow2(x13);
311 double SoneOfX = 0.172826*((3.*x+1)*
igamc_scaled(1./3.,x)*gamma13 - 3.*x13);
312 double StwoOfX = -0.0495957*(((1.5*x+2.)*x+1.)*
igamc_scaled(2./3.,x)*gamma23 - 1.5*x23*(x+1.));
315 double z13 = cbrt(1./lambda);
316 double SnOfLambda = (StwoOfX*z13 + SoneOfX)*z13 + SzeroOfX;
318 return 5.197e-14 * nelem *
powpq(x,3,2) * SnOfLambda;
NORETURN void TotalInsanity(void)
STATIC double ExponentialInt(double v)
STATIC double X1Int(double u)
STATIC double X2Int(double u)
t_iso_sp iso_sp[NISO][LIMELM]
int dprintf(FILE *fp, const char *format,...)
#define NUM_HS98_DATA_POINTS
STATIC double GetHS98CrossSection(long n, long l, long s, double EgammaRyd)
double **** HS_He1_Xsectn
double ***** OP_Helike_Xsectn
multi_arr< long, 3 > QuantumNumbers2Index
double H_photo_cs(double rel_photon_energy, long int n, long int l, long int iz)
double qg32(double, double, double(*)(double))
double **** HS_He1_Energy
double powpq(double x, int p, int q)
double ***** OP_Helike_Energy
double linint(const double x[], const double y[], long n, double xval)
long **** OP_Helike_NumPts
STATIC double cross_section(double EgammaRyd, double EthRyd, long nelem, long n, long l, long s)
double e1_scaled(double x)
double igamc_scaled(double a, double x)
double Recomb_Seaton59(long nelem, double temp, long n)
double He_cross_section(double EgammaRyd, double EthRyd, long n, long l, long S, long nelem)