00001
00002
00003
00004
00005
00006
00007 #include "cddefines.h"
00008 #include "optimize.h"
00009 #include "parse.h"
00010 #include "struc.h"
00011 #include "input.h"
00012 #include "dense.h"
00013 #include "hcmap.h"
00014 #include "h2.h"
00015 #include "version.h"
00016 #include "h2.h"
00017 #include "hextra.h"
00018 #include "heavy.h"
00019 #include "grid.h"
00020 #include "ionbal.h"
00021 #include "iso.h"
00022 #include "taulines.h"
00023 #include "cosmology.h"
00024 #include "physconst.h"
00025 #include "broke.h"
00026 #include "rfield.h"
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 void InitCoreload( void )
00043 {
00044 static int nCalled=0;
00045 long int nelem;
00046
00047 DEBUG_ENTRY( "InitCoreload()" );
00048
00049
00050 if( nCalled )
00051 return;
00052
00053 ++nCalled;
00054
00055 rfield.lgMeshSetUp = false;
00056
00057 hcmap.lgMapOK = true;
00058 hcmap.lgMapDone = false;
00059
00060
00061 # ifdef _WIN32
00062 strcpy( input.chDelimiter, "\\" );
00063 # else
00064 strcpy( input.chDelimiter, "/" );
00065 # endif
00066
00067
00068 hcmap.nMapAlloc = 0;
00069 hcmap.nmap = 0;
00070 hcmap.lgMapBeingDone = false;
00071
00072
00073 strncpy( chOptimFileName , "optimal.in" , sizeof( chOptimFileName ) );
00074
00075
00076 long int nCom[LIMELM] =
00077 {
00078 1 , 2 ,
00079 1 , 2 ,
00080 1 , 2 , 3 , 4 , 5 , 6 ,
00081 1 , 2 ,
00082 1 , 2 , 3 , 4 , 5 , 6 ,
00083 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ,
00084 1 , 2 ,
00085 1 , 2
00086 };
00087
00088 for( nelem=ipHYDROGEN; nelem<LIMELM; ++nelem )
00089 {
00090 ionbal.nCompRecoilElec[nelem] = nCom[nelem];
00091 }
00092
00093
00094 strcpy( Heavy.chShell[0], "1s" );
00095 strcpy( Heavy.chShell[1], "2s" );
00096 strcpy( Heavy.chShell[2], "2p" );
00097 strcpy( Heavy.chShell[3], "3s" );
00098 strcpy( Heavy.chShell[4], "3p" );
00099 strcpy( Heavy.chShell[5], "3d" );
00100 strcpy( Heavy.chShell[6], "4s" );
00101
00102
00103
00104 for( nelem=ipHYDROGEN; nelem < LIMELM; ++nelem )
00105 {
00106 iso_sp[ipH_LIKE][nelem].n_HighestResolved_max = 5;
00107 iso_sp[ipH_LIKE][nelem].nCollapsed_max = 2;
00108 }
00109
00110 iso_sp[ipH_LIKE][ipHYDROGEN].n_HighestResolved_max = 10;
00111 iso_sp[ipH_LIKE][ipHELIUM].n_HighestResolved_max = 10;
00112
00113 iso_sp[ipH_LIKE][ipHYDROGEN].nCollapsed_max = 15;
00114 iso_sp[ipH_LIKE][ipHELIUM].nCollapsed_max = 15;
00115
00116
00117
00118 iso_sp[ipHE_LIKE][ipHYDROGEN].n_HighestResolved_max = -LONG_MAX;
00119 iso_sp[ipHE_LIKE][ipHYDROGEN].numLevels_max = -LONG_MAX;
00120 iso_sp[ipHE_LIKE][ipHYDROGEN].nCollapsed_max = -LONG_MAX;
00121
00122 for( nelem=ipHELIUM; nelem < LIMELM; ++nelem )
00123 {
00124
00125 iso_sp[ipHE_LIKE][nelem].n_HighestResolved_max = 3;
00126 iso_sp[ipHE_LIKE][nelem].nCollapsed_max = 1;
00127 }
00128
00129 iso_sp[ipHE_LIKE][ipHELIUM].n_HighestResolved_max = 6;
00130 iso_sp[ipHE_LIKE][ipHELIUM].nCollapsed_max = 20;
00131
00132
00133 iso_sp[ipHE_LIKE][ipCARBON].n_HighestResolved_max = 5;
00134 iso_sp[ipHE_LIKE][ipNITROGEN].n_HighestResolved_max = 5;
00135 iso_sp[ipHE_LIKE][ipOXYGEN].n_HighestResolved_max = 5;
00136 iso_sp[ipHE_LIKE][ipNEON].n_HighestResolved_max = 5;
00137 iso_sp[ipHE_LIKE][ipSILICON].n_HighestResolved_max = 5;
00138 iso_sp[ipHE_LIKE][ipMAGNESIUM].n_HighestResolved_max = 5;
00139 iso_sp[ipHE_LIKE][ipSULPHUR].n_HighestResolved_max = 5;
00140 iso_sp[ipHE_LIKE][ipIRON].n_HighestResolved_max = 5;
00141
00142 iso_sp[ipHE_LIKE][LIMELM-1].n_HighestResolved_max = 5;
00143
00144 iso_ctrl.chISO[ipH_LIKE] = "H-like ";
00145 iso_ctrl.chISO[ipHE_LIKE] = "He-like";
00146
00147 max_num_levels = 0;
00148 for( long ipISO = ipH_LIKE; ipISO < NISO; ipISO++ )
00149 {
00150 for( nelem=ipISO; nelem < LIMELM; nelem++ )
00151 {
00152
00153
00154 iso_sp[ipISO][nelem].numLevels_malloc = LONG_MAX;
00155 iso_update_num_levels( ipISO, nelem );
00156 }
00157 }
00158
00159 lgStatesAdded = false;
00160 lgLinesAdded = false;
00161
00162
00163
00164 for( nelem=0; nelem < LIMELM; nelem++ )
00165 {
00166
00167 dense.lgElmtOn[nelem] = true;
00168
00169
00170
00171 dense.lgSetIoniz[nelem] = false;
00172
00173
00174 for( int ion=0; ion<=nelem+1; ++ion )
00175 {
00176 dense.lgIonChiantiOn[nelem][ion] = false;
00177 dense.lgIonStoutOn[nelem][ion] = false;
00178 dense.maxWN[nelem][ion] = 0.;
00179 }
00180 }
00181
00182
00183 dense.density_low_limit = SMALLFLOAT * 1e3;
00184 dense.density_low_limit = MAX2( dense.density_low_limit, 1e-50 );
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210 hextra.background_density = 2.15e-9f*7.9f;
00211 hextra.background_rate = 2.5e-17f*7.9f;
00212
00213
00214
00215
00216 grid.lgGridDone = false;
00217 grid.lgStrictRepeat = false;
00218
00219
00220 grid.LoEnergy_keV = 0.;
00221 grid.HiEnergy_keV = 0.;
00222 grid.ipLoEnergy = 0;
00223 grid.ipHiEnergy = 0;
00224 grid.seqNum = 0;
00225
00226 for( long i=0; i < LIMPAR; ++i )
00227 optimize.lgOptimizeAsLinear[i] = false;
00228
00229
00230 struc.dr_ionfrac_limit = 1e-3f;
00231
00232 SaveFilesInit();
00233
00234 diatoms_init();
00235
00236
00237 cosmology.redshift_current = 0.f;
00238 cosmology.redshift_start = 0.f;
00239 cosmology.redshift_step = 0.f;
00240 cosmology.omega_baryon = 0.04592f;
00241 cosmology.omega_rad = 8.23e-5f;
00242 cosmology.omega_lambda = 0.7299177f;
00243 cosmology.omega_matter = 0.27f;
00244 cosmology.omega_k = 0.f;
00245
00246 cosmology.h = 0.71f;
00247
00248 cosmology.H_0 = 100.f*cosmology.h;
00249 cosmology.lgDo = false;
00250
00251
00252
00253 broke.lgBroke = false;
00254 broke.lgFixit = false;
00255 broke.lgCheckit = false;
00256
00257 return;
00258 }