cloudy  trunk
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
parse_tlaw.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 /*ParseTLaw parse parameters on the tlaw command to set temperature as function of depth,
4  * currently only does Bertoldi & Draine simple T law */
5 
6 /* Despite outward appearances, this routine has no connection whatsoever with
7  Bassetlaw (http://www.bassetlawmuseum.org.uk/) */
8 
9 #include "cddefines.h"
10 #include "thermal.h"
11 #include "parser.h"
12 
13 void ParseTLaw( Parser &p )
14 {
15  DEBUG_ENTRY( "ParseTLaw()" );
16 
17  /* this says that some type of temperature law has been specified */
18  thermal.lgTLaw = true;
21 
22  if( p.nMatch("DB96") )
23  {
24  /* this is to simulate the temperature law given by equation 41 in
25  * >>refer H2 temperature law Draine, B.T., & Bertoldi, Frank, 1996, ApJ, 468, 269-289 */
26  thermal.lgTeBD96 = true;
27 
28  /* this is the initial temperature for the BD96 temperature law */
29  thermal.T0BD96 = 500.f;
30 
31  /* the coefficient on column density for temp dropoff */
32  thermal.SigmaBD96 = 6e-22f;
33  }
34  else if( p.nMatch("SN99") )
35  {
36  /* this is to simulate the temperature law given by equation 16 in
37  * >>refer H2 temperature law Sternberg, A., & Neufeld, D.A. 1999, ApJ, 516, 371-380 */
38  thermal.lgTeSN99 = true;
39 
40  /* this is the inital temperature for the BD96 temperature law */
41  thermal.T0SN99 = 500.f;
42  }
43  else if( p.nMatch("TABL") )
44  {
45  /* when called, read in temperatures from input stream */
46  thermal.lgTeTLaw = true;
47 
48  p.readLaw(thermal.tlaw);
49  }
50  else
51  {
52  fprintf(ioQQQ," There must be a keyword on this command."
53  " The ones I know about are BD96, SN99, and TABLe\n");
55  }
56 
57 #if 0
58 #include "dense.h"
59 #include "optimize.h"
60 #include "input.h"
61  /* all remainder is currently dead code, a copy of DLAW command,
62  * which could be activated if needs arose */
63  /* call fcn dense_fabden(RADIUS) which uses the ten parameters
64  * N.B.; existing version of dense_fabden must be deleted */
65  if (0)
66  {
67  /* this is usual case, call dense_fabden to get density */
68  for( long j=0; j < 10; j++ )
69  {
70  dense.DensityLaw[j] = p.FFmtRead();
71  }
72 
73  /* set flag so we know which law to use later */
74  strcpy( dense.chDenseLaw, "DLW1" );
75 
76  /* vary option */
77  if( optimize.lgVarOn )
78  {
79  /* NB - there are 5 = LIMEXT numbers on this line - if LIMEXT ever changes,
80  * chnage this too */
81  strcpy( optimize.chVarFmt[optimize.nparm], "DLAW %f %f %f %f %f " );
82 
83  /* index for where to write */
85  for( log j=0; j<LIMEXT; ++j )
86  {
88  }
91  ++optimize.nparm;
92  }
93  }
94 # endif
95  return;
96 }
bool nMatch(const char *chKey) const
Definition: parser.h:150
t_thermal thermal
Definition: thermal.cpp:6
double FFmtRead(void)
Definition: parser.cpp:472
t_input input
Definition: input.cpp:12
long int nvfpnt[LIMPAR]
Definition: optimize.h:198
DepthTable tlaw
Definition: thermal.h:95
long int nRead
Definition: input.h:105
realnum SigmaBD96
Definition: thermal.h:86
bool lgTemperatureConstant
Definition: thermal.h:44
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
t_dense dense
Definition: global.cpp:15
long int nparm
Definition: optimize.h:204
float realnum
Definition: cddefines.h:124
#define EXIT_FAILURE
Definition: cddefines.h:168
bool lgTeTLaw
Definition: thermal.h:96
#define cdEXIT(FAIL)
Definition: cddefines.h:482
bool lgTeBD96
Definition: thermal.h:84
t_optimize optimize
Definition: optimize.cpp:6
realnum vincr[LIMPAR]
Definition: optimize.h:195
bool lgTemperatureConstantCommandParsed
Definition: thermal.h:50
const long LIMEXT
Definition: optimize.h:60
char chDenseLaw[5]
Definition: dense.h:176
bool lgTLaw
Definition: thermal.h:80
#define DEBUG_ENTRY(funcname)
Definition: cddefines.h:723
bool lgTeSN99
Definition: thermal.h:92
void ParseTLaw(Parser &p)
Definition: parse_tlaw.cpp:13
realnum T0SN99
Definition: thermal.h:91
int fprintf(const Output &stream, const char *format,...)
Definition: service.cpp:1121
double DensityLaw[10]
Definition: dense.h:191
void readLaw(DepthTable &table)
Definition: parser.cpp:976
realnum T0BD96
Definition: thermal.h:86
long int nvarxt[LIMPAR]
Definition: optimize.h:198