Show
Ignore:
Timestamp:
05/10/08 09:03:02 (2 months ago)
Author:
peter
Message:

Merging all changes from mainline upto r2033, except r1902.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/c08_branch/source/iso_solve.cpp

    r1822 r2034  
    88#include "conv.h" 
    99#include "dense.h" 
     10#include "opacity.h" 
    1011#include "elementnames.h" 
    1112#include "h2.h" 
     
    2122#include "thermal.h" 
    2223#include "trace.h" 
    23  
    24 /*lint -e662 creation of  out of bound pointer */ 
    25 /*lint -e661 creation of  out of bound pointer */ 
    2624 
    2725/* iso_solve main routine to call iso_level and determine iso level balances */ 
     
    3937                error; 
    4038        static bool lgFinitePop[LIMELM]; 
    41         static bool lgMustInit=true
     39        static bool lgMustInit[NISO]={true, true}
    4240        bool lgH_chem_conv; 
    4341        int loop_H_chem; 
     
    4745        DEBUG_ENTRY( "iso_solve()" ); 
    4846 
    49         if( lgMustInit
     47        if( lgMustInit[ipISO]
    5048        { 
    5149                for( nelem=ipHELIUM; nelem<LIMELM; ++nelem ) 
    5250                        lgFinitePop[nelem] = true; 
    53                 lgMustInit = false; 
    5451        } 
    5552 
     
    8380                /** \todo       2       remove this when this routine really controls helium itself */ 
    8481                fixit();  /* why does this routine not control helium?  Shouldn't it? */ 
     82                // can just remove these entirely?, only applies to helium itself anyway. 
    8583                lowsav = dense.IonLow[ipHELIUM]; 
    8684                ihisav = dense.IonHigh[ipHELIUM]; 
     
    111109                                if( iso.lgRandErrGen[ipISO] && nzone==0 && !iso.lgErrGenDone[ipISO][nelem] ) 
    112110                                { 
    113                                         iso_error_generation(ipISO, nelem); 
     111                                        iso_error_generation(ipISO, nelem ); 
    114112                                } 
    115113 
    116114                                /* evaluate recombination rates */ 
    117115                                iso_radiative_recomb( ipISO , nelem ); 
     116 
     117                                if( opac.lgRedoStatic ) 
     118                                { 
     119                                        if( nelem<=ipHELIUM ) 
     120                                        { 
     121                                                iso_collapsed_bnl_set( ipISO, nelem ); 
     122 
     123                                                //iso_collapsed_bnl_print( ipISO, nelem ); 
     124 
     125                                                iso_collapsed_Aul_update( ipISO, nelem ); 
     126 
     127                                                iso_collapsed_lifetimes_update( ipISO, nelem ); 
     128 
     129                                                iso_cascade( ipISO, nelem ); 
     130 
     131                                                iso_radiative_recomb_effective( ipISO, nelem ); 
     132                                        } 
     133                                        else 
     134                                        { 
     135                                                iso_cascade( ipISO, nelem ); 
     136 
     137                                                iso_radiative_recomb_effective( ipISO, nelem ); 
     138                                        } 
     139                                } 
    118140 
    119141                                /* evaluate state specific creation and destruction processes, 
     
    140162 
    141163                                iso.pop_ion_ov_neut[ipISO][nelem] = 0.; 
    142                                 if( ipISO==ipHE_LIKE ) 
    143                                         iso.xIonSimple[ipISO][nelem] = 0.; 
     164                                iso.xIonSimple[ipISO][nelem] = 0.; 
    144165 
    145166                                /* zero it out since no population*/ 
     
    175196                } 
    176197        } 
     198 
     199        /* setting this flag false means that we have been through this loop at least once already. */   
     200        lgMustInit[ipISO] = false; 
    177201 
    178202        if( ipISO == ipHE_LIKE ) 
     
    473497        /* first dimension is multiplicity */ 
    474498        char chSpin[3][9]= {"singlets", "doublets", "triplets"}; 
    475         char chISO[2][8]= {"H-like", "He-like"}; 
    476499 
    477500#define ITEM_TO_PRINT(A_)       ( lgPrtDeparCoef ? iso.DepartCoef[ipISO][nelem][A_] : StatesElem[ipISO][nelem][A_].Pop ) 
     
    495518                /* give element number and spin */ 
    496519                fprintf(ioQQQ," %s %s  %s %s\n", 
    497                         chISO[ipISO], 
     520                        iso.chISO[ipISO], 
    498521                        elementnames.chElementSym[nelem], 
    499522                        chSpin[is-1], 
     
    501524 
    502525                /* header with the l states */ 
    503                 fprintf(ioQQQ," n\\l=>         "); 
     526                fprintf(ioQQQ," n\\l=>    "); 
    504527                for( i =0; i < nResolved; ++i) 
    505528                { 
    506                         fprintf(ioQQQ,"%2ld       ",i); 
     529                        fprintf(ioQQQ,"%2ld         ",i); 
    507530                } 
    508531                fprintf(ioQQQ,"\n"); 
     
    514537                                continue; 
    515538 
    516                         fprintf(ioQQQ," %2ld           ",in); 
     539                        fprintf(ioQQQ," %2ld      ",in); 
    517540 
    518541                        for( il = 0; il < in; ++il) 
     
    520543                                if( ipISO==ipHE_LIKE && (in==2) && (il==1) && (is==3) ) 
    521544                                { 
    522                                         fprintf( ioQQQ,PrintEfmt("%9.2e", ITEM_TO_PRINT(ipHe2p3P0) )); 
    523                                         fprintf( ioQQQ,PrintEfmt("%9.2e", ITEM_TO_PRINT(ipHe2p3P1) )); 
    524                                         fprintf( ioQQQ,PrintEfmt("%9.2e", ITEM_TO_PRINT(ipHe2p3P2) )); 
     545                                        fprintf( ioQQQ, "%9.3e ", ITEM_TO_PRINT(ipHe2p3P0) ); 
     546                                        fprintf( ioQQQ, "%9.3e ", ITEM_TO_PRINT(ipHe2p3P1) ); 
     547                                        fprintf( ioQQQ, "%9.3e ", ITEM_TO_PRINT(ipHe2p3P2) ); 
    525548                                } 
    526549                                else 
    527550                                { 
    528551                                        ipLo = iso.QuantumNumbers2Index[ipISO][nelem][in][il][is]; 
    529                                         fprintf( ioQQQ,PrintEfmt("%9.2e", ITEM_TO_PRINT(ipLo) )); 
     552                                        fprintf( ioQQQ, "%9.3e ", ITEM_TO_PRINT(ipLo) ); 
    530553                                } 
    531554                        } 
     
    538561                in = StatesElem[ipISO][nelem][il].n; 
    539562                /* prin quan number of collapsed levels */ 
    540                 fprintf(ioQQQ," %2ld           ",in); 
    541                 fprintf( ioQQQ,PrintEfmt("%9.2e", ITEM_TO_PRINT(il) )); 
     563                fprintf(ioQQQ," %2ld      ",in); 
     564                fprintf( ioQQQ, "%9.3e ", ITEM_TO_PRINT(il) ); 
    542565                fprintf(ioQQQ,"\n"); 
    543566        } 
     
    589612        return; 
    590613} 
    591  
    592  
    593 /*lint +e662 creation of  out of bound pointer */ 
    594 /*lint +e661 creation of  out of bound pointer */