60 static long int nhit = 0,
63 static double oltcool=0.,
72 fprintf(
ioQQQ,
" COOLR TE:%.4e zone %li %li Cool:%.4e Heat:%.4e eden:%.4e edenTrue:%.4e\n",
167 fprintf(
ioQQQ,
"DEBUG big %.2f\t%.5e\t%.2e\t%.2e\t%.2e\n",
225 heat += (*diatom)->Cont_Diss_Heat_Rate();
265 enum {DEBUG_LOC=
false};
268 fprintf(
ioQQQ,
"h2coolbug\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\n",
292 (sin(2.03657*log10(
phycon.
te)+4.63258))-2.08189*
296 (-26.2982*pow(log10(
phycon.
te), -0.215807)) - sqrt(factor));
299 double aa=-26.2982, bb=-0.215807, omeg=2.03657, phi=4.63258,
300 c1=0.283978, c2=-1.27333, d1=-2.08189, d2=4.66288;
306 double w = 0.5 * y + aa * pow(x,bb)
308 + (c1*y+c2) * sin(omeg*x+phi) + (d1*y+d2) );
315 fixit(
"test and enable chemical heating by default");
350 enum {DEBUG_LOC=
false};
353 fprintf(
ioQQQ,
"CoolEvaluate debuggg\t%.2f\t%.5e\t%.5e\t%.5e\t%.5e\t%.5e\n",
379 for(
long int nelem=ipISO; nelem <
LIMELM; nelem++ )
417 for(
long ion=1; ion <
LIMELM+1; ++ion )
433 enum {DEBUG_LOC=
false};
434 if( DEBUG_LOC &&
nzone>60 )
436 double sumfield = 0., sumtot=0., sum1=0., sum2=0.;
444 fprintf(
ioQQQ,
"DEBUG brems heat\t%.2f\t%.3e\t%.3e\t%.3e\t%e\t%.3e\t%.3e\n",
447 sumtot/
SDIV(sumfield) ,
501 for(
long int ion=limit_lo; ion<=limit_hi; ++ion )
595 double xIonDenseSave[
LIMELM][LIMELM+1];
598 for(
int nelem=0; nelem <
LIMELM; nelem++ )
600 for(
int ion=0; ion<=nelem+1; ++ion )
611 (*(*TauDummy).Hi()).g() = 0.;
612 (*(*TauDummy).Lo()).g() = 0.;
613 (*(*TauDummy).Hi()).IonStg() = 0;
614 (*(*TauDummy).Lo()).IonStg() = 0;
615 (*(*TauDummy).Hi()).nelem() = 0;
616 (*(*TauDummy).Lo()).nelem() = 0;
617 (*TauDummy).Emis().Aul() = 0.;
618 (*TauDummy).EnergyWN() = 0.;
619 (*TauDummy).WLAng() = 0.;
625 for(
int nelem=0; nelem <
LIMELM; nelem++ )
627 for(
int ion=0; ion<=nelem+1; ++ion )
650 enum {DEBUG_LOC=
false};
654 if( lgMustPrintHeader )
656 lgMustPrintHeader =
false;
658 for(
long ipSpecies=1; ipSpecies<
nSpecies; ipSpecies++ )
663 printf(
"DEBUG Max\t%li" ,
dBaseSpecies[0].numLevels_max );
664 for(
long ipSpecies=1; ipSpecies<
nSpecies; ipSpecies++ )
666 printf(
"\t%li" ,
dBaseSpecies[ipSpecies].numLevels_max );
670 printf(
"DEBUG Local\t%li" ,
dBaseSpecies[0].numLevels_local );
671 for(
long ipSpecies=1; ipSpecies<
nSpecies; ipSpecies++ )
673 printf(
"\t%li" ,
dBaseSpecies[ipSpecies].numLevels_local );
687 fprintf(
ioQQQ,
" COOLR; cooling is <=0, this is impossible.\n" );
695 fprintf(
ioQQQ,
" COOLR; cooling slope <=0, this is impossible.\n" );
698 fprintf(
ioQQQ,
" Probably due to very low density.\n" );
714 " NOTE Negative cooling, zone %4ld, =%10.2e coola=%10.2e CHION=%10.2e Te=%10.2e\n",
733 if(
nzone != nzSave )
756 double logT = log10( Temp * 0.001 );
759 for(
int i = 0; i < ncoeff; i++ )
761 sum += coeff[i] * logTn;
773 const double DE = 852.5;
774 return 5.09e-27 * pow( Temp * 0.001, 0.5) *
dsexp( DE / Temp );
782 double coeff_oH2_H_cool[] = { -24.330855, 4.4404496, -4.0460989, -1.1390725, 9.8094223, 8.6273872 };
783 int ncoeff =
sizeof( coeff_oH2_H_cool ) /
sizeof( coeff_oH2_H_cool[0] );
784 return ga08_sum( Temp, coeff_oH2_H_cool, ncoeff );
793 double coeff_oH2_H_warm[] = { -24.329086, 4.6105087, -3.9505350, 12.363818, -32.403165, 48.853562, -38.542008, 12.066770 };
794 int ncoeff =
sizeof( coeff_oH2_H_warm ) /
sizeof( coeff_oH2_H_warm[0] );
795 return ga08_sum( Temp, coeff_oH2_H_warm, ncoeff );
806 const double Tbreak = 100.;
807 static double Temp_c = -1.;
813 Temp_c = Tbreak / ( 1. + (crate_ab - crate_bb) / LOG10_E );
815 printf(
"oH2 H, at 100K:\t %f (%.10e vs %.10e)\n", Temp_c, crate_bb, crate_ab);
819 if( Temp > Tbreak && Temp <= Temp_c )
820 corr = LOG10_E * ( 1. - Temp / Temp_c );
830 const double Tbreak = 1000.;
831 static double Temp_c = -1.;
837 Temp_c = Tbreak / ( 1. + (crate_ab - crate_bb) / LOG10_E );
839 printf(
"oH2 H, at 1000K:\t %f (%.10e vs %.10e)\n", Temp_c, crate_bb, crate_ab);
843 if( Temp >= Temp_c && Temp_c < Tbreak )
844 corr = LOG10_E * ( Temp / Temp_c - 1. );
853 static double cool_above_6000 = -1.;
854 if( cool_above_6000 < 0. )
864 else if( Temp < 1000. )
869 cool = pow(10., cool);
871 else if( Temp < 6000. )
877 cool = cool_above_6000;
889 const double E20 = 509.85;
890 return 8.16e-26 * pow(Temp * 0.001, 0.5) *
dsexp( E20 / Temp );
898 double coeff_pH2_H_cool[] = { -24.216387, 3.3237480, -11.642384, -35.553366, -35.105689, -10.922078 };
899 int ncoeff =
sizeof( coeff_pH2_H_cool ) /
sizeof( coeff_pH2_H_cool[0] );
900 return ga08_sum( Temp, coeff_pH2_H_cool, ncoeff );
908 double coeff_pH2_H_warm[] = { -24.216387, 4.2046488, -1.3155285, -1.6552763, 4.1780102, -0.56949697, -3.3824407, 1.0904027 };
909 int ncoeff =
sizeof( coeff_pH2_H_warm ) /
sizeof( coeff_pH2_H_warm[0] );
910 return ga08_sum( Temp, coeff_pH2_H_warm, ncoeff );
919 const double Tbreak = 100.;
920 static double Temp_c = -1.;
926 Temp_c = Tbreak / ( 1. + (crate_ab - crate_bb) / LOG10_E );
928 printf(
"pH2 H, at 100K:\t %f\n", Temp_c);
932 if( Temp > Tbreak && Temp <= Temp_c )
933 corr = LOG10_E * ( 1. - Temp / Temp_c );
942 static double cool_above_6000 = -1.;
943 if( cool_above_6000 < 0. )
958 cool = pow(10., cool);
960 else if( Temp < 6000. )
966 cool = cool_above_6000;
978 double coeff_pH2_pH2[] = { -23.889798, 1.8550774, -0.55593388, 0.28429361, -0.20581113, 0.13112378 };
979 int ncoeff =
sizeof( coeff_pH2_pH2 ) /
sizeof( coeff_pH2_pH2[0] );
980 return ga08_sum( Temp, coeff_pH2_pH2, ncoeff );
988 static double cool_above_6000 = -1.;
989 if( cool_above_6000 < 0. )
998 cool = cool_above_6000;
1007 double coeff_pH2_oH2[] = { -23.748534, 1.76676480, -0.58634325, 0.31074159, -0.17455629, 0.18530758 };
1008 int ncoeff =
sizeof( coeff_pH2_oH2 ) /
sizeof( coeff_pH2_oH2[0] );
1009 return ga08_sum( Temp, coeff_pH2_oH2, ncoeff );
1017 static double cool_above_6000 = -1.;
1018 if( cool_above_6000 < 0. )
1027 cool = cool_above_6000;
1038 double coeff_oH2_pH2[] = { -24.126177, 2.3258217, -1.0082491, 0.54823768, -0.33679759, 0.20771406 };
1039 int ncoeff =
sizeof( coeff_oH2_pH2 ) /
sizeof( coeff_oH2_pH2[0] );
1040 return ga08_sum( Temp, coeff_oH2_pH2, ncoeff );
1048 static double cool_above_6000 = -1.;
1049 if( cool_above_6000 < 0. )
1057 cool = cool_above_6000;
1068 double coeff_oH2_oH2[] = { -24.020047, 2.2687566, -1.0200304, 0.83561432, -0.40772247, 0.096025713 };
1069 int ncoeff =
sizeof( coeff_oH2_oH2 ) /
sizeof( coeff_oH2_oH2[0] );
1070 return ga08_sum( Temp, coeff_oH2_oH2, ncoeff );
1078 static double cool_above_6000 = -1.;
1079 if( cool_above_6000 < 0. )
1088 cool = cool_above_6000;
1099 double coeff_pH2_He[] = { -23.489029 , 1.8210825 , -0.59110559 , 0.42280623 , -0.30171138 , 0.12872839 };
1100 int ncoeff =
sizeof( coeff_pH2_He ) /
sizeof( coeff_pH2_He[0] );
1101 return ga08_sum( Temp, coeff_pH2_He, ncoeff );
1108 static double cool_above_6000 = -1.;
1109 if( cool_above_6000 < 0. )
1118 cool = cool_above_6000;
1128 double coeff_oH2_He[] = { -23.7749 , 2.40654 , -1.23449 , 0.739874 , -0.258940 , 0.120573 };
1129 int ncoeff =
sizeof( coeff_oH2_He ) /
sizeof( coeff_oH2_He[0] );
1130 return ga08_sum( Temp, coeff_oH2_He, ncoeff );
1138 static double cool_above_6000 = -1.;
1139 if( cool_above_6000 < 0. )
1148 cool = cool_above_6000;
1159 double coeff_pH2_p[] = { -21.757160 , 1.3998367 , -0.37209530 , 0.061554519 , -0.37238286 , 0.23314157 };
1160 int ncoeff =
sizeof( coeff_pH2_p ) /
sizeof( coeff_pH2_p[0] );
1161 return ga08_sum( Temp, coeff_pH2_p, ncoeff );
1168 static double cool_above_10000 = -1.;
1169 if( cool_above_10000 < 0. )
1178 cool = cool_above_10000;
1188 double coeff_oH2_p[] = { -21.706641 , 1.3901283 , -0.34993699 , 0.075402398 , -0.23170723 , 0.068938876 };
1189 int ncoeff =
sizeof( coeff_oH2_p ) /
sizeof( coeff_oH2_p[0] );
1190 return ga08_sum( Temp, coeff_oH2_p, ncoeff );
1197 static double cool_above_10000 = -1.;
1198 if( cool_above_10000 < 0. )
1207 cool = cool_above_10000;
1218 double coeff_pH2_e_cool[] = { -22.817869 , 0.95653474 , 0.79283462 , 0.56811779 , 0.27895033 , 0.056049813 };
1219 int ncoeff =
sizeof( coeff_pH2_e_cool ) /
sizeof( coeff_pH2_e_cool[0] );
1220 return ga08_sum( Temp, coeff_pH2_e_cool, ncoeff );
1228 double coeff_pH2_e_warm[] = { -22.817869 , 0.66916141 , 7.1191428 , -11.176835 , 7.0467275 , -1.6471816 };
1229 int ncoeff =
sizeof( coeff_pH2_e_warm ) /
sizeof( coeff_pH2_e_warm[0] );
1230 return ga08_sum( Temp, coeff_pH2_e_warm, ncoeff );
1237 static double cool_above_10000 = -1.;
1238 if( cool_above_10000 < 0. )
1243 const double E20 = 509.85;
1248 else if( Temp <= 1e4 )
1251 cool = cool_above_10000;
1253 return dsexp( E20 / Temp ) * cool;
1263 double coeff_oH2_e[] = { -21.703215 , 0.76059565 , 0.50644890 , 0.050371349 , -0.10372467 , -0.035709409 };
1264 int ncoeff =
sizeof( coeff_oH2_e ) /
sizeof( coeff_oH2_e[0] );
1265 return ga08_sum( Temp, coeff_oH2_e, ncoeff );
1272 static double cool_above_10000 = -1.;
1273 if( cool_above_10000 < 0. )
1282 cool = cool_above_10000;
1284 const double E31 = 845.;
1285 return dsexp( E31 / Temp ) * cool;
1299 double f_ortho = 1. - f_para;
1333 double cooling_low = cool_H + cool_H2 + cool_He + cool_p + cool_e;
1337 enum { DEBUG_LOC =
false };
1340 printf(
"%e\t%e\t%e\t%e\t%e\t%e\t%e\t%e\t%e\t%e\t%e\t%e\n",
1351 cooling_high / (1. + cooling_high / cooling_low),
1352 cooling_high / (1. + cooling_high / cooling_low) *
hmi.
H2_total
1364 return cooling_high / (1. + cooling_high / cooling_low);
1370 static double TeEvalCS = 0., TeEvalCS_21cm=0.;
1371 static double electron_rate_21cm,
1378 for(
int nelem=ipISO; nelem <
LIMELM; nelem++ )
1383 iso_sp[ipISO][nelem].
fb[0].RateLevel2Cont;
1388 enum {DEBUG_LOC=
false};
1391 for (
int nelem = 0; nelem <
LIMELM; nelem++)
1393 fprintf(
ioQQQ,
"ionbal.ExcitationGround: nelem = %d", nelem);
1394 for (
int ion = 0; ion < nelem+1; ion++)
1408 enum {DEBUG_LOC=
false};
1411 # define N21CM_TE 16
1413 double teval[
N21CM_TE]={2.,5.,10.,20.,50.,100.,200.,500.,1000.,
1414 2000.,3000.,5000.,7000.,10000.,15000.,20000.};
1418 ioQQQ,
"DEBUG 21 cm deex Te=\t%.2e\tH0=\t%.2e\tp=\t%.2e\te=\t%.2e\n",
1437 double cs = (electron_rate_21cm *
dense.
eden +
1477 dense.
xIonDense[(*HFLines[i].Hi()).nelem()-1][(*HFLines[i].Hi()).IonStg()-1] *=
1493 static const double EPS = 0.01;
1508 fprintf(
ioQQQ,
" negative line=%s %.2f fraction of heating=%.3f\n",
1515 fprintf(
ioQQQ,
" heating line=%s %.2f fraction of heating=%.3f\n",
1554 " fndstr cool: TE=%10.4e Ne=%10.4e C=%10.3e dC/dT=%10.2e ABS(%s %.1f)=%.2e nz=%ld\n",
1586 " All coolant heat greater than%6.2f%% of the total will be printed.\n",
1593 if( fabs(ratio) >=
EPS )
1607 static const double aI[11][11] = {
1608 { 3.15847e+00,-2.52430e+00, 4.04877e-01, 6.13466e-01, 6.28867e-01, 3.29441e-01,
1609 -1.71486e-01,-3.68685e-01,-7.59200e-02, 1.60187e-01, 8.37729e-02 },
1610 { 2.46819e-02, 1.03924e-01, 1.98935e-01, 2.18843e-01, 1.20482e-01,-4.82390e-02,
1611 -1.20811e-01,-4.46133e-04, 8.88749e-02, 2.50320e-02,-1.28900e-02 },
1612 { -2.11118e-02,-8.53821e-02,-1.52444e-01,-1.45660e-01,-4.63705e-02, 8.16592e-02,
1613 9.87296e-02,-3.24743e-02,-8.82637e-02,-7.52221e-03, 1.99419e-02 },
1614 { 1.24009e-02, 4.73623e-02, 7.51656e-02, 5.07201e-02,-2.25247e-02,-8.17151e-02,
1615 -4.59297e-02, 5.05096e-02, 5.58818e-02,-9.11885e-03,-1.71348e-02 },
1616 { -5.41633e-03,-1.91406e-02,-2.58034e-02,-2.23048e-03, 5.07325e-02, 5.94414e-02,
1617 -2.11247e-02,-5.05387e-02, 9.20453e-03, 1.67321e-02,-3.47663e-03 },
1618 { 1.70070e-03, 5.39773e-03, 4.13361e-03,-1.14273e-02,-3.23280e-02,-2.19399e-02,
1619 1.76310e-02, 2.23352e-02,-4.59817e-03,-8.24286e-03,-3.90032e-04 },
1620 { -3.05111e-04,-7.26681e-04, 4.67015e-03, 1.24789e-02,-1.16976e-02,-1.13488e-02,
1621 6.31446e-02, 1.33830e-02,-8.54735e-02,-6.47349e-03, 3.72266e-02 },
1622 { -1.21721e-04,-7.47266e-04,-2.20675e-03,-2.74351e-03,-1.00402e-03,-2.38863e-03,
1623 -2.28987e-03, 7.79323e-03, 7.98332e-03,-3.80435e-03,-4.25035e-03 },
1624 { 1.77611e-04, 8.73517e-04,-2.67582e-03,-4.57871e-03, 2.96622e-02, 1.89850e-02,
1625 -8.84093e-02,-2.93629e-02, 1.02966e-01, 1.38957e-02,-4.22093e-02 },
1626 { -2.05480e-05,-6.92284e-05, 2.95254e-05,-1.70374e-04,-5.43191e-04, 2.50978e-03,
1627 4.45570e-03,-2.80083e-03,-5.68093e-03, 1.10618e-03, 2.33625e-03 },
1628 { -3.58754e-05,-1.80305e-04, 1.40751e-03, 2.06757e-03,-1.23098e-02,-8.81767e-03,
1629 3.46210e-02, 1.23727e-02,-4.04801e-02,-5.68689e-03, 1.66733e-02 }
1633 static const double bI[11] = {
1634 2.21564e+00, 1.83879e-01, -1.33575e-01, 5.89871e-02, -1.45904e-02, -7.10244e-04,
1635 2.80940e-03, -1.70485e-03, 5.26075e-04, 9.94159e-05, -1.06851e-04
1639 static const double aII[9][3] = {
1640 { -3.7369800e+01,-9.3647000e+00, 9.2170000e-01 },
1641 { 3.8036590e+02, 9.5918600e+01,-1.3498800e+01 },
1642 { -1.4898014e+03,-3.9701720e+02, 7.6453900e+01 },
1643 { 2.8614150e+03, 8.4293760e+02,-2.1783010e+02 },
1644 { -2.3263704e+03,-9.0730760e+02, 3.2097530e+02 },
1645 { -6.9161180e+02, 3.0688020e+02,-1.8806670e+02 },
1646 { 2.8537893e+03, 2.9129830e+02,-8.2416100e+01 },
1647 { -2.0407952e+03,-2.9902530e+02, 1.6371910e+02 },
1648 { 4.9259810e+02, 7.6346100e+01,-6.0024800e+01 }
1651 static const double bII[9][2] = {
1652 { -1.1628100e+01,-8.6991000e+00 },
1653 { 1.2560660e+02, 6.3383000e+01 },
1654 { -5.3274890e+02,-1.2889390e+02 },
1655 { 1.1423873e+03,-1.3503120e+02 },
1656 { -1.1568545e+03, 9.7758380e+02 },
1657 { 7.5010200e+01,-1.6499529e+03 },
1658 { 9.9681140e+02, 1.2586812e+03 },
1659 { -8.8818950e+02,-4.0474610e+02 },
1660 { 2.5013860e+02, 2.7335400e+01 }
1664 static const double cII[7][5] = {
1665 { -5.7752000e+00, 3.0558600e+01,-5.4327200e+01, 3.6262500e+01,-8.4082000e+00 },
1666 { 4.6209700e+01,-2.4821770e+02, 4.5096760e+02,-3.1009720e+02, 7.4792500e+01 },
1667 { -1.6072800e+02, 8.7419640e+02,-1.6165987e+03, 1.1380531e+03,-2.8295400e+02 },
1668 { 3.0500700e+02,-1.6769028e+03, 3.1481061e+03,-2.2608347e+03, 5.7639300e+02 },
1669 { -3.2954200e+02, 1.8288677e+03,-3.4783930e+03, 2.5419361e+03,-6.6193900e+02 },
1670 { 1.9107700e+02,-1.0689366e+03, 2.0556693e+03,-1.5252058e+03, 4.0429300e+02 },
1671 { -4.6271800e+01, 2.6056560e+02,-5.0567890e+02, 3.8008520e+02,-1.0223300e+02 }
1675 static const double Gf1[3][5] = {
1676 { 9.0640248e-01, 8.8891357e-01, 8.8622693e-01, 8.9657428e-01, 9.1906253e-01 },
1677 { 1.1330031e+00, 1.2222562e+00, 1.3293404e+00, 1.4569332e+00, 1.6083594e+00 },
1678 { 2.5492570e+00, 2.9028584e+00, 3.3233510e+00, 3.8244497e+00, 4.4229884e+00 }
1682 static const double Gf2[2][5] = {
1683 { 7.2512198e-01, 6.4648260e-01, 5.9081795e-01, 5.5173802e-01, 5.2517859e-01 },
1684 { 5.0355693e-01, 5.1463417e-01, 5.3173616e-01, 5.5502217e-01, 5.8485797e-01 }
1689 { 5.2163300e+01, 4.9713900e+01, 6.4751200e+01 },
1690 { -2.5703130e+02,-1.8977460e+02,-2.1389560e+02 },
1691 { 4.4681610e+02, 2.7102980e+02, 1.7414320e+02 },
1692 { -2.9305850e+02,-2.6978070e+02, 1.3650880e+02 },
1693 { 0.0000000e+00, 4.2048120e+02,-2.7148990e+02 },
1694 { 7.7047400e+01,-5.7662470e+02, 8.9321000e+01 },
1695 { -2.3871800e+01, 4.3277900e+02, 5.8258400e+01 },
1696 { 0.0000000e+00,-1.6053650e+02,-4.6080700e+01 },
1697 { 1.9970000e-01, 2.3392500e+01, 8.7301000e+00 }
1701 { -8.5862000e+00, 3.7643220e+02 },
1702 { 3.4134800e+01,-1.2233635e+03 },
1703 { -1.1632870e+02, 6.2867870e+02 },
1704 { 2.9654510e+02, 2.2373946e+03 },
1705 { -3.9342070e+02,-3.8288387e+03 },
1706 { 2.3754970e+02, 2.1217933e+03 },
1707 { -3.0600000e+01,-5.5166700e+01 },
1708 { -2.7617000e+01,-3.4943210e+02 },
1709 { 8.8453000e+00, 9.2205900e+01 }
1721 double mec2 = ELECTRON_MASS*
pow2(SPEEDLIGHT);
1722 double tau = BOLTZMANN*Te/mec2;
1724 double fac = mec2*
pow2(eden)*SIGMA_THOMSON*SPEEDLIGHT*FINE_STRUCTURE*
powpq(tau,3,2);
1726 if( Te <= 5.754399e5 )
1729 G = 1.680322*pow(Te/5.754399e5,0.116);
1731 else if( Te <= 1.160451e7 )
1734 double Theta = (log10(tau) + 2.65)/1.35;
1737 for(
int i=0; i < 11; ++i )
1742 G *= sqrt(8./(3.*PI));
1744 else if( Te <= 3.481352e9 )
1746 double A[3]={0.,0.,0.}, B[2]={0.,0.}, C[5]={0.,0.,0.,0.,0.};
1748 double tau8 =
powpq(tau,1,8);
1750 for(
int j=0; j < 9; ++j )
1752 A[0] +=
aII[j][0]*t8p;
1753 A[1] +=
aII[j][1]*t8p;
1754 A[2] +=
aII[j][2]*t8p;
1755 B[0] +=
bII[j][0]*t8p;
1756 B[1] +=
bII[j][1]*t8p;
1759 double tau6 =
powpq(tau,1,6);
1761 for(
int j=0; j < 7; ++j )
1763 C[0] +=
cII[j][0]*t6p;
1764 C[1] +=
cII[j][1]*t6p;
1765 C[2] +=
cII[j][2]*t6p;
1766 C[3] +=
cII[j][3]*t6p;
1767 C[4] +=
cII[j][4]*t6p;
1770 G = A[0] + A[1] + 2.*A[2] + B[0] + 0.5*B[1];
1771 for(
int i=0; i < 3; ++i )
1772 for(
int j=2; j < 7; ++j )
1773 G +=
Gf1[i][j-2]*A[i]*C[j-2];
1774 for(
int i=0; i < 2; ++i )
1775 for(
int j=2; j < 7; ++j )
1776 G +=
Gf2[i][j-2]*B[i]*C[j-2];
1780 double A[3]={0.,0.,0.}, B[2]={0.,0.};
1782 double tau8 =
powpq(tau,1,8);
1784 for(
int j=0; j < 9; ++j )
1786 A[0] +=
aIII[j][0]*t8p;
1787 A[1] +=
aIII[j][1]*t8p;
1788 A[2] +=
aIII[j][2]*t8p;
1789 B[0] +=
bIII[j][0]*t8p;
1790 B[1] +=
bIII[j][1]*t8p;
1793 G = A[0] + A[1] + 2.*A[2] + B[0] + 0.5*B[1];
1808 double mec2 = ELECTRON_MASS*
pow2(SPEEDLIGHT);
1810 double tau = BOLTZMANN*
max(Te,5.754399e5)/mec2;
1813 double fac = SIGMA_THOMSON*SPEEDLIGHT*FINE_STRUCTURE/sqrt(tau)*FR1RYD*HPLANCK/mec2;
1817 if( Te < 5.754399e5 )
1818 fac *= pow(Te/5.754399e5,-0.384);
1825 double fac2 = PI8*
pow3(FR1RYD)/
pow2(SPEEDLIGHT);
1834 for(
long k=klo; k < khi; ++k )
1836 vexp( arg.ptr0(), boltz.
ptr0(), klo, khi );
1837 bfac = boltz.
ptr0();
1840 if( Te <= 1.160451e7 )
1850 double Theta = (log10(tau) + 2.65)/1.35;
1853 for(
int i=1; i < 11; ++i )
1854 Thp[i] = Thp[i-1]*Theta;
1857 double hokT = TE1RYD/Te;
1858 for(
long k=klo; k < khi; ++k )
1860 vlog10( x.ptr0(), y.ptr0(), klo, khi );
1862 for(
long k=klo; k < khi; ++k )
1864 double xx = (y[k] + 1.5)/2.5;
1867 for(
int i=1; i < 11; ++i )
1868 xxp[i] = xxp[i-1]*xx;
1871 for(
int i=0; i < 11; ++i )
1872 for(
int j=0; j < 11; ++j )
1873 G +=
aI[i][j]*Thp[i]*xxp[j];
1874 G *= sqrt(8./(3.*PI));
1882 else if( Te <= 3.481352e9 )
1885 double A[3]={0.,0.,0.}, B[2]={0.,0.}, C[5]={0.,0.,0.,0.,0.};
1886 double tau8 =
powpq(tau,1,8);
1888 for(
int j=0; j < 9; ++j )
1890 A[0] +=
aII[j][0]*t8p;
1891 A[1] +=
aII[j][1]*t8p;
1892 A[2] +=
aII[j][2]*t8p;
1893 B[0] +=
bII[j][0]*t8p;
1894 B[1] +=
bII[j][1]*t8p;
1897 double tau6 =
powpq(tau,1,6);
1899 for(
int j=0; j < 7; ++j )
1901 C[0] +=
cII[j][0]*t6p;
1902 C[1] +=
cII[j][1]*t6p;
1903 C[2] +=
cII[j][2]*t6p;
1904 C[3] +=
cII[j][3]*t6p;
1905 C[4] +=
cII[j][4]*t6p;
1909 for(
long k=klo; k < khi; ++k )
1913 double G = (A[2]*x + A[1])*x + A[0] +
e1_scaled(x)*(B[1]*x + B[0]);
1915 double x8 =
powpq(x,1,8);
1917 for(
int i=2; i < 7; ++i )
1932 double A[3]={0.,0.,0.}, B[2]={0.,0.};
1933 double tau8 =
powpq(tau,1,8);
1935 for(
int j=0; j < 9; ++j )
1937 A[0] +=
aIII[j][0]*t8p;
1938 A[1] +=
aIII[j][1]*t8p;
1939 A[2] +=
aIII[j][2]*t8p;
1940 B[0] +=
bIII[j][0]*t8p;
1941 B[1] +=
bIII[j][1]*t8p;
1945 for(
long k=klo; k < khi; ++k )
1949 double G = (A[2]*x + A[1])*x + A[0] +
e1_scaled(x)*(B[1]*x + B[0]);
1970 double z1 = knu[klo];
1971 double slope = log(y1/y2)/(x1l-x2l);
1974 for(
long k=0; k < klo; ++k )
1977 arg[k] = slope*(x2l-x1l);
1979 vexp( arg.ptr0(), efac.
ptr0(), 0, klo );
1980 for(
long k=0; k < klo; ++k )
1984 knu[k] = z1*efac[k]*af;
1993 slope = (log(y2/y1) + (x2-
x1)*TE1RYD/Te)/(x2l-x1l);
2000 arg[k] = (x1-
x2)*TE1RYD/Te - slope*(x1l-x2l);
2001 arg2[k] = (slope-2.)*(x2l-x1l);
2008 knu[k] = z1*efac2[k];
void CoolAdd(const char *chLabel, realnum lambda, double cool)
STATIC double ga08_pH2_e(double Temp)
static const double aII[9][3]
double HyperfineCS(size_t i)
t_mole_global mole_global
vector< double, allocator_avx< double > > ContBoltz
double brems_cool(long ion, double Te)
void coolpr(FILE *io, const char *chLabel, realnum lambda, double ratio, const char *chJOB)
STATIC double ga08_oH2_He(double Temp)
STATIC double ga08_oH2_oH2(double Temp)
STATIC double ga08_oH2_e_a10_b1e4(double Temp)
STATIC double ga08_pH2_p(double Temp)
long int ipEnergyBremsThin
NORETURN void TotalInsanity(void)
double widflx(size_t i) const
void vlog10(const double x[], double y[], long nlo, long nhi)
static const double aIII[9][3]
STATIC double ga08_pH2_H_b1000(double Temp)
double H21cm_H_atom(double temp)
void RT_line_one_escape(const TransitionProxy &t, bool lgShield_this_zone, realnum pestrk, realnum DopplerWidth)
long int IonHigh[LIMELM+1]
STATIC double ga08_pH2_oH2(double Temp)
bool lgTimeDependentStatic
TransitionList HFLines("HFLines",&AnonStates)
STATIC double ga08_oH2_p(double Temp)
void CoolEvaluate(double *tot)
bool lgTemperatureConstant
static const bool PRT_DERIV
STATIC double ga08_pH2_e_a1000_b1e4(double Temp)
molezone * findspecieslocal(const char buf[])
STATIC double ga08_oH2_pH2_a100_b6000(double Temp)
static const double aI[11][11]
double anu(size_t i) const
void TempChange(double TempNew, bool lgForceUpdate)
realnum deriv_HeatH2Dexc_ELWERT
STATIC double ga08_oH2_p_a10_b1e4(double Temp)
STATIC double ga08_oH2_H(double Temp)
static const double Gf2[2][5]
double anuln(size_t i) const
STATIC double ga08_oH2_H_b100(double Temp)
double ** ExcitationGround
static const double cII[7][5]
STATIC void CoolHyperfine(void)
t_iso_sp iso_sp[NISO][LIMELM]
void vexp(const double x[], double y[], long nlo, long nhi)
long int nflux_with_check
bool lgIonStoutOn[LIMELM][LIMELM+1]
STATIC double ga08_sum(double Temp, double *coeff, int ncoeff)
realnum deriv_HeatH2Dexc_TH85
double xIonDense[LIMELM][LIMELM+1]
double H21cm_proton(double temp)
void CoolSum(double *total)
static const double bIII[9][2]
bool fp_equal(sys_float x, sys_float y, int n=3)
double H21cm_electron(double temp)
STATIC double ga08_oH2_He_b6000(double Temp)
STATIC double ga08_oH2_pH2(double Temp)
STATIC double ga08_oH2_oH2_a100_b6000(double Temp)
bool lgBallistic(void) const
bool lgIonChiantiOn[LIMELM][LIMELM+1]
STATIC double eeBremsCooling(double Te, double eden)
double chem_heat(void) const
long int IonLow[LIMELM+1]
void atom_level2(const TransitionProxy &t, const bool lgHFS)
STATIC double ga08_pH2_H_b100(double Temp)
STATIC double ga08_pH2_pH2(double Temp)
void iso_cool(long ipISO, long nelem)
void PutCS(double cs, const TransitionProxy &t)
char chClntLab[NCOLNT][NCOLNT_LAB_LEN+1]
realnum deriv_HeatH2Dexc_BD96
STATIC double ga08_oH2_H_stitch_100(double Temp)
static const double Gf1[3][5]
realnum AccelTotalOutward
STATIC double ga08_oH2_H_b1000(double Temp)
vector< diatomics * > diatoms
void eeBremsSpectrum(double Te, realnum jnu[], double knu[])
double anu2(size_t i) const
diatomics h2("h2", 4100.,&hmi.H2_total, Yan_H2_CS)
realnum GetDopplerWidth(realnum massAMU)
static bool lgMustPrintHeader
STATIC double ga08_oH2_H_b6000(double Temp)
double heating(long nelem, long ion)
double gauntff(long Z, double Te, double anu)
void setHeating(long nelem, long ion, double heating)
STATIC double ga08_oH2_H_stitch_1000(double Temp)
realnum gas_phase[LIMELM]
realnum AtomicWeight[LIMELM]
static const double bI[11]
char chH2_small_model_type
realnum deriv_HeatH2Dexc_BHT90
STATIC double ga08_pH2_He(double Temp)
#define DEBUG_ENTRY(funcname)
double powpq(double x, int p, int q)
realnum scalingDensity(void)
STATIC double ga08_pH2_H_b6000(double Temp)
double elementcool[LIMELM+1]
diatomics hd("hd", 4100.,&hmi.HD_total, Yan_H2_CS)
STATIC double ga08_oH2_e(double Temp)
vector< species > dBaseSpecies
double e1_scaled(double x)
size_t ithreshC(double threshold) const
int fprintf(const Output &stream, const char *format,...)
STATIC double ga08_pH2_H_stitch_100(double Temp)
STATIC double ga08_pH2_e_a10_b1000(double Temp)
realnum deriv_HeatH2Dexc_used
sys_float SDIV(sys_float x)
STATIC double ga08_pH2_p_a10_b1e4(double Temp)
static const double bII[9][2]
STATIC void fndstr(double tot, double dc)
void brems_sum_ions(t_brems_den &sum) const
double interpolate_LTE_Cooling(double Temp)
STATIC double ga08_pH2_pH2_a100_b6000(double Temp)
void vexpm1(const double x[], double y[], long nlo, long nhi)
vector< diatomics * >::iterator diatom_iter
STATIC double ga08_pH2_oH2_a100_b6000(double Temp)
void dBaseUpdateCollCoeffs(void)
STATIC double ga08_pH2_He_b6000(double Temp)
double ** RR_rate_coef_used
STATIC double ga08_pH2_H(double Temp)
STATIC double CoolH2_GA08(double Temp)