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 /*ParseGlobule parse parameters off the globule command */ 00004 #include "cddefines.h" 00005 #include "radius.h" 00006 #include "dense.h" 00007 #include "optimize.h" 00008 #include "input.h" 00009 #include "parse.h" 00010 00011 void ParseGlobule(char *chCard) 00012 { 00013 bool lgEOL; 00014 long int i; 00015 00016 DEBUG_ENTRY( "ParseGlobule()" ); 00017 00018 if( dense.gas_phase[ipHYDROGEN] > 0. ) 00019 { 00020 fprintf( ioQQQ, " PROBLEM DISASTER More than one density command was entered.\n" ); 00021 cdEXIT(EXIT_FAILURE); 00022 } 00023 00024 /* globule with density increasing inward 00025 * parameters are outer density, radius of globule, and density power */ 00026 i = 5; 00027 radius.glbden = (realnum)FFmtRead(chCard,&i,INPUT_LINE_LENGTH,&lgEOL); 00028 radius.glbden = lgEOL ? 1.f : (realnum)pow((realnum)10.f,radius.glbden); 00029 dense.gas_phase[ipHYDROGEN] = radius.glbden; 00030 00031 if( dense.gas_phase[ipHYDROGEN] <= 0. ) 00032 { 00033 fprintf( ioQQQ, " PROBLEM DISASTER Hydrogen density must be > 0.\n" ); 00034 cdEXIT(EXIT_FAILURE); 00035 } 00036 00037 radius.glbrad = (realnum)FFmtRead(chCard,&i,INPUT_LINE_LENGTH,&lgEOL); 00038 if( lgEOL ) 00039 { 00040 radius.glbrad = 3.086e18f; 00041 } 00042 else 00043 { 00044 radius.glbrad = (realnum)pow((realnum)10.f,radius.glbrad); 00045 } 00046 00047 /* this is largest zone thickness, used to set first zone thickness */ 00048 radius.sdrmax = radius.glbrad/25.; 00049 00050 /* turn off min dr checking in NEXTDR */ 00051 radius.lgDrMnOn = false; 00052 radius.glbpow = (realnum)FFmtRead(chCard,&i,INPUT_LINE_LENGTH,&lgEOL); 00053 if( lgEOL ) 00054 radius.glbpow = 1.; 00055 strcpy( dense.chDenseLaw, "GLOB" ); 00056 00057 /* this is distance to globule */ 00058 radius.glbdst = radius.glbrad; 00059 00060 /* vary option */ 00061 if( optimize.lgVarOn ) 00062 { 00063 /* pointer to where to write */ 00064 optimize.nvfpnt[optimize.nparm] = input.nRead; 00065 00066 /* this is the number of parameters to feed onto the input line */ 00067 optimize.nvarxt[optimize.nparm] = 3; 00068 strcpy( optimize.chVarFmt[optimize.nparm], "GLOBULE %f %f %f" ); 00069 00070 /* param is log of abundance by number relative to hydrogen */ 00071 optimize.vparm[0][optimize.nparm] = (realnum)log10(radius.glbden); 00072 optimize.vparm[1][optimize.nparm] = (realnum)log10(radius.glbrad); 00073 optimize.vparm[2][optimize.nparm] = radius.glbpow; 00074 optimize.vincr[optimize.nparm] = 0.2f; 00075 ++optimize.nparm; 00076 } 00077 return; 00078 }