More cosmological parameters

This commit is contained in:
Guilhem Lavaux 2011-06-06 10:58:55 -04:00
parent 42c6f11034
commit b5b44fdead
3 changed files with 32 additions and 8 deletions

View File

@ -24,7 +24,10 @@ int ipvz_out = 5;
void h5_read_runtime_parameters void h5_read_runtime_parameters
(H5File* file, /* file handle */ (H5File* file, /* file handle */
double* LBox, // box size double* LBox, // box size
int* numPart) // number of particles int* numPart,
double *hubble,
double *omegam,
double *omegalambda) // number of particles
{ {
int MAX_PARM = 200; int MAX_PARM = 200;
@ -47,6 +50,8 @@ void h5_read_runtime_parameters
str_runtime_params_t *str_rt_parms; str_runtime_params_t *str_rt_parms;
log_runtime_params_t *log_rt_parms; log_runtime_params_t *log_rt_parms;
double omegarad;
int i; int i;
nint_runtime_parameters = MAX_PARM; nint_runtime_parameters = MAX_PARM;
@ -145,6 +150,15 @@ void h5_read_runtime_parameters
if (strncmp(real_runtime_parameter_names[i],"xmax",4) == 0 ) { if (strncmp(real_runtime_parameter_names[i],"xmax",4) == 0 ) {
*LBox = real_runtime_parameter_values[i]; *LBox = real_runtime_parameter_values[i];
} }
if (strncmp(int_runtime_parameter_names[i],"hubbleconstant", 14) == 0 ) {
*hubble = real_runtime_parameter_values[i];
}
if (strncmp(int_runtime_parameter_names[i],"omegamatter", 11) == 0 ) {
*omegam = real_runtime_parameter_values[i];
}
if (strncmp(int_runtime_parameter_names[i],"omegaradiation", 11) == 0 ) {
omegarad = real_runtime_parameter_values[i];
}
} }
for (i = 0; i < nint_runtime_parameters; i++) { for (i = 0; i < nint_runtime_parameters; i++) {
@ -153,6 +167,9 @@ void h5_read_runtime_parameters
*numPart = *numPart * *numPart * *numPart; *numPart = *numPart * *numPart * *numPart;
} }
} }
*omegalambda = 1-(*omegam)-omegarad;
} }

View File

@ -14,7 +14,10 @@ using namespace H5;
void h5_read_runtime_parameters void h5_read_runtime_parameters
(H5File* file, /* file handle */ (H5File* file, /* file handle */
double* LBox, double* LBox,
int* numPart); int* numPart,
double* hubble,
double* omegam,
double* omegalambda);
void h5_read_flash3_particles (H5File* file, void h5_read_flash3_particles (H5File* file,
int* totalparticles, int* totalparticles,

View File

@ -20,11 +20,12 @@ SimuData *CosmoTool::loadFlashMulti(const char *fname, int id, int loadflags)
H5File *fileID; H5File *fileID;
H5std_string filename; H5std_string filename;
//char filename[81]; //char filename[81];
double lbox, time; double lbox, time, hubble, omegam, omegalambda;
int npart; int npart;
const double kpc2cm = 3.08568025e21; const double kpc2cm = 3.08568025e21;
const double km2cm = 1.e5; const double km2cm = 1.e5;
const double hubble2cm = 3.240779270005e-18;
if (id != 0) if (id != 0)
throw NoSuchFileException(); throw NoSuchFileException();
@ -42,9 +43,12 @@ SimuData *CosmoTool::loadFlashMulti(const char *fname, int id, int loadflags)
h5_read_flash3_header_info(&file, &time); h5_read_flash3_header_info(&file, &time);
data->time = time; data->time = time;
h5_read_runtime_parameters(&file, &lbox, &npart); h5_read_runtime_parameters(&file, &lbox, &npart, &hubble, &omegam, &omegalambda);
data->TotalNumPart = data->NumPart = npart; data->TotalNumPart = data->NumPart = npart;
data->BoxSize = lbox/kpc2cm; data->BoxSize = lbox/kpc2cm;
data->Hubble = hubble/hubble2cm;
data->Omega_M = omegam;
data->Omega_Lambda = omegalambda;
// particle data // particle data
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {