Changeset 1092
- Timestamp:
- 05/03/07 18:54:55 (21 months ago)
- Location:
- trunk
- Files:
-
- 24 modified
-
source/date.h (modified) (1 diff)
-
source/dynamics.cpp (modified) (7 diffs)
-
source/hextra.h (modified) (3 diffs)
-
source/hot_issues.txt (modified) (3 diffs)
-
source/iso_cool.cpp (modified) (38 diffs)
-
source/parse_commands.cpp (modified) (2 diffs)
-
source/prt_zone.cpp (modified) (1 diff)
-
source/punch_do.cpp (modified) (1 diff)
-
source/zerologic.cpp (modified) (1 diff)
-
tsuite/auto/agn_warm_absorber.in (modified) (1 diff)
-
tsuite/auto/coll_coronal.in (modified) (1 diff)
-
tsuite/auto/dynamics_orion_flow.in (modified) (1 diff)
-
tsuite/auto/func_abund_fluc.in (modified) (1 diff)
-
tsuite/auto/func_dlaw.in (modified) (1 diff)
-
tsuite/auto/func_grid.in (modified) (1 diff)
-
tsuite/auto/func_ion_increase.in (modified) (1 diff)
-
tsuite/auto/func_map.in (modified) (1 diff)
-
tsuite/auto/func_stopline.in (modified) (1 diff)
-
tsuite/auto/func_test.in (modified) (1 diff)
-
tsuite/auto/func_trans_punch.in (modified) (1 diff)
-
tsuite/auto/func_trans_read.in (modified) (1 diff)
-
tsuite/auto/limit_hi_ion.in (modified) (1 diff)
-
tsuite/auto/nlr_lex00.in (modified) (1 diff)
-
tsuite/auto/nova_photos.in (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/date.h
r1074 r1092 8 8 * in the morning so no date conflict happens */ 9 9 #define YEAR 107 10 #define MONTH 311 #define DAY 2810 #define MONTH 4 11 #define DAY 3 -
trunk/source/dynamics.cpp
r812 r1092 22 22 #include "radius.h" 23 23 #include "thirdparty.h" 24 #include "hextra.h" 24 25 #include "rfield.h" 25 26 #include "trace.h" … … 1340 1341 1341 1342 /* this is set true on CORONAL XXX TIME INIT command, says to use constant 1342 * temperature for f orst N_INITIAL_RELAX iterations, then let run free */1343 * temperature for first N_INITIAL_RELAX iterations, then let run free */ 1343 1344 if( dynamics.lg_coronal_time_init ) 1344 1345 { … … 1403 1404 ++nTimeVary; 1404 1405 } 1405 if( !nTimeVary ) 1406 { 1407 fprintf(ioQQQ," DISASTER - there were no variable continua - " 1408 "put TIME option on at least one luminosity command.\n"); 1406 1407 if( hextra.lgTurbHeatVaryTime ) 1408 { 1409 /* vary extra heating */ 1410 hextra.TurbHeat = hextra.TurbHeatSave * time_continuum_scale; 1411 fprintf(ioQQQ,"DEBUG TurbHeat vary new heat %.2e\n", 1412 hextra.TurbHeat); 1413 } 1414 else if( nTimeVary ) 1415 { 1416 for( i=0; i<rfield.nupper; ++i ) 1417 { 1418 /* >>chng 06 mar 22, break into constant and time dependent parts */ 1419 rfield.flux[i] = rfield.flux_const[i] + 1420 rfield.flux_time[i]*time_continuum_scale; 1421 rfield.FluxSave[i] = rfield.flux[i]; 1422 } 1423 } 1424 else 1425 { 1426 fprintf(ioQQQ," DISASTER - there were no variable continua " 1427 "or heat sources - put TIME option on at least one " 1428 "luminosity or hextra command.\n"); 1409 1429 puts( "[Stop in DynaEndIter]" ); 1410 1430 cdEXIT(EXIT_FAILURE); 1411 }1412 1413 for( i=0; i<rfield.nupper; ++i )1414 {1415 /* >>chng 06 mar 22, break into constant and time dependent parts */1416 rfield.flux[i] = rfield.flux_const[i] +1417 rfield.flux_time[i]*time_continuum_scale;1418 rfield.FluxSave[i] = rfield.flux[i];1419 1431 } 1420 1432 /* this is heat radiated, after correction for change of H density in constant … … 1425 1437 else 1426 1438 { 1427 /* this branch, during initial stabil azation of soln */1439 /* this branch, during initial stabilization of solution */ 1428 1440 HeatInitial = 1.5 * pressure.PresGasCurr; 1429 1441 HeatRadiated = 0.; … … 1450 1462 dynamics.lgRecom = true; 1451 1463 /* set largest possible zone thickness to value on previous 1452 * iterati n when light was on - during recombination conditions1464 * iteration when light was on - during recombination conditions 1453 1465 * become much more homogeneous and dr can get too large, 1454 1466 * crashing into H i-front */ … … 1458 1470 if( lgtime_dt_specified ) 1459 1471 { 1460 1461 1472 /* this is the new timestep */ 1462 1473 fprintf(ioQQQ,"DEBUG lgtimes increment Time to %li %.2e\n" ,nTime_dt_array_element, … … 1979 1990 timestep_init = FFmtRead(chCard,&i,INPUT_LINE_LENGTH,&lgEOL); 1980 1991 /* this is log of timestep */ 1992 if( timestep_init > 30. ) 1993 { 1994 /* this number is large and will almost certainly crash */ 1995 fprintf(ioQQQ,"WARNING - the log of the initial time step is too " 1996 "large, I shall probably crash. The value was log t = %.2e\n", 1997 timestep_init ); 1998 fflush(ioQQQ); 1999 } 1981 2000 timestep_init = pow( 10. , timestep_init ); 1982 2001 timestep = timestep_init; -
trunk/source/hextra.h
r740 r1092 21 21 float cryden_ov_background; 22 22 23 /** this is default cosmic ray background density and rate */23 /** this is default cosmic ray background density and rate */ 24 24 float background_density; 25 25 float background_rate; … … 27 27 /** these three set with hextra command, first the heating rate */ 28 28 float TurbHeat, 29 30 /** save the initial value in case TurbHeat varies with time */ 31 TurbHeatSave , 29 32 30 33 /** the scale radius for the heating */ … … 34 37 turback; 35 38 39 /** set true if extra heat varies with time in time dependent sims */ 40 bool lgTurbHeatVaryTime; 41 36 42 } hextra; 37 38 -
trunk/source/hot_issues.txt
r1075 r1092 1 1 HOT ISSUES 2 3 cdColm has option to get level col den for large H2. this is also repeated in cdH2_colden. Doc for first is removed from hazy, and code for it should be removed too. there is no reason to have two ways of doing exactly the same thing.4 2 5 3 ming gu dr data received 2007 feb 8, incorporate into cloudy 6 4 7 5 table starburst - write claus 6 7 table stars in hazy is wrong 8 8 9 9 check e2 function at line 300 of service.cpp … … 13 13 I am also not completely sure about what happens further down between lines 1145 and 1198. 14 14 15 NI pumping 16 15 17 what happened with e2 16 18 17 19 uta code query, get out of conv_base 20 21 rename lines.in 18 22 19 23 hmi.H2_H2g_to_H2s_rate_used - make multiple occurances like rest … … 23 27 24 28 but make sure all "used" are saved and rest 29 25 30 26 31 purify crash in func_trans_read after trans write -
trunk/source/iso_cool.cpp
r1075 r1092 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 /*iso_cool compute net cooling due to species in iso-sequences */ 3 /*iso_cool compute net cooling due to hydrogenc atom species, ground state 4 * photoionization of hydrogenic species done in sumheat */ 4 5 #include "cddefines.h" 5 6 #include "physconst.h" … … 12 13 #include "cooling.h" 13 14 #include "iso.h" 15 /** \todo 2 - if pc lint ever fixes this bug in their product, remove this -e */ 14 16 /*lint -e661 Possible access of out-of-bounds pointer*/ 15 17 /*lint -e662 (Warning -- Possible creation of out-of-bounds pointer */ … … 35 37 edenHCorr_IonAbund, 36 38 edenIonAbund, 37 coll_ion_cool_one,39 hex, 38 40 HeatExcited, 39 * coll_ion_cool_array,40 *hlone , 41 *hexx, /* will become save arrays dimd nhlvl+1*/ 42 *hlone ,/* will become save arrays dimd nhlvl+1*/ 41 43 ThinCoolingCaseB, 42 44 ThinCoolingSum, … … 85 87 DEBUG_ENTRY( "iso_cool()" ); 86 88 89 /** \todo 2 this routine dumps all heating and cooling into only a very few lables, 90 * it would be best to break these out into individual labels that show element, 91 * iso sequence, and agent */ 92 87 93 /* validate the incoming data */ 88 94 ASSERT( nelem >= ipISO ); 89 95 ASSERT( ipISO <NISO ); 90 96 ASSERT( nelem < LIMELM ); 91 /* local number of levels may be less than malloced number if continuum 92 * has been lowered due to high density */ 93 ASSERT( iso.numLevels_local[ipISO][nelem] <= iso.numLevels_max[ipISO][nelem] ); 94 95 /* for zero abundance or if element has been turned off we need to 96 * set some produced variables to zero */ 97 98 if( ipISO==0 ) 99 { 100 /* >>chng 06 aug 28, continuum lowering now on, allow less than here. */ 101 ASSERT( iso.numLevels_local[ipISO][nelem] <= iso.numLevels_max[ipISO][nelem] ); 102 } 103 else if( ipISO==1 ) 104 { 105 ASSERT( iso.numLevels_local[ipISO][nelem] <= iso.numLevels_max[ipISO][nelem] ); 106 } 107 else 108 TotalInsanity(); 109 110 /* for zero abundance we need to set some produced variables to zero */ 111 /* >>chng 04 nov 13, add check on element off */ 97 112 if( dense.xIonDense[nelem][nelem+1-ipISO] <= 0. || 98 113 /* >>chng 04 dec 07, add test for recombined species having zero abundance, … … 131 146 } 132 147 133 /* create some space , these go to numLevels_local instead of _max134 * since continuum may have been lowered by density*/135 coll_ion_cool_array= (double *)MALLOC( (unsigned)(iso.numLevels_local[ipISO][nelem])*sizeof(double) );148 /* create some space */ 149 /* >>chng 06 aug 17, all these should go to numLevels_local instead of _max. */ 150 hexx = (double *)MALLOC( (unsigned)(iso.numLevels_local[ipISO][nelem])*sizeof(double) ); 136 151 hlone = (double *)MALLOC( (unsigned)(iso.numLevels_local[ipISO][nelem])*sizeof(double) ); 137 152 SavePhotoHeat = (double *)MALLOC( (unsigned)(iso.numLevels_local[ipISO][nelem])*sizeof(double) ); … … 139 154 SaveRadRecCool = (double *)MALLOC( (unsigned)(iso.numLevels_local[ipISO][nelem])*sizeof(double) ); 140 155 156 /* compute the total cooling due to the hydrogen atom, and its derivative 157 * halfte is 1/(2T) */ 158 141 159 /*********************************************************************** 142 160 * * … … 145 163 ***********************************************************************/ 146 164 147 /* will be net collisional ionization cooling, units erg/cm^3/s */148 coll_ion_cool_one= 0.;165 /* hex will be net collisional ionization cooling, units erg/cm^3/s */ 166 hex = 0.; 149 167 dhexdt = 0.; 150 168 151 /* collisional ionization cooling minus three body heating 152 * depending on how topoff is done, highest level can have large population 153 * and its coupling to continuum can be large, at various times code 154 * had to ignore effects of very highest level, but starting in mid 155 * 20006 all levels have been included */ 156 for( n=0; n < iso.numLevels_local[ipISO][nelem]; ++n ) 169 /* collisional ionization cooling, three body heating 170 * highest level is fastest collision by far, its coupling to 171 * continuum can overwhelm heating, so only count nearly up to the top */ 172 /* >>chng 02 apr 25, from numLevels to numLevels-1 - departure coef for highest can be large */ 173 /* >>chng 06 aug 17, upper limit from numLevels_max to _local with continuum lowering 174 * treated consistently */ 175 /* >>chng 06 sep 1, take "-1" take out, negate 02 apr 25 change. */ 176 for( n=0; n < iso.numLevels_local[ipISO][nelem]/*-1*/; ++n ) 157 177 { 158 178 /* total collisional ionization cooling less three body heating */ 159 coll_ion_cool_array[n] =179 hexx[n] = 160 180 iso.xIsoLevNIonRyd[ipISO][nelem][n]*iso.ColIoniz[ipISO][nelem][n]*collider* 161 181 (iso.Pop2Ion[ipISO][nelem][n] -iso.PopLTE[ipISO][nelem][n]*dense.eden); 162 coll_ion_cool_one += coll_ion_cool_array[n];163 /*fprintf(ioQQQ,"DEBUG coll_ion_cool_one%.2e %2li %2li %2li %.2e %.4e %.4e %.3f\n",164 coll_ion_cool_one,182 hex += hexx[n]; 183 /*fprintf(ioQQQ,"DEBUG hex %.2e %2li %2li %2li %.2e %.4e %.4e %.3f\n", 184 hex, 165 185 ipISO , nelem , n , 166 coll_ion_cool_array[n] ,186 hexx[n] , 167 187 iso.Pop2Ion[ipISO][nelem][n] , 168 188 iso.PopLTE[ipISO][nelem][n]*dense.eden , … … 171 191 172 192 /* the derivative of the cooling 173 * need extra factor of temp of 1 Ryd since div by square of temp in Ryd */174 dhexdt += coll_ion_cool_array[n]*(iso.xIsoLevNIonRyd[ipISO][nelem][n]/TE1RYD/POW2(phycon.te_ryd) -193 * need extra factor of temp of 1 ryd since div by square of temp in ryd */ 194 dhexdt += hexx[n]*(iso.xIsoLevNIonRyd[ipISO][nelem][n]/TE1RYD/POW2(phycon.te_ryd) - 175 195 thermal.halfte); 176 196 } 197 /*if( ipISO==1 && nelem==1 ) 198 { 199 n = 85; 200 fprintf(ioQQQ,"DEBUG hexx %.2e %.2e\n", 201 iso.Pop2Ion[ipISO][nelem][n] , 202 iso.PopLTE[ipISO][nelem][n]*dense.eden ); 203 }*/ 204 205 /* convert to physical units, need to convert ryd to ergs, 206 * and bring to density per vol not per ion */ 207 /* >>chng 05 dec 28, leave hex in hexx units for simple debugging */ 208 /*hex *= EN1RYD*dense.xIonDense[nelem][nelem+1-ipISO]; 209 dhexdt *= EN1RYD*dense.xIonDense[nelem][nelem+1-ipISO];*/ 177 210 178 211 /* save net collisional ionization cooling less H-3 body heating 179 * convert to physical units, need to convert Ryd to ergs, 212 * for inclusion in printout 213 * convert to physical units, need to convert ryd to ergs, 180 214 * and bring to density per vol not per ion */ 181 iso.coll_ion[ipISO][nelem] = coll_ion_cool_one* EN1RYD*dense.xIonDense[nelem][nelem+1-ipISO];215 iso.coll_ion[ipISO][nelem] = hex * EN1RYD*dense.xIonDense[nelem][nelem+1-ipISO]; 182 216 /* create a meaningful label */ 183 217 sprintf(chLabel , "IScion%2s%2s" , elementnames.chElementSym[ipISO] , … … 187 221 CoolAdd(chLabel,(float)nelem,MAX2(0.,iso.coll_ion[ipISO][nelem])); 188 222 189 /* deriv ativewrt temp190 * convert to physical units, need to convert Ryd to ergs,223 /* deriv wrt temp 224 * convert to physical units, need to convert ryd to ergs, 191 225 * and bring to density per vol not per ion */ 192 226 thermal.dCooldT += dhexdt*EN1RYD*dense.xIonDense[nelem][nelem+1-ipISO]; 193 227 194 /* heating[0][3] is all three body heating, opposite of collisional 195 * ionization cooling, 228 /* heating[0][3] is all three body heating, opposite of coll ion cooling, 196 229 * would be unusual for this to be non-zero since would require excited 197 230 * state departure coefficients to be greater than unity */ 198 231 thermal.heating[0][3] += MAX2(0.,-iso.coll_ion[ipISO][nelem]); 199 { 200 /* debug block printing individual contributors to this process */ 232 /*if( ipISO==1 && nelem==1 ) 233 fprintf(ioQQQ,"DEBUG %li %2li %.2e %.4e\n", 234 ipISO , nelem , 235 -iso.coll_ion[ipISO][nelem]/ MAX2( SMALLFLOAT , thermal.htot ) , 236 phycon.te );*/ 237 { 238 /*@-redef@*/ 201 239 enum {DEBUG_LOC=false}; 240 /*@+redef@*/ 202 241 if( DEBUG_LOC && nelem==1 && ipISO==1 ) 203 242 { … … 209 248 for( n=0; n < (iso.numLevels_local[ipISO][nelem] - 1); n++ ) 210 249 { 211 if( coll_ion_cool_array[n] / SDIV( coll_ion_cool_one) > 0.1 )250 if( hexx[n] / SDIV( hex ) > 0.1 ) 212 251 fprintf(ioQQQ," %2li %.1e", 213 252 n, 214 coll_ion_cool_array[n]/ SDIV( coll_ion_cool_one) );253 hexx[n]/ SDIV( hex ) ); 215 254 } 216 255 fprintf(ioQQQ,"\n"); … … 236 275 edenHCorr_IonAbund = collider*dense.xIonDense[nelem][nelem+1-ipISO]; 237 276 277 /* >>chng 02 apr 23 */ 278 /* new logic, for any iso seq */ 238 279 /* now do case b sum to compare with exact value below */ 239 280 iso.RadRecCool[ipISO][nelem] = 0.; … … 254 295 thin = iso.RadRecomb[ipISO][nelem][0][ipRecRad]* 255 296 /* arg is the scaled temperature, T * n^2 / Z^2, 256 * n is prin ciple quantumnumber, Z is charge, 1 for H */297 * n is prin quant number, Z is charge, 1 for H */ 257 298 HCoolRatio( 258 299 phycon.te * POW2( (double)iso.quant_desig[ipISO][nelem][0].n / (double)(nelem+1-ipISO) ))* … … 260 301 phycon.te * BOLTZMANN; 261 302 } 262 /* the cooling, corrected for optical dep th*/303 /* the cooling, corrected for optical dephs */ 263 304 SaveRadRecCool[0] = iso.RadRecomb[ipISO][nelem][0][ipRecNetEsc] * thin; 264 305 /* this is now total free-bound cooling */ … … 266 307 267 308 /* radiative recombination cooling for all excited states */ 309 /* >>chng 06 aug 17, should go to numLevels_local instead of _max. */ 268 310 for( n=1; n < iso.numLevels_local[ipISO][nelem]; n++ ) 269 311 { … … 271 313 thin = iso.RadRecomb[ipISO][nelem][n][ipRecRad]* 272 314 /* arg is the scaled temperature, T * n^2 / Z^2, 273 * n is prin ciple quantumnumber, Z is charge, 1 for H */315 * n is prin quant number, Z is charge, 1 for H */ 274 316 HCoolRatio( 275 317 phycon.te * POW2( (double)iso.quant_desig[ipISO][nelem][n].n / (double)(nelem+1-ipISO) ))* … … 277 319 phycon.te * BOLTZMANN; 278 320 279 /* the cooling, corrected for optical dep th*/321 /* the cooling, corrected for optical dephs */ 280 322 SaveRadRecCool[n] = iso.RadRecomb[ipISO][nelem][n][ipRecNetEsc] * thin * edenIonAbund; 281 323 /* this is now total free-bound cooling */ … … 286 328 } 287 329 { 288 /* debug block for state specific recombination cooling*/330 /*@-redef@*/ 289 331 enum {DEBUG_LOC=false}; 332 /*@+redef@*/ 290 333 if( DEBUG_LOC ) 291 334 { … … 302 345 } 303 346 304 /* Case b sum of optically thin radiative recombination cooling. 305 * add any remainder to the sum from above - high precision is needed 306 * to get STE result to converge close to equilibrium - only done for 307 * H-like ions where exact result is known */ 347 /* following is expression for case b sum of 348 * optically thin radiative recombination cooling - we will need to add any remainder to 349 * the sum from above - high precision is needed to get STE result to converge 350 * close to equilibrium - as in lte.in and induchhe.in */ 351 /* >>chng 02 apr 26, do not print for he-like - they are always negative at low t */ 308 352 if( ipISO == ipH_LIKE ) 309 353 { … … 350 394 RecCoolExtra = MAX2(0., RecCoolExtra ); 351 395 352 /* add error onto total - this is significant for approach to STE */ 396 /* add error onto total - this is significant for approach to ste */ 397 /* >>chng 06 aug 17, should have numLevels_local instead of _max. */ 353 398 iso.RadRecCool[ipISO][nelem] += RecCoolExtra* edenIonAbund *iso.RadRecomb[ipISO][nelem][iso.numLevels_local[ipISO][nelem]-1][ipRecNetEsc]; 354 399 … … 360 405 ***********************************************************************/ 361 406 362 /* photoionization of excited levels */ 407 /* photoionization of excited levels 408 * HPhotHeat(n,nelem) is photoionization heating due to level n, 409 * evaluated in iso_photo */ 363 410 HeatExcited = 0.; 364 411 ipbig = -1000; 412 /* >>chng 06 aug 17, should go to numLevels_local instead of _max. */ 365 413 for( n=1; n < (iso.numLevels_local[ipISO][nelem] - 1); ++n ) 366 414 { … … 375 423 } 376 424 { 377 /* debug block for heating due to photo of each n */ 425 /* this block to debug heating due to photo of var n */ 426 /*@-redef@*/ 378 427 enum {DEBUG_LOC=false}; 428 /*@+redef@*/ 379 429 if( DEBUG_LOC && ipISO==0 && nelem==0 && nzone > 700) 380 430 { … … 402 452 } 403 453 404 /* FreeBnd_net_Cool_Rate is net cooling due to recombination405 * RadRecCool is total radiative recombination cooling sum to all levels,406 * with n>=2 photoionization heating subtracted*/454 /* HFreBndNet is net cooling due to 455 * HRadRecCool is total radiative recombination cooling sum to all levels, 456 * net is this less n>=2 photoionization heating */ 407 457 iso.FreeBnd_net_Cool_Rate[ipISO][nelem] = iso.RadRecCool[ipISO][nelem] - HeatExcited; 408 458 /*fprintf(ioQQQ,"DEBUG Hn2\t%.3e\t%.3e\n", … … 410 460 HeatExcited/SDIV(thermal.htot));*/ 411 461 412 /* heating[ 0][1] is all excited state photoionization heating from ALL413 * species, this is set to zero in CoolEvaluate before loop where this414 * is called.*/462 /* heating[1][0] is all excited state photoionization heating from ALL species, 463 * this is set to zero in CoolEvaluate before loop where this is called. 464 * >>chng 96 jan 25, was -HeatExcited */ 415 465 thermal.heating[0][1] += MAX2(0.,-iso.FreeBnd_net_Cool_Rate[ipISO][nelem]); 416 466 … … 441 491 } 442 492 { 443 /* print rec cool, induced rec cool, photo heat */ 493 /* print rec cool, induc rec cool, photo heat */ 494 /*@-redef@*/ 444 495 enum {DEBUG_LOC=false}; 496 /*@+redef@*/ 445 497 if( DEBUG_LOC && ipISO==0 && nelem==5 /**/ ) 446 498 { … … 476 528 CoolAdd(chLabel,(float)nelem,iso.RecomInducCool_Rate[ipISO][nelem]); 477 529 478 /* find total collisional energy exchange due to bound-bound */ 530 /* lines are remainder of this routine */ 531 /* this will be the only loop in the final code 532 * find total collisional energy exchange */ 479 533 iso.xLineTotCool[ipISO][nelem] = 0.; 480 534 dCdT_all = 0.; … … 483 537 nhi_heat_max = -1; 484 538 485 /* loop does not include highest levels - their population may be486 * affected by topoff */487 539 for( ipLo=0; ipLo < iso.numLevels_local[ipISO][nelem]-2; ipLo++ ) 488 540 { 489 541 for( ipHi=ipLo + 1; ipHi < iso.numLevels_local[ipISO][nelem]-1; ipHi++ ) 490 542 { 491 /* collisional energy exchange between ipHi and ipLo - net cool */492 543 &nb
