Show
Ignore:
Timestamp:
02/19/08 15:23:09 (9 months ago)
Author:
rjrw
Message:

Merge from trunk r1800:1803

Correct iso_level handling of molecular sources, along lines of Ryan's
fix to the grain charge transfer.

Location:
branches/newmole/source
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • branches/newmole/source/ion_solver.cpp

    r1780 r1804  
    246246                low = dense.IonLow[nelem]; 
    247247 
    248                 for( ion_to=low; ion_to <= limit; ion_to++ ) 
     248                for( ion_to=low; ion_to <= dense.IonHigh[nelem]; ion_to++ ) 
    249249                { 
    250250                        for( ion_from=dense.IonLow[nelem]; ion_from <= dense.IonHigh[nelem]; ++ion_from ) 
  • branches/newmole/source/iso_ionize_recombine.cpp

    r1800 r1804  
    77#include "atmdat.h" 
    88#include "dense.h" 
    9 #include "grainvar.h" 
    109#include "hmi.h" 
    1110#include "mole.h" 
     
    115114        long int nelem ) 
    116115{ 
    117         long int level, 
    118                 ion; 
    119         double Recom3Body, 
    120                 sum; 
     116        long int level; 
     117        double Recom3Body; 
    121118 
    122119        DEBUG_ENTRY( "iso_ionize_recombine()" ); 
     
    167164        /* all following go into or out of ground state */ 
    168165        level = 0; 
    169  
    170         /* grain charge transfer recombination and ionization,  
    171          * assume goes into and comes from ground state */ 
    172         /* first grain surface losses - both to lower and higher stages of ionization */ 
    173         sum = 0.; 
    174         for(ion=0; ion<nelem+1; ++ion ) 
    175                 if( ion!=nelem-ipISO ) 
    176                         sum += gv.GrainChTrRate[nelem][nelem-ipISO][ion]; 
    177         /*>>chng 04 sep 08, replaced grain ct rate from old sum with current sum */ 
    178         iso.RateLevel2Cont[ipISO][nelem][level] += sum; 
    179  
    180         /* >>chng 04 apr 10, add formally correct grain surface ionization and recombination -  
    181          * this HAD NOT been included for H-like species */ 
    182         /* >>chng 04 sep 08, use explicit term from higher stage of ionization - note that added 
    183          * GrainCreat[nelem][nelem-ipISO] for case of atomic He incorrectly added two-stage recombination 
    184          * to existing matrix logic */ 
    185         /*iso.RateCont2Level[ipISO][nelem][level] += ionbal.GrainCreat[nelem][nelem-ipISO];*/ 
    186         iso.RateCont2Level[ipISO][nelem][level] += gv.GrainChTrRate[nelem][nelem+1-ipISO][nelem-ipISO]; 
    187  
    188         for(ion=0; ion<nelem+1; ++ion) 
    189                 if ( ion < nelem-ipISO ) 
    190                         iso.RateLevel2Cont[ipISO][nelem][level] += mole.xMoleChTrRate[nelem][nelem-ipISO][ion]; 
    191                 else if ( ion > nelem-ipISO ) 
    192                         iso.RateCont2Level[ipISO][nelem][level] += mole.xMoleChTrRate[nelem][ion][nelem-ipISO]; 
    193166 
    194167        /* now charge transfer - all into/from ground, two cases, H and not H */ 
  • branches/newmole/source/iso_level.cpp

    r1800 r1804  
    99#include "dynamics.h" 
    1010#include "elementnames.h" 
     11#include "grainvar.h" 
    1112#include "he.h" 
    1213#include "helike.h" 
     
    246247                { 
    247248                        /* all process depopulating level and placing into the continuum 
    248                          * this includes grain charge transfer ionization */ 
     249                         * this does NOT include grain charge transfer ionization, added below */ 
    249250                        z[level][level] = iso.RateLevel2Cont[ipISO][nelem][level]; 
    250  
     251                         
    251252                        if( ipISO == ipHE_LIKE && level == ipHe2s3S ) 
    252253                                /* >>chng 05 dec 21, rm eden to make into rate coefficient */ 
     
    353354                z[1+ipISO][1+ipISO] += iso.TwoNu_induc_dn[ipISO][nelem]*iso.lgInd2nu_On; 
    354355 
     356                /* grain charge transfer recombination and ionization to ALL other stages */ 
     357                for( long ion=0; ion<=nelem+1; ++ion ) 
     358                { 
     359                        if( ion!=nelem-ipISO ) 
     360                        { 
     361                                /* recombination must be multiplied by a ratio of densities to get proper rate. */ 
     362                                creation[0] += gv.GrainChTrRate[nelem][ion][nelem-ipISO] *  
     363                                        dense.xIonDense[nelem][ion] / SDIV(dense.xIonDense[nelem][nelem+1-ipISO]); 
     364                                z[0][0] += gv.GrainChTrRate[nelem][nelem-ipISO][ion]; 
     365                        } 
     366                } 
     367 
    355368                /* >>chng 02 Sep 06 rjrw -- all elements have these terms */ 
    356369                /*>>>chng 02 oct 01, only include if lgAdvection is set */ 
     
    372385 
    373386                /* add in source and sink terms from molecular network. */ 
    374                 if( nelem == ipISO && conv.nTotalIoniz ) 
    375                 { 
    376                         /* these are the external source and sink terms */ 
    377                         /* source first */ 
     387                if( conv.nTotalIoniz && nelem-ipISO < N_MOLE_ION) 
     388                { 
    378389                        creation[0] += mole.source[nelem][nelem-ipISO]/SDIV(dense.xIonDense[nelem][nelem+1-ipISO]); 
    379  
    380390                        for( ipLo=0; ipLo<numlevels_local; ++ipLo ) 
    381391                        { 
    382392                                z[ipLo][ipLo] += mole.sink[nelem][nelem-ipISO]; 
     393                        } 
     394                         
     395                        for( long ion=0; ion<N_MOLE_ION; ++ion ) 
     396                        { 
     397                                if( ion!=nelem-ipISO && ion < nelem+1 ) 
     398                                { 
     399                                        /* recombination must be multiplied by a ratio of densities to get proper rate. */ 
     400                                        creation[0] += mole.xMoleChTrRate[nelem][ion][nelem-ipISO] *  
     401                                                dense.xIonDense[nelem][ion] / SDIV(dense.xIonDense[nelem][nelem+1-ipISO]); 
     402                                        for( ipLo=0; ipLo<numlevels_local; ++ipLo ) 
     403                                        { 
     404                                                z[ipLo][ipLo] += mole.xMoleChTrRate[nelem][nelem-ipISO][ion]; 
     405                                        } 
     406                                } 
    383407                        } 
    384408                }