30 static const double energy_off = 0.273*FREQ_1EV/SPEEDLIGHT;
42 double Edust = DissocEnergy *
Xdust[
ipH2] *
43 ( 1. - ( (Ev - Evm) / (DissocEnergy+energy_off-Evm)) *
44 ( (1.-
Xdust[ipH2])/2.) );
49 EH2_here = DissocEnergy +energy_off - Edust;
58 double G1[
H2_TOP] = { 0.3 , 0.4 , 0.9 };
59 double G2[
H2_TOP] = { 0.6 , 0.6 , 0.4 };
62 if( (energy_wn+energy_off) <= Evm )
65 Fv =
sexp(
POW2( (energy_wn+energy_off - Evm)/(G1[ipH2]* Evm ) ) );
70 Fv =
sexp(
POW2( (energy_wn+energy_off - Evm)/(G2[ipH2]*(EH2 - Evm ) ) ) );
80 if( (*Lo).n()==0 && (*tr).Emis().Aul() > 1.01e-30 )
116 bool lgDebugPrt =
false;
140 fixit(
"this doesn't work!");
149 for(
long iVibHi = 0; iVibHi <=
nVib_hi[iElecHi]; ++iVibHi )
160 for(
unsigned nEner = 0; nEner <
states.
size(); ++nEner )
162 long iElec =
states[nEner].n();
163 long iVib =
states[nEner].v();
164 long iRot =
states[nEner].J();
188 const int H2_nRot_add_ortho_para[
N_ELEC] = {0, 1, 1, 0, 1, 1, 0};
189 if(
is_odd( (*st).J() + H2_nRot_add_ortho_para[(*st).n()]) )
192 H2_lgOrtho[(*st).n()][(*st).v()][(*st).J()] =
true;
197 H2_lgOrtho[(*st).n()][(*st).v()][(*st).J()] =
false;
203 H2_lgOrtho[(*st).n()][(*st).v()][(*st).J()] =
false;
209 realnum rotstat = 2.f*(*st).J()+1.f;
211 if (
H2_lgOrtho[(*st).n()][(*st).v()][(*st).J()])
214 (*st).g() = opstat*rotstat;
225 " H2_Create: there are %li electronic levels, in each level there are",
228 " for a total of %li levels.\n", (
long int)
states.
size() );
253 " The total number of levels used in the matrix solver was set to %li but there are only %li levels in X.\n Sorry.\n",
255 nLevels_per_elec[0]);
269 fprintf(
ioQQQ,
"%li\t%li\t%li\t%.5e\n", (*st).n(), (*st).v(), (*st).J(), (*st).energy().WN() );
300 for(
long iVib = 0; iVib <=
nVib_hi[iElec]; ++iVib )
325 for(
long iVib = 0; iVib <=
nVib_hi[0]; ++iVib )
344 for(
long iVib = 0; iVib <=
nVib_hi[0]; ++iVib )
370 for(
long iVib = 0; iVib <=
nVib_hi[0]; ++iVib )
391 for(
long iVib = 0; iVib <=
nVib_hi[0]; ++iVib )
411 long iElec = (*st).n();
412 if( iElec > 0 )
continue;
413 long iVib = (*st).v();
414 long iRot = (*st).J();
431 fixit(
"this needs to be generalized");
435 for(
long j = 1; j < nLevels_per_elec[0]; ++j )
438 for(
long k = 0; k < j; ++k )
446 fixit(
"Does RateCoefTable only need to be N_X_COLLIDER long?");
461 for(
long ipHi = 1; ipHi < nLevels_per_elec[0]; ++ipHi )
463 for(
long ipLo = 0; ipLo < ipHi; ++ipLo )
481 for(
long i=1; i<nLevels_per_elec[0]; ++i )
488 for(
unsigned nEner = 1; nEner <
states.
size(); ++nEner )
499 vector<TransitionList::iterator> initptrs;
501 initlist.states() = &
states;
507 for(
unsigned ipHi=1; ipHi<
states.
size(); ++ipHi )
509 for(
unsigned ipLo=0; ipLo<ipHi; ++ipLo )
515 initptrs[lineIndex] = tr;
528 for(
long iVibHi=0; iVibHi<=
nVib_hi[iElecHi]; ++iVibHi )
531 for(
long iRotHi=
Jlowest[iElecHi]; iRotHi<=
nRot_hi[iElecHi][iVibHi]; ++iRotHi )
537 long int lim_elec_lo = 0;
539 for(
long iElecLo=0; iElecLo<=lim_elec_lo; ++iElecLo )
542 for(
long iVibLo=0; iVibLo<=
nVib_hi[iElecLo]; ++iVibLo )
564 stable_sort( initptrs.begin(), initptrs.end(),
compareEmis );
569 vector<TransitionList::iterator>::iterator ptr = initptrs.begin();
570 for (
size_t i=0; i < initptrs.size(); ++i, ++tr, ++ptr)
582 for(
unsigned i = 0; i <
trans.
size(); ++i )
587 trans[i].ipHi() = ipEnergySort[(*Hi).n()][(*Hi).v()][(*Hi).J()];
588 trans[i].ipLo() = ipEnergySort[(*Lo).n()][(*Lo).v()][(*Lo).J()];
596 for(
unsigned i = 0; i <
trans.
size(); ++i )
611 (*tr).WLAng() = (
realnum)(1.e8f/(*tr).EnergyWN() /
RefIndex( (*tr).EnergyWN() ) );
613 (*tr).Coll().col_str() = 0.;
623 (*tr).Emis().iRedisFun() =
ipCRDW;
628 (*tr).Emis().TauTot() = 1e20f;
630 (*tr).Emis().dampXvel() = (
realnum)( (*tr).Emis().Aul()/(*tr).EnergyWN()/PI4);
631 (*tr).Emis().gf() = (
realnum)(
GetGF( (*tr).Emis().Aul(),(*tr).EnergyWN(), (*(*tr).Hi()).g() ) );
634 (*tr).Emis().opacity() = (
realnum)(
abscf( (*tr).Emis().gf(), (*tr).EnergyWN(), (*(*tr).Lo()).g()) );
643 (*tr).Emis().ColOvTot() = 1.;
649 (*tr).Emis().ColOvTot() = 0.;
652 fixit(
"why not include this for excitations within X as well?");
665 (*tr).Coll().col_str() = (
realnum)(
666 ( (*tr).Emis().gf()/ (*tr).EnergyWN() ) /
669 ASSERT( (*tr).Coll().col_str()>0.);
686 realnum sum = 0., sumj = 0., sumv = 0., sumo = 0., sump = 0.;
695 double T_H2_FORM = 50000.;
696 for(
long iVib = 0; iVib <=
nVib_hi[0]; ++iVib )
703 (1.f+2.f*
H2_lgOrtho[iElec][iVib][iRot]) * (1.f+iVib) *
707 sumv += iVib * H2_X_grain_formation_distribution[
ipH2][iVib][iRot];
710 sumo += H2_X_grain_formation_distribution[
ipH2][iVib][iRot];
715 sump += H2_X_grain_formation_distribution[
ipH2][iVib][iRot];
723 double Xrot[
H2_TOP] = { 0.14 , 0.15 , 0.15 };
724 double Xtrans[
H2_TOP] = { 0.12 , 0.15 , 0.25 };
730 for(
long iVib = 0; iVib <=
nVib_hi[0]; ++iVib )
739 for(
long iVib = 0; iVib <=
nVib_hi[0]; ++iVib )
751 Erot = (EH2 - Ev) * Xrot[
ipH2] / (Xrot[
ipH2] + Xtrans[
ipH2]);
787 double gaussian =
sexp(
POW2( (deltaE - Erot) / (0.5 * Erot) ) );
789 double thermal_dist =
sexp( deltaE / Erot );
792 double aver = ( gaussian + thermal_dist ) / 2.;
803 (1.f+2.f*
H2_lgOrtho[iElec][iVib][iRot]) * Fv * (2.*iRot+1.) * aver );
807 sumv += iVib * H2_X_grain_formation_distribution[
ipH2][iVib][iRot];
810 sumo += H2_X_grain_formation_distribution[
ipH2][iVib][iRot];
814 sump += H2_X_grain_formation_distribution[
ipH2][iVib][iRot];
836 double T_H2_FORM = 17329.;
838 for(
long iVib = 0; iVib <=
nVib_hi[0]; ++iVib )
849 sumv += iVib * H2_X_grain_formation_distribution[
ipH2][iVib][iRot];
852 sumo += H2_X_grain_formation_distribution[
ipH2][iVib][iRot];
857 sump += H2_X_grain_formation_distribution[
ipH2][iVib][iRot];
866 sumo = sumj = sumv = 0.;
868 for(
long iVib = 0; iVib <=
nVib_hi[0]; ++iVib )
883 fprintf(
ioQQQ,
"H2 form grains mean J= %.3f mean v = %.3f ortho/para= %.3f\n",
884 sumj/sum , sumv/sum , sumo/sump );
888 for(
long iVib = 0; iVib <=
nVib_hi[0]; ++iVib )
multi_arr< double, 2 > H2_rad_rate_in
multi_arr< double, 2 > H2_col_rate_out
t_mole_global mole_global
multi_arr< realnum, 3 > H2_dissprob
const double ENERGY_H2_STAR
double H2_DissocEnergies[N_ELEC]
NORETURN void TotalInsanity(void)
STATIC bool compareEmis(const TransitionList::iterator &tr1, const TransitionList::iterator &tr2)
double abscf(double gf, double enercm, double gl)
bool lgLeiden_Keep_ipMH2s
multi_arr< double, 2 > pops_per_vib
multi_arr< realnum, 2 > H2_coll_dissoc_rate_coef_H2
valarray< long > ipVib_H2_energy_sort
void H2_CollidRateRead(long int nColl)
vector< CollRateCoeffArray > RateCoefTable
sys_float sexp(sys_float x)
double RefIndex(double EnergyWN)
multi_arr< realnum, 2 > H2_coll_dissoc_rate_coef
static double Xdust[H2_TOP]
void H2_Read_hminus_distribution(void)
static double XVIB[H2_TOP]
multi_arr< realnum, 3 > CollRateErrFac
multi_arr< realnum, 2 > H2_X_formation
t_iso_sp iso_sp[NISO][LIMELM]
multi_arr< realnum, 3 > CollRateCoeff
valarray< realnum > H2_X_sink
static const double energy_off
multi_arr< long int, 3 > ipEnergySort
multi_arr< double, 3 > H2_old_populations
const multi_geom< d, ALLOC > & clone() const
multi_arr< realnum, 3 > H2_disske
void resize(size_t newsize)
long ipoint(double energy_ryd)
realnum & EnergyWN() const
multi_arr< realnum, 3 > H2_X_hminus_formation_distribution
double energy(const genericState &gs)
long int nLevels_per_elec[N_ELEC]
multi_arr< double, 3 > H2_populations_LTE
STATIC double EH2_eval(int ipH2, double DissocEnergy, double energy_wn)
molecule * findspecies(const char buf[])
valarray< class molezone > species
multi_arr< realnum, 2 > H2_X_colden_LTE
multi_arr< bool, 2 > lgH2_radiative
multi_arr< realnum, 2 > H2_X_Hmin_back
multi_arr< realnum, 6 > H2_SaveLine
multi_arr< double, 3 > H2_rad_rate_out
diatomics h2("h2", 4100.,&hmi.H2_total, Yan_H2_CS)
valarray< long > ipElec_H2_energy_sort
double RandGauss(double xMean, double s)
void Read_Mol_Diss_cross_sections(void)
multi_arr< realnum, 3 > H2_X_grain_formation_distribution
TransitionProxy trans(const long ipHi, const long ipLo)
void H2_ReadTransprob(long int nelec, TransitionList &trans)
multi_arr< double, 2 > H2_X_rate_to_elec_excited
void reserve(size_type i1)
double GetGF(double trans_prob, double enercm, double gup)
multi_arr< double, 2 > H2_X_rate_from_elec_excited
#define DEBUG_ENTRY(funcname)
multi_arr< long int, 2 > ipTransitionSort
diatomics hd("hd", 4100.,&hmi.HD_total, Yan_H2_CS)
TransitionList::iterator rad_end
int fprintf(const Output &stream, const char *format,...)
void H2_ReadDissocEnergies(void)
valarray< long > nRot_hi[N_ELEC]
vector< TransitionList > AllTransitions
valarray< long > ipRot_H2_energy_sort
valarray< realnum > H2_X_source
void H2_ReadDissprob(long int nelec)
STATIC double H2_vib_dist(int ipH2, double EH2, double DissocEnergy, double energy_wn)
multi_arr< realnum, 2 > H2_X_coll_rate
STATIC bool lgRadiative(const TransitionList::iterator &tr)
multi_arr< double, 2 > H2_col_rate_in
multi_arr< realnum, 2 > H2_X_colden
multi_arr< int, 2 > H2_ipPhoto
multi_arr< bool, 3 > H2_lgOrtho