61 double frac_beam_time;
63 double frac_beam_const;
65 double frac_isotropic;
79 ratio = fabs( log10( flux_now / flux_org ) );
80 BigLog =
max( ratio , BigLog );
118 double HCaseBRecCoeff,
128 double frac_beam_time;
130 double frac_beam_const;
132 double frac_isotropic;
134 long int nelem , ion;
150 factor = (
realnum)(EN1RYD/PI4/FR1RYD/HNU3C2);
157 double flux =
ffun(
rfield.
anu(i), &frac_beam_time, &frac_beam_const, &frac_isotropic );
158 ASSERT( fabs(1.-frac_beam_time-frac_beam_const-frac_isotropic) < 10.*FLT_EPSILON );
163 fprintf(
ioQQQ,
"\n Cannot continue. The continuum is far too intense.\n" );
177 fprintf(
ioQQQ,
" negative continuum returned at%6ld%10.2e%10.2e\n",
199 fprintf(
ioQQQ,
"\n\n Compton heating, cooling coefficients \n" );
236 fprintf(
ioQQQ,
" ContSetIntensity: The peak of the H-ion continuum is at %.3e Ryd - its value is %.2e\n",
242 fprintf(
ioQQQ,
" PROBLEM DISASTER The continuum is too intense to compute. Use a fainter continuum. (This is the nu*f_nu test)\n" );
261 fprintf(
ioQQQ,
" NOTE Setcon: continuum has zero intensity starting at %11.4e Ryd.\n",
272 "%6ld cells in the incident continuum have zero intensity. Problems???\n\n",
283 " PROBLEM DISASTER Continuum has negative intensity at %.4e Ryd=%.2e %4.4s %4.4s\n",
290 " PROBLEM DISASTER cont_setintensity - internal error - continuum energies not in increasing order: energies follow\n" );
292 "%ld %e %ld %e %ld %e\n",
347 tcompr = (p1 + p2 + p3 + p4 + p5 + p6 + p7)/TotalPower;
348 tcomp = tcompr/(4.*6.272e-6);
359 " mean photon energy=%10.3eR =%10.3eK low, high nu=%12.4e%12.4e\n",
383 fprintf(
ioQQQ,
" NOTE There is no hydrogen-ionizing radiation.\n" );
389 fprintf(
ioQQQ,
" NOTE There is no Balmer continuum radiation.<<<<\n" );
429 "\n WARNING: The energy density temperature (%g) is greater than the"
430 " black body temperature (%g). This is unphysical.\n\n",
448 realnum plsFrqConstant = (
realnum)(ELEM_CHARGE_ESU/sqrt(PI*ELECTRON_MASS)/FR1RYD);
449 ASSERT( plsFrqConstant > 2.7e-12 && plsFrqConstant < 2.8e-12 );
498 " !The plasma frequency is %.2e Ryd. The incident continuum is set to 0 below this.\n",
579 " >>> NOTE The incident continuum is surprisingly faint.\n" );
581 " >>> The total energy in the Balmer and Lyman continua is %.2e erg cm-2 s-1.\n"
583 fprintf(
ioQQQ,
" >>> This is many orders of magnitude fainter than the ISM galactic background.\n" );
584 fprintf(
ioQQQ,
" >>> This seems unphysical - please check that the continuum intensity has been properly set.\n" );
585 fprintf(
ioQQQ,
" >>> YOU MAY BE MAKING A BIG MISTAKE!!\n >>>\n\n\n\n" );
597 " CAUTION The incident radiation field is surprisingly intense.\n" );
599 " The dimensionless hydrogen ionization parameter is %.2e.\n"
601 fprintf(
ioQQQ,
" This is many orders of magnitude brighter than commonly seen.\n" );
602 fprintf(
ioQQQ,
" This seems unphysical - please check that the radiation field intensity has been properly set.\n" );
603 fprintf(
ioQQQ,
" YOU MAY BE MAKING A BIG MISTAKE!!\n\n\n\n\n" );
616 TeNew = (20000.+log10(
rfield.
uh)*5000.);
617 TeNew =
MAX2(8000. , TeNew );
638 for( ion=0; ion<nelem+1; ++ion )
665 HCaseBRecCoeff = (-9.9765209 + 0.158607055*
phycon.
telogn[0] + 0.30112749*
675 double PhotonEnergy = 1.;
691 if( RatioIoniz<1e-3 )
703 else if( RatioIoniz>1e3 )
719 double alpha = HCaseBRecCoeff + CollIoniz ;
720 double beta = HCaseBRecCoeff*EdenExtraLocal + OtherIonization +
724 double discriminant =
POW2(beta) - 4.*alpha*gamma;
725 if( discriminant <0 )
728 fprintf(
ioQQQ,
" DISASTER PROBLEM cont_initensity found negative discriminant.\n");
736 fprintf(
ioQQQ,
" DISASTER PROBLEM cont_initensity found n(H+)>n(H).\n");
744 fprintf(
ioQQQ,
" DISASTER PROBLEM cont_initensity found n(H0)<0.\n");
783 double RecTot = HCaseBRecCoeff*
dense.
eden;
784 RatioIonizToRecomb = xIoniz/RecTot;
793 r3ov2 = xIoniz/RecTot;
796 if( RatioIonizToRecomb > 0. )
834 while( loopCount < 10 && fabs(newEden/
dense.
eden - 1.) > 0.001 );
840 fprintf(
ioQQQ,
"PROBLEM the derived atomic hydrogen density is zero.\n");
843 fprintf(
ioQQQ,
"This is almost certainly due to floating point "
844 "limits on this computer.\nThe ionization parameter is very large,"
845 " the density is very small,\nand the H^0 density cannot be"
846 " stored in a double.\n");
858 fprintf(
ioQQQ,
"\n PROBLEM DISASTER - this simulation has no source"
859 " of ionization. The electron density is zero. Consider "
860 "adding a source of ionization such as cosmic rays.\n\n");
870 for(
long nelem=ipISO; nelem<
LIMELM; ++nelem)
918 fprintf(
ioQQQ,
" PROBLEM DISASTER Negative electron density results in ContSetIntensity.\n" );
919 fprintf(
ioQQQ,
"%10.2e%10.2e%10.2e%10.2e%10.2e%10.2e\n",
935 " ContSetIntensity sets initial EDEN to %.4e, contributors H+=%.2e He+, ++= %.2e %.2e Heav %.2e extra %.2e\n",
953 fprintf(
ioQQQ,
"\ntrace continuum print of %li incident spectral "
975 for( i=0; i < 6; i++ )
980 for( i=0; i < 8; i++ )
1014 fprintf(
ioQQQ,
" ContSetIntensity returns, nflux=%5ld anu(nflux)=%11.4e eden=%10.2e\n",
1040 for( i=il-1; i < iupper; i++ )
1081 for(
long i=0; i<low-1; ++i )
1120 fprintf(
ioQQQ,
" UNKN spectral normalization cannot happen.\n" );
1128 fprintf(
ioQQQ,
" chRSpec must be SQCM or 4 PI, and it was %4.4s. This cannot happen.\n",
1141 fprintf(
ioQQQ,
"\n\n PROBLEM DISASTER At least one of the compiled stellar atmosphere"
1142 " grids has been compiled with a different energy grid resolution factor.\n" );
1143 fprintf(
ioQQQ,
" Please recompile this file using the COMPILE STARS command "
1144 "and make sure that you use the correct SET CONTINUUM RESOLUTION factor.\n" );
1152 fprintf(
ioQQQ,
"\n\n PROBLEM DISASTER The file read by the TABLE READ command "
1153 "has been compiled with a different energy grid resolution factor.\n" );
1154 fprintf(
ioQQQ,
" Please recompile this file using the SAVE TRANSMITTED CONTINUUM "
1155 "command and use the correct SET CONTINUUM RESOLUTION factor.\n" );
1163 for(
size_t nd=0; nd <
gv.
bin.size(); nd++ )
1167 fprintf(
ioQQQ,
"\n\n PROBLEM DISASTER At least one of the grain opacity files "
1168 "has been compiled with a different energy grid resolution factor.\n" );
1169 fprintf(
ioQQQ,
" Please recompile this file using the COMPILE GRAINS command "
1170 "and make sure that you use the correct SET CONTINUUM RESOLUTION factor.\n" );
1195 " conorm converts continuum %ld from luminosity to intensity.\n",
1214 " conorm converts continuum %ld from ionizat par to q(h).\n",
1230 fprintf(
ioQQQ,
" conorm converts continuum%3ld from x-ray ionizat par to I.\n",
1241 fprintf(
ioQQQ,
" Cloudy will predict lumin into 4pi\n" );
1245 fprintf(
ioQQQ,
" Cloudy will do surface flux for lumin\n" );
1269 fprintf(
ioQQQ,
"PROBLEM DISASTER, a continuum source is a laser at %f Ryd, but the intensity was specified over a range from %f to %f Ryd.\n",
1273 fprintf(
ioQQQ,
"Please specify the continuum flux where the laser is active.\n");
1281 fprintf(
ioQQQ,
" conorm continuum number %ld is shape %s range is %.2e %.2e\n",
1303 fprintf(
ioQQQ,
" conorm this is ratio to 1st con\n" );
1309 fprintf(
ioQQQ,
" I cant form a ratio if continuum is first source.\n" );
1321 fprintf(
ioQQQ,
" Previous continua were zero where ratio is desired.\n" );
1338 fprintf(
ioQQQ,
" conorm ratio will set scale fac to%10.3e at%10.2e Ryd.\n",
1353 fprintf(
ioQQQ,
"\n\n PROBLEM DISASTER\n The intensity of continuum source %ld is non-positive at the energy used to normalize it (%.3e Ryd). Something is seriously wrong.\n",
1357 fprintf(
ioQQQ,
" This continuum shape given by a table of points - check that the intensity is specified at an energy within the range of that table.\n");
1358 fprintf(
ioQQQ,
" Also check that the numbers used to specify the shape and intensity do not under or overflow on this cpu.\n\n");
1365 f = log10(f) + log10(
rfield.
range[i][0]*EN1RYD/FR1RYD);
1371 fprintf(
ioQQQ,
" conorm will set log fnu to%10.3e at%10.2e Ryd. Factor=%11.4e\n",
1382 fprintf(
ioQQQ,
" conorm calling qintr range=%11.3e %11.3e desired val is %11.3e\n",
1398 fprintf(
ioQQQ,
" PROBLEM DISASTER Continuum source specified is too extreme.\n" );
1400 " The integral over the continuum shape gave (log) %.3e photons, and the command requested (log) %.3e.\n" ,
1403 " The difference in the log is %.3e.\n" ,
1407 fprintf(
ioQQQ,
" The continuum source is too bright.\n" );
1411 fprintf(
ioQQQ,
" The continuum source is too faint.\n" );
1414 fprintf(
ioQQQ,
" The usual cause for this problem is an incorrect continuum intensity/luminosity or radius command.\n" );
1415 fprintf(
ioQQQ,
" There were a total of %li continuum shape commands entered - the problem is with number %li.\n",
1427 fprintf(
ioQQQ,
" conorm finds Q over range from%11.4e-%11.4e Ryd, integral= %10.4e Factor=%11.4e\n",
1446 fprintf(
ioQQQ,
" conorm finds luminosity range is %10.3e to %9.3e Ryd, factor is %11.4e\n",
1461 fprintf(
ioQQQ,
"PROBLEM DISASTER conorm finds infinite continuum scale factor.\n" );
1462 fprintf(
ioQQQ,
"The continuum is too intense to compute with this cpu.\n" );
1463 fprintf(
ioQQQ,
"Were the intensity and luminosity commands switched?\n" );
1485 fprintf(
ioQQQ,
"PROBLEM DISASTER conorm: Aperture slit specified, but not predicting luminosity.\n" );
1486 fprintf(
ioQQQ,
"conorm: Please specify an inner radius to determine L.\nSorry\n" );
1517 fprintf(
ioQQQ,
" PROBLEM DISASTER Sorry, but both luminosity and surface brightness have been requested for lines.\n" );
1518 fprintf(
ioQQQ,
" the PRINT LINE SURFACE BRIGHTNESS command can only be used when lines are predicted per unit cloud area.\n" );
1548 for(
long i=ipLo; i < ipHi; i++ )
1553 fprintf(
ioQQQ,
" PROBLEM DISASTER Photon number sum in QINTR is %.3e\n",
1555 fprintf(
ioQQQ,
" This source has no ionizing radiation, and the number of ionizing photons was specified.\n" );
1556 fprintf(
ioQQQ,
" This was continuum source number%3ld\n",
1558 fprintf(
ioQQQ,
" Sorry, but I cannot go on. ANU and FLUX arrays follow. Enjoy.\n" );
1559 fprintf(
ioQQQ,
"\n\n This error is also caused by an old table read file whose energy mesh does not agree with the code.\n" );
1589 for(
long i=ip1; i < ip2; i++ )
1592 return ( sum > 0. ) ? log10(sum) : -38.;
vector< double, allocator_avx< double > > ContBoltz
bool lgContinuumLoweringEnabled[NISO]
void iso_continuum_lower(long ipISO, long nelem)
NORETURN void TotalInsanity(void)
double widflx(size_t i) const
realnum * flux_beam_const_save
vector< string > chContLabel
long int IonHigh[LIMELM+1]
realnum ** flux_total_incident
double coll_ion_wrapper(long int z, long int n, double t)
vector< Energy > tNu[LIMSPC]
vector< double, allocator_avx< double > > ContBoltzHelp2
sys_float sexp(sys_float x)
bool lgTemperatureConstant
vector< double, allocator_avx< double > > ContBoltzAvg
vector< realnum > tslop[LIMSPC]
double anu(size_t i) const
void TempChange(double TempNew, bool lgForceUpdate)
realnum ExtinguishEnergyPowerLow
t_iso_sp iso_sp[NISO][LIMELM]
long int nflux_with_check
realnum ExtinguishConvertColDen2OptDepth
double xIonDense[LIMELM][LIMELM+1]
bool fp_equal(sys_float x, sys_float y, int n=3)
realnum ExtinguishLeakage
size_t ipointC(double anu) const
long ipoint(double energy_ryd)
long int IonLow[LIMELM+1]
STATIC void extin(realnum *ex1ryd)
realnum * flux_time_beam_save
STATIC double pintr(double penlo, double penhi)
Illuminate::IlluminationType Illumination[LIMSPC]
bool lgSurfaceBrightness_SR
STATIC double qintr(double qenlo, double qenhi)
double anu2(size_t i) const
realnum * OccNumbIncidCont
vector< string > chLineLabel
double anumin(size_t i) const
realnum gas_phase[LIMELM]
void IncidentContinuumHere()
STATIC void sumcon(long int il, long int ih, realnum *q, realnum *p, realnum *panu)
realnum * flux_isotropic_save
#define DEBUG_ENTRY(funcname)
double powpq(double x, int p, int q)
realnum ExtinguishColumnDensity
vector< double, allocator_avx< double > > ContBoltzHelp1
realnum * ExtinguishFactor
int fprintf(const Output &stream, const char *format,...)
realnum OpticalDepthScaleFactor[LIMSPC]
double anumax(size_t i) const
void EdenChange(double EdenNew)
t_secondaries secondaries
realnum * flux_beam_const
double getResolutionScaleFactor() const
long int ipHeavy[LIMELM][LIMELM]
realnum ExtinguishLowEnergyLimit