Changeset 2276

Show
Ignore:
Timestamp:
07/28/08 01:45:32 (6 months ago)
Author:
gary
Message:

Lya maser drives negative solution to 21 cm levels - add ticket on this - current solution is to consider only non-negative Lya photon occupation numbers

Location:
trunk/source
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/source/atom_hyperfine.cpp

    r2271 r2276  
    1010/*H21cm_proton - evaluate proton spin changing H atom collision rate, */ 
    1111#include "cddefines.h" 
     12#include "conv.h" 
    1213#include "lines_service.h" 
    1314#include "phycon.h" 
     
    6061        ASSERT( a21>0. ); 
    6162 
    62         /* >>chng 04 dec 01, add hyperfine.lgLya_pump_21cm, option to turn off Lya pump 
    63          * of 21 cm, with no 21cm lya pump */ 
     63        /* hyperfine.lgLya_pump_21cm is option to turn off Lya pump 
     64         * of 21 cm, with no 21cm lya pump command - note that this 
     65         * can be negative if Lya mases - can occur during search phase */ 
    6466        occnu_lya = OccupationNumberLine( &Transitions[ipH_LIKE][ipHYDROGEN][ipH2p][ipH1s] ) * 
    6567                hyperfine.lgLya_pump_21cm; 
    66  
    67         /* >>chng 05 apr 20, GS, the lya occupation number for the hyperfine levels 0S1/2 and 1S1/2 are different*/ 
     68        if( occnu_lya<0 ) 
     69        { 
     70                static bool lgCommentDone = false; 
     71                /* Lya is masing - could be due to very bad solution in search phase */ 
     72                if( !conv.lgSearch && !lgCommentDone ) 
     73                { 
     74                        fprintf(ioQQQ, 
     75                        "NOTE Lya masing will invert 21 cm, occupation number set zero\n"); 
     76                        lgCommentDone = true; 
     77                } 
     78                occnu_lya = 0.; 
     79        } 
     80 
     81        /* Lya occupation number for the hyperfine levels 0S1/2 and 1S1/2 are different*/ 
    6882        texc = TexcLine( &Transitions[ipH_LIKE][ipHYDROGEN][ipH2p][ipH1s] ); 
    69         /* >>chng 05 apr 21, GS, Energy difference between 2p1/2 and 2p3/2 is taken from NSRDS */ 
     83        /* Energy difference between 2p1/2 and 2p3/2 taken from NSRDS */ 
    7084        if( texc > 0. ) 
    7185        { 
    72                 /* convert to boltz factor, which will applied to occupation number of hiher energy transition */ 
     86                /* convert to Boltzmann factor, which will applied to occupation  
     87                 * number of higher energy transition */ 
    7388                texc1 = sexp(0.068/texc); 
    7489                texc2 = sexp(((82259.272-82258.907)*T1CM)/texc); 
     
    134149        HFLines[0].Hi->Pop = (x/(1.+x))* PopTot; 
    135150        HFLines[0].Lo->Pop = (1./(1.+x))* PopTot; 
     151        ASSERT( HFLines[0].Hi->Pop >0. ); 
     152        ASSERT( HFLines[0].Lo->Pop >0. ); 
    136153 
    137154        /* the population with correction for stimulated emission */ 
     
    140157        /* number of escaping line photons, used elsewhere for outward beam */ 
    141158        HFLines[0].Emis->phots = a21*HFLines[0].Hi->Pop; 
    142  
     159        ASSERT( HFLines[0].Emis->phots >= 0. ); 
    143160        /* intensity of line */ 
    144161        HFLines[0].Emis->xIntensity = HFLines[0].Emis->phots*HFLines[0].EnergyErg; 
  • trunk/source/lines_service.cpp

    r2267 r2276  
    142142        ASSERT( t->ipCont > 0 ); 
    143143 
    144         /* routine to evaluate line photon occupation number */ 
    145         if( t->Lo->Pop > SMALLFLOAT ) 
     144        /* routine to evaluate line photon occupation number -  
     145         * return negative number if line is maser */ 
     146        if( fabs(t->Emis->PopOpc) > SMALLFLOAT ) 
    146147        { 
    147148                /* the lower population with correction for stimulated emission */ 
    148                 double PopLo_corr = t->Lo->Pop / t->Lo->g - t->Hi->Pop / t->Hi->g; 
    149                 OccupationNumberLine_v = ( t->Hi->Pop / t->Hi->g )/SDIV(PopLo_corr ) * 
     149                OccupationNumberLine_v = ( t->Hi->Pop / t->Hi->g ) / 
     150                        ( t->Emis->PopOpc / t->Lo->g ) * 
    150151                        (1. - t->Emis->Pesc); 
    151152        } 
     
    154155                OccupationNumberLine_v = 0.; 
    155156        } 
     157        /* return value is not guaranteed to be positive - negative if 
     158         * line mases */ 
    156159        return( OccupationNumberLine_v ); 
    157160} 
     
    407410  transition * t) 
    408411{ 
    409  
    410412        DEBUG_ENTRY( "PutCS()" ); 
    411413 
    412         /* collision strength must not be negative, had been test for being positive, 
    413          * but called with zero - did not check why 98 jul 5 */ 
    414         ASSERT( cs >= 0. ); 
     414        /* collision strength must be negative */ 
     415        ASSERT( cs > 0. ); 
    415416 
    416417        t->Coll.col_str = (realnum)cs; 
     418 
    417419        return; 
    418420}