24 for (i = 0; i < nlev; i++) {
27 for (j = 0; j < nlev; j++) {
37 for (i = 0; i < nlev; i++) {
38 for (j = i + 1; j < nlev; j++) {
48 tmpx = 0.6199646 * log(T) - 6.2803580;
49 scrh = 0.5 * X->
omega[
i][
j][0] + X->
omega[
i][
j][1] * tmpx + X->
omega[
i][
j][2] * (2.*tmpx*tmpx - 1) + X->
omega[i][j][3] * (4.*tmpx*tmpx*tmpx - 3*tmpx);
54 q[
j][
i] *= 8.629e-6/sqrt(T);
57 for (i = 0; i < nlev; i++) q[i][i] = 0.0;
63 for (i = 0 ; i < nlev ; i++) {
64 for (j = 0 ; j < nlev ; j++) {
67 for (k = 0 ; k < nlev ; k++) {
68 if (k != i) scrh += Ne*q[
i][
k];
69 if (k < i) scrh += X->
A[
i][
k];
73 if (j < i) M[
i][
j] = Ne*q[
j][
i];
74 if (j > i) M[
i][
j] = Ne*q[
j][
i] + X->
A[
j][
i];
82 for (j = 0; j < nlev; j++) {
93 for (i = 0 ; i < nlev ; i++) X->
Ni[i] = rhs[i];
112 for (i = 0; i < X->
nlev; i++) {
113 for (j = 0; j < X->
nlev; j++) {
114 if (X->
dE[i][j] > 0.0) {
117 for (n = 0; n < X->
nTom; n++){
118 if ( (X->
omega[i][j][n] > 0.0)
119 || (X->
isH && X->
omega[i][j][n] != 0.0)
130 for (i = 0; i < X->
nlev; i++){
131 for (j = 0; j < X->
nlev; j++) {
132 if (X->
dE[i][j] < 0.0) { X->
dE[
i][
j] = 0.0; X->
A[
i][
j] = 0.0;
for (n = 0; n < X->
nTom; n++) X->
omega[i][j][n] = 0.000; }
133 if (X->
A[i][j] < 0.0) { X->
A[
i][
j] = 0.0;
for (n = 0; n < X->
nTom; n++) X->
omega[i][j][n] = 0.000; }
134 if (X->
dE[i][j] > 0.0) X->
dE[
i][
j] = 1.2399e-4/(1.e-8*X->
dE[
i][
j]) ;
143 for (i = 0; i < X->
nlev; i++) {
144 for (j = i; j < X->
nlev; j++) {
152 for (i = 0; i < X->
nlev; i++) {
153 for (n = 0; n < X->
nTom; n++) X->
omega[i][i][n] = 0.000;
161 double lagrange (
double *x,
double *y,
double xp,
int n,
int ii,
int jj)
185 if (xp < x[0])
return (y[0]);
186 if (xp > x[n-1])
return (y[n-1]);
188 for (i = 0; i <
n; i++){
190 for (k = 0; k <
n; k++){
191 if (k == i)
continue;
192 scrh *= (xp - x[
k])/(x[i] - x[k]);
206 #define ZERO_5X 0.0, 0.0, 0.0, 0.0, 0.0
208 double T, t4, tmprec, lam,
f1, f2, x1, x2, P, Q, F[2], Tn[9];
210 long int nv,
i,
j, ti1, ti2, cindex;
212 static double **coll_ion, **rad_rec, **diel_rec, **chtr_hp, **chtr_h, **chtr_he, **tot_recs;
216 double coll_ion_P[] = { 0., 0., 1.
223 double coll_ion_A[] = { 0.291e-7, 0.175e-7, 0.0000
224 C_EXPAND(0.685e-7, 0.185e-7, 0.635e-8, 0.150e-8, 0.0000)
225 N_EXPAND(0.482e-7, 0.298e-7, 0.810e-8, 0.371e-8, 0.0000)
226 O_EXPAND(0.359e-7, 0.139e-7, 0.931e-8, 0.102e-7, 0.0000)
227 Ne_EXPAND(0.150e-7, 0.198e-7, 0.703e-8, 0.424e-8, 0.0000)
228 S_EXPAND(0.549e-7, 0.681e-7, 0.214e-7, 0.166e-7, 0.0000)
230 double coll_ion_X[] = { 0.232, 0.180, 0.265
231 C_EXPAND( 0.193, 0.286, 0.427, 0.416, 0.0000)
232 N_EXPAND(0.0652, 0.310, 0.350, 0.549, 0.0167)
233 O_EXPAND( 0.073, 0.212, 0.270, 0.614, 0.630)
234 Ne_EXPAND(0.0329, 0.295, 0.0677, 0.0482, 0.0000)
235 S_EXPAND( 0.100, 0.693, 0.353, 1.030, 0.0000)
237 double coll_ion_K[] = { 0.39, 0.35, 0.25
238 C_EXPAND(0.25, 0.24, 0.21, 0.13, 0.02)
239 N_EXPAND(0.42, 0.30, 0.24, 0.18, 0.74)
240 O_EXPAND(0.34, 0.22, 0.27, 0.27, 0.17)
242 S_EXPAND(0.25, 0.21, 0.24, 0.14, 0.00)
244 double coll_ion_Tmin[] = { 0., 0., 0.
260 double chtrH_ion_a[] = { 0.00, 0.00, 0.00
261 C_EXPAND( 0.00, 0.00, 0.00, 0.00, 0.00)
262 N_EXPAND(4.55e-3, 0.00, 0.00, 0.00, 0.00)
263 O_EXPAND( 7.4e-2, 0.00, 0.00, 0.00, 0.00)
265 S_EXPAND( 0.00, 0.00, 0.00, 0.00, 0.00)
267 double chtrH_ion_b[] = { 0.00, 0.00, 0.00
268 C_EXPAND( 0.00, 0.00, 0.00, 0.00, 0.00)
269 N_EXPAND(-0.29, 0.00, 0.00, 0.00, 0.00)
270 O_EXPAND( 0.47, 0.00, 0.00, 0.00, 0.00)
272 S_EXPAND( 0.00, 0.00, 0.00, 0.00, 0.00)
274 double chtrH_ion_c[] = { 0.00, 0.00, 0.00
275 C_EXPAND( 0.00, 0.00, 0.00, 0.00, 0.00)
276 N_EXPAND(-0.92, 0.00, 0.00, 0.00, 0.00)
277 O_EXPAND(24.37, 0.00, 0.00, 0.00, 0.00)
279 S_EXPAND( 0.00, 0.00, 0.00, 0.00, 0.00)
281 double chtrH_ion_d[] = { 0.00, 0.00, 0.00
282 C_EXPAND( 0.00, 0.00, 0.00, 0.00, 0.00)
283 N_EXPAND(-8.38, 0.00, 0.00, 0.00, 0.00)
284 O_EXPAND(-0.74, 0.00, 0.00, 0.00, 0.00)
286 S_EXPAND( 0.00, 0.00, 0.00, 0.00, 0.00)
288 double chtrH_ion_upT[] = { 0.00, 0.00, 0.00
289 C_EXPAND(1.0, 0.00, 0.00, 0.00, 0.00)
290 N_EXPAND(5.0, 0.00, 0.00, 0.00, 0.00)
291 O_EXPAND(1.0, 0.00, 0.00, 0.00, 0.00)
293 S_EXPAND(1.0, 0.00, 0.00, 0.00, 0.00)
298 double chtrH_rec_a[] = { 0.00, 7.46e-6, 0.00
299 C_EXPAND(1.76e-9, 1.67e-4, 3.25, 332.46, 0.00)
300 N_EXPAND(1.01e-3, 3.05e-1, 4.54, 3.28, 0.00)
301 O_EXPAND( 1.04, 1.04, 3.98, 0.252, 0.00)
302 Ne_EXPAND( 0.00, 1.00e-5, 14.73, 6.47, 0.00)
303 S_EXPAND(3.82e-7, 1.00e-5, 2.29, 6.44, 0.00)
306 double chtrH_rec_b[] = { 0.00, 2.06, 0.00
307 C_EXPAND( 8.33, 2.79, 0.21, -0.11, 0.00)
308 N_EXPAND( -0.29, 0.60, 0.57, 0.52, 0.00)
309 O_EXPAND(3.15e-2, 0.27, 0.26, 0.63, 0.00)
310 Ne_EXPAND( 0.00, 0.00, 4.52e-2, 0.54, 0.00)
311 S_EXPAND( 11.10, 0.00, 4.02e-2, 0.13, 0.00)
313 double chtrH_rec_c[] = { 0.00, 9.93, 0.00
314 C_EXPAND(4278.78, 304.72, 0.19, -0.995, 0.00)
315 N_EXPAND( -0.92, 2.65, -0.65, -0.52, 0.00)
316 O_EXPAND( -0.61, 2.02, 0.56, 2.08, 0.00)
317 Ne_EXPAND( 0.00, 0.00, -0.84, 3.59, 0.00)
318 S_EXPAND(2.57e+4, 0.00, 1.59, 2.69, 0.00)
320 double chtrH_rec_d[] = { 0.00, -3.89, 0.00
321 C_EXPAND(-6.41, -4.07, -3.29, -1.58e-3, 0.00)
322 N_EXPAND(-8.38, -0.93, -0.89, -0.19, 0.00)
323 O_EXPAND(-9.73, -5.92, -2.62, -4.16, 0.00)
324 Ne_EXPAND( 0.00, 0.00, -0.31, -5.22, 0.00)
325 S_EXPAND(-8.22, 0.00, -6.06, -5.69, 0.00)
327 double chtrH_rec_upT[] = { 0.00, 1.e+5, 1.e+7
328 C_EXPAND(1.e+4, 5.e+4, 1.e+5, 1.e+5, 0.00)
329 N_EXPAND(5.e+4, 1.e+5, 1.e+5, 3.e+5, 0.00)
330 O_EXPAND(1.e+4, 1.e+5, 5.e+4, 3.e+4, 0.00)
331 Ne_EXPAND( 0.00, 5.e+4, 5.e+4, 3.e+4, 0.00)
332 S_EXPAND(1.e+4, 3.e+4, 3.e+4, 3.e+4, 0.00)
339 double chtrH_rec_o1[8] = {3.348706E+00, 1.281922E+00, -1.870663E+00,-7.195090E-01,-2.473806E-01, 8.577410E-02, 1.721933E-02, 9.213735E-03};
340 double chtrH_rec_o2[8] = {3.266558E+00, 2.264383E+00, -1.019642E+00,-1.090796E+00,-4.403829E-01,-1.369024E-01, 1.606288E-01, 1.925501E-01};
341 double chtrH_rec_o3[8] = {4.860561E+00, 1.680463E+00, -1.110986E+00,-1.346895E+00,-2.697744E-01, 1.329470E-01,-4.511763E-02, 4.614949E-02};
342 double chtrH_rec_o4[8] = {4.680553E+00, 2.456278E+00, -1.026270E+00,-1.587952E+00,-1.318074E-01, 1.451866E-01,-1.526627E-01, 7.596889E-02};
343 double chtrH_rec_o5[8] = {5.723788E+00, 1.771316E+00, -1.254652E+00,-9.009546E-01,-3.558194E-01 -7.138940E-02, 2.846941E-02, 1.313952E-01};
344 double chtrH_rec_Tmin = 1.0e+2, chtrH_rec_Tmax = 1.0e+10;
350 double chtrHe_rec_a1[] = { 0.00, 0.00, 0.00
351 C_EXPAND(0.00, 0.00, 1.12, 3.12e-7, 0.00)
352 N_EXPAND(0.00, 4.84e-1, 2.05, 1.26e-2, 0.00)
353 O_EXPAND(0.00, 7.10e-3, 1.12, 0.997, 0.00)
354 Ne_EXPAND(0.00, 1.00e-5, 1.00e-5, 1.77, 0.00)
355 S_EXPAND(0.00, 0.00, 3.58, 7.44e-4, 0.00)
357 double chtrHe_rec_b1[] = { 0.00, 0.00, 0.00
358 C_EXPAND(0.00, 0.00, 0.42, -7.37e-2, 0.00)
359 N_EXPAND(0.00, 0.92, 0.23, 1.55, 0.00)
360 O_EXPAND(0.00, 2.60, 0.42, 0.40, 0.00)
362 S_EXPAND(0.00, 0.00, 7.77e-3, 0.34, 0.00)
364 double chtrHe_rec_c1[] = { 0.00, 0.00, 0.00
365 C_EXPAND(0.00, 0.00, -0.69, 3.50e+1, 0.00)
366 N_EXPAND(0.00, 2.37, -0.72, 11.2, 0.00)
367 O_EXPAND(0.00, 8.99, -0.71, -0.46, 0.00)
368 Ne_EXPAND(0.00, 0.00, 0.00, 4.88e-2, 0.00)
369 S_EXPAND(0.00, 0.00, -0.94, 3.74, 0.00)
371 double chtrHe_rec_d1[] = { 0.00, 0.00, 0.00
372 C_EXPAND(0.00, 0.00, -0.34, 2.40, 0.00)
373 N_EXPAND(0.00, -10.2, -0.19, -7.82, 0.00)
374 O_EXPAND(0.00, -0.78, -1.98e-2, -0.35, 0.00)
376 S_EXPAND(0.00, 0.00, -0.30, -5.18, 0.00)
379 double chtrHe_rec_a2[] = { 0.00, 0.00, 0.00
380 C_EXPAND(0.00, 0.00, 1.12, 3.12e-7, 0.00)
381 N_EXPAND(0.00, 4.84e-1, 2.05, 1.26e-2, 0.00)
382 O_EXPAND(0.00, 7.10e-3, 1.12, 0.997, 0.00)
383 Ne_EXPAND(0.00, 8.48e-3, 1.00e-5, 1.77, 0.00)
384 S_EXPAND(0.00, 0.00, 3.58, 7.44e-4, 0.00)
386 double chtrHe_rec_b2[] = { 0.00, 0.00, 0.00
387 C_EXPAND(0.00, 0.00, 0.42, -7.37e-2, 0.00)
388 N_EXPAND(0.00, 0.92, 0.23, 1.55, 0.00)
389 O_EXPAND(0.00, 2.60, 0.42, 0.40, 0.00)
391 S_EXPAND(0.00, 0.00, 7.77e-3, 0.34, 0.00)
393 double chtrHe_rec_c2[] = { 0.00, 0.00, 0.00
394 C_EXPAND(0.00, 0.00, -0.69, 3.50e+1, 0.00)
395 N_EXPAND(0.00, 2.37, -0.72, 11.2, 0.00)
396 O_EXPAND(0.00, 8.99, -0.71, -0.46, 0.00)
397 Ne_EXPAND(0.00, -1.92, 0.00, 4.88e-2, 0.00)
398 S_EXPAND(0.00, 0.00, -0.94, 3.74, 0.00)
400 double chtrHe_rec_d2[] = { 0.00, 0.00, 0.00
401 C_EXPAND(0.00, 0.00, -0.34, 2.40, 0.00)
402 N_EXPAND(0.00, -10.2, -0.19, -7.82, 0.00)
403 O_EXPAND(0.00, -0.78, -1.98e-2, -0.35, 0.00)
404 Ne_EXPAND(0.00, -1.50, 0.00, -3.35, 0.00)
405 S_EXPAND(0.00, 0.00, -0.30, -5.18, 0.00)
408 double chtrHe_rec_a3[] = { 0.00, 0.00, 0.00
409 C_EXPAND(0.00, 0.00, 1.12, 1.49e-5, 0.00)
410 N_EXPAND(0.00, 4.84e-1, 2.05, 1.26e-2, 0.00)
411 O_EXPAND(0.00, 7.10e-3, 1.12, 0.997, 0.00)
412 Ne_EXPAND(0.00, 2.52e-2, 1.34e-4, 1.77, 0.00)
413 S_EXPAND(0.00, 0.00, 3.58, 7.44e-4, 0.00)
415 double chtrHe_rec_b3[] = { 0.00, 0.00, 0.00
416 C_EXPAND(0.00, 0.00, 0.42, 2.73, 0.00)
417 N_EXPAND(0.00, 0.92, 0.23, 1.55, 0.00)
418 O_EXPAND(0.00, 2.60, 0.42, 0.40, 0.00)
420 S_EXPAND(0.00, 0.00, 7.77e-3, 0.34, 0.00)
422 double chtrHe_rec_c3[] = { 0.00, 0.00, 0.00
423 C_EXPAND(0.00, 0.00, -0.69, 5.93, 0.00)
424 N_EXPAND(0.00, 2.37, -0.72, 11.2, 0.00)
425 O_EXPAND(0.00, 8.99, -0.71, -0.46, 0.00)
426 Ne_EXPAND(0.00, -1.99, -2.55, 4.88e-2, 0.00)
427 S_EXPAND(0.00, 0.00, -0.94, 3.74, 0.00)
429 double chtrHe_rec_d3[] = { 0.00, 0.00, 0.00
430 C_EXPAND(0.00, 0.00, -0.34, -8.74e-2, 0.00)
431 N_EXPAND(0.00, -10.2, -0.19, -7.82, 0.00)
432 O_EXPAND(0.00, -0.78, -1.98e-2, -0.35, 0.00)
433 Ne_EXPAND(0.00, -0.91, -0.37, -3.35, 0.00)
434 S_EXPAND(0.00, 0.00, -0.30, -5.18, 0.00)
437 double chtrHe_rec_a4[] = { 0.00, 0.00, 0.00
438 C_EXPAND(0.00, 0.00, 1.12, 1.49e-5, 0.00)
439 N_EXPAND(0.00, 3.17, 2.05, 1.26e-2, 0.00)
440 O_EXPAND(0.00, 6.21e-1, 1.12, 0.997, 0.00)
441 Ne_EXPAND(0.00, 2.52e-2, 1.34e-4, 2.67e-1, 0.00)
442 S_EXPAND(0.00, 0.00, 0.00, 0.00, 0.00)
444 double chtrHe_rec_b4[] = { 0.00, 0.00, 0.00
445 C_EXPAND(0.00, 0.00, 0.42, 2.73, 0.00)
446 N_EXPAND(0.00, 0.20, 0.23, 1.55, 0.00)
447 O_EXPAND(0.00, 0.53, 0.42, 0.40, 0.00)
449 S_EXPAND(0.00, 0.00, 0.00, 0.00, 0.00)
451 double chtrHe_rec_c4[] = { 0.00, 0.00, 0.00
452 C_EXPAND(0.00, 0.00, -0.69, 5.93, 0.00)
453 N_EXPAND(0.00, -0.72, -0.72, 11.2, 0.00)
454 O_EXPAND(0.00, -0.66, -0.71, -0.46, 0.00)
455 Ne_EXPAND(0.00, -1.99, -2.55, 0.91, 0.00)
456 S_EXPAND(0.00, 0.00, 0.00, 0.00, 0.00)
458 double chtrHe_rec_d4[] = { 0.00, 0.00, 0.00
459 C_EXPAND(0.00, 0.00, -0.34, -8.74e-2, 0.00)
460 N_EXPAND(0.00, -4.81e-2, -0.19, -7.82, 0.00)
461 O_EXPAND(0.00, -2.22e-2, -1.98e-2, -0.35, 0.00)
462 Ne_EXPAND(0.00, -0.91, -0.37, -1.88e-2, 0.00)
463 S_EXPAND(0.00, 0.00, 0.00, 0.00, 0.00)
466 double chtrHe_rec_a5[] = { 0.00, 0.00, 0.00
467 C_EXPAND(0.00, 0.00, 1.12, 1.49e-5, 0.00)
468 N_EXPAND(0.00, 3.17, 2.05, 3.75e-1, 0.00)
469 O_EXPAND(0.00, 6.21e-1, 1.12, 0.997, 0.00)
470 Ne_EXPAND(0.00, 2.52e-2, 0.1, 2.67e-1, 0.00)
471 S_EXPAND(0.00, 0.00, 0.00, 0.00, 0.00)
473 double chtrHe_rec_b5[] = { 0.00, 0.00, 0.00
474 C_EXPAND(0.00, 0.00, 0.42, 2.73, 0.00)
475 N_EXPAND(0.00, 0.20, 0.23, 0.54, 0.00)
476 O_EXPAND(0.00, 0.53, 0.42, 0.40, 0.00)
478 S_EXPAND(0.00, 0.00, 0.00, 0.00, 0.00)
480 double chtrHe_rec_c5[] = { 0.00, 0.00, 0.00
481 C_EXPAND(0.00, 0.00, -0.69, 5.93, 0.00)
482 N_EXPAND(0.00, -0.72, -0.72, -0.82, 0.00)
483 O_EXPAND(0.00, -0.66, -0.71, -0.46, 0.00)
484 Ne_EXPAND(0.00, -1.99, -1.09, 0.91, 0.00)
485 S_EXPAND(0.00, 0.00, 0.00, 0.00, 0.00)
487 double chtrHe_rec_d5[] = { 0.00, 0.00, 0.00
488 C_EXPAND(0.00, 0.00, -0.34, -8.74e-2, 0.00)
489 N_EXPAND(0.00, -4.81e-2, -0.19, -2.07e-2, 0.00)
490 O_EXPAND(0.00, -2.22e-2, -1.98e-2, -0.35, 0.00)
491 Ne_EXPAND(0.00, -0.91, -2.47e-2, -1.88e-2, 0.00)
492 S_EXPAND(0.00, 0.00, 0.00, 0.00, 0.00)
496 double rad_rec_a[] = { 5.596, 0.0000, 0.0000
497 C_EXPAND(5.068, 5.434, 4.742, 4.051, 0.00)
498 N_EXPAND(3.874, 4.974, 4.750, 4.626, 0.00)
499 O_EXPAND(3.201, 4.092, 4.890, 14.665, 0.00)
500 Ne_EXPAND(0.000, 0.000, 0.000, 0.0000, 0.00)
501 S_EXPAND(0.000, 0.000, 0.000, 0.0000, 0.00) };
504 double rad_rec_b[] = { -0.6038, 0.0000, 0.0000
505 C_EXPAND(-0.6192, -0.6116, -0.6167, -0.6270, 0.00)
506 N_EXPAND(-0.6487, -0.6209, -0.5942, -0.9521, 0.00)
507 O_EXPAND(-0.6880, -0.6413, -0.6213, -0.5140, 0.00)
508 Ne_EXPAND( 0.0000, 0.0000, 0.0000, 0.0000, 0.00)
509 S_EXPAND( 0.0000, 0.0000, 0.0000, 0.0000, 0.00)};
512 double rad_rec_c[] = { 0.3436, 0.0000, 0.0000
513 C_EXPAND(-0.0815, 0.0694, 0.2960, 0.5054, 0.00)
514 N_EXPAND( 0.0000, 0.0000, 0.8452, 0.4729, 0.00)
515 O_EXPAND(-0.0174, 0.0000, 0.0184, 2.7300, 0.00)
516 Ne_EXPAND( 0.0000, 0.0000, 0.0000, 0.0000, 0.00)
517 S_EXPAND( 0.0000, 0.0000, 0.0000, 0.0000, 0.00)};
520 double rad_rec_d[] = { 0.4479, 0.0000, 0.0000
521 C_EXPAND(1.2910, 0.7866, 0.6167, 0.6692, 0.00)
522 N_EXPAND(1.0000, 1.0000, 2.8450, -0.4477, 0.00)
523 O_EXPAND(1.7070, 1.0000, 1.5550, 0.2328, 0.00)
524 Ne_EXPAND(0.0000, 0.0000, 0.0000, 0.0000, 0.00)
525 S_EXPAND(0.0000, 0.0000, 0.0000, 0.0000, 0.00) };
530 double diel_rec_a[] = { 0.0000, 0.0000, 0.0000
531 C_EXPAND(0.0108, 1.8267, 2.3196, 0.0000, 0.00)
532 N_EXPAND(0.0000, 0.0320, -0.8806, 0.4134, 0.00)
533 O_EXPAND(0.0000, -0.0036, 0.0000, 0.0061, 0.00)
534 Ne_EXPAND(0.0000, 0.0000, 0.0000, 0.0000, 0.00)
535 S_EXPAND(0.0000, 0.0000, 0.0000, 0.0000, 0.00) };
536 double diel_rec_b[] = { 0.0000, 0.0000, 0.0000
537 C_EXPAND(-0.1075, 4.1012, 10.7328, 0.0000, 0.00)
538 N_EXPAND( 0.6310, -0.6624, 11.2406, -4.6319, 0.00)
539 O_EXPAND( 0.0238, 0.7519, 21.8790, 0.2269, 0.00)
540 Ne_EXPAND( 0.0000, 0.0000, 0.0000, 0.0000, 0.00)
541 S_EXPAND( 0.0000, 0.0000, 0.0000, 0.0000, 0.00) };
542 double diel_rec_c[] = { 0.0000, 0.0000, 0.0000
543 C_EXPAND(0.2810, 4.8443, 6.8830, 0.0000, 0.00)
544 N_EXPAND(0.1990, 4.3191, 30.7066, 25.9172, 0.00)
545 O_EXPAND(0.0659, 1.5252, 16.2730, 32.1419, 0.00)
546 Ne_EXPAND(0.0000, 0.0000, 0.0000, 0.0000, 0.00)
547 S_EXPAND(0.0000, 0.0000, 0.0000, 0.0000, 0.00) };
548 double diel_rec_d[] = { 0.0000, 0.0000, 0.0000
549 C_EXPAND(-0.0193, 0.2261, -0.1824, 0.0000, 0.00)
550 N_EXPAND(-0.0197, 0.0003, -1.1721, -2.2290, 0.00)
551 O_EXPAND( 0.0349, -0.0838, -0.7020, 1.9939, 0.00)
552 Ne_EXPAND( 0.0000, 0.0000, 0.0000, 0.0000, 0.00)
553 S_EXPAND( 0.0000, 0.0000, 0.0000, 0.0000, 0.00) };
554 double diel_rec_f[] = { 0.0000, 0.0000, 0.0000
555 C_EXPAND(-0.1127, 0.5960, 0.4101, 0.0000, 0.00)
556 N_EXPAND( 0.4398, 0.5946, 0.6127, 0.2360, 0.00)
557 O_EXPAND( 0.5334, 0.2769, 1.1899, -0.0646, 0.00)
558 Ne_EXPAND( 0.0000, 0.0000, 0.0000, 0.0000, 0.00)
559 S_EXPAND( 0.0000, 0.0000, 0.0000, 0.0000, 0.00) };
564 double tot_rec_T[5] = { 5.e+3, 1.1e+4, 5.5e+4, 1.1e+5, 2.2e+5 };
565 static int tot_rec_ions[] = { 0, 1, 18, 19, 20, 21, 23, 24, 25, 26};
566 double tot_rec[][5] = { { -12.5, -13.0, -13.2, -13.4, -13.65 },
567 { -12.5, -12.6, -12.8, -12.1, -11.75 },
569 { -12.3, -12.5, -12.6, -11.8, -11.7 },
570 { -11.7, -11.9, -11.6, -11.3, -11.3 },
571 { -11.2, -11.4, -11.6, -10.9, -11.1 },
572 { -11.0, -11.1, -11.3, -10.6, -10.7 },
573 { -12.5, -12.4, -10.9, -10.95, -11.4 },
574 { -11.7, -11.8, -10.6, -10.3, -10.6 },
575 { -11.4, -11.6, -10.0, -9.8, -10.1 },
576 { -11.2, -11.3, -9.9, -9.7, -10.0 } };
578 double tot_recH_He[2][5] = {{ -12.5, -13.0, -13.2, -13.4, -13.65 },
579 { -12.5, -12.6, -12.8, -12.1, -11.75 }};
580 double tot_recNe[][5] = { { -12.3, -12.5, -12.6, -11.8, -11.7 },
581 { -11.7, -11.9, -11.6, -11.3, -11.3 },
582 { -11.2, -11.4, -11.6, -10.9, -11.1 },
583 { -11.0, -11.1, -11.3, -10.6, -10.7 }};
584 double tot_recS[][5] = { { -12.5, -12.4, -10.9, -10.95, -11.4 },
585 { -11.7, -11.8, -10.6, -10.3, -10.6 },
586 { -11.4, -11.6, -10.0, -9.8, -10.1 },
587 { -11.2, -11.3, -9.9, -9.7, -10.0 }};
592 double fe_rr_A [3] = { 1.42e-13, 1.02e-12, 0.00 };
593 double fe_rr_eta [3] = { 0.891, 0.843, 0.00 };
595 double fe_dr_e1 [3] = { 1.670, 2.860, 0.000};
596 double fe_dr_e2 [3] = { 31.40, 52.1, 0.00};
597 double fe_dr_e3 [3] = { 0.00, 0.00, 0.00};
598 double fe_dr_e4 [3] = { 0.00, 0.00, 0.00};
599 double fe_dr_c1 [3] = { 2.30e-3, 1.50e-2, 0.00};
600 double fe_dr_c2 [3] = { 2.7e-3, 4.7e-3, 0.00};
601 double fe_dr_c3 [3] = { 0.00, 0.00, 0.00};
602 double fe_dr_c4 [3] = { 0.00, 0.00, 0.00};
607 print1(
"> MINeq: creating ionization coefficients tables...\n");
608 print1(
" * collisional ionization\n");
614 for (nv = 0; nv <
NIONS; nv++) {
615 if ( coll_ion_Tmin[nv] <
to_ev(T) )
616 coll_ion[i][nv] = coll_ion_A[nv] * ( 1. + coll_ion_P[nv] * sqrt(
coll_ion_dE[nv]/
to_ev(T)) )
620 else coll_ion[
i][nv] = coll_ion_A[nv] * ( 1. + coll_ion_P[nv] * sqrt(
coll_ion_dE[nv]/
to_ev(T)) )
627 print1(
" * radiative recombination\n");
628 if (rad_rec == NULL) rad_rec =
ARRAY_2D(I_g_stepNumber,
NIONS,
double);
634 rad_rec[
i][nv] = 1.e-13 *
rad_rec_z[nv] * rad_rec_a[nv] * pow( 1.e-4*T/pow(
rad_rec_z[nv],2.), rad_rec_b[nv] )
635 / ( 1. + rad_rec_c[nv] * pow( 1.e-4*T/pow(
rad_rec_z[nv],2.), rad_rec_d[nv] ) ) ;
638 rad_rec[
i][nv] = 1.e-13 *
rad_rec_z[nv] * rad_rec_a[nv] * pow( 1.e-4*T/pow(
rad_rec_z[nv],2.), rad_rec_b[nv] )
639 / ( 1. + rad_rec_c[nv] * pow( 1.e-4*T/pow(
rad_rec_z[nv],2.), rad_rec_d[nv] ) )
642 else rad_rec[
i][nv] = 0.0;
646 rad_rec[
i][0] = 5.197e-14 * sqrt(lam) * (0.4288 + 0.5 * log(lam) + 0.469 * pow(lam,-1./3.) );
649 rad_rec[i][nv] = fe_rr_A[nv - NIONS + 3] * pow( (T*1.e-4), -fe_rr_eta[nv-NIONS+3]);
653 print1(
" * dielectronic recombination\n");
654 if (diel_rec == NULL) diel_rec =
ARRAY_2D(I_g_stepNumber,
NIONS,
double);
660 diel_rec[
i][nv] = 1.e-12 * ( diel_rec_a[nv] / t4 + diel_rec_b[nv] + diel_rec_c[nv]*t4 + diel_rec_d[nv] * pow(t4,2.) )
661 * pow( t4, -3./2. ) * exp( -diel_rec_f[nv]/t4 );
665 diel_rec[
i][nv] = 1.6e-12 * pow(T, -1.5) * ( fe_dr_c1[nv-NIONS+3]*exp(-fe_dr_e1[nv-NIONS+3]/
to_ev(T))
666 + fe_dr_c2[nv-NIONS+3]*exp(-fe_dr_e2[nv-NIONS+3]/
to_ev(T))
667 + fe_dr_c3[nv-NIONS+3]*exp(-fe_dr_e3[nv-NIONS+3]/
to_ev(T))
668 + fe_dr_c4[nv-NIONS+3]*exp(-fe_dr_e4[nv-NIONS+3]/
to_ev(T)) );
673 print1(
" * charge transfer with H+\n");
674 if (chtr_hp == NULL) chtr_hp =
ARRAY_2D(I_g_stepNumber,
NIONS,
double);
679 for (nv = 0; nv <
NIONS; nv++) {
680 if (t4<=chtrH_ion_upT[nv])
681 chtr_hp[
i][nv] = 1.e-9 * chtrH_ion_a[nv] * pow( t4, chtrH_ion_b[nv] )
682 * ( 1. + chtrH_ion_c[nv] * exp ( chtrH_ion_d[nv]*t4 ));
683 else chtr_hp[
i][nv] = 1.e-9 * chtrH_ion_a[nv] * pow( t4, chtrH_ion_b[nv] )
684 * ( 1. + chtrH_ion_c[nv] * exp ( chtrH_ion_d[nv]*t4 ))
685 * exp( -(t4-chtrH_ion_upT[nv])/(5.e-2*chtrH_ion_upT[nv]));
689 print1(
" * charge transfer with H\n");
690 if (chtr_h == NULL) chtr_h =
ARRAY_2D(I_g_stepNumber,
NIONS,
double);
695 for (nv = 0; nv <
NIONS; nv++) {
696 if (T<=chtrH_rec_upT[nv])
697 chtr_h[
i][nv] = 1.e-9 * chtrH_rec_a[nv] * pow( t4, chtrH_rec_b[nv] )
698 * ( 1. + chtrH_rec_c[nv] * exp ( chtrH_rec_d[nv]*t4 ));
699 else chtr_h[
i][nv] = 1.e-9 * chtrH_rec_a[nv] * pow( t4, chtrH_rec_b[nv] )
700 * ( 1. + chtrH_rec_c[nv] * exp ( chtrH_rec_d[nv]*t4 ))
701 * exp( -(T - chtrH_rec_upT[nv])/(5.e-2*chtrH_rec_upT[nv]));
705 print1(
" * charge transfer with He\n");
706 if (chtr_he == NULL) chtr_he =
ARRAY_2D(I_g_stepNumber,
NIONS,
double);
711 for (nv = 0; nv <
NIONS; nv++) {
730 chtr_he[
i][nv] =
elem_ab[
el_He] * 1.e-9 * chtrHe_rec_a1[nv] * pow( t4, chtrHe_rec_b1[nv] )
731 * ( 1. + chtrHe_rec_c1[nv] * exp ( chtrHe_rec_d1[nv]*t4 ))
732 * (T>5000.0?exp( -(T-5000.0)/1.e2):1.0)
733 +
elem_ab[
el_He] * 1.e-9 * chtrHe_rec_a2[nv] * pow( t4, chtrHe_rec_b2[nv] )
734 * ( 1. + chtrHe_rec_c2[nv] * exp ( chtrHe_rec_d2[nv]*t4 ))
735 * (T>10000.0?exp( -(T-10000.0)/2.e2):1.0) * (T<5000.0?exp( -(5000.0-T)/1.e2):1.0)
736 +
elem_ab[
el_He] * 1.e-9 * chtrHe_rec_a3[nv] * pow( t4, chtrHe_rec_b3[nv] )
737 * ( 1. + chtrHe_rec_c3[nv] * exp ( chtrHe_rec_d3[nv]*t4 ))
738 * (T>50000.0?exp( -(T-50000.0)/1.e3):1.0) * (T<10000.0?exp( -(10000.0-T)/2.e2):1.0)
739 +
elem_ab[
el_He] * 1.e-9 * chtrHe_rec_a4[nv] * pow( t4, chtrHe_rec_b4[nv] )
740 * ( 1. + chtrHe_rec_c4[nv] * exp ( chtrHe_rec_d4[nv]*t4 ))
741 * (T>100000.0?exp( -(T-100000.0)/2.e3):1.0) * (T<50000.0?exp( -(50000.0-T)/1.e3):1.0)
742 +
elem_ab[
el_He] * 1.e-9 * chtrHe_rec_a5[nv] * pow( t4, chtrHe_rec_b5[nv] )
743 * ( 1. + chtrHe_rec_c5[nv] * exp ( chtrHe_rec_d5[nv]*t4 ))
744 * (T<100000.0?exp( -(100000.0-T)/2.e3):1.0);
750 print1(
" * total recombination coefficients\n");
751 if (tot_recs == NULL) tot_recs =
ARRAY_2D(I_g_stepNumber,
NIONS,
double);
753 for (nv = 0; nv <
NIONS; nv++ ) tot_recs[i][nv] = 0.0;
757 if (T <= tot_rec_T[0]) { ti1=-1; ti2=0; }
758 if (T > tot_rec_T[4]) { ti1=4; ti2=-1; }
759 for (j = 0; j < 4; j++) {
760 if ( (tot_rec_T[j] < T) && (tot_rec_T[j+1]>=
T) ) { ti1=
j; ti2=j+1; }
765 for (nv = 0; nv <= 1; nv++){
766 if (ti1 == -1) tmprec = tot_recH_He[nv][0];
767 else if (ti2 == -1) tmprec = tot_recH_He[nv][4];
768 else tmprec = (T-tot_rec_T[ti1])/(tot_rec_T[ti2]-tot_rec_T[ti1])*tot_recH_He[nv][ti2]
769 + (tot_rec_T[ti2]-
T)/(tot_rec_T[ti2]-tot_rec_T[ti1])*tot_recH_He[nv][ti1];
770 tot_recs[
i][nv] = pow(10.0,tmprec);
775 for (nv = 0; nv <
Ne_IONS-1; nv++){
776 if (ti1 == -1) tmprec = tot_recNe[nv][0];
777 else if (ti2 == -1) tmprec = tot_recNe[nv][4];
778 else tmprec = (T-tot_rec_T[ti1])/(tot_rec_T[ti2]-tot_rec_T[ti1])*tot_recNe[nv][ti2]
779 + (tot_rec_T[ti2]-
T)/(tot_rec_T[ti2]-tot_rec_T[ti1])*tot_recNe[nv][ti1];
780 tot_recs[
i][X_NeI+nv-
NFLX] = pow(10.0,tmprec);
785 for (nv = 0; nv <
S_IONS-1; nv++){
786 if (ti1 == -1) tmprec = tot_recS[nv][0];
787 else if (ti2 == -1) tmprec = tot_recS[nv][4];
788 else tmprec = (T-tot_rec_T[ti1])/(tot_rec_T[ti2]-tot_rec_T[ti1])*tot_recS[nv][ti2]
789 + (tot_rec_T[ti2]-
T)/(tot_rec_T[ti2]-tot_rec_T[ti1])*tot_recS[nv][ti1];
790 tot_recs[
i][X_SI+nv-
NFLX] = pow(10.0,tmprec);
794 for (nv = 0; nv <
NIONS; nv++) {
796 for (j = 0; j < 10; j++)
797 if (tot_rec_ions[j] == nv) cindex =
j;
801 if (ti1 == -1) tmprec = tot_rec[cindex][0];
802 else if (ti2 == -1) tmprec = tot_rec[cindex][4];
803 else tmprec = (T-tot_rec_T[ti1])/(tot_rec_T[ti2]-tot_rec_T[ti1])*tot_rec[cindex][ti2]
804 + (tot_rec_T[ti2]-
T)/(tot_rec_T[ti2]-tot_rec_T[ti1])*tot_rec[cindex][ti1];
805 tot_recs[
i][nv] = pow(10.0,tmprec);
817 for (nv = 0; nv <
NIONS; nv++) {
818 tbl[
i][0][nv] = coll_ion[
i][nv];
819 tbl[
i][1][nv] = rad_rec[
i][nv];
820 tbl[
i][2][nv] = diel_rec[
i][nv];
821 tbl[
i][3][nv] = chtr_hp[
i][nv];
822 tbl[
i][4][nv] = chtr_h[
i][nv];
823 tbl[
i][5][nv] = chtr_he[
i][nv];
824 tbl[
i][6][nv] = tot_recs[
i][nv];
827 for (j = 0; j < 7; j++) {
848 int ib, ie, first_time, atom_id,
i,
j;
851 double line_1, line_2, d;
852 char fname[100],fnn[10];
872 for (i = 0; i <
NIONS; i++) atoms[i].dE = NULL;
875 for (atom_id = 0; atom_id <
NIONS; atom_id++) {
887 for (ib = 1; ib < X->
nlev; ib++) {
888 for (ie = 0; ie < ib; ie++) {
889 if ( (X->
Ni[ib] != X->
Ni[ib]) || (X->
A[ib][ie] != X->
A[ib][ie]) ||
890 (X->
dE[ib][ie] != X->
dE[ib][ie]) ||
891 (X->
Ni[ib] * X->
A[ib][ie] * X->
dE[ib][ie] > 1.0e+200) ){
892 printf (
" Nan found atom = %d ib,ie = %d, %d\n", atom_id,ib,ie);
893 printf (
" T, ne = %12.6e %12.6e %12.6e %12.6e %12.6e %12.6e\n",T, Ne,X->
Ni[ib],X->
A[ib][ie],X->
dE[ib][ie], X->
omega[ib][ie][0] );
897 if (X->
A[ib][ie] > 0.0 && X->
Ni[ib] > 0.0)
898 line_2 += X->
Ni[ib] * X->
A[ib][ie] * X->
dE[ib][ie] / Ne ;
903 losstables[atom_id][*nN][*nT] = line_2;
915 print1(
"> MINEq radiative losses tables generated and saved to memory.\n");
void Solve_System(Ion *X, double Ne, double T)
void Symmetrize_Coeff(Ion *X)
void print1(const char *fmt,...)
const double rad_rec_z[31]
double lagrange(double *x, double *y, double xp, int n, int ii, int jj)
#define S_EXPAND(a, b, c, d, e)
const double coll_ion_dE[31]
#define N_EXPAND(a, b, c, d, e)
void LUBackSubst(double **a, int n, int *indx, double b[])
#define C_EXPAND(a, b, c, d, e)
#define ARRAY_1D(nx, type)
int Create_Ion_Coeff_Tables(double ***tbl)
#define O_EXPAND(a, b, c, d, e)
void INIT_ATOM(Ion *, int)
#define ARRAY_2D(nx, ny, type)
int LUDecompose(double **a, int n, int *indx, double *d)
int Create_Losses_Tables(double ***losstables, int *nT, int *nN)
#define QUIT_PLUTO(e_code)
#define Fe_EXPAND(a, b, c)