40                 long ipFullShell = -1, ipNextFull = 0;
 
   41                 xValenceDonorDensity = 0.;
 
   45                         xValenceDonorDensity += 
 
   47                         if (nelem == ipNoble[ipNextFull])
 
   57                                                                                                                         xValenceDonorDensity),1e-4));
 
   66                 realnum xNeutralParticleDensity = 0.;
 
   67                 for( 
long nelem=0; nelem < 
LIMELM; nelem++ )
 
   83                         enum {DEBUG_LOC=
false};
 
   86                                 fprintf(
ioQQQ,
" xIonDense xNeutralParticleDensity tot\t%.3e",xNeutralParticleDensity);
 
   87                                 for( 
long nelem=0; nelem < 
LIMELM; nelem++ )
 
   94                 xValenceDonorDensity = (xNeutralParticleDensity+
dense.
EdenTrue);
 
   96                                                                                                                         xValenceDonorDensity),1e-4));
 
  104         double cosmic_ray_ionization_rate , 
 
  105                 pair_production_ionization_rate , 
 
  106                 fast_neutron_ionization_rate , SecExcitLyaRate;
 
  109         double SeconIoniz_iso[
NISO] , 
 
  110                 SeconExcit_iso[
NISO];
 
  119         double secmetsave[
LIMELM];
 
  121         realnum SaveOxygen1 , SaveCarbon1;
 
  125         double Cosmic_ray_sec2prim;
 
  152         realnum xValenceDonorDensity, ElectronFraction;
 
  159         realnum xBoundValenceDensity = (1.0f-ElectronFraction)*xValenceDonorDensity;
 
  166                 Cosmic_ray_sec2prim = 0.05f;
 
  192                 sec2prim_par_1 = -(1.251f + 195.932f * ElectronFraction);
 
  193                 sec2prim_par_2 = 1.f + 46.814f * ElectronFraction - 44.969f * 
 
  194                         ElectronFraction * ElectronFraction;
 
  196                 Cosmic_ray_sec2prim = (exp(sec2prim_par_1/
SDIV( sec2prim_par_2)));
 
  213                                 " csupra H0 %.2e  HeatSum eval sec ion effic, ElectronFraction = %.3e HeatEfficPrimary %.3e SecIon2PrimaryErg %.3e\n", 
 
  228         fixit(
"This breaks the invariant for total mass.");
 
  244                 SeconIoniz_iso[ipISO] = 0.;
 
  245                 SeconExcit_iso[ipISO] = 0.;
 
  250         for( 
long nelem=0; nelem<
LIMELM; ++nelem)
 
  252                 secmetsave[nelem] = 0.;
 
  268                                 double HeatingHi = 0.;
 
  281                         secmet += secmetsave[nelem];
 
  297                                         double HeatingHi = 0.;
 
  307                                                 xBoundValenceDensity;
 
  312                                                 xBoundValenceDensity;
 
  314                                         ASSERT( SeconIoniz_iso[ipISO]>=0. && 
 
  315                                                           SeconExcit_iso[ipISO]>=0.);
 
  323                 long int ipsavemax=-1;
 
  326                         if( secmetsave[nelem] > savemax )
 
  328                                 savemax = secmetsave[nelem];
 
  333                         "   HeatSum secmet largest contributor element %li frac of total %.3e, total %.3e\n", 
 
  335                         savemax/
SDIV(secmet),
 
  350                 secmet /= xBoundValenceDensity;
 
  351                 smetla /= xBoundValenceDensity;
 
  411                 pair_production_ionization_rate = 
 
  419                 fast_neutron_ionization_rate = 
 
  434                 pair_production_ionization_rate = 0.;
 
  435                 SecExcitLyaRate = 0.;
 
  436                 fast_neutron_ionization_rate = 0.;
 
  441         cosmic_ray_ionization_rate = 
 
  460                         for( ion=0; ion<nelem+1; ++ion )
 
  469                 double csupra = cosmic_ray_ionization_rate + 
 
  470                         pair_production_ionization_rate +
 
  471                         fast_neutron_ionization_rate +
 
  480                         for( ion=0; ion<nelem+1; ++ion )
 
  486                 fixit(
"why does x12tot include non Ly-a stuff here, and get used to scale other lines elsewhere?");
 
  514         static long int nhit=0, 
 
  516         double photo_heat_2lev_atoms,
 
  517                 photo_heat_ISO_atoms ,
 
  522         static double oldheat=0., 
 
  525         realnum SaveOxygen1 , SaveCarbon1;
 
  529         double Cosmic_ray_heat_eff;
 
  535                 fixit(
"much or all of this secondary stuff should be updated much earlier: solvers in conv_base use outdated details");
 
  562         realnum xValenceDonorDensity, ElectronFraction;
 
  569         realnum xBoundValenceDensity = (1.0f-ElectronFraction)*xValenceDonorDensity;
 
  573                 Cosmic_ray_heat_eff = 0.95;
 
  606                 Cosmic_ray_heat_eff = - 8.189 - 18.394 * ElectronFraction - 6.608 * ElectronFraction * ElectronFraction * log(ElectronFraction)
 
  607                         + 8.322 * exp( ElectronFraction )  + 4.961 * sqrt(ElectronFraction);
 
  617         photo_heat_2lev_atoms = 0.;
 
  618         photo_heat_ISO_atoms = 0.;
 
  628         fixit(
"This breaks the invariant for total mass.");
 
  644         for( 
long nelem=0; nelem<
LIMELM; ++nelem)
 
  750         for( 
long nelem=0; nelem<
LIMELM; ++nelem )
 
  752                 for( ion=0; ion<nelem+1; ++ion )
 
  794                         heat += (*diatom)->Abund() *
 
  830                 xBoundValenceDensity * Cosmic_ray_heat_eff +
 
  837         for( 
long nelem=0; nelem<
LIMELM; ++nelem)
 
  843                 for( 
long i=nelem+1; i < 
LIMELM; i++ )
 
  849         thermal.
htot = OtherHeat + photo_heat_2lev_atoms + photo_heat_ISO_atoms;
 
  858                                 " Total heating is <0; is this model collisionally ionized? zone is %li\n",
 
  864                                 " Total heating is 0; is the density small? zone is %li\n",
 
  873                 fprintf( 
ioQQQ, 
" HeatSum gets negative line heating,%10.2e%10.2e this is insane.\n", 
 
  890         thermal.
dHeatdT = -0.7*(photo_heat_2lev_atoms+photo_heat_ISO_atoms+
 
  899                 photo_heat_2lev_atoms,
 
  900                 photo_heat_ISO_atoms);
 
  972                 for( 
long nelem=ipISO; nelem<
LIMELM; ++nelem)
 
  995                 if( 
nzone != nzSave )
 
 1009                 for( 
long i=0; i < 
LIMELM; i++ )
 
 1011                         for( j=0; j < 
LIMELM; j++ )
 
 1019                                         ipnt = 
MIN2((
long)NDIM-1,ipnt+1);
 
 1034                                 ipnt = 
MIN2((
long)NDIM-1,ipnt+1);
 
 1039                   "    HeatSum HTOT %.3e Te:%.3e dH/dT%.2e other %.2e photo 2lev %.2e photo iso %.2e\n", 
 
 1046                   photo_heat_2lev_atoms, 
 
 1047                   photo_heat_ISO_atoms);
 
 1050                 for(
long i=0; i < ipnt; i++ )
 
 1059                         if( !(i%8) && i>0 && i!=(ipnt-1) )
 
 1075         for(
long i=0; i < 
LIMELM; i++ )
 
 1077                 for(
long j=0; j < 
LIMELM; j++ )
 
t_mole_global mole_global
double heavycollcool[LIMELM]
double ** CompRecoilHeatRate
double CosRayHeatNeutralParticles
long int IonHigh[LIMELM+1]
realnum SecIon2PrimaryErg
bool lgTemperatureConstant
molezone * findspecieslocal(const char buf[])
static const double FAINT_HEAT
t_iso_sp iso_sp[NISO][LIMELM]
double xIonDense[LIMELM][LIMELM+1]
bool fp_equal(sys_float x, sys_float y, int n=3)
double CosRayHeatThermalElectrons
long int IonLow[LIMELM+1]
long int nsShells[LIMELM][LIMELM]
valarray< class molezone > species
vector< diatomics * > diatoms
double heating(long nelem, long ion)
double **** PhotoRate_Shell
void setHeating(long nelem, long ion, double heating)
realnum gas_phase[LIMELM]
double *** CollIonRate_Ground
double CompRecoilHeatLocal
#define DEBUG_ENTRY(funcname)
int fprintf(const Output &stream, const char *format,...)
realnum deriv_HeatH2Dexc_used
sys_float SDIV(sys_float x)
double pow(double x, int i)
realnum SecExcitLya2PrimaryErg
double PairProducPhotoRate[3]
t_secondaries secondaries
STATIC void ElectronFractions(realnum &ElectronFraction, realnum &xValenceDonorDensity)
static const bool PRT_DERIV
vector< diatomics * >::iterator diatom_iter
const bool lgConvBaseHeatTest