/home66/gary/public_html/cloudy/c08_branch/source/prt_lines_general.cpp

Go to the documentation of this file.
00001 /* This file is part of Cloudy and is copyright (C)1978-2008 by Gary J. Ferland and
00002  * others.  For conditions of distribution and use see copyright notice in license.txt */
00003 /*lines_general put general information and energetics into line intensity stack */
00004 /*GetMaxhLine find the strongest heating line */
00005 #include "cddefines.h"
00006 #include "taulines.h"
00007 #include "coolheavy.h"
00008 #include "hydrogenic.h"
00009 #include "dense.h"
00010 #include "thermal.h"
00011 #include "continuum.h"
00012 #include "geometry.h"
00013 #include "dynamics.h"
00014 #include "rt.h"
00015 #include "iso.h"
00016 #include "rfield.h"
00017 #include "trace.h"
00018 #include "ionbal.h"
00019 #include "lines_service.h"
00020 #include "radius.h"
00021 #include "lines.h"
00022 /*GetMaxhLine find the strongest heating line */
00023 STATIC void GetMaxhLine(void);
00024 
00025 void lines_general(void)
00026 {
00027         long int i, 
00028           ipHi, 
00029           ipLo, 
00030           nelem, 
00031           ipnt;
00032 
00033         double 
00034           hbetac, 
00035           HeatMetal ,
00036           ee511, 
00037           hlalph;
00038 
00039         DEBUG_ENTRY( "lines_general()" );
00040 
00041         if( trace.lgTrace )
00042         {
00043                 fprintf( ioQQQ, "   lines_general called\n" );
00044         }
00045 
00046         i = StuffComment( "general properties" );
00047         linadd( 0., (realnum)i , "####", 'i',
00048                 " start of general properties");
00049 
00050         /* total H-beta from multi-level atom */
00051         nelem = ipHYDROGEN;
00052         ipLo = ipH2p;
00053 
00054         // this can be changed with the atom levels command but must be at
00055         // least 3
00056         ASSERT( iso.n_HighestResolved_max[ipH_LIKE][nelem] >=3 );
00057 
00058         if( iso.n_HighestResolved_max[ipH_LIKE][nelem] >= 4 )
00059         {
00060                 ipHi = ipH4p;
00061                 hbetac = 
00062                 (Transitions[ipH_LIKE][nelem][ipH4p][ipH2s].Emis->Aul * 
00063                 Transitions[ipH_LIKE][nelem][ipH4p][ipH2s].Emis->Pesc *
00064                 StatesElem[ipH_LIKE][nelem][ipH4p].Pop +
00065                 Transitions[ipH_LIKE][nelem][ipH4s][ipH2p].Emis->Aul *
00066                 Transitions[ipH_LIKE][nelem][ipH4s][ipH2p].Emis->Pesc *
00067                 StatesElem[ipH_LIKE][nelem][ipH4s].Pop +
00068                 Transitions[ipH_LIKE][nelem][ipH4d][ipH2p].Emis->Aul *
00069                 Transitions[ipH_LIKE][nelem][ipH4d][ipH2p].Emis->Pesc *
00070                 StatesElem[ipH_LIKE][nelem][ipH4d].Pop) *
00071                 Transitions[ipH_LIKE][nelem][ipHi][ipLo].EnergyErg*
00072                 dense.xIonDense[ipHYDROGEN][1];
00073         }
00074         else
00075         {
00076                 // atom levels command does not allow < 3
00077                 ASSERT( iso.n_HighestResolved_max[ipH_LIKE][nelem] == 3 );
00078                 ipHi = 6;
00079                 hbetac = 
00080                         (Transitions[ipH_LIKE][nelem][ipHi][ipH2s].Emis->Aul * 
00081                         Transitions[ipH_LIKE][nelem][ipHi][ipH2s].Emis->Pesc +
00082                         Transitions[ipH_LIKE][nelem][ipHi][ipH2p].Emis->Aul *
00083                         Transitions[ipH_LIKE][nelem][ipHi][ipH2p].Emis->Pesc ) *
00084                         StatesElem[ipH_LIKE][nelem][ipHi].Pop *
00085                         Transitions[ipH_LIKE][nelem][ipHi][ipLo].EnergyErg*
00086                         dense.xIonDense[ipHYDROGEN][1];
00087         }
00088 
00089         /* these lines added to outlin in metdif - following must be false 
00090          * this passes array index for line energy in continuum mesh - in rest
00091          * of code this is set by a previous call to PntForLine, this index
00092          * is on the f not c scale */
00093         rt.fracin = Transitions[ipH_LIKE][nelem][ipHi][ipH2s].Emis->FracInwd;
00094         lindst(hbetac,Transitions[ipH_LIKE][nelem][ipHi][ipH2s].WLAng,"TOTL",
00095                 Transitions[ipH_LIKE][nelem][ipHi][ipH2s].ipCont,'i',false,
00096                    " H I Balmer beta predicted by model atom " );
00097         rt.fracin = 0.5;
00098 
00099         /* total Ly-a from multi-level atom */
00100         ipHi = ipH2p;
00101         ipLo = ipH1s;
00102         hlalph = 
00103                 Transitions[ipH_LIKE][nelem][ipHi][ipLo].Emis->Aul* 
00104                 Transitions[ipH_LIKE][nelem][ipHi][ipLo].Hi->Pop*
00105                 Transitions[ipH_LIKE][nelem][ipHi][ipLo].Emis->Pesc*
00106                 Transitions[ipH_LIKE][nelem][ipHi][ipLo].EnergyErg*
00107                 dense.xIonDense[ipHYDROGEN][1];
00108 
00109         rt.fracin = Transitions[ipH_LIKE][nelem][ipHi][ipLo].Emis->FracInwd;
00110         lindst(hlalph,Transitions[ipH_LIKE][nelem][ipHi][ipLo].WLAng,"TOTL",
00111                 Transitions[ipH_LIKE][nelem][ipHi][ipLo].ipCont,'i',false ,
00112                 " H I Lya predicted from model atom ");
00113         rt.fracin = 0.5;
00114 
00115         continuum.totlsv = continuum.totlsv/radius.dVeff*geometry.covgeo;
00116 
00117         /* H 21 cm, A from 
00118          * >>refer      H1      A       Gould, ApJ 423, 522
00119          * =2.88426e-15 s-1 */
00120 
00121         linadd(continuum.totlsv,0,"Inci",'i',
00122                 "total luminosity in incident continuum");
00123         continuum.totlsv = continuum.totlsv*radius.dVeff/geometry.covgeo;
00124 
00125         /* ipass is flag to indicate whether to only set up line array
00126          * (ipass=0) or actually evaluate lines intensities (ipass=1) */
00127         if( LineSave.ipass > 0 )
00128         {
00129                 continuum.totlsv = 0.;
00130         }
00131 
00132         linadd(thermal.htot,0,"TotH",'i',
00133                 "  total heating, all forms, information since individuals added later ");
00134 
00135         linadd(thermal.ctot,0,"TotC",'i',
00136                 "  total cooling, all forms, information since individuals added later ");
00137 
00138         linadd(thermal.heating[0][0],0,"BFH1",'h',
00139                 "  hydrogen photoionization heating, ground state only ");
00140 
00141         linadd(thermal.heating[0][1],0,"BFHx",'h',
00142                 "  net hydrogen photoionization heating less rec cooling, all excited states normally zero, positive if excited states are net heating ");
00143 
00144         linadd(thermal.heating[0][22],0,"Line",'h',
00145                 "  heating due to induced lines absorption of continuum ");
00146         if( thermal.htot > 0. )
00147         {
00148                 if( thermal.heating[0][22]/thermal.htot > thermal.HeatLineMax )
00149                 {
00150                         thermal.HeatLineMax = (realnum)(thermal.heating[0][22]/thermal.htot);
00151                         /* finds the strongest heating line */
00152                         GetMaxhLine();
00153                 }
00154         }
00155 
00156         linadd(thermal.heating[1][0]+thermal.heating[1][1]+thermal.heating[1][2],0,"BFHe",'h',
00157           "  total helium photoionization heating, all stages ");
00158 
00159         HeatMetal = 0.;
00160         /* some sums that will be printed in the stack */
00161         for( nelem=2; nelem<LIMELM; ++nelem)
00162         {
00163                 /* we now have final solution for this element */
00164                 for( i=dense.IonLow[nelem]; i < dense.IonHigh[nelem]; i++ )
00165                 {
00166                         ASSERT( i < LIMELM );
00167                         /* total metal photo heating for LINES */
00168                         HeatMetal += thermal.heating[nelem][i];
00169                 }
00170         }
00171 
00172         linadd(HeatMetal,0,"TotM",'h',
00173                 "  total heavy element photoionization heating, all stages ");
00174 
00175         linadd(thermal.heating[0][21],0,"pair",'h',
00176                 "  heating due to pair production ");
00177 
00178         /* ipass is flag to indicate whether to only set up line array
00179          * (ipass=0) or actually evaluate lines intensities (ipass=1) */
00180         if( LineSave.ipass > 0 )
00181         {
00182                 /* this will be max local heating due to bound compton */
00183                 ionbal.CompHeating_Max = MAX2( ionbal.CompHeating_Max , ionbal.CompRecoilHeatLocal/thermal.htot);
00184         }
00185         else
00186         {
00187                 ionbal.CompHeating_Max = 0.;
00188         }
00189 
00190         linadd(ionbal.CompRecoilHeatLocal,0,"Cbnd",'h',
00191                 "  heating due to bound compton scattering ");
00192 
00193         linadd(rfield.cmheat,0,"ComH",'h',
00194                 "  Compton heating ");
00195 
00196         linadd(CoolHeavy.tccool,0,"ComC",'c',
00197                 "  total Compton cooling ");
00198 
00199         /* record max local heating due to advection */
00200         dynamics.HeatMax = MAX2( dynamics.HeatMax , dynamics.Heat /thermal.htot );
00201         /* record max local cooling due to advection */
00202         dynamics.CoolMax = MAX2( dynamics.CoolMax , dynamics.Cool /thermal.htot );
00203 
00204         linadd(dynamics.Cool  , 0 , "advC" , 'i',
00205                 "  cooling due to advection " );
00206 
00207         linadd(dynamics.Heat , 0 , "advH" , 'i' ,
00208                 "  heating due to advection ");
00209 
00210         linadd( thermal.char_tran_heat ,0,"CT H",'h',
00211                 " heating due to charge transfer ");
00212 
00213         linadd( thermal.char_tran_cool ,0,"CT C",'c',
00214                 " cooling due to charge transfer ");
00215 
00216         linadd(thermal.heating[1][6],0,"CR H",'h',
00217                 " cosmic ray heating ");
00218 
00219         linadd(thermal.heating[0][20],0,"extH",'h',
00220                 " extra heat added to this zone, from HEXTRA command ");
00221 
00222         linadd(CoolHeavy.cextxx,0,"extC",'c',
00223                 " extra cooling added to this zone, from CEXTRA command ");
00224 
00225 
00226         ee511 = (dense.gas_phase[ipHYDROGEN] + 4.*dense.gas_phase[ipHELIUM])*ionbal.PairProducPhotoRate[0]*2.*8.20e-7;
00227         PntForLine(2.427e-2,"e-e+",&ipnt);
00228         lindst(ee511,(realnum)2.427e-2,"e-e+",ipnt,'i',true,
00229                 " 511keV annihilation line " );
00230 
00231         linadd(CoolHeavy.expans,0,"Expn",'c',
00232                 "  expansion cooling, only non-zero for wind ");
00233 
00234         linadd(iso.RadRecCool[ipH_LIKE][ipHYDROGEN],0,"H FB",'i',
00235                 "  H radiative recombination cooling ");
00236 
00237         linadd(MAX2(0.,iso.FreeBnd_net_Cool_Rate[ipH_LIKE][ipHYDROGEN]),0,"HFBc",'c',
00238                 "  net free-bound cooling ");
00239 
00240         linadd(MAX2(0.,-iso.FreeBnd_net_Cool_Rate[ipH_LIKE][ipHYDROGEN]),0,"HFBh",'h',
00241                 "  net free-bound heating ");
00242 
00243         linadd(iso.RecomInducCool_Rate[ipH_LIKE][ipHYDROGEN],0,"Hind",'c',
00244                 "  cooling due to induced rec of hydrogen ");
00245 
00246         linadd(CoolHeavy.c3ind,0,"3He2",'c',
00247                 "  cooling due to induced rec of fully ionized helium ");
00248 
00249         linadd(CoolHeavy.cyntrn,0,"Cycn",'c',
00250                 "  cyclotron cooling ");
00251         return;
00252 }
00253 
00254 /*GetMaxhLine find the strongest heating line */
00255 STATIC void GetMaxhLine(void)
00256 {
00257         long int i;
00258         double strong;
00259 
00260         DEBUG_ENTRY( "GetMaxhLine()" );
00261 
00262         /* routine called to find which is the strongest heating line */
00263         strong = 0.;
00264 
00265         /* possible for levlmax to remain 0 if induced processes turned off */
00266         thermal.levlmax = 0;
00267 
00268         for( i=1; i <= nLevel1; i++ )
00269         {
00270                 if( TauLines[i].Coll.heat > strong )
00271                 {
00272                         strong = TauLines[i].Coll.heat;
00273                         thermal.levlmax = 1;
00274                         thermal.ipHeatlmax = i;
00275                 }
00276         }
00277 
00278         for( i=0; i < nWindLine; i++ )
00279         {
00280                 if( TauLine2[i].Hi->IonStg < TauLine2[i].Hi->nelem+1-NISO )
00281                 {
00282                         if( TauLine2[i].Coll.heat > strong )
00283                         {
00284                                 strong = TauLine2[i].Coll.heat;
00285                                 thermal.levlmax = 2;
00286                                 thermal.ipHeatlmax = i;
00287                         }
00288                 }
00289         }
00290 
00291         for( i=0; i < nHFLines; i++ )
00292         {
00293                 if( HFLines[i].Coll.heat > strong )
00294                 {
00295                         strong = HFLines[i].Coll.heat;
00296                         thermal.levlmax = 3;
00297                         thermal.ipHeatlmax = i;
00298                 }
00299         }
00300 
00301         for( i=0; i < nCORotate; i++ )
00302         {
00303                 if( C12O16Rotate[i].Coll.heat > strong )
00304                 {
00305                         strong = C12O16Rotate[i].Coll.heat;
00306                         thermal.levlmax = 4;
00307                         thermal.ipHeatlmax = i;
00308                 }
00309                 if( C13O16Rotate[i].Coll.heat > strong )
00310                 {
00311                         strong = C13O16Rotate[i].Coll.heat;
00312                         thermal.levlmax = 5;
00313                         thermal.ipHeatlmax = i;
00314                 }
00315         }
00316 
00317         /* Atoms & Molecules */
00318         for( i=0; i < linesAdded2; i++ )
00319         {
00320                 if(atmolEmis[i].tran->Coll.heat > strong )
00321                 {
00322                         strong = atmolEmis[i].tran->Coll.heat;
00323                         thermal.levlmax = 6;
00324                         thermal.ipHeatlmax = i;
00325                 }
00326         }
00327         return;
00328 }

Generated on Mon Feb 16 12:01:26 2009 for cloudy by  doxygen 1.4.7