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

Merging all changes from mainline upto r2033, except r1902.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/c08_branch/source/iso_cool.cpp

    r1822 r2034  
    1212#include "cooling.h" 
    1313#include "iso.h" 
    14 /*lint -e661 Possible access of out-of-bounds pointer*/ 
    15 /*lint -e662  (Warning -- Possible creation of out-of-bounds pointer  */ 
    1614 
    1715/* HP cc cannot compile this routine with any optimization */  
     
    6159        char chLabel[NCOLNT_LAB_LEN+1]; 
    6260 
    63         /* these are labels for iso line cooling, sum of ALL hydrogen lines, 
    64          * along the iso sequence 
    65         static char chHlin[LIMELM][5]= 
    66         {"Hl 0","Hl 1","Hl 2","Hl 3","Hl 4","Hl 5","Hl 6","Hl 7","Hl 8","Hl 9", 
    67          "Hl10","Hl11","Hl12","Hl13","Hl14","Hl15","Hl16","Hl17","Hl18","Hl19", 
    68          "Hl20","Hl21","Hl22","Hl23","Hl24","Hl25","Hl26","Hl27","Hl28","Hl29"}; */ 
    69  
    70         /* these are labels for iso collisional ionization cooling, 
    71          * along the iso sequence 
    72         static char chHion[LIMELM][5]= 
    73         {"Hi 0","Hi 1","Hi 2","Hi 3","Hi 4","Hi 5","Hi 6","Hi 7","Hi 8","Hi 9", 
    74          "Hi10","Hi11","Hi12","Hi13","Hi14","Hi15","Hi16","Hi17","Hi18","Hi19", 
    75          "Hi20","Hi21","Hi22","Hi23","Hi24","Hi25","Hi26","Hi27","Hi28","Hi29"}; */ 
    76  
    77         /* these are labels for iso photoionization heating, 
    78          * along the iso sequence  
    79         static char chHp[LIMELM][5]= 
    80         {"Hp 0","Hp 1","Hp 2","Hp 3","Hp 4","Hp 5","Hp 6","Hp 7","Hp 8","Hp 9", 
    81          "Hp10","Hp11","Hp12","Hp13","Hp14","Hp15","Hp16","Hp17","Hp18","Hp19", 
    82          "Hp20","Hp21","Hp22","Hp23","Hp24","Hp25","Hp26","Hp27","Hp28","Hp29"};*/ 
    83  
    84         /* these are labels for iso induced recombination heating, 
    85          * along the iso sequence 
    86         static char chHn[LIMELM][5]= 
    87         {"Hn 0","Hn 1","Hn 2","Hn 3","Hn 4","Hn 5","Hn 6","Hn 7","Hn 8","Hn 9", 
    88          "Hn10","Hn11","Hn12","Hn13","Hn14","Hn15","Hn16","Hn17","Hn18","Hn19", 
    89          "Hn20","Hn21","Hn22","Hn23","Hn24","Hn25","Hn26","Hn27","Hn28","Hn29"}; */ 
    90  
    9161        DEBUG_ENTRY( "iso_cool()" ); 
    9262 
     
    160130         * and its coupling to continuum can be large, at various times code  
    161131         * had to ignore effects of very highest level, but starting in mid 
    162          * 20006 all levels have been included */ 
    163         for( n=0; n < iso.numLevels_local[ipISO][nelem]; ++n ) 
     132         * 20006 all levels have been included  
     133         * 2008 apr 18, do not include highest - when only 2 collapsed levels 
     134          * are used several density 13 BLR sims have serious convergence 
     135          * problems */ 
     136        for( n=0; n < iso.numLevels_local[ipISO][nelem]-1; ++n ) 
    164137        { 
    165138                /* total collisional ionization cooling less three body heating */ 
     
    168141                  (StatesElem[ipISO][nelem][n].Pop -iso.PopLTE[ipISO][nelem][n]*dense.eden); 
    169142                CollisIonizatCoolingTotal += CollisIonizatCooling; 
    170                 /*fprintf(ioQQQ,"DEBUG CollisIonizatCoolingTotal %.2e %2li %2li %2li %.2e %.4e %.4e %.3f\n", 
    171                         CollisIonizatCoolingTotal, 
    172                         ipISO , nelem , n , 
    173                         CollisIonizatCooling ,  
    174                         StatesElem[ipISO][nelem][n].Pop , 
    175                         iso.PopLTE[ipISO][nelem][n]*dense.eden , 
    176                         fabs(StatesElem[ipISO][nelem][n].Pop - iso.PopLTE[ipISO][nelem][n]*dense.eden ) /  
    177                             (iso.PopLTE[ipISO][nelem][n]*dense.eden) );*/ 
    178143 
    179144                /* the derivative of the cooling  
    180145                 * need extra factor of temp of 1 Ryd since div by square of temp in Ryd */ 
    181146                CollisIonizatCoolingDT = CollisIonizatCooling* 
    182                         (iso.xIsoLevNIonRyd[ipISO][nelem][n]/TE1RYD/POW2(phycon.te_ryd)/* -  
    183                   thermal.halfte*/); 
     147                        (iso.xIsoLevNIonRyd[ipISO][nelem][n]/TE1RYD/POW2(phycon.te_ryd)); 
     148 
    184149                dCollisIonizatCoolingTotalDT += CollisIonizatCoolingDT; 
    185150                // save values for debug printout 
     
    280245                 thin = iso.RadRecomb[ipISO][nelem][0][ipRecRad]* 
    281246                        /* arg is the scaled temperature, T * n^2 / Z^2,  
    282                          * n is principle quantum number, Z is charge, 1 for H */ 
     247                         * n is principal quantum number, Z is charge, 1 for H */ 
    283248                        HCoolRatio(  
    284249                        phycon.te * POW2( (double)StatesElem[ipISO][nelem][0].n / (double)(nelem+1-ipISO) ))* 
     
    297262                 thin = iso.RadRecomb[ipISO][nelem][n][ipRecRad]* 
    298263                        /* arg is the scaled temperature, T * n^2 / Z^2,  
    299                          * n is principle quantum number, Z is charge, 1 for H */ 
     264                         * n is principal quantum number, Z is charge, 1 for H */ 
    300265                        HCoolRatio(  
    301266                        phycon.te * POW2( (double)StatesElem[ipISO][nelem][n].n / (double)(nelem+1-ipISO) ))* 
     
    316281                if( DEBUG_LOC  ) 
    317282                { 
    318                         if( nelem==1 && ipISO==ipHE_LIKE) 
     283                        if( nelem==ipISO ) 
    319284                        { 
    320285                                /* >>chng 06 aug 17, should go to numLevels_local instead of _max. */ 
     
    526491 
    527492                        iso.xLineTotCool[ipISO][nelem] += hlone; 
    528                         { 
    529                                 /* debug block for collisional cooling between two levels */ 
    530                                 enum {DEBUG_LOC=false}; 
    531                                 if( DEBUG_LOC && ipISO==ipHE_LIKE && nelem==ipHELIUM /**/ ) 
    532                                 { 
    533                                         fprintf(ioQQQ,"iso_coolll %li %li %.2e %.2e %.2e %.2e\n", 
    534                                                 ipHi , ipLo,  
    535                                                 StatesElem[ipISO][nelem][ipHi].Pop , 
    536                                                 Transitions[ipISO][nelem][ipHi][ipLo].Coll.ColUL ,  
    537                                                 Transitions[ipISO][nelem][ipHi][ipLo].Coll.cs ,  
    538                                                 hlone/SDIV( thermal.htot ) ); 
    539                                 } 
    540                         } 
    541493 
    542494                        /* next get derivative */ 
     
    569521                if( DEBUG_LOC ) 
    570522                { 
    571                         if( ipISO==ipHE_LIKE && nelem==ipHELIUM ) 
     523                        if( nelem==ipISO ) 
    572524                                fprintf(ioQQQ,"%li %li %.2e\n", nlo_heat_max, nhi_heat_max, heat_max ); 
    573525                } 
     
    655607        if( iso.xLineTotCool[ipISO][nelem] > 0. ) 
    656608        { 
    657                 /* hydrogen is a net coolant label gives iso sequence, "wavelength" gives element */ 
     609                /* species is a net coolant label gives iso sequence, "wavelength" gives element */ 
    658610                CoolAdd(chLabel,(realnum)nelem,iso.xLineTotCool[ipISO][nelem]); 
    659611                thermal.dCooldT += dCdT_all; 
     
    662614        else 
    663615        { 
    664                 /* hydrogen is a net heat source, thermal.heating[0][23]was set to 0 in CoolEvaluate*/ 
     616                /* species is a net heat source, thermal.heating[0][23]was set to 0 in CoolEvaluate*/ 
    665617                thermal.heating[0][23] -= iso.xLineTotCool[ipISO][nelem]; 
    666618                CoolAdd(chLabel,(realnum)nelem,0.); 
     
    681633                                        iso.cBal_cool[ipISO][nelem]/iso.xLineTotCool[ipISO][nelem] , 
    682634                                        iso.cRest_cool[ipISO][nelem]/iso.xLineTotCool[ipISO][nelem] ); 
    683  
    684 #                               if 0 
    685                                 if( iso.cLya_cool[ipISO][nelem]/iso.xLineTotCool[ipISO][nelem] > 0.9 ) 
    686                                 fprintf(ioQQQ," 1s 2s 2p %.2e %.2e %.2e\n", 
    687                                         StatesElem[ipISO][nelem][ipH1s].Pop ,  
    688                                         StatesElem[ipISO][nelem][ipH2s].Pop , 
    689                                         StatesElem[ipISO][nelem][ipH2p].Pop); 
    690  
    691 #                               endif 
    692635                        } 
    693636                } 
     
    756699#pragma OPTIMIZE ON 
    757700#endif 
    758 /*lint +e661 Possible access of out-of-bounds pointer*/ 
    759 /*lint +e662 (Warning -- Possible creation of out-of-bounds pointer  */