cloudy  trunk
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
prt_lines_general.cpp
Go to the documentation of this file.
1 /* This file is part of Cloudy and is copyright (C)1978-2008 by Gary J. Ferland and
2  * others. For conditions of distribution and use see copyright notice in license.txt */
3 /*lines_general put general information and energetics into line intensity stack */
4 /*GetMaxhLine find the strongest heating line */
5 #include "cddefines.h"
6 #include "taulines.h"
7 #include "coolheavy.h"
8 #include "hydrogenic.h"
9 #include "dense.h"
10 #include "thermal.h"
11 #include "continuum.h"
12 #include "geometry.h"
13 #include "dynamics.h"
14 #include "rt.h"
15 #include "iso.h"
16 #include "rfield.h"
17 #include "trace.h"
18 #include "ionbal.h"
19 #include "lines_service.h"
20 #include "radius.h"
21 #include "lines.h"
22 /*GetMaxhLine find the strongest heating line */
23 STATIC void GetMaxhLine(void);
24 
25 void lines_general(void)
26 {
27  long int i,
28  ipHi,
29  ipLo,
30  nelem,
31  ipnt;
32 
33  double
34  hbetac,
35  HeatMetal ,
36  ee511,
37  hlalph;
38 
39  DEBUG_ENTRY( "lines_general()" );
40 
41  if( trace.lgTrace )
42  {
43  fprintf( ioQQQ, " lines_general called\n" );
44  }
45 
46  i = StuffComment( "general properties" );
47  linadd( 0., (realnum)i , "####", 'i',
48  " start of general properties");
49 
50  /* total H-beta from multi-level atom */
51  nelem = ipHYDROGEN;
52  ipHi = ipH4p;
53  ipLo = ipH2p;
54 
55  if( iso.n_HighestResolved_max[ipH_LIKE][nelem] >= 4 )
56  {
57  hbetac =
58  (Transitions[ipH_LIKE][nelem][ipH4p][ipH2s].Emis->Aul *
59  Transitions[ipH_LIKE][nelem][ipH4p][ipH2s].Emis->Pesc *
60  StatesElem[ipH_LIKE][nelem][ipH4p].Pop +
61  Transitions[ipH_LIKE][nelem][ipH4s][ipH2p].Emis->Aul *
62  Transitions[ipH_LIKE][nelem][ipH4s][ipH2p].Emis->Pesc *
63  StatesElem[ipH_LIKE][nelem][ipH4s].Pop +
64  Transitions[ipH_LIKE][nelem][ipH4d][ipH2p].Emis->Aul *
65  Transitions[ipH_LIKE][nelem][ipH4d][ipH2p].Emis->Pesc *
66  StatesElem[ipH_LIKE][nelem][ipH4d].Pop) *
67  Transitions[ipH_LIKE][nelem][ipHi][ipLo].EnergyErg*
69  }
70  else
71  {
72  hbetac =
73  (Transitions[ipH_LIKE][nelem][ipHi][ipH2s].Emis->Aul *
74  Transitions[ipH_LIKE][nelem][ipHi][ipH2s].Emis->Pesc +
75  Transitions[ipH_LIKE][nelem][ipHi][ipH2p].Emis->Aul *
76  Transitions[ipH_LIKE][nelem][ipHi][ipH2p].Emis->Pesc ) *
77  StatesElem[ipH_LIKE][nelem][ipHi].Pop *
78  Transitions[ipH_LIKE][nelem][ipHi][ipLo].EnergyErg*
80  }
81 
82  /* these lines added to outlin in metdif - following must be false
83  * this passes array index for line energy in continuum mesh - in rest
84  * of code this is set by a previous call to PntForLine, this index
85  * is on the f not c scale */
86  rt.fracin = Transitions[ipH_LIKE][nelem][ipHi][ipH2s].Emis->FracInwd;
87  lindst(hbetac,4861,"TOTL",Transitions[ipH_LIKE][nelem][ipHi][ipH2s].ipCont,'i',false," " );
88  rt.fracin = 0.5;
89 
90  /* total Ly-a from multi-level atom */
91  ipHi = ipH2p;
92  ipLo = ipH1s;
93  hlalph =
94  Transitions[ipH_LIKE][nelem][ipHi][ipLo].Emis->Aul*
95  Transitions[ipH_LIKE][nelem][ipHi][ipLo].Hi->Pop*
96  Transitions[ipH_LIKE][nelem][ipHi][ipLo].Emis->Pesc*
97  Transitions[ipH_LIKE][nelem][ipHi][ipLo].EnergyErg*
99 
100  rt.fracin = Transitions[ipH_LIKE][nelem][ipHi][ipLo].Emis->FracInwd;
101  lindst(hlalph,1216,"TOTL",Transitions[ipH_LIKE][nelem][ipHi][ipLo].ipCont,'i',false ,
102  "");
103  rt.fracin = 0.5;
104 
106 
107  /* H 21 cm, A from
108  * >>refer H1 A Gould, ApJ 423, 522
109  * =2.88426e-15 s-1 */
110 
111  linadd(continuum.totlsv,0,"Inci",'i',
112  "total luminosity in incident continuum");
114 
115  /* ipass is flag to indicate whether to only set up line array
116  * (ipass=0) or actually evaluate lines intensities (ipass=1) */
117  if( LineSave.ipass > 0 )
118  {
119  continuum.totlsv = 0.;
120  }
121 
122  linadd(thermal.htot,0,"TotH",'i',
123  " total heating, all forms, information since individuals added later ");
124 
125  linadd(thermal.ctot,0,"TotC",'i',
126  " total cooling, all forms, information since individuals added later ");
127 
128  linadd(thermal.heating[0][0],0,"BFH1",'h',
129  " hydrogen photoionization heating, ground state only ");
130 
131  linadd(thermal.heating[0][1],0,"BFHx",'h',
132  " net hydrogen photoionization heating less rec cooling, all excited states normally zero, positive if excited states are net heating ");
133 
134  linadd(thermal.heating[0][22],0,"Line",'h',
135  " heating due to induced lines absorption of continuum ");
136  if( thermal.htot > 0. )
137  {
139  {
141  /* finds the strongest heating line */
142  GetMaxhLine();
143  }
144  }
145 
146  linadd(thermal.heating[1][0]+thermal.heating[1][1]+thermal.heating[1][2],0,"BFHe",'h',
147  " total helium photoionization heating, all stages ");
148 
149  HeatMetal = 0.;
150  /* some sums that will be printed in the stack */
151  for( nelem=2; nelem<LIMELM; ++nelem)
152  {
153  /* we now have final solution for this element */
154  for( i=dense.IonLow[nelem]; i < dense.IonHigh[nelem]; i++ )
155  {
156  ASSERT( i < LIMELM );
157  /* total metal photo heating for LINES */
158  HeatMetal += thermal.heating[nelem][i];
159  }
160  }
161 
162  linadd(HeatMetal,0,"TotM",'h',
163  " total heavy element photoionization heating, all stages ");
164 
165  linadd(thermal.heating[0][21],0,"pair",'h',
166  " heating due to pair production ");
167 
168  /* ipass is flag to indicate whether to only set up line array
169  * (ipass=0) or actually evaluate lines intensities (ipass=1) */
170  if( LineSave.ipass > 0 )
171  {
172  /* this will be max local heating due to bound compton */
174  }
175  else
176  {
177  ionbal.CompHeating_Max = 0.;
178  }
179 
180  linadd(ionbal.CompRecoilHeatLocal,0,"Cbnd",'h',
181  " heating due to bound compton scattering ");
182 
183  linadd(rfield.cmheat,0,"ComH",'h',
184  " Compton heating ");
185 
186  linadd(CoolHeavy.tccool,0,"ComC",'c',
187  " total Compton cooling ");
188 
189  /* record max local heating due to advection */
191  /* record max local cooling due to advection */
193 
194  linadd(dynamics.Cool , 0 , "advC" , 'i',
195  " cooling due to advection " );
196 
197  linadd(dynamics.Heat , 0 , "advH" , 'i' ,
198  " heating due to advection ");
199 
200  linadd( thermal.char_tran_heat ,0,"CT H",'h',
201  " heating due to charge transfer ");
202 
203  linadd( thermal.char_tran_cool ,0,"CT C",'c',
204  " cooling due to charge transfer ");
205 
206  linadd(thermal.heating[1][6],0,"CR H",'h',
207  " cosmic ray heating ");
208 
209  linadd(thermal.heating[0][20],0,"extH",'h',
210  " extra heat added to this zone, from HEXTRA command ");
211 
212  linadd(CoolHeavy.cextxx,0,"extC",'c',
213  " extra cooling added to this zone, from CEXTRA command ");
214 
215 
217  PntForLine(2.427e-2,"e-e+",&ipnt);
218  lindst(ee511,0,"e-e+",ipnt,'i',true,
219  " 511keV annihilation line " );
220 
221  linadd(CoolHeavy.expans,0,"Expn",'c',
222  " expansion cooling, only non-zero for wind ");
223 
224  linadd(iso.RadRecCool[ipH_LIKE][ipHYDROGEN],0,"H FB",'i',
225  " H radiative recombination cooling ");
226 
227  linadd(MAX2(0.,iso.FreeBnd_net_Cool_Rate[ipH_LIKE][ipHYDROGEN]),0,"HFBc",'c',
228  " net free-bound cooling ");
229 
230  linadd(MAX2(0.,-iso.FreeBnd_net_Cool_Rate[ipH_LIKE][ipHYDROGEN]),0,"HFBh",'h',
231  " net free-bound heating ");
232 
233  linadd(iso.RecomInducCool_Rate[ipH_LIKE][ipHYDROGEN],0,"Hind",'c',
234  " cooling due to induced rec of hydrogen ");
235 
236  linadd(CoolHeavy.c3ind,0,"3He2",'c',
237  " cooling due to induced rec of fully ionized helium ");
238 
239  linadd(CoolHeavy.cyntrn,0,"Cycn",'c',
240  " cyclotron cooling ");
241  return;
242 }
243 
244 /*GetMaxhLine find the strongest heating line */
245 STATIC void GetMaxhLine(void)
246 {
247  long int i;
248  double strong;
249 
250  DEBUG_ENTRY( "GetMaxhLine()" );
251 
252  /* routine called to find which is the strongest heating line */
253  strong = 0.;
254 
255  /* possible for levlmax to remain 0 if induced processes turned off */
256  thermal.levlmax = 0;
257 
258  for( i=1; i <= nLevel1; i++ )
259  {
260  if( TauLines[i].Coll.heat > strong )
261  {
262  strong = TauLines[i].Coll.heat;
263  thermal.levlmax = 1;
264  thermal.ipHeatlmax = i;
265  }
266  }
267 
268  for( i=0; i < nWindLine; i++ )
269  {
270  if( TauLine2[i].Hi->IonStg < TauLine2[i].Hi->nelem+1-NISO )
271  {
272  if( TauLine2[i].Coll.heat > strong )
273  {
274  strong = TauLine2[i].Coll.heat;
275  thermal.levlmax = 2;
276  thermal.ipHeatlmax = i;
277  }
278  }
279  }
280 
281  for( i=0; i < nHFLines; i++ )
282  {
283  if( HFLines[i].Coll.heat > strong )
284  {
285  strong = HFLines[i].Coll.heat;
286  thermal.levlmax = 3;
287  thermal.ipHeatlmax = i;
288  }
289  }
290 
291  for( i=0; i < nCORotate; i++ )
292  {
293  if( C12O16Rotate[i].Coll.heat > strong )
294  {
295  strong = C12O16Rotate[i].Coll.heat;
296  thermal.levlmax = 4;
297  thermal.ipHeatlmax = i;
298  }
299  if( C13O16Rotate[i].Coll.heat > strong )
300  {
301  strong = C13O16Rotate[i].Coll.heat;
302  thermal.levlmax = 5;
303  thermal.ipHeatlmax = i;
304  }
305  }
306 
307  /* Atoms & Molecules */
308  for( i=0; i < linesAdded2; i++ )
309  {
310  if(atmolEmis[i].tran->Coll.heat > strong )
311  {
312  strong = atmolEmis[i].tran->Coll.heat;
313  thermal.levlmax = 6;
314  thermal.ipHeatlmax = i;
315  }
316  }
317  return;
318 }

Generated for cloudy by doxygen 1.8.1.1