cloudy  trunk
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
prt_lines_continuum.cpp
Go to the documentation of this file.
1 /* This file is part of Cloudy and is copyright (C)1978-2013 by Gary J. Ferland and
2  * others. For conditions of distribution and use see copyright notice in license.txt */
3 /*lines_continuum put energetics, H, and He lines into line intensity stack */
4 #include "cddefines.h"
5 #include "taulines.h"
6 #include "physconst.h"
7 #include "iso.h"
8 #include "geometry.h"
9 #include "heavy.h"
10 #include "dense.h"
11 #include "prt.h"
12 #include "opacity.h"
13 #include "coolheavy.h"
14 #include "optimize.h"
15 #include "phycon.h"
16 #include "rfield.h"
17 #include "predcont.h"
18 #include "lines_service.h"
19 #include "radius.h"
20 #include "continuum.h"
21 #include "lines.h"
22 #include "elementnames.h"
23 
24 void lines_continuum(void)
25 {
26 
27  double f1,
28  f2 ,
29  bac ,
30  flow;
31  long i,nBand;
32 
33  DEBUG_ENTRY( "lines_continuum()" );
34 
35  /* code has all local emissivities zeroed out with cryptic comment about being
36  * situation dependent. Why? this is option to turn back on */
37  const bool KILL_CONT = false;
38 
39  i = StuffComment( "continua" );
40  linadd( 0., (realnum)i , "####", 'i',
41  " start continua");
42 
43  /* these entries only work correctly if the APERTURE command is not in effect */
44  if( geometry.iEmissPower == 2 )
45  {
46  /***********************************************************************
47  * stuff in Bac ratio - continuum above the Balmer Jump
48  * this is trick, zeroing out saved continuum integrated so far,
49  * and adding the current version, so that the line array gives the
50  * value in the final continuum
51  *
52  * reflected continuum is different from others since relative to inner
53  * radius, others for for this radius
54  *************************************************************************/
55 
57  /***************************************************************************
58  * "Bac " , 3646, this is residual continuum at peak of Balmer Jump
59  * flux below - flux above
60  ***************************************************************************/
61  /* >>chng 00 dec 02, remove opac.tmn */
62  /* >>chng 00 dec 19, remove / radius.GeoDil */
63  /* extrapolated continuum above head */
64  /* >>chng 01 jul 13, from ConInterOut to ConEmitOut */
65  f1 = (rfield.ConEmitOut[0][iso_sp[ipH_LIKE][ipHYDROGEN].fb[2].ipIsoLevNIonCon-1] +
66  rfield.ConEmitReflec[0][iso_sp[ipH_LIKE][ipHYDROGEN].fb[2].ipIsoLevNIonCon-1]/radius.r1r0sq )/
67  rfield.widflx[iso_sp[ipH_LIKE][ipHYDROGEN].fb[2].ipIsoLevNIonCon-1];
68 
69  /* extrapolated continuum below head */
70  /* >>chng 00 dec 19, remove / radius.GeoDil */
71  f2 = (rfield.ConEmitOut[0][iso_sp[ipH_LIKE][ipHYDROGEN].fb[2].ipIsoLevNIonCon-2]+
72  rfield.ConEmitReflec[0][iso_sp[ipH_LIKE][ipHYDROGEN].fb[2].ipIsoLevNIonCon-2]/radius.r1r0sq )/
73  rfield.widflx[iso_sp[ipH_LIKE][ipHYDROGEN].fb[2].ipIsoLevNIonCon-2];
74 
75  /* convert to nuFnu units */
76  f1 = f1*0.250*0.250*EN1RYD*radius.r1r0sq;
77  f2 = f2*0.250*0.250*EN1RYD*radius.r1r0sq;
78  bac = (f1 - f2);
79 
80  /* memory not allocated until ipass >= 0
81  * clear summed intrinsic and emergent intensity of following
82  * entry - following call to linadd will enter the total and
83  * keep entering the total but is done for each zone hence need to
84  * keep resetting to zero*/
85  if( LineSave.ipass > 0 )
86  {
87  LineSv[LineSave.nsum].SumLine[0] = 0.;
88  LineSv[LineSave.nsum].SumLine[1] = 0.;
89  }
90 
91  linadd(MAX2(0.,bac)/radius.dVeffAper,3646,"Bac ",'i',
92  "residual flux at head of Balmer continuum, nuFnu ");
93  /* >>chng 03 feb 06, set to zero */
94  /* emslin saves the per unit vol emissivity of a line, which is normally
95  * what goes into linadd. We zero this unit emissivity which was set
96  * FOR THE PREVIOUS LINE since it is so situation dependent */
97  if( KILL_CONT && LineSave.ipass > 0 )
98  {
99  LineSv[LineSave.nsum-1].emslin[0] = 0.;
100  LineSv[LineSave.nsum-1].emslin[1] = 0.;
101  }
102 
103  /* memory not allocated until ipass >= 0 */
104  if( LineSave.ipass > 0 )
105  {
106  LineSv[LineSave.nsum].SumLine[0] = 0.;
107  LineSv[LineSave.nsum].SumLine[1] = 0.;
108  }
109 
110  linadd(f1/radius.dVeffAper,3645,"nFnu",'i',
111  "total flux above head of Balmer continuum, nuFnu ");
112  /* >>chng 03 feb 06, set to zero */
113  /* emslin saves the per unit vol emissivity of a line, which is normally
114  * what goes into linadd. We zero this unit emissivity which was set
115  * FOR THE PREVIOUS LINE since it is so situation dependent */
116  if( KILL_CONT && LineSave.ipass > 0 )
117  {
118  LineSv[LineSave.nsum-1].emslin[0] = 0.;
119  LineSv[LineSave.nsum-1].emslin[1] = 0.;
120  }
121 
122  /* memory not allocated until ipass >= 0 */
123  if( LineSave.ipass > 0 )
124  {
125  LineSv[LineSave.nsum].SumLine[0] = 0.;
126  LineSv[LineSave.nsum].SumLine[1] = 0.;
127  }
128 
129  linadd(f2/radius.dVeffAper,3647,"nFnu",'i',
130  "total flux above head of Balmer continuum, nuFnu ");
131  /* >>chng 03 feb 06, set to zero */
132  /* emslin saves the per unit vol emissivity of a line, which is normally
133  * what goes into linadd. We zero this unit emissivity which was set
134  * FOR THE PREVIOUS LINE since it is so situation dependent */
135  if( KILL_CONT && LineSave.ipass > 0 )
136  {
137  LineSv[LineSave.nsum-1].emslin[0] = 0.;
138  LineSv[LineSave.nsum-1].emslin[1] = 0.;
139  }
140 
141  /******************************************************************************
142  * "cout" , 3646, this is outward residual continuum at peak of Balmer Jump *
143  * equal to total in spherical geometry, half in opt thin open geometry *
144  ******************************************************************************/
145  /* >>chng 00 dec 02, remove opac.tmn */
146  /* >>chng 00 dec 19, remove / radius.GeoDil */
147  f1 = rfield.ConEmitOut[0][iso_sp[ipH_LIKE][ipHYDROGEN].fb[2].ipIsoLevNIonCon-1]/
148  rfield.widflx[iso_sp[ipH_LIKE][ipHYDROGEN].fb[2].ipIsoLevNIonCon-1];
149 
150  /* >>chng 00 dec 19, remove / radius.GeoDil */
151  f2 = rfield.ConEmitOut[0][iso_sp[ipH_LIKE][ipHYDROGEN].fb[2].ipIsoLevNIonCon-2]/
152  rfield.widflx[iso_sp[ipH_LIKE][ipHYDROGEN].fb[2].ipIsoLevNIonCon-2];
153 
154  /* net Balmer jump */
155  bac = (f1 - f2)*0.250*0.250*EN1RYD*radius.r1r0sq;
156 
157  /* memory not allocated until ipass >= 0 */
158  if( LineSave.ipass > 0 )
159  {
160  LineSv[LineSave.nsum].SumLine[0] = 0.;
161  LineSv[LineSave.nsum].SumLine[1] = 0.;
162  }
163 
164  linadd(MAX2(0.,bac)/radius.dVeffAper,3646,"cout",'i',
165  "residual flux in Balmer continuum, nuFnu ");
166  /* >>chng 03 feb 06, set to zero */
167  /* emslin saves the per unit vol emissivity of a line, which is normally
168  * what goes into linadd. We zero this unit emissivity which was set
169  * FOR THE PREVIOUS LINE since it is so situation dependent */
170  if( KILL_CONT && LineSave.ipass > 0 )
171  {
172  LineSv[LineSave.nsum-1].emslin[0] = 0.;
173  LineSv[LineSave.nsum-1].emslin[1] = 0.;
174  }
175 
176  /*********************************************************************
177  * "cref" , 3646, this is reflected continuum at peak of Balmer Jump*
178  * equal to zero in spherical geometry, half of total in op thin opn *
179  *********************************************************************/
180  /* >>chng 00 dec 02, remove opac.tmn */
181  /* >>chng 00 dec 19, remove / radius.GeoDil */
182  f1 = rfield.ConEmitReflec[0][iso_sp[ipH_LIKE][ipHYDROGEN].fb[2].ipIsoLevNIonCon-1]/
183  rfield.widflx[iso_sp[ipH_LIKE][ipHYDROGEN].fb[2].ipIsoLevNIonCon-1];
184 
185  f2 = rfield.ConEmitReflec[0][iso_sp[ipH_LIKE][ipHYDROGEN].fb[2].ipIsoLevNIonCon-2]/
186  rfield.widflx[iso_sp[ipH_LIKE][ipHYDROGEN].fb[2].ipIsoLevNIonCon-2];
187 
188  /* net Balmer jump */
189  bac = (f1 - f2)*0.250*0.250*EN1RYD;
190 
191  /* memory not allocated until ipass >= 0 */
192  if( LineSave.ipass > 0 )
193  {
194  LineSv[LineSave.nsum].SumLine[0] = 0.;
195  LineSv[LineSave.nsum].SumLine[1] = 0.;
196  }
197 
198  linadd(MAX2(0.,bac)/radius.dVeffAper,3646,"cref",'i',
199  "residual flux in Balmer continuum, nuFnu ");
200  /* >>chng 03 feb 06, set to zero */
201  /* emslin saves the per unit vol emissivity of a line, which is normally
202  * what goes into linadd. We zero this unit emissivity which was set
203  * FOR THE PREVIOUS LINE since it is so situation dependent */
204  if( KILL_CONT && LineSave.ipass > 0 )
205  {
206  LineSv[LineSave.nsum-1].emslin[0] = 0.;
207  LineSv[LineSave.nsum-1].emslin[1] = 0.;
208  }
209 
210  /*********************************************************************
211  * "thin" , 3646, tot optically thin continuum at peak of Balmer Jump*/
212  if( nzone > 0 )
213  {
214  /* rfield.ConEmitLocal is not defined initially, only evaluate when into model */
215  f1 = rfield.ConEmitLocal[nzone][iso_sp[ipH_LIKE][ipHYDROGEN].fb[2].ipIsoLevNIonCon-1]/
216  rfield.widflx[iso_sp[ipH_LIKE][ipHYDROGEN].fb[2].ipIsoLevNIonCon-1];
217  f2 = rfield.ConEmitLocal[nzone][iso_sp[ipH_LIKE][ipHYDROGEN].fb[2].ipIsoLevNIonCon-2]/
218  rfield.widflx[iso_sp[ipH_LIKE][ipHYDROGEN].fb[2].ipIsoLevNIonCon-2];
219  bac = (f1 - f2)*0.250*0.250*EN1RYD;
220  }
221  else
222  {
223  f1 = 0.;
224  f2 = 0.;
225  bac = 0.;
226  }
227 
228  linadd(MAX2(0.,bac),3646,"thin",'i',
229  "residual flux in Balmer continuum, nuFnu ");
230 
231  linadd(continuum.cn4861/radius.dVeffAper,4860,"Inci",'i',
232  "incident continuum nu*f_nu at H-beta, at illuminated face of cloud ");
233  /* >>chng 07 jun 13, at this point nsum is the number of lines in the stack
234  * so nsum-1 is the entry created by the above call to linadd
235  * we want to set the emergent incident continuum to the intrinsic
236  * incident continuum - there are reports of the incident continuum
237  * striking the cloud and the emergent - incident distinction does
238  * not apply - code had left emergent intensity at zero, bug reported
239  * by K Korista on discussion group 2007 jun 14 */
240  if( LineSave.ipass > 0 )
241  {
243  }
244 
245  linadd(continuum.cn1216/radius.dVeffAper,1215,"Inci",'i',
246  "incident continuum nu*f_nu near Ly-alpha, at illuminated face of cloud");
247  /* see comment concerning parallel code immediately above */
248  if( LineSave.ipass > 0 )
249  {
251  }
252 
253  if( LineSave.ipass > 0 )
254  {
255  continuum.cn4861 = 0.;
256  continuum.cn1216 = 0.;
257  }
258  }
259 
260  flow = (iso_sp[ipH_LIKE][ipHYDROGEN].fb[ipH2p].RadRecomb[ipRecRad] +
261  iso_sp[ipH_LIKE][ipHYDROGEN].fb[ipH2s].RadRecomb[ipRecRad])*
262  iso_sp[ipH_LIKE][ipHYDROGEN].fb[ipH2p].RadRecomb[ipRecEsc]*
263  dense.eden*dense.xIonDense[ipHYDROGEN][1]* 5.45e-12;
264  linadd(flow,0,"Ba C",'i',
265  "integrated Balmer continuum emission");
266 
267  if( iso_sp[ipH_LIKE][ipHYDROGEN].n_HighestResolved_max >= 3 )
268  {
269  flow = ( iso_sp[ipH_LIKE][ipHYDROGEN].fb[ipH3s].RadRecomb[ipRecRad]*
270  iso_sp[ipH_LIKE][ipHYDROGEN].fb[ipH3s].RadRecomb[ipRecEsc] +
271  iso_sp[ipH_LIKE][ipHYDROGEN].fb[ipH3p].RadRecomb[ipRecRad]*
272  iso_sp[ipH_LIKE][ipHYDROGEN].fb[ipH3p].RadRecomb[ipRecEsc] +
273  iso_sp[ipH_LIKE][ipHYDROGEN].fb[ipH3d].RadRecomb[ipRecRad]*
274  iso_sp[ipH_LIKE][ipHYDROGEN].fb[ipH3d].RadRecomb[ipRecEsc] ) *
275  dense.eden*dense.xIonDense[ipHYDROGEN][1]*3.53e-12;
276  }
277  else
278  {
279  flow = iso_sp[ipH_LIKE][ipHYDROGEN].fb[3].RadRecomb[ipRecRad]*
280  iso_sp[ipH_LIKE][ipHYDROGEN].fb[3].RadRecomb[ipRecEsc]*
281  dense.eden*dense.xIonDense[ipHYDROGEN][1]*3.53e-12;
282  }
283  linadd(flow,0,"PA C",'i',
284  "Paschen continuum emission ");
285 
286  /* these are a series of continuum bands defined in the file
287  * continuum_bands.ini - this makes it possible to enter any
288  * integrated total emission into the emission-line stack */
289  /* these entries only work correctly if the APERTURE command is not in effect */
290  if( geometry.iEmissPower == 2 )
291  {
292  for( nBand=0; nBand < continuum.nContBand; ++nBand )
293  {
294  double EmergentContinuum = 0.;
295  double DiffuseEmission = 0.;
296  if( LineSave.ipass > 0 )
297  {
298  /* find total emission over band - units will be erg cm-2 s-1 */
299  for( i=continuum.ipContBandLow[nBand]; i<=continuum.ipContBandHi[nBand]; ++i )
300  {
301  // correction for fraction of low or hi cell
302  // that lies within the band
303  double EdgeCorrection = 1.;
304  if( i==continuum.ipContBandLow[nBand] )
305  EdgeCorrection = continuum.BandEdgeCorrLow[nBand];
306  else if( i==continuum.ipContBandHi[nBand])
307  EdgeCorrection = continuum.BandEdgeCorrHi[nBand];
308 
309  double xIntenOut =
310  /* the attenuated incident continuum */
311  rfield.flux[0][i-1] +
312 
313  // the outward emitted continuous radiation field
314  (rfield.ConEmitOut[0][i-1] +
315 
316  /* outward emitted lines */
317  rfield.outlin[0][i-1])*geometry.covgeo;
318  xIntenOut *= EdgeCorrection;
319 
320  /* div by opac.E2TauAbsFace[i] because ConEmitReflec has already
321  * been corrected for this - emergent_line will introduce a
322  * further correction so this will cancel the extra factor */
323  double xIntenIn = 0.;
324  if( opac.E2TauAbsFace[i-1] > 0. )
325  xIntenIn = (double)rfield.ConEmitReflec[0][i-1]/
326  (double)opac.E2TauAbsFace[i-1]*geometry.covgeo;
327  /* outward emitted lines */
328  xIntenIn += rfield.reflin[0][i-1]*geometry.covgeo;
329  xIntenIn *= EdgeCorrection;
330 
331  /* the fraction of this that gets out */
332  EmergentContinuum += rfield.anu[i-1] *
333  emergent_line( xIntenIn , xIntenOut , i )
334  / SDIV(opac.tmn[i-1]);
335 
336  // diffuse local emission
337  DiffuseEmission += (rfield.ConEmitLocal[nzone][i-1] +
339  EdgeCorrection;
340  }
341  }
342  /* we will call lindst with an energy half way between the two
343  * ends of the band. This will make an extinction correction that
344  * has already been applied above by multiplying by emergent_line.
345  * Find this factor and remove it before the call */
346  double corr = emergent_line( 0.5 , 0.5 ,
347  (continuum.ipContBandLow[nBand]+continuum.ipContBandHi[nBand])/2 );
348  if( corr < SMALLFLOAT )
349  EmergentContinuum = 0.;
350  else
351  EmergentContinuum /= corr;
352 
353  /* convert to physical units */
354  EmergentContinuum *= EN1RYD*radius.r1r0sq/radius.dVeffAper;
355  DiffuseEmission *= EN1RYD;
356  /* memory not allocated until ipass >= 0 */
357  if( LineSave.ipass > 0 )
358  {
359  LineSv[LineSave.nsum].SumLine[0] = 0.;
360  LineSv[LineSave.nsum].SumLine[1] = 0.;
361  }
362 
363  lindst( EmergentContinuum ,
364  // the negative wavelength is a sentinel that the wavelength
365  // may be bogus - very often the "center" of the band, as defined
366  // by observers, is far to the blue end of the range. use the
367  // observed definition of the wavelength. This introduces an error
368  // since the wavelength is used to determine the transfer of the
369  // band against background opacities
370  -continuum.ContBandWavelength[nBand] ,
372  (continuum.ipContBandLow[nBand]+continuum.ipContBandHi[nBand])/2 ,
373  'i' , false,
374  "continuum bands defined in continuum_bands.ini");
375 
376  // emissivity has no meaning for these bands - quantity is net
377  // transmitted radiation field
378  if( LineSave.ipass > 0 )
379  {
380  LineSv[LineSave.nsum-1].emslin[0] = DiffuseEmission;
381  LineSv[LineSave.nsum-1].emslin[1] = DiffuseEmission;
382  }
383  }
384  }
385 
386  linadd(MAX2(0.,CoolHeavy.brems_cool_net),0,"HFFc",'c',
387  "net free-free cooling, ALL species, free-free heating subtracted, so nearly cancels with cooling in LTE ");
388 
389  linadd(MAX2(0.,-CoolHeavy.brems_cool_net),0,"HFFh",'h',
390  "net free-free heating, nearly cancels with cooling in LTE ");
391 
392  linadd(CoolHeavy.brems_cool_h,0,"H FF",'i',
393  " H brems (free-free) cooling ");
394 
395  linadd(CoolHeavy.brems_heat_total,0,"FF H",'i',
396  "total free-free heating ");
397 
398  linadd(CoolHeavy.brems_cool_he,0,"HeFF",'i',
399  "He brems emission ");
400 
401  linadd(CoolHeavy.heavfb,0,"MeFB",'c',
402  "heavy element recombination cooling ");
403 
404  linadd(CoolHeavy.brems_cool_metals,0,"MeFF",'i',
405  "heavy elements (metals) brems cooling, heat not subtracted ");
406 
408  "total brems emission - total cooling but not minus heating ");
409 
411  "part of H brems, in x-ray beyond 0.5KeV ");
412 
413  linadd(CoolHeavy.eebrm,0,"eeff",'c',
414  "electron - electron brems ");
415 
416  /* predict emitted continuum at series of continuum points */
417  /* class is located in predcont.h,
418  * PredCont - contains vector of pair of Energy and ip where
419  * we want to predict the continuum,
420  *
421  * the entry nFnu will only be printed if the command
422  * print diffuse continuum
423  * is entered -
424  *
425  * this code should be kept parallel with that in dopunch, where
426  * save continuum is produced, since two must agree */
427 
428  t_PredCont& PredCont = t_PredCont::Inst();
429  if( LineSave.ipass == 0 )
430  PredCont.set_offset(LineSave.nsum);
431 
432  /* these entries only work correctly if the APERTURE command is not in effect */
433  if( geometry.iEmissPower == 2 )
434  {
435  for( i=0; i < long(PredCont.size()); i++ )
436  {
437  double SourceTransmitted , Cont_nInu;
438  double SourceReflected, DiffuseOutward, DiffuseInward;
439  double renorm;
440 
441  /* put wavelength in Angstroms into dummy structure, so that we can use iWavLen
442  * to get a proper wavelength with units, continuum energies are stored in PredCont */
443  (*TauDummy).WLAng() = (realnum)PredCont[i].Angstrom();
444  /*lambda = iWavLen(TauDummy , &chUnits , &chShift );*/
445 
446  /* >>chng 00 dec 02, there were three occurrences of /opac.tmn which had the
447  * effect of raising the summed continuum by the local opacity correction factor.
448  * in the case of the Lyman continuum this raised the reported value by orders
449  * of magnitude. There have been commented out in the following for now. */
450  /* reflected total continuum (diff+incident emitted inward direction) */
451 
452  /* >>chng 00 dec 08, implement the "set nFnu [SOURCE_REFLECTED] ... command, PvH */
453  /* >>chng 00 dec 19, remove / radius.GeoDil */
454  renorm = rfield.anu2[PredCont[i].ip_C()]*EN1RYD/rfield.widflx[PredCont[i].ip_C()];
455 
456  /* this is the reflected diffuse continuum */
457  if( prt.lgDiffuseInward )
458  {
459  DiffuseInward = rfield.ConEmitReflec[0][PredCont[i].ip_C()]*renorm;
460  }
461  else
462  {
463  DiffuseInward = 0.;
464  }
465 
466  /* the outward diffuse continuum */
467  if( prt.lgDiffuseOutward )
468  {
469  DiffuseOutward = rfield.ConEmitOut[0][PredCont[i].ip_C()]*renorm*radius.r1r0sq;
470  }
471  else
472  {
473  DiffuseOutward = 0.;
474  }
475 
476  /* reflected part of INCIDENT continuum (only incident, not diffuse, which was above) */
477  if( prt.lgSourceReflected )
478  {
479  SourceReflected = rfield.ConRefIncid[0][PredCont[i].ip_C()]*renorm;
480  }
481  else
482  {
483  SourceReflected = 0.;
484  }
485 
486  /* the attenuated incident continuum */
488  {
489  SourceTransmitted = rfield.flux[0][PredCont[i].ip_C()]*renorm*radius.r1r0sq;
490  }
491  else
492  {
493  SourceTransmitted = 0.;
494  }
495 
496  /* memory has not been allocated until ipass >= 0, so must not access this element,
497  * this element will be used to save the following quantity */
498  if( LineSave.ipass > 0 )
499  {
500  LineSv[LineSave.nsum].SumLine[0] = 0.;
501  LineSv[LineSave.nsum].SumLine[1] = 0.;
502  }
503 
504  linadd((DiffuseInward+SourceReflected+DiffuseOutward+SourceTransmitted)/radius.dVeffAper,
505  (*TauDummy).WLAng(),"nFnu",'i',
506  "total continuum at selected energy points " );
507 
508  /* emslin saves the per unit vol emissivity of a line, which is normally
509  * what goes into linadd. We zero this unit emissivity which was set
510  * FOR THE PREVIOUS LINE since it is so situation dependent */
511  if( KILL_CONT && LineSave.ipass > 0 )
512  {
513  LineSv[LineSave.nsum-1].emslin[0] = 0.;
514  LineSv[LineSave.nsum-1].emslin[1] = 0.;
515  }
516 
517  /* this is the normal set to zero to trick the NEXT line into going in properly */
518  if( LineSave.ipass > 0 )
519  {
520  LineSv[LineSave.nsum].SumLine[0] = 0.;
521  LineSv[LineSave.nsum].SumLine[1] = 0.;
522  }
523 
524  /* the nsum-1 -- emslin and nsum -- SumLine is not a bug, look above - they do
525  * different things to different saves */
526  Cont_nInu = rfield.flux[0][PredCont[i].ip_C()]*renorm*radius.r1r0sq +
527  rfield.ConRefIncid[0][PredCont[i].ip_C()]*renorm;
528 
529 # if 0
530  /* this code can be used to create assert statements for the continuum shape */
531  if( !i )
532  fprintf(ioQQQ,"\n");
533  char chWL[1000];
534  sprt_wl( chWL , (*TauDummy).WLAng() );
535  fprintf( ioQQQ,"assert line luminosity \"nInu\" %s %.3f\n",
536  chWL ,
537  log10(SDIV(Cont_nInu/radius.dVeffAper)) + radius.Conv2PrtInten );
538 # endif
539 
540  linadd( Cont_nInu/radius.dVeffAper,(*TauDummy).WLAng(),"nInu",'i',
541  "transmitted and reflected incident continuum at selected energy points " );
542 
543  /* emslin saves the per unit volume emissivity of a line, which is normally
544  * what goes into linadd. We zero this unit emissivity since it is so situation dependent */
545  if( KILL_CONT && LineSave.ipass > 0 )
546  {
547  LineSv[LineSave.nsum-1].emslin[0] = 0.;
548  LineSv[LineSave.nsum-1].emslin[1] = 0.;
549  }
550 
551  /* memory has not been allocated until ipass >= 0 */
552  if( LineSave.ipass > 0 )
553  {
554  LineSv[LineSave.nsum].SumLine[0] = 0.;
555  LineSv[LineSave.nsum].SumLine[1] = 0.;
556  }
557 
558  linadd( (DiffuseInward+SourceReflected)/radius.dVeffAper,(*TauDummy).WLAng(),"InwT",'i',
559  "total reflected continuum, total inward emission plus reflected (XXdiffuseXX) total continuum ");
560 
561  if( KILL_CONT && LineSave.ipass > 0 )
562  {
563  LineSv[LineSave.nsum-1].emslin[0] = 0.;
564  LineSv[LineSave.nsum-1].emslin[1] = 0.;
565  }
566 
567  /* memory has not been allocated until ipass >= 0 */
568  if( LineSave.ipass > 0 )
569  {
570  LineSv[LineSave.nsum].SumLine[0] = 0.;
571  LineSv[LineSave.nsum].SumLine[1] = 0.;
572  }
573 
574  linadd(SourceReflected/radius.dVeffAper,(*TauDummy).WLAng(),"InwC",'i',
575  "reflected incident continuum (only incident) ");
576 
577  if( KILL_CONT && LineSave.ipass > 0 )
578  {
579  LineSv[LineSave.nsum-1].emslin[0] = 0.;
580  LineSv[LineSave.nsum-1].emslin[1] = 0.;
581  }
582  }
583  }
584 
585  i = StuffComment( "RRC" );
586  linadd( 0., (realnum)i , "####", 'i',"radiative recombination continua");
587 
588  // radiative recombination continua, RRC, for iso sequences
589  for( long ipISO=ipH_LIKE; ipISO<NISO; ++ipISO )
590  {
591  for( long nelem=ipISO; nelem < LIMELM; nelem++ )
592  {
593  if( nelem < 2 || dense.lgElmtOn[nelem] )
594  {
595  char chLabel[5]=" ";
596  for( long n=0; n < iso_sp[ipISO][nelem].numLevels_max; n++ )
597  {
598  if( LineSave.ipass < 0 )
599  // this pass only counting lines
600  linadd(0.,0.,"dumy",'i',"radiative recombination continuum");
601  else if( LineSave.ipass == 0 )
602  {
603  // save wavelength and label
604  /* chIonLbl generates a null terminated 4 char string, of form "C 2"
605  * the result, chLable, is only used when ipass == 0, can be undefined otherwise */
606  chIonLbl(chLabel, iso_sp[ipISO][nelem].trans(1,0));
607  realnum wl = (realnum)(RYDLAM / iso_sp[ipISO][nelem].fb[n].xIsoLevNIonRyd);
608  wl /= (realnum)RefIndex( 1e8/wl );
609  linadd( 0. , wl ,chLabel,'i',
610  "radiative recombination continuum");
611  }
612  else
613  {
614  // save intensity
615  linadd(iso_sp[ipISO][nelem].fb[n].RadRecCon,0,"dumy",'i',
616  "radiative recombination continuum");
617  }
618  }
619  }
620  }
621  }
622 
623  // RRC for non iso sequence ions
624 
625  /* add recombination continua for elements heavier than those done with iso seq */
626  for( long nelem=NISO; nelem < LIMELM; nelem++ )
627  {
628  /* do not include species with iso-sequence in following */
629  /* >>chng 03 sep 09, upper bound was wrong, did not include NISO */
630  for( long ion=0; ion < nelem-NISO+1; ion++ )
631  {
632  if( dense.lgElmtOn[nelem] )
633  {
634  if( LineSave.ipass < 0 )
635  // this pass only counting lines
636  linadd(0.,0.,"dumy",'i',"radiative recombination continuum");
637  else if( LineSave.ipass == 0 )
638  {
639  char chLabel[5];
640  strcpy( chLabel , elementnames.chElementSym[nelem] );
641  strcat( chLabel , elementnames.chIonStage[ion]);
642  // save wavelength and label
643  realnum wl = (realnum)(RYDLAM / Heavy.Valence_IP_Ryd[nelem][ion]);
644  wl /= (realnum)RefIndex( 1e8/wl );
645  linadd( 0. , wl ,chLabel,'i',
646  "radiative recombination continuum");
647  }
648  else
649  {
650  // save intensity
651  linadd(Heavy.RadRecCon[nelem][ion],0,"dumy",'i',
652  "radiative recombination continuum");
653  }
654  }
655  }
656  }
657 
658  return;
659 }
double RadRecCon[LIMELM][LIMELM]
Definition: heavy.h:18
realnum * widflx
Definition: rfield.h:65
void lindst(double xInten, realnum wavelength, const char *chLab, long int ipnt, char chInfo, bool lgOutToo, const char *chComment)
char chIonStage[LIMELM+1][CHARS_ION_STAGE]
Definition: elementnames.h:29
t_opac opac
Definition: opacity.cpp:5
realnum ** flux
Definition: rfield.h:86
realnum * DiffuseLineEmission
Definition: rfield.h:203
t_Heavy Heavy
Definition: heavy.cpp:5
const realnum SMALLFLOAT
Definition: cpu.h:178
const int NISO
Definition: cddefines.h:265
long int * ipContBandLow
Definition: continuum.h:115
#define MAX2
Definition: cddefines.h:786
realnum * BandEdgeCorrHi
Definition: continuum.h:118
long int iEmissPower
Definition: geometry.h:61
t_phycon phycon
Definition: phycon.cpp:6
double brems_cool_he
Definition: coolheavy.h:117
t_LineSave LineSave
Definition: lines.cpp:5
t_dense dense
Definition: dense.cpp:24
bool lgDiffuseInward
Definition: prt.h:168
realnum cn4861
Definition: continuum.h:101
sys_float sexp(sys_float x)
Definition: service.cpp:914
double RefIndex(double EnergyWN)
t_CoolHeavy CoolHeavy
Definition: coolheavy.cpp:5
const double RYDLAM
Definition: physconst.h:176
realnum covgeo
Definition: geometry.h:35
realnum ** outlin
Definition: rfield.h:199
FILE * ioQQQ
Definition: cddefines.cpp:7
long int nzone
Definition: cddefines.cpp:14
double eebrm
Definition: coolheavy.h:9
void chIonLbl(char *chIonLbl_v, const TransitionProxy &t)
Definition: transition.cpp:195
vector< freeBound > fb
Definition: iso.h:452
void lines_continuum(void)
double xIonDense[LIMELM][LIMELM+1]
Definition: dense.h:125
void set_offset(long offset)
Definition: predcont.h:32
double brems_cool_net
Definition: coolheavy.h:117
double SumLine[4]
Definition: lines.h:125
static T & Inst()
Definition: cddefines.h:179
t_elementnames elementnames
Definition: elementnames.cpp:5
t_iso_sp iso_sp[NISO][LIMELM]
Definition: iso.cpp:8
bool lgSourceReflected
Definition: prt.h:166
realnum ** ConEmitLocal
Definition: rfield.h:149
t_geometry geometry
Definition: geometry.cpp:5
bool lgDiffuseOutward
Definition: prt.h:169
LinSv * LineSv
Definition: cdinit.cpp:70
t_continuum continuum
Definition: continuum.cpp:5
double brems_cool_h
Definition: coolheavy.h:117
t_rfield rfield
Definition: rfield.cpp:8
realnum * anu2
Definition: rfield.h:77
float realnum
Definition: cddefines.h:107
bool lgElmtOn[LIMELM]
Definition: dense.h:146
realnum * ContBandWavelength
Definition: continuum.h:114
const int ipRecRad
Definition: cddefines.h:287
double brems_heat_total
Definition: coolheavy.h:117
const int ipRecEsc
Definition: cddefines.h:283
const int ipH3s
Definition: iso.h:30
const double EN1RYD
Definition: physconst.h:179
double heavfb
Definition: coolheavy.h:9
const int ipH3d
Definition: iso.h:32
t_radius radius
Definition: radius.cpp:5
long int nContBand
Definition: continuum.h:112
t_prt prt
Definition: prt.cpp:10
realnum ** reflin
Definition: rfield.h:206
realnum ** ConEmitOut
Definition: rfield.h:161
size_t size() const
Definition: predcont.h:28
char chElementSym[LIMELM][CHARS_ELEMENT_SYM]
Definition: elementnames.h:25
double Conv2PrtInten
Definition: radius.h:147
double brems_cool_metals
Definition: coolheavy.h:117
const int ipH2p
Definition: iso.h:29
void sprt_wl(char *chString, realnum wl)
Definition: prt.cpp:25
double emslin[2]
Definition: lines.h:128
double * anu
Definition: rfield.h:58
const int ipH2s
Definition: iso.h:28
const int ipH_LIKE
Definition: iso.h:62
const int LIMELM
Definition: cddefines.h:262
realnum * BandEdgeCorrLow
Definition: continuum.h:118
double Valence_IP_Ryd[LIMELM][LIMELM]
Definition: heavy.h:24
#define DEBUG_ENTRY(funcname)
Definition: cddefines.h:688
realnum * E2TauAbsFace
Definition: opacity.h:124
double eden
Definition: dense.h:190
double emergent_line(double emissivity_in, double emissivity_out, long int ipCont)
bool lgSourceTransmitted
Definition: prt.h:167
sys_float SDIV(sys_float x)
Definition: cddefines.h:956
long int numLevels_max
Definition: iso.h:493
long int nsum
Definition: lines.h:62
realnum * tmn
Definition: opacity.h:136
void linadd(double xInten, realnum wavelength, const char *chLab, char chInfo, const char *chComment)
realnum ** ConEmitReflec
Definition: rfield.h:155
double r1r0sq
Definition: radius.h:22
long int * ipContBandHi
Definition: continuum.h:115
double te
Definition: phycon.h:11
const int ipHYDROGEN
Definition: cddefines.h:309
realnum ** ConRefIncid
Definition: rfield.h:167
const int ipH3p
Definition: iso.h:31
long int ipass
Definition: lines.h:75
double dVeffAper
Definition: radius.h:87
realnum cn1216
Definition: continuum.h:101
char ** chContBandLabels
Definition: continuum.h:113
long int StuffComment(const char *chComment)
Definition: prt_final.cpp:1925