Changeset 1178
- Timestamp:
- 06/08/07 22:10:35 (1 year ago)
- Files:
-
- trunk/source/assert_results.cpp (modified) (1 diff)
- trunk/source/cloudy.cpp (modified) (3 diffs)
- trunk/source/conv_init_solution.cpp (modified) (1 diff)
- trunk/source/grid.h (modified) (1 diff)
- trunk/source/grid_do.cpp (modified) (3 diffs)
- trunk/source/grid_xspec.cpp (modified) (1 diff)
- trunk/source/init.h (modified) (2 diffs)
- trunk/source/init_defaults_preparse.cpp (modified) (4 diffs)
- trunk/source/mole_h2.cpp (modified) (2 diffs)
- trunk/source/optimize.h (modified) (1 diff)
- trunk/source/optimize_func.cpp (modified) (5 diffs)
- trunk/source/parse_optimize.cpp (modified) (9 diffs)
- trunk/source/parse_set.cpp (modified) (2 diffs)
- trunk/source/parse_stop.cpp (modified) (2 diffs)
- trunk/source/punch_do.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/source/assert_results.cpp
r1142 r1178 1482 1482 /* will be used if there were big botched asserts */ 1483 1483 lgBigBotch = false; 1484 1485 /* the optimize*.in and stars_oppim*.in tests in the test suite include 1486 * asserts while optimizing. We do not want to test the asserts during 1487 * the optimization process, since we will find blown asserts and report 1488 * major problems. We do want to test asserts on the final model however. 1489 * Printout will usually be turned off in all except the final model, 1490 * so do not to the assert tests if we are optimizing but not printing */ 1491 if( !called.lgTalk && optimize.lgOptimize ) 1492 { 1493 /* just return */ 1494 DEBUG_EXIT( "lgCheckAsserts()" ); 1495 return true; 1496 } 1484 1497 1485 1498 /*fprintf(ioQQQ , "DEBUG grid %li\n", optimize.nOptimiz );*/ trunk/source/cloudy.cpp
r1147 r1178 80 80 * in a grid, before the parser is called - this must set any values 81 81 * that may be changed by the command parser */ 82 InitDefaults ();82 InitDefaultsPreparse(); 83 83 84 84 /* scan in and parse input data */ … … 325 325 return(true); 326 326 } 327 328 327 } 329 328 … … 341 340 warnin(chLine); 342 341 342 if( grid.lgGrid ) 343 { 344 /* save flags indicating quality of this calculation if in grid 345 * these will be output with punch grid command */ 346 /* nOptimiz is 1 for first model in a grid */ 347 grid.lgAbort[optimize.nOptimiz-1] = true; 348 /* number of warnings is only defined if we did not abort */ 349 grid.nWarn[optimize.nOptimiz-1] = warnings.nwarn; 350 351 /* possibly punch out some results from this zone when doing grid 352 * since grid punch files expect something at this grid point */ 353 PunchDo("MIDL"); 354 PunchDo("LAST" ); 355 } 356 343 357 DEBUG_EXIT( "BadStart()" ); 344 358 return; trunk/source/conv_init_solution.cpp
r889 r1178 471 471 { 472 472 /* we hit an abort */ 473 fprintf( ioQQQ, " Search for initial conditions aborted - lgAbort set true.\n" );473 fprintf( ioQQQ, "PROBLEM Search for initial conditions aborted - lgAbort set true.\n" ); 474 474 ShowMe(); 475 475 trunk/source/grid.h
r849 r1178 29 29 **paramData, 30 30 **interpParameters; 31 bool *lgAbort; 32 int *nWarn; 31 33 32 34 float paramIncrements[LIMPAR]; trunk/source/grid_do.cpp
r1147 r1178 16 16 #include "grid.h" 17 17 18 /*grid_do called by cdDrive, calls gridXspec, returns 0 if ok, 1for disaster */18 /*grid_do called by cdDrive, calls gridXspec, returns false if ok, true for disaster */ 19 19 bool grid_do(void) 20 20 { … … 43 43 } 44 44 45 /* this moved here from zerologic */46 optimize.nIterOptim = 20;47 optimize.ioOptim = NULL;48 optimize.OptGlobalErr = 0.10f;49 optimize.nlobs = 0;50 optimize.nTempObs = 0;51 optimize.ncobs = 0;52 optimize.nRangeSet = 0;53 strcpy( optimize.chOptRtn, "SUBP" );54 55 /* flags says what is to be matched */56 optimize.lgOptLin = false;57 optimize.lgOptLum = false;58 optimize.lgOptCol = false;59 optimize.lgOptTemp = false;60 61 /* trace flag for optimization process */62 optimize.lgTrOpt = false;63 64 optimize.lgOptimFlow = false;65 optimize.optint = 0.;66 optimize.optier = 0.;67 # ifdef __unix68 optimize.lgParallel = true;69 # else70 optimize.lgParallel = false;71 # endif72 optimize.lgOptCont = false;73 74 45 /* necessary to do this to keep all lines in */ 75 46 prt.lgFaintOn = false; … … 79 50 * in a grid, before the parser is called - this must set any values 80 51 * that may be changed by the command parser */ 81 InitDefaults ();52 InitDefaultsPreparse(); 82 53 83 54 /* call READR the first time to scan off all variable options */ trunk/source/grid_xspec.cpp
r1147 r1178 62 62 63 63 grid.interpParameters = (float**)MALLOC(sizeof(float*)*(unsigned)(grid.totNumModels) ); 64 /* save abort flag */ 65 grid.lgAbort = (bool*)MALLOC(sizeof(bool)*(unsigned)(grid.totNumModels) ); 66 /* number of warnings */ 67 grid.nWarn = (int*)MALLOC(sizeof(int)*(unsigned)(grid.totNumModels) ); 64 68 65 69 for( i=0; i<nInterpVars+grid.naddparm; i++ ) trunk/source/init.h
r1147 r1178 4 4 * InitCoreload - one time initialization, called from cdInit 5 5 * InitCoreloadPostparse - one time initialization, called after parser 6 * InitDefaults initialization at start of simulation, called from cloudy6 * InitDefaultsPreparse initialization at start of simulation, called from cloudy 7 7 * before parser, will be called one time per sim in grid 8 8 * InitSimPostparse initialization at start of simulation, called from cloudy … … 18 18 /** initialize values that are changed in the parser. Called just 19 19 * before parser, will be called one time per core load */ 20 void InitDefaults ( void );20 void InitDefaultsPreparse( void ); 21 21 22 22 /** initialization after parser, called one time per core load trunk/source/init_defaults_preparse.cpp
r1175 r1178 1 1 /* This file is part of Cloudy and is copyright (C) 1978-2005 by Gary J. Ferland 2 2 * For conditions of distribution and use, see copyright notice in license.txt */ 3 /*InitDefaults initialization at start of simulation, called from cloudy3 /*InitDefaultsPreparse initialization at start of simulation, called from cloudy 4 4 * before parser, sets initial values of quantities changed by parser */ 5 5 #include "cddefines.h" … … 8 8 #include "stopcalc.h" 9 9 #include "wind.h" 10 #include "optimize.h" 10 11 #include "punch.h" 11 12 #include "init.h" 12 13 13 /*InitDefaults initialization at start of simulation, called from cloudy14 /*InitDefaultsPreparse initialization at start of simulation, called from cloudy 14 15 * before parser, will now be called one time per sim in grid but long term 15 16 * goal is to call parser only one time in a grid. This would be called … … 18 19 * It does not initialize variables for the start of a calculation. That 19 20 * is done by InitSimPostparse */ 20 void InitDefaults ( void )21 void InitDefaultsPreparse( void ) 21 22 { 22 23 long int i, ipISO; 23 24 24 DEBUG_ENTRY( "InitDefaults ()" );25 DEBUG_ENTRY( "InitDefaultsPreparse()" ); 25 26 26 27 /* init vars before parsing commands for each sim */ … … 191 192 } 192 193 193 DEBUG_EXIT( "InitDefaults()" ); 194 /* initialize some variables for the optimizer */ 195 optimize.nIterOptim = 20; 196 optimize.ioOptim = NULL; 197 optimize.OptGlobalErr = 0.10f; 198 optimize.nlobs = 0; 199 optimize.nTempObs = 0; 200 optimize.ncobs = 0; 201 optimize.nRangeSet = 0; 202 strcpy( optimize.chOptRtn, "SUBP" ); 203 204 /* flags says what is to be matched */ 205 optimize.lgOptLin = false; 206 optimize.lgOptLum = false; 207 optimize.lgOptCol = false; 208 optimize.lgOptTemp = false; 209 optimize.lgOptimize = false; 210 211 /* trace flag for optimization process */ 212 optimize.lgTrOpt = false; 213 214 optimize.lgOptimFlow = false; 215 optimize.optint = 0.; 216 optimize.optier = 0.; 217 # ifdef __unix 218 optimize.lgParallel = true; 219 # else 220 optimize.lgParallel = false; 221 # endif 222 optimize.lgOptCont = false; 223 224 DEBUG_EXIT( "InitDefaultsPreparse()" ); 194 225 return; 195 226 } trunk/source/mole_h2.cpp
r1176 r1178 3893 3893 * cancel out. Some dense cosmic ray heated clouds could not find correct 3894 3894 * initial solution due to noise introduced by large net heating which was 3895 * the very noisy tiny difference betwee en very large heating and cooling3895 * the very noisy tiny difference between very large heating and cooling 3896 3896 * terms. Do not include collisions with x as heat/cool during the 3897 3897 * initial search phase */ … … 3905 3905 3906 3906 /*cdH2_colden return column density in H2, negative -1 if cannot find state, 3907 * header is cd drive */3907 * header is cdDrive */ 3908 3908 double cdH2_colden( long iVib , long iRot ) 3909 3909 { trunk/source/optimize.h
r873 r1178 141 141 FILE *ioOptim; 142 142 float OptGlobalErr; 143 144 /* counter for number of models in a grid - is one (not zero) for 145 * first simulation */ 143 146 long int nOptimiz; 147 144 148 bool lgOptimFlow; 145 149 float optint, 146 150 optier; 147 151 long int nTrOpt; 148 bool lgTrOpt, 152 bool lgTrOpt; 153 bool lgOptimize, 154 /** these flags say we are optimizing on line intensity, luminosity, 155 * column density, or temperature */ 149 156 lgOptLin, 150 157 lgOptLum, trunk/source/optimize_func.cpp
r1149 r1178 9 9 #include "radius.h" 10 10 #include "input.h" 11 #include "warnings.h" 11 12 #include "cloudy.h" 12 13 #include "cddrive.h" … … 61 62 62 63 DEBUG_ENTRY( "optimize_func()" ); 63 /* limpar defined in optimize.h */64 64 65 65 /* This routine is called by optimizer with values of the … … 74 74 */ 75 75 76 /* initialize the code for this run */77 /*cdInit();*/78 76 /* zero out lots of variables */ 79 77 zero(); 80 81 /* CO_Init() */82 /* can't call this here, get zero malloc, this happens when Cloudy is called below anyway. */83 /* CO_zero(); */84 78 85 79 if( optimize.lgOptimFlow ) … … 98 92 } 99 93 100 /* al lways increment nOptimiz, even if parameters are out of bounds,94 /* always increment nOptimiz, even if parameters are out of bounds, 101 95 * this prevents optimizer to get stuck in infinite loop */ 102 96 ++optimize.nOptimiz; 103 97 104 /* call routine to pack /kardsv/ variablewith appropriate98 /* call routine to pack variables with appropriate 105 99 * CLOUDY input lines given the array of variable parameters p(i) */ 106 100 vary_input(&lgLimOK); … … 129 123 if( lgBAD ) 130 124 { 131 fprintf( ioQQQ, " Cloudy returned error condition - what happened?\n" );125 fprintf( ioQQQ, "PROBLEM Cloudy returned error condition - what happened?\n" ); 132 126 } 133 127 trunk/source/parse_optimize.cpp
r873 r1178 1 1 /* This file is part of Cloudy and is copyright (C)1978-2007 by Gary J. Ferland 2 2 * For conditions of distribution and use see copyright notice in license.txt */ 3 /*ParseOptimize parse the optimize command line*/3 /*ParseOptimize parse the optimize and grid command lines */ 4 4 /*GetOptColDen read observed column densities & errors for optimizer */ 5 5 /*GetOptLineInt parse observed line intensities for optimization routines */ … … 25 25 static void GetOptTemp(char *chCard ); 26 26 27 /* ParseOptimize - called from ParseCommands if GRID or OPTIMIZE command found */ 27 28 void ParseOptimize( 28 29 /* command line, which was changed to all caps in main parsing routine */ … … 48 49 * original version of command line, which preserves case of 49 50 * characters. Also removes string between quotes */ 50 GetQuote( chOptimFileName , chCard , true ); 51 if( GetQuote( chOptimFileName , chCard , true ) ) 52 /* this can't happen since GetQuote exits if quote not 53 * found, since true sets abort mode */ 54 TotalInsanity(); 51 55 52 56 /* open the file */ … … 58 62 } 59 63 } 60 61 } 62 /*>>chng 07 feb 08m rm optimize optimize_amoeba due to Robin & Peter license 63 * concerns - R837 */ 64 } 64 65 65 66 else if( nMatch("COLU",chCard) ) … … 67 68 /* optimize column density */ 68 69 optimize.lgOptCol = true; 70 optimize.lgOptimize = true; 69 71 70 72 /* read column densities to match */ … … 76 78 /* set flag saying that optimization should start from continue file */ 77 79 optimize.lgOptCont = true; 80 optimize.lgOptimize = true; 78 81 } 79 82 … … 98 101 optimize.optier = (float)FFmtRead(chCard,&i,INPUT_LINE_LENGTH,&lgEOL); 99 102 if( lgEOL ) 100 {101 103 optimize.optier = DEFERR; 102 }103 104 104 105 /* set flag to say that intensity or luminosity of line set */ 105 106 optimize.lgOptLum = true; 107 optimize.lgOptimize = true; 106 108 } 107 109 … … 120 122 /* set flag saying that something has been set */ 121 123 optimize.lgOptLin = true; 124 optimize.lgOptimize = true; 122 125 } 123 126 … … 200 203 /* set flag saying that optimize temps has been set */ 201 204 optimize.lgOptTemp = true; 205 optimize.lgOptimize = true; 202 206 } 203 207 trunk/source/parse_set.cpp
r1099 r1178 1595 1595 * null terminated string to chDataPath 1596 1596 * also sets name in OrgCard and chCard to blanks so that 1597 * do not trigger off it later 1598 GetQuote( chTmpHashString , chCard , true );*/ 1597 * do not trigger off it later */ 1599 1598 if( strcmp( chString_quotes_lowercase , "return" ) == 0 ) 1600 1599 { … … 1663 1662 * null terminated string to chDataPath 1664 1663 * also sets name in OrgCard and chCard to blanks so that 1665 * do not trigger off it later 1664 * do not trigger off it later */ 1666 1665 1667 GetQuote( punch.chFilenamePrefix , chCard , true );*/1668 1666 strcpy( punch.chFilenamePrefix , chString_quotes_lowercase ); 1669 1667 } trunk/source/parse_stop.cpp
r1147 r1178 41 41 if( lgEOL && nMatch(" OFF",chCard) ) 42 42 { 43 /* this is ending temperature */ 43 /* this is special case for ending temperature - do not use - 44 * but will still stop if Te falls below TeLowest, the lowest 45 * possible temperature */ 44 46 StopCalc.tend = -1.f; 45 /* >>chng 05 aug 15, do not reset StopCalc.TeLowest since this is lowest46 * possible temperature code can handle, set to 2.7 K */47 /*StopCalc.TeLowest = -1.f;*/48 47 } 49 48 else … … 76 75 else 77 76 { 78 /* this is ending temperature */ 77 /* this is ending temperature - we stop if kinetic temperature 78 * falls below this */ 79 79 StopCalc.tend = (float)tread; 80 /* >>chng 05 aug 15, do not set TeLowest - this is lower temp bound,81 * set to 2.7K - cannot go below this */82 /*StopCalc.TeLowest = (float)MIN2(StopCalc.TeLowest,StopCalc.tend);*/83 80 } 84 81 } trunk/source/punch_do.cpp
r1159 r1178 1549 1549 else if( strcmp(punch.chPunch[ipPun],"GRID") == 0 ) 1550 1550 { 1551 /* one time punch of all grid parameters after grid is complete */ 1551 1552 if( (strcmp(chTime,"LAST") == 0 ) && grid.lgGridDone ) 1552 1553 { … … 1554 1555 * As in "PARAM1 is HDEN"? */ 1555 1556 /* print first parameter outside of loop, so that tabs are right. */ 1556 fprintf(punch.ipPnunit[ipPun], " PARAM1" );1557 for( i= 2; i<= grid.nintparm; i++ )1557 fprintf(punch.ipPnunit[ipPun], "Abort?\tnWarnings" ); 1558 for( i=1; i<= grid.nintparm; i++ ) 1558 1559 { 1559 1560 fprintf(punch.ipPnunit[ipPun], "\tPARAM%li", i ); … … 1562 1563 for( i=0; i<grid.totNumModels; i++ ) 1563 1564 { 1565 fprintf(punch.ipPnunit[ipPun], "%c\t%li\t", 1566 TorF(grid.lgAbort[i]) , grid.nWarn[i] ); 1564 1567 for( j=0; j< grid.nintparm; j++ ) 1565 1568 {
