Changeset 1686 for branches/newmole/source
- Timestamp:
- 12/16/07 13:43:02 (11 months ago)
- Location:
- branches/newmole/source
- Files:
-
- 24 modified
-
conv_base.cpp (modified) (4 diffs)
-
dynamics.cpp (modified) (2 diffs)
-
eden_sum.cpp (modified) (6 diffs)
-
h2.h (modified) (1 diff)
-
hcmap.cpp (modified) (1 diff)
-
heat_sum.cpp (modified) (1 diff)
-
init_coreload.cpp (modified) (2 diffs)
-
init_defaults_preparse.cpp (modified) (2 diffs)
-
init_sim_postparse.cpp (modified) (1 diff)
-
mole.h (modified) (4 diffs)
-
mole_co_drive.cpp (modified) (7 diffs)
-
mole_co_etc.cpp (modified) (16 diffs)
-
mole_eval_balance.cpp (modified) (5 diffs)
-
mole_h2.cpp (modified) (41 diffs)
-
mole_h2_coll.cpp (modified) (20 diffs)
-
mole_h2_create.cpp (modified) (21 diffs)
-
mole_h2_etc.cpp (modified) (12 diffs)
-
mole_h2_io.cpp (modified) (9 diffs)
-
mole_newton_step.cpp (modified) (5 diffs)
-
mole_reactions.cpp (modified) (5 diffs)
-
parse_atom_h2.cpp (modified) (19 diffs)
-
parse_set.cpp (modified) (4 diffs)
-
prt_comment.cpp (modified) (1 diff)
-
radius_next.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/newmole/source/conv_base.cpp
r1658 r1686 199 199 * will confirm that these are converged */ 200 200 EdenTrue_old = dense.EdenTrue; 201 EdenFromMolecOld = co.comole_eden;201 EdenFromMolecOld = mole.elec; 202 202 EdenFromGrainsOld = gv.TotalEden; 203 203 HeatingOld = thermal.htot; … … 867 867 868 868 /* check on molecular electron den */ 869 if( fabs(EdenFromMolecOld - co.comole_eden)/dense.EdenTrue > conv.EdenErrorAllowed/2. )869 if( fabs(EdenFromMolecOld - mole.elec)/dense.EdenTrue > conv.EdenErrorAllowed/2. ) 870 870 { 871 871 conv.lgConvIoniz = false; … … 905 905 906 906 /* check on sum of grain and molecular electron den - often two large numbers that cancel */ 907 if( fabs( (EdenFromMolecOld-EdenFromGrainsOld) - ( co.comole_eden-gv.TotalEden) )/dense.eden >907 if( fabs( (EdenFromMolecOld-EdenFromGrainsOld) - (mole.elec-gv.TotalEden) )/dense.eden > 908 908 conv.EdenErrorAllowed/4. ) 909 909 { … … 911 911 sprintf( conv.chConvIoniz, "edn grn e" ); 912 912 conv.BadConvIoniz[0] = (EdenFromMolecOld-EdenFromGrainsOld); 913 conv.BadConvIoniz[1] = ( co.comole_eden-gv.TotalEden);913 conv.BadConvIoniz[1] = (mole.elec-gv.TotalEden); 914 914 } 915 915 -
branches/newmole/source/dynamics.cpp
r1681 r1686 951 951 frac_next; 952 952 /* Atoms and positive ions are already counted in UpstreamElem */ 953 if(COmole[mol]->n_nuclei != 1 || COmole[mol]-> nElec< 0)953 if(COmole[mol]->n_nuclei != 1 || COmole[mol]->charge < 0) 954 954 { 955 955 for( nelem=ipHYDROGEN; nelem<LIMELM; ++nelem ) … … 983 983 { 984 984 Upstream_molecules[mol] = Old_molecules[ipUpstream][mol]/Old_density[ipUpstream]; 985 if(COmole[mol]->n_nuclei > 1 || COmole[mol]-> nElec< 0)985 if(COmole[mol]->n_nuclei > 1 || COmole[mol]->charge < 0) 986 986 { 987 987 for( nelem=ipHYDROGEN; nelem<LIMELM; ++nelem ) -
branches/newmole/source/eden_sum.cpp
r1610 r1686 18 18 int eden_sum(void) 19 19 { 20 long int i,20 long int 21 21 ion, 22 22 nelem; … … 54 54 dense.EdenTrue += sum_all_ions; 55 55 ASSERT( dense.EdenTrue >= 0. ); 56 57 /* add on molecules */58 co.comole_eden = 0.;59 for(i=0;i<mole.num_calc;i++)60 {61 if (COmole[i]->n_nuclei > 1 || COmole[i]->nElec < 0)62 co.comole_eden += COmole[i]->hevmol*COmole[i]->nElec;63 }64 56 65 57 #if 1 … … 69 61 /* >>chng 04 feb 20, recoil_ion.in shows this important, 70 62 * update test so prevent neg eden */ 71 if( (- co.comole_eden) > dense.EdenTrue/4. && conv.lgSearch )63 if( (-mole.elec) > dense.EdenTrue/4. && conv.lgSearch ) 72 64 { 73 65 /*dense.EdenTrue += MIN2(dense.EdenTrue*0.05,hmole_eden);*/ 74 66 dense.EdenTrue *= 0.9; 75 67 } 76 else if( (- co.comole_eden) > dense.EdenTrue )68 else if( (-mole.elec) > dense.EdenTrue ) 77 69 { 78 70 /* >>chng 04 mar 14, add this branch to prevent … … 81 73 fprintf(ioQQQ," PROBLEM sum eden from hmole too neg, set to limt. EdenTrue:%.3e hmole_eden:%.3e \n", 82 74 dense.EdenTrue, 83 co.comole_eden);75 mole.elec); 84 76 dense.EdenTrue = dense.EdenTrue/2.; 85 77 } … … 87 79 { 88 80 /* account for electrons on all molecules */ 89 dense.EdenTrue += co.comole_eden;81 dense.EdenTrue += mole.elec; 90 82 } 91 83 #else 92 dense.EdenTrue += co.comole_eden;84 dense.EdenTrue += mole.elec; 93 85 #endif 94 86 … … 149 141 dense.EdenTrue , 150 142 sum_all_ions , 151 co.comole_eden,143 mole.elec , 152 144 gv.TotalEden*gv.lgGrainElectrons, 153 145 dense.EdenExtra , 154 sum_all_ions + co.comole_eden+ gv.TotalEden*gv.lgGrainElectrons + dense.EdenExtra,146 sum_all_ions + mole.elec + gv.TotalEden*gv.lgGrainElectrons + dense.EdenExtra, 155 147 rfield.otslin[2182] ); 156 148 -
branches/newmole/source/h2.h
r1610 r1686 159 159 long int Jlowest[N_H2_ELEC]; 160 160 161 /** std and mean for the noise, log normal distribution */ 162 double xMeanNoise , xSTDNoise; 163 164 /** limit to the ratio H2/Htot - if ratio is below this, large atom is not called */ 165 double H2_to_H_limit; 166 167 /** the number of electronic quantum states to include. 168 * To do both Lyman and Werner bands want nelec = 3 */ 169 long int n_h2_elec_states; 170 171 /** this is option to use estimates of the collision rates from g-bar approximations */ 172 /** turn mole.lgColl_gbar on/off with atom h2 gbar on off */ 173 bool lgColl_gbar; 174 175 /** this is option to turn off the calculated collision rates */ 176 bool lgColl_deexec_Calc; 177 178 /** this is option to turn off guesses of collisional dissociation rates */ 179 bool lgColl_dissoc_coll; 180 161 181 /* true to use 2007 set of H2 - H collision rate, false use 1999 */ 162 182 bool lgH2_H_coll_07; 163 183 184 /** include collision rates that come from real calculations, 185 * off with atom h2 collisions off command */ 186 bool lgH2_grain_deexcitation; 187 188 /** flag to force LTE level populations, atom H2 LTE */ 189 bool lgH2_LTE; 190 191 /** option to turn off ortho-para collisions, command ATOM H2 COLLISIONS ORTHO PARA OFF */ 192 bool lgH2_ortho_para_coll_on; 193 194 /** which set of He - H2 collisions to use? default is ORNL, other 195 * is Le BOURlet */ 196 bool lgH2_He_ORNL; 197 198 /** turn on trace information */ 199 int nH2_TRACE; 200 201 /** put noise into collision rates */ 202 bool lgH2_NOISE , 203 /** noise for the CR collisions */ 204 lgH2_NOISECOSMIC; 205 206 /** this sets how fine a trace we want for atom h2 trace */ 207 int nH2_trace_final , 208 nH2_trace_iterations , 209 nH2_trace_full, 210 nH2_trace_matrix; 211 164 212 } h2; 165 213 -
branches/newmole/source/hcmap.cpp
r1610 r1686 235 235 236 236 /* this will force reinitialization of co network */ 237 co.iteration_co= -2;237 mole.iteration = -2; 238 238 239 239 /* now get ionization solution for this temperature */ -
branches/newmole/source/heat_sum.cpp
r1610 r1686 118 118 for( i=0; i < mole.num_calc; i++ ) 119 119 { 120 if(COmole[i]->n_nuclei > 1 || COmole[i]-> nElec< 0)120 if(COmole[i]->n_nuclei > 1 || COmole[i]->charge < 0) 121 121 AtomicCollidDensity += COmole[i]->hevmol; 122 122 } -
branches/newmole/source/init_coreload.cpp
r1610 r1686 11 11 #include "date.h" 12 12 #include "version.h" 13 #include " mole.h"13 #include "h2.h" 14 14 #include "extinc.h" 15 15 #include "heavy.h" … … 344 344 /* these are used to set trace levels of output by options on atom h2 trace command 345 345 * first is minimum level of trace, keyword is FINAL */ 346 mole.nH2_trace_final = 1;346 h2.nH2_trace_final = 1; 347 347 /* intermediate level of trace, info per iteration, key ITERATION */ 348 mole.nH2_trace_iterations = 2;348 h2.nH2_trace_iterations = 2; 349 349 /* full trace, keyword is FULL */ 350 mole.nH2_trace_full = 3;350 h2.nH2_trace_full = 3; 351 351 /* print matrices used in solving X */ 352 mole.nH2_trace_matrix = 4;352 h2.nH2_trace_matrix = 4; 353 353 354 354 /* initialization for punch files - must call after input commands have -
branches/newmole/source/init_defaults_preparse.cpp
r1610 r1686 12 12 #include "extinc.h" 13 13 #include "h2.h" 14 #include "mole.h"15 14 #include "wind.h" 16 15 #include "thermal.h" … … 69 68 70 69 /* holds options for trace set with atom h2 command */ 71 mole.nH2_TRACE = false;70 h2.nH2_TRACE = false; 72 71 73 72 /* option to scramble collision data */ 74 mole.lgH2_NOISE = false;75 mole.lgH2_NOISECOSMIC = false;73 h2.lgH2_NOISE = false; 74 h2.lgH2_NOISECOSMIC = false; 76 75 77 76 /* option to turn off or on gbar collisions of the collision rate, 78 77 * default is to have it on */ 79 /* turn mole.lgColl_gbar on/off with atom h2 gbar on off */80 mole.lgColl_gbar = true;78 /* turn h2.lgColl_gbar on/off with atom h2 gbar on off */ 79 h2.lgColl_gbar = true; 81 80 82 81 /* include collision rates that come from real calculations, 83 82 * off with atom h2 collisions off command */ 84 mole.lgColl_deexec_Calc = true;85 86 mole.lgColl_dissoc_coll = true;83 h2.lgColl_deexec_Calc = true; 84 85 h2.lgColl_dissoc_coll = true; 87 86 88 87 /* option to turn off H2 - grain collision & deexcitation, 89 88 * atom h2 grain collision on/off */ 90 mole.lgH2_grain_deexcitation = false;89 h2.lgH2_grain_deexcitation = false; 91 90 92 91 /* option to turn off ortho-para collisions, command ATOM H2 COLLISIONS ORTHO PARA OFF */ 93 mole.lgH2_ortho_para_coll_on = true;92 h2.lgH2_ortho_para_coll_on = true; 94 93 95 94 /* which set of H2 - He collision data to use? default is Le Bourlot Meudon set, 96 95 * set to ORNL with command 97 96 * atom H2 He collisions ORNL */ 98 mole.lgH2_He_ORNL = true;97 h2.lgH2_He_ORNL = true; 99 98 100 99 /* use 1999 or 2007 H2 - H collision set atomic data mole H2 h */ -
branches/newmole/source/init_sim_postparse.cpp
r1658 r1686 24 24 thermal.lgUnstable = false; 25 25 26 mole _Init();26 mole.init(); 27 27 mole_zero(); 28 28 -
branches/newmole/source/mole.h
r1684 r1686 129 129 double h2lim; 130 130 131 long co_nzone , iteration_co;132 133 /** total electron density in molecules */134 double comole_eden;135 136 131 } co; 137 132 138 EXTERN struct t_mole { 139 133 class Mole { 134 135 public: 136 void init(void); 140 137 141 /** limit to the ratio H2/Htot - if ratio is below this, large atom is not called */ 142 double H2_to_H_limit; 143 144 /** the number of electronic quantum states to include. 145 * To do both Lyman and Werner bands want nelec = 3 */ 146 long int n_h2_elec_states; 147 148 /** this is option to use estimates of the collision rates from g-bar approximations */ 149 /** turn mole.lgColl_gbar on/off with atom h2 gbar on off */ 150 bool lgColl_gbar; 151 152 /** this is option to turn off the calculated collision rates */ 153 bool lgColl_deexec_Calc; 154 155 /** this is option to turn off guesses of collisional dissociation rates */ 156 bool lgColl_dissoc_coll; 157 158 /** include collision rates that come from real calculations, 159 * off with atom h2 collisions off command */ 160 bool lgH2_grain_deexcitation; 161 162 /** flag to force LTE level populations, atom H2 LTE */ 163 bool lgH2_LTE; 164 165 /** option to turn off ortho-para collisions, command ATOM H2 COLLISIONS ORTHO PARA OFF */ 166 bool lgH2_ortho_para_coll_on; 167 168 /** which set of He - H2 collisions to use? default is ORNL, other 169 * is Le BOURlet */ 170 bool lgH2_He_ORNL; 171 172 /** turn on trace information */ 173 int nH2_TRACE; 174 175 /** put noise into collision rates */ 176 bool lgH2_NOISE , 177 /** noise for the CR collisions */ 178 lgH2_NOISECOSMIC; 179 180 /** this sets how fine a trace we want for atom h2 trace */ 181 int nH2_trace_final , 182 nH2_trace_iterations , 183 nH2_trace_full, 184 nH2_trace_matrix; 185 138 long nzone , iteration; 139 186 140 /** do we include capture of molecules onto grain surfaces? default is true, 187 141 * turned off with NO GRAIN MOLECULES command */ 188 142 bool lgGrain_mole_deplete; 189 190 /** std and mean for the noise, log normal distribution */191 double xMeanNoise , xSTDNoise;192 143 193 144 /** flag saying whether an element is in the chemistry network */ … … 195 146 196 147 realnum eden_f, grain_area; 148 149 /** total charge in molecules */ 150 double elec; 197 151 198 152 /** these are source and sink terms for the ionization ladder, for chemical … … 205 159 *snk; 206 160 realnum ***xMoleChTrRate;/***[LIMELM][LIMELM+1][LIMELM+1];*/ 207 } mole; 161 }; 162 163 extern Mole mole; 208 164 209 165 enum {CHARS_SPECIES=7}; … … 214 170 char label[CHARS_SPECIES]; /** molecule name */ 215 171 int nElem[LIMELM]; /** number of each element in molecule */ 216 int nElec; /* Charge on species/number of e- liberated by formation */172 int charge; /* Charge on species/number of e- liberated by formation */ 217 173 int Excit; /* Is species excited (e.g. H2*) */ 218 174 bool lgGas_Phase; /** Solid or gas phase? */ -
branches/newmole/source/mole_co_drive.cpp
r1658 r1686 178 178 * to converge the molecules - there will be problems during initial 179 179 * search so do not print anything in this case */ 180 lgFirstTry = (nzone== co.co_nzone && iteration==co.iteration_co);180 lgFirstTry = (nzone==mole.nzone && iteration==mole.iteration); 181 181 182 182 /* did the molecule network have negative pops? */ … … 271 271 /* >>chng 05 jul 15, do not init if we have never evaluated CO in this iteration 272 272 * and we are below limit where it should be evaluated */ 273 if( iteration!= co.iteration_co&&273 if( iteration!=mole.iteration && 274 274 hmi.H2_total/dense.gas_phase[ipHYDROGEN] < h2lim ) 275 275 { 276 276 return; 277 277 } 278 else if( co.iteration_co< 0 || lgMoleZeroed )278 else if( mole.iteration < 0 || lgMoleZeroed ) 279 279 { 280 280 … … 290 290 291 291 /* set iteration flag */ 292 co.iteration_co= iteration;293 co.co_nzone = nzone;292 mole.iteration = iteration; 293 mole.nzone = nzone; 294 294 295 295 /* for constant pressure models when molecules are reset on second … … 302 302 iteration,nzone,hmi.H2_total/dense.gas_phase[ipHYDROGEN]); 303 303 } 304 else if( iteration > co.iteration_co)304 else if( iteration > mole.iteration ) 305 305 { 306 306 realnum ratio = dense.gas_phase[ipHYDROGEN] / hden_save_prev_call; … … 313 313 } 314 314 315 co.iteration_co= iteration;316 co.co_nzone = nzone;315 mole.iteration = iteration; 316 mole.nzone = nzone; 317 317 318 318 if( DEBUG_MOLECAVER ) … … 322 322 hmi.H2_total/dense.gas_phase[ipHYDROGEN]); 323 323 } 324 else if( iteration == co.iteration_co && nzone==co.co_nzone+1 )324 else if( iteration == mole.iteration && nzone==mole.nzone+1 ) 325 325 { 326 326 /* this branch, second zone with solution, so save previous … … 331 331 } 332 332 333 co.co_nzone = -2;333 mole.nzone = -2; 334 334 hden_save_prev_call = dense.gas_phase[ipHYDROGEN]; 335 335 -
branches/newmole/source/mole_co_etc.cpp
r1683 r1686 51 51 struct molecule **groupspecies; 52 52 53 Mole mole; 54 53 55 /*=================================================================*/ 54 /* CO_Init called from cdInit to initialize CO routines */55 void mole_Init(void)56 /*mole_Init called from cdInit to initialize CO routines */ 57 void Mole::init(void) 56 58 { 57 59 long int i, … … 59 61 struct molecule *sp; 60 62 static realnum one=1.0; 61 static bool lg CO_Init_called=false;63 static bool lgmole_Init_called=false; 62 64 63 65 DEBUG_ENTRY( "mole_Init()" ); … … 65 67 /* these tell the molecular solver what zone and iteration it has 66 68 * been evaluated on */ 67 co.co_nzone = -2;68 co.iteration_co= -2;69 mole.nzone = -2; 70 mole.iteration = -2; 69 71 70 72 /* prevent memory leaks */ 71 73 /* \todo this is a temporary fix for PR14. We should improve the overall design 72 74 * of this code to prevent valid pointers being overwritten in a second call to mole_Init */ 73 if( lg CO_Init_called )75 if( lgmole_Init_called ) 74 76 { 75 77 return; … … 77 79 78 80 /* say that we have been called */ 79 lg CO_Init_called = true;81 lgmole_Init_called = true; 80 82 81 83 for(nelem=ipHYDROGEN; nelem<LIMELM; ++nelem ) … … 227 229 /* Add passive species to complete network */ 228 230 sp = newspecies("e- ",OTHER,MOLE_PASSIVE,&(mole.eden_f),0.00e+00, 0.0f); 229 sp-> nElec= -1; sp->mole_mass = (realnum)ELECTRON_MASS; /* Augment properties for this non-molecular species */231 sp->charge = -1; sp->mole_mass = (realnum)ELECTRON_MASS; /* Augment properties for this non-molecular species */ 230 232 sp = newspecies("grn ",OTHER,MOLE_PASSIVE,&(mole.grain_area),0.00e+00, 0.0f); 231 233 sp = newspecies("PHOTON",OTHER,MOLE_PASSIVE,&one,0.00e+00, 0.0f); … … 317 319 } 318 320 } 319 if(sp-> nElec < N_MOLE_ION && sp->nElec>= 0)320 { 321 element_list[nelem]->ipMl[sp-> nElec] = i;321 if(sp->charge < N_MOLE_ION && sp->charge >= 0) 322 { 323 element_list[nelem]->ipMl[sp->charge] = i; 322 324 } 323 325 } … … 382 384 mol->nElem[nelem] = 0; 383 385 } 384 mol-> nElec= mol->Excit = 0;386 mol->charge = mol->Excit = 0; 385 387 mol->mole_mass = 0.0; 386 388 mol->state = state; … … 418 420 n = 1; 419 421 if(*s == '+') 420 mol-> nElec= n;422 mol->charge = n; 421 423 else 422 mol-> nElec= -n;424 mol->charge = -n; 423 425 *s = '\0'; 424 426 } … … 653 655 total_molecule_elems(dense.xMolecules); 654 656 657 /* add on molecules */ 658 mole.elec = 0.; 659 for(i=0;i<mole.num_calc;i++) 660 { 661 if (COmole[i]->n_nuclei > 1 || COmole[i]->charge < 0) 662 mole.elec += COmole[i]->hevmol*COmole[i]->charge; 663 } 664
