cloudy  trunk
 All Data Structures 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-2008 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 #include "cddefines.h"
6 #include "thermal.h"
7 #include "parse.h"
8 
9 void ParseTLaw(char *chCard )
10 {
11 
12  DEBUG_ENTRY( "ParseTLaw()" );
13 
14  /* this says that some type of temperature law has been specified */
15  thermal.lgTLaw = true;
18 
19  if( nMatch("DB96",chCard) )
20  {
21  /* this is to simulate the temperature law given by equation 41 in
22  * >>refer H2 temperature law Draine, B.T., & Bertoldi, Frank, 1996, ApJ, 468, 269-289 */
23  thermal.lgTeBD96 = true;
24 
25  /* this is the initial temperature for the BD96 temperature law */
26  thermal.T0BD96 = 500.f;
27  TempChange(thermal.T0BD96 , false);
28 
29  /* the coefficient on column density for temp dropoff */
30  thermal.SigmaBD96 = 6e-22f;
31  }
32  else if( nMatch("SN99",chCard) )
33  {
34  /* this is to simulate the temperature law given by equation 16 in
35  * >>refer H2 temperature law Sternberg, A., & Neufeld, D.A. 1999, ApJ, 516, 371-380 */
36  thermal.lgTeSN99 = true;
37 
38  /* this is the inital temperature for the BD96 temperature law */
39  thermal.T0SN99 = 500.f;
40  TempChange(thermal.T0SN99 , false);
41  }
42  else
43  {
44  fprintf(ioQQQ," There must be a keyword on this command. The one I know about is BD96\n");
45  cdEXIT(EXIT_FAILURE);
46  }
47 
48 #if 0
49 #include "dense.h"
50 #include "optimize.h"
51 #include "input.h"
52  bool lgEOL,
53  lgEnd;
54  long int i,
55  j;
56  char chCAP[5];
57  /* all remainder is currently dead code, a copy of DLAW command,
58  * which could be activated if needs arose */
59  /* call fcn dense_fabden(RADIUS) which uses the ten parameters
60  * N.B.; existing version of dense_fabden must be deleted
61  * >>chng 96 nov 29, added table option */
62  if( nMatch("TABL",chCard) )
63  {
64  /* when called, read in densities from input stream */
65  strcpy( dense.chDenseLaw, "DLW2" );
66  if( nMatch("DEPT",chCard) )
67  {
68  dense.lgDLWDepth = true;
69  }
70  else
71  {
72  dense.lgDLWDepth = false;
73  }
74 
75  input_readarray(chCard,&lgEnd);
76  i = 1;
77  dense.frad[0] = (realnum)FFmtRead(chCard,&i,INPUT_LINE_LENGTH,&lgEOL);
78  dense.fhden[0] = (realnum)FFmtRead(chCard,&i,INPUT_LINE_LENGTH,&lgEOL);
79  if( lgEOL )
80  {
81  fprintf( ioQQQ, " No pairs entered - can\'t interpolate.\n Sorry.\n" );
82  cdEXIT(EXIT_FAILURE);
83  }
84 
85  dense.nvals = 2;
86  lgEnd = false;
87 
88  /* read pairs of numbers until we find line starting with END */
89  while( !lgEnd && dense.nvals < LIMTABDLAW )
90  {
91  input_readarray(chCard,&lgEnd);
92  if( !lgEnd )
93  {
94  cap4(chCAP , chCard);
95  if( strncmp(chCAP , "END" , 3 ) == 0 )
96  lgEnd = true;
97  }
98 
99  if( !lgEnd )
100  {
101  i = 1;
102  dense.frad[dense.nvals-1] = (realnum)FFmtRead(chCard
103  ,&i,INPUT_LINE_LENGTH,&lgEOL);
104  dense.fhden[dense.nvals-1] = (realnum)FFmtRead(chCard
105  ,&i,INPUT_LINE_LENGTH,&lgEOL);
106  dense.nvals += 1;
107  }
108  }
109  --dense.nvals;
110 
111  for( i=1; i < dense.nvals; i++ )
112  {
113  /* the radius values are assumed to be strictly increasing */
114  if( dense.frad[i] <= dense.frad[i-1] )
115  {
116  fprintf( ioQQQ, " density.in radii must be in increasing order\n" );
117  cdEXIT(EXIT_FAILURE);
118  }
119  }
120  }
121  else
122  {
123  /* this is usual case, call dense_fabden to get density */
124  i = 4;
125  for( j=0; j < 10; j++ )
126  {
127  dense.DensityLaw[j] = FFmtRead(chCard,&i,INPUT_LINE_LENGTH,&lgEOL);
128  }
129 
130  /* set flag so we know which law to use later */
131  strcpy( dense.chDenseLaw, "DLW1" );
132 
133  /* vary option */
134  if( optimize.lgVarOn )
135  {
136  /* NB - there are 5 = LIMEXT numbers on this line - if LIMEXT ever changes,
137  * chnage this too */
138  strcpy( optimize.chVarFmt[optimize.nparm], "DLAW %f %f %f %f %f " );
139 
140  /* index for where to write */
142  for( j=0; j<LIMEXT; ++j )
143  {
145  }
146  optimize.vincr[optimize.nparm] = 0.5;
148  ++optimize.nparm;
149  }
150  }
151 # endif
152  return;
153 }

Generated for cloudy by doxygen 1.8.1.1