80 if(
b1.wavelength >
a1.wavelength )
82 else if(
b1.wavelength <
a1.wavelength )
128 high_index = low_index;
151 for(
long k = low_index; k <= high_index; k++ )
187static void runNLTE(
int ipPun)
190 int nouter[11] = {0,2,3,3,3,4,3,5,5,6,0};
193 fprintf(
save.
ipPnunit[ipPun],
"data Ferland University of Kentucky Cloudy 10 11-5-2011\n");
197 fprintf(
save.
ipPnunit[ipPun],
"calctime %11.4e %11.4e\n",4.5,30.);
205 for(
int ion = 1; ion < nelem-1; ion++)
210 for(
int ion = 1; ion < nelem-1; ion++)
219 long count_nrglvls = 0;
220 for(
int ion = 1; ion < nelem-1; ion++)
245 printf(
"\nNot using :\t%li\t%i\n",nelem+1,ion+1);
252 fprintf(
save.
ipPnunit[ipPun],
"\nsummary_quantities\n");
265 fprintf(
save.
ipPnunit[ipPun],
"\nion_stages %li\n",nelem-2);
270 double autoion[nelem+1];
272 for(
int ion = 1; ion < nelem-1; ion++)
274 double tempRecomb = 0.;
276 double f_aphoto = 0.;
279 double f_Sphoto = 0.;
314 " %11.3e %11.3e %11.3e %11.3e\n"
315 " %11.3e %11.3e %11.3e %11.3e\n\n",
330 fprintf(
save.
ipPnunit[ipPun],
"\nenergy_levels %li\n",count_nrglvls);
332 double GcollBF = 0.0;
334 double GphotoBF = 0.0;
336 double GautoBF = 0.0;
340 double QcollBF = 0.0;
342 double QphotoBF = 0.0;
344 double QautoBF = 0.0;
348 double totallevelpop = 0.;
350 for(
int ion = 1; ion < nelem-1; ion++)
371 for(
int ion = 1; ion < nelem-1; ion++)
385 for(
int i = 0; i < ion; i++ )
398 if( lvl == 0 && ion != nelem+1)
402 GautoBF = autoion[ion];
413 GcollBF + GphotoBF + GautoBF;
423 f_GcollBB =
dBaseStates[ipSpec][lvl].DestCollBB()/Gtotal;
424 f_GphotoBB =
dBaseStates[ipSpec][lvl].DestPhotoBB()/Gtotal;
425 f_GcollBF = GcollBF/Gtotal;
426 f_GphotoBF = GphotoBF/Gtotal;
427 f_GautoBF = GautoBF/Gtotal;
438 if( lvl == 0 && ion != 0 )
453 0.0 + QcollBF + QphotoBF + QautoBF;
463 f_QcollBB =
dBaseStates[ipSpec][lvl].CreatCollBB()/Qtotal;
464 f_QphotoBB = 0.0/Qtotal;
465 f_QcollBF = QcollBF/Qtotal;
466 f_QphotoBF = QphotoBF/Qtotal;
467 f_QautoBF = QautoBF/Qtotal;
479 fprintf(
save.
ipPnunit[ipPun],
"elev %li %3i %11.4e %11.6e %11.4e\n"
480 " %11.3e %11.3e %11.3e %11.3e %11.3e %11.3e\n"
481 " %11.3e %11.3e %11.3e %11.3e %11.3e %11.3e\n"
506 printf(
"\nNot using :\t%li\t%i for levels\n",nelem+1,ion+1);
523 return realnum(
max(0., 1. - (1.-transmission)*corr ));
535 const char *chFunction);
567 if( ipFeII_Cont_type == 3 )
570 return(
FeII_Cont[ipCont][ipFeII_Cont_type]);
653 if( strcmp(chTime,
"LAST") == 0 )
659 for( ipPun=0; ipPun <
save.
nsave; ipPun++ )
671 bool lgNoHitFirstBranch =
false;
684 (
lgAbort && strcmp(chTime,
"LAST") == 0 ) ||
691 if( strcmp(chTime,
"LAST") != 0 )
706 else if( strcmp(
save.
chSave[ipPun],
"21CM") == 0 )
709 if( strcmp(chTime,
"LAST") != 0 )
712 "%.5e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\n",
742 else if( strcmp(
save.
chSave[ipPun],
"AGES") == 0 )
745 if( strcmp(chTime,
"LAST") != 0 )
750 fprintf(
save.
ipPnunit[ipPun],
"%.5e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\n",
766 else if( strcmp(
save.
chSave[ipPun],
" AGN") == 0 )
768 if( strcmp(chTime,
"LAST") == 0 )
782 fprintf(
ioQQQ,
" SaveDo does not recognize flag %4.4s set for AGN save. This is impossible.\n",
790 else if( strcmp(
save.
chSave[ipPun],
"MONI") == 0 )
792 if( strcmp(chTime,
"LAST") == 0 )
799 else if( strcmp(
save.
chSave[ipPun],
"AVER") == 0 )
801 if( strcmp(chTime,
"LAST") == 0 )
808 else if( strncmp(
save.
chSave[ipPun],
"CHA",3) == 0 )
810 if( strcmp(chTime,
"LAST") == 0 )
817 else if( strcmp(
save.
chSave[ipPun],
"CHIA") == 0)
819 static bool lgRunOnce =
true;
826 double fupsilon = 0.;
827 double initTemp = 4.0;
828 double finalTemp = 9.1;
829 double stepTemp = 0.2;
830 fprintf(
save.
ipPnunit[ipPun],
"Species\tLo\tHi\tWLAng");
831 for(
double logtemp = initTemp;logtemp < finalTemp;logtemp = logtemp + stepTemp )
836 for (
int ipSpecies=0; ipSpecies <
nSpecies; ++ipSpecies)
839 tr !=
dBaseTrans[ipSpecies].Emis().end(); ++tr)
841 if(
dBaseTrans[ipSpecies].chLabel() ==
"Chianti" )
843 ipLo = tr->Tran().ipLo();
844 ipHi = tr->Tran().ipHi();
847 fprintf(
save.
ipPnunit[ipPun],
"%5.3e",tr->Tran().WLAng());
848 for(
double logtemp = initTemp;logtemp < finalTemp;logtemp = logtemp + stepTemp )
860 else if( strcmp(
save.
chSave[ipPun],
"COOL") == 0 ||
864 if( strcmp(chTime,
"LAST") != 0 )
868 else if( strcmp(
save.
chSave[ipPun],
"DOMI") == 0 )
871 if( strcmp(chTime,
"LAST") != 0 )
876 fprintf(
ioQQQ,
"Error in SAVE DOMINANT RATES, species %s not found\n",
888 else if( strncmp(
save.
chSave[ipPun],
"DYN" , 3) == 0 )
891 if( strcmp(chTime,
"LAST") != 0 )
895 else if( strcmp(
save.
chSave[ipPun],
"ENTH") == 0 )
897 if( strcmp(chTime,
"LAST") != 0 )
899 "%.5e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\n",
910 else if( strcmp(
save.
chSave[ipPun],
"COLU") == 0 )
913 if( strcmp(chTime,
"LAST") == 0 )
919 else if( strcmp(
save.
chSave[ipPun],
"COLS") == 0 )
922 if( strcmp(chTime,
"LAST") == 0 )
929 else if( strcmp(
save.
chSave[ipPun],
"COMP") == 0 )
932 if( strcmp(chTime,
"LAST") != 0 )
944 else if( strcmp(
save.
chSave[ipPun],
"CON ") == 0 )
950 bool lgPrintThis =
false;
954 if( strcmp(chTime,
"LAST") != 0 )
978 if( strcmp(chTime,
"LAST") == 0 )
990 ASSERT( nEmType==0 || nEmType==1 );
1029 flxtrn = conem + flxatt;
1044 fprintf(
save.
ipPnunit[ipPun],
"%.3e\t", flxref + flxtrn );
1067 else if( strcmp(
save.
chSave[ipPun],
"CONN") == 0 )
1069 if( strcmp(chTime,
"LAST") == 0 )
1073 else if( strcmp(
save.
chSave[ipPun],
"CONC") == 0 )
1078 if( strcmp(chTime,
"LAST") == 0 )
1092 else if( strcmp(
save.
chSave[ipPun],
"CONG") == 0 )
1095 if( strcmp(chTime,
"LAST") == 0 )
1109 fprintf(
save.
ipPnunit[ipPun],
"%.5e\t%.3e\t%.3e\t%.3e\n",
1119 else if( strcmp(
save.
chSave[ipPun],
"CONR") == 0 )
1124 if( strcmp(chTime,
"LAST") == 0 )
1128 fprintf(
save.
ipPnunit[ipPun],
" Reflected continuum not predicted when SPHERE is set.\n" );
1130 "\n\n>>>>>>>>>>>>>\n Reflected continuum not predicted when SPHERE is set.\n" );
1155 fprintf(
save.
ipPnunit[ipPun],
"%.5e\t%.4e\t%.4e\t%.4e\t%.4e\t%.4s\n",
1162 else if( strcmp(
save.
chSave[ipPun],
"CNVE") == 0 )
1165 if( strcmp(chTime,
"LAST") != 0 )
1168 "%.5e\t%li\t%.4e\t%.4f\t%.4e\t%.4e\t%.3f\t%.4e\t%.4e\t%.4f\n",
1182 else if( strcmp(
save.
chSave[ipPun],
"CONB") == 0 )
1187 if( strcmp(chTime,
"LAST") != 0 )
1191 fprintf(
save.
ipPnunit[ipPun],
"%14.5e %14.5e %14.5e\n",
1197 else if( strcmp(
save.
chSave[ipPun],
"COND") == 0 )
1203 if( strcmp(chTime,
"LAST") == 0 &&
1214 double EmisLin = resolution*
EN1RYD*
1218 fprintf(
save.
ipPnunit[ipPun],
"%.5e\t%.5e\t%.5e\t%.5e\n",
1225 else if( strcmp(chTime,
"LAST") != 0 &&
1245 double EmisLin = resolution*
EN1RYD*
1256 double EmisLin = resolution*
EN1RYD*
1267 else if( strcmp(
save.
chSave[ipPun],
"CONE") == 0 )
1272 if( strcmp(chTime,
"LAST") == 0 )
1294 fprintf(
save.
ipPnunit[ipPun],
"%.5e\t%.3e\t%.3e\t%.3e\t%4.4s\t%4.4s\n",
1307 else if( strcmp(
save.
chSave[ipPun],
"CONf") == 0 )
1309 if( strcmp(chTime,
"LAST") == 0 )
1332 for( jj=1; jj<nskip; ++jj )
1342 }
while( j < nu_hi );
1346 else if( strcmp(
save.
chSave[ipPun],
"CONi") == 0 )
1353 if( strcmp(chTime,
"LAST") != 0 )
1383 fprintf(
save.
ipPnunit[ipPun],
"%10.2e%10.2e%10.2e%10.2e%10.2e\n",
1384 fref, fout, fsum, sum, flxin );
1388 else if( strcmp(
save.
chSave[ipPun],
"CONI") == 0 )
1451 "%li\t%.5e\t%.2e\t%.2e\t%.2f\t%.2f\t%.2f\t%.2f\t%.2f\t%.2e\t%.2e\t%.4s\t%.4s\n",
1471 " punchdo, the PUNCH IONIZING CONTINUUM command "
1472 "did not find a strong point, sum and fsum were %.2e %.2e\n",
1475 " punchdo, the low-frequency energy was %.5e Ryd\n",
1478 " You can reset the threshold for the lowest fractional "
1479 "interaction to print with the second number of the save command\n"
1480 " The fraction was %.3f and this was too large.\n",
1486 else if( strcmp(
save.
chSave[ipPun],
"CONl") == 0 )
1488 if( strcmp(chTime,
"LAST") != 0 )
1491 ASSERT( nEmType==0 || nEmType==1 );
1516 flxtrn = conem + flxatt;
1519 double lowlim, highlim, NRGeV;
1524 if( NRGeV >= lowlim && NRGeV <= highlim )
1529 fprintf(
save.
ipPnunit[ipPun],
"%14.8e %14.8e %14.8e ",0.,0.,0.);
1531 fprintf(
save.
ipPnunit[ipPun],
"%14.8e\n", (flxref + flxtrn)/NRGeV );
1540 else if( strcmp(
save.
chSave[ipPun],
"CONS") == 0 )
1542 if( strcmp(chTime,
"LAST") != 0 )
1551 "%.14e\t%.14e\t%.5e\t%.5e\t%.5e\n",
1560 else if( strcmp(
save.
chSave[ipPun],
"CORA") == 0 )
1566 if( strcmp(chTime,
"LAST") == 0 )
1572 "%.5e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%4.4s\t%4.4s\t",
1591 else if( strcmp(
save.
chSave[ipPun],
"CONo") == 0 )
1597 if( strcmp(chTime,
"LAST") == 0 )
1612 else if( strcmp(
save.
chSave[ipPun],
"CONO") == 0 )
1618 if( strcmp(chTime,
"LAST") == 0 )
1627 fprintf(
save.
ipPnunit[ipPun],
"%11.5e%10.2e%10.2e%10.2e%10.2e\n",
1639 else if( strcmp(
save.
chSave[ipPun],
"CONT") == 0 )
1646 if( strcmp(chTime,
"LAST") == 0 )
1649 fprintf(
save.
ipPnunit[ipPun],
"%32ld # file format version number\n",
1659 fprintf(
save.
ipPnunit[ipPun],
"%23.8x %8.8x # check 2\n",
1662 fprintf(
save.
ipPnunit[ipPun],
"%23.8x %8.8x # check 2\n",
1666 fprintf(
save.
ipPnunit[ipPun],
"%23.8x %8.8x # check 3\n",
1669 fprintf(
save.
ipPnunit[ipPun],
"%23.8x %8.8x # check 3\n",
1673 fprintf(
save.
ipPnunit[ipPun],
"%23.8x %8.8x # check 4\n",
1676 fprintf(
save.
ipPnunit[ipPun],
"%23.8x %8.8x # check 4\n",
1712 flxtrn = conem + flxatt;
1719 trans_coef_total[j] );
1724 else if( strcmp(
save.
chSave[ipPun],
"CON2") == 0 )
1727 if( strcmp(chTime,
"LAST") == 0 )
1740 else if( strcmp(
save.
chSave[ipPun],
"DUSE") == 0 )
1743 if( strcmp(chTime,
"LAST") != 0 )
1756 else if( strcmp(
save.
chSave[ipPun],
"DUSO") == 0 )
1759 if( strcmp(chTime,
"LAST") == 0 )
1765 "%.5e\t%.2e\t%.2e\t%.2e\t",
1777 for(
size_t nd=0; nd <
gv.
bin.size(); nd++ )
1779 scat +=
gv.
bin[nd]->pure_sc1[j]*
gv.
bin[nd]->dstAbund;
1791 else if( strcmp(
save.
chSave[ipPun],
"DUSA") == 0 ||
1794 bool lgDGRatio = ( strcmp(
save.
chSave[ipPun],
"DUSD") == 0 );
1797 if( strcmp(chTime,
"LAST") != 0 )
1800 static bool lgMustPrtHeaderDRRatio =
true,
1801 lgMustPrtHeaderAbundance=
true;
1803 if( ( lgMustPrtHeaderDRRatio && lgDGRatio ) ||
1804 ( lgMustPrtHeaderAbundance && !lgDGRatio ) )
1808 if( lgMustPrtHeaderDRRatio && lgDGRatio )
1809 lgMustPrtHeaderDRRatio =
false;
1810 else if( lgMustPrtHeaderAbundance &&!lgDGRatio )
1811 lgMustPrtHeaderAbundance =
false;
1814 for(
size_t nd=0; nd <
gv.
bin.size(); ++nd )
1820 for(
size_t nd=0; nd <
gv.
bin.size(); ++nd )
1828 for(
size_t nd=0; nd <
gv.
bin.size(); ++nd )
1831 gv.
bin[nd]->cnv_H_pCM3;
1841 else if( strcmp(
save.
chSave[ipPun],
"DUSP") == 0 )
1844 if( strcmp(chTime,
"LAST") != 0 )
1847 static bool lgMustPrtHeader =
true;
1849 if( lgMustPrtHeader )
1853 for(
size_t nd=0; nd <
gv.
bin.size(); ++nd )
1859 for(
size_t nd=0; nd <
gv.
bin.size(); ++nd )
1864 lgMustPrtHeader =
false;
1869 for(
size_t nd=0; nd <
gv.
bin.size(); ++nd )
1875 else if( strcmp(
save.
chSave[ipPun],
"DUSR") == 0 )
1878 if( strcmp(chTime,
"LAST") != 0 )
1881 static bool lgMustPrtHeader =
true;
1883 if( lgMustPrtHeader )
1887 for(
size_t nd=0; nd <
gv.
bin.size(); ++nd )
1893 for(
size_t nd=0; nd <
gv.
bin.size(); ++nd )
1898 lgMustPrtHeader =
false;
1903 for(
size_t nd=0; nd <
gv.
bin.size(); ++nd )
1904 fprintf(
save.
ipPnunit[ipPun],
"\t%.3e",
gv.
bin[nd]->rate_h2_form_grains_used );
1909 else if( strcmp(
save.
chSave[ipPun],
"DUST") == 0 )
1912 if( strcmp(chTime,
"LAST") != 0 )
1915 static bool lgMustPrtHeader =
true;
1917 if( lgMustPrtHeader )
1921 for(
size_t nd=0; nd <
gv.
bin.size(); ++nd )
1927 for(
size_t nd=0; nd <
gv.
bin.size(); ++nd )
1932 lgMustPrtHeader =
false;
1936 for(
size_t nd=0; nd <
gv.
bin.size(); ++nd )
1942 else if( strcmp(
save.
chSave[ipPun],
"DUSC") == 0 )
1946 if( strcmp(chTime,
"LAST") != 0 )
1949 static bool lgMustPrtHeader =
true;
1951 if( lgMustPrtHeader )
1955 for(
size_t nd=0; nd <
gv.
bin.size(); ++nd )
1960 fprintf(
save.
ipPnunit[ipPun],
"#grn rad (mic)\tne\t" );
1961 for(
size_t nd=0; nd <
gv.
bin.size(); ++nd )
1966 lgMustPrtHeader =
false;
1976 for(
size_t nd=0; nd <
gv.
bin.size(); ++nd )
1984 else if( strcmp(
save.
chSave[ipPun],
"DUSH") == 0 )
1987 if( strcmp(chTime,
"LAST") != 0 )
1990 static bool lgMustPrtHeader =
true;
1992 if( lgMustPrtHeader )
1996 for(
size_t nd=0; nd <
gv.
bin.size(); ++nd )
2002 for(
size_t nd=0; nd <
gv.
bin.size(); ++nd )
2007 lgMustPrtHeader =
false;
2012 for(
size_t nd=0; nd <
gv.
bin.size(); ++nd )
2018 else if( strcmp(
save.
chSave[ipPun],
"DUSV") == 0 )
2021 if( strcmp(chTime,
"LAST") != 0 )
2024 static bool lgMustPrtHeader =
true;
2026 if( lgMustPrtHeader )
2030 for(
size_t nd=0; nd <
gv.
bin.size(); ++nd )
2036 for(
size_t nd=0; nd <
gv.
bin.size(); ++nd )
2041 lgMustPrtHeader =
false;
2046 for(
size_t nd=0; nd <
gv.
bin.size(); ++nd )
2053 else if( strcmp(
save.
chSave[ipPun],
"DUSQ") == 0 )
2056 if( strcmp(chTime,
"LAST") == 0 )
2062 for(
size_t nd=0; nd <
gv.
bin.size(); nd++ )
2065 gv.
bin[nd]->dstab1[j]*4./
gv.
bin[nd]->IntArea,
2073 else if( strcmp(
save.
chSave[ipPun],
"ELEM") == 0 )
2075 if( strcmp(chTime,
"LAST") != 0 )
2094 for( j=0; j <= (nelem + 1); ++j)
2125 else if( strcmp(
save.
chSave[ipPun],
"RECA") == 0 )
2133 else if( strcmp(
save.
chSave[ipPun],
"RECE") == 0 )
2142 "%12.4e %12.4e %12.4e %12.4e\n",
2149 else if( strncmp(
save.
chSave[ipPun],
"FEc" , 3 ) == 0 )
2152 if( strcmp(chTime,
"LAST") == 0 )
2158 char chTempHeader[100];
2159 long ipFeII_Cont_type;
2162 strcpy(chTempHeader ,
"#FeII inward: Wl(A)\tInt[erg cm-2 s-1]\n");
2163 ipFeII_Cont_type = 1;
2165 else if( strcmp(
save.
chSave[ipPun],
"FEcO") == 0 )
2167 strcpy(chTempHeader ,
"#FeII outward: Wl(A)\tInt[erg cm-2 s-1]\n");
2168 ipFeII_Cont_type = 2;
2170 else if( strcmp(
save.
chSave[ipPun],
"FEcT") == 0 )
2172 strcpy(chTempHeader ,
"#FeII total: Wl(A)\tInt[erg cm-2 s-1]\n");
2173 ipFeII_Cont_type = 3;
2211 fprintf(
save.
ipPnunit[ipPun],
"FeiI wl, total, inward, outward\n");
2231 else if( strcmp(
save.
chSave[ipPun],
"FENl") == 0 )
2233 if( strcmp(chTime,
"LAST") == 0 )
2240 else if( strcmp(
save.
chSave[ipPun],
"FE2l") == 0 )
2242 if( strcmp(chTime,
"LAST") == 0 )
2249 else if( strcmp(
save.
chSave[ipPun],
"FEli") == 0 )
2251 if( strcmp(chTime,
"LAST") == 0 )
2258 else if( strcmp(
save.
chSave[ipPun],
"FE2o") == 0 )
2260 if( strcmp(chTime,
"LAST") == 0 )
2267 else if( strcmp(
save.
chSave[ipPun],
"FRED") == 0 )
2271 if( strcmp(chTime,
"LAST") != 0 )
2274 fprintf(
save.
ipPnunit[ipPun],
"%.5e\t%.5e\t%.3e\t%.3e\t%.3e"
2275 "\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e"
2276 "\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e"
2277 "\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e"
2278 "\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e"
2312 else if( strcmp(
save.
chSave[ipPun],
"FE2d") == 0 )
2315 if( strcmp(chTime,
"LAST") != 0 )
2319 else if( strcmp(
save.
chSave[ipPun],
"FE2D") == 0 )
2322 if( strcmp(chTime,
"LAST") != 0 )
2326 else if( strcmp(
save.
chSave[ipPun],
"FE2p") == 0 )
2328 bool lgFlag =
false;
2332 if( strcmp(chTime,
"LAST") != 0 )
2337 else if( strcmp(
save.
chSave[ipPun],
"FE2P") == 0 )
2339 bool lgFlag =
false;
2343 if( strcmp(chTime,
"LAST") != 0 )
2352 else if( strcmp(
save.
chSave[ipPun],
"FITS") == 0 )
2354 if( strcmp(chTime,
"LAST") == 0 )
2360 else if( strcmp(
save.
chSave[ipPun],
"GAMt") == 0 )
2362 if( strcmp(chTime,
"LAST") != 0 )
2366 for( nelem=0; nelem <
LIMELM; nelem++ )
2368 for( ion=0; ion <= nelem; ion++ )
2372 fprintf(
save.
ipPnunit[ipPun],
"%3ld%3ld%3ld%10.2e%10.2e%10.2e",
2373 nelem+1, ion+1, ns+1,
2391 else if( strcmp(
save.
chSave[ipPun],
"GAMe") == 0 )
2393 if( strcmp(chTime,
"LAST") != 0 )
2411 else if( strcmp(
save.
chSave[ipPun],
"GAUN") == 0 )
2414 if( strcmp(chTime,
"LAST") != 0 )
2424 lgNoHitFirstBranch =
true;
2430 (
lgAbort && strcmp(chTime,
"LAST") == 0 ) ||
2436 if( strcmp(chTime,
"LAST") != 0 )
2442 "#PROBLEM Pressure not converged iter %li zone %li density-pressure follows:\n",
2449 "#PROBLEM Temperature not converged iter %li zone %li density-pressure follows:\n",
2455 fprintf(
save.
ipPnunit[ipPun] ,
"%2li %4li\t%.5e\t%.5e\t%.5e\n",
2465 else if( strcmp(
save.
chSave[ipPun],
"HISt") == 0 )
2468 if( strcmp(chTime,
"LAST") != 0 )
2474 "#PROBLEM Pressure not converged iter %li zone %li temp heat cool follows:\n",
2481 "#PROBLEM Temperature not converged iter %li zone %li temp heat cool follows:\n",
2487 fprintf(
save.
ipPnunit[ipPun] ,
"%2li %4li\t%.5e\t%.5e\t%.5e\n",
2497 else if( strncmp(
save.
chSave[ipPun],
"H2",2) == 0 )
2503 else if( strcmp(
save.
chSave[ipPun],
"HEAT") == 0 )
2506 if( strcmp(chTime,
"LAST") != 0 )
2510 else if( strncmp(
save.
chSave[ipPun],
"HE",2) == 0 )
2514 if( strcmp(
save.
chSave[ipPun] ,
"HELW") == 0 )
2516 if( strcmp(chTime,
"LAST") == 0 )
2520 "Z\tElem\t2 1P->1 1S\t2 3P1->1 1S\t2 3P2->1 1S"
2521 "\t2 3S->1 1S\t2 3P2->2 3S\t2 3P1->2 3S\t2 3P0->2 3S" );
2559 else if( strcmp(
save.
chSave[ipPun],
"HUMM") == 0 )
2564 " %.5e %10.3e %10.3e %10.3e %10.3e %10.3e %10.3e\n",
2572 else if( strncmp(
save.
chSave[ipPun] ,
"HYD", 3 ) == 0 )
2577 if( strcmp(chTime,
"LAST") != 0 )
2581 " %.5e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\n",
2592 else if( strcmp(
save.
chSave[ipPun],
"HYDi") == 0 )
2594 if( strcmp(chTime,
"LAST") != 0 )
2624 fprintf(
save.
ipPnunit[ipPun],
"hion\t%4ld\t%.2e\t%.2e\t%.2e",
2635 "\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\n",
2640 fref/
MAX2(1e-37,fout),
2641 stage/
MAX2(1e-37,fout),
2652 else if( strcmp(
save.
chSave[ipPun],
"HYDp") == 0 )
2654 if( strcmp(chTime,
"LAST") != 0 )
2673 else if( strcmp(
save.
chSave[ipPun],
"HYDl") == 0 )
2675 if( strcmp(chTime,
"LAST") == 0 )
2682 for( ipLo=0; ipLo<ipHi; ++ipLo )
2686 fprintf(
save.
ipPnunit[ipPun],
"%li\t%li\t%li\t%li\t%.4e\t%.2e\n",
2699 else if( strcmp(
save.
chSave[ipPun],
"HYDL") == 0 )
2701 if( strcmp(chTime,
"LAST") != 0 )
2708 "%.5e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\n",
2724 else if( strcmp(
save.
chSave[ipPun],
"HYDr") == 0 )
2731 double ThinCoolingCaseB;
2734 ThinCoolingCaseB = pow(10.,((-25.859117 +
2757 fprintf(
ioQQQ ,
"save agn now exits since solution is disturbed.\n");
2764 else if( strcmp(
save.
chSave[ipPun],
"IONI") == 0 )
2766 if( strcmp(chTime,
"LAST") == 0 )
2774 else if( strcmp(
save.
chSave[ipPun],
"IONR") == 0 )
2776 if( strcmp(chTime,
"LAST") != 0 )
2787 for( ion=0; ion<nelem+1; ++ion )
2790 "\t%.4e\t%.4e\t%.4e\t%.4e",
2800 else if( strcmp(
save.
chSave[ipPun],
" IP ") == 0 )
2802 if( strcmp(chTime,
"LAST") == 0 )
2805 for( nelem=0; nelem <
LIMELM; nelem++ )
2811 const int NELEM_LINE = 10;
2813 for( ion_big=0; ion_big<=nelem; ion_big += NELEM_LINE )
2815 int ion_limit =
MIN2(ion_big+NELEM_LINE-1,nelem);
2822 for( ion=ion_big; ion <= ion_limit; ++ion )
2838 for( ion=ion_big; ion<=ion_limit; ++ion )
2854 else if( energy < 100. )
2858 else if( energy < 1000. )
2864 fprintf(
save.
ipPnunit[ipPun],
"\t%6ld", (
long)(energy) );
2876 else if( strcmp(
save.
chSave[ipPun],
"LINC") == 0 )
2879 if( strcmp(chTime,
"LAST") != 0 )
2886 else if( strcmp(
save.
chSave[ipPun],
"LIND") == 0 )
2892 else if( strcmp(
save.
chSave[ipPun],
"LINL") == 0 )
2895 bool lgPrintAll=
false;
2902 else if( strcmp(
save.
chSave[ipPun],
"LINO") == 0 )
2904 if( strcmp(chTime,
"LAST") == 0 )
2911 else if( strcmp(
save.
chSave[ipPun],
"LINP") == 0 )
2913 if( strcmp(chTime,
"LAST") != 0 )
2928 else if( strcmp(
save.
chSave[ipPun],
"LINS") == 0 )
2931 if( strcmp(chTime,
"LAST") != 0 )
2938 else if( strcmp(
save.
chSave[ipPun],
"LINR") == 0 )
2941 if( strcmp(chTime,
"LAST") != 0 )
2945 else if( strcmp(
save.
chSave[ipPun],
"LINA") == 0 )
2948 if( strcmp(chTime,
"LAST") == 0 )
2954 LineSv[j].SumLine[0] > 0. )
2978 else if( strcmp(
save.
chSave[ipPun],
"LINI") == 0 )
2980 if( strcmp(chTime,
"LAST") == 0 &&
2987 else if( strcmp(chTime,
"LAST") != 0 )
3000 else if( strcmp(
save.
chSave[ipPun],
"LEIL") == 0)
3004 if( strcmp(chTime,
"LAST") == 0 )
3006 double absval , rel;
3012 const int NLINE_H2 = 31;
3014 const int NLINE_NOTH_H2 = 5;
3016 char chLabel[NLINE_NOTH_H2][5]=
3017 {
"C 2",
"O 1",
"O 1",
"C 1",
"C 1" };
3018 double Wl[NLINE_NOTH_H2]=
3019 {157.6 , 63.17 , 145.5 ,609.2 , 369.7 , };
3023 double Wl_H2[NLINE_H2]=
3025 28.213, 17.03 , 12.28 , 9.662 , 8.024 , 6.907 , 6.107 , 5.510 , 5.051 , 4.693 ,
3026 4.408 , 4.180 , 3.996 , 3.845 , 3.723 , 3.625 , 3.546 , 3.485 , 3.437 , 3.403 ,
3027 3.380 , 3.368 , 3.365 , 3.371 , 3.387 , 3.410 , 3.441 , 3.485 , 3.542 , 3.603};
3029 for( n=0; n<NLINE_NOTH_H2; ++n )
3031 fprintf(
save.
ipPnunit[ipPun],
"%s\t%.2f",chLabel[n] , Wl[n]);
3034 if(
cdLine( chLabel[n] , (
realnum)(Wl[n]*1e4) , &absval , &rel ) <= 0 )
3040 fprintf(
save.
ipPnunit[ipPun],
"\t%.3e\t%.3e\n",pow(10.,rel),absval);
3049 "Here are some of the H2 Intensities, The first one is the\n"
3050 "1-0 S(0) line and the following ones are the 0-0 S(X)\n"
3051 "lines where X goes from 0 to 29\n\n");
3052 for( n=0; n<NLINE_H2; ++n )
3054 fprintf(
save.
ipPnunit[ipPun],
"%s\t%.3f",
"H2 " , Wl_H2[n]);
3056 if(
cdLine(
"H2 " , (
realnum)(Wl_H2[n]*1e4) , &absval , &rel ) <= 0 )
3062 fprintf(
save.
ipPnunit[ipPun],
"\t%.3e\t%.3e\n",pow(10.,rel),absval);
3069 else if( strcmp(
save.
chSave[ipPun],
"LEIS") == 0)
3071 if( strcmp(chTime,
"LAST") != 0 )
3074 double col_ci , col_oi , col_cii, col_heii;
3075 if(
cdColm(
"carb" , 1 , &col_ci ) )
3077 if(
cdColm(
"carb" , 2 , &col_cii ) )
3079 if(
cdColm(
"oxyg" , 1 , &col_oi ) )
3081 if(
cdColm(
"heli" , 2 , &col_heii ) )
3085 "%.5e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t"
3086 "%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t"
3087 "%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t"
3088 "%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t"
3089 "%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\n",
3169 else if( strcmp(
save.
chSave[ipPun],
"NLTE") == 0)
3171 if( strcmp(chTime,
"LAST") == 0 )
3181 else if( strcmp(
save.
chSave[ipPun],
"LY1") == 0)
3183 static bool runonce =
true;
3198 else if( strcmp(
save.
chSave[ipPun],
"LY2") == 0)
3200 static bool runonce =
true;
3220 else if( strcmp(
save.
chSave[ipPun],
"LY3") == 0)
3222 static realnum tt[8]={1e3f,3e3f,5e3f,7e3f,1e4f,12e3f,15e3f,2e4f};
3223 static bool runonce =
true;
3227 for(
int k = 0; k < 8; k++)
3234 for(
long ipLo=0; ipLo < ipHi; ipLo++ )
3236 bool skipLine =
false;
3237 for(
int k = 0; k < 8; k++)
3247 fprintf(
save.
ipPnunit[ipPun],
"CSELECTRON\t%li\t%li",ipLo+1,ipHi+1);
3248 for(
int k = 0; k < 8; k++)
3261 else if( strcmp(
save.
chSave[ipPun],
"LLST") == 0)
3264 if( strcmp(chTime,
"LAST") == 0 )
3283 double relative , absolute, PrtQuantity;
3286 &relative , &absolute , LineType ) ) <=0 )
3290 static bool lgMustPrintFirstTime =
true;
3291 if( lgMustPrintFirstTime )
3294 fprintf(
ioQQQ,
"Did not find an H2 line, the large model is not "
3295 "included, so I will ignore it. Log intensity set to -30.\n" );
3296 fprintf(
ioQQQ,
"I will totally ignore any future missed H2 lines\n");
3297 lgMustPrintFirstTime =
false;
3310 fprintf(
ioQQQ,
"DISASTER - did not find a line in the Line List table\n");
3320 PrtQuantity = pow(10. , absolute);
3322 PrtQuantity = relative;
3342 static double SaveQuantity = 0;
3345 SaveQuantity /
SDIV( PrtQuantity ) );
3347 SaveQuantity = PrtQuantity;
3351 fprintf(
save.
ipPnunit[ipPun],
"\t%.4e" , PrtQuantity );
3365 else if( strcmp(
save.
chSave[ipPun],
"CHRT") == 0)
3368 if( strcmp(chTime,
"LAST") != 0 )
3370 bool lgHeader, lgData;
3384 else if( strcmp(
save.
chSave[ipPun],
"MAP ") == 0 )
3399 else if( strcmp(
save.
chSave[ipPun],
"MOLE") == 0 )
3404 "#molecular species will follow:\n");
3406 "#depth\tAV(point)\tAV(extend)\tCO diss rate\tC recom rate");
3415 if( strcmp(chTime,
"LAST") != 0 )
3442 else if( strcmp(
save.
chSave[ipPun],
"OPAC") == 0 )
3450 else if( strcmp(
save.
chSave[ipPun],
"OPTc") == 0 )
3457 "%13.5e\t%.3e\t%12.4e\t%.3e\n",
3467 else if( strcmp(
save.
chSave[ipPun],
"OPTf") == 0 )
3493 for( jj=1; jj<nskip; ++jj )
3501 "%12.6e\t%.3e\t%.3e\n",
3506 }
while( j < nu_hi );
3510 else if( strcmp(
save.
chSave[ipPun],
" OTS") == 0 )
3535 "tot con lin=%.2e%.2e lin=%.4s%.4e%.2e con=%.4s%.4e%.2e\n",
3541 else if( strcmp(
save.
chSave[ipPun],
"OVER") == 0 )
3550 if( strcmp(chTime,
"LAST") != 0 )
3584 for( j=1; j <= 3; j++ )
3595 hold =
MAX2(toosmall, hold );
3596 fprintf(
save.
ipPnunit[ipPun],
"\t%.4f", log10(hold) );
3599 for( j=1; j <= 4; j++ )
3608 for( j=1; j <= 6; j++ )
3619 hold =
MAX2(toosmall, hold );
3620 fprintf(
save.
ipPnunit[ipPun],
"\t%.4f", log10(hold) );
3630 else if( strcmp(
save.
chSave[ipPun],
" PDR") == 0 )
3633 if( strcmp(chTime,
"LAST") != 0 )
3643 "%.5e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t",
3672 else if( strcmp(
save.
chSave[ipPun],
"PERF") == 0 )
3674 if( strcmp(chTime,
"LAST") != 0 )
3676 static double ElapsedTime , ZoneTime;
3685 ZoneTime = t - ElapsedTime;
3690 fprintf(
save.
ipPnunit[ipPun],
" %ld\t%.3f\t%.2f\t%li",
3693 for(
long i=0; i<
NTYPES; ++i )
3699 else if( strcmp(
save.
chSave[ipPun],
"PHYS") == 0 )
3701 if( strcmp(chTime,
"LAST") != 0 )
3704 fprintf(
save.
ipPnunit[ipPun],
"%.5e\t%.4e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\n",
3710 else if( strcmp(
save.
chSave[ipPun],
"PRES") == 0 )
3713 if( strcmp(chTime,
"LAST") != 0 )
3716 "%.5e\t%.5e\t%.5e\t%.5e\t%.5e\t%.5e\t%.5e\t%.5e\t%.5e\t%.5e\t%.5e\t%.5e\t%.5e\t%.5e\t%.5e\t%.5e\t%c\n",
3758 else if( strcmp(
save.
chSave[ipPun],
"PREL") == 0 )
3762 "%.5e\t%.3e\t%.3e\t",
3777 if( strcmp(chTime,
"LAST") != 0 )
3779 fprintf(
save.
ipPnunit[ipPun],
"%ld\t%.5e\t%.4e\t%.4e\n",
3785 else if( strcmp(
save.
chSave[ipPun],
"RADO") == 0 )
3788 if( strcmp(chTime,
"LAST") == 0 )
3790 fprintf(
save.
ipPnunit[ipPun],
"%ld\t%.5e\t%.4e\t%.4e\n",
3796 else if( strcmp(
save.
chSave[ipPun],
"RESU") == 0 )
3799 if( strcmp(chTime,
"LAST") == 0 )
3809 else if( strcmp(
save.
chSave[ipPun],
"SECO") == 0 )
3812 if( strcmp(chTime,
"LAST") != 0 )
3814 "%.5e\t%.3e\t%.3e\t%.3e\n",
3821 else if( strcmp(
save.
chSave[ipPun],
"SOUS") == 0 )
3825 if( strcmp(chTime,
"LAST") != 0 )
3828 for( j=0; j < limit; j++ )
3831 "%.5e\t%.4e\t%.4e\t%.4e\t%.4e\t%.4e\n",
3842 else if( strcmp(
save.
chSave[ipPun],
"SOUD") == 0 )
3848 "%.4e\t%.4e\t%.4e\t%.4e\n",
3856 else if( strcmp(
save.
chSave[ipPun],
"SPEC") == 0 )
3862 else if( strcmp(
save.
chSave[ipPun],
"SPCS") == 0 )
3864 if( ( strcmp(chTime,
"LAST") != 0 && strcmp(
save.
chSaveArgs[ipPun],
"COLU") != 0 ) ||
3865 ( strcmp(chTime,
"LAST") == 0 && strcmp(
save.
chSaveArgs[ipPun],
"COLU") == 0 ) )
3869 else if( strcmp(
save.
chSave[ipPun],
"TEMP") == 0 )
3871 static double deriv_old=-1;
3872 double deriv=-1. , deriv_sec;
3896 else if( strcmp(
save.
chSave[ipPun],
"TIMD") == 0 )
3898 if( strcmp(chTime,
"LAST") == 0 )
3903 else if( strcmp(
save.
chSave[ipPun],
"XTIM") == 0 )
3905 static double ElapsedTime , ZoneTime;
3914 ZoneTime = t - ElapsedTime;
3920 nzone, ZoneTime , ElapsedTime );
3923 else if( strcmp(
save.
chSave[ipPun],
"TPRE") == 0 )
3926 fprintf(
save.
ipPnunit[ipPun],
"%5ld %11.4e %11.4e %11.4e %g\n",
3931 else if( strcmp(
save.
chSave[ipPun],
"WIND") == 0 )
3936 if( (
save.
punarg[ipPun][0] == 0 && strcmp(chTime,
"LAST") == 0)
3939 (
save.
punarg[ipPun][0] == 1 && strcmp(chTime,
"LAST") != 0 ) )
3942 "%.5e\t%.5e\t%.4e\t%.4e\t%.4e\t%.4e\t%.4e\t%.4e\n",
3954 else if( strcmp(
save.
chSave[ipPun],
"XATT") == 0 )
3959 if( strcmp(chTime,
"LAST") == 0 )
3965 fprintf(
ioQQQ,
" Cannot save xspec files unless doing a grid.\n" );
3970 else if( strcmp(
save.
chSave[ipPun],
"XRFI") == 0 )
3975 if( strcmp(chTime,
"LAST") == 0 )
3981 fprintf(
ioQQQ,
" Cannot save xspec files unless doing a grid.\n" );
3986 else if( strcmp(
save.
chSave[ipPun],
"XINC") == 0 )
3991 if( strcmp(chTime,
"LAST") == 0 )
3997 fprintf(
ioQQQ,
" Cannot save xspec files unless doing a grid.\n" );
4002 else if( strcmp(
save.
chSave[ipPun],
"XDFR") == 0 )
4007 if( strcmp(chTime,
"LAST") == 0 )
4013 fprintf(
ioQQQ,
" Cannot save xspec files unless doing a grid.\n" );
4018 else if( strcmp(
save.
chSave[ipPun],
"XDFO") == 0 )
4023 if( strcmp(chTime,
"LAST") == 0 )
4029 fprintf(
ioQQQ,
" Cannot save xspec files unless doing a grid.\n" );
4034 else if( strcmp(
save.
chSave[ipPun],
"XLNR") == 0 )
4039 if( strcmp(chTime,
"LAST") == 0 )
4045 fprintf(
ioQQQ,
" Cannot save xspec files unless doing a grid.\n" );
4050 else if( strcmp(
save.
chSave[ipPun],
"XLNO") == 0 )
4055 if( strcmp(chTime,
"LAST") == 0 )
4061 fprintf(
ioQQQ,
" Cannot save xspec files unless doing a grid.\n" );
4066 else if( strcmp(
save.
chSave[ipPun],
"XREF") == 0 )
4071 if( strcmp(chTime,
"LAST") == 0 )
4077 fprintf(
ioQQQ,
" Cannot save xspec files unless doing a grid.\n" );
4082 else if( strcmp(
save.
chSave[ipPun],
"XTOT") == 0 )
4087 if( strcmp(chTime,
"LAST") == 0 )
4093 fprintf(
ioQQQ,
" Cannot save xspec files unless doing a grid.\n" );
4098 else if( strcmp(
save.
chSave[ipPun],
"XTRN") == 0 )
4103 if( strcmp(chTime,
"LAST") == 0 )
4109 fprintf(
ioQQQ,
" Cannot save xspec files unless doing a grid.\n" );
4114 else if( strcmp(
save.
chSave[ipPun],
"XSPM") == 0 )
4119 if( strcmp(chTime,
"LAST") == 0 )
4125 fprintf(
ioQQQ,
" Cannot save xspec files unless doing a grid.\n" );
4138 fprintf(
ioQQQ,
" PROBLEM DISASTER SaveDo does not recognize flag %4.4s set by ParseSave. This is impossible.\n",
4151 if( strcmp(chTime,
"LAST") == 0 &&
4167 fprintf(
save.
ipPnunit[ipPun],
" GRID_DELIMIT -- grid%09ld",
4189 fprintf( ioPUN,
"**********************************************************************************************************************************\n" );
4195 fprintf( ioPUN,
"zone=%5ld\n",
nzone );
4196 fprintf( ioPUN,
"**********************************************************************************************************************************\n" );
4197 fprintf( ioPUN,
"begin emission lines\n" );
4203 bool lgEmergent =
false;
4211 if(
LineSv[i].SumLine[lgEmergent] > Threshold )
4220 fprintf( ioPUN,
" \n" );
4221 fprintf( ioPUN,
"**********************************************************************************************************************************\n" );
4236 long int nelem , ipLo , ipHi , i , ipISO;
4243 if( strcmp( &*chJob ,
"optical" ) == 0 )
4249 else if( strcmp( &*chJob ,
"populat" ) == 0 )
4256 fprintf(ioPUN,
"index\tAn.ion\tgLo\tgUp\tE(wn)\tgf\n");
4266 fprintf(
ioQQQ,
" insane job in SaveLineStuff =%s\n",
4276 for( nelem=ipISO; nelem <
LIMELM; nelem++ )
4283 for( ipLo=0; ipLo <ipHi; ipLo++ )
4328 for( i=0; i <
nUTA; i++ )
4356 fprintf( ioPUN ,
"%2.2s%2.2s\t",
4372 fprintf( ioPUN ,
"\t%.3f", t.
Emis().
TauIn() );
4374 fprintf(ioPUN,
"\t%.3e",
4376 fprintf(ioPUN,
"\n");
4384 fprintf(ioPUN,
"%li\t%s" , index , chLbl );
4386 fprintf(ioPUN,
"\t%.0f\t%.0f",
4387 (*t.
Lo()).g() ,(*t.
Hi()).g());
4389 fprintf(ioPUN,
"\t%.2f\t%.3e",
4391 fprintf(ioPUN,
"\n");
4396 if( (*t.
Hi()).Pop() > xLimit )
4403 fprintf(ioPUN,
"%li\t%.2e\t%.2e\n", index, (*t.
Lo()).Pop(), (*t.
Hi()).Pop() );
4411 long int ipLo, ipHi,
4432 ncells = ipHi - ipLo + 1;
4435 energy = (
double *)
MALLOC( (
size_t)(ncells+1)*
sizeof(
double) );
4436 cont_incid = (
double *)
MALLOC( (
size_t)(ncells+1)*
sizeof(
double) );
4437 cont_atten = (
double *)
MALLOC( (
size_t)(ncells+1)*
sizeof(
double) );
4438 diffuse_in = (
double *)
MALLOC( (
size_t)(ncells+1)*
sizeof(
double) );
4439 diffuse_out = (
double *)
MALLOC( (
size_t)(ncells+1)*
sizeof(
double) );
4440 emis_lines_out = (
double *)
MALLOC( (
size_t)(ncells+1)*
sizeof(
double) );
4441 emis_lines_in = (
double *)
MALLOC( (
size_t)(ncells+1)*
sizeof(
double) );
4446 for( j=0; j<ncells; ++j )
4459 cdSPEC( 1 , ncells , cont_incid );
4461 cdSPEC( 2 , ncells , cont_atten );
4463 cdSPEC( 5 , ncells , diffuse_in );
4465 cdSPEC( 4 , ncells , diffuse_out );
4468 cdSPEC( 6 , ncells , emis_lines_out );
4470 cdSPEC( 7 , ncells , emis_lines_in );
4486 for( j=0; j<ncells-1; ++j )
4490 fprintf( ioPUN,
"%.3e\t", cont_incid[j] );
4491 fprintf( ioPUN,
"%.3e\t", cont_atten[j] );
4492 fprintf( ioPUN,
"%.3e\t", diffuse_in[j]+diffuse_out[j] );
4493 fprintf( ioPUN,
"%.3e",
4494 emis_lines_out[j]+emis_lines_in[j] );
4495 fprintf( ioPUN,
"\n" );
4503 free(emis_lines_out);
4504 free(emis_lines_in);
4513 realnum te[NTE] = {5000., 10000., 15000., 20000.};
4522 for( i=0;i<NTE; ++i)
4542 fprintf(ioPUN,
"wl");
4543 for( i=0;i<NTE; ++i)
4545 fprintf(ioPUN,
"\tT=%.0f",te[i]);
4547 fprintf( ioPUN ,
"\tcont\n");
4552 fprintf( ioPUN ,
"%12.5e",
4555 for( i=0;i<NTE; ++i)
4564 for( i=0;i<NTE; ++i)
4566 free( agn_continuum[i] );
4573 fprintf(
ioQQQ,
"AGN_Hemis - result of save AGN3 hemis - I have left the code in a disturbed state, and will now exit.\n");
4581 long int i , nelem , ion;
4588 fprintf( ioPUN,
"**********************************************************************************************************************************\n" );
4594 fprintf( ioPUN,
"**********************************************************************************************************************************\n" );
4596 fprintf( ioPUN,
"C*OPTICAL DEPTHS ELECTRON=%10.3e\n",
opac.
telec );
4598 fprintf( ioPUN,
"BEGIN EMISSION LINES\n" );
4603 if(
LineSv[i].SumLine[0] > 0. )
4606 LineSv[i].SumLine[0],
"Line ");
4612 fprintf( ioPUN,
" \n" );
4614 fprintf( ioPUN,
"BEGIN COLUMN DENSITIES\n" );
4622 for( nelem=0; nelem<
LIMELM; nelem++ )
4624 for(ion=0; ion < nelem+1; ion++)
4626 fprintf( ioPUN,
" %10.3e",
mean.
xIonMean[0][nelem][ion][0] );
4628 if( nelem==9|| nelem==19 || nelem==29 )
4630 fprintf( ioPUN,
"\n" );
4635 fprintf( ioPUN,
"END OF RESULTS\n" );
4636 fprintf( ioPUN,
"**********************************************************************************************************************************\n" );
4651 const char *chFunction)
4664 if( strcmp(chFunction,
"Start") == 0 )
4668 else if( strcmp(chFunction,
"Line ") == 0 )
4672 strcpy( chLabSave[
ipLine], chLab );
4673 xIntenSave[
ipLine] = xInten;
4683 for( i=0; i <
ipLine; i++ )
4685 fprintf( ioPUN,
" %4.4s ", chLabSave[i] );
4687 fprintf( ioPUN,
"\t%.3e", xIntenSave[i]);
4691 fprintf( ioPUN,
"\n" );
4695 fprintf( ioPUN,
" \n" );
4699 else if( strcmp(chFunction,
"Flush") == 0 )
4708 for( i=0; i <
ipLine; i++ )
4710 fprintf( ioPUN,
" %4.4s", chLabSave[i] );
4712 fprintf( ioPUN,
"\t%.3e", xIntenSave[i]);
4716 fprintf( ioPUN,
"\n" );
4719 fprintf( ioPUN,
" \n" );
4724 fprintf(
ioQQQ,
" SaveResults1Line called with insane request=%5.5s\n",
4762 ener[i] = 0.5f*i - 8.f;
4765 for( charge = 1; charge<
LIMELM; charge++ )
4768 z = (
realnum)log10((
double)charge);
4786 fprintf( ioPUN,
" " );
4789 fprintf( ioPUN,
"\t%6.1f", ste[i-1] );
4791 fprintf( ioPUN,
"\n" );
4795 fprintf( ioPUN,
"\t%6.2f", ener[j] );
4798 fprintf( ioPUN,
"\t%6.2f", log10(
g[j][ite]) );
4800 fprintf( ioPUN,
"\n" );
4803 fprintf( ioPUN,
" " );
4806 fprintf( ioPUN,
"\t%6.1f", ste[i] );
4808 fprintf( ioPUN,
"\n" );
4811 fprintf( ioPUN,
" " );
4814 fprintf( ioPUN,
"\t%6.1f", ste[i] );
4816 fprintf( ioPUN,
"\n" );
4822 fprintf( ioPUN,
"\t%6.2f\t%6.2f\t%6.2e\n", ste[i], ener[j],
4827 fprintf( ioPUN,
"Below is log(u), log(gamma**2), gff\n" );
4833 fprintf( ioPUN,
"\t%6.2f\t%6.2f\t%6.2e\n", 2.*z + log10(
TE1RYD) - ste[i] , log10(
TE1RYD)+ener[j]-ste[i],
4837 fprintf( ioPUN,
"end of charge = %li\n", charge);
4838 fprintf( ioPUN,
"****************************\n");
4848 if( pnunit == NULL )
4854 fprintf( pnunit,
"#Index\tFailure?\tWarnings?\tExit code\t#rank\t#seq" );
4862 fprintf( pnunit,
"\t%s", chStr );
4864 fprintf( pnunit,
"\tgrid parameter string\n" );
4868 fprintf( pnunit,
"%9.9ld\t%c\t%c\t%20s\t%ld\t%ld",
4877 char chStringHold[100];
4879 strcpy( chGridParam, chStringHold );
4885 strcat( chGridParam, chStringHold );
4889 fprintf( pnunit,
"\t%s\n", chGridParam );
void ChargTranPun(FILE *ipPnunit, char *chSave)
double CHIANTI_Upsilon(long, long, long, long, double)
void FeIIPunPop(FILE *ioPUN, bool lgPunchRange, long int ipRangeLo, long int ipRangeHi, bool lgPunchDensity)
void FeIIPunDepart(FILE *ioPUN, bool lgDoAll)
void FeIIPunchLineStuff(FILE *io, realnum xLimit, long index)
void FeIIPunchColden(FILE *ioPUN)
void FeIIPunchLevels(FILE *ioPUN)
void FeIIPunchOpticalDepth(FILE *ioPUN)
void FeIISaveLines(FILE *ioPUN)
double plankf(long int ip)
sys_float sexp(sys_float x)
long nMatch(const char *chKey, const char *chCard)
const int INPUT_LINE_LENGTH
sys_float safe_div(sys_float x, sys_float y, sys_float res_0by0)
double AnuUnit(realnum energy)
bool fp_equal(sys_float x, sys_float y, int n=3)
NORETURN void TotalInsanity(void)
sys_float SDIV(sys_float x)
#define DEBUG_ENTRY(funcname)
int cdColm(const char *chLabel, long int ion, double *theocl)
void cdCautions(FILE *ioOUT)
void cdWarnings(FILE *ioPNT)
long int cdLine(const char *chLabel, realnum wavelength, double *relint, double *absint)
void cdSPEC2(int Option, long int nEnergy, long int ipLoEnergy, long int ipHiEnergy, realnum ReturnedSpectrum[])
void cdSPEC(int Option, long int nEnergy, double ReturnedSpectrum[])
realnum ColUL(const ColliderList &colls) const
realnum & Pelec_esc() const
realnum & dampXvel() const
vector< realnum > GraphiteEmission
vector< realnum > GrainEmission
double rate_h2_form_grains_used_total
vector< realnum > SilicateEmission
CollisionProxy Coll() const
realnum & EnergyWN() const
qList::iterator Lo() const
qList::iterator Hi() const
EmissionList::reference Emis() const
void H2_PunchDo(FILE *io, char chJOB[], const char chTime[], long int ipPun)
void H2_PunchLineStuff(FILE *io, realnum xLimit, long index)
realnum ph1(int i, int j, int k, int l) const
const string & chExitStatus(exit_type s) const
double *** CollIonRate_Ground
double ** RR_rate_coef_used
double ** UTA_ionize_rate
double **** PhotoRate_Shell
double RateIonizTot(long nelem, long ion)
double ** DR_Badnell_rate_coef
TransitionProxy trans(const long ipHi, const long ipLo)
long int nCollapsed_local
double findrk(const char buf[]) const
valarray< class molezone > species
long nelec_eject(long n, long i, long ns) const
realnum elec_eject_frac(long n, long i, long ns, long ne) const
void GammaPrt(long int ipLoEnr, long int ipHiEnr, long int ipOpac, FILE *ioFILE, double total, double threshold)
double cont_gaunt_calc(double temp, double z, double photon)
long ipFineCont(double energy_ryd)
long ipoint(double energy_ryd)
int ConvPresTempEdenIoniz(void)
void CoolSave(FILE *io, char chJob[])
realnum GetDopplerWidth(realnum massAMU)
void DynaSave(FILE *ipPnunit, char chJob)
void DynaPunchTimeDep(FILE *ipPnunit, const char *chJob)
t_elementnames elementnames
void GridGatherInCloudy(void)
const int NUM_OUTPUT_TYPES
diatomics h2("h2", 4100., &hmi.H2_total, Yan_H2_CS)
void map_do(FILE *io, const char *chType)
void AGN_He1_CS(FILE *ioPun)
double HydroRecCool(long int n, long int ipZ)
void ion_recombAGN(FILE *io)
t_iso_sp iso_sp[NISO][LIMELM]
t_mole_global mole_global
molezone * findspecieslocal(const char buf[])
void mole_punch(FILE *punit, const char speciesname[], const char args[], bool lgHeader, bool lgData, double depth)
molecule * findspecies(const char buf[])
void mole_dominant_rates(const molecule *debug_species, FILE *ioOut)
static realnum * wavelength
bool lgCheckMonitors(FILE *ioMONITOR)
UNUSED const double BOLTZMANN
UNUSED const double EN1RYD
UNUSED const double EVRYD
UNUSED const double TE1RYD
UNUSED const double RYDLAM
void prt_wl(FILE *ioOUT, realnum wl)
void prt_LineLabels(FILE *ioOUT, bool lgPrintAll)
void sprt_wl(char *chString, realnum wl)
void PrtMeanIon(char chType, bool lgDensity, FILE *)
void PrtLinePres(FILE *ioPRESSURE)
void PrtColumns(FILE *ioMEAN, const char *chType, long int ipPun)
static const long MAX_HEADER_SIZE
void save_line(FILE *ip, const char *chDo, bool lgEmergent)
static const long VERSION_TRNCON
void save_colden(FILE *ioPUN)
void SaveSpecial(FILE *io, const char *chTime)
void save_average(long int ipPun)
void SaveSpecies(FILE *ioPUN, long int ipPun)
NORETURN void SaveLineData(FILE *io)
void Save_Line_RT(FILE *ip)
void save_opacity(FILE *io, long int np)
void saveFITSfile(FILE *io, int option)
STATIC void AGN_Hemis(FILE *ioPUN)
int wavelength_compare(const void *a, const void *b)
static bool lgSaveOpticalDepths
void Save1Line(const TransitionProxy &t, FILE *ioPUN, realnum xLimit, long index, realnum DopplerWidth)
static bool lgPopsFirstCall
static const int LINEWIDTH
STATIC void SaveResults1Line(FILE *ioPUN, const char *chLab, realnum wl, double xInten, const char *chFunction)
void SaveGrid(FILE *pnunit, exit_type status)
STATIC realnum SaveFeII_cont(long int ipCont, long ipFeII_Cont_type)
STATIC void SaveLineStuff(FILE *ioPUN, const char *chJob, realnum xLimit)
STATIC void FindStrongestLineLabels(void)
realnum PrettyTransmission(long j, realnum transmission)
static const int NTE_GAUNT
void SaveDo(const char *chTime)
STATIC void SaveLineIntensity(FILE *ioPUN, long int ipPun, realnum Threshold)
STATIC void SaveNewContinuum(FILE *ioPUN)
STATIC void SaveGaunts(FILE *ioPUN)
STATIC void SaveResults(FILE *ioPUN)
static const int NENR_GAUNT
static bool lgMustPrintHeader
t_secondaries secondaries
realnum AccelTotalOutward
long int nFeIILevel_malloc
double FeIIAul[NFE2LEVN][NFE2LEVN]
double FeIINRGs[NFE2LEVN]
double FeIISTWT[NFE2LEVN]
double FeIIColl[NFE2LEVN][NFE2LEVN][8]
long int nsShells[LIMELM][LIMELM]
double Valence_IP_Ryd[LIMELM][LIMELM]
double ResolutionScaleFactor
vector< double > hist_pres_density
vector< double > hist_pres_error
vector< double > hist_pres_current
long getCounterZone(const long type)
vector< double > hist_temp_heat
vector< double > hist_temp_cool
vector< double > hist_temp_temp
double xIonDense[LIMELM][LIMELM+1]
realnum gas_phase[LIMELM]
realnum AtomicWeight[LIMELM]
bool lgTimeDependentStatic
char chIonStage[LIMELM+1][CHARS_ION_STAGE]
char chElementSym[LIMELM][CHARS_ELEMENT_SYM]
bool lgOutputTypeOn[NUM_OUTPUT_TYPES]
realnum ** interpParameters
realnum UV_Cont_rel2_Draine_DB96_depth
double H2_Solomon_dissoc_rate_used_H2g
double H2_photodissoc_used_H2g
realnum UV_Cont_rel2_Habing_TH85_depth
multi_arr< double, 4 > xIonMean
long int ipElement[LIMELM][LIMELM][7][3]
char chVarFmt[LIMPAR][FILENAME_PATH_LENGTH_2]
realnum pinzon_PresIntegElecThin
realnum PresIntegElecThin
double pres_radiation_lines_curr
double extin_mag_V_extended
const realnum * getCoarseTransCoef()
realnum ** flux_total_incident
realnum * trans_coef_total
realnum * DiffuseLineEmission
realnum ** ConSourceFcnLocal
char chHeader[LIMPUN][MAX_HEADER_SIZE]
vector< char * > chLineListLabel[LIMPUN]
const char * chConPunEnr[LIMPUN]
bool lg_separate_iterations[LIMPUN]
long int nSaveEveryZone[LIMPUN]
realnum punarg[LIMPUN][3]
diatomics * whichDiatomToPrint[LIMPUN]
bool lgCumulative[LIMPUN]
bool lgHashEndIter[LIMPUN]
char chHashString[INPUT_LINE_LENGTH]
char chSpeciesDominantRates[LIMPUN][CHARS_SPECIES]
bool lgPunLstIter[LIMPUN]
char chSaveArgs[LIMPUN][5]
bool lgSaveEveryZone[LIMPUN]
bool lgLineListRatio[LIMPUN]
vector< realnum > wlLineList[LIMPUN]
double heating[LIMELM][LIMELM]
double sound_speed_adiabatic
vector< qList > dBaseStates
vector< vector< TransitionList > > ExtraLymanLines
TransitionList UTALines("UTALines", &AnonStates)
TransitionList TauLine2("TauLine2", &AnonStates)
vector< TransitionList > dBaseTrans
TransitionList HFLines("HFLines", &AnonStates)
multi_arr< int, 3 > ipExtraLymanLines
TransitionList TauLines("TauLines", &AnonStates)
void TempChange(double TempNew, bool lgForceUpdate)
double OccupationNumberLine(const TransitionProxy &t)
double TexcLine(const TransitionProxy &t)
char * chLineLbl(const TransitionProxy &t)