cloudy trunk
|
00001 /* This file is part of Cloudy and is copyright (C)1978-2008 by Gary J. Ferland and 00002 * others. For conditions of distribution and use see copyright notice in license.txt */ 00003 00004 #ifndef _CDDRIVE_H_ 00005 #define _CDDRIVE_H_ 00006 00044 void cdInit(void); 00045 00051 void cdTalk(bool); 00052 00059 void cdOutp(FILE* ); 00060 00062 void cdInp(FILE* ); 00063 00068 void cdDepth_depth( double cdDepth[] ); 00069 00073 long int cdnZone(void ); 00074 00079 double cdB21cm( void ); 00080 00091 int cdRead( const char* ); 00092 00100 void cdPrtWL( FILE *io , realnum wl ); 00101 00110 long debugLine( realnum wavelength ); 00111 00119 void cdNoExec(void); 00120 00126 int cdDrive(void); 00127 00128 00129 /* The next two routines confirm that the previous calculation was ok 00130 * or produce a list of error conditions */ 00131 00138 void cdErrors(FILE* ); 00139 00155 void cdNwcns( 00156 bool *lgAbort , 00157 long int *NumberWarnings, 00158 long int *NumberCautions, 00159 long int *NumberNotes, 00160 long int *NumberSurprises, 00161 long int *NumberTempFailures, 00162 long int *NumberPresFailures, 00163 long int *NumberIonFailures, 00164 long int *NumberNeFailures ); 00165 00168 void cdReasonGeo(FILE*); 00169 00174 void cdWarnings(FILE*); 00177 void cdCautions(FILE*); 00179 void cdSurprises(FILE*); 00181 void cdNotes(FILE*); 00182 00183 /*********************************************************** 00184 * 00185 * The next routines examine the predictions of the previous model 00186 * 00187 ***********************************************************/ 00188 00209 long int cdLine( 00210 const char *chLabel, 00211 realnum wavelength, 00212 double *relint, 00213 double *absint); 00214 00215 00221 void cdLine_ip(long int ipLine, 00222 double *relint, 00223 double *absint ); 00224 00235 long int cdDLine(char *chLabel, 00236 realnum wavelength, 00237 double *relint, 00238 double *absint ); 00239 00247 long int cdLineListPunch( 00248 /* a file handle pointing to a file that is read for writing - 00249 * the calling routine must close it */ 00250 FILE* io ); 00251 00280 int cdColm(const char*, long, double* ); 00281 00285 double cdH2_colden( long iVib , long iRot ); 00286 00292 double cdCO_colden( long isotope , long iRot ); 00293 00309 long int cdEmis( 00310 char *chLabel, 00311 realnum wavelength, 00312 double *emiss ); 00313 00314 00319 void cdEmis_ip( 00320 long int ipLine, 00321 double *emiss ); 00322 00326 double cdCooling_last(void); 00327 00331 double cdHeating_last(void); 00332 00334 double cdEDEN_last(void); 00335 00342 void cdPressure_last( 00343 double *TotalPressure, 00344 double *GasPressure, 00345 double *RadiationPressure); 00346 00357 void cdPressure_depth( 00358 double TotalPressure[], 00359 double GasPressure[], 00360 double RadiationPressure[]); 00361 00365 double cdTemp_last(void); 00366 00387 int cdIonFrac( 00388 const char *chLabel, 00389 long int IonStage, 00390 double *fracin, 00391 const char *chWeight , 00392 bool lgDensity ); 00393 00398 void cdVersion(char chString[] ); 00399 00404 void cdDate(char chString[] ); 00405 00406 /* The following pairs of routines can keep track of the execution time for one model - 00407 * cdSetExecTime called first (in cdInit, not by the user) to initialize timer. 00408 * When cdExecTime is called it will return the elapsed time in seconds 00409 * since cdInit called cdSetExecTime*/ 00410 00412 void cdSetExecTime(void); 00413 00416 double cdExecTime(void); 00417 00444 long int cdGetLineList( 00445 const char chFile[] , 00446 char ***chLabels , 00447 realnum **wl ); 00448 00456 void cdTimescales( 00457 double *TTherm , 00458 double *THRecom , 00459 double *TH2 ); 00460 00461 /* ****************************************************************** 00462 * 00463 * next part deals with FeII bands. There are two types, the tabulated 00464 * band that are defined in bands_Fe2.dat, and the psuedo-continuum bins 00465 * that are generatedby the code in FeIIContCreate. 00466 * nFeIIConBins is number of continuum bins in FeII_Cont 00467 * nFeIIBands is number of bands in bands_Fe2.dat, and are saved in FeII_Bands 00468 * the bands are created by hand and the entries in bands_Fe2.dat are 00469 * meant to be created by a person */ 00470 00471 /* the declarations for the next four are in FeIILevelPops.c */ 00473 extern long int nFeIIBands; 00474 00476 extern long int nFeIIConBins; 00477 00478 /* band wavelength, lower and upper bounds, in vacuum Angstroms */ 00482 extern realnum **FeII_Bands; 00483 00484 /* continuum wavelengths, lower and upper bounds, in vacuum Angstroms 00485 * third is integrated intensity */ 00488 extern realnum **FeII_Cont; 00489 00490 00493 void cdMPI(void); 00523 void cdSPEC( 00524 int Option , 00525 double EnergyLow[] , 00526 long int nEnergy , 00527 double ReturnedSpectrum[] ); 00528 00529 00551 void cdSPEC2( 00552 int Option , 00553 long int nEnergy , 00554 realnum ReturnedSpectrum[] ); 00555 00573 int cdTemp( 00574 const char *chLabel, 00575 long int IonStage, 00576 double *TeMean, 00577 const char *chWeight ); 00578 00583 void cdPrintCommands( FILE * ); 00584 00586 void cdClosePunchFiles( void ); 00587 00601 long int cdH2_Line( 00602 /* indices for the upper level */ 00603 long int iElecHi, 00604 long int iVibHi , 00605 long int iRotHi , 00606 /* indices for lower level */ 00607 long int iElecLo, 00608 long int iVibLo , 00609 long int iRotLo , 00610 /* linear intensity relative to normalization line*/ 00611 double *relint, 00612 /* log of luminosity or intensity of line */ 00613 double *absint ); 00614 00615 /* none of the following are generally needed */ 00616 00620 extern bool lgcdInitCalled; 00621 00622 #ifndef MAX2 00623 /* MAX2 takes two arguments, returns the larger of the two */ 00624 #define MAX2(a,b) (((a)>(b)) ? (a) : (b)) 00625 #endif 00626 /* */ 00627 00628 #ifndef MIN2 00629 /* MIN2 takes two arguments, returns the smaller of the two */ 00630 #define MIN2(a,b) (((a)<(b)) ? (a) : (b)) 00631 #endif 00632 /* */ 00633 00634 00635 #endif /* _CDDRIVE_H_ */