cloudy
trunk
Loading...
Searching...
No Matches
source
prt_meanion.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
/*PrtMeanIon print mean ionization fractions or temperatures for all elements */
4
#include "
cddefines.h
"
5
#include "
geometry.h
"
6
#include "
dense.h
"
7
#include "
mean.h
"
8
#include "
elementnames.h
"
9
#include "
prt.h
"
10
11
void
PrtMeanIon
(
12
/* this is either 't' or 'i', for mean ionization or temperature */
13
char
chType,
14
/* true include density, false do not */
15
bool
lgDensity,
16
/* this is stream used for io, is stdout when called by final,
17
* is save unit when save output generated */
18
FILE *ioMEAN )
19
{
20
long
int
i,
21
limit,
22
n,
23
nelem;
24
/* >>chng 04 dec 31, had been static, not possible to ever set false if
25
* ever true, rm static */
26
bool
lgPrtLots=
false
;
27
28
realnum
aa[
LIMELM
+1];
29
30
DEBUG_ENTRY
(
"PrtMeanIon()"
);
31
32
/* print mean ionization or temperature for the computed model
33
* the ionization means are relative to the total element */
34
35
const
char
* type[3] = {
"radius"
,
"area"
,
"volume"
};
36
37
for
(
int
d=2; d >= 0; --d )
38
{
39
/* only print spherical if not plane parallel */
40
/* >>>chng 99 may 01, test included one for sphere being set,
41
* so no printout when not set. now print even when sphere not
42
* set but geo is not plane parallel */
43
if
(
geometry
.lgGeoPP && d > 0 )
44
continue
;
45
46
/* get means for hydrogen */
47
mean
.MeanIon(chType,
ipHYDROGEN
,d,&n,aa,lgDensity);
48
49
/* now print hydrogen, special since part of title goes here */
50
fprintf( ioMEAN,
"\n Hydrogen "
);
51
for
( i=0; i < 3; i++ )
52
{
53
fprintf( ioMEAN,
"%7.3f"
, aa[i] );
54
}
55
fprintf(ioMEAN,
" (H2)"
);
56
if
( chType==
'i'
&& lgDensity )
57
{
58
fprintf( ioMEAN,
59
" Log10 Mean Ionisation (over %s*electron density)\n"
, type[d] );
60
}
61
else
if
( chType==
'i'
)
62
{
63
fprintf( ioMEAN,
64
" Log10 Mean Ionisation (over %s)\n"
, type[d] );
65
}
66
else
if
( chType==
't'
&& lgDensity )
67
{
68
fprintf( ioMEAN,
69
" Log10 Mean Temperature (over %s*electron density)\n"
, type[d] );
70
}
71
else
if
( chType==
't'
)
72
{
73
fprintf( ioMEAN,
74
" Log10 Mean Temperature (over %s)\n"
, type[d] );
75
}
76
else
77
{
78
fprintf(
ioQQQ
,
" PrtMeanIon called with insane job: %c\n"
, chType );
79
TotalInsanity
();
80
}
81
82
/* ionization fractions for remaining elements */
83
for
( nelem=
ipHELIUM
; nelem <
LIMELM
; nelem++ )
84
{
85
if
(
dense
.lgElmtOn[nelem] )
86
{
87
mean
.MeanIon(chType,nelem,d,&n,aa,lgDensity);
88
limit =
MIN2
(17,n);
89
fprintf( ioMEAN,
" %10.10s"
,
elementnames
.chElementName[nelem] );
90
91
for
( i=0; i < limit; i++ )
92
{
93
fprintf( ioMEAN,
"%7.3f"
, aa[i] );
94
}
95
fprintf( ioMEAN,
"\n"
);
96
97
if
( n > 17 )
98
{
99
lgPrtLots =
true
;
100
fprintf( ioMEAN,
" "
);
101
for
( i=17; i < n; i++ )
102
{
103
fprintf( ioMEAN,
"%7.3f"
, aa[i] );
104
}
105
fprintf( ioMEAN,
"\n"
);
106
}
107
}
108
}
109
110
fprintf( ioMEAN,
"\n "
);
111
for
( i=1; i <= 17; i++ )
112
{
113
fprintf( ioMEAN,
"%7ld"
, i );
114
}
115
fprintf( ioMEAN,
"\n"
);
116
if
( lgPrtLots )
117
{
118
fprintf( ioMEAN,
" "
);
119
for
( i=18; i <=
LIMELM
; i++ )
120
{
121
fprintf( ioMEAN,
"%7ld"
, i );
122
}
123
fprintf( ioMEAN,
"\n"
);
124
}
125
}
126
return
;
127
}
ioQQQ
FILE * ioQQQ
Definition
cddefines.cpp:7
cddefines.h
MIN2
#define MIN2
Definition
cddefines.h:761
LIMELM
const int LIMELM
Definition
cddefines.h:258
ipHELIUM
const int ipHELIUM
Definition
cddefines.h:306
realnum
float realnum
Definition
cddefines.h:103
TotalInsanity
NORETURN void TotalInsanity(void)
Definition
service.cpp:886
ipHYDROGEN
const int ipHYDROGEN
Definition
cddefines.h:305
DEBUG_ENTRY
#define DEBUG_ENTRY(funcname)
Definition
cddefines.h:684
dense
t_dense dense
Definition
dense.cpp:24
dense.h
elementnames
t_elementnames elementnames
Definition
elementnames.cpp:5
elementnames.h
geometry
t_geometry geometry
Definition
geometry.cpp:5
geometry.h
mean
t_mean mean
Definition
mean.cpp:17
mean.h
prt.h
PrtMeanIon
void PrtMeanIon(char chType, bool lgDensity, FILE *ioMEAN)
Definition
prt_meanion.cpp:11
Generated by
1.14.0