/home66/gary/public_html/cloudy/c08_branch/source/parse_coronal.cpp

Go to the documentation of this file.
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 /*ParseCoronal parse parameters off coronal equilibrium command */
00004 #include "cddefines.h"
00005 #include "rfield.h"
00006 #include "thermal.h"
00007 #include "input.h"
00008 #include "optimize.h"
00009 #include "phycon.h"
00010 #include "radius.h"
00011 #include "dynamics.h"
00012 #include "parse.h"
00013 
00014 /*ParseCoronal parse parameters off coronal equilibrium command */
00015 void ParseCoronal(char *chCard,
00016   long int *nqh, 
00017   realnum *ar1)
00018 {
00019         bool lgEOL;
00020         long int i;
00021         double a;
00022 
00023         DEBUG_ENTRY( "ParseCoronal()" );
00024 
00025         if( nMatch( "INIT" , chCard ) && nMatch( "TIME" , chCard ) )
00026         {
00027                 dynamics.lg_coronal_time_init = true;
00028         }
00029 
00030         /* coronal equilibrium; set constant temperature to number on line */
00031         thermal.lgTemperatureConstant = true;
00032         thermal.lgTemperatureConstantCommandParsed = true;
00033         i = 5;
00034         a = FFmtRead(chCard,&i,INPUT_LINE_LENGTH,&lgEOL);
00035         if( lgEOL )
00036         {
00037                 fprintf( ioQQQ, " There should be a temperature on this line.\n" );
00038                 cdEXIT(EXIT_FAILURE);
00039         }
00040 
00041         /* numbers less than or equal to 10 are the log of the temperature */
00042         if( a <= 10. && !nMatch("LINE",chCard) )
00043         {
00044                 thermal.ConstTemp = (realnum)pow(10.,a);
00045         }
00046         else
00047         {
00048                 thermal.ConstTemp = (realnum)a;
00049         }
00050 
00051         /* insure not below lowest allowed temperature for the code */
00052         if( thermal.ConstTemp < phycon.TEMP_LIMIT_LOW )
00053         {
00054                 fprintf( ioQQQ, " temperature on coronal command cannot be below %.3f, reset to 3K.\n",
00055                         phycon.TEMP_LIMIT_LOW);
00056                 thermal.ConstTemp = 3.;
00057         }
00058         else if( thermal.ConstTemp > phycon.TEMP_LIMIT_HIGH )
00059         {
00060                 fprintf( ioQQQ, " temperature on coronal command cannot be above %.3f, reset to 3e9K.\n",
00061                         phycon.TEMP_LIMIT_HIGH);
00062                 thermal.ConstTemp = 3e9;
00063         }
00064 
00065         /* now simulate a BREMS line */
00066         strcpy( rfield.chSpType[rfield.nspec], "BREMS" );
00067         rfield.slope[rfield.nspec] = 1e8;
00068         rfield.cutoff[rfield.nspec][0] = 0.;
00069         rfield.cutoff[rfield.nspec][1] = 0.;
00070 
00071         /* simulate an ionization parameter line */
00072         strcpy( rfield.chRSpec[*nqh], "SQCM" );
00073         strcpy( rfield.chSpNorm[*nqh], "IONI" );
00074 
00075         /* >>chng 96 jun 17, to stop mole network from crashing */
00076         /* >>chng 05 aug 15, this sets ionization parameter, in test case ism_hot_brems the
00077          * value of 1e-10 was enough to dominate the ionization of he-like N - it's ionization
00078          * then jumped due to large optical depth in the continuum - change U from -10 to -15 */
00079         /* >>chng 05 aug 16, this very strongly affected the coll_t4 sim - apparently there
00080          * was a significant photoionization contribution from the -10 continuum,
00081          * this was close to a 'no photoionization' case, but lower further to insure
00082          * no photo contribution 
00083          * chang from -15 to -20 */
00084         rfield.totpow[*nqh] = -20.f;
00085 
00086         /* set R to large value if U specified but R is not */
00087         /* set radius to very large value if not already set */
00088         /* >>chng 01 jul 24, from Radius == 0 to this, as per PvH comments */
00089         if( !radius.lgRadiusKnown )
00090         {
00091                 *ar1 = (realnum)radius.rdfalt;
00092                 radius.Radius = pow(10.,radius.rdfalt);
00093         }
00094 
00095         ++rfield.nspec;
00096         if( rfield.nspec >= LIMSPC )
00097         {
00098                 /* too many continua were entered */
00099                 fprintf( ioQQQ, " Too many continua entered; increase LIMSPC\n" );
00100                 cdEXIT(EXIT_FAILURE);
00101         }
00102         ++*nqh;
00103         if( *nqh >= LIMSPC )
00104         {
00105                 /* too many continua were entered */
00106                 fprintf( ioQQQ, " Too many continua entered; increase LIMSPC\n" );
00107                 cdEXIT(EXIT_FAILURE);
00108         }
00109 
00110         /* vary option */
00111         if( optimize.lgVarOn )
00112         {
00113                 /*  no luminosity options on vary */
00114                 optimize.nvarxt[optimize.nparm] = 1;
00115                 strcpy( optimize.chVarFmt[optimize.nparm], "COROnal equilibrium %f" );
00116 
00117                 /*  pointer to where to write */
00118                 optimize.nvfpnt[optimize.nparm] = input.nRead;
00119 
00120                 /*  log of temp will be pointer */
00121                 optimize.vparm[0][optimize.nparm] = (realnum)log10(phycon.te);
00122                 optimize.vincr[optimize.nparm] = 0.1f;
00123                 ++optimize.nparm;
00124         }
00125         return;
00126 }

Generated on Mon Feb 16 12:01:25 2009 for cloudy by  doxygen 1.4.7