Show
Ignore:
Timestamp:
12/20/07 05:42:46 (11 months ago)
Author:
rjrw
Message:

Merged from trunk r1608:1700

Location:
branches/newmole/source
Files:
9 removed
100 modified
40 copied

Legend:

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

    r1610 r1701  
    833833        } 
    834834 
     835        /* assert grain potential */ 
     836        else if( nMatch( "GRAI", input.chCARDCAPS ) && nMatch( "POTE", input.chCARDCAPS ) ) 
     837        { 
     838                /* this flag will mean grain potential */ 
     839                strcpy( chAssertType[nAsserts] , "gp" ); 
     840                /* a label */ 
     841                strcpy( chAssertLineLabel[nAsserts], "GPot" ); 
     842                /* now get the first number on the line */ 
     843                i = 5; 
     844                /* grain bin number */ 
     845                wavelength[nAsserts] = (realnum)FFmtRead(input.chCARDCAPS ,&i, INPUT_LINE_LENGTH,&lgEOL); 
     846                /* the potential itself, in volt, always linear */ 
     847                AssertQuantity[nAsserts] = FFmtRead(input.chCARDCAPS ,&i, INPUT_LINE_LENGTH,&lgEOL); 
     848 
     849                if( lgEOL ) 
     850                { 
     851                        NoNumb(input.chOrgCard); 
     852                } 
     853 
     854                /* optional error, default available (cannot do before loop since we 
     855                 * do not know how many numbers are on line */ 
     856                AssertError[nAsserts] = FFmtRead(input.chCARDCAPS ,&i, INPUT_LINE_LENGTH,&lgEOL); 
     857                         
     858                if( lgEOL ) 
     859                { 
     860                        /* default error was set in define above */ 
     861                        AssertError[nAsserts] = DEF_ERROR; 
     862                } 
     863        } 
     864 
    835865        /* assert mean temperature, assert temperature hydrogen 2 8000 */ 
    836866        else if( nMatch("TEMP",input.chCARDCAPS ) ) 
     
    857887                        /* grains, copy 4-char string "grai" 
    858888                         * into array that will be used to get temperature after calculation */ 
    859                         strcpy( chAssertLineLabel[nAsserts], "GRAI" ); 
     889                        strcpy( chAssertLineLabel[nAsserts], "GTem" ); 
    860890                        /* this is to make sure that pointer to grain type is valid, we check 
    861891                         * that it is less than this below */ 
     
    20922122 
    20932123                        /* options are average Te for ion, temp at ill face, or temp for grain */ 
    2094                         if( strcmp( chAssertLineLabel[i], "GRAI" ) == 0 ) 
     2124                        if( strcmp( chAssertLineLabel[i], "GTem" ) == 0 ) 
    20952125                        { 
    20962126                                long nd; 
     
    21412171                        PredQuan[i] = relint; 
    21422172                        RelError[i] = 1. -  PredQuan[i]/AssertQuantity[i]; 
     2173                } 
     2174 
     2175                /* this would be grain potential in volt */ 
     2176                else if( strcmp( chAssertType[i], "gp" ) == 0 ) 
     2177                { 
     2178                        /* the minus one is because the grain types are counted from one, 
     2179                         * but stuffed into the c array, that counts from zero */ 
     2180                        long nd = (long)(wavelength[i]-1); 
     2181                        if( nd < 0 || nd >= gv.nBin ) { 
     2182                                fprintf( ioQQQ, "Illegal grain number found: %g\n" , wavelength[i] ); 
     2183                                fprintf( ioQQQ, "Use 1 for first grain that is turned on, " ); 
     2184                                fprintf( ioQQQ, "2 for second, etc....\n" ); 
     2185                                fprintf( ioQQQ, "Old style grain numbers are not valid anymore !!\n" ); 
     2186                                puts( "[Stop in ParseAssertResults]" ); 
     2187                                cdEXIT(EXIT_FAILURE); 
     2188                        } 
     2189 
     2190                        /* get average grain potential in volt, always averaged over radius */ 
     2191                        PredQuan[i] = gv.bin[nd]->avdpot/radius.depth_x_fillfac; 
     2192                        /* actually absolute error, potential can be zero! */ 
     2193                        RelError[i] = AssertQuantity[i] -  PredQuan[i]; 
    21432194                } 
    21442195 
  • branches/newmole/source/atmdat_2photon.cpp

    r1610 r1701  
    311311        long int i,  
    312312          limit; 
    313         double SponRate; 
    314  
    315         double s1, s2, t1, t2, t3, p; 
    316  
     313        realnum SponRate, s1, s2, t1, t2, t3, p; 
     314         
    317315        DEBUG_ENTRY( "atmdat_2phot_rate()" ); 
    318316 
  • branches/newmole/source/atmdat_adfa.cpp

    r1610 r1701  
    55#include "physconst.h" 
    66#include "atmdat.h" 
     7#include "iso.h" 
    78 
    89/** constructor: read in all the ADfA data files */ 
     
    945946        ASSERT( ipLo < ipHi ); 
    946947 
    947         if( ipHi <= 2 )         /* n = 1,2 */ 
    948         { 
    949                 ASSERT( ipLo < 1 ); 
    950         } 
    951         else if( ipHi <= 5 )    /* n = 3 */ 
    952         { 
    953                 ASSERT( ipLo < 3 ); 
    954         } 
    955         else if( ipHi <= 9 )    /* n = 4 */ 
    956         { 
    957                 ASSERT( ipLo < 6 ); 
    958         } 
    959         else if( ipHi <= 14 )   /* n = 5 */ 
    960         { 
    961                 ASSERT( ipLo < 10 ); 
    962         } 
    963         else 
    964                 TotalInsanity(); 
     948        long ipISO = ipH_LIKE; 
     949        long nelem = ipHYDROGEN; 
     950        ASSERT( N_(ipLo) < N_(ipHi) ); 
     951        ASSERT( N_(ipHi) <= 5 ); 
    965952 
    966953        rate = HCS[ipHi-1][ipLo][ipTe]; 
  • branches/newmole/source/atmdat_char_tran.cpp

    r1687 r1701  
    434434                atmdat.HeCharExcRecTo[ipOXYGEN][3] = 6e-10; 
    435435 
     436                /* ionization */ 
     437                /* O0 + He+ => O+ + He0 */ 
     438                /* >>refer      O0      CT      Zhao et al., ApJ, 615, 1063 */ 
     439                atmdat.HeCharExcIonOf[ipOXYGEN][0] =  
     440                        4.991E-15 * pow( phycon.te / 1e4, 0.3794 )* sexp( phycon.te/1.121E6 ) + 
     441                        2.780E-15 * pow( phycon.te / 1e4, -0.2163 )* exp( -1. * MIN2(1e7, phycon.te)/(-8.158E5) ); 
     442 
    436443                /* neon */ 
    437444                /* recombination */ 
  • branches/newmole/source/atmdat_chianti.cpp

    r1610 r1701  
    1515        DEBUG_ENTRY( "atmdat_Chianti_readin()" ); 
    1616 
    17         int intCS,intCollIndex = -10000, 
    18                 intLineCount,intsplinepts,intTranType,intxs; 
     17        int intCS,intCollIndex = -10000,intsplinepts,intTranType,intxs; 
    1918        /* type is set to 0 for non chianti and 1 for chianti*/ 
    20         long int i,j,nMolLevs,intrtct, 
    21                 intCollTran,intcollindex, 
    22                 ipLo,ipHi,intAtomicNo,intIonStage; 
    23         /*intrtct refers to radiative transitions count*/ 
    24         FILE *atmolLevDATA , *atmolTraDATA=NULL,*atmolEleColDATA=NULL,*atmolProColDATA=NULL; 
     19        long int i,j,nMolLevs,intCollTran,intcollindex,ipLo,ipHi; 
     20        FILE *atmolLevDATA , *atmolTraDATA=NULL,*atmolEleColDATA=NULL; 
    2521        realnum  fstatwt,fenergyK,fenergyWN,fWLAng,fenergy,feinsteina; 
    2622        double fScalingParam,fEnergyDiff,fGF,*xs,*spl,*spl2; 
     
    4541        long int *intNewIndex=NULL,*intOldIndex=NULL; 
    4642        int interror; 
    47         bool lgProtonData=false,lgEneLevOrder; 
     43        bool lgEneLevOrder; 
    4844 
    4945        /*This is to identify where the fields start */ 
     
    192188        if( trace.lgTrace ) 
    193189                fprintf( ioQQQ," moldat_readin opening %s:",chFilename); 
    194         /*We will set a flag here to indicate if the proton collision strengths are available */ 
    195         if( ( atmolProColDATA = fopen( chProColFilename , "r" ) ) != NULL ) 
    196         { 
    197                 lgProtonData = true; 
    198         } 
    199         else 
    200         { 
    201                 lgProtonData = false; 
    202         } 
    203190 
    204191        nMolLevs = 0; 
    205         intrtct = 0; 
    206192        lgEneLevOrder = true; 
    207193        while( read_whole_line( chLine , (int)sizeof(chLine) , atmolLevDATA ) != NULL ) 
     
    242228                        atmolTrans[intNS][ipHi][ipLo].Lo = &atmolStates[intNS][ipLo]; 
    243229                        atmolTrans[intNS][ipHi][ipLo].Hi = &atmolStates[intNS][ipHi]; 
    244                         atmolTrans[intNS][ipHi][ipLo].Emis = NULL; 
     230                        atmolTrans[intNS][ipHi][ipLo].Emis = &DummyEmis; 
    245231                } 
    246232        } 
     
    436422                fWLAng = (realnum)atof(&chLine[WOTS]); 
    437423 
    438                 fixit(); 
    439                 /* Chianti labels the H 1 2-photon transition as z wavelength of zero.   
     424                /* \todo 2 Chianti labels the H 1 2-photon transition as z wavelength of zero.   
    440425                 * Should we just ignore all of the wavelengths in this file and use the 
    441426                 * difference of level energies instead. */ 
     
    541526        /*Dummy string used for convenience*/ 
    542527        strcpy(chLine,"A"); 
    543         intLineCount = 0; 
    544528 
    545529        if(read_whole_line( chLine , (int)sizeof(chLine)  ,atmolEleColDATA ) == NULL ) 
     
    563547                bool lgEOL; 
    564548 
    565                 intAtomicNo = (long)FFmtRead( chLine, &i, sizeof(chLine), &lgEOL ); 
    566                 intIonStage = (long)FFmtRead( chLine, &i, sizeof(chLine), &lgEOL ); 
     549                (void)FFmtRead( chLine, &i, sizeof(chLine), &lgEOL ); // intAtomicNo 
     550                (void)FFmtRead( chLine, &i, sizeof(chLine), &lgEOL ); // intIonStage 
    567551                /* level indices */ 
    568552                ipLo = (long)FFmtRead( chLine, &i, sizeof(chLine), &lgEOL ) - 1; 
  • branches/newmole/source/atmdat_lamda.cpp

    r1610 r1701  
    127127                        atmolTrans[intNS][ipHi][ipLo].Lo = &atmolStates[intNS][ipLo]; 
    128128                        atmolTrans[intNS][ipHi][ipLo].Hi = &atmolStates[intNS][ipHi]; 
    129                         atmolTrans[intNS][ipHi][ipLo].Emis = NULL; 
     129                        atmolTrans[intNS][ipHi][ipLo].Emis = &DummyEmis; 
    130130                } 
    131131        } 
  • branches/newmole/source/atmdat_readin.cpp

    r1653 r1701  
    383383                TauLines[i].Hi = AddState2Stack(); 
    384384                TauLines[i].Lo = AddState2Stack(); 
    385                 TauLines[i].Emis = AddLine2Stack(); 
     385                TauLines[i].Emis = AddLine2Stack( true ); 
    386386        } 
    387387 
     
    602602                        TauLine2[i].Hi = AddState2Stack(); 
    603603                        TauLine2[i].Lo = AddState2Stack(); 
    604                         TauLine2[i].Emis = AddLine2Stack(); 
     604                        TauLine2[i].Emis = AddLine2Stack( true ); 
    605605                } 
    606606 
     
    937937                UTALines[i].Hi = AddState2Stack(); 
    938938                UTALines[i].Lo = AddState2Stack(); 
    939                 UTALines[i].Emis = AddLine2Stack(); 
     939                UTALines[i].Emis = AddLine2Stack( true ); 
    940940        } 
    941941 
     
    14111411                C12O16Rotate[J].Hi = AddState2Stack(); 
    14121412                C12O16Rotate[J].Lo = AddState2Stack(); 
    1413                 C12O16Rotate[J].Emis = AddLine2Stack(); 
     1413                C12O16Rotate[J].Emis = AddLine2Stack( true ); 
    14141414 
    14151415                TransitionJunk( &C13O16Rotate[J] ); 
    14161416                C13O16Rotate[J].Hi = AddState2Stack(); 
    14171417                C13O16Rotate[J].Lo = AddState2Stack(); 
    1418                 C13O16Rotate[J].Emis = AddLine2Stack(); 
     1418                C13O16Rotate[J].Emis = AddLine2Stack( true ); 
    14191419        } 
    14201420 
  • branches/newmole/source/atom_feii.cpp

    r1610 r1701  
    406406 
    407407                        Fe2LevN[ipHi][ipLo].Hi = Fe2LevN[ipHi][0].Hi; 
    408                         Fe2LevN[ipHi][ipLo].Emis = AddLine2Stack(); 
     408                        Fe2LevN[ipHi][ipLo].Emis = AddLine2Stack( true ); 
    409409                } 
    410410        } 
  • branches/newmole/source/atom_hyperfine.cpp

    r1610 r1701  
    419419                HFLines[i].Hi = AddState2Stack(); 
    420420                HFLines[i].Lo = AddState2Stack(); 
    421                 HFLines[i].Emis = AddLine2Stack(); 
     421                HFLines[i].Emis = AddLine2Stack( true ); 
    422422        } 
    423423 
  • branches/newmole/source/cddefines.h

    r1610 r1701  
    839839// ARPA_TYPE: arrays of pointers to arrays ... 
    840840// C_TYPE: row-major order, exactly as used in C (last index runs fastest) 
    841 typedef enum { ARPA_TYPE, C_TYPE, GEN_TYPE, ML_TOP } mem_layout; 
     841typedef enum { ARPA_TYPE, C_TYPE, FLX_TYPE, ML_TOP } mem_layout; 
    842842 
    843843// magic numbers to identify each memory layout 
     
    13981398                { 
    13991399                        if( _ptr != NULL ) 
    1400                                 free(_