/home66/gary/public_html/cloudy/c08_branch/source/init_sim_postparse.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 /*InitSimPostparse initialization at start of simulation, called from cloudy
00004 * after parser, will be called one time per sim in grid */
00005 #include "cddefines.h" 
00006 #include "dense.h"
00007 #include "elementnames.h"
00008 #include "physconst.h"
00009 #include "mole.h"
00010 #include "trace.h"
00011 #include "radius.h"
00012 #include "thermal.h"
00013 #include "heavy.h"
00014 #include "wind.h"
00015 #include "init.h" 
00016 #include "iso.h"
00017 
00018 /*InitSimPostparse initialization after parser, called one time per sim in 
00019  * grid, sets initial or zeros values before start of sim */
00020 void InitSimPostparse( void )
00021 {
00022         DEBUG_ENTRY( "InitSimPostparse()" );
00023         /* init vars after parsing commands for each sim */
00024 
00025         thermal.thist = 0.;
00026         thermal.tlowst = 1e20f;
00027         thermal.nUnstable = 0;
00028         thermal.lgUnstable = false;
00029 
00030         CO_Init();
00031         CO_zero();
00032 
00033         /* >> chng 06 Nov 24 rjrw: Move reaction definitions here so they can be controlled by parsed commands */
00034         CO_create_react();
00035 
00036         /* zero out diffuse Lya emission */
00037         for( long nelem=ipHYDROGEN; nelem<LIMELM; ++nelem )
00038                 for( long ion=0; ion<=nelem; ++ion )
00039                         Heavy.xLyaHeavy[nelem][ion] = 0;
00040 
00041         /* this term applies centrifugal acceleration if DISK option on wind command */
00042         wind.DiskRadius = 0;
00043         if( wind.lgDisk )
00044                 wind.DiskRadius = radius.Radius;
00045 
00046         /* usually computed in pressure_change, but not called before first zone */
00047         wind.AccelGravity = (realnum)(GRAV_CONST*wind.comass*SOLAR_MASS/POW2(radius.Radius)*
00048                 (1.-wind.DiskRadius/radius.Radius) );
00049         if( trace.lgTrace && trace.lgWind )
00050         {
00051                 fprintf(ioQQQ," InitSimPostparse sets AccelGravity %.3e lgDisk?%c\n",
00052                         wind.AccelGravity , 
00053                         TorF(wind.lgDisk) );
00054         }
00055 
00056         /* update iso sequence level information */
00057         for( long ipISO=ipH_LIKE; ipISO<NISO; ++ipISO )
00058         {
00059                 for( long nelem=ipISO; nelem < LIMELM; ++nelem )
00060                 {
00061                         /* these elements that are turned off */
00062                         if( nelem>ipHELIUM && !dense.lgElmtOn[nelem] )
00063                         {
00064                                 iso.numLevels_max[ipISO][nelem] = 0;
00065                                 iso.nCollapsed_max[ipISO][nelem] = 0;
00066                                 iso.n_HighestResolved_max[ipISO][nelem] = 0;
00067 
00068                                 iso.numLevels_local[ipISO][nelem] = 0;
00069                                 iso.nCollapsed_local[ipISO][nelem] = 0;
00070                                 iso.n_HighestResolved_local[ipISO][nelem] = 0;
00071                         }
00072                         else
00073                         {
00074                                 iso_update_num_levels( ipISO, nelem );
00075                                 /* must always have at least one collapsed level, unless compiling recomb data file. */
00076                                 ASSERT( iso.nCollapsed_max[ipISO][nelem] > 0 || iso.lgCompileRecomb[ipISO] );
00077                         }
00078                 }
00079         }
00080 
00081         if( iso.lgPrintNumberOfLevels )
00082         {
00083                 fprintf(ioQQQ,"\n\n Number of levels in ions treated by iso sequences.\n");
00084                 fprintf(ioQQQ," ISO   Element  hi-n(l-resolved) #(l-resolved)  n(collapsed)\n");
00085                 /* option to print number of levels for each element */
00086                 for( long ipISO=ipH_LIKE; ipISO<NISO; ++ipISO )
00087                 {
00088                         for( long nelem=ipISO; nelem<LIMELM; ++nelem )
00089                         {
00090                                 /* print number of levels */
00091                                 fprintf(ioQQQ," %s  %s    %4li            %4li           %4li \n",
00092                                         iso.chISO[ipISO] ,
00093                                         elementnames.chElementSym[nelem],
00094                                         iso.n_HighestResolved_max[ipISO][nelem],
00095                                         iso.numLevels_max[ipISO][nelem]-iso.nCollapsed_max[ipISO][nelem],
00096                                         iso.nCollapsed_max[ipISO][nelem]);
00097                         }
00098                 }
00099         }
00100 
00101         return;
00102 }

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