cloudy
trunk
Main Page
Related Pages
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
source
init_sim_postparse.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
/*InitSimPostparse initialization at start of simulation, called from cloudy
4
* after parser, will be called one time per sim in grid */
5
#include "
cddefines.h
"
6
#include "
dense.h
"
7
#include "
elementnames.h
"
8
#include "
physconst.h
"
9
#include "
mole.h
"
10
#include "
trace.h
"
11
#include "
radius.h
"
12
#include "
thermal.h
"
13
#include "
heavy.h
"
14
#include "
wind.h
"
15
#include "
init.h
"
16
#include "
iso.h
"
17
18
/*InitSimPostparse initialization after parser, called one time per sim in
19
* grid, sets initial or zeros values before start of sim */
20
void
InitSimPostparse
(
void
)
21
{
22
DEBUG_ENTRY
(
"InitSimPostparse()"
);
23
/* init vars after parsing commands for each sim */
24
25
thermal
.
thist
= 0.;
26
thermal
.
tlowst
= 1e20f;
27
thermal
.
nUnstable
= 0;
28
thermal
.
lgUnstable
=
false
;
29
30
CO_Init
();
31
CO_zero
();
32
33
/* >> chng 06 Nov 24 rjrw: Move reaction definitions here so they can be controlled by parsed commands */
34
CO_create_react
();
35
36
/* zero out diffuse Lya emission */
37
for
(
long
nelem=
ipHYDROGEN
; nelem<
LIMELM
; ++nelem )
38
for
(
long
ion=0; ion<=nelem; ++ion )
39
Heavy
.
xLyaHeavy
[nelem][ion] = 0;
40
41
/* this term applies centrifugal acceleration if DISK option on wind command */
42
wind
.
DiskRadius
= 0;
43
if
(
wind
.
lgDisk
)
44
wind
.
DiskRadius
=
radius
.
Radius
;
45
46
/* usually computed in pressure_change, but not called before first zone */
47
wind
.
AccelGravity
= (
realnum
)(
GRAV_CONST
*
wind
.
comass
*
SOLAR_MASS
/
POW2
(
radius
.
Radius
)*
48
(1.-
wind
.
DiskRadius
/
radius
.
Radius
) );
49
if
(
trace
.
lgTrace
&&
trace
.
lgWind
)
50
{
51
fprintf(
ioQQQ
,
" InitSimPostparse sets AccelGravity %.3e lgDisk?%c\n"
,
52
wind
.
AccelGravity
,
53
TorF
(
wind
.
lgDisk
) );
54
}
55
56
/* update iso sequence level information */
57
for
(
long
ipISO=
ipH_LIKE
; ipISO<
NISO
; ++ipISO )
58
{
59
for
(
long
nelem=ipISO; nelem <
LIMELM
; ++nelem )
60
{
61
/* these elements that are turned off */
62
if
( nelem>
ipHELIUM
&& !
dense
.
lgElmtOn
[nelem] )
63
{
64
iso
.
numLevels_max
[ipISO][nelem] = 0;
65
iso
.
nCollapsed_max
[ipISO][nelem] = 0;
66
iso
.
n_HighestResolved_max
[ipISO][nelem] = 0;
67
68
iso
.
numLevels_local
[ipISO][nelem] = 0;
69
iso
.
nCollapsed_local
[ipISO][nelem] = 0;
70
iso
.
n_HighestResolved_local
[ipISO][nelem] = 0;
71
}
72
else
73
{
74
iso_update_num_levels
( ipISO, nelem );
75
/* must always have at least one collapsed level, unless compiling recomb data file. */
76
ASSERT
(
iso
.
nCollapsed_max
[ipISO][nelem] > 0 ||
iso
.
lgCompileRecomb
[ipISO] );
77
}
78
}
79
}
80
81
if
(
iso
.
lgPrintNumberOfLevels
)
82
{
83
fprintf(
ioQQQ
,
"\n\n Number of levels in ions treated by iso sequences.\n"
);
84
fprintf(
ioQQQ
,
" ISO Element hi-n(l-resolved) #(l-resolved) n(collapsed)\n"
);
85
/* option to print number of levels for each element */
86
for
(
long
ipISO=
ipH_LIKE
; ipISO<
NISO
; ++ipISO )
87
{
88
for
(
long
nelem=ipISO; nelem<
LIMELM
; ++nelem )
89
{
90
/* print number of levels */
91
fprintf(
ioQQQ
,
" %s %s %4li %4li %4li \n"
,
92
iso
.
chISO
[ipISO] ,
93
elementnames
.
chElementSym
[nelem],
94
iso
.
n_HighestResolved_max
[ipISO][nelem],
95
iso
.
numLevels_max
[ipISO][nelem]-
iso
.
nCollapsed_max
[ipISO][nelem],
96
iso
.
nCollapsed_max
[ipISO][nelem]);
97
}
98
}
99
}
100
101
return
;
102
}
Generated for cloudy by
1.8.3.1