Changeset 1848 for branches/newmole/source/mole_drive.cpp
- Timestamp:
- 03/15/08 13:18:03 (10 months ago)
- Files:
-
- 1 modified
-
branches/newmole/source/mole_drive.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/newmole/source/mole_drive.cpp
r1846 r1848 235 235 realnum abundan; 236 236 237 double *b, **c; 237 valarray<double> b(mole.num_total); 238 double **c; 238 239 long int i; 239 240 240 241 DEBUG_ENTRY( "mole_effects()" ); 241 242 242 b = (double *)MALLOC((size_t)mole.num_total*sizeof(double));243 243 c = (double **)MALLOC((size_t)mole.num_total*sizeof(double *)); 244 244 c[0] = (double *)MALLOC((size_t)mole.num_total* … … 249 249 } 250 250 251 mole_eval_balance(mole.num_total, b,c);251 mole_eval_balance(mole.num_total,&b[0],c); 252 252 253 253 for (long int nelem=ipHYDROGEN;nelem<LIMELM;nelem++) … … 299 299 300 300 /* save rate H2 is destroyed units s-1 */ 301 302 /* total H2 - all forms */ 303 hmi.H2_total = (realnum) findspecies("H2*")->den + findspecies("H2")->den; 304 /* first guess at ortho and para densities */ 305 h2.ortho_density = 0.75*hmi.H2_total; 306 h2.para_density = 0.25*hmi.H2_total; 307 301 308 /* >>chng 05 mar 18, TE, add terms - 302 309 total destruction rate is: dest_tot = n_H2g/n_H2tot * dest_H2g + n_H2s/n_H2tot * dest_H2s */ … … 320 327 321 328 /* establish local timescale for H2 molecule destruction */ 322 if( findspecies("H2")->index != -1 && -c[findspecies("H2")->index][findspecies("H2")->index]> SMALLFLOAT )329 if(hmi.H2_rate_destroy > SMALLFLOAT ) 323 330 { 324 331 /* units are now seconds */ 325 timesc.time_H2_Dest_here = -1./c[findspecies("H2")->index][findspecies("H2")->index];332 timesc.time_H2_Dest_here = 1./hmi.H2_rate_destroy; 326 333 } 327 334 else … … 331 338 332 339 /* local timescale for H2 formation 333 * both grains and radiative attachment */ 334 timesc.time_H2_Form_here = (mole_findrk("H,H,grnh=>H2*")+mole_findrk("H,H,grnh=>H2")) * 335 /* this corrects for fact that we the timescale for H2 to form from an atomic gas. 336 * The rate becomes very small when gas is fully molecular, and ratio of total hydrogen 337 * to atomic hydrogen corrections for this. */ 338 dense.gas_phase[ipHYDROGEN]/SDIV(dense.xIonDense[ipHYDROGEN][0]); 340 * both grains and radiative attachment 341 * >>chng 08 mar 15 rjrw -- ratio formation rate to density of _H2_ so comparable with destruction rate, 342 * use full rates not rate coefficients so have correct units */ 343 timesc.time_H2_Form_here = (mole_findrate("H,H,grnh=>H2*")+mole_findrate("H,H,grnh=>H2")); 339 344 /* timescale is inverse of this rate */ 340 345 if( timesc.time_H2_Form_here > SMALLFLOAT ) 341 346 { 342 347 /* units are now seconds */ 343 timesc.time_H2_Form_here = 1./timesc.time_H2_Form_here;348 timesc.time_H2_Form_here = hmi.H2_total/timesc.time_H2_Form_here; 344 349 } 345 350 else … … 347 352 timesc.time_H2_Form_here = 0.; 348 353 } 349 350 351 /* total H2 - all forms */352 hmi.H2_total = (realnum) findspecies("H2*")->den + findspecies("H2")->den;353 /* first guess at ortho and para densities */354 h2.ortho_density = 0.75*hmi.H2_total;355 h2.para_density = 0.25*hmi.H2_total;356 354 357 355 /* NB the first index must be kept parallel with nelem and ionstag in … … 708 706 free(c[0]); 709 707 free(c); 710 free(b);711 708 712 709 mole_h_rate_diagnostics();
