cloudy trunk
Loading...
Searching...
No Matches
parse_ionpar.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/*ParseIonPar parse the ionization parameter command */
4#include "cddefines.h"
5#include "radius.h"
6#include "optimize.h"
7#include "rfield.h"
8#include "input.h"
9#include "parser.h"
10
12{
13 ParseIonPar(p,'I');
14}
16{
17 ParseIonPar(p,'X');
18}
19
21 char chType)
22{
23
24 DEBUG_ENTRY( "ParseIonPar()" );
25
26 /* check not too many continua */
27 if( p.m_nqh >= LIMSPC )
28 {
29 /* too many continua were entered */
30 fprintf( ioQQQ, " Too many continua entered; increase LIMSPC\n" );
32 }
33
34 /* this is counter for where to start scanning number on line - different
35 * for XI than for IONIZ */
36 /* say that continuum is per unit area, ionization parameter*/
37 strcpy( rfield.chRSpec[p.m_nqh], "SQCM" );
38 if( chType == 'I' )
39 {
40 /* this is the usual ionization parameter, U */
41 strcpy( rfield.chSpNorm[p.m_nqh], "IONI" );
42 }
43 else if( chType == 'X' )
44 {
45 /* the X-Ray ionization parameter, xi, defined by Tarter+69,
46 * The explicit energy bounds, 1-1000 Ryd, are quoted in Kallman & Bautista 2001 */
47 strcpy( rfield.chSpNorm[p.m_nqh], "IONX" );
48 rfield.range[(p.m_nqh)][0] = 1.;
49 rfield.range[(p.m_nqh)][1] = 1000.;
50 }
51 else
52 {
53 fprintf(ioQQQ," ParseIonPar hit chCard insanity.\n");
55 }
56
57 /* get the ionization parameter*/
58 rfield.totpow[p.m_nqh] = p.FFmtRead();
59 if( p.lgEOL() )
60 p.NoNumb("ionization parameter");
61
62 /* check for linear option, if present take log since rfield.totpow[p.m_nqh]
63 * being log ionization parameter is the default */
64 if( p.nMatch( "LINE" ) )
65 rfield.totpow[p.m_nqh] = log10(rfield.totpow[p.m_nqh]);
66
67 /* >>chng 06 mar 22, add time option to vary only some continua with time */
68 if( p.nMatch( "TIME" ) )
69 rfield.lgTimeVary[p.m_nqh] = true;
70
71 /* vary option */
72 if( optimize.lgVarOn )
73 {
74 if( chType == 'I' )
75 {
76 /* this is the usual ionization parameter, U */
77 strcpy( optimize.chVarFmt[optimize.nparm], "IONIZATION PARAMETER= %f LOG" );
78 }
79 else if( chType == 'X' )
80 {
81 /* the X-Ray ionization parameter, xi */
82 strcpy( optimize.chVarFmt[optimize.nparm], "XI= %f LOG" );
83 }
84 else
85 {
86 fprintf( ioQQQ, " Insanity in detecting which ionization parameter.\n" );
88 }
89 if( rfield.lgTimeVary[p.m_nqh] )
90 strcat( optimize.chVarFmt[optimize.nparm], " TIME" );
91 /* pointer to where to write */
92 optimize.nvfpnt[optimize.nparm] = input.nRead;
93 optimize.vparm[0][optimize.nparm] = (realnum)rfield.totpow[p.m_nqh];
94 optimize.vincr[optimize.nparm] = 0.5;
95 optimize.nvarxt[optimize.nparm] = 1;
96 ++optimize.nparm;
97 }
98
99 /* set R to large value if U specified. */
100 /* set radius to very large value if not already set */
101 /* >>chng 01 jul 24, from Radius == 0 to this, as per PvH comments */
102 if( !radius.lgRadiusKnown )
103 {
104 radius.Radius = pow(10.,radius.rdfalt);
105 }
106 /* increment nmber of specifications of continuum intensities, */
107 ++p.m_nqh;
108 return;
109}
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
#define DEBUG_ENTRY(funcname)
Definition cddefines.h:684
double FFmtRead(void)
Definition parser.cpp:353
bool nMatch(const char *chKey) const
Definition parser.h:135
bool lgEOL(void) const
Definition parser.h:98
NORETURN void NoNumb(const char *chDesc) const
Definition parser.cpp:233
long int m_nqh
Definition parser.h:41
t_input input
Definition input.cpp:12
t_optimize optimize
Definition optimize.cpp:5
void ParseIonParI(Parser &p)
void ParseIonPar(Parser &p, char chType)
void ParseIonParX(Parser &p)
t_radius radius
Definition radius.cpp:5
t_rfield rfield
Definition rfield.cpp:8
const int LIMSPC
Definition rfield.h:18