cloudy trunk
Loading...
Searching...
No Matches
parse_globule.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/*ParseGlobule parse parameters off the globule command */
4#include "cddefines.h"
5#include "radius.h"
6#include "dense.h"
7#include "optimize.h"
8#include "input.h"
9#include "parser.h"
10
12{
13 DEBUG_ENTRY( "ParseGlobule()" );
14
15 if( dense.gas_phase[ipHYDROGEN] > 0. )
16 {
17 fprintf( ioQQQ, " PROBLEM DISASTER More than one density command was entered.\n" );
19 }
20
21 /* globule with density increasing inward
22 * parameters are outer density, radius of globule, and density power */
23 radius.glbden = (realnum)p.FFmtRead();
24 radius.glbden = p.lgEOL() ? 1.f : (realnum)pow((realnum)10.f,radius.glbden);
25 dense.SetGasPhaseDensity( ipHYDROGEN, radius.glbden );
26
27 if( dense.gas_phase[ipHYDROGEN] <= 0. )
28 {
29 fprintf( ioQQQ, " PROBLEM DISASTER Hydrogen density must be > 0.\n" );
31 }
32
33 radius.glbrad = (realnum)p.FFmtRead();
34 if( p.lgEOL() )
35 {
36 radius.glbrad = 3.086e18f;
37 }
38 else
39 {
40 radius.glbrad = (realnum)pow((realnum)10.f,radius.glbrad);
41 }
42
43 /* this is largest zone thickness, used to set first zone thickness */
44 radius.sdrmax = radius.glbrad/25.;
45 radius.lgSdrmaxRel = false;
46
47 /* turn off min dr checking in NEXTDR */
48 radius.lgDrMnOn = false;
49 radius.glbpow = (realnum)p.FFmtRead();
50 if( p.lgEOL() )
51 radius.glbpow = 1.;
52 strcpy( dense.chDenseLaw, "GLOB" );
53
54 /* this is distance to globule */
55 radius.glbdst = radius.glbrad;
56
57 /* vary option */
58 if( optimize.lgVarOn )
59 {
60 /* pointer to where to write */
61 optimize.nvfpnt[optimize.nparm] = input.nRead;
62
63 /* this is the number of parameters to feed onto the input line */
64 optimize.nvarxt[optimize.nparm] = 3;
65 // the keyword LOG is not used above, but is checked elsewhere
66 strcpy( optimize.chVarFmt[optimize.nparm], "GLOBULE %f LOG %f %f" );
67
68 /* param is log of abundance by number relative to hydrogen */
69 optimize.vparm[0][optimize.nparm] = (realnum)log10(radius.glbden);
70 optimize.vparm[1][optimize.nparm] = (realnum)log10(radius.glbrad);
71 optimize.vparm[2][optimize.nparm] = radius.glbpow;
72 optimize.vincr[optimize.nparm] = 0.2f;
73 ++optimize.nparm;
74 }
75 return;
76}
FILE * ioQQQ
Definition cddefines.cpp:7
#define EXIT_FAILURE
Definition cddefines.h:140
#define cdEXIT(FAIL)
Definition cddefines.h:434
float realnum
Definition cddefines.h:103
const int ipHYDROGEN
Definition cddefines.h:305
#define DEBUG_ENTRY(funcname)
Definition cddefines.h:684
double FFmtRead(void)
Definition parser.cpp:353
bool lgEOL(void) const
Definition parser.h:98
t_dense dense
Definition dense.cpp:24
t_input input
Definition input.cpp:12
t_optimize optimize
Definition optimize.cpp:5
void ParseGlobule(Parser &p)
t_radius radius
Definition radius.cpp:5