Changeset 2034 for branches/c08_branch/source/iso_cool.cpp
- Timestamp:
- 05/10/08 09:03:02 (6 months ago)
- Files:
-
- 1 modified
-
branches/c08_branch/source/iso_cool.cpp (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/c08_branch/source/iso_cool.cpp
r1822 r2034 12 12 #include "cooling.h" 13 13 #include "iso.h" 14 /*lint -e661 Possible access of out-of-bounds pointer*/15 /*lint -e662 (Warning -- Possible creation of out-of-bounds pointer */16 14 17 15 /* HP cc cannot compile this routine with any optimization */ … … 61 59 char chLabel[NCOLNT_LAB_LEN+1]; 62 60 63 /* these are labels for iso line cooling, sum of ALL hydrogen lines,64 * along the iso sequence65 static char chHlin[LIMELM][5]=66 {"Hl 0","Hl 1","Hl 2","Hl 3","Hl 4","Hl 5","Hl 6","Hl 7","Hl 8","Hl 9",67 "Hl10","Hl11","Hl12","Hl13","Hl14","Hl15","Hl16","Hl17","Hl18","Hl19",68 "Hl20","Hl21","Hl22","Hl23","Hl24","Hl25","Hl26","Hl27","Hl28","Hl29"}; */69 70 /* these are labels for iso collisional ionization cooling,71 * along the iso sequence72 static char chHion[LIMELM][5]=73 {"Hi 0","Hi 1","Hi 2","Hi 3","Hi 4","Hi 5","Hi 6","Hi 7","Hi 8","Hi 9",74 "Hi10","Hi11","Hi12","Hi13","Hi14","Hi15","Hi16","Hi17","Hi18","Hi19",75 "Hi20","Hi21","Hi22","Hi23","Hi24","Hi25","Hi26","Hi27","Hi28","Hi29"}; */76 77 /* these are labels for iso photoionization heating,78 * along the iso sequence79 static char chHp[LIMELM][5]=80 {"Hp 0","Hp 1","Hp 2","Hp 3","Hp 4","Hp 5","Hp 6","Hp 7","Hp 8","Hp 9",81 "Hp10","Hp11","Hp12","Hp13","Hp14","Hp15","Hp16","Hp17","Hp18","Hp19",82 "Hp20","Hp21","Hp22","Hp23","Hp24","Hp25","Hp26","Hp27","Hp28","Hp29"};*/83 84 /* these are labels for iso induced recombination heating,85 * along the iso sequence86 static char chHn[LIMELM][5]=87 {"Hn 0","Hn 1","Hn 2","Hn 3","Hn 4","Hn 5","Hn 6","Hn 7","Hn 8","Hn 9",88 "Hn10","Hn11","Hn12","Hn13","Hn14","Hn15","Hn16","Hn17","Hn18","Hn19",89 "Hn20","Hn21","Hn22","Hn23","Hn24","Hn25","Hn26","Hn27","Hn28","Hn29"}; */90 91 61 DEBUG_ENTRY( "iso_cool()" ); 92 62 … … 160 130 * and its coupling to continuum can be large, at various times code 161 131 * had to ignore effects of very highest level, but starting in mid 162 * 20006 all levels have been included */ 163 for( n=0; n < iso.numLevels_local[ipISO][nelem]; ++n ) 132 * 20006 all levels have been included 133 * 2008 apr 18, do not include highest - when only 2 collapsed levels 134 * are used several density 13 BLR sims have serious convergence 135 * problems */ 136 for( n=0; n < iso.numLevels_local[ipISO][nelem]-1; ++n ) 164 137 { 165 138 /* total collisional ionization cooling less three body heating */ … … 168 141 (StatesElem[ipISO][nelem][n].Pop -iso.PopLTE[ipISO][nelem][n]*dense.eden); 169 142 CollisIonizatCoolingTotal += CollisIonizatCooling; 170 /*fprintf(ioQQQ,"DEBUG CollisIonizatCoolingTotal %.2e %2li %2li %2li %.2e %.4e %.4e %.3f\n",171 CollisIonizatCoolingTotal,172 ipISO , nelem , n ,173 CollisIonizatCooling ,174 StatesElem[ipISO][nelem][n].Pop ,175 iso.PopLTE[ipISO][nelem][n]*dense.eden ,176 fabs(StatesElem[ipISO][nelem][n].Pop - iso.PopLTE[ipISO][nelem][n]*dense.eden ) /177 (iso.PopLTE[ipISO][nelem][n]*dense.eden) );*/178 143 179 144 /* the derivative of the cooling 180 145 * need extra factor of temp of 1 Ryd since div by square of temp in Ryd */ 181 146 CollisIonizatCoolingDT = CollisIonizatCooling* 182 (iso.xIsoLevNIonRyd[ipISO][nelem][n]/TE1RYD/POW2(phycon.te_ryd) /* -183 thermal.halfte*/); 147 (iso.xIsoLevNIonRyd[ipISO][nelem][n]/TE1RYD/POW2(phycon.te_ryd)); 148 184 149 dCollisIonizatCoolingTotalDT += CollisIonizatCoolingDT; 185 150 // save values for debug printout … … 280 245 thin = iso.RadRecomb[ipISO][nelem][0][ipRecRad]* 281 246 /* arg is the scaled temperature, T * n^2 / Z^2, 282 * n is princip lequantum number, Z is charge, 1 for H */247 * n is principal quantum number, Z is charge, 1 for H */ 283 248 HCoolRatio( 284 249 phycon.te * POW2( (double)StatesElem[ipISO][nelem][0].n / (double)(nelem+1-ipISO) ))* … … 297 262 thin = iso.RadRecomb[ipISO][nelem][n][ipRecRad]* 298 263 /* arg is the scaled temperature, T * n^2 / Z^2, 299 * n is princip lequantum number, Z is charge, 1 for H */264 * n is principal quantum number, Z is charge, 1 for H */ 300 265 HCoolRatio( 301 266 phycon.te * POW2( (double)StatesElem[ipISO][nelem][n].n / (double)(nelem+1-ipISO) ))* … … 316 281 if( DEBUG_LOC ) 317 282 { 318 if( nelem== 1 && ipISO==ipHE_LIKE)283 if( nelem==ipISO ) 319 284 { 320 285 /* >>chng 06 aug 17, should go to numLevels_local instead of _max. */ … … 526 491 527 492 iso.xLineTotCool[ipISO][nelem] += hlone; 528 {529 /* debug block for collisional cooling between two levels */530 enum {DEBUG_LOC=false};531 if( DEBUG_LOC && ipISO==ipHE_LIKE && nelem==ipHELIUM /**/ )532 {533 fprintf(ioQQQ,"iso_coolll %li %li %.2e %.2e %.2e %.2e\n",534 ipHi , ipLo,535 StatesElem[ipISO][nelem][ipHi].Pop ,536 Transitions[ipISO][nelem][ipHi][ipLo].Coll.ColUL ,537 Transitions[ipISO][nelem][ipHi][ipLo].Coll.cs ,538 hlone/SDIV( thermal.htot ) );539 }540 }541 493 542 494 /* next get derivative */ … … 569 521 if( DEBUG_LOC ) 570 522 { 571 if( ipISO==ipHE_LIKE && nelem==ipHELIUM)523 if( nelem==ipISO ) 572 524 fprintf(ioQQQ,"%li %li %.2e\n", nlo_heat_max, nhi_heat_max, heat_max ); 573 525 } … … 655 607 if( iso.xLineTotCool[ipISO][nelem] > 0. ) 656 608 { 657 /* hydrogenis a net coolant label gives iso sequence, "wavelength" gives element */609 /* species is a net coolant label gives iso sequence, "wavelength" gives element */ 658 610 CoolAdd(chLabel,(realnum)nelem,iso.xLineTotCool[ipISO][nelem]); 659 611 thermal.dCooldT += dCdT_all; … … 662 614 else 663 615 { 664 /* hydrogenis a net heat source, thermal.heating[0][23]was set to 0 in CoolEvaluate*/616 /* species is a net heat source, thermal.heating[0][23]was set to 0 in CoolEvaluate*/ 665 617 thermal.heating[0][23] -= iso.xLineTotCool[ipISO][nelem]; 666 618 CoolAdd(chLabel,(realnum)nelem,0.); … … 681 633 iso.cBal_cool[ipISO][nelem]/iso.xLineTotCool[ipISO][nelem] , 682 634 iso.cRest_cool[ipISO][nelem]/iso.xLineTotCool[ipISO][nelem] ); 683 684 # if 0685 if( iso.cLya_cool[ipISO][nelem]/iso.xLineTotCool[ipISO][nelem] > 0.9 )686 fprintf(ioQQQ," 1s 2s 2p %.2e %.2e %.2e\n",687 StatesElem[ipISO][nelem][ipH1s].Pop ,688 StatesElem[ipISO][nelem][ipH2s].Pop ,689 StatesElem[ipISO][nelem][ipH2p].Pop);690 691 # endif692 635 } 693 636 } … … 756 699 #pragma OPTIMIZE ON 757 700 #endif 758 /*lint +e661 Possible access of out-of-bounds pointer*/759 /*lint +e662 (Warning -- Possible creation of out-of-bounds pointer */
