cloudy  trunk
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
parse_illuminate.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 /*ParseStop parse the stop command */
4 #include "cddefines.h"
5 #include "optimize.h"
6 #include "rfield.h"
7 #include "geometry.h"
8 #include "input.h"
9 #include "parser.h"
10 
12 {
13  DEBUG_ENTRY( "ParseIlluminate()" );
14 
15  if( rfield.nShape < 1 )
16  {
17  fprintf(ioQQQ,"PROBLEM the illuminate command has come before any "
18  "radiation field shape commands.\nThis must come after the field"
19  " is specified.\nSorry.\n");
21  }
22 
24  // use chCard()+4 to make sure the command ILLUMINATE itself is not picked up
25  if( p.nMatch( "FORW" ) )
27  else if( p.nMatch( "REVE" ) )
29  else if( p.nMatch( "SYMM" ) )
31 
32  // isotropic case
33  if( p.nMatch( "ISOT" ) )
34  {
35  // isotropic illumination - following not meaningful
37  rfield.lgBeamed[rfield.nShape-1] = false;
38  }
39  else
40  {
41  double AngleIllumRadian = 0.;
42 
43  /* default is to specify an illumination angle */
44  rfield.lgBeamed[rfield.nShape-1] = true;
45  double a = p.FFmtRead();
46  if( p.lgEOL() )
47  p.NoNumb("illumination angle");
48 
49  /* default is degrees, but radian key accepted */
50  if( p.nMatch( "RADI" ) )
51  AngleIllumRadian = a;
52  else
53  AngleIllumRadian = a/RADIAN;
54  if( AngleIllumRadian < 0. || AngleIllumRadian >= PI/2. )
55  {
56  fprintf( ioQQQ, " Angle of illumination must be between 0 and 90 degrees "
57  "or 0 and pi/2 radians.\n" );
59  }
60 
61  /* this is effective path 1. / COS( theta ) - so that
62  * dTau_eff = dTau_normal * geometry.DirectionalCosin */
63  geometry.DirectionalCosin = (realnum)(1./cos(AngleIllumRadian));
64 
66  (realnum)(1./cos(AngleIllumRadian));
67 
68  /* vary option */
69  if( optimize.lgVarOn )
70  {
71  /* no luminosity options on vary */
73  if( p.nMatch( "RADI" ) )
74  {
75  strcpy( optimize.chVarFmt[optimize.nparm], "ILLUMINATE %f RADIAN" );
76  optimize.vparm[0][optimize.nparm] = (realnum)AngleIllumRadian;
77  optimize.varang[optimize.nparm][0] = 0.f;
78  optimize.varang[optimize.nparm][1] = realnum(PI/2.);
79  }
80  else
81  {
82  strcpy( optimize.chVarFmt[optimize.nparm], "ILLUMINATE %f" );
83  optimize.vparm[0][optimize.nparm] = (realnum)(AngleIllumRadian*RADIAN);
84  optimize.varang[optimize.nparm][0] = 0.f;
85  optimize.varang[optimize.nparm][1] = 90.f;
86  }
87 
89  strcat( optimize.chVarFmt[optimize.nparm], " FORWARD" );
91  strcat( optimize.chVarFmt[optimize.nparm], " REVERSE" );
93  strcat( optimize.chVarFmt[optimize.nparm], " ISOTROPIC" );
94 
96  /* pointer to where to write */
98  /* the increment in the first steps away from the original value */
99  optimize.vincr[optimize.nparm] = 0.1f;
100  optimize.nparm += 1;
101  }
102  }
103 }
104 
bool nMatch(const char *chKey) const
Definition: parser.h:150
bool lgBeamed[LIMSPC]
Definition: rfield.h:294
double FFmtRead(void)
Definition: parser.cpp:472
t_input input
Definition: input.cpp:12
long int nvfpnt[LIMPAR]
Definition: optimize.h:198
realnum varang[LIMPAR][2]
Definition: optimize.h:201
long int nRead
Definition: input.h:105
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
void ParseIlluminate(Parser &p)
t_geometry geometry
Definition: geometry.cpp:5
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
Illuminate::IlluminationType Illumination[LIMSPC]
Definition: rfield.h:300
#define cdEXIT(FAIL)
Definition: cddefines.h:482
realnum DirectionalCosin
Definition: geometry.h:25
NORETURN void NoNumb(const char *chDesc) const
Definition: parser.cpp:345
t_optimize optimize
Definition: optimize.cpp:6
realnum vincr[LIMPAR]
Definition: optimize.h:195
bool lgOptimizeAsLinear[LIMPAR]
Definition: optimize.h:184
#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
realnum OpticalDepthScaleFactor[LIMSPC]
Definition: rfield.h:298
long int nShape
Definition: rfield.h:306
long int nvarxt[LIMPAR]
Definition: optimize.h:198