cloudy  trunk
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
hydrocollid.cpp
Go to the documentation of this file.
1 /* This file is part of Cloudy and is copyright (C)1978-2017 by Gary J. Ferland and
2  * others. For conditions of distribution and use see copyright notice in license.txt */
3 /*HCSAR_interp interpolate on collision strengths */
4 /*C6cs123 line collision rates for lower levels of hydrogenic carbon, n=1,2,3 */
5 /*Ca20cs123 line collision rates for lower levels of hydrogenic calcium, n=1,2,3 */
6 /*Hydcs123 Hydrogenic de-excitation collision rates n=1,2,3 */
7 /*H1cs123 hydrogen collision data levels involving 1s,2s,2p,3. */
8 /*Ne10cs123 line collision rates for lower levels of hydrogenic neon, n=1,2,3 */
9 /*He2cs123 line collision strengths for lower levels of helium ion, n=1,2,3, by K Korista */
10 /*Fe26cs123 line collision rates for lower levels of hydrogenic iron, n=1,2,3 */
11 #include "cddefines.h"
12 #include "atmdat.h"
13 #include "atmdat_adfa.h"
14 #include "helike_cs.h"
15 #include "hydrogenic.h"
16 #include "hydro_vs_rates.h"
17 #include "iso.h"
18 #include "opacity.h"
19 #include "phycon.h"
20 #include "thirdparty.h"
21 #include "integrate.h"
22 #include "freebound.h"
23 
24 STATIC double Fe26cs123(long int i, long int j);
25 STATIC double He2cs123(long int i, long int j);
26 STATIC double Hydcs123(long int ilow, long int ihigh, long int iz, long int chType);
27 STATIC double C6cs123(long int i, long int j);
28 STATIC double Ca20cs123(long int i, long int j);
29 STATIC double Ne10cs123(long int i, long int j);
30 
31 STATIC realnum HCSAR_interp( int ipLo , int ipHi );
32 STATIC realnum HlikeCSInterp( long nelem, long Collider, long nHi, long lHi, long sHi, long nLo, long lLo, long sLo );
33 STATIC double CS_ThermAve_PR78(long ipISO, long nelem, long nHi, long nLo, double deltaE, double temp );
34 STATIC double Therm_ave_coll_str_int_PR78( double EOverKT );
35 inline double C2_PR78(double x, double y);
36 STATIC double CS_PercivalRichards78( double Ebar );
37 
39 static double kTRyd, global_deltaE;
40 
41 static const realnum HCSTE[NHCSTE] = {5802.f,11604.f,34812.f,58020.f,116040.f,174060.f,232080.f,290100.f};
42 
43 /*HCSAR_interp interpolate on collision strengths */
44 STATIC realnum HCSAR_interp( int ipLo , int ipHi )
45 {
46 
47  static int ip=1;
48  realnum cs;
49 
50  DEBUG_ENTRY( "HCSAR_interp()" );
51 
52  if( ipLo==1 && ipHi==2 )
53  {
54  fprintf(ioQQQ,"HCSAR_interp was called for the 2s-2p transition, which it cannot do\n");
56  }
57  if( phycon.te <= HCSTE[0] )
58  {
59  cs = t_ADfA::Inst().h_coll_str( ipLo , ipHi , 0 );
60  }
61  else if( phycon.te >= HCSTE[NHCSTE-1] )
62  {
63  cs = t_ADfA::Inst().h_coll_str( ipLo , ipHi , NHCSTE-1 );
64  }
65  else
66  {
67  /* the ip index is most likely correct since it points to the last temperature */
68  if( (HCSTE[ip-1] >= phycon.te ) || ( phycon.te > HCSTE[ip]) )
69  {
70  /* we must find the temperature in the array */
71  for( ip=1; ip<NHCSTE; ++ip )
72  {
73  if( (HCSTE[ip-1] < phycon.te ) && ( phycon.te <= HCSTE[ip]) )
74  break;
75  }
76  }
77  /* we now have the index */
78  cs = t_ADfA::Inst().h_coll_str( ipLo , ipHi , ip-1 ) +
79  (t_ADfA::Inst().h_coll_str( ipLo , ipHi , ip ) - t_ADfA::Inst().h_coll_str( ipLo , ipHi , ip-1 ) ) / (HCSTE[ip]-HCSTE[ip-1] ) *
80  ((realnum)phycon.te - HCSTE[ip-1] );
81  if( cs <= 0.)
82  {
83  fprintf(ioQQQ," insane cs returned by HCSAR_interp, values are\n");
84  fprintf(ioQQQ,"%.3f %.3f \n", t_ADfA::Inst().h_coll_str( ipLo , ipHi , ip-1 ),t_ADfA::Inst().h_coll_str( ipLo , ipHi , ip ) );
85  }
86  }
87  return(cs);
88 }
89 
90 /*Hydcs123 Hydrogenic de-excitation collision strengths between levels n=1,2,3,
91  * for any charge. routine only called by HydroCSInterp to fill in hydroline arrays
92  * with collision strengths */
94  /* lower principal quantum number, 1, 2, or 3, in this routine
95  * 1 is 1s, 2 is 2s, 3 is 2p, and 4 is 3s, 5 is 3p, and 6 is 3d */
96  long int ipLow,
97  /* upper principal quantum nubmer, 2, 3, or 4 */
98  long int ipHi,
99  /* charge, 0 for hydrogen, 1 for helium, etc */
100  long int nelem,
101  /* = 'e' for electron collisions, ='p' for proton */
102  long int chType)
103 {
104  long int i,
105  j,
106  k;
107  double C,
108  D,
109  EE,
110  expq ,
111  Hydcs123_v,
112  logx,
113  Ratehigh,
114  Ratelow,
115  TeUse,
116  gLo,
117  gHi,
118  q,
119  rate,
120  slope,
121  temp,
122  temphigh,
123  templow,
124  tev,
125  x,
126  QuanNLo,
127  QuanNUp,
128  Charge,
129  ChargeSquared,
130  zhigh,
131  zlow;
132  static const double ap[5] = {-2113.113,729.0084,1055.397,854.632,938.9912};
133  static const double bp[5] = {-6783.515,-377.7190,724.1936,493.1107,735.7466};
134  static const double cp[5] = {-3049.719,226.2320,637.8630,388.5465,554.6369};
135  static const double dp[5] = {3514.5153,88.60169,-470.4055,-329.4914,-450.8459};
136  static const double ep[5] = {0.005251557,0.009059154,0.008725781,0.009952418,0.01098687};
137  static const double ae[5] = {-767.5859,-643.1189,-461.6836,-429.0543,-406.5285};
138  static const double be[5] = {-1731.9178,-1442.548,-1055.364,-980.3079,-930.9266};
139  static const double ce[5] = {-939.1834,-789.9569,-569.1451,-530.1974,-502.0939};
140  static const double de[5] = {927.4773,773.2008,564.3272,524.2944,497.7763};
141  static const double ee[5] = {-0.002528027,-0.003793665,-0.002122103,-0.002234207,-0.002317720};
142  static const double A[2] = {4.4394,0.0};
143  static const double B[2] = {0.8949,0.8879};
144  static const double C0[2] = {-0.6012,-0.2474};
145  static const double C1[2] = {-3.9710,-3.7562};
146  static const double C2[2] = {-4.2176,2.0491};
147  static const double D0[2] = {2.930,0.0539};
148  static const double D1[2] = {1.7990,3.4009};
149  static const double D2[2] = {4.9347,-1.7770};
150 
151  DEBUG_ENTRY( "Hydcs123()" );
152  /* Hydrogenic de-excitation collision rates n=1,2,3
153  * >>refer h1 cs Callaway, J. 1983, Phys Let A, 96, 83
154  * >>refer h1 cs Zygelman, B., & Dalgarno, A. 1987, Phys Rev A, 35, 4085
155  * for 2p-2s only.
156  * The fit from Callaway is in nuclear charge for 1s - 2s,2p only.
157  * For transtions involving level 3, interpolation in Z involving
158  * the functions He2cs123,C6cs123,Ne10cs123,Ca20cs123, Fe26cs123.
159  *
160  * The fits from ZD are for 2p-2s for Z=2,6,12,16,18 only other charges are
161  * interpolated, both electron and proton rates are included,
162  * the variable chType is either 'e' or 'p'.
163  *
164  * ipLow is the lower level and runs from 1 to 3 (1s, 2s, 2p)
165  * ipHi is the upper level and runs from 2 to 6 (2s, 2p, 3s, 3p, 3d) */
166 
167  /* for Callaway fit: */
168  /* for Zygelman and Dalgarno: */
169 
170  /* first entry is 2p, then 2s */
171 
172  /* fit in nuclear charge Z for 2p-2s collisions in hydrogenic species
173  * equation is a+bx+cx^2ln(x)+dexp(x)+eln(x)/x^2, where x=te/Z^2 in a.u.
174  * first are the proton rates: */
175  /* these are electron rates: */
176 
177  /* following is for charged species */
178  /* charge is on scale with He+=1, Li++=2, etc */
179  ASSERT( nelem > ipHYDROGEN );
180  ASSERT( nelem < LIMELM );
181 
182  /* these are the pointers to upper and lower levels. 1=1s, 2=2s, 3=2p, 4=3 */
183  ASSERT( ipLow > 0);
184  ASSERT( ipLow <= 3);
185  ASSERT( ipHi > 1 );
186  ASSERT( ipHi <=6 );
187 
188  /* set quantum numbers and stat. weights of the transitions: */
189  if( ipHi == 6 )
190  {
191  /* upper is n=3 then set level, stat. weight */
192  QuanNUp = 3.;
193  gHi = 10.;
194  /* following will be set here even though it is not used in this case,
195  * to prevent good compilers from falsing on i not set,
196  * there is assert when used to make sure it is ok */
197  i = -1;
198  }
199  else if( ipHi == 5 )
200  {
201  /* upper is n=3 then set level, stat. weight */
202  QuanNUp = 3.;
203  gHi = 6.;
204  /* following will be set here even though it is not used in this case,
205  * to prevent good compilers from falsing on i not set,
206  * there is assert when used to make sure it is ok */
207  i = -1;
208  }
209  else if( ipHi == 4 )
210  {
211  /* upper is n=3 then set level, stat. weight */
212  QuanNUp = 3.;
213  gHi = 2.;
214  /* following will be set here even though it is not used in this case,
215  * to prevent good compilers from falsing on i not set,
216  * there is assert when used to make sure it is ok */
217  i = -1;
218  }
219  else if( ipHi == 3 )
220  {
221  /* upper is nl=2p then set level, stat. weight */
222  QuanNUp = 2.;
223  gHi = 6.;
224  /* used to point within vectors defined above */
225  i = 0;
226  }
227  else if( ipHi == 2 )
228  {
229  /* upper is nl=2s then set level, stat. weight */
230  QuanNUp = 2.;
231  gHi = 2.;
232  /* used to point within vectors defined above */
233  i = 1;
234  }
235  else
236  {
237  fprintf( ioQQQ, " Insane levels in Hydcs123\n" );
239  }
240 
241  /* which lower level? */
242  if( ipLow == 1 )
243  {
244  /* lower is n=1 then set level, stat. weight */
245  QuanNLo = 1.;
246  gLo = 2.;
247  }
248  else if( ipLow == 2 )
249  {
250  /* lower is nl=2s then set level, stat. weight */
251  QuanNLo = 2.;
252  gLo = 2.;
253  }
254  else if( ipLow == 3 )
255  {
256  QuanNLo = 2.;
257  gLo = 6.;
258  }
259  else
260  {
261  fprintf( ioQQQ, " Insane levels in Hydcs123\n" );
263  }
264 
265  /* following is the physical charge */
266  Charge = (double)(nelem + 1);
267  /* square of charge */
268  ChargeSquared = Charge*Charge;
269 
270  if( ipLow == 2 && ipHi == 3 )
271  {
272  /*************************************** this is 2p-2s:
273  * series of if statements determines which entries Charge is between. */
274  if( nelem < 1 )
275  {
276  /* this can't happen since routine returned above when ip=1 and
277  * special atomic hydrogen routine called */
278  fprintf( ioQQQ, " insane charge given to Hydcs123\n" );
280  }
281  else if( nelem == 1 )
282  {
283  zlow = 2.;
284  j = 1;
285  zhigh = 2.;
286  k = 1;
287  }
288  /* Li through C */
289  else if( nelem <= 5 )
290  {
291  zlow = 2.;
292  j = 1;
293  zhigh = 6.;
294  k = 2;
295  }
296  else if( nelem <= 11 )
297  {
298  zlow = 6.;
299  j = 2;
300  zhigh = 12.;
301  k = 3;
302  }
303  else if( nelem <= 15 )
304  {
305  zlow = 12.;
306  j = 3;
307  zhigh = 16.;
308  k = 4;
309  }
310  else if( nelem <= 17 )
311  {
312  zlow = 16.;
313  j = 4;
314  zhigh = 18.;
315  k = 5;
316  }
317  /* following changed to else from else if,
318  * to prevent false comment in good compilers */
319  /*else if( nelem > 18 )*/
320  else
321  {
322  zlow = 18.;
323  j = 5;
324  zhigh = 18.;
325  k = 5;
326  }
327 
328  /* convert Te to a.u./Z^2
329  * determine rate at the low Charge */
330  x = EVRYD/TE1RYD*phycon.te/(27.211396*pow2(zlow));
331  TeUse = MIN2(x,0.80);
332  x = MAX2(0.025,TeUse);
333  logx = log(x);
334 
335  /* what type of collision are we dealing with? */
336  if( chType == 'e' )
337  {
338  /* electron collisions */
339  Ratelow = ae[j-1] + be[j-1]*x + ce[j-1]*pow2(x)*logx + de[j-1]*
340  exp(x) + ee[j-1]*logx/pow2(x);
341  }
342  else if( chType == 'p' )
343  {
344  Ratelow = ap[j-1] + bp[j-1]*x + cp[j-1]*pow2(x)*logx + dp[j-1]*
345  exp(x) + ep[j-1]*logx/pow2(x);
346  }
347  else
348  {
349  /* this can't happen */
350  fprintf( ioQQQ, " insane collision species given to Hydcs123\n" );
352  }
353 
354  if( fp_equal( zlow, zhigh ) )
355  {
356  rate = Ratelow;
357  }
358  else
359  {
360  /* determine rate at the high Charge */
361  x = EVRYD/TE1RYD*phycon.te/(27.211396*pow2(zhigh));
362  TeUse = MIN2(x,0.80);
363  x = MAX2(0.025,TeUse);
364  logx = log(x);
365  if( chType == 'e' )
366  {
367  Ratehigh = ae[k-1] + be[k-1]*x + ce[k-1]*pow2(x)*logx +
368  de[k-1]*exp(x) + ee[k-1]*logx/pow2(x);
369  }
370  else
371  {
372  Ratehigh = ap[k-1] + bp[k-1]*x + cp[k-1]*pow2(x)*logx +
373  dp[k-1]*exp(x) + ep[k-1]*logx/pow2(x);
374  }
375  /* linearly interpolate in charge */
376  slope = (Ratehigh - Ratelow)/(zhigh - zlow);
377  rate = slope*(Charge - zlow) + Ratelow;
378  }
379  rate = rate/ChargeSquared/Charge*1.0e-7;
380  /* must convert to cs and need to know the valid temp range */
381  templow = 0.025*27.211396*TE1RYD/EVRYD*ChargeSquared;
382  temphigh = 0.80*27.211396*TE1RYD/EVRYD*ChargeSquared;
383  TeUse = MIN2((double)phycon.te,temphigh);
384  temp = MAX2(TeUse,templow);
385  Hydcs123_v = rate*gHi*sqrt(temp)/COLL_CONST;
386 
387  if( chType == 'p' )
388  {
389  /* COLL_CONST is incorrect for protons, correct here */
390  Hydcs123_v *= powpq( PROTON_MASS/ELECTRON_MASS, 3, 2 );
391  }
392  }
393  else if( ipHi == 4 || ipHi == 5 || ipHi == 6 )
394  {
395  /* n = 3
396  * for the rates involving n = 3, must do something different. */
397  if( nelem < 1 )
398  {
399  fprintf( ioQQQ, " insane charge given to Hydcs123\n" );
401  }
402  else if( nelem == 1 )
403  {
404  zlow = 2.;
405  Ratelow = He2cs123(ipLow,ipHi);
406  zhigh = 2.;
407  Ratehigh = Ratelow;
408  }
409  else if( nelem > 1 && nelem <= 5 )
410  {
411  zlow = 2.;
412  Ratelow = He2cs123(ipLow,ipHi);
413  zhigh = 6.;
414  Ratehigh = C6cs123(ipLow,ipHi);
415  }
416  else if( nelem > 5 && nelem <= 9 )
417  {
418  zlow = 6.;
419  Ratelow = C6cs123(ipLow,ipHi);
420  zhigh = 10.;
421  Ratehigh = Ne10cs123(ipLow,ipHi);
422  }
423  else if( nelem > 9 && nelem <= 19 )
424  {
425  zlow = 10.;
426  Ratelow = Ne10cs123(ipLow,ipHi);
427  zhigh = 20.;
428  Ratehigh = Ca20cs123(ipLow,ipHi);
429  }
430  else if( nelem > 19 && nelem <= 25 )
431  {
432  zlow = 20.;
433  Ratelow = Ca20cs123(ipLow,ipHi);
434  zhigh = 26.;
435  Ratehigh = Fe26cs123(ipLow,ipHi);
436  }
437  /*>>>chng 98 dec 17, to else to stop comment from good compilers*/
438  /*else if( nelem > 26 )*/
439  else
440  {
441  Charge = 26.;
442  zlow = 26.;
443  Ratelow = Fe26cs123(ipLow,ipHi);
444  zhigh = 26.;
445  Ratehigh = Ratelow;
446  }
447 
448  /* linearly interpolate */
449  if( fp_equal( zlow, zhigh ) )
450  {
451  rate = Ratelow;
452  }
453  else
454  {
455  slope = (Ratehigh - Ratelow)/(zhigh - zlow);
456  rate = slope*(Charge - zlow) + Ratelow;
457  }
458 
460  Hydcs123_v = rate;
461 
462  /* the routines C6cs123, Ne10cs123, etc... do not resolve L for n>2 */
463  /* dividing by N should roughly recover the original l-resolved data */
464  Hydcs123_v /= 3.;
465  }
466  else
467  {
468  /* this branch 1-2s, 1-2p */
469  if( nelem == 1 )
470  {
471  /* this brance for helium, then return */
472  Hydcs123_v = He2cs123(ipLow,ipHi);
473  return( Hydcs123_v );
474  }
475 
476  /* electron temperature in eV */
477  tev = phycon.te / EVDEGK;
478  /* energy in eV for hydrogenic species and these quantum numbers */
479  EE = ChargeSquared*EVRYD*(1./QuanNLo/QuanNLo - 1./QuanNUp/QuanNUp);
480  /* EE/kT for this transion */
481  q = EE/tev;
482  TeUse = MIN2(q,10.);
483  /* q is now EE/kT but between 1 and 10 */
484  q = MAX2(1.,TeUse);
485  expq = exp(q);
486 
487  /* i must be 0 or 1 */
488  ASSERT( i==0 || i==1 );
489  C = C0[i] + C1[i]/Charge + C2[i]/ChargeSquared;
490  D = D0[i] + D1[i]/Charge + D2[i]/ChargeSquared;
491 
492  /* following code changed so that e1 always returns e1,
493  * orifinal version only returned e1 for x < 1 */
494  /* use disabled e1: */
495  /*if( q < 1. )*/
496  /*{*/
497  /*rate = (B[i-1] + D*q)*exp(-q) + (A[i-1] + C*q - D*q*q)**/
498  /*e1(q);*/
499  /*}*/
500  /*else*/
501  /*{*/
502  /*rate = (B[i-1] + D*q) + (A[i-1] + C*q - D*q*q)*e1(q);*/
503  /*}*/
504  /*rate *= 8.010e-8/2./ChargeSquared/tev*sqrt(tev);*/
505  /* convert to de-excitation */
506  /*if( q < 1. )*/
507  /*{*/
508  /*rate = rate*exp(q)*gLo/gHi;*/
509  /*}*/
510  /*else*/
511  /*{*/
512  /*rate = rate*gLo/gHi;*/
513  /*}*/
514 
515  /*>>>chng 98 dec 17, e1 always returns e1 */
516  rate = (B[i] + D*q)/expq + (A[i] + C*q - D*q*q)*
517  e1(q);
518  // Equation (2) of Callaway 1983 -- can simplify by cancelling tev factors
519  // with R_0(T)
520  //rate *= 8.010e-8/2./ChargeSquared/tev*sqrt(tev);
521  rate *= 8.010e-8/(2. * ChargeSquared * sqrt(tev));
522  /* convert to de-excitation */
523  rate *= expq*gLo/gHi;
524 
525  /* convert to cs */
526  Hydcs123_v = rate*gHi*phycon.sqrte/COLL_CONST;
527  }
528  return( Hydcs123_v );
529 }
530 
531 /*C6cs123 line collision rates for lower levels of hydrogenic carbon, n=1,2,3 */
532 STATIC double C6cs123(long int i,
533  long int j)
534 {
535  double C6cs123_v,
536  TeUse,
537  t,
538  logx,
539  x;
540  static const double a[3] = {-92.23774,-1631.3878,-6326.4947};
541  static const double b[3] = {-11.93818,-218.3341,-849.8927};
542  static const double c[3] = {0.07762914,1.50127,5.847452};
543  static const double d[3] = {78.401154,1404.8475,5457.9291};
544  static const double e[3] = {332.9531,5887.4263,22815.211};
545 
546  DEBUG_ENTRY( "C6cs123()" );
547 
548  /* These are fits to Table 5 of
549  * >>refer c6 cs Aggarwal, K.M., & Kingston, A.E. 1991, J Phys B, 24, 4583
550  * C VI collision rates for 1s-3l, 2s-3l, and 2p-3l,
551  * principal quantum numbers n and l.
552  *
553  * i is the lower level and runs from 1 to 3 (1s, 2s, 2p)
554  * j is the upper level and runs from 2 to 6 (2s, 2p, 3s, 3p, 3d)
555  * 1s-2s,2p is not done here.
556  * check temperature: fits only good between 3.8 < log Te < 6.2
557  */
558  /* arrays for fits of 3 transitions see the code below for key: */
559 
560  TeUse = MAX2(phycon.te,6310.);
561  t = MIN2(TeUse,1.6e6);
562  x = log10(t);
563  logx = log(x);
564 
565  if( i == 1 && j == 2 )
566  {
567  /* 1s - 2s (first entry) */
568  fprintf( ioQQQ, " Carbon VI 2s-1s not done in C6cs123\n" );
570  }
571 
572  else if( i == 1 && j == 3 )
573  {
574  /* 1s - 2p (second entry) */
575  fprintf( ioQQQ, " Carbon VI 2p-1s not done in C6cs123\n" );
577  }
578 
579  else if( i == 1 && ( j == 4 || j == 5 || j == 6 ) )
580  {
581  /* 1s - 3 (first entry) */
582  C6cs123_v = a[0] + b[0]*x + c[0]*pow2(x)*sqrt(x) + d[0]*logx +
583  e[0]*logx/pow2(x);
584  }
585  else if( i == 2 && ( j == 4 || j == 5 || j == 6 ) )
586  {
587  /* 2s - 3 (second entry) */
588  C6cs123_v = a[1] + b[1]*x + c[1]*pow2(x)*sqrt(x) + d[1]*logx +
589  e[1]*logx/pow2(x);
590  }
591  else if( i == 3 && ( j == 4 || j == 5 || j == 6 ) )
592  {
593  /* 2p - 3s (third entry) */
594  C6cs123_v = a[2] + b[2]*x + c[2]*pow2(x)*sqrt(x) + d[2]*logx +
595  e[2]*logx/pow2(x);
596  }
597  else
598  {
599  fprintf( ioQQQ, " insane levels for C VI n=1,2,3 !!!\n" );
601  }
602  return( C6cs123_v );
603 }
604 
605 /*Ca20cs123 line collision rates for lower levels of hydrogenic calcium, n=1,2,3 */
606 STATIC double Ca20cs123(long int i,
607  long int j)
608 {
609  double Ca20cs123_v,
610  TeUse,
611  t,
612  logx,
613  x;
614  static const double a[3] = {-12.5007,-187.2303,-880.18896};
615  static const double b[3] = {-1.438749,-22.17467,-103.1259};
616  static const double c[3] = {0.008219688,0.1318711,0.6043752};
617  static const double d[3] = {10.116516,153.2650,717.4036};
618  static const double e[3] = {45.905343,685.7049,3227.2836};
619 
620  DEBUG_ENTRY( "Ca20cs123()" );
621 
622  /*
623  * These are fits to Table 5 of
624  * >>refer ca20 cs Aggarwal, K.M., & Kingston, A.E. 1992, J Phys B, 25, 751
625  * Ca XX collision rates for 1s-3l, 2s-3l, and 2p-3l,
626  * principal quantum numbers n and l.
627  *
628  * i is the lower level and runs from 1 to 3 (1s, 2s, 2p)
629  * j is the upper level and runs from 2 to 6 (2s, 2p, 3s, 3p, 3d)
630  * 1s-2s,2p is not done here.
631  * check temperature: fits only good between 5.0 < log Te < 7.2
632  */
633 
634  /* arrays for fits of 3 transitions see the code below for key: */
635 
636  TeUse = MAX2(phycon.te,1.0e5);
637  t = MIN2(TeUse,1.585e7);
638  x = log10(t);
639  logx = log(x);
640 
641  if( i == 1 && j == 2 )
642  {
643  /* 1s - 2s (first entry) */
644  fprintf( ioQQQ, " Ca XX 2s-1s not done in Ca20cs123\n" );
646  }
647 
648  else if( i == 1 && j == 3 )
649  {
650  /* 1s - 2p (second entry) */
651  fprintf( ioQQQ, " Ca XX 2p-1s not done in Ca20cs123\n" );
653  }
654 
655  else if( i == 1 && ( j == 4 || j == 5 || j == 6 ))
656  {
657  /* 1s - 3 (first entry) */
658  Ca20cs123_v = a[0] + b[0]*x + c[0]*pow2(x)*sqrt(x) + d[0]*logx +
659  e[0]*logx/pow2(x);
660  }
661  else if( i == 2 && ( j == 4 || j == 5 || j == 6 ))
662  {
663  /* 2s - 3 (second entry) */
664  Ca20cs123_v = a[1] + b[1]*x + c[1]*pow2(x)*sqrt(x) + d[1]*logx +
665  e[1]*logx/pow2(x);
666  }
667  else if( i == 3 && ( j == 4 || j == 5 || j == 6 ))
668  {
669  /* 2p - 3s (third entry) */
670  Ca20cs123_v = a[2] + b[2]*x + c[2]*pow2(x)*sqrt(x) + d[2]*logx +
671  e[2]*logx/pow2(x);
672  }
673  else
674  {
675  fprintf( ioQQQ, " insane levels for Ca XX n=1,2,3 !!!\n" );
677  }
678  return( Ca20cs123_v );
679 }
680 
681 /*Ne10cs123 line collision rates for lower levels of hydrogenic neon, n=1,2,3 */
682 STATIC double Ne10cs123(long int i,
683  long int j)
684 {
685  double Ne10cs123_v,
686  TeUse,
687  logx,
688  t,
689  x;
690  static const double a[3] = {3.346644,151.2435,71.7095};
691  static const double b[3] = {0.5176036,20.05133,13.1543};
692  static const double c[3] = {-0.00408072,-0.1311591,-0.1099238};
693  static const double d[3] = {-3.064742,-129.8303,-71.0617};
694  static const double e[3] = {-11.87587,-541.8599,-241.2520};
695 
696  DEBUG_ENTRY( "Ne10cs123()" );
697 
698  /* These are fits to Table 5 of
699  * >>refer ne10 cs Aggarwal, K.M., & Kingston, A.E. 1991, PhyS, 44, 517
700  * Ne X collision rates for 1s-3, 2s-3l, and 2p-3l,
701  * principal quantum numbers n and l.
702  *
703  * i is the lower level and runs from 1 to 3 (1s, 2s, 2p)
704  * j is the upper level and runs from 2 to 6 (2s, 2p, 3s, 3p, 3d)
705  * 1s-2s,2p is not done here.
706  * check temperature: fits only good between 3.8 < log Te < 6.2
707  * */
708  /* arrays for fits of 3 transitions see the code below for key: */
709 
710  TeUse = MAX2(phycon.te,6310.);
711  t = MIN2(TeUse,1.6e6);
712  x = log10(t);
713  logx = log(x);
714 
715  if( i == 1 && j == 2 )
716  {
717  /* 1s - 2s (first entry) */
718  fprintf( ioQQQ, " Neon X 2s-1s not done in Ne10cs123\n" );
720  }
721 
722  else if( i == 1 && j == 3 )
723  {
724  /* 1s - 2p (second entry) */
725  fprintf( ioQQQ, " Neon X 2p-1s not done in Ne10cs123\n" );
727  }
728 
729  else if( i == 1 && ( j == 4 || j == 5 || j == 6 ) )
730  {
731  /* 1s - 3 (first entry) */
732  Ne10cs123_v = a[0] + b[0]*x + c[0]*pow2(x)*sqrt(x) + d[0]*logx +
733  e[0]*logx/pow2(x);
734  }
735  else if( i == 2 && ( j == 4 || j == 5 || j == 6 ) )
736  {
737  /* 2s - 3 (second entry) */
738  Ne10cs123_v = a[1] + b[1]*x + c[1]*pow2(x)*sqrt(x) + d[1]*logx +
739  e[1]*logx/pow2(x);
740  }
741  else if( i == 3 && ( j == 4 || j == 5 || j == 6 ) )
742  {
743  /* 2p - 3s (third entry) */
744  Ne10cs123_v = a[2] + b[2]*x + c[2]*pow2(x)*sqrt(x) + d[2]*logx +
745  e[2]*logx/pow2(x);
746  }
747  else
748  {
749  fprintf( ioQQQ, " insane levels for Ne X n=1,2,3 !!!\n" );
751  }
752  return( Ne10cs123_v );
753 }
754 
755 /*He2cs123 line collision strengths for lower levels of helium ion, n=1,2,3, by K Korista */
756 STATIC double He2cs123(long int i,
757  long int j)
758 {
759  double He2cs123_v,
760  t;
761  static const double a[11]={0.12176209,0.32916723,0.46546497,0.044501688,
762  0.040523277,0.5234889,1.4903214,1.4215094,1.0295881,4.769306,9.7226127};
763  static const double b[11]={0.039936166,2.9711166e-05,-0.020835863,3.0508137e-04,
764  -2.004485e-15,4.41475e-06,1.0622666e-05,2.0538877e-06,0.80638448,2.0967075e-06,
765  7.6089851e-05};
766  static const double c[11]={143284.77,0.73158545,-2.159172,0.43254802,2.1338557,
767  8.9899702e-06,-2.9001451e-12,1.762076e-05,52741.735,-2153.1219,-3.3996921e-11};
768 
769  DEBUG_ENTRY( "He2cs123()" );
770 
771  /* These are fits to Table 2
772  * >>refer he2 cs Aggarwal, K.M., Callaway, J., Kingston, A.E., Unnikrishnan, K.
773  * >>refercon 1992, ApJS, 80, 473
774  * He II collision rates for 1s-2s, 1s-2p, 1s-3s, 1s-3p, 1s-3d, 2s-3s, 2s-3p, 2s-3d,
775  * 2p-3s, 2p-3p, and 2p-3d.
776  * principal quantum numbers n and l.
777  *
778  * i is the lower level and runs from 1 to 3 (1s, 2s, 2p)
779  * j is the upper level and runs from 2 to 6 (2s, 2p, 3s, 3p, 3d)
780  * check temperature: fits only good between 5,000K and 500,000K
781  * */
782  /* array for fits of 11 transitions see the code below for key: */
783 
784  t = phycon.te;
785  if( t < 5000. )
786  {
787  t = 5000.;
788  }
789  else if( t > 5.0e05 )
790  {
791  t = 5.0e05;
792  }
793 
794  /**************fits begin here**************
795  * */
796  if( i == 1 && j == 2 )
797  {
798  /* 1s - 2s (first entry) */
799  He2cs123_v = a[0] + b[0]*exp(-t/c[0]);
800  }
801  else if( i == 1 && j == 3 )
802  {
803  /* 1s - 2p (second entry) */
804  He2cs123_v = a[1] + b[1]*pow(t,c[1]);
805  }
806  else if( i == 1 && j == 4 )
807  {
808  /* 1s - 3s (third entry) */
809  double logt = log(t);
810  He2cs123_v = a[2] + b[2]*logt + c[2]/logt;
811  }
812  else if( i == 1 && j == 5 )
813  {
814  /* 1s - 3p (fourth entry) */
815  He2cs123_v = a[3] + b[3]*pow(t,c[3]);
816  }
817  else if( i == 1 && j == 6 )
818  {
819  /* 1s - 3d (fifth entry) */
820  He2cs123_v = a[4] + b[4]*pow(t,c[4]);
821  }
822  else if( i == 2 && j == 4 )
823  {
824  /* 2s - 3s (sixth entry) */
825  He2cs123_v = (a[5] + c[5]*t)/(1 + b[5]*t);
826  }
827  else if( i == 2 && j == 5 )
828  {
829  /* 2s - 3p (seventh entry) */
830  He2cs123_v = a[6] + b[6]*t + c[6]*t*t;
831  }
832  else if( i == 2 && j == 6 )
833  {
834  /* 2s - 3d (eighth entry) */
835  He2cs123_v = (a[7] + c[7]*t)/(1 + b[7]*t);
836  }
837  else if( i == 3 && j == 4 )
838  {
839  /* 2p - 3s (ninth entry) */
840  He2cs123_v = a[8] + b[8]*exp(-t/c[8]);
841  }
842  else if( i == 3 && j == 5 )
843  {
844  /* 2p - 3p (tenth entry) */
845  He2cs123_v = a[9] + b[9]*t + c[9]/t;
846  }
847  else if( i == 3 && j == 6 )
848  {
849  /* 2p - 3d (eleventh entry) */
850  He2cs123_v = a[10] + b[10]*t + c[10]*t*t;
851  }
852  else
853  {
854  /**************fits end here************** */
855  fprintf( ioQQQ, " insane levels for He II n=1,2,3 !!!\n" );
857  }
858  return( He2cs123_v );
859 }
860 
861 /*Fe26cs123 line collision rates for lower levels of hydrogenic iron, n=1,2,3 */
862 STATIC double Fe26cs123(long int i,
863  long int j)
864 {
865  double Fe26cs123_v,
866  TeUse,
867  logx,
868  t,
869  x;
870  static const double a[3] = {-4.238398,-238.2599,-1211.5237};
871  static const double b[3] = {-0.4448177,-27.06869,-136.7659};
872  static const double c[3] = {0.0022861,0.153273,0.7677703};
873  static const double d[3] = {3.303775,191.7165,972.3731};
874  static const double e[3] = {15.82689,878.1333,4468.696};
875 
876  DEBUG_ENTRY( "Fe26cs123()" );
877 
878  /* These are fits to Table 5 of
879  * >>refer fe26 cs Aggarwal, K.M., & Kingston, A.E. 1993, ApJS, 85, 187
880  * Fe XXVI collision rates for 1s-3, 2s-3, and 2p-3,
881  * principal quantum numbers n and l.
882  *
883  * i is the lower level and runs from 1 to 3 (1s, 2s, 2p)
884  * j is the upper level and runs from 2 to 6 (2s, 2p, 3s, 3p, 3d)
885  * 1s-2s,2p is not done here.
886  * check temperature: fits only good between 5.2 < log Te < 7.2
887  * */
888  /* arrays for fits of 3 transitions see the code below for key: */
889 
890  TeUse = MAX2(phycon.te,1.585e5);
891  t = MIN2(TeUse,1.585e7);
892  x = log10(t);
893  logx = log(x);
894 
895  if( i == 1 && j == 2 )
896  {
897  /* 1s - 2s (first entry) */
898  fprintf( ioQQQ, " Fe XXVI 2s-1s not done in Fe26cs123\n" );
900  }
901 
902  else if( i == 1 && j == 3 )
903  {
904  /* 1s - 2p (second entry) */
905  fprintf( ioQQQ, " Fe XXVI 2p-1s not done in Fe26cs123\n" );
907  }
908 
909  else if( i == 1 && ( j == 4 || j == 5 || j == 6 ) )
910  {
911  /* 1s - 3 (first entry) */
912  Fe26cs123_v = a[0] + b[0]*x + c[0]*pow2(x)*sqrt(x) + d[0]*logx +
913  e[0]*logx/pow2(x);
914  }
915  else if( i == 2 && ( j == 4 || j == 5 || j == 6 ) )
916  {
917  /* 2s - 3 (second entry) */
918  Fe26cs123_v = a[1] + b[1]*x + c[1]*pow2(x)*sqrt(x) + d[1]*logx +
919  e[1]*logx/pow2(x);
920  }
921  else if( i == 3 && ( j == 4 || j == 5 || j == 6 ) )
922  {
923  /* 2p - 3s (third entry) */
924  Fe26cs123_v = a[2] + b[2]*x + c[2]*pow2(x)*sqrt(x) + d[2]*logx +
925  e[2]*logx/pow2(x);
926  }
927  else
928  {
929  fprintf( ioQQQ, " insane levels for Ca XX n=1,2,3 !!!\n" );
931  }
932  return( Fe26cs123_v );
933 }
934 
935 
936 STATIC double CS_ThermAve_PR78(long ipISO, long nelem, long nHi, long nLo, double deltaE, double temp )
937 {
938 
939  double coll_str;
940 
941  DEBUG_ENTRY( "CS_ThermAve_PR78()" );
942 
943  global_ipISO = ipISO;
944  global_nelem = nelem;
945  global_nHi = nHi;
946  global_nLo = nLo;
947  global_deltaE = deltaE;
948 
949  kTRyd = temp / TE1RYD;
950 
951  if( !iso_ctrl.lgCS_therm_ave[ipISO] )
952  {
953  /* Do NOT average over Maxwellian */
954  coll_str = CS_PercivalRichards78( kTRyd );
955  }
956  else
957  {
958  /* DO average over Maxwellian */
959  coll_str = qg32( 0.0, 1.0, Therm_ave_coll_str_int_PR78);
960  coll_str += qg32( 1.0, 10.0, Therm_ave_coll_str_int_PR78);
961  }
962 
963  return coll_str;
964 }
965 
966 /* The integrand for calculating the thermal average of collision strengths */
967 STATIC double Therm_ave_coll_str_int_PR78( double EOverKT )
968 {
969  double integrand;
970 
971  DEBUG_ENTRY( "Therm_ave_coll_str_int_PR78()" );
972 
973  integrand = exp( -1.*EOverKT ) * CS_PercivalRichards78( EOverKT * kTRyd );
974 
975  return integrand;
976 }
977 
978 inline double C2_PR78(double x, double y)
979 {
980  return pow2(x)*log1p(2./3.*x)/(2.*y + 1.5*x);
981 }
982 
983 STATIC double CS_PercivalRichards78( double Ebar )
984 {
985  DEBUG_ENTRY( "CS_PercivalRichards78()" );
986 
987  if( Ebar < global_deltaE )
988  return 0.;
989 
990  long ipISO = global_ipISO;
991  long nelem = global_nelem;
992  double np = (double)global_nHi;
993  double n = (double)global_nLo;
994  double n2 = pow2(n);
995  double nnp = n*np;
996  double Ebar2 = pow2(Ebar);
997  double s = np - n;
998  long is = global_nHi - global_nLo ;
999 
1000  ASSERT( s > 0. );
1001 
1002  double A = 8./(3.*s) * pow3(np/(s*n)) * (0.184 - 0.04/pow2(cbrt(s))) * powi(1.-0.2*s/nnp, 1+2*is);
1003 
1004  double Z3 = (double)(nelem + 1 - ipISO);
1005  double Z32 = pow2(Z3);
1006 
1007  double D = exp(-Z32/(nnp*Ebar2));
1008 
1009  double L = log((1.+0.53*Ebar2*nnp/Z32) / (1.+0.4*Ebar));
1010 
1011  double F = powi(1.-0.3*s*D/nnp, 1+2*is);
1012 
1013  double G = 0.5*pow3(Ebar*n2/(Z3*np));
1014 
1015  double h1 = sqrt(2. - pow2(n/np));
1016  double h2 = 2.*Z3/(n2*Ebar);
1017  double xPlus = h2/(h1+1.);
1018  double xMinus = h2/(h1-1.);
1019 
1020  double y = 1./(1.-D*log(18.*s)/(4.*s));
1021 
1022  double H = C2_PR78(xMinus,y) - C2_PR78(xPlus,y);
1023 
1024  /* this is the LHS of equation 1 of PR78 */
1025  double cross_section = A*D*L + F*G*H;
1026  /* this is the result after solving equation 1 for the cross section */
1027  cross_section *= PI*pow2(n2*BOHR_RADIUS_CM/Z3) / Ebar;
1028 
1029  double stat_weight;
1030  if( ipISO == ipH_LIKE )
1031  stat_weight = 2.*n2;
1032  else if( ipISO == ipHE_LIKE )
1033  stat_weight = 4.*n2;
1034  else
1035  TotalInsanity();
1036 
1037  /* convert to collision strength */
1038  return cross_section*stat_weight*Ebar / (PI*pow2(BOHR_RADIUS_CM));
1039 }
1040 
1041 #if 0
1042 STATIC void TestPercivalRichards( void )
1043 {
1044  double CStemp;
1045 
1046  /* this reproduces Table 1 of PR78 */
1047  for( long i=0; i<5; i++ )
1048  {
1049  double Ebar[5] = {0.1, 0.4, 0.8, 1.0, 10.};
1050 
1051  CStemp = CS_PercivalRichards78( 0, 2, 12, 10, Ebar[i] );
1052  }
1053 
1054  /* this reproduces Table 2 of PR78 */
1055  for( long i=0; i<5; i++ )
1056  {
1057  double Ebar[5] = {0.1, 0.4, 0.8, 1.0, 10.};
1058 
1059  CStemp = CS_ThermAve_PR78( ipISO, 0, N_(ipHi), N_(ipLo), phycon.te );
1060  }
1061 
1062  return;
1063 }
1064 #endif
1065 
1067  long ipHi,
1068  long ipLo,
1069  long ipCollider )
1070 {
1071  DEBUG_ENTRY( "HydroCSInterp()" );
1072 
1073  long nHi = iso_sp[ipH_LIKE][nelem].st[ipHi].n();
1074  long lHi = iso_sp[ipH_LIKE][nelem].st[ipHi].l();
1075  long sHi = iso_sp[ipH_LIKE][nelem].st[ipHi].S();
1076  long gHi = iso_sp[ipH_LIKE][nelem].st[ipHi].g();
1077  double IP_Ryd_Hi = iso_sp[ipH_LIKE][nelem].fb[ipHi].xIsoLevNIonRyd;
1078  long nLo = iso_sp[ipH_LIKE][nelem].st[ipLo].n();
1079  long lLo = iso_sp[ipH_LIKE][nelem].st[ipLo].l();
1080  long sLo = iso_sp[ipH_LIKE][nelem].st[ipLo].S();
1081  long gLo = iso_sp[ipH_LIKE][nelem].st[ipLo].g();
1082  double IP_Ryd_Lo = iso_sp[ipH_LIKE][nelem].fb[ipLo].xIsoLevNIonRyd;
1083  double Aul = iso_sp[ipH_LIKE][nelem].trans(ipHi,ipLo).Emis().Aul();
1084  // collisions are from high to low level, then initial level lifetime is from higher level
1085  double tauLo = iso_sp[ipH_LIKE][nelem].st[ipHi].lifetime();
1086  double EnerErg = iso_sp[ipH_LIKE][nelem].trans(ipHi,ipLo).EnergyErg();
1087 
1088  double CStemp = GetHlikeCollisionStrength( nelem, ipCollider,
1089  nHi, lHi, sHi, gHi, IP_Ryd_Hi,
1090  nLo, lLo, sLo, gLo, IP_Ryd_Lo,
1091  Aul, tauLo, EnerErg );
1092  return (realnum)CStemp;
1093 }
1094 
1095 realnum GetHlikeCollisionStrength( long nelem, long ipCollider,
1096  long nHi, long lHi, long sHi, long gHi, double IP_Ryd_Hi,
1097  long nLo, long lLo, long sLo, long gLo, double IP_Ryd_Lo,
1098  double Aul, double tauLo, double EnerErg )
1099 {
1100  DEBUG_ENTRY( "GetHlikeCollisionStrength()" );
1101 
1103  return 0.;
1104 
1105  double CStemp;
1106 
1107  // Energy gap between levels in eV
1108  double deltaE_eV = EnerErg/EN1EV;
1109 
1110  /* This set of collision strengths should only be used
1111  * if the Storey and Hummer flag is set */
1113  {
1114  if( nLo == nHi )
1115  {
1116  if( nHi <= iso_sp[ipH_LIKE][nelem].n_HighestResolved_max &&
1117  abs( lLo - lHi ) != 1 )
1118  {
1119  /* if delta L is not +/- 1, set collision strength to zero. */
1120  CStemp = 0.;
1121  }
1122  else if (ipCollider == ipELECTRON)
1123  {
1124  /* l-changing collisions are calculated for heavy slow projectile */
1125  CStemp = 0.;
1126  }
1127  else
1128  {
1129  //classical PS64 for Pengelly, R.M., & Seaton, M.J., 1964, MNRAS, 127, 165
1130  CStemp = CS_l_mixing_PS64(
1131  nelem,
1132  tauLo,
1133  nelem+1.-ipH_LIKE,
1134  nHi,
1135  lHi,
1136  gHi,
1137  lLo,
1138  deltaE_eV,
1139  ipCollider);
1140  if (0)
1141  {
1142  // New PS-M Refer F. Guzman MNRAS (2016)
1143  CStemp = CS_l_mixing_PS64_expI(
1144  nelem,
1145  tauLo,
1146  nelem+1.-ipH_LIKE,
1147  nHi,
1148  lHi,
1149  gHi,
1150  lLo,
1151  deltaE_eV,
1152  ipCollider);
1153  }
1154  }
1155  }
1156 
1157  else
1158  {
1159  if( nHi <= iso_sp[ipH_LIKE][nelem].n_HighestResolved_max &&
1160  abs( lLo - lHi ) != 1 )
1161  {
1162  /* if delta L is not +/- 1, set collision strength to zero. */
1163  CStemp = 0.;
1164  }
1165  else if( ipCollider == ipELECTRON )
1166  {
1167  CStemp = CS_ThermAve_PR78( ipH_LIKE, nelem, nHi, nLo,
1168  EnerErg / EN1RYD , phycon.te );
1169  if ( lHi >= 0 )
1170  CStemp /= 2.*pow2(nHi);
1171  }
1172  else
1173  CStemp = 0.;
1174  }
1175  }
1176  else
1177  {
1178  /* HCSAR_interp interpolates on a table to return R-matrix collision strengths
1179  * for hydrogen only */
1180  if( (CStemp = HlikeCSInterp( nelem, ipCollider, nHi, lHi, sHi, nLo, lLo, sLo )) >= 0.f )
1181  {
1182  fixit( "do something here and throughout this routine with where as in helike_cs.cpp." );
1183  //where = "HlikeI";
1184  }
1185  else if( nelem==ipHYDROGEN && ipCollider==ipELECTRON && ( nHi != nLo ) )
1186  {
1187  CStemp = hydro_vs_deexcit( nHi, gHi, IP_Ryd_Hi, nLo, gLo, IP_Ryd_Lo, Aul );
1188  /* There are NO resolved data for levels higher than n=4 */
1189  if ( lHi >= 0 )
1190  CStemp /= 2.*pow2(nHi);
1191  }
1192  else if( nLo == nHi )
1193  {
1194  if ( ipCollider == ipELECTRON)
1195  /* l-changing collisions are calculated for heavy slow projectile */
1196  CStemp = 0.;
1197  else if( iso_ctrl.lgCS_Vrinceanu[ipH_LIKE] )
1198  {
1199  CStemp = CS_l_mixing_VF01(ipH_LIKE, nelem,
1200  nHi,
1201  lHi,
1202  lLo,
1203  sLo,
1204  gHi,
1205  tauLo,
1206  IP_Ryd_Hi,
1207  IP_Ryd_Lo,
1208  phycon.te,
1209  ipCollider );
1210  }
1211  else if( iso_ctrl.lgCS_VOS12[ipH_LIKE] )
1212  {
1213  /* Use the method given in
1214  * >>refer He CS Vrinceau etal ApJ 747, 56 (2012); semiclasical treatment: eq. (7)
1215  * statistical weights included */
1216  CStemp = CS_l_mixing_VOS12(nHi,lHi,lLo,nelem,gHi,nelem+1.-ipH_LIKE,ipCollider,phycon.sqrte);
1217  }
1218  else if( iso_ctrl.lgCS_VOS12QM[ipH_LIKE] )// && abs( lLo - lHi ) == 1)
1219  {
1220  /* Use the method given in
1221  * >>refer He CS Vrinceau etal ApJ 747, 56 (2012); quantal treatment: eq. (2)
1222  * statistical weights included */
1223  CStemp = CS_l_mixing_VOS12QM(ipH_LIKE, nelem,
1224  nLo,
1225  lHi,
1226  lLo,
1227  sLo,
1228  gHi,
1229  tauLo,
1230  IP_Ryd_Hi,
1231  IP_Ryd_Lo,
1232  phycon.te,
1233  ipCollider );
1234  }
1235  else if ( iso_ctrl.lgCS_PS64[ipH_LIKE] && abs( lLo - lHi ) == 1 )
1236  {
1238  {
1239  //classical PS64 for Pengelly, R.M., & Seaton, M.J., 1964, MNRAS, 127, 165
1240  CStemp = CS_l_mixing_PS64(
1241  nelem,
1242  tauLo,
1243  nelem+1.-ipH_LIKE,
1244  nHi,
1245  lHi,
1246  gHi,
1247  lLo,
1248  deltaE_eV,
1249  ipCollider);
1250  }
1251  else
1252  // PS-M Refer F. Guzman MNRAS (2016)
1253  CStemp = CS_l_mixing_PS64_expI(
1254  nelem,
1255  tauLo,
1256  nelem+1.-ipH_LIKE,
1257  nHi,
1258  lHi,
1259  gHi,
1260  lLo,
1261  //sHi,
1262  deltaE_eV,
1263  ipCollider);
1264  }
1265  else
1266  CStemp = 0.;
1267  }
1268  else
1269  {
1270  ASSERT( nHi != nLo );
1271  /* highly excited levels */
1272  /* Vriens&Smeets (1980) give no Z dependence on their cross sections,
1273  * Percival and Richards (1978) have got a Z dependence so their rates are preferred */
1274  CStemp = CS_ThermAve_PR78( ipH_LIKE, nelem, nHi, nLo,
1275  EnerErg / EN1RYD , phycon.te );
1276  /* Thse are unresolved rates so they should e averaged for resolved transitions */
1277  if ( lHi >= 0 )
1278  CStemp /= 2.*pow2(nHi);
1279 
1280  }
1281  }
1282 
1283  return (realnum)CStemp;
1284 }
1285 
1286 STATIC realnum HlikeCSInterp( long nelem, long Collider, long nHi, long lHi, long sHi, long nLo, long lLo, long sLo )
1287 {
1288  DEBUG_ENTRY( "HlikeCSInterp()" );
1289 
1290  // Cannot do collapsed levels with unspecified l here.
1291  if( lLo < 0 || lHi < 0 )
1292  return -1.f;
1293 
1294  ASSERT( sHi==2 && sLo==2 );
1295  long ipLo = iso_sp[ipH_LIKE][nelem].QuantumNumbers2Index[nLo][lLo][sLo];
1296  long ipHi = iso_sp[ipH_LIKE][nelem].QuantumNumbers2Index[nHi][lHi][sHi];
1297  ASSERT( ipLo < ipHi );
1298 
1299  realnum cs = -1.f;
1300 
1301  if( nelem==ipHYDROGEN && Collider==ipELECTRON && nHi <= 5 && ( nHi != nLo ) )
1302  {
1303  cs = HCSAR_interp(ipLo,ipHi);
1304  }
1305  else if( nelem>ipHYDROGEN && Collider==ipELECTRON && nHi <= 3 && nLo < 3 )
1306  {
1307  cs = Hydcs123(ipLo + 1,ipHi + 1,nelem,'e');
1308  }
1309  else if( nelem>ipHYDROGEN && Collider==ipPROTON && nHi==2 && lHi==1 && nLo==2 && lLo==0 )
1310  {
1311  cs = Hydcs123(ipLo + 1,ipHi + 1,nelem,'p');
1312  }
1313 
1314  return cs;
1315 }
1316 
static long global_nelem
Definition: hydrocollid.cpp:38
realnum GetHlikeCollisionStrength(long nelem, long ipCollider, long nHi, long lHi, long sHi, long gHi, double IP_Ryd_Hi, long nLo, long lLo, long sLo, long gLo, double IP_Ryd_Lo, double Aul, double tauLo, double EnerErg)
realnum EnergyErg() const
Definition: transition.h:90
qList st
Definition: iso.h:482
STATIC double Ne10cs123(long int i, long int j)
bool lgCS_PSClassic[NISO]
Definition: iso.h:408
const int ipHE_LIKE
Definition: iso.h:65
NORETURN void TotalInsanity(void)
Definition: service.cpp:1067
t_opac opac
Definition: opacity.cpp:5
realnum h_coll_str(long ipLo, long ipHi, long ipTe)
t_isoCTRL iso_ctrl
Definition: iso.cpp:9
double e1(double x)
bool lgCS_therm_ave[NISO]
Definition: iso.h:408
double CS_l_mixing_VF01(long ipISO, long nelem, long n, long l, long lp, long s, long gLo, double tauLo, double IP_Ryd_Hi, double IP_Ryd_Lo, double temp, long Collider)
Definition: helike_cs.cpp:1656
STATIC double Fe26cs123(long int i, long int j)
double C2_PR78(double x, double y)
t_phycon phycon
Definition: phycon.cpp:6
double CS_l_mixing_PS64(long nelem, double tau, double target_charge, long n, long l, double gLo, long lp, double deltaE_eV, long Collider)
Definition: helike_cs.cpp:1382
T pow3(T a)
Definition: cddefines.h:992
static long global_nHi
Definition: hydrocollid.cpp:38
static const double C1
FILE * ioQQQ
Definition: cddefines.cpp:7
vector< freeBound > fb
Definition: iso.h:481
#define MIN2(a, b)
Definition: cddefines.h:807
bool lgCS_Vrinceanu[NISO]
Definition: iso.h:408
STATIC double Hydcs123(long int ilow, long int ihigh, long int iz, long int chType)
Definition: hydrocollid.cpp:93
static t_ADfA & Inst()
Definition: cddefines.h:209
t_iso_sp iso_sp[NISO][LIMELM]
Definition: iso.cpp:11
STATIC double CS_ThermAve_PR78(long ipISO, long nelem, long nHi, long nLo, double deltaE, double temp)
bool fp_equal(sys_float x, sys_float y, int n=3)
Definition: cddefines.h:858
bool lgColl_excite[NISO]
Definition: iso.h:362
realnum HydroCSInterp(long nelem, long ipHi, long ipLo, long ipCollider)
double CS_l_mixing_VOS12(long n, long l, long lp, long nelem, double gLo, long Ztarget, long Collider, double sqrte)
Definition: helike_cs.cpp:2084
STATIC realnum HCSAR_interp(int ipLo, int ipHi)
Definition: hydrocollid.cpp:44
static const realnum HCSTE[NHCSTE]
Definition: hydrocollid.cpp:41
STATIC double He2cs123(long int i, long int j)
#define STATIC
Definition: cddefines.h:118
EmissionList::reference Emis() const
Definition: transition.h:447
#define N_(A_)
Definition: iso.h:22
static long global_ipISO
Definition: hydrocollid.cpp:38
bool lgCS_PS64[NISO]
Definition: iso.h:408
float realnum
Definition: cddefines.h:124
#define EXIT_FAILURE
Definition: cddefines.h:168
STATIC double CS_PercivalRichards78(double Ebar)
#define cdEXIT(FAIL)
Definition: cddefines.h:484
static double kTRyd
Definition: hydrocollid.cpp:39
double powi(double, long int)
Definition: service.cpp:690
diatomics h2("h2", 4100.,&hmi.H2_total, Yan_H2_CS)
multi_arr< long, 3 > QuantumNumbers2Index
Definition: iso.h:490
TransitionProxy trans(const long ipHi, const long ipLo)
Definition: iso.h:473
STATIC double Ca20cs123(long int i, long int j)
double CS_l_mixing_VOS12QM(long ipISO, long nelem, long n, long l, long lp, long s, long gLo, double tauLo, double IP_Ryd_Hi, double IP_Ryd_Lo, double temp, long Collider)
Definition: helike_cs.cpp:1675
#define ASSERT(exp)
Definition: cddefines.h:617
bool lgCS_VOS12[NISO]
Definition: iso.h:408
static double global_deltaE
Definition: hydrocollid.cpp:39
double qg32(double, double, double(*)(double))
Definition: service.cpp:1271
const int ipH_LIKE
Definition: iso.h:64
const int LIMELM
Definition: cddefines.h:307
T pow2(T a)
Definition: cddefines.h:985
STATIC double C6cs123(long int i, long int j)
#define DEBUG_ENTRY(funcname)
Definition: cddefines.h:729
double powpq(double x, int p, int q)
Definition: service.cpp:726
#define NHCSTE
Definition: atmdat.h:268
bool lgCS_VOS12QM[NISO]
Definition: iso.h:408
STATIC double cross_section(double EgammaRyd, double EthRyd, long nelem, long n, long l, long s)
static long global_nLo
Definition: hydrocollid.cpp:38
#define MAX2(a, b)
Definition: cddefines.h:828
int fprintf(const Output &stream, const char *format,...)
Definition: service.cpp:1217
double pow(double x, int i)
Definition: cddefines.h:782
STATIC realnum HlikeCSInterp(long nelem, long Collider, long nHi, long lHi, long sHi, long nLo, long lLo, long sLo)
double hydro_vs_deexcit(long nHi, long gHi, double IP_Ryd_Hi, long nLo, long gLo, double IP_Ryd_Lo, double Aul)
double sqrte
Definition: phycon.h:58
#define fixit(a)
Definition: cddefines.h:416
double te
Definition: phycon.h:21
double CS_l_mixing_PS64_expI(long nelem, double tau, double target_charge, long n, long l, double g, long lp, double deltaE_eV, long Collider)
Definition: helike_cs.cpp:1189
STATIC double Therm_ave_coll_str_int_PR78(double EOverKT)
const int ipHYDROGEN
Definition: cddefines.h:348
realnum & Aul() const
Definition: emission.h:668
bool lgCaseB_HummerStorey
Definition: opacity.h:177