00001
00002
00003
00004
00005
00006
00007 #include "cddefines.h"
00008 #include "dense.h"
00009 #include "struc.h"
00010 #include "rfield.h"
00011 #include "elementnames.h"
00012 #include "atoms.h"
00013 #include "physconst.h"
00014 #include "iterations.h"
00015 #include "pressure.h"
00016 #include "mole.h"
00017 #include "trace.h"
00018 #include "radius.h"
00019 #include "thermal.h"
00020 #include "heavy.h"
00021 #include "wind.h"
00022 #include "init.h"
00023 #include "iso.h"
00024
00025
00026
00027
00028
00029 void InitSimPostparse( void )
00030 {
00031 DEBUG_ENTRY( "InitSimPostparse()" );
00032
00033 struc.nzonePreviousIteration = -1;
00034
00035 thermal.thist = 0.;
00036 thermal.tlowst = 1e20f;
00037 thermal.nUnstable = 0;
00038 thermal.lgUnstable = false;
00039
00040 CO_Init();
00041 CO_zero();
00042
00043
00044 CO_create_react();
00045
00046
00047 for( long nelem=ipHYDROGEN; nelem<LIMELM; ++nelem )
00048 for( long ion=0; ion<=nelem; ++ion )
00049 Heavy.xLyaHeavy[nelem][ion] = 0;
00050
00051
00052 if( radius.StopRadius[0] > 0. )
00053 {
00054 for( long j=0; j < iterations.iter_malloc; j++ )
00055 {
00056 if( radius.StopRadius[j] > radius.Radius )
00057 radius.StopThickness[j] = radius.StopRadius[j] - radius.Radius;
00058 else
00059 {
00060 fprintf( ioQQQ, " PROBLEM stopping radius is <= inner radius. Bailing out.\n" );
00061 cdEXIT(EXIT_FAILURE);
00062 }
00063 }
00064 }
00065
00066
00067 wind.DiskRadius = 0;
00068 if( wind.lgDisk )
00069 wind.DiskRadius = radius.Radius;
00070
00071 iterations.lgLastIt = false;
00072
00073 rfield_opac_zero( 0 , rfield.nupper );
00074
00075 rfield.lgUSphON = false;
00076
00077
00078 rfield.ipEnergyBremsThin = 0;
00079 rfield.EnergyBremsThin = 0.;
00080 rfield.comtot = 0.;
00081 rfield.comoff = 1.;
00082 rfield.cmcool = 0.;
00083 rfield.cinrat = 0.;
00084 rfield.extin_mag_B_point = 0.;
00085 rfield.extin_mag_V_point = 0.;
00086 rfield.extin_mag_B_extended = 0.;
00087 rfield.extin_mag_V_extended = 0.;
00088 rfield.EnerGammaRay = 7676.;
00089
00090
00091 wind.AccelGravity = (realnum)(GRAV_CONST*wind.comass*SOLAR_MASS/POW2(radius.Radius)*
00092 (1.-wind.DiskRadius/radius.Radius) );
00093 if( trace.lgTrace && trace.lgWind )
00094 {
00095 fprintf(ioQQQ," InitSimPostparse sets AccelGravity %.3e lgDisk?%c\n",
00096 wind.AccelGravity ,
00097 TorF(wind.lgDisk) );
00098 }
00099
00100
00101 pressure.PresInteg = 0.;
00102 pressure.PresIntegElecThin = 0.;
00103 pressure.pinzon = 0.;
00104
00105
00106 for( long ipISO=ipH_LIKE; ipISO<NISO; ++ipISO )
00107 {
00108 for( long nelem=ipISO; nelem < LIMELM; ++nelem )
00109 {
00110
00111 if( nelem>ipHELIUM && !dense.lgElmtOn[nelem] )
00112 {
00113 iso.numLevels_max[ipISO][nelem] = 0;
00114 iso.nCollapsed_max[ipISO][nelem] = 0;
00115 iso.n_HighestResolved_max[ipISO][nelem] = 0;
00116
00117 iso.numLevels_local[ipISO][nelem] = 0;
00118 iso.nCollapsed_local[ipISO][nelem] = 0;
00119 iso.n_HighestResolved_local[ipISO][nelem] = 0;
00120 }
00121 else
00122 {
00123 iso_update_num_levels( ipISO, nelem );
00124
00125 ASSERT( iso.nCollapsed_max[ipISO][nelem] > 0 || iso.lgCompileRecomb[ipISO] );
00126 }
00127 }
00128 }
00129
00130 if( iso.lgPrintNumberOfLevels )
00131 {
00132 fprintf(ioQQQ,"\n\n Number of levels in ions treated by iso sequences.\n");
00133 fprintf(ioQQQ," ISO Element hi-n(l-resolved) #(l-resolved) n(collapsed)\n");
00134
00135 for( long ipISO=ipH_LIKE; ipISO<NISO; ++ipISO )
00136 {
00137 for( long nelem=ipISO; nelem<LIMELM; ++nelem )
00138 {
00139
00140 fprintf(ioQQQ," %s %s %4li %4li %4li \n",
00141 iso.chISO[ipISO] ,
00142 elementnames.chElementSym[nelem],
00143 iso.n_HighestResolved_max[ipISO][nelem],
00144 iso.numLevels_max[ipISO][nelem]-iso.nCollapsed_max[ipISO][nelem],
00145 iso.nCollapsed_max[ipISO][nelem]);
00146 }
00147 }
00148 }
00149 atoms.p2nit = 0.;
00150 atoms.d5200r = 0.;
00151
00152 return;
00153 }