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
dense_fabden.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
/*dense_fabden called by dlaw command, returns density for any density law */
4
#include "
cddefines.h
"
5
#include "
rfield.h
"
6
#include "
dense.h
"
7
8
/*dense_fabden called by dlaw command, returns density for any density law */
9
double
dense_fabden
(
double
radius
,
10
double
depth)
11
{
12
double
a , b;
13
a = depth;
14
b =
radius
;
15
16
fprintf(
ioQQQ
,
"PROBLEM DISASTER The default version of dense_fabden is "
17
"still in dense_fabden.cpp - edit and replace this file to use your version.\n"
);
18
/* return val is example - must return density */
19
return
(a*b);
20
21
/* these are two examples of using this routine */
22
# if 0
23
double
fabden_v;
24
double
z , z0 , density , rad_midplane;
25
DEBUG_ENTRY
(
"dense_fabden()"
);
26
27
/* this routine is called when the DLAW command is given,
28
* and must return the hydrogen density at the current radius or depth
29
* RADIUS is the radius, the distance from the center of symmetry.
30
* DEPTH is the depth into the cloud, from the illuminated face
31
* both are in cm
32
*
33
* radius, depth, and the array DensityLaw are double precision, although
34
* dense_fabden itself is not
35
*
36
* this is one way to generate a density
37
* dense_fabden = radius * depth
38
*
39
* this is how to use the parameters on the dlaw command
40
* dense_fabden = DensityLaw(1) + radius * DensityLaw(2)
41
*
42
* following must be removed if this sub is to be used */
43
/*fprintf( ioQQQ, " the old version of dense_fabden must be deleted, and a new one put in place. Sorry.\n" );*/
44
45
if
( depth > radius )
46
TotalInsanity
();
47
48
rad_midplane = radius * cos(
dense
.
DensityLaw
[0] );
49
z = radius * sin(
dense
.
DensityLaw
[0] );
50
z0 = 0.047 * pow( rad_midplane/
AU
, 1.25 ) *
AU
;
51
/* density in gm / cm3 */
52
density = 1.4e-9 * pow( rad_midplane/
AU
, -11./4. ) *
sexp
(
POW2
(z/z0) );
53
/* convert density to cm-3 */
54
fabden_v = density/(
ATOMIC_MASS_UNIT
* 1.2);
55
56
fprintf(
ioQQQ
,
"bug dense_fabden zone %.2f radius %e density %e \n"
,
57
fnzone
, radius , fabden_v );
58
return
( fabden_v );
59
# endif
60
61
#if 0
62
63
/* update stromgren radius to most recent value */
64
if
(
rfield
.
lgUSphON
)
65
dense
.
DensityLaw
[2] =
rfield
.
rstrom
/
PARSEC
;
66
67
/* this is the density law used in the Wen & O'Dell, 1995, ApJ 438, 784 paper */
68
powexp =
MIN2
((radius/parsec-
dense
.
DensityLaw
[2])/
dense
.
DensityLaw
[1],
dense
.
DensityLaw
[3]);
69
fabden_v = pow(10.,
dense
.
DensityLaw
[0])*exp(powexp);
70
71
fabden_v =
dense
.
DensityLaw
[0];
72
/* just here to stop compilers from flagging unused vars */
73
temp = radius + depth;
74
if
( fabden_v == 0. )
75
{
76
cdEXIT
(EXIT_FAILURE);
77
}
78
else
79
{
80
/* when this routine is used the following branch is the correct exit */
81
/* following should return correct value of the density at this position,
82
* temp is there to trick lint */
83
return
( fabden_v*temp );
84
}
85
#endif
86
}
Generated for cloudy by
1.8.3.1