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 /*ParseExtinguish parse the extinguish command */ 00004 #include "cddefines.h" 00005 #include "rfield.h" 00006 #include "extinc.h" 00007 00008 /*ParseExtinguish parse the extinguish command */ 00009 void ParseExtinguish( char *chCard ) 00010 { 00011 long int i; 00012 bool lgEOL; 00013 /* extinguish ionizing continuum by absorbing column AFTER 00014 * setting luminosity or Q(H). First number is the column 00015 * density (log), second number is leakage (def=0%) 00016 * last number is lowest energy (ryd), last two may be omitted 00017 * from right to left 00018 * 00019 * extinction is actually done in extin, which is called by ContSetIntensity */ 00020 00021 DEBUG_ENTRY( "ParseExtinguish()" ); 00022 00023 i = 5; 00024 extinc.excolm = (realnum)FFmtRead(chCard,&i,INPUT_LINE_LENGTH,&lgEOL); 00025 if( lgEOL ) 00026 NoNumb(chCard); 00027 00028 /* >>chng 01 dec 19, add linear option */ 00029 /* default is for the number to be the log of the column. 00030 * there is a linear option for the column or optical depth, 00031 * if linear does not occur then log, and convert to linear */ 00032 if( !nMatch("LINE" , chCard ) ) 00033 { 00034 /* >>chng 03 jan 02, make comment if first value seems too large */ 00035 if( extinc.excolm>35. ) 00036 { 00037 fprintf(ioQQQ, 00038 " The first parameter on this command line is the log of either the column density or optical depth.\n"); 00039 fprintf(ioQQQ, 00040 " The value seems pretty big to me - please check it.\n"); 00041 /* flush it since we will probably crash */ 00042 fflush(ioQQQ); 00043 } 00044 extinc.excolm = (realnum)pow((realnum)10.f,extinc.excolm); 00045 } 00046 00047 /* option to set leakage - default is 0. */ 00048 extinc.exleak = (realnum)FFmtRead(chCard,&i,INPUT_LINE_LENGTH,&lgEOL); 00049 /* optional leakage is zero */ 00050 if( lgEOL ) 00051 extinc.exleak = 0.; 00052 00053 /* negative leaks are logs */ 00054 if( extinc.exleak < 0. ) 00055 extinc.exleak = (realnum)pow((realnum)10.f,extinc.exleak); 00056 00057 if( extinc.exleak > 1. ) 00058 { 00059 /* but leaks greater than 1 are not allowed */ 00060 fprintf( ioQQQ, " A leakage of%9.0f%% was entered - this must be less than 100%%\n", 00061 extinc.exleak*100. ); 00062 cdEXIT(EXIT_FAILURE); 00063 } 00064 /* user input check that H-ionizing radiation is blocked if 00065 * table Draine used */ 00066 rfield.lgBlockHIon = true; 00067 00068 /* option to set lowest energy for absorber */ 00069 extinc.exlow = (realnum)FFmtRead(chCard,&i,INPUT_LINE_LENGTH,&lgEOL); 00070 if( lgEOL ) 00071 { 00072 extinc.exlow = 0.99946f; 00073 } 00074 00075 else 00076 { 00077 if( extinc.exlow <= 0. ) 00078 extinc.exlow = (realnum)pow((realnum)10.f,extinc.exlow); 00079 if( extinc.exlow < 0.99946 ) 00080 { 00081 fprintf( ioQQQ, " Energy less than 1 Ryd!!\n" ); 00082 } 00083 } 00084 00085 /* >>chng 01 dec 19, add optical depth at 1 Ryd rather than column density */ 00086 if( nMatch("OPTI" , chCard ) ) 00087 { 00088 /* convert the optical depth into the proper column density */ 00089 extinc.excolm /= (realnum)(extinc.cnst_col2optdepth* 00090 pow(extinc.exlow,extinc.cnst_power) ); 00091 } 00092 return; 00093 }