cloudy  trunk
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 */
46  strcpy( rfield.chSpNorm[p.m_nqh], "IONX" );
47  /* >>chng 06 jan 20, had used 5 as in ionization parameter so
48  * possible to miss beginning of number */
49  }
50  else
51  {
52  fprintf(ioQQQ," ParseIonPar hit chCard insanity.\n");
54  }
55 
56  /* get the ionization parameter*/
57  rfield.totpow[p.m_nqh] = p.FFmtRead();
58  if( p.lgEOL() )
59  p.NoNumb("ionization parameter");
60 
61  /* check for linear option, if present take log since rfield.totpow[p.m_nqh]
62  * being log ionization parameter is the default */
63  if( p.nMatch( "LINE" ) )
64  rfield.totpow[p.m_nqh] = log10(rfield.totpow[p.m_nqh]);
65 
66  /* >>chng 06 mar 22, add time option to vary only some continua with time */
67  if( p.nMatch( "TIME" ) )
68  rfield.lgTimeVary[p.m_nqh] = true;
69 
70  /* vary option */
71  if( optimize.lgVarOn )
72  {
73  if( chType == 'I' )
74  {
75  /* this is the usual ionization parameter, U */
76  strcpy( optimize.chVarFmt[optimize.nparm], "IONIZATION PARAMETER= %f LOG" );
77  }
78  else if( chType == 'X' )
79  {
80  /* the X-Ray ionization parameter, xi */
81  strcpy( optimize.chVarFmt[optimize.nparm], "XI= %f LOG" );
82  }
83  else
84  {
85  fprintf( ioQQQ, " Insanity in detecting which ionization parameter.\n" );
87  }
88  if( rfield.lgTimeVary[p.m_nqh] )
89  strcat( optimize.chVarFmt[optimize.nparm], " TIME" );
90  /* pointer to where to write */
95  ++optimize.nparm;
96  }
97 
98  /* set R to large value if U specified. */
99  /* set radius to very large value if not already set */
100  /* >>chng 01 jul 24, from Radius == 0 to this, as per PvH comments */
101  if( !radius.lgRadiusKnown )
102  {
103  radius.Radius = pow(10.,radius.rdfalt);
104  }
105  /* increment nmber of specifications of continuum intensities, */
106  ++p.m_nqh;
107  return;
108 }
bool nMatch(const char *chKey) const
Definition: parser.h:135
double Radius
Definition: radius.h:22
double FFmtRead(void)
Definition: parser.cpp:353
t_input input
Definition: input.cpp:12
long int nvfpnt[LIMPAR]
Definition: optimize.h:194
long int m_nqh
Definition: parser.h:41
double totpow[LIMSPC]
Definition: rfield.h:300
char chRSpec[LIMSPC][5]
Definition: rfield.h:351
long int nRead
Definition: input.h:46
void ParseIonPar(Parser &p, char chType)
char chVarFmt[LIMPAR][FILENAME_PATH_LENGTH_2]
Definition: optimize.h:263
FILE * ioQQQ
Definition: cddefines.cpp:7
realnum vparm[LIMEXT][LIMPAR]
Definition: optimize.h:188
Definition: parser.h:31
bool lgVarOn
Definition: optimize.h:203
bool lgTimeVary[LIMSPC]
Definition: rfield.h:306
const int LIMSPC
Definition: rfield.h:18
void ParseIonParX(Parser &p)
long int nparm
Definition: optimize.h:200
t_rfield rfield
Definition: rfield.cpp:8
float realnum
Definition: cddefines.h:107
#define EXIT_FAILURE
Definition: cddefines.h:144
#define cdEXIT(FAIL)
Definition: cddefines.h:438
NORETURN void NoNumb(const char *chDesc) const
Definition: parser.cpp:233
bool lgRadiusKnown
Definition: radius.h:116
t_optimize optimize
Definition: optimize.cpp:5
char chSpNorm[LIMSPC][5]
Definition: rfield.h:351
t_radius radius
Definition: radius.cpp:5
realnum vincr[LIMPAR]
Definition: optimize.h:191
void ParseIonParI(Parser &p)
#define DEBUG_ENTRY(funcname)
Definition: cddefines.h:688
bool lgEOL(void) const
Definition: parser.h:98
double rdfalt
Definition: radius.h:124
long int nvarxt[LIMPAR]
Definition: optimize.h:194