cloudy  trunk
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
prt_continuum.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 /*PrtContinuum print information about continuum if requested with PRINT CONTINUUM command,
4  * called by PrtFinal */
5 #include "cddefines.h"
6 #include "rfield.h"
7 #include "iso.h"
8 #include "radius.h"
9 #include "opacity.h"
10 #include "prt.h"
11 
12 static const int NFLUXSV = 360;
13 static const int NXBD = 9;
14 
15 void PrtContinuum(void)
16 {
17  long int i,
18  i1,
19  j,
20  ninc,
21  nline;
22  realnum fluxsv[NFLUXSV],
23  xbdsav[NXBD];
24 
25  /* energies for the x-ray bands */
26  static double xraybd[NXBD + 1]={
27  7.3498,
28  36.8,
29  73.5,
30  110.3,
31  147.1,
32  183.8,
33  220.6,
34  367.6,
35  551.5,
36  735.3};
37 
38  DEBUG_ENTRY( "PrtContinuum()" );
39  /*print information about continuum if requested with PRINT CONTINUUM command */
40  /* this is number of ranges for adding x-ray bands */
41 
42  /* this stuff was always printed before version 84, and is now an option
43  * to turn on information with PRINT CONTINUUM command */
44 
45  /* the default - not turned on, just return */
46  if( !prt.lgPrtCont )
47  {
48  return;
49  }
50 
51  /* derive x-ray fluxes in various bands for later printout
52  *
53  * >>chng 97 jun 08, get rid of statement labels */
54  if( xraybd[0] < rfield.anu[rfield.nflux-1] )
55  {
56  i1 = opac.ipCKshell - 10;
57  /* get out to lower bound of first range */
58  while( (double)rfield.anu[i1-1] < xraybd[0] && i1 < rfield.nflux )
59  {
60  i1 += 1;
61  }
62  /* now add up over that range */
63  for( i=0; i < NXBD; i++ )
64  {
65  xbdsav[i] = 0.;
66  while( (double)rfield.anu[i1-1] < xraybd[i+1] && i1 < rfield.nflux )
67  {
68  xbdsav[i] += rfield.flux[i1-1] +
69  rfield.outlin[i1-1] +rfield.outlin_noplot[i1-1] + rfield.ConInterOut[i1-1];
70  i1 += 1;
71  }
72  xbdsav[i] *= (realnum)radius.r1r0sq;
73  }
74  }
75  else
76  {
77  /* continuum not defined at x-ray energies, but zero it for safety */
78  for( i=0; i < NXBD; i++ )
79  {
80  xbdsav[i] = 0.;
81  }
82  }
83 
84  /* now print x-ray flux (photons s^-1, flux or lum) in various bands */
85  if( xbdsav[0] > 0 )
86  {
87  fprintf( ioQQQ, "\n 0.1-0.5kev:" );
88  for(i=0; i < NXBD; i++)
89  fprintf( ioQQQ, "%8.2e", xbdsav[i] );
90  fprintf( ioQQQ, " 0.5-1.0kev:\n" );
91  }
92 
93  /* renorm fLUX array before printing it */
95  {
96  fprintf( ioQQQ, " PCONTN: not enough cells in flux_total_incident, need%4ld\n",
98  cdEXIT(EXIT_FAILURE);
99  }
100 
102  {
103  if( rfield.flux_total_incident[i] > 0. )
104  {
108  }
109  else
110  {
111  fluxsv[i-iso.ipIsoLevNIonCon[ipH_LIKE][ipHYDROGEN][2]+1] = 0.;
112  }
113  }
114  /* renormalize whole continuum */
115  for( i=0; i < rfield.nflux; i++ )
116  {
117  rfield.flux[i] = (realnum)(((rfield.flux[i] +
119  radius.r1r0sq);
120  }
121 
122  fprintf( ioQQQ,
123  "\n\n Normalised continuum\n" );
124 
126  {
127  fprintf( ioQQQ, "%7.3f%6.3f", rfield.anu[i-1], fluxsv[i-iso.ipIsoLevNIonCon[ipH_LIKE][ipHYDROGEN][2]] );
128  }
129  fprintf( ioQQQ, "\n" );
130 
131  fprintf( ioQQQ,
132  "\n Emergent continuum - phot/ryd/cm2/s (r in)\n" );
133 
134  nline = ((rfield.nflux - iso.ipIsoLevNIonCon[ipH_LIKE][ipHYDROGEN][2] - 1)/4 + 7)/7;
135  ninc = nline*4;
136  for( j=0; j < nline; j++ )
137  {
138  i1 = j*4 + iso.ipIsoLevNIonCon[ipH_LIKE][ipHYDROGEN][2];
139  fprintf( ioQQQ, " " );
140 
141  for( i=i1; i<rfield.nflux; i = i + ninc)
142  {
143  fprintf( ioQQQ, "%6.3f%10.2e", rfield.anu[i],
145  }
146  fprintf( ioQQQ, "\n" );
147  }
148  return;
149 }

Generated for cloudy by doxygen 1.8.1.2