Changeset 1918 for branches/newmole

Show
Ignore:
Timestamp:
04/06/08 04:45:19 (9 months ago)
Author:
rjrw
Message:

Merged from trunk r1833:1917

Location:
branches/newmole/source
Files:
94 modified
11 copied

Legend:

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

    r1780 r1918  
    22142214        if( called.lgTalk && nAsserts>0 ) 
    22152215        {  
    2216                 char chVer[10]; 
    22172216                time_t now; 
    2218                 cdVersion(chVer ); 
    22192217 
    22202218                /* First disambiguate any line identifications */ 
     
    22812279 
    22822280                /* write start of title and version number of code */ 
    2283                 fprintf( ioASSERT, "=============Results of asserts: C%s ",chVer ); 
     2281                fprintf( ioASSERT, "=============Results of asserts: Cloudy %s ", version::Inst().chVersion ); 
    22842282 
    22852283                /* usually print date and time info - do not if "no times" command entered,  
     
    24682466                        fprintf( ioASSERT, " BOTCHED ASSERTS!!!   Botched Asserts!!! \n"); 
    24692467                } 
    2470                 /* if botched asserts then explain how we were compiled */ 
    2471                 if( !lgAssertsOK ) 
    2472                 { 
    2473                         fprintf( ioQQQ, " %s\n\n", version.chInfo ); 
     2468 
     2469                /* explain how we were compiled, but only if printing time */ 
     2470                if( prt.lgPrintTime ) 
     2471                { 
     2472                        fprintf( ioQQQ, " %s\n\n", version::Inst().chInfo ); 
    24742473                } 
    24752474        } 
  • branches/newmole/source/atmdat_char_tran.cpp

    r1780 r1918  
    9090                } 
    9191 
    92                 /* >>chng 04 apr 27, the above included only the radiative charge transfer from 
     92                /* The above included only the radiative charge transfer from 
    9393                 * Stancil et al 1998.  must explicitly add on the ct fitted by Kingdon & Ferland, 
    94                  * the code must have originally had the KF fit, but got hosed at some point  
    95                  * these are two different sets of physics  
    96                  * He0 + H+ -> He+ + H0 */ 
     94                 * The process H0 + He+ -> He0 + H+ */ 
    9795                if( phycon.te > 6000. ) 
    98                         atmdat.HCharExcIonOf[ipHELIUM][0] += 7.47e-15*pow(phycon.te/1e4,2.06)* 
     96                        atmdat.HCharExcRecTo[ipHELIUM][0] += 7.47e-15*pow(phycon.te/1e4,2.06)* 
    9997                        (1.+9.93*sexp(3.89e-4*phycon.te) ); 
    10098 
  • branches/newmole/source/atmdat_chianti.cpp

    r1830 r1918  
    263263                strncpy(atmolStates[intNS][j].chLabel,Species[intNS].chptrSpName, 4); 
    264264                atmolStates[intNS][j].chLabel[4] = '\0'; 
     265 
     266                /*Index for keep track of species index*/ 
     267                atmolStates[intNS][j].AtmolIndex = intNS; 
    265268 
    266269                fstatwt = (realnum)atof(&chLine[SWS]); 
  • branches/newmole/source/atmdat_lamda.cpp

    r1830 r1918  
    5252        ipLo = 0; 
    5353        j = 0; 
    54         while(intlnct < 5) 
     54        while(intlnct < 3) 
    5555        { 
    5656                intlnct++; 
     
    6161                } 
    6262        } 
    63  
     63        /*Extracting out the molecular weight*/ 
     64        if(read_whole_line( chLine , (int)sizeof(chLine) , atmolLevDATA ) == NULL ) 
     65        { 
     66                fprintf( ioQQQ, " The data file %s is corrupted .\n",chEFilename); 
     67                cdEXIT(EXIT_FAILURE); 
     68        } 
     69        Species[intNS].fmolweight = (realnum)atof(chLine); 
     70 
     71        /*Discard this line*/ 
     72        if(read_whole_line( chLine , (int)sizeof(chLine) , atmolLevDATA ) == NULL ) 
     73        { 
     74                fprintf( ioQQQ, " The data file %s is corrupted .\n",chEFilename); 
     75                cdEXIT(EXIT_FAILURE); 
     76        } 
     77        /*Reading in the number of energy levels*/ 
    6478        if(read_whole_line( chLine , (int)sizeof(chLine) , atmolLevDATA ) == NULL ) 
    6579        { 
     
    127141                strncpy(atmolStates[intNS][nMolLevs].chLabel,Species[intNS].chptrSpName, 4); 
    128142                atmolStates[intNS][nMolLevs].chLabel[4] = '\0'; 
     143                /*Keeping track of species index*/ 
     144                atmolStates[intNS][nMolLevs].AtmolIndex = intNS; 
    129145 
    130146                long i = 1; 
     
    224240                /* don't need the energy in GHz, so throw it away. */ 
    225241                FFmtRead( chLine, &i, sizeof(chLine), &lgEOL ); 
    226                 fenergyK = (realnum)FFmtRead( chLine, &i, sizeof(chLine), &lgEOL ); 
    227  
     242                fenergyK = (realnum)(((atmolStates[intNS][ipHi].energy) -(atmolStates[intNS][ipLo].energy))*T1CM); 
    228243                ASSERT( index == intrtct + 1 ); 
    229244 
  • branches/newmole/source/atom_feii.cpp

    r1830 r1918  
    6060#include "atomfeii.h" 
    6161#include "iso.h" 
     62#include "pressure.h" 
    6263/*lint -e668 passing null pointer */ 
    6364 
     
    30653066                                        Fe2LevN[ipHi][ipLo].Emis->PopOpc > smallfloat ) 
    30663067                                { 
    3067                                         RadPres1 = 5.551e-2*(powi(Fe2LevN[ipHi][ipLo].EnergyWN/ 
    3068                                                 1.e6,4))*(Fe2LevN[ipHi][ipLo].Hi->Pop/Fe2LevN[ipHi][ipLo].Hi->g)/ 
    3069                                                 (Fe2LevN[ipHi][ipLo].Lo->Pop/Fe2LevN[ipHi][ipLo].Lo->g)* 
    3070                                                 RT_LineWidth(&Fe2LevN[ipHi][ipLo]); 
     3068                                        RadPres1 =  RadiationPressure( &Fe2LevN[ipHi][ipLo] ); 
     3069 
    30713070#                                       ifdef DEBUGFE 
    30723071                                        if( RadPres1 > RadMax ) 
  • branches/newmole/source/atom_oi.cpp

    r1780 r1918  
    8181        { 
    8282                /* two sided escape prob */ 
    83                 tin = Transitions[ipH_LIKE][ipHYDROGEN][ipH3p][ipH1s].Emis->TauIn +  
    84                         TauLines[ipTO1025].Emis->TauIn; 
     83                tin = TauLines[ipTO1025].Emis->TauIn; 
    8584                esin = esc_CRDwing_1side(tin,1e-4); 
    86                 tout = (Transitions[ipH_LIKE][ipHYDROGEN][ipH3p][ipH1s].Emis->TauTot +  
    87                   TauLines[ipTO1025].Emis->TauTot)*0.9 -  
    88                   Transitions[ipH_LIKE][ipHYDROGEN][ipH3p][ipH1s].Emis->TauIn -  
     85                tout = (TauLines[ipTO1025].Emis->TauTot)*0.9 -  
    8986                  TauLines[ipTO1025].Emis->TauIn; 
    9087 
    9188                if( trace.lgTr8446 && trace.lgTrace ) 
    9289                { 
    93                         fprintf( ioQQQ, "       P8446 tin, tout=%10.2e%10.2e\n",  
    94                           tin, tout ); 
     90                        fprintf( ioQQQ, "       P8446 tin, tout=%10.2e%10.2e\n", tin, tout ); 
    9591                } 
    9692 
    9793                if( tout > 0. ) 
    9894                { 
    99                         tout = Transitions[ipH_LIKE][ipHYDROGEN][ipH3p][ipH1s].Emis->TauTot +  
    100                           TauLines[ipTO1025].Emis->TauTot -  
    101                           Transitions[ipH_LIKE][ipHYDROGEN][ipH3p][ipH1s].Emis->TauIn -  
    102                           TauLines[ipTO1025].Emis->TauIn; 
     95                        tout = TauLines[ipTO1025].Emis->TauTot - TauLines[ipTO1025].Emis->TauIn; 
    10396 
    10497                        /* do not update esab if we overran optical depth scale */ 
     
    109102        { 
    110103                /* one-sided escape probability */ 
    111                 esab = esc_CRDwing_1side(Transitions[ipH_LIKE][ipHYDROGEN][ipH3p][ipH1s].Emis->TauIn+ 
    112                   TauLines[ipTO1025].Emis->TauIn,1e-4); 
     104                esab = esc_CRDwing_1side(TauLines[ipTO1025].Emis->TauIn,1e-4); 
    113105        } 
    114106 
  • branches/newmole/source/cddefines.h

    r1830 r1918  
    218218        ipHE_PLUS, 
    219219        ipALPHA, 
    220         ipATOMH, 
    221         ipHE_2PLUS, 
    222         ipH2_ORTHO, 
    223         ipH2_PARA, 
     220        //ipATOMH, 
     221        //ipHE_2PLUS, 
     222        //ipH2_ORTHO, 
     223        //ipH2_PARA, 
    224224        ipNCOLLIDER 
    225225}; 
     
    592592#       ifdef NDEBUG 
    593593#               define ASSERT(exp) ((void)0) 
     594#       elif defined ASSERTDEBUG 
     595#               define ASSERT(exp) if (!(exp)) MyAssert(__FILE__, __LINE__) 
    594596#       else 
    595597/* the do { ... } while ( 0 ) prevents bugs in code like this: 
     
    12771279        char chConfig[11]; 
    12781280 
     1281        /*Index to identify the quantum state with the species index*/ 
     1282        int AtmolIndex; 
     1283 
    12791284        species   *sp; 
    12801285 
     
    13341339        long ipCont; 
    13351340}; 
     1341 
     1342/* Explicit instantiations for debugging purposes */ 
     1343INSTANTIATE_MULTI_ARR( quantumState, MEM_LAYOUT_VAL, lgBOUNDSCHECKVAL ); 
     1344INSTANTIATE_MULTI_ARR( transition, MEM_LAYOUT_VAL, lgBOUNDSCHECKVAL ); 
    13361345 
    13371346 
  • branches/newmole/source/cddrive.cpp

    r1846 r1918  
    352352 * 
    353353 * cdVersion - puts version number of code into string  
    354  * incoming string must have at least 8 char and will become null 
     354 * incoming string must have sufficient length and will become null 
    355355 * terminated string 
    356356 * 
    357357 ************************************************************************/ 
    358358 
    359 void cdVersion(char chString[] )  
    360 { 
    361         DEBUG_ENTRY( "cdVersion()" ); 
    362  
    363         if( !lgcdInitCalled ) 
    364         { 
    365                 printf(" cdInit was not called first - this must be the first call.\n"); 
    366                 cdEXIT(EXIT_FAILURE); 
    367         } 
    368  
    369         /* version was set by cdInit */ 
    370         strcpy( chString , version.chVersion ); 
     359void cdVersion(char chString[]) 
     360{ 
     361        strcpy( chString , version::Inst().chVersion ); 
    371362        return; 
    372363} 
     
    381372 
    382373/* cdDate - puts date of code into string  */ 
    383 void cdDate(char chString[] )  
    384 { 
    385         /* date was set by cdInit */ 
    386         strcpy( chString , version.chDate ); 
     374void cdDate(char chString[]) 
     375{ 
     376        strcpy( chString , version::Inst().chDate ); 
    387377        return; 
    388378} 
     
    19451935 * this is limit to how many more commands can be read */ 
    19461936int cdRead( 
    1947         /* the string containing the commands */ 
    1948         char *chInputLine )      
     1937        /* the string containing the command */ 
     1938        const char *chInputLine )        
    19491939{ 
    19501940        char *chEOL , /* will be used to search for end of line symbols */ 
     
    19651955         * but want to include special "c " type of comment  
    19661956         * >>chng 06 sep 04 use routine to check for comments */ 
    1967         if( (lgInputComment( chInputLine ) /*( chInputLine[0]=='#') ||  
    1968                  (chInputLine[0]=='%') || 
    1969                  (strncmp(chInputLine,"//", 2 )==0 ) ||  
    1970                  (chInputLine[0]=='*')*/ ||  
    1971                  /* these two are end-of-input-stream sentinels */ 
    1972                  (chInputLine[0]=='\n')|| 
    1973                  (chInputLine[0]==' ') )  
    1974                  /* option to allow "C " lines through */ 
    1975                  && 
    1976                  !(chInputLine[0]=='C' || chInputLine[0]=='c' ) ) 
     1957        if( ( lgInputComment( chInputLine ) || 
     1958              /* these two are end-of-input-stream sentinels */ 
     1959              chInputLine[0] == '\n' || chInputLine[0] == ' ' ) && 
     1960            /* option to allow "C" lines through */ 
     1961            ! ( chInputLine[0] == 'C' || chInputLine[0] == 'c' ) ) 
    19771962        { 
    19781963                /* return value is number of lines that can still be stuffed in */ 
     
    19831968        * validate a location to store this line image, then store the version     * 
    19841969        * that has been truncated from special end of line characters              * 
    1985         * stored image will have <=80 valid characters                             * 
     1970        * stored image will have < INPUT_LINE_LENGTH valid characters              * 
    19861971        ***************************************************************************/ 
    19871972 
     
    20061991        } 
    20071992 
     1993        strncpy( chLocal, chInputLine, INPUT_LINE_LENGTH ); 
     1994        // strncpy will pad chLocal with null bytes if chInputLine is shorter than 
     1995        // INPUT_LINE_LENGTH characters, so this indicates an overlong input string 
     1996        if( chLocal[INPUT_LINE_LENGTH-1] != '\0' ) 
     1997        { 
     1998                chLocal[INPUT_LINE_LENGTH-1] = '\0'; 
     1999                fprintf(ioQQQ," PROBLEM cdRead, while parsing the following input line:\n %s\n", 
     2000                        chInputLine); 
     2001                fprintf(ioQQQ," found that the line is longer than %i characters, the longest possible line.\n", 
     2002                        INPUT_LINE_LENGTH-1); 
     2003                fprintf(ioQQQ," Please make the command line no longer than this limit.\n"); 
     2004        } 
     2005 
    20082006        /* now kill any part of line image after special end of line character, 
    20092007         * this stops info user wants ignored from entering after here */ 
    2010         if( (chEOL = strchr(chInputLine , '\n' ) ) !=NULL ) 
     2008        if( (chEOL = strchr(chLocal, '\n' ) ) != NULL ) 
    20112009        { 
    20122010                *chEOL = '\0'; 
    20132011        } 
    2014         if( (chEOL = strchr(chInputLine , '%' ) ) !=NULL ) 
     2012        if( (chEOL = strchr(chLocal, '%' ) ) != NULL ) 
    20152013        { 
    20162014                *chEOL = '\0'; 
    20172015        } 
    20182016        /* >>chng 02 apr 10, add this char */ 
    2019         if( (chEOL = strchr(chInputLine , '#' ) ) !=NULL ) 
     2017        if( (chEOL = strchr(chLocal, '#' ) ) != NULL ) 
    20202018        { 
    20212019                *chEOL = '\0'; 
    20222020        } 
    2023         if( (chEOL = strchr(chInputLine , ';' ) ) !=NULL ) 
     2021        if( (chEOL = strchr(chLocal, ';' ) ) != NULL ) 
    20242022        { 
    20252023                *chEOL = '\0'; 
    20262024        } 
    2027         if( (chEOL = strstr(chInputLine , "//" ) ) !=NULL ) 
     2025        if( (chEOL = strstr(chLocal, "//" ) ) != NULL ) 
    20282026        { 
    20292027                *chEOL = '\0'; 
    2030         } 
    2031  
    2032         /* check that there are less than INPUT_LINE_LENGTH characters to the null character  
    2033          * first find the end of string mark */ 
    2034         chEOL = strchr(chInputLine , '\0' ); 
    2035  
    2036         /* do something if no end of string, or if string longer than  
    2037          * INPUT_LINE_LENGTH characters */ 
    2038         if( (chEOL==NULL) || (chEOL - chInputLine)>INPUT_LINE_LENGTH ) 
    2039         { 
    2040                 /* remember, in C [INPUT_LINE_LENGTH] is the n+1th character */ 
    2041                 chInputLine[INPUT_LINE_LENGTH-1] = '\0'; 
    2042                 fprintf(ioQQQ," cdRead, while parsing the following input line:\n %s\n", 
    2043                         chInputLine); 
    2044                 fprintf(ioQQQ," found that the line is longer than %i characters, the longest possible line.\n", 
    2045                         INPUT_LINE_LENGTH); 
    2046                 fprintf(ioQQQ," Please make the command line shorter than this limit.\n"); 
    20472028        } 
    20482029 
    20492030        /* now do it again, since we now want to make sure that there is a trailing space 
    20502031         * if the line is shorter than 80 char, test on null is to keep lint happy */ 
    2051         if( (chEOL = strchr(chInputLine , '\0' )) == NULL ) 
     2032        if( (chEOL = strchr( chLocal, '\0' )) == NULL ) 
    20522033                TotalInsanity(); 
    20532034 
    2054         /* pad with a space if short enough, 
     2035        /* pad with two spaces if short enough, 
    20552036         * if not short enough for this to be done, then up to user to create correct input */ 
    2056         strcpy( chLocal , chInputLine ); 
    2057         if( chEOL-chInputLine <INPUT_LINE_LENGTH-4 ) 
    2058         { 
    2059                 strcat( chLocal , "  " ); 
     2037        if( chEOL-chLocal < INPUT_LINE_LENGTH-2 ) 
     2038        { 
     2039                strcat( chLocal, "  " ); 
    20602040        } 
    20612041 
  • branches/newmole/source/cddrive.h

    r1830 r1918  
    8989 * standard - a non-zero return is normal  
    9090*/ 
    91 int cdRead(char* ); 
     91int cdRead( const char* ); 
    9292 
    9393/**  
  • branches/newmole/source/cdgetlinelist.cpp

    r1830 r1918  
    22 * others.  For conditions of distribution and use see copyright notice in license.txt */ 
    33/*cdGetLineList routine to read in master list of emission line wavelengths and ids, for 
    4  * generating loc grids, 
    5  * someday add cdGetNLRLineList */ 
     4 * generating loc grids */ 
    65#include "cddefines.h" 
    76#include "cddrive.h" 
     
    3837        chFilename = ( strlen(chFile) == 0 ) ? "LineList_BLR.dat" : chFile; 
    3938 
    40         /* >>chng 04 nov 06, had searched only on path, now search locally  
    41          * and then on path if not found */