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