cloudy  trunk
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
mole_h2_form.cpp
Go to the documentation of this file.
1 /* This file is part of Cloudy and is copyright (C)1978-2008 by Gary J. Ferland and
2  * others. For conditions of distribution and use see copyright notice in license.txt */
3 /*mole_H2_form find state specific rates grains and H- form H2 */
4 #include "cddefines.h"
5 #include "grainvar.h"
6 #include "phycon.h"
7 #include "hmi.h"
8 #include "dense.h"
9 #include "h2.h"
10 #include "h2_priv.h"
11 
12 /*mole_H2_form find state specific rates grains and H- form H2 */
13 void mole_H2_form( void )
14 {
15 
16  long int iVib , iRot , nd;
17  long int ipT;
18  double rate, oldrate ,
19  frac_lo , frac_hi;
20 
21  DEBUG_ENTRY( "mole_H2_form()" );
22 
23  /* rate of entry into X from H- and formation on grain surfaces
24  * will one of several distribution functions derived elsewhere
25  * first zero out formation rates and rates others collide into particular level */
26  for( iVib = 0; iVib <= h2.nVib_hi[0]; ++iVib )
27  {
28  for( iRot=h2.Jlowest[0]; iRot<=h2.nRot_hi[0][iVib]; ++iRot )
29  {
30  /* this will be the rate formation (s-1) of H2 due to
31  * both formation on grain surfaces and the H minus route,
32  * also H2+ + H => H2 + H+ into one vJ level */
33  /* units cm-3 s-1 */
34  H2_X_formation[iVib][iRot] = 0.;
35  H2_X_Hmin_back[iVib][iRot] = 0.;
36  }
37  }
38 
39  /* loop over all grain types, finding total formation rate into each ro-vib level,
40  * also keeps trace of total formation into H2 ground and star, as defined by Tielens & Hollenbach,
41  * these are used in the H molecular network */
42  hmi.H2_forms_grains = 0.;
44  /* >>chng 02 oct 08, resolved grain types */
45  for( nd=0; nd<gv.nBin; ++nd )
46  {
47  int ipH2 = (int)gv.which_H2distr[gv.bin[nd]->matType];
48  for( iVib = 0; iVib <= h2.nVib_hi[0]; ++iVib )
49  {
50  for( iRot=h2.Jlowest[0]; iRot<=h2.nRot_hi[0][iVib]; ++iRot )
51  {
52  /* >>chng 02 nov 14, changed indexing into H2_X_grain_formation_distribution and gv.bin, PvH */
53  realnum one =
54  /* H2_X_grain_formation_distribution is normalized to a summed total of unity */
55  H2_X_grain_formation_distribution[ipH2][iVib][iRot] *
56  /* units of following are s-1 */
58  /* final units are s-1 */
59  /* units cm-3 s-1 */
60  /* >>chng 04 may 05, added atomic hydrogen density, units cm-3 s-1 */
61  H2_X_formation[iVib][iRot] += one*dense.xIonDense[ipHYDROGEN][0];
62 
63  /* save rates for formation into "H2" and "H2*" in the chemical
64  * network - it resolves the H2 into two species, as in
65  * Hollenbach / Tielens work - these rates will be used in the
66  * chemistry solver to get H2 and H2* densities */
67  if( energy_wn[0][iVib][iRot] < ENERGY_H2_STAR )
68  {
69  /* unit s-1, h2 means h2g*/
70  hmi.H2_forms_grains += one;
71  }
72  else
73  {
74  hmi.H2star_forms_grains += one;
75  }
76  }
77  }
78  }
79 
80  /* formation of H2 in excited states from H- H minus */
81  /* >>chng 02 oct 17, temp dependent fit to rate, updated reference,
82  * about 40% larger than before */
83  /* rate in has units cm-3 s-1 */
85  /*rate = hmi.hminus*1.35e-9f;*/
86  /* convert to dimensionless factors that add to unity */
87  /* >>chng 02 oct 17, use proper distribution function */
89  hmi.H2_forms_hminus = 0.;
90  oldrate = 0.;
91  /* which temperature point to use? */
92  if( phycon.alogte<=1. )
93  {
94  ipT = 0;
95  frac_lo = 1.;
96  frac_hi = 0.;
97  }
98  else if( phycon.alogte>=4. )
99  {
100  ipT = nTE_HMINUS-2;
101  frac_lo = 0.;
102  frac_hi = 1.;
103  }
104  else
105  {
106  /* find the temp */
107  for( ipT=0; ipT<nTE_HMINUS-1; ++ipT )
108  {
109  if( H2_te_hminus[ipT+1]>phycon.alogte )
110  break;
111  }
112  frac_hi = (phycon.alogte-H2_te_hminus[ipT])/(H2_te_hminus[ipT+1]-H2_te_hminus[ipT]);
113  frac_lo = 1.-frac_hi;
114  }
115 
116  /* we now know how to interpolate, now fill in H- formation sites */
117  for( iVib=0; iVib<=h2.nVib_hi[0]; ++iVib )
118  {
119  for( iRot=h2.Jlowest[0]; iRot<=h2.nRot_hi[0][iVib]; ++iRot )
120  {
121  /* the temperature-interpolated distribution function, adds up to unity,
122  * dimensionless */
123  double rate_interp =
124  frac_lo*H2_X_hminus_formation_distribution[ipT][iVib][iRot] +
125  frac_hi*H2_X_hminus_formation_distribution[ipT+1][iVib][iRot];
126 
127  /* above rate was set, had dimensions cm-3 s-1
128  * rate is product of parent densities and total formation rate */
129  realnum one = (realnum)(rate * rate_interp);
130 
131  /* save this rate [cm3 s-1] for back reaction in levels solver for v,J */
132  H2_X_Hmin_back[iVib][iRot] = (realnum)(rate_interp * hmi.assoc_detach);
133 
134  /* units cm-3 s-1 */
135  H2_X_formation[iVib][iRot] += one;
136 
137  oldrate += rate_interp;
138 
139  /* save rates to pass back into molecule network */
140  if( energy_wn[0][iVib][iRot] < ENERGY_H2_STAR )
141  {
142  /* unit cm-3s-1, h2 means h2g*/
143  hmi.H2_forms_hminus += one;
144  }
145  else
146  {
147  hmi.H2star_forms_hminus += one;
148  }
149  }
150  }
151  /* confirm that shape function is normalized correctly */
152  ASSERT( fabs(1.-oldrate)<1e-4 );
153 
154  /* >>chng 03 feb 10, add this population process */
155  /* H2+ + H => H2 + H+,
156  * >>refer H2 population Krstic, P.S., preprint
157  * all goes into v=4 but no J information, assume into J = 0 */
158  /* >>chng 04 may 05, add density at end */
160  iVib = 4;
161  iRot = 0;
162  /* units cm-3 s-1 */
163  H2_X_formation[iVib][iRot] += (realnum)rate;
164 
165  return;
166 }

Generated for cloudy by doxygen 1.8.1.1