89 return max(0., 1. - (1.-transmission)*corr);
94 inline double flxCell(
long j,
long nEmType,
cont_type ct,
bool lgForceConserve =
false,
95 bool lgPrtIsotropicCont =
true,
const realnum *trans_coef_total = NULL)
107 ASSERT( trans_coef_total != NULL );
109 if( lgForceConserve )
110 val *= double(trans_coef_total[j]);
175 const realnum *trans_coef_total = ( nOption == 0 || nOption == 2 || nOption == 8 || nOption == 10 ) ?
195 returnval = flxatt + conem + flxref;
197 else if( nOption == 1 )
202 else if( nOption == 2 )
208 else if( nOption == 3 )
213 else if( nOption == 4 )
219 else if( nOption == 5 )
225 else if( nOption == 6 )
230 else if( nOption == 7 )
235 else if( nOption == 8 )
242 else if( nOption == 9 )
249 else if( nOption == 10 )
254 ASSERT( trans_coef_total != NULL );
255 returnval = double(
opac.
ExpmTau[j]*trans_coef_total[j]);
259 fprintf(
ioQQQ,
" cdSPEC called with impossible nOption (%i)\n", nOption);
267 ReturnedSpectrum[j] =
realnum(returnval);
268 ASSERT( ReturnedSpectrum[j] >= 0.f );
309 high_index = low_index;
332 for(
long k = low_index; k <= high_index; k++ )
373 return log10(
SDIV(value) );
383 static const int LINEWIDTH = 6;
384 class SaveLineResults
387 const LinSv *m_lines[LINEWIDTH];
392 SaveLineResults(FILE *ioPUN,
int typ)
407 for(
long i=0; i <
ipLine; i++ )
410 m_lines[i]->prt(m_ioPUN);
411 fprintf( m_ioPUN,
"\t%.3e", m_lines[i]->SumLine(m_typ) );
424 int getEmType(
int ipPun)
428 ASSERT( nEmType==0 || nEmType==1 );
432 fprintf(
ioQQQ,
" Must type 'set cumulative' before using 'save cumulative' output\n");
497 bool lgLastOnly = (strcmp(chTime,
"LAST") == 0);
509 for( ipPun=0; ipPun <
save.
nsave; ipPun++ )
515 bool lgNoHitFirstBranch =
false;
523 const bool lgActive =
553 else if( strcmp(
save.
chSave[ipPun],
"21CM") == 0 )
559 "%.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",
589 else if( strcmp(
save.
chSave[ipPun],
"AGES") == 0 )
613 else if( strcmp(
save.
chSave[ipPun],
" AGN") == 0 )
629 fprintf(
ioQQQ,
" SaveDo does not recognize flag %4.4s set for AGN save. This is impossible.\n",
637 else if( strcmp(
save.
chSave[ipPun],
"MONI") == 0 )
646 else if( strcmp(
save.
chSave[ipPun],
"AVER") == 0 )
655 else if( strncmp(
save.
chSave[ipPun],
"CHA",3) == 0 )
664 else if( strcmp(
save.
chSave[ipPun],
"CHIA") == 0)
666 static bool lgRunOnce =
true;
673 double fupsilon = 0.;
674 double initTemp = 3.0;
675 double finalTemp = 9.1;
676 double stepTemp = 0.2;
677 for (
int ipSpecies=0; ipSpecies <
nSpecies; ++ipSpecies)
683 tr !=
dBaseTrans[ipSpecies].Emis().end(); ++tr)
685 ipLo = tr->Tran().ipLo();
686 ipHi = tr->Tran().ipHi();
694 for(
double logtemp = initTemp;logtemp < finalTemp;logtemp = logtemp + stepTemp )
700 for( ipHi = 1; ipHi <
dBaseSpecies[ipSpecies].numLevels_max; ++ipHi )
702 for( ipLo =0; ipLo < ipHi; ++ipLo )
706 for(
double logtemp = initTemp;logtemp < finalTemp;logtemp = logtemp + stepTemp )
719 else if( strcmp(
save.
chSave[ipPun],
"COOL") == 0 ||
727 else if( strcmp(
save.
chSave[ipPun],
"DOMI") == 0 )
735 fprintf(
ioQQQ,
"Error in SAVE DOMINANT RATES, species %s not found\n",
742 vector<const molecule*> debug_list;
743 debug_list.push_back(debug_species);
750 else if( strcmp(
save.
chSave[ipPun],
"CHRT") == 0 ||
760 bool lgHeader, lgData;
774 else if( strncmp(
save.
chSave[ipPun],
"DYN" , 3) == 0 )
781 else if( strcmp(
save.
chSave[ipPun],
"ENTH") == 0 )
785 "%.5e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\n",
796 else if( strcmp(
save.
chSave[ipPun],
"COMP") == 0 )
811 else if( strcmp(
save.
chSave[ipPun],
"CON ") == 0 )
817 bool lgPrintThis =
false;
856 int nEmType = getEmType(ipPun);
891 double flxtrn = conem + flxatt;
924 else if( strcmp(
save.
chSave[ipPun],
"CONC") == 0 )
942 else if( strcmp(
save.
chSave[ipPun],
"CONG") == 0 )
962 else if( strcmp(
save.
chSave[ipPun],
"CONR") == 0 )
973 "\n\n>>>>>>>>>>>>>\n Reflected continuum not predicted when SPHERE is set.\n" );
1006 else if( strcmp(
save.
chSave[ipPun],
"CNVE") == 0 )
1012 "%.5e\t%li\t%.4e\t%.4f\t%.4e\t%.4e\t%.3f\t%.4e\t%.4e\t%.4f\n",
1026 else if( strcmp(
save.
chSave[ipPun],
"CONB") == 0 )
1041 else if( strcmp(
save.
chSave[ipPun],
"COND") == 0 )
1058 double EmisLin = resolution*EN1RYD*
1069 else if( ! lgLastOnly &&
1074 if( lgMustPrintHeader )
1076 lgMustPrintHeader =
false;
1089 double EmisLin = resolution*EN1RYD*
1100 double EmisLin = resolution*EN1RYD*
1111 else if( strcmp(
save.
chSave[ipPun],
"CONE") == 0 )
1144 else if( strcmp(
save.
chSave[ipPun],
"CONf") == 0 )
1164 nskip =
MAX2( 1, nskip );
1170 for(
long jj=1; jj<nskip; ++jj )
1180 }
while( j < nu_hi );
1184 else if( strcmp(
save.
chSave[ipPun],
"CONi") == 0 )
1223 fref, fout, fsum, sum, flxin );
1227 else if( strcmp(
save.
chSave[ipPun],
"CONI") == 0 )
1291 "%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",
1311 " SaveDo, the SAVE IONIZING CONTINUUM command "
1312 "did not find a strongly interacting energy, sum and fsum were %.2e %.2e\n",
1315 " SaveDo, the low-frequency energy was %.5e Ryd\n",
1318 " You can reset the threshold for the lowest fractional "
1319 "interaction to print with the second number of the save command\n"
1320 " The fraction was %.3f and this was too large.\n",
1326 else if( strcmp(
save.
chSave[ipPun],
"CONS") == 0 )
1337 "%.14e\t%.14e\t%.5e\t%.5e\t%.5e\n",
1346 else if( strcmp(
save.
chSave[ipPun],
"CORA") == 0 )
1358 "%.5e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%4.4s\t%4.4s\t",
1377 else if( strcmp(
save.
chSave[ipPun],
"CONT") == 0 )
1449 rfield.
anu(j), intentrn, trans_coef_total[j] );
1454 else if( strcmp(
save.
chSave[ipPun],
"CON2") == 0 )
1470 else if( strcmp(
save.
chSave[ipPun],
"DUSE") == 0 )
1486 else if( strcmp(
save.
chSave[ipPun],
"DUSO") == 0 )
1495 "%.5e\t%.2e\t%.2e\t%.2e\t",
1507 for(
size_t nd=0; nd <
gv.
bin.size(); nd++ )
1509 scat +=
gv.
bin[nd]->pure_sc1[j]*
gv.
bin[nd]->dstAbund;
1521 else if( strcmp(
save.
chSave[ipPun],
"DUSA") == 0 ||
1524 bool lgDGRatio = ( strcmp(
save.
chSave[ipPun],
"DUSD") == 0 );
1533 for(
size_t nd=0; nd <
gv.
bin.size(); ++nd )
1542 for(
size_t nd=0; nd <
gv.
bin.size(); ++nd )
1545 gv.
bin[nd]->cnv_H_pCM3;
1555 else if( strcmp(
save.
chSave[ipPun],
"DUSP") == 0 )
1565 for(
size_t nd=0; nd <
gv.
bin.size(); ++nd )
1573 for(
size_t nd=0; nd <
gv.
bin.size(); ++nd )
1579 else if( strcmp(
save.
chSave[ipPun],
"DUSR") == 0 )
1588 for(
size_t nd=0; nd <
gv.
bin.size(); ++nd )
1596 for(
size_t nd=0; nd <
gv.
bin.size(); ++nd )
1602 else if( strcmp(
save.
chSave[ipPun],
"DUST") == 0 )
1612 for(
size_t nd=0; nd <
gv.
bin.size(); ++nd )
1619 for(
size_t nd=0; nd <
gv.
bin.size(); ++nd )
1625 else if( strcmp(
save.
chSave[ipPun],
"DUSC") == 0 )
1636 for(
size_t nd=0; nd <
gv.
bin.size(); ++nd )
1649 for(
size_t nd=0; nd <
gv.
bin.size(); ++nd )
1657 else if( strcmp(
save.
chSave[ipPun],
"DUSH") == 0 )
1667 for(
size_t nd=0; nd <
gv.
bin.size(); ++nd )
1675 for(
size_t nd=0; nd <
gv.
bin.size(); ++nd )
1681 else if( strcmp(
save.
chSave[ipPun],
"DUSV") == 0 )
1691 for(
size_t nd=0; nd <
gv.
bin.size(); ++nd )
1699 for(
size_t nd=0; nd <
gv.
bin.size(); ++nd )
1706 else if( strcmp(
save.
chSave[ipPun],
"DUSQ") == 0 )
1715 for(
size_t nd=0; nd <
gv.
bin.size(); ++nd )
1717 gv.
bin[nd]->chDstLab,
gv.
bin[nd]->chDstLab );
1725 for(
size_t nd=0; nd <
gv.
bin.size(); nd++ )
1728 gv.
bin[nd]->dstab1[j]*4./
gv.
bin[nd]->IntArea,
1736 else if( strcmp(
save.
chSave[ipPun],
"ELEM") == 0 )
1744 long nelem = (
long int)
save.
punarg[ipPun][0];
1759 for( j=0; j <= (nelem + 1); ++j)
1772 for (
size_t ic = 0; ic < chList.size(); ++ic )
1774 vector<genericState> v =
matchGeneric(chList[ic].c_str(),
false);
1776 for (
size_t j=0; j<v.size(); ++j)
1786 else if( strcmp(
save.
chSave[ipPun],
"FRED") == 0 )
1794 "\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e"
1795 "\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e"
1796 "\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e"
1797 "\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\n",
1830 else if( strcmp(
save.
chSave[ipPun],
"FITS") == 0 )
1836 else if( strcmp(
save.
chSave[ipPun],
"GAMt") == 0 )
1842 for(
long nelem=0; nelem <
LIMELM; nelem++ )
1844 for(
long ion=0; ion <= nelem; ion++ )
1849 nelem+1, ion+1, ns+1,
1867 else if( strcmp(
save.
chSave[ipPun],
"GAMe") == 0 )
1887 else if( strcmp(
save.
chSave[ipPun],
"GAUN") == 0 )
1894 else if( strcmp(
save.
chSave[ipPun],
"GRID") == 0 )
1902 lgNoHitFirstBranch =
true;
1919 "#PROBLEM Pressure not converged iter %li zone %li density-pressure follows:\n",
1926 "#PROBLEM Temperature not converged iter %li zone %li density-pressure follows:\n",
1942 else if( strcmp(
save.
chSave[ipPun],
"HISt") == 0 )
1951 "#PROBLEM Pressure not converged iter %li zone %li temp heat cool follows:\n",
1958 "#PROBLEM Temperature not converged iter %li zone %li temp heat cool follows:\n",
1974 else if( strncmp(
save.
chSave[ipPun],
"H2",2) == 0 )
1980 else if( strcmp(
save.
chSave[ipPun],
"HEAT") == 0 )
1987 else if( strncmp(
save.
chSave[ipPun],
"HE",2) == 0 )
1991 if( strcmp(
save.
chSave[ipPun] ,
"HELW") == 0 )
1997 "Z\tElem\t2 1P->1 1S\t2 3P1->1 1S\t2 3P2->1 1S"
1998 "\t2 3S->1 1S\t2 3P2->2 3S\t2 3P1->2 3S\t2 3P0->2 3S" );
2036 else if( strcmp(
save.
chSave[ipPun],
"HUMM") == 0 )
2041 " %.5e %10.3e %10.3e %10.3e %10.3e %10.3e %10.3e\n",
2049 else if( strncmp(
save.
chSave[ipPun] ,
"HYD", 3 ) == 0 )
2058 " %.5e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\n",
2069 else if( strcmp(
save.
chSave[ipPun],
"HYDi") == 0 )
2075 double RateInter = 0.;
2110 "\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\n",
2115 fref/
MAX2(1e-37,fout),
2116 stage/
MAX2(1e-37,fout),
2127 else if( strcmp(
save.
chSave[ipPun],
"HYDp") == 0 )
2148 else if( strcmp(
save.
chSave[ipPun],
"HYDl") == 0 )
2157 for(
long ipLo=0; ipLo<ipHi; ++ipLo )
2174 else if( strcmp(
save.
chSave[ipPun],
"HYDL") == 0 )
2183 "%.5e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\n",
2199 else if( strcmp(
save.
chSave[ipPun],
"HYDr") == 0 )
2206 double ThinCoolingCaseB;
2209 ThinCoolingCaseB =
exp10(((-25.859117 +
2221 (r1+ThinCoolingCaseB)/(BOLTZMANN*
phycon.
te) );
2227 ThinCoolingCaseB/(BOLTZMANN*
phycon.
te));
2232 fprintf(
ioQQQ ,
"save agn now exits since solution is disturbed.\n");
2239 else if( strcmp(
save.
chSave[ipPun],
"IONI") == 0 )
2249 else if( strcmp(
save.
chSave[ipPun],
"IONR") == 0 )
2262 for(
long ion=0; ion<nelem+1; ++ion )
2265 "\t%.4e\t%.4e\t%.4e\t%.4e",
2275 else if( strcmp(
save.
chSave[ipPun],
" IP ") == 0 )
2280 for(
long nelem=0; nelem <
LIMELM; nelem++ )
2286 const int NELEM_LINE = 10;
2288 for( ion_big=0; ion_big<=nelem; ion_big += NELEM_LINE )
2290 int ion_limit =
MIN2(ion_big+NELEM_LINE-1,nelem);
2297 for(
long ion=ion_big; ion <= ion_limit; ++ion )
2304 ASSERT( ion_limit < LIMELM );
2306 for(
long ips=0; ips <
Heavy.
nsShells[nelem][ion_big]; ips++ )
2313 for(
long ion=ion_big; ion<=ion_limit; ++ion )
2329 else if( energy < 100. )
2333 else if( energy < 1000. )
2351 else if( strcmp(
save.
chSave[ipPun],
"LINC") == 0 )
2360 else if( strcmp(
save.
chSave[ipPun],
"LINT") == 0 )
2370 else if( strcmp(
save.
chSave[ipPun],
"LIND") == 0 )
2376 else if( strcmp(
save.
chSave[ipPun],
"LINL") == 0 )
2379 static bool lgRunOnce=
false;
2384 bool lgPrintAll=
false;
2391 else if( strcmp(
save.
chSave[ipPun],
"LINO") == 0 )
2400 else if( strcmp(
save.
chSave[ipPun],
"LINP") == 0 )
2404 static bool lgFirst=
true;
2417 else if( strcmp(
save.
chSave[ipPun],
"LINS") == 0 )
2427 else if( strcmp(
save.
chSave[ipPun],
"LINR") == 0 )
2434 else if( strcmp(
save.
chSave[ipPun],
"LINA") == 0 )
2465 else if( strcmp(
save.
chSave[ipPun],
"LINI") == 0 )
2474 else if( ! lgLastOnly )
2487 else if( strcmp(
save.
chSave[ipPun],
"LEIL") == 0)
2493 double absval , rel;
2499 const int NLINE_H2 = 31;
2501 const int NLINE_NOTH_H2 = 5;
2503 char chLabel[NLINE_NOTH_H2][
NCHLAB]=
2504 {
"C 2",
"O 1",
"O 1",
"C 1",
"C 1" };
2505 double Wl[NLINE_NOTH_H2]=
2506 { 157.636 , 63.1679 , 145.495, 609.590 , 370.269 };
2510 double Wl_H2[NLINE_H2]=
2512 28.213 , 17.03 , 12.2752, 9.66228, 8.02362, 6.90725, 6.10718, 5.50996, 5.05148, 4.69342,
2513 4.40836, 4.17983, 3.99573, 3.84534, 3.72257, 3.62531, 3.54606, 3.48530, 3.43697, 3.40299,
2514 3.37995, 3.36794, 3.36534, 3.37087, 3.38671, 3.40989, 3.44080, 3.48530, 3.54226, 3.60346};
2516 for( n=0; n<NLINE_NOTH_H2; ++n )
2521 if(
cdLine( chLabel[n] , (
realnum)(Wl[n]*1e4) , &rel, &absval ) <= 0 )
2536 "Here are some of the H2 Intensities, The first one is the\n"
2537 "1-0 S(0) line and the following ones are the 0-0 S(X)\n"
2538 "lines where X goes from 0 to 29\n\n");
2539 for( n=0; n<NLINE_H2; ++n )
2543 if(
cdLine(
"H2 " , (
realnum)(Wl_H2[n]*1e4) , &rel, &absval ) <= 0 )
2556 else if( strcmp(
save.
chSave[ipPun],
"LEIS") == 0)
2561 double col_ci , col_oi , col_cii, col_heii;
2562 if(
cdColm(
"carb" , 1 , &col_ci ) )
2564 if(
cdColm(
"carb" , 2 , &col_cii ) )
2566 if(
cdColm(
"oxyg" , 1 , &col_oi ) )
2568 if(
cdColm(
"heli" , 2 , &col_heii ) )
2572 "%.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"
2573 "%.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"
2574 "%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t"
2575 "%.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"
2576 "%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\n",
2656 else if( strcmp(
save.
chSave[ipPun],
"LLST") == 0)
2675 bool lgBadLine =
false;
2679 double relative , absolute, PrtQuantity;
2682 &relative , &absolute , LineType ) ) <=0 )
2686 static bool lgMustPrintFirstTime =
true;
2687 if( lgMustPrintFirstTime )
2690 fprintf(
ioQQQ,
"Did not find an H2 line, the large model is not "
2691 "included, so I will ignore it. Log intensity set to -30.\n" );
2692 fprintf(
ioQQQ,
"I will totally ignore any future missed H2 lines\n");
2693 lgMustPrintFirstTime =
false;
2715 PrtQuantity = absolute;
2717 PrtQuantity = relative;
2737 static double SaveQuantity = 0;
2740 SaveQuantity /
SDIV( PrtQuantity ) );
2742 SaveQuantity = PrtQuantity;
2759 fprintf(
ioQQQ,
"DISASTER - did not find line(s) in the Line List table\n");
2765 else if( strcmp(
save.
chSave[ipPun],
"MAP ") == 0 )
2781 else if( strcmp(
save.
chSave[ipPun],
"MOLE") == 0 )
2786 "#depth\tAV(point)\tAV(extend)\tCO diss rate\tC recom rate");
2826 else if( strcmp(
save.
chSave[ipPun],
"OPAC") == 0 )
2834 else if( strcmp(
save.
chSave[ipPun],
"OPTc") == 0 )
2841 "%13.5e\t%.3e\t%12.4e\t%.3e\n",
2851 else if( strcmp(
save.
chSave[ipPun],
"OPTf") == 0 )
2871 nskip =
MAX2( 1, nskip );
2879 for(
long jj=1; jj<nskip; ++jj )
2888 "%12.6e\t%.3e\t%.3e\n",
2893 }
while( j < nu_hi );
2897 else if( strcmp(
save.
chSave[ipPun],
" OTS") == 0 )
2900 double xLinMax = 0.;
2901 double opConSum = 0.;
2902 double opLinSum = 0.;
2922 "tot con lin=%.2e%.2e lin=%.4s%.4e%.2e con=%.4s%.4e%.2e\n",
2928 else if( strcmp(
save.
chSave[ipPun],
"OVER") == 0 )
2973 for( j=1; j <= 3; j++ )
2984 hold =
MAX2(toosmall, hold );
2988 for( j=1; j <= 4; j++ )
2997 for( j=1; j <= 6; j++ )
3008 hold =
MAX2(toosmall, hold );
3023 else if( strcmp(
save.
chSave[ipPun],
" PDR") == 0 )
3036 "%.5e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t",
3065 else if( strcmp(
save.
chSave[ipPun],
"PERF") == 0 )
3070 "#zone\tdTime\tElapsed t\tnPres2Ioniz" );
3081 static double ElapsedTime , ZoneTime;
3090 ZoneTime = t - ElapsedTime;
3104 else if( strcmp(
save.
chSave[ipPun],
"PHYS") == 0 )
3115 else if( strcmp(
save.
chSave[ipPun],
"PRES") == 0 )
3121 "%.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",
3163 else if( strcmp(
save.
chSave[ipPun],
"PREL") == 0 )
3167 "%.5e\t%.3e\t%.3e\t",
3190 else if( strcmp(
save.
chSave[ipPun],
"RADO") == 0 )
3201 else if( strcmp(
save.
chSave[ipPun],
"RESU") == 0 )
3208 else if( strcmp(
save.
chSave[ipPun],
"RECA") == 0 )
3216 else if( strcmp(
save.
chSave[ipPun],
"RECE") == 0 )
3225 "%12.4e %12.4e %12.4e %12.4e\n",
3239 else if( strcmp(
save.
chSave[ipPun],
"SECO") == 0 )
3244 "%.5e\t%.3e\t%.3e\t%.3e\n",
3251 else if( strcmp(
save.
chSave[ipPun],
"SOUS") == 0 )
3258 for( j=0; j < limit; j++ )
3261 "%.5e\t%.4e\t%.4e\t%.4e\t%.4e\t%.4e\n",
3272 else if( strcmp(
save.
chSave[ipPun],
"SOUD") == 0 )
3278 "%.4e\t%.4e\t%.4e\t%.4e\n",
3286 else if( strcmp(
save.
chSave[ipPun],
"SPEC") == 0 )
3292 else if( strcmp(
save.
chSave[ipPun],
"SPCS") == 0 )
3312 else if( ( ! lgLastOnly && strcmp(
save.
chSaveArgs[ipPun],
"COLU") != 0 ) ||
3317 else if( strcmp(
save.
chSave[ipPun],
"TEMP") == 0 )
3319 static double deriv_old=-1;
3320 double deriv=-1. , deriv_sec;
3344 else if( strcmp(
save.
chSave[ipPun],
"TIMD") == 0 )
3351 else if( strcmp(
save.
chSave[ipPun],
"XTIM") == 0 )
3353 static double ElapsedTime , ZoneTime;
3362 ZoneTime = t - ElapsedTime;
3368 nzone, ZoneTime , ElapsedTime );
3371 else if( strcmp(
save.
chSave[ipPun],
"TPRE") == 0 )
3379 else if( strcmp(
save.
chSave[ipPun],
"WIND") == 0 )
3384 if( (
save.
punarg[ipPun][0] == 0 && lgLastOnly)
3387 (
save.
punarg[ipPun][0] == 1 && ! lgLastOnly ) )
3390 "%.5e\t%.5e\t%.4e\t%.4e\t%.4e\t%.4e\t%.4e\t%.4e\n",
3402 else if( strcmp(
save.
chSave[ipPun],
"XATT") == 0 )
3410 else if( strcmp(
save.
chSave[ipPun],
"XRFI") == 0 )
3418 else if( strcmp(
save.
chSave[ipPun],
"XINC") == 0 )
3426 else if( strcmp(
save.
chSave[ipPun],
"XDFR") == 0 )
3434 else if( strcmp(
save.
chSave[ipPun],
"XDFO") == 0 )
3442 else if( strcmp(
save.
chSave[ipPun],
"XLNR") == 0 )
3450 else if( strcmp(
save.
chSave[ipPun],
"XLNO") == 0 )
3458 else if( strcmp(
save.
chSave[ipPun],
"XREF") == 0 )
3466 else if( strcmp(
save.
chSave[ipPun],
"XTOT") == 0 )
3474 else if( strcmp(
save.
chSave[ipPun],
"XTRN") == 0 )
3482 else if( strcmp(
save.
chSave[ipPun],
"XSPM") == 0 )
3498 fprintf(
ioQQQ,
" PROBLEM DISASTER SaveDo does not recognize flag %4.4s set by ParseSave. This is impossible.\n",
3554 fprintf( ioPUN,
"**********************************************************************************************************************************\n" );
3561 fprintf( ioPUN,
"**********************************************************************************************************************************\n" );
3562 fprintf( ioPUN,
"begin emission lines\n" );
3566 bool lgEmergent =
false;
3571 fixit(
"value of lgEmergent isn't consistent with lgEmergent");
3587 fprintf( ioPUN,
"**********************************************************************************************************************************\n" );
3604 if( strcmp( &*chJob ,
"optical" ) == 0 )
3607 lgSaveOpticalDepths =
true;
3608 lgPopsFirstCall =
false;
3610 else if( strcmp( &*chJob ,
"populat" ) == 0 )
3612 static bool lgFirst=
true;
3613 lgSaveOpticalDepths =
false;
3617 lgPopsFirstCall =
true;
3618 fprintf(ioPUN,
"index\tAn.ion\tgLo\tgUp\tE(wn)\tgf\n");
3623 lgPopsFirstCall =
false;
3639 for(
long nelem=ipISO; nelem <
LIMELM; nelem++ )
3646 for(
long ipLo=0; ipLo <ipHi; ipLo++ )
3658 if( lgSaveOpticalDepths )
3665 for(
long ipHi=
iso_sp[ipISO][nelem].st[
iso_sp[ipISO][nelem].numLevels_local-1].n()+1; ipHi <
iso_ctrl.
nLyman[ipISO]; ipHi++ )
3694 for (
int ipSpecies=0; ipSpecies <
nSpecies; ++ipSpecies)
3698 em !=
dBaseTrans[ipSpecies].Emis().end(); ++em)
3701 Save1Line( (*em).Tran(), ioPUN, xLimit, index, DopplerWidth );
3714 if( lgSaveOpticalDepths )
3741 else if( lgPopsFirstCall )
3746 fprintf(ioPUN,
"\t%.0f\t%.0f",
3747 (*t.
Lo()).g() ,(*t.
Hi()).g());
3749 fprintf(ioPUN,
"\t%.2f\t%.3e",
3756 if( (*t.
Hi()).Pop() > xLimit )
3763 fprintf(ioPUN,
"%li\t%.2e\t%.2e\n", index, (*t.
Lo()).Pop(), (*t.
Hi()).Pop() );
3772 realnum te[NTE] = {5000., 10000., 15000., 20000.};
3781 for( i=0;i<NTE; ++i)
3802 for( i=0;i<NTE; ++i)
3804 fprintf(ioPUN,
"\tT=%.0f",te[i]);
3814 for( i=0;i<NTE; ++i)
3823 for( i=0;i<NTE; ++i)
3825 free( agn_continuum[i] );
3832 fprintf(
ioQQQ,
"AGN_Hemis - result of save AGN3 hemis - I have left the code in a disturbed state, and will now exit.\n");
3840 long int i , nelem , ion;
3847 fprintf( ioPUN,
"**********************************************************************************************************************************\n" );
3853 fprintf( ioPUN,
"**********************************************************************************************************************************\n" );
3857 fprintf( ioPUN,
"BEGIN EMISSION LINES\n" );
3858 SaveLineResults slr(ioPUN,0);
3872 fprintf( ioPUN,
"BEGIN COLUMN DENSITIES\n" );
3880 for( nelem=0; nelem<
LIMELM; nelem++ )
3882 for(ion=0; ion < nelem+1; ion++)
3886 if( nelem==9|| nelem==19 || nelem==29 )
3893 fprintf( ioPUN,
"END OF RESULTS\n" );
3894 fprintf( ioPUN,
"**********************************************************************************************************************************\n" );
3932 static const int NENR_GAUNT = 33;
3933 static const int NTE_GAUNT = 20;
3935 double ener[NENR_GAUNT], ste[NTE_GAUNT], g[NENR_GAUNT][NTE_GAUNT];
3940 for(
int i=0; i < NTE_GAUNT; i++ )
3941 ste[i] = 0.5f*(i+1);
3943 for(
int i=0; i < NENR_GAUNT; i++ )
3944 ener[i] = 0.5f*i - 9.f;
3946 for(
int charge=1; charge <=
LIMELM; charge++ )
3949 for(
int ite=0; ite < NTE_GAUNT; ite++ )
3951 for(
int j=0; j < NENR_GAUNT; j++ )
3958 fprintf( ioPUN,
"\tlg(nu)\\lg(Te)" );
3959 for(
int i=1; i <= NTE_GAUNT; i++ )
3960 fprintf( ioPUN,
"\t%.3e", ste[i-1] );
3963 for(
int j=0; j < NENR_GAUNT; j++ )
3965 fprintf( ioPUN,
"\t%10.3e", ener[j] );
3966 for(
int ite=0; ite < NTE_GAUNT; ite++ )
3967 fprintf( ioPUN,
"\t%.3e", g[j][ite] );
3971 fprintf( ioPUN,
"\tlg(nu)/lg(Te)" );
3972 for(
int i=0; i < NTE_GAUNT; i++ )
3973 fprintf( ioPUN,
"\t%.3e", ste[i] );
3976 fprintf( ioPUN,
"Below is log(gamma^2), log(u), gff\n" );
3979 double z = log10((
double)charge);
3981 for(
int i=0; i < NTE_GAUNT; i++ )
3983 for(
int j=0; j < NENR_GAUNT; j++ )
3985 fprintf( ioPUN,
"\t%10.3e\t%10.3e\t%10.3e\n",
3986 2.*z + log10(TE1RYD) - ste[i],
3987 log10(TE1RYD) + ener[j] - ste[i],
3991 fprintf( ioPUN,
"end of charge = %i\n", charge );
3992 fprintf( ioPUN,
"****************************\n" );
4000 bool lgCreate = ( pnunit == NULL );
4008 pnunit =
open_data( fnam.c_str(),
"w" );
4014 fprintf( pnunit,
"#Index\tFailure?\tWarnings?\tExit code\t#rank\t#seq" );
4019 fprintf( pnunit,
"\t%s", chStr.substr(0,9).c_str() );
4021 fprintf( pnunit,
"\tgrid parameter string\n" );
4025 fprintf( pnunit,
"%9.9ld\t%c\t%c\t%20s\t%ld\t%ld",
4033 ostringstream chGridParam;
4037 chGridParam <<
", ";
4041 fprintf( pnunit,
"\t%s\n", chGridParam.str().c_str() );
STATIC void SaveLineStuff(FILE *ioPUN, const char *chJob, realnum xLimit)
void AGN_He1_CS(FILE *ioPun)
bool lgPunLstIter[LIMPUN]
long getCounterZone(const long type) const
realnum ** ConSourceFcnLocal
double HydroRecCool(long int n, long int ipZ)
t_mole_global mole_global
vector< double > hist_pres_density
double TexcLine(const TransitionProxy &t)
double H2_Solomon_dissoc_rate_used_H2g
realnum punarg[LIMPUN][3]
void prt_wl(FILE *ioOUT, realnum wl)
FILE * open_data(const char *fname, const char *mode, access_scheme scheme)
long int ipElement[LIMELM][LIMELM][7][3]
double PrettyTransmission(long j, double transmission)
void prt_LineLabels(FILE *ioOUT, bool lgPrintAll)
void SaveSpecial(FILE *io, const char *chTime)
string chIonLbl(const TransitionProxy &t)
void CoolSave(FILE *io, const char chJob[])
TransitionList UTALines("UTALines",&AnonStates)
vector< double > hist_pres_error
string chLineLbl(const TransitionProxy &t)
NORETURN void TotalInsanity(void)
double widflx(size_t i) const
realnum * DiffuseLineEmission
realnum ph1(int i, int j, int k, int l) const
vector< string > chContLabel
string mesh_md5sum() const
void save_line(FILE *ip, const char *chDo, bool lgEmergent, long ipPun)
realnum PresIntegElecThin
static const long VERSION_TRNCON
void cdCautions(FILE *ioOUT)
realnum ** flux_total_incident
void DynaSave(FILE *ipPnunit, char chJob)
bool lgTimeDependentStatic
void cdWarnings(FILE *ioPNT)
double CHIANTI_Upsilon(long, long, long, long, double)
STATIC void SaveGaunts(FILE *ioPUN)
TransitionList HFLines("HFLines",&AnonStates)
double findrk(const char buf[]) const
void SaveSpeciesBands(const long ipPun, const string &speciesLabel, const string &fileBands)
char chHashString[INPUT_LINE_LENGTH]
NORETURN void SaveLineData(FILE *io)
vector< genericState > matchGeneric(const char *chLabel, bool lgValidate)
sys_float sexp(sys_float x)
void ion_recombAGN(FILE *io)
void cdSPEC2(int Option, realnum ReturnedSpectrum[])
long ipFineCont(double energy_ryd)
char chVarFmt[LIMPAR][FILENAME_PATH_LENGTH_2]
molezone * findspecieslocal(const char buf[])
void PrtMeanIon(char chType, bool lgDensity, FILE *)
TransitionList TauLine2("TauLine2",&AnonStates)
void PrtLinePres(FILE *ioPRESSURE)
double anu(size_t i) const
void TempChange(double TempNew, bool lgForceUpdate)
void mole_save(FILE *punit, const char speciesname[], const char args[], bool lgHeader, bool lgData, bool lgCoef, double depth)
double pres_radiation_lines_curr
vector< realnum > GraphiteEmission
void SaveDo(const char *chTime)
t_elementnames elementnames
t_iso_sp iso_sp[NISO][LIMELM]
long int nflux_with_check
static bool lgSaveOpticalDepths
bool lgCumulative[LIMPUN]
const realnum * getCoarseTransCoef()
realnum ** interpParameters
double xIonDense[LIMELM][LIMELM+1]
vector< double > hist_temp_cool
string SpeciesBandFile[LIMPUN]
bool fp_equal(sys_float x, sys_float y, int n=3)
void SaveSpeciesOptDep(const long int ipPun, const string &speciesLabel)
void save_opacity(FILE *io, long int np)
bool lg_separate_iterations[LIMPUN]
const char * getCounterName(const long type) const
ColliderList colliders(dense)
long ipoint(double energy_ryd)
long nelec_eject(long n, long i, long ns) const
realnum & EnergyWN() const
void SaveGrid(FILE *pnunit, exit_type status)
long int nsShells[LIMELM][LIMELM]
vector< realnum > GrainEmission
realnum elec_eject_frac(long n, long i, long ns, long ne) const
double energy(const genericState &gs)
char chSaveArgs[LIMPUN][5]
realnum & dampXvel() const
double flxCell(long j, long nEmType, cont_type ct, bool lgForceConserve=false, bool lgPrtIsotropicCont=true, const realnum *trans_coef_total=NULL)
EmissionList::reference Emis() const
multi_arr< int, 3 > ipExtraLymanLines
void Save_Line_RT(FILE *ip)
STATIC void FindStrongestLineLabels(void)
vector< double > hist_pres_current
molecule * findspecies(const char buf[])
void saveFITSfile(FILE *io, int option, realnum Elo=0.f, realnum Ehi=0.f, realnum Enorm=0.f)
vector< double > hist_temp_temp
valarray< class molezone > species
const int NUM_OUTPUT_TYPES
realnum AccelTotalOutward
long int nSaveEveryZone[LIMPUN]
qList::iterator Hi() const
bool lgLineListRatio[LIMPUN]
vector< string > chLineListLabel[LIMPUN]
double anu2(size_t i) const
diatomics h2("h2", 4100.,&hmi.H2_total, Yan_H2_CS)
realnum GetDopplerWidth(realnum massAMU)
sys_float safe_div(sys_float x, sys_float y, sys_float res_0by0)
realnum * OccNumbIncidCont
double column(const genericState &gs)
void map_do(FILE *io, const char *chType)
double PrtLogLin(double value)
static bool lgMustPrintHeader
vector< string > chLineLabel
double heating(long nelem, long ion)
double H2_photodissoc_used_H2g
double AnuUnit(realnum energy)
double anumin(size_t i) const
SaveParams params[LIMPUN]
double **** PhotoRate_Shell
double gauntff(long Z, double Te, double anu)
TransitionProxy trans(const long ipHi, const long ipLo)
char chElementSym[LIMELM][CHARS_ELEMENT_SYM]
realnum gas_phase[LIMELM]
realnum UV_Cont_rel2_Draine_DB96_depth
bool lgSaveEveryZone[LIMPUN]
realnum AtomicWeight[LIMELM]
void SaveHeaderDone(int ipPun)
void sprt_wl(char *chString, realnum wl)
bool lgPrtIsotropicCont[LIMPUN]
double sound_speed_adiabatic
qList::iterator Lo() const
double OccupationNumberLine(const TransitionProxy &t)
void mole_dominant_rates(const vector< const molecule * > &debug_list, FILE *ioOut, bool lgPrintReagents, size_t NPRINT, double fprint)
long int cdLine(const char *chLabel, realnum wavelength, double *relint, double *absint)
vector< realnum > wlLineList[LIMPUN]
void ChargTranPun(FILE *ipPnunit, char *chSave)
double density(const genericState &gs)
double extin_mag_V_extended
bool lgHashEndIter[LIMPUN]
vector< vector< TransitionList > > ExtraLymanLines
int cdColm(const char *chLabel, long int ion, double *theocl)
bool lgPrtOldStyleLogs[LIMPUN]
CollisionProxy Coll() const
void H2_PunchLineStuff(FILE *io, realnum xLimit, long index)
#define DEBUG_ENTRY(funcname)
void H2_PunchDo(FILE *io, char chJOB[], const char chTime[], long int ipPun)
diatomics * whichDiatomToPrint[LIMPUN]
int ConvPresTempEdenIoniz(void)
vector< double > hist_temp_heat
bool lgOutputTypeOn[NUM_OUTPUT_TYPES]
vector< species > dBaseSpecies
void SaveSpecies(FILE *ioPUN, long int ipPun)
double RateIonizTot(long nelem, long ion) const
realnum UV_Cont_rel2_Habing_TH85_depth
bool lgCheckMonitors(FILE *ioMONITOR)
int fprintf(const Output &stream, const char *format,...)
multi_arr< double, 4 > xIonMean
string chSpeciesDominantRates[LIMPUN]
const char * chConSavEnr[LIMPUN]
void prt_line_inlist(FILE *ioOUT, const char *label, realnum wvlng)
STATIC void AGN_Hemis(FILE *ioPUN)
void SaveSpeciesPseudoCont(const long ipPun, const string &speciesLabel)
sys_float SDIV(sys_float x)
vector< string > chSaveSpecies[LIMPUN]
size_t ntypes(void) const
void DynaPunchTimeDep(FILE *ipPnunit, const char *chJob)
void save_average(long int ipPun)
void GammaPrt(long int ipLoEnr, long int ipHiEnr, long int ipOpac, FILE *ioFILE, double total, double threshold)
STATIC void SaveLineIntensity(FILE *ioPUN, long int ipPun, realnum Threshold)
string GridPointPrefix(int n)
realnum pinzon_PresIntegElecThin
vector< realnum > SilicateEmission
double anumax(size_t i) const
t_secondaries secondaries
vector< TransitionList > dBaseTrans
double plankf(long int ip)
STATIC void SaveResults(FILE *ioPUN)
double flux_correct_isotropic(const bool lgSaveIsotr, const int nEmType, const int iflux)
bool lgSaveHeader(int ipPun) const
long int nCollapsed_local
double getResolutionScaleFactor() const
double ColUL(const ColliderList &colls) const
double rate_h2_form_grains_used_total
const string & chExitStatus(exit_type s) const
static bool lgPopsFirstCall
vector< string > chFileName
void Save1Line(const TransitionProxy &t, FILE *io, realnum xLimit, long index, realnum DopplerWidth)