35 CollisIonizatCoolingTotal,
36 CollisIonizatHeatingTotal,
37 dCollisIonizatCoolingTotalDT,
42 CollisIonizatCoolingDT,
45 valarray<double> CollisIonizatCoolingArr,
46 CollisIonizatCoolingDTArr,
50 long int nlo_heat_max , nhi_heat_max;
85 for(
long ipLo=0; ipLo < ipHi; ++ipLo )
108 CollisIonizatCoolingTotal = 0.;
109 CollisIonizatHeatingTotal = 0.;
110 dCollisIonizatCoolingTotalDT = 0.;
116 for(
long n=0; n < lim; ++n )
119 CollisIonizatCooling =
122 CollisIonizatCoolingTotal += CollisIonizatCooling;
123 CollisIonizatHeating =
127 CollisIonizatHeatingTotal += CollisIonizatHeating;
129 double CollisIonizatDiff = CollisIonizatCooling-CollisIonizatHeating;
131 CollisIonizatCoolingDT = CollisIonizatDiff*
135 dCollisIonizatCoolingTotalDT += CollisIonizatCoolingDT;
139 CollisIonizatCoolingArr[n] = CollisIonizatDiff;
140 CollisIonizatCoolingDTArr[n] = CollisIonizatCoolingDT;
144 double CollisIonizatNetCooling =
145 CollisIonizatCoolingTotal-CollisIonizatHeatingTotal;
148 sp->
coll_ion = CollisIonizatNetCooling;
176 if (CollisIonizatNetCooling < 0)
186 if( CollisIonizatCoolingArr[n] /
SDIV( CollisIonizatNetCooling ) > 0.1 )
189 CollisIonizatCoolingArr[n]/
SDIV( CollisIonizatNetCooling ) );
195 if( CollisIonizatCoolingDTArr[n] /
SDIV( dCollisIonizatCoolingTotalDT ) > 0.1 )
198 CollisIonizatCoolingDTArr[n]/
SDIV( dCollisIonizatCoolingTotalDT ) );
235 enum {DEBUG_LOC=
false};
262 ASSERT( sp->
fb[n].PhotoHeat >= 0. );
265 SavePhotoHeat[n] = sp->
st[n].Pop()*
267 HeatExcited += SavePhotoHeat[n];
268 if( SavePhotoHeat[n] > biggest )
270 biggest = SavePhotoHeat[n];
276 enum {DEBUG_LOC=
false};
277 if( DEBUG_LOC && ipISO==0 && nelem==0 &&
nzone > 700)
282 fprintf(
ioQQQ,
"ipISO = %li nelem=%li ipbig=%li biggest=%g HeatExcited=%.2e ctot=%.2e\n",
291 fprintf(
ioQQQ,
"DEBUG phot heat%2li\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\n",
293 SavePhotoHeat[n]/HeatExcited,
335 SaveInducCool[n] = sp->
fb[n].RecomInducCool_Coef*sp->
fb[n].PopLTE*edenIonAbund;
343 enum {DEBUG_LOC=
false};
344 if( DEBUG_LOC && ipISO==0 && nelem==5 )
359 fprintf(
ioQQQ,
"%li\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e \n",
362 sp->
fb[n].RadRecCoolCoef,
364 sp->
fb[n].RecomInducCool_Coef,
366 sp->
fb[n].RecomInducRate);
388 sp->
st[ipHi].Pop()/sp->
st[ipHi].g());
404 fixit(
"Wouldn't need to mask this out if levels were in order");
405 arg[ipHi] = -
max((sp->
st[ipHi].energy().K()-sp->
st[ipHi-1].energy().K()) /
phycon.
te, -38.);
413 for (
long ipLo = 0; ipLo < ipHi; ++ipLo )
414 Boltzmann[ipLo] *= bstep[ipHi];
416 for(
long ipLo=0; ipLo < ipHi; ++ipLo )
423 sp->
st[ipHi].g()/sp->
st[ipLo].g() -
448 if( hlone < heat_max )
460 enum {DEBUG_LOC=
false};
464 fprintf(
ioQQQ,
"%li %li %.2e\n", nlo_heat_max, nhi_heat_max, heat_max );
479 sp->
st[ipHi].g()/sp->
st[0].g() -
500 double boltzH2s = bstep[2];
501 double boltzH2p = 1.;
504 boltzH2s *= bstep[ipHi];
505 boltzH2p *= bstep[ipHi];
513 sp->
st[ipHi].g()/sp->
st[ipLo].g() -
516 ASSERT( sp->
st[ipHi].energy().Erg() >
517 sp->
st[ipLo].energy().Erg() );
524 sp->
st[ipHi].g()/sp->
st[ipLo].g() -
527 ASSERT( sp->
st[ipHi].energy().Erg() >
528 sp->
st[ipLo].energy().Erg() );
540 for (
unsigned lev = 0; lev < Boltzmann.size(); ++lev)
545 for (
long ipLo = 0; ipLo < ipHi; ++ipLo )
546 Boltzmann[ipLo] *= bstep[ipHi];
548 for(
long ipLo=3; ipLo < ipHi; ++ipLo )
554 sp->
st[ipHi].g()/sp->
st[ipLo].g() -
581 sp->
dLTot = -dCdT_all;
586 enum {DEBUG_LOC=
false};
591 fprintf(
ioQQQ,
"%.2e la %.2f restly %.2f barest %.2f hrest %.2f\n",
603 enum {DEBUG_LOC=
false};
606 if( DEBUG_LOC && (nelem==1 || nelem==0) )
614 fprintf(
ioQQQ,
"%li\t%li\t%g\t%g\t%g\t%g\tT=\t%g\t%g\t%g\t%g\n", nelem,n,
615 sp->
fb[n].gamnc *sp->
fb[n].PopLTE,
620 sp->
fb[n].RecomInducRate*sp->
fb[n].PopLTE ,
622 sp->
fb[n].RecomInducRate*sp->
fb[n].PopLTE ,
626 sp->
fb[n].PhotoHeat*sp->
fb[n].PopLTE,
627 sp->
fb[n].RecomInducCool_Coef*sp->
fb[n].PopLTE+sp->
fb[n].RadRecCoolCoef,
629 sp->
fb[n].RecomInducCool_Coef*sp->
fb[n].PopLTE ,
631 sp->
fb[n].RadRecCoolCoef );
639 fprintf(
ioQQQ,
"%li\t%li\t%g\t%g\t%g\t%g\tT=\t%g\t%g\t%g\t%g\n", nelem,n,
640 sp->
fb[n].gamnc*sp->
st[n].Pop(),
643 sp->
fb[n].RecomInducRate*sp->
fb[n].PopLTE *edenIonAbund ,
645 sp->
fb[n].RecomInducRate*sp->
fb[n].PopLTE *edenIonAbund ,
648 SaveInducCool[n]+sp->
fb[n].RadRecCoolCoef*edenIonAbund ,
652 sp->
fb[n].RadRecCoolCoef*edenIonAbund );
672 double ThinCoolingSum = 0.;
695 phycon.
te *
POW2( (
double)sp->
st[n].n() / (double)(nelem+1-ipISO) ))*
705 ThinCoolingSum += thin;
708 return ThinCoolingSum;
717 double RecCoolExtra = 0.;
725 double ThinCoolingCaseB;
730 ThinCoolingCaseB = (-25.859117 +
742 ThinCoolingCaseB = (-25.859117 +
756 RecCoolExtra = ThinCoolingCaseB - ThinCoolingSum;
765 RecCoolExtra =
MAX2(0., RecCoolExtra );
795 long ipLo = sp->
fb[n].ipIsoLevNIonCon-1;
796 double thresh = sp->
fb[n].xIsoLevNIonRyd;
810 long ipLo = sp->
fb[n].ipIsoLevNIonCon-1;
811 long offset = -sp->
fb[n].ipIsoLevNIonCon + sp->
fb[n].ipOpac;
812 double thresh = sp->
fb[n].xIsoLevNIonRyd;
821 double energyAboveThresh = widflx/2.;
823 double RadRecCoolCoef = energyAboveThresh*photon;
824 for( nu=ipLo+1; nu < ipHi; nu++ )
829 energyAboveThresh =
rfield.
anu(nu) - thresh;
834 double one = energyAboveThresh*photon;
835 RadRecCoolCoef += one;
837 if( one < 1.e-20*RadRecCoolCoef )
842 sp->
fb[n].RadRecCoolCoef = gamma*RadRecCoolCoef*sp->
fb[n].RadRecomb[
ipRecNetEsc]*EN1RYD;
848 sp->
fb[n].RadRecCoolCoef = 0.;
void CoolAdd(const char *chLabel, realnum lambda, double cool)
double HydroRecCool(long int n, long int ipZ)
realnum EnergyErg() const
double widflx(size_t i) const
long int IonHigh[LIMELM+1]
double RecomInducCool_Rate
vector< double, allocator_avx< double > > ContBoltzHelp2
double anu(size_t i) const
double RRC_TeUsed[NISO][LIMELM]
t_elementnames elementnames
t_iso_sp iso_sp[NISO][LIMELM]
void vexp(const double x[], double y[], long nlo, long nhi)
double xIonDense[LIMELM][LIMELM+1]
bool fp_equal(sys_float x, sys_float y, int n=3)
ColliderList colliders(dense)
void iso_cool(long ipISO, long nelem)
STATIC double iso_rad_rec_cooling_approx(long ipISO, long nelem)
double powi(double, long int)
STATIC void iso_rad_rec_cooling_discrete(const long ipISO, const long nelem)
double anu2(size_t i) const
double anumin(size_t i) const
TransitionProxy trans(const long ipHi, const long ipLo)
char chElementSym[LIMELM][CHARS_ELEMENT_SYM]
realnum gas_phase[LIMELM]
double FreeBnd_net_Cool_Rate
CollisionProxy Coll() const
double HCoolRatio(double t)
#define DEBUG_ENTRY(funcname)
double elementcool[LIMELM+1]
vector< double, allocator_avx< double > > ContBoltzHelp1
int fprintf(const Output &stream, const char *format,...)
sys_float SDIV(sys_float x)
STATIC double iso_rad_rec_cooling_extra(long ipISO, long nelem, const double &ThinCoolingSum)
double anumax(size_t i) const
const bool lgPrintIonizCooling
void CollisionZero(const CollisionProxy &t)
void AddHeating(long nelem, long ion, double heating)
void vexpm1(const double x[], double y[], long nlo, long nhi)
double ColUL(const ColliderList &colls) const