00001 /* This file is part of Cloudy and is copyright (C)1978-2010 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 "parser.h" 00007 00008 /*ParseExtinguish parse the extinguish command */ 00009 void ParseExtinguish( Parser &p ) 00010 { 00011 // extinguish ionizing continuum by absorbing column AFTER 00012 // setting luminosity or intensity. First number is the column 00013 // density (log), second number is leakage (def=0%) 00014 // last number is lowest energy (ryd), last two may be omitted 00015 // from right to left 00016 // 00017 // extinction is actually done in extin, which is called by ContSetIntensity 00018 00019 DEBUG_ENTRY( "ParseExtinguish()" ); 00020 00021 rfield.ExtinguishColumnDensity = (realnum)p.FFmtRead(); 00022 if( p.lgEOL() ) 00023 p.NoNumb("extinguishing column"); 00024 00025 // default is for the number to be the log of the column. 00026 // there is a linear option for the column or optical depth, 00027 // if linear does not occur then log, and convert to linear */ 00028 if( !p.nMatch("LINE" ) ) 00029 { 00030 if( rfield.ExtinguishColumnDensity>35. ) 00031 { 00032 fprintf(ioQQQ, 00033 " The first parameter on this command line is the log of either the column density or optical depth.\n"); 00034 fprintf(ioQQQ, 00035 " The value seems pretty big to me - please check it.\n"); 00036 /* flush it since we will probably crash */ 00037 fflush(ioQQQ); 00038 } 00039 rfield.ExtinguishColumnDensity = (realnum)pow((realnum)10.f,rfield.ExtinguishColumnDensity); 00040 } 00041 00042 /* option to set leakage - default is 0. */ 00043 rfield.ExtinguishLeakage = (realnum)p.FFmtRead(); 00044 if( p.lgEOL() ) 00045 rfield.ExtinguishLeakage = 0.; 00046 00047 /* negative leaks are logs */ 00048 if( rfield.ExtinguishLeakage < 0. ) 00049 rfield.ExtinguishLeakage = (realnum)pow((realnum)10.f,rfield.ExtinguishLeakage); 00050 00051 if( rfield.ExtinguishLeakage > 1. ) 00052 { 00053 /* but leaks greater than 1 are not allowed */ 00054 fprintf( ioQQQ, " A leakage of%9.0f%% was entered - this must be less than 100%%\n", 00055 rfield.ExtinguishLeakage*100. ); 00056 cdEXIT(EXIT_FAILURE); 00057 } 00058 // user input check that H-ionizing radiation is blocked if 00059 // table Draine used */ 00060 rfield.lgBlockHIon = true; 00061 00062 /* option to set lowest energy for absorber */ 00063 rfield.ExtinguishLowEnergyLimit = (realnum)p.FFmtRead(); 00064 if( p.lgEOL() ) 00065 rfield.ExtinguishLowEnergyLimit = 0.99946f; 00066 else 00067 { 00068 if( rfield.ExtinguishLowEnergyLimit <= 0. ) 00069 rfield.ExtinguishLowEnergyLimit = (realnum)pow((realnum)10.f,rfield.ExtinguishLowEnergyLimit); 00070 if( rfield.ExtinguishLowEnergyLimit < 0.99946 ) 00071 fprintf( ioQQQ, " Energy less than 1 Ryd!!\n" ); 00072 } 00073 00074 /* specify optical depth at 1 Ryd rather than column density */ 00075 if( p.nMatch("OPTI" ) ) 00076 { 00077 /* convert the optical depth into the proper column density */ 00078 rfield.ExtinguishColumnDensity /= (realnum)(rfield.ExtinguishConvertColDen2OptDepth* 00079 pow(rfield.ExtinguishLowEnergyLimit,rfield.ExtinguishEnergyPowerLow) ); 00080 } 00081 00082 return; 00083 }