cloudy  trunk
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
parse_agn.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 /*ParseAgn parse parameters for the AGN continuum shape command */
4 #include "cddefines.h"
5 #include "rfield.h"
6 #include "parse.h"
7 #include "physconst.h"
8 
9 void ParseAgn(char *chCard)
10 {
11  bool lgEOL;
12  long int i;
13  double BigBump,
14  Ratio,
15  XRays,
16  xnu;
17 
18  DEBUG_ENTRY( "ParseAgn()" );
19 
20  /* this radiation field will be something like an AGN */
21  strcpy( rfield.chSpType[rfield.nspec], "AGN " );
22 
23  /* there were no numbers on the line - this could be the Kirk option,
24  * to use the numbers for the continuum in the atlas paper */
25  if( nMatch("KIRK",chCard) )
26  {
27  /* million degree cutoff, but in rydbergs */
28  rfield.slope[rfield.nspec] = 1e6 / TE1RYD;
29 
30  /* cutoff is second parameter is really alpha ox */
31  rfield.cutoff[rfield.nspec][0] = -1.40;
32 
33  /* bb slope is third parameter */
34  rfield.cutoff[rfield.nspec][1] = -0.50;
35 
36  /* slope of X-Ray component is last parameter */
37  rfield.cutoff[rfield.nspec][2] = -1.0;
38  }
39  else
40  {
41  /* first parameter is temperature of big bump
42  * second parameter is alpha ox */
43  i = 5;
44  /* slope is first parameter is really temperature of bump */
45  rfield.slope[rfield.nspec] = FFmtRead(chCard,&i,INPUT_LINE_LENGTH,&lgEOL);
46  if( lgEOL )
47  {
48 
49  fprintf( ioQQQ, " The big bump temperature should have been on this line. Sorry.\n" );
50  cdEXIT(EXIT_FAILURE);
51  }
52 
53  if( rfield.slope[rfield.nspec] <= 0. )
54  {
55  fprintf( ioQQQ, " Non positive temperature not allowed. Sorry.\n" );
56  cdEXIT(EXIT_FAILURE);
57  }
58 
59  /* temps are log if first le 10 */
60  if( rfield.slope[rfield.nspec] <= 10. )
62  pow(10.,rfield.slope[rfield.nspec]);
63 
64  /* want cutoff in ryd not kelvin */
66 
67  /* cutoff is second parameter is really alpha ox */
68  rfield.cutoff[rfield.nspec][0] = FFmtRead(chCard,&i,INPUT_LINE_LENGTH, &lgEOL);
69  if( lgEOL )
70  {
71  fprintf( ioQQQ, " alpha ox should have been on this line. Sorry.\n" );
72  cdEXIT(EXIT_FAILURE);
73  }
74 
75  if( rfield.cutoff[rfield.nspec][0] > 3. ||
76  rfield.cutoff[rfield.nspec][0] < -3. )
77  {
78  fprintf( ioQQQ, " An alpha ox of%10.2e looks funny to me. Check Hazy to make sure its ok.\n",
79  rfield.cutoff[rfield.nspec][0] );
80  }
81 
82  if( rfield.cutoff[rfield.nspec][0] >= 0. )
83  {
84  fprintf( ioQQQ, " The sign of alpha ox is almost certainly incorrect. Check Hazy.\n" );
85  }
86 
87  /* bb slope is third parameter */
88  rfield.cutoff[rfield.nspec][1] = FFmtRead(chCard,&i,INPUT_LINE_LENGTH, &lgEOL);
89  if( lgEOL )
90  rfield.cutoff[rfield.nspec][1] = -0.5f;
91 
92  /* slope of X-Ray component is last parameter */
93  rfield.cutoff[rfield.nspec][2] = FFmtRead(chCard,&i,INPUT_LINE_LENGTH, &lgEOL);
94  if( lgEOL )
95  rfield.cutoff[rfield.nspec][2] = -1.0f;
96  }
97 
98  /* 403.3 is ratio of energies where alpha ox defined,
99  * assumed to be 2500A and 2keV */
100  Ratio = pow(403.3,rfield.cutoff[rfield.nspec][0] - 1.);
101 
102  /* following code must be kept parallel with ffun1 */
103  xnu = 0.3645;
104  BigBump = pow(xnu,-1. + rfield.cutoff[rfield.nspec][1])*
105  sexp(xnu/rfield.slope[rfield.nspec]);
106  xnu = 147.;
107 
108  /* XRays = xnu**(-2.) */
109  XRays = pow(xnu,rfield.cutoff[rfield.nspec][2] - 1.);
110  if( BigBump <= 0. )
111  {
112  fprintf( ioQQQ, " Big Bump had zero flux at .3645 Ryd.\n" );
113  cdEXIT(EXIT_FAILURE);
114  }
115  rfield.cutoff[rfield.nspec][0] = (Ratio/(XRays/BigBump));
116 
117  /* lastly increment number of spectra and check that we still have room in the vector */
118  ++rfield.nspec;
119  if( rfield.nspec >= LIMSPC )
120  {
121  fprintf( ioQQQ, " Too many continua entered; increase LIMSPC\n" );
122  cdEXIT(EXIT_FAILURE);
123  }
124  return;
125 }

Generated for cloudy by doxygen 1.8.1.1