cloudy  trunk
 All Data Structures 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-2008 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 "parse.h"
10 
11 void ParseIonPar(long int *nqh,
12  char *chCard,
13  realnum *ar1)
14 {
15  bool lgEOL;
16  long int i;
17 
18  DEBUG_ENTRY( "ParseIonPar()" );
19 
20  /* check not too many continua */
21  if( *nqh >= LIMSPC )
22  {
23  /* too many continua were entered */
24  fprintf( ioQQQ, " Too many continua entered; increase LIMSPC\n" );
25  cdEXIT(EXIT_FAILURE);
26  }
27 
28  /* this is counter for where to start scanning number on line - different
29  * for XI than for IONIZ */
30  i = -1;
31  /* say that continuum is per unit area, ionization parameter*/
32  strcpy( rfield.chRSpec[*nqh], "SQCM" );
33  if( chCard[0] == 'I' )
34  {
35  /* this is the usual ionization parameter, U */
36  strcpy( rfield.chSpNorm[*nqh], "IONI" );
37  i = 5;
38  }
39  else if( chCard[0] == 'X' )
40  {
41  /* the X-Ray ionization parameter, xi */
42  strcpy( rfield.chSpNorm[*nqh], "IONX" );
43  /* >>chng 06 jan 20, had used 5 as in ionization parameter so
44  * possible to miss beginning of number */
45  i = 3;
46  }
47  else
48  {
49  fprintf(ioQQQ," ParseIonPar hit chCard insanity.\n");
50  cdEXIT(EXIT_FAILURE);
51  }
52 
53  /* get the ionization parameter*/
54  rfield.totpow[*nqh] = FFmtRead(chCard,&i,INPUT_LINE_LENGTH,&lgEOL);
55  if( lgEOL )
56  NoNumb(chCard);
57 
58  /* check for linear option, if present take log since rfield.totpow[*nqh]
59  * being log ionization parameter is the default */
60  if( nMatch( "LINE" , chCard ) )
61  rfield.totpow[*nqh] = log10(rfield.totpow[*nqh]);
62 
63  /* >>chng 06 mar 22, add time option to vary only some continua with time */
64  if( nMatch( "TIME" , chCard ) )
65  rfield.lgTimeVary[*nqh] = true;
66 
67  /* vary option */
68  if( optimize.lgVarOn )
69  {
70  if( chCard[0] == 'I' )
71  {
72  /* this is the usual ionization parameter, U */
73  strcpy( optimize.chVarFmt[optimize.nparm], "IONIZATION PARAMETER=%f" );
74  }
75  else if( chCard[0] == 'X' )
76  {
77  /* the X-Ray ionization parameter, xi */
78  strcpy( optimize.chVarFmt[optimize.nparm], "XI=%f" );
79  }
80  else
81  {
82  fprintf( ioQQQ, " Insanity in detecting which ionization parameter.\n" );
83  cdEXIT(EXIT_FAILURE);
84  }
85  /* pointer to where to write */
90  ++optimize.nparm;
91  }
92 
93  /* set R to large value if U specified. */
94  /* set radius to very large value if not already set */
95  /* >>chng 01 jul 24, from Radius == 0 to this, as per PvH comments */
96  if( !radius.lgRadiusKnown )
97  {
98  *ar1 = (realnum)radius.rdfalt;
99  radius.Radius = pow(10.,radius.rdfalt);
100  }
101  /* increment nmber of specifications of continuum intensities, */
102  ++*nqh;
103  return;
104 }

Generated for cloudy by doxygen 1.8.4