44 return strcmp(unit,ref) == 0;
52 if(
nMatch(
" MIC",chCard) )
57 else if(
nMatch(
" EV ",chCard) )
62 else if(
nMatch(
" KEV",chCard) )
67 else if(
nMatch(
" MEV",chCard) )
72 else if(
nMatch(
"WAVE",chCard) )
77 else if(
nMatch(
"CENT",chCard) ||
nMatch(
" CM ",chCard) )
82 else if(
nMatch(
" MM ",chCard) )
87 else if(
nMatch(
" NM ",chCard) )
92 else if(
nMatch(
"ANGS",chCard) )
97 else if(
nMatch(
" HZ ",chCard) )
102 else if(
nMatch(
" KHZ",chCard) )
107 else if(
nMatch(
" MHZ",chCard) )
112 else if(
nMatch(
" GHZ",chCard) )
117 else if(
nMatch(
"KELV",chCard) ||
nMatch(
" K ",chCard) )
122 else if(
nMatch(
" RYD",chCard) )
128 else if(
nMatch(
" ERG ",chCard) )
135 fprintf(
ioQQQ,
" No energy / wavelength unit was recognized on this line:\n %s\n\n", chCard );
136 fprintf(
ioQQQ,
" See Hazy for details.\n" );
212 fprintf(
ioQQQ,
" insane units in Energy::get: \"%s\"\n", unit );
288 fprintf(
ioQQQ,
" insane units in Energy::set: \"%s\"\n", unit );
297 double energy =
Ryd();
298 if( energy < rfield.emm || energy >
rfield.egamry )
300 fprintf(
ioQQQ,
" The energy %g Ryd is not within the default Cloudy range\n", energy );
329 outsum(&outtot,&outin,&outout);
331 sum_recom_lines =
totlin(
'r');
332 if( sum_recom_lines == 0. )
334 sprintf( chLine,
" !Total recombination line energy is 0." );
339 sum_coolants =
totlin(
'c');
340 if( sum_coolants == 0. )
342 sprintf( chLine,
" !Total cooling is zero." );
346 if( !(
wind.lgBallistic() ||
wind.lgStatic()) )
364 fprintf(
ioQQQ,
"PROBLEM DISASTER lgConserveEnergy failed %li\t%li\t%e\t%e\t%e\n",
374 if( !
dynamics.lgTimeDependentStatic && (sum_coolants + sum_recom_lines + flow_energy) >
continuum.TotalLumin*
geometry.covgeo &&
381 " W-Radiated luminosity (cool+rec+wind=%.2e+%.2e+%.2e) is greater than that in incident radiation (TotalLumin=%8.2e). Power radiated was %8.2e",
382 sum_coolants, sum_recom_lines, flow_energy ,
continuum.TotalLumin,
thermal.power );
385 fprintf(
ioQQQ,
"\n\n DISASTER This calculation DID NOT CONSERVE ENERGY!\n\n\n" );
388 fprintf(
ioQQQ,
"Rerun with *set check energy every zone* command to do energy check for each zone.\n\n");
394 fprintf(
ioQQQ,
"\n The CASE B command was entered - this can have unphysical effects, including non-conservation of energy.\n Why was it needed?\n\n" );
399 sprintf( chLine,
" W-Something is really wrong: the ratio of radiated to incident luminosity is %.2e.",
400 (sum_coolants + sum_recom_lines)/
continuum.TotalLumin );
406 fprintf(
ioQQQ,
" This may have been caused by the FORCE TE command.\n" );
407 fprintf(
ioQQQ,
" Remove it and run again.\n" );
419 double flxref = 0., flxatt = 0., conem = 0.;
424 for(
long j=0; j<
rfield.nflux; j++ )
427 flxref += (
rfield.ConRefIncid[nEmType][j] +
rfield.ConEmitReflec[nEmType][j] +
rfield.reflin[nEmType][j]) *
rfield.anu[j];
451 static const double RATIO = 0.02;
459 fprintf(
ioQQQ,
" badprt: all entries with greater than%6.2f%% of incident continuum follow.\n",
461 fprintf(
ioQQQ,
" badprt: Intensities are relative to total energy in incident continuum.\n" );
467 " Sum of energy in recombination lines is %.2e relative to total incident radiation is %.2e\n",
469 sum_recom_lines/
MAX2(1e-30,total) );
471 fprintf(
ioQQQ,
" all strong information lines \n line wl ener/total\n");
475 if(
LineSv[i].chSumTyp == chInfo &&
LineSv[i].SumLine[0]/total > RATIO )
479 fprintf(
ioQQQ,
" %7.3f %c\n",
LineSv[i].SumLine[0]/total, chInfo );
483 fprintf(
ioQQQ,
" all strong cooling lines \n line wl ener/total\n");
486 fprintf(
ioQQQ,
" Sum of coolants (abs) = %.2e (rel)= %.2e\n",
487 sum_coolants, sum_coolants/
MAX2(1e-30,total) );
490 if(
LineSv[i].chSumTyp == chInfo &&
LineSv[i].SumLine[0]/total > RATIO )
494 fprintf(
ioQQQ,
" %7.3f %c\n",
LineSv[i].SumLine[0]/total, chInfo );
498 fprintf(
ioQQQ,
" all strong heating lines \n line wl ener/total\n");
500 fprintf(
ioQQQ,
" Sum of heat (abs) = %.2e (rel)= %.2e\n",
504 if(
LineSv[i].chSumTyp == chInfo &&
LineSv[i].SumLine[0]/total > RATIO )
508 fprintf(
ioQQQ,
" %7.3f %c\n",
LineSv[i].SumLine[0]/total, chInfo );
long nMatch(const char *chKey, const char *chCard)
const int INPUT_LINE_LENGTH
#define DEBUG_ENTRY(funcname)
double get(const char *unit) const
void outsum(double *outtot, double *outin, double *outout)
long ipoint(double energy_ryd)
static const char * ENERGY_CM
static const char * ENERGY_WN
static const char * ENERGY_KHZ
static const char * ENERGY_RYD
STATIC double sum_radiation(void)
static const char * ENERGY_MEV
static const char * ENERGY_A
static const char * ENERGY_K
static const char * ENERGY_GHZ
STATIC void badprt(double total)
static const char * ENERGY_MICRON
const char * StandardEnergyUnit(const char *chCard)
static const char * ENERGY_KEV
static const char * ENERGY_ERG
static const char * ENERGY_MHZ
static const char * ENERGY_EV
static const char * ENERGY_NM
static const char * ENERGY_HZ
bool isSameUnit(const char *unit, const char *ref)
static const char * ENERGY_MM
double totlin(int chInfo)
static realnum * wavelength
UNUSED const double FR1RYD
UNUSED const double RYD_INF
UNUSED const double EN1RYD
UNUSED const double EVRYD
UNUSED const double TE1RYD
UNUSED const double RYDLAM
void prt_wl(FILE *ioOUT, realnum wl)
t_secondaries secondaries
void warnin(char *chLine)
void bangin(char *chLine)