root/branches/newmole/source/cddrive.h
| Revision 2406, 22.2 kB (checked in by rporter, 3 months ago) | |
|---|---|
|
|
| Line | |
|---|---|
| 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 | |
| 4 | #ifndef _CDDRIVE_H_ |
| 5 | #define _CDDRIVE_H_ |
| 6 | |
| 7 | /**\file cddrive.h |
| 8 | \verbatim |
| 9 | this file contains definitions for the suite of routines that |
| 10 | allow the code to be driven as a subroutine. |
| 11 | These routines set up model parameters, |
| 12 | control the execution of Cloudy, and obtain results once complete |
| 13 | these are the only "public" routines, and only these should |
| 14 | be accessed when controlling Cloudy |
| 15 | |
| 16 | DRIVING CLOUDY FROM A FORTRAN PROGRAM: |
| 17 | This should not be too hard - the recommended approach is to use |
| 18 | the cfortran.h file described at http://www-zeus.desy.de/~burow/cfortran/ |
| 19 | |
| 20 | A note on return error conditions: |
| 21 | |
| 22 | Many functions return an int to indicate success or failure. |
| 23 | I try to follow standard Unix/C convention. |
| 24 | A return value of zero usually indicates that the routine was successful, |
| 25 | and a non-zero value (not always 1) indicates failure. This is conventional |
| 26 | in both C and Unix. So the way to call Cloudy and test for success is |
| 27 | |
| 28 | if( cdDdrive() ) |
| 29 | { |
| 30 | printf(" Cloudy failed.\n"); |
| 31 | } |
| 32 | |
| 33 | Although I try to follow this, there ARE exceptions. |
| 34 | \endverbatim |
| 35 | */ |
| 36 | |
| 37 | /** |
| 38 | * cdInit |
| 39 | * This routine must be called before any of the others - |
| 40 | * it reinitializes many variables, and must be called before any |
| 41 | * of the other routines. In a large grid of calculations it must be repeatedly called |
| 42 | * before the start of the new calculation and after all results have |
| 43 | * been obtained from the previous model */ |
| 44 | void cdInit(void); |
| 45 | |
| 46 | /** |
| 47 | * cdTalk |
| 48 | * tells the code whether or not to produce any of its normal output, |
| 49 | * If the argument is true (or if it is not called at all) it produces |
| 50 | * output, produces no output if it is false */ |
| 51 | void cdTalk(bool); |
| 52 | |
| 53 | /** |
| 54 | * cdOutp |
| 55 | * This tells the code where to send output. The argument must be |
| 56 | * a previously opened file handle. All output will go to this file. |
| 57 | * If this routine is not called then all output will go to |
| 58 | * stdout, the standard c output */ |
| 59 | void cdOutp(FILE* ); |
| 60 | |
| 61 | /** cdInp - redirect input stream to open file */ |
| 62 | void cdInp(FILE* ); |
| 63 | |
| 64 | /** |
| 65 | * returns depth structure of previous model |
| 66 | * \param cdDepth[] |
| 67 | */ |
| 68 | void cdDepth_depth( double cdDepth[] ); |
| 69 | |
| 70 | /** |
| 71 | * cdnZone |
| 72 | * returns number of zones */ |
| 73 | long int cdnZone(void ); |
| 74 | |
| 75 | /** |
| 76 | * cdB21cm |
| 77 | * returns B as measured by 21 cm |
| 78 | * assumes tangled field weighted by n(H0)/T */ |
| 79 | double cdB21cm( void ); |
| 80 | |
| 81 | /** |
| 82 | * cdRead |
| 83 | * This sends commands to the code. The normal set of commands |
| 84 | * described in Part I of Hazy must be entered into a null-terminated |
| 85 | * string. These strings are then fed to Cloudy with this command. The function |
| 86 | * returns the number of commands that can still be entered before the command |
| 87 | * stack is full. The code will stop if you try to continue giving it commands |
| 88 | * after the command has returned zero. This return value is the opposite of the |
| 89 | * standard - a non-zero return is normal |
| 90 | */ |
| 91 | int cdRead( const char* ); |
| 92 | |
| 93 | /** |
| 94 | * cdPrtWL print line wavelengths in Angstroms in the standard format - |
| 95 | * a wrapper for prt_wl which must be kept parallel with sprt_wl |
| 96 | * both of those live in pdt.c |
| 97 | *\param [out] *ioOUT output file handle |
| 98 | *\param [in] the emission line wavelength |
| 99 | */ |
| 100 | void cdPrtWL( FILE *io , realnum wl ); |
| 101 | |
| 102 | /** debugLine provides a debugging hook into the main line array |
| 103 | * loops over whole array and finds every line that matches length, |
| 104 | * the wavelength, the argument to the function |
| 105 | * put breakpoint inside if test |
| 106 | * return value is number of matches, also prints all matches |
| 107 | *\param [in] the emission line wavelength |
| 108 | *\param [out] the number of matches |
| 109 | */ |
| 110 | long debugLine( realnum wavelength ); |
| 111 | |
| 112 | /** |
| 113 | * cdNoExec |
| 114 | * This provides option to have the code prepare the initial conditions for a model, |
| 115 | * but not actually try to compute the model. I use this when setting up a large |
| 116 | * grid so that I can quickly run through the full grid as a check that the commands |
| 117 | * are entered properly and the parameters I am going to vary do so properly. |
| 118 | * The command is then commented out when the grid is properly set up. */ |
| 119 | void cdNoExec(void); |
| 120 | |
| 121 | /** |
| 122 | * cdDrive |
| 123 | * This command actually computes a model. |
| 124 | * It returns 0 if the calculation was successful, and 1 if an error |
| 125 | * condition was encountered */ |
| 126 | int cdDrive(void); |
| 127 | |
| 128 | |
| 129 | /* The next two routines confirm that the previous calculation was ok |
| 130 | * or produce a list of error conditions */ |
| 131 | |
| 132 | /** |
| 133 | * cdErrors |
| 134 | * After the calculation is completed, a summary of all error messages can be |
| 135 | * be generated by calling this routine. The argument is the output file |
| 136 | *\param [out] *ioOUT output file |
| 137 | */ |
| 138 | void cdErrors(FILE* ); |
| 139 | |
| 140 | /** |
| 141 | * cdNwcns |
| 142 | * This command returns the number of warnings, cautions, notes, surprises, |
| 143 | * assorted types of failures found the last computed model |
| 144 | |
| 145 | \param *lgAbort abort status, if non-zero then big problems happened |
| 146 | \param *NumberWarnings the number of warnings |
| 147 | \param *NumberCautions the number of cautions |
| 148 | \param *NumberNotes the number of notes |
| 149 | \param *NumberSurprises the number of surprises |
| 150 | \param *NumberTempFailures the number of temperature convergence failures |
| 151 | \param *NumberPresFailures the number of pressure convergence failures |
| 152 | \param *NumberIonFailures the number of ionization convergence failures |
| 153 | \param *NumberNeFailures the number of electron density convergence failures |
| 154 | */ |
| 155 | void cdNwcns( |
| 156 | bool *lgAbort , |
| 157 | long int *NumberWarnings, |
| 158 | long int *NumberCautions, |
| 159 | long int *NumberNotes, |
| 160 | long int *NumberSurprises, |
| 161 | long int *NumberTempFailures, |
| 162 | long int *NumberPresFailures, |
| 163 | long int *NumberIonFailures, |
| 164 | long int *NumberNeFailures ); |
| 165 | |
| 166 | /** This prints the reason why the model stopped, and the model geometry, on |
| 167 | * the io file pointed to by the file handle */ |
| 168 | void cdReasonGeo(FILE*); |
| 169 | |
| 170 | /** |
| 171 | * These routines produce lists of warnings, cautions, notes, surprises |
| 172 | * These are the routines that are called by cdErrors. Normally |
| 173 | * cdErrors and not these routines would be called by the user. */ |
| 174 | void cdWarnings(FILE*); |
| 175 | /** |
| 176 | * produces list of cautions*/ |
| 177 | void cdCautions(FILE*); |
| 178 | /** produces list of surprises*/ |
| 179 | void cdSurprises(FILE*); |
| 180 | /** produces list of Notes */ |
| 181 | void cdNotes(FILE*); |
| 182 | |
| 183 | /*********************************************************** |
| 184 | * |
| 185 | * The next routines examine the predictions of the previous model |
| 186 | * |
| 187 | ***********************************************************/ |
| 188 | |
| 189 | /** |
| 190 | * cdLine |
| 191 | * This routine finds the predicted intensity of any line in the standard output. |
| 192 | * |
| 193 | * |
| 194 | * \param *chLabel 1st parameter is the 4-char label + null terminated label, as it appears in the output. |
| 195 | * \param wavelength 2nd parameter is the float wavelength in Angstroms, not how it appears in printout. |
| 196 | * The first four digits must agree with the number in the printout, but the units must be Angstroms. |
| 197 | * 3rd parameter is the predicted intensity relative to the normalization line. |
| 198 | * 4th par is the log of the predicted luminosity or intensity of the line (ergs). |
| 199 | * \param *relint 5th is pointer to relative intensity, a double that is returned |
| 200 | * \param *absint 6th is pointer to log of absolute intensity |
| 201 | * |
| 202 | * \return return value: |
| 203 | * The routine returns an index (>0) of the array element within stack if it finds the line, |
| 204 | * It returns the negative of the total number of lines if it could not find the line. |
| 205 | * (this is a debugging aid) |
| 206 | * note that this returns a long int since there are LOTS of lines |
| 207 | * this also IS NOT the standard C convention for success or failure */ |
| 208 | |
| 209 | long int cdLine( |
| 210 | const char *chLabel, |
| 211 | realnum wavelength, |
| 212 | double *relint, |
| 213 | double *absint); |
| 214 | |
| 215 | |
| 216 | /**cdLine_ip get the predicted line intensity, using index for line in stack |
| 217 | \param ipLine |
| 218 | \param *relint linear intensity relative to normalization line |
| 219 | \param *absint log of luminosity or intensity of line |
| 220 | */ |
| 221 | void cdLine_ip(long int ipLine, |
| 222 | double *relint, |
| 223 | double *absint ); |
| 224 | |
| 225 | /** |
| 226 | cdDLine get the predicted emergent line intensity, also index for line in stack |
| 227 | |
| 228 | \param *chLabel |
| 229 | \param wavelength wavelength of line as printed by code |
| 230 | \param *relint linear intensity relative to normalization line |
| 231 | \param *absint log of luminosity or intensity of line |
| 232 | \return returns array index for line in array stack if we found the line, |
| 233 | or false==0 if we did not find the line |
| 234 | */ |
| 235 | long int cdDLine(char *chLabel, |
| 236 | realnum wavelength, |
| 237 | double *relint, |
| 238 | double *absint ); |
| 239 | |
| 240 | /** |
| 241 | create a file with a list of all emission lines punched, |
| 242 | and their index within the emission line stack |
| 243 | \param io a file handle pointing to a file that is read for writing - |
| 244 | the calling routine must close it |
| 245 | \return returns total number of lines in the list |
| 246 | */ |
| 247 | long int cdLineListPunch( |
| 248 | /* a file handle pointing to a file that is read for writing - |
| 249 | * the calling routine must close it */ |
| 250 | FILE* io ); |
| 251 | |
| 252 | /** |
| 253 | \verbatim |
| 254 | * cdColm |
| 255 | * This obtains the column density of a species in the previously computed model. |
| 256 | * The first parameter is a 4 character + NULL terminated string which gives |
| 257 | * the first 4 char of the element name as spelled by Cloudy, either upper or lower case. |
| 258 | * The second parameter is the stage of ionization, 1 for atom, 2 for first ion, etc; 0 is special. |
| 259 | * |
| 260 | * examples: |
| 261 | * column density of atomic carbon |
| 262 | * cdColm( "carb" , 1 , &col1 ); |
| 263 | * |
| 264 | * doubly ionized helium |
| 265 | * cdColm( "heli" , 3 , &col3 ); |
| 266 | * |
| 267 | * molecular hydrogen |
| 268 | * cdColm("H2 " , 0 , &col2 ); |
| 269 | * |
| 270 | * If the ion stage is zero then the routine will check the first label |
| 271 | * for the values "H2 ", "OH ", "CO " and "CII* *", |
| 272 | * and will return the H2, OH, CO or CII* column density in this case |
| 273 | * |
| 274 | * The column density [cm-2] is returned as the third parameter in all cases |
| 275 | * |
| 276 | * The function returns 0 if it found the species, 1 if it failed |
| 277 | \endverbatim |
| 278 | */ |
| 279 | |
| 280 | int cdColm(const char*, long, double* ); |
| 281 | |
| 282 | /**cdH2_colden return column density in H2, returns -1 if cannot find state, |
| 283 | * header is in cdDrive, source in h2.c */ |
| 284 | |
| 285 | double cdH2_colden( long iVib , long iRot ); |
| 286 | |
| 287 | /**cdCO_colden return column density in H2, negative -1 if cannot find state, |
| 288 | * header is cdDrive */ |
| 289 | |
| 290 | /** long isotope \n long iRot |
| 291 | */ |
| 292 | double cdCO_colden( long isotope , long iRot ); |
| 293 | |
| 294 | /** |
| 295 | * cdEmis |
| 296 | * This routine finds the local emissivity for any line. |
| 297 | * The first argument is the 4 character (null terminated) label as it appears in the |
| 298 | * standard output. |
| 299 | * The second argument is float wavelength as it appears in the standard output. |
| 300 | * The emissivity (erg /cm^3 /s) is returned as the last parameter. |
| 301 | * cdEms returns the index of the line in the stack if it was found, |
| 302 | * the negative of the total number of lines in the stack if it could not find the line |
| 303 | \param *chLabel 4 char null terminated string label |
| 304 | \param wavelength line wavelength |
| 305 | \param *emiss the vol emissivity of this line in last computed zone |
| 306 | \return return value will be index of line within stack |
| 307 | */ |
| 308 | |
| 309 | long int cdEmis( |
| 310 | char *chLabel, |
| 311 | realnum wavelength, |
| 312 | double *emiss ); |
| 313 | |
| 314 | |
| 315 | /** cdEms_ip obtain the local emissivity for a line with known index |
| 316 | \param ipLine index of the line in the stack |
| 317 | \param *emiss the vol emissivity of this line in last computed zone |
| 318 | */ |
| 319 | void cdEmis_ip( |
| 320 | long int ipLine, |
| 321 | double *emiss ); |
| 322 | |
| 323 | /** |
| 324 | * cdCooling_last |
| 325 | * The returns the total cooling (erg cm^-3 s^-1) for the last computed zone */ |
| 326 | double cdCooling_last(void); |
| 327 | |
| 328 | /** |
| 329 | * cdHeating_last |
| 330 | * returns the total heating (erg cm^-3 s^-1) for the last computed zone */ |
| 331 | double cdHeating_last(void); |
| 332 | |
| 333 | /**cdEDEN_last return electron density of last zone */ |
| 334 | double cdEDEN_last(void); |
| 335 | |
| 336 | /** cdPressure_last |
| 337 | * This returns the pressure and its constituents for the last computed zone. |
| 338 | \param *TotalPressure total pressure, all forms |
| 339 | \param *GasPressure gas pressure |
| 340 | \param *RadiationPressure radiation pressure |
| 341 | */ |
| 342 | void cdPressure_last( |
| 343 | double *TotalPressure, |
| 344 | double *GasPressure, |
| 345 | double *RadiationPressure); |
| 346 | |
| 347 | /** |
| 348 | * cdPressure_depth |
| 349 | * This returns the pressure and its constituents for the last iteration. |
| 350 | * space was allocated in the calling routine for the vectors - |
| 351 | * before calling this, cdnZone should have been called to get the number of |
| 352 | * zones, then space allocated for the arrays |
| 353 | \param TotalPressure[] total pressure, all forms |
| 354 | \param GasPressure[] gas pressure |
| 355 | \param RadiationPressure[] radiation pressure |
| 356 | */ |
| 357 | void cdPressure_depth( |
| 358 | double TotalPressure[], |
| 359 | double GasPressure[], |
| 360 | double RadiationPressure[]); |
| 361 | |
| 362 | /** |
| 363 | * cdTemp_last |
| 364 | * returns the temperature of the last zone on last iteration */ |
| 365 | double cdTemp_last(void); |
| 366 | |
| 367 | /** |
| 368 | \verbatim |
| 369 | * cdIonFrac |
| 370 | * This returns the ionization fraction for any element included in the calculation. |
| 371 | * The first parameter is 4 char null terminated string giving the first 4 letters of |
| 372 | * element name as spelled by Cloudy. |
| 373 | * The second parameter is an integer giving the ionization stage, |
| 374 | * 1 for atom, 2 for first ion, etc. |
| 375 | * The third parameter returns the predicted ionization fraction of that ion stage. |
| 376 | * The last parameter is an 8 character + null string that says either "volume" or "radius", |
| 377 | * to specify whether the average should be weighted by volume or radius. |
| 378 | * The return value is 0 if the routine could find the species and |
| 379 | * non-zero if it failed to find the element |
| 380 | \endverbatim |
| 381 | \param *chLabel four char string, null terminated, giving the element name |
| 382 | \param IonStage IonStage is ionization stage, 1 for atom, up to N+1 where N is atomic number |
| 383 | \param *fracin will be fractional ionization |
| 384 | \param *chWeight how to weight the average, must be "VOLUME" or "RADIUS" |
| 385 | \param lgDensity if true then weighting also has electron density, if false then only volume or radius |
| 386 | */ |
| 387 | int cdIonFrac( |
| 388 | const char *chLabel, |
| 389 | long int IonStage, |
| 390 | double *fracin, |
| 391 | const char *chWeight , |
| 392 | bool lgDensity ); |
| 393 | |
| 394 | /** |
| 395 | * cdVersion |
| 396 | * The argument is a string with at least 8 characters that will receive a null terminated |
| 397 | * string with the version number of the code. */ |
| 398 | void cdVersion(char chString[] ); |
| 399 | |
| 400 | /** |
| 401 | * cdDate |
| 402 | * The argument is a string with at least 8 char that will receive a null terminated |
| 403 | * string with the date of the current version of the code. */ |
| 404 | void cdDate(char chString[] ); |
| 405 | |
| 406 | /* The following pairs of routines can keep track of the execution time for one model - |
| 407 | * cdSetExecTime called first (in cdInit, not by the user) to initialize timer. |
| 408 | * When cdExecTime is called it will return the elapsed time in seconds |
| 409 | * since cdInit called cdSetExecTime*/ |
| 410 | |
| 411 | /** normally called by cdInit, this routine sets initial variables for times */ |
| 412 | void cdSetExecTime(void); |
| 413 | |
| 414 | /** cdExecTime returns the elapsed time cpu time (sec) that has elapsed |
| 415 | * since cdInit called cdSetExecTime.*/ |
| 416 | double cdExecTime(void); |
| 417 | |
| 418 | /** |
| 419 | \verbatim |
| 420 | * cdGetLineList will read in a list of emission line labels and wavelengths |
| 421 | * from a file. I use it for generating LOC grids. |
| 422 | * Two files (cdGetLineList and cdGetLineList) are included in the main data |
| 423 | * distribution and have list of strong emission lines for high and low density gas. |
| 424 | * other files can be created by the user. |
| 425 | * |
| 426 | * The first argument is the name of the file to read. |
| 427 | * It it is void ("") then the routine will open LineList_BLR.dat |
| 428 | * |
| 429 | * The next two arguments are pointers that will become arrays giving the |
| 430 | * list of labels and wavelengths. The routine will allocate the |
| 431 | * needed space, but the pointer is defined in the calling routine. |
| 432 | * in the calling routine the two variable should be declared like this: |
| 433 | * char **chLabels; |
| 434 | * realnum *wavelength; |
| 435 | * They would appear as follows in the call to the routine: |
| 436 | * chGetLineList("", &chLabels , &wavelength ); |
| 437 | * |
| 438 | * cdGetLineList returns the number of lines it found in the file if it was successful, |
| 439 | * and -1 if it could not open the file. |
| 440 | * |
| 441 | \endverbatim |
| 442 | */ |
| 443 | |
| 444 | long int cdGetLineList( |
| 445 | const char chFile[] , |
| 446 | char ***chLabels , |
| 447 | realnum **wl ); |
| 448 | |
| 449 | /** |
| 450 | * cdTimescales returns the longest thermal, recombination, and H2 formation |
| 451 | * timescales that occurred in the previous model |
| 452 | \param *TTherm the thermal cooling timescale |
| 453 | \param *THRecom the hydrogen recombination timescale |
| 454 | \param *TH2 the H2 formation timescale |
| 455 | */ |
| 456 | void cdTimescales( |
| 457 | double *TTherm , |
| 458 | double *THRecom , |
| 459 | double *TH2 ); |
| 460 | |
| 461 | /* ****************************************************************** |
| 462 | * |
| 463 | * next part deals with FeII bands. There are two types, the tabulated |
| 464 | * band that are defined in FeII_bands.ini, and the psuedo-continuum bins |
| 465 | * that are generatedby the code in FeIIContCreate. |
| 466 | * nFeIIConBins is number of continuum bins in FeII_Cont |
| 467 | * nFeIIBands is number of bands in FeII_bands.ini, and are saved in FeII_Bands |
| 468 | * the bands are created by hand and the entries in FeII_bands.ini are |
| 469 | * meant to be created by a person */ |
| 470 | |
| 471 | /* the declarations for the next four are in FeIILevelPops.c */ |
| 472 | /** this is the number of bands read in from FeII_bands.ini */ |
| 473 | extern long int nFeIIBands; |
| 474 | |
| 475 | /** number of bands in continuum array */ |
| 476 | extern long int nFeIIConBins; |
| 477 | |
| 478 | /* band wavelength, lower and upper bounds, in vacuum Angstroms */ |
| 479 | /** FeII.bands[n][3], where n is the number of bands in fe2bands.dat |
| 480 | * these bands are defined in fe2bands.dat and read in at startup |
| 481 | * of calculation */ |
| 482 | extern realnum **FeII_Bands; |
| 483 | |
| 484 | /* continuum wavelengths, lower and upper bounds, in vacuum Angstroms |
| 485 | * third is integrated intensity */ |
| 486 | /** FeII_Cont[n][3], where n is the number of cells needed |
| 487 | * these bands are defined in cdGetFeIIBands */ |
| 488 | extern realnum **FeII_Cont; |
| 489 | |
| 490 | |
| 491 | /**cdMPI sets flag telling exit handler to call MPI_Finalize, This routine |
| 492 | * must be called after cdInit when MPI is used */ |
| 493 | void cdMPI(void); /** set flag so that exit handler will clean up MPI */ |
| 494 | |
| 495 | /** |
| 496 | * this routine returns the spectrum needed for Keith Arnaud's XSPEC |
| 497 | * X-Ray analysis code. It should be called after cdDrive has successfully |
| 498 | * computed a model. The calling routine must ensure that the vectors |
| 499 | * have enough space to store the resulting spectrum, |
| 500 | * given the bounds and energy resolution |
| 501 | \param Option |
| 502 | \verbatim |
| 503 | option - the type of spectrum to be returned |
| 504 | 1 the incident continuum 4\pi nuJ_nu, , erg cm-2 s-1 |
| 505 | |
| 506 | 2 the attenuated incident continuum, same units |
| 507 | 3 the reflected continuum, same units |
| 508 | |
| 509 | 4 diffuse continuous emission outward direction |
| 510 | 5 diffuse continuous emission, reflected |
| 511 | |
| 512 | 6 collisional+recombination lines, outward |
| 513 | 7 collisional+recombination lines, reflected |
| 514 | |
| 515 | all lines and continuum emitted by the cloud assume full coverage of |
| 516 | continuum source |
| 517 | \endverbatim |
| 518 | \param EnergyLow[] * the energy of the lower edge of each cell |
| 519 | (in Ryd to be consistent with all the rest of Cloudy |
| 520 | \param nEnergy the number of cells + 1 |
| 521 | \param ReturnedSpectrum[] the returned spectrum, same size is two energy spectra (see option), returns nEnergy -1 pts |
| 522 | */ |
| 523 | void cdSPEC( |
| 524 | int Option , |
| 525 | double EnergyLow[] , |
| 526 | long int nEnergy , |
| 527 | double ReturnedSpectrum[] ); |
| 528 | |
| 529 | |
| 530 | /** |
| 531 | \param Option |
| 532 | \verbatim the type of spectrum to be returned |
| 533 | 1 the incident continuum 4\pi nuJ_nu, , erg cm-2 s-1 |
| 534 | |
| 535 | 2 the attenuated incident continuum, same units |
| 536 | 3 the reflected continuum, same units |
| 537 | |
| 538 | 4 diffuse emission outward direction |
| 539 | 5 diffuse emission, reflected |
| 540 | |
| 541 | 6 collisional+recombination lines, outward |
| 542 | 7 collisional+recombination lines, reflected |
| 543 | |
| 544 | all lines and continuum emitted by the cloud assume full coverage of |
| 545 | continuum source |
| 546 | \endverbatim |
| 547 | |
| 548 | \param nEnergy the number of cells + 1 |
| 549 | \param ipLoEnergy |
| 550 | \param ipHiEnergy |
| 551 | \param ReturnedSpectrum[] the returned spectrum, same size is two energy spectra (see option), returns nEnergy -1 pts |
| 552 | */ |
| 553 | void cdSPEC2( |
| 554 | int Option , |
| 555 | long int nEnergy , |
| 556 | long int ipLoEnergy, |
| 557 | long int ipHiEnergy, |
| 558 | realnum ReturnedSpectrum[] ); |
| 559 | |
| 560 | /** cdTemp \verbatim |
| 561 | * This routine finds the mean electron temperature for any ionization stage |
| 562 | * It returns 0 if it could find the species, 1 if it could not find the species. |
| 563 | * The first argument is a null terminated 4 char string that gives the element |
| 564 | * name as spelled by Cloudy. |
| 565 | * The second argument is ion stage, 1 for atom, 2 for first ion, etc |
| 566 | * This third argument will be returned as result, |
| 567 | * Last parameter is either "VOLUME" or "RADIUS" to give weighting |
| 568 | * |
| 569 | * if the ion stage is zero then the element label will have a special meaning. |
| 570 | * The string "21CM" is will return the 21 cm temperature. |
| 571 | * The string "H2 " will return the temperature weighted wrt the H2 density \endverbatim |
| 572 | \param *chLabel four char string, null terminated, giving the element name |
| 573 | \param IonStage IonStage is ionization stage, 1 for atom, up to N+1 where N is atomic number |
| 574 | \param *TeMean will be temperature |
| 575 | \param *chWeight how to weight the average, must be "VOLUME" or "RADIUS" |
| 576 | */ |
| 577 | int cdTemp( |
| 578 | const char *chLabel, |
| 579 | long int IonStage, |
| 580 | double *TeMean, |
| 581 | const char *chWeight ); |
| 582 | |
| 583 | /** cdPrintCommands( FILE *) |
| 584 | * This routine prints all input commands into file whose handle is the argument |
| 585 | * \param *ioOUT [out] output file handle |
| 586 | */ |
| 587 | void cdPrintCommands( FILE * ); |
| 588 | |
| 589 | /** wrapper to close all punch files */ |
| 590 | void cdClosePunchFiles( void ); |
| 591 | |
| 592 | /**cdH2_Line returns 1 if we found the line, |
| 593 | * or false==0 if we did not find the line because ortho-para transition |
| 594 | * or upper level has lower energy than lower level |
| 595 | * NB - this is in mole_h2_io.c |
| 596 | \param iElecHi indices for the upper level |
| 597 | \param iVibHi indices for the upper level |
| 598 | \param iRotHi indices for the upper level |
| 599 | \param iElecLo indices for lower level |
| 600 | \param iVibLo indices for lower level |
| 601 | \param iRotLo indices for lower level |
| 602 | \param *relint linear intensity relative to normalization line |
| 603 | \param *absint log of luminosity or intensity of line |
| 604 | */ |
| 605 | long int cdH2_Line( |
| 606 | /* indices for the upper level */ |
| 607 | long int iElecHi, |
| 608 | long int iVibHi , |
| 609 | long int iRotHi , |
| 610 | /* indices for lower level */ |
| 611 | long int iElecLo, |
| 612 | long int iVibLo , |
| 613 | long int iRotLo , |
| 614 | /* linear intensity relative to normalization line*/ |
| 615 | double *relint, |
| 616 | /* log of luminosity or intensity of line */ |
| 617 | double *absint ); |
| 618 | |
| 619 | /* none of the following are generally needed */ |
| 620 | |
| 621 | /** this is the value that will be set true when cdInit is called. |
| 622 | * Other routines will check that this is true when they are called, |
| 623 | * to verify that cdInit was called first. Definition is in cdInit.cpp */ |
| 624 | extern bool lgcdInitCalled; |
| 625 | |
| 626 | #ifndef MAX2 |
| 627 | /* MAX2 takes two arguments, returns the larger of the two */ |
| 628 | #define MAX2(a,b) (((a)>(b)) ? (a) : (b)) |
| 629 | #endif |
| 630 | /* */ |
| 631 | |
| 632 | #ifndef MIN2 |
| 633 | /* MIN2 takes two arguments, returns the smaller of the two */ |
| 634 | #define MIN2(a,b) (((a)<(b)) ? (a) : (b)) |
| 635 | #endif |
| 636 | /* */ |
| 637 | |
| 638 | |
| 639 | #endif /* _CDDRIVE_H_ */ |
Note: See TracBrowser
for help on using the browser.
