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