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-2022 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 */
96  ++optimize.nparm;
97  }
98 
99  /* increment nmber of specifications of continuum intensities, */
100  ++p.m_nqh;
101  return;
102 }
bool nMatch(const char *chKey) const
Definition: parser.h:150
double FFmtRead(void)
Definition: parser.cpp:472
t_input input
Definition: input.cpp:12
long int nvfpnt[LIMPAR]
Definition: optimize.h:198
long int m_nqh
Definition: parser.h:54
double totpow[LIMSPC]
Definition: rfield.h:284
char chRSpec[LIMSPC][5]
Definition: rfield.h:335
long int nRead
Definition: input.h:105
void ParseIonPar(Parser &p, char chType)
char chVarFmt[LIMPAR][FILENAME_PATH_LENGTH_2]
Definition: optimize.h:267
FILE * ioQQQ
Definition: cddefines.cpp:7
realnum vparm[LIMEXT][LIMPAR]
Definition: optimize.h:192
Definition: parser.h:43
bool lgVarOn
Definition: optimize.h:207
bool lgTimeVary[LIMSPC]
Definition: rfield.h:290
double range[LIMSPC][2]
Definition: rfield.h:331
const int LIMSPC
Definition: rfield.h:21
void ParseIonParX(Parser &p)
long int nparm
Definition: optimize.h:204
t_rfield rfield
Definition: rfield.cpp:9
float realnum
Definition: cddefines.h:124
#define EXIT_FAILURE
Definition: cddefines.h:168
#define cdEXIT(FAIL)
Definition: cddefines.h:482
NORETURN void NoNumb(const char *chDesc) const
Definition: parser.cpp:345
t_optimize optimize
Definition: optimize.cpp:6
char chSpNorm[LIMSPC][5]
Definition: rfield.h:335
realnum vincr[LIMPAR]
Definition: optimize.h:195
void ParseIonParI(Parser &p)
#define DEBUG_ENTRY(funcname)
Definition: cddefines.h:723
bool lgEOL(void) const
Definition: parser.h:113
int fprintf(const Output &stream, const char *format,...)
Definition: service.cpp:1121
long int nvarxt[LIMPAR]
Definition: optimize.h:198