Use redshift for computing the scale factor

This commit is contained in:
Guilhem Lavaux 2011-06-06 11:20:03 -04:00
parent 1135be3bab
commit 0fbf6789f1
3 changed files with 13 additions and 7 deletions

View File

@ -159,6 +159,9 @@ void h5_read_runtime_parameters
if (strncmp(real_runtime_parameter_names[i],"omegaradiation", 11) == 0 ) { if (strncmp(real_runtime_parameter_names[i],"omegaradiation", 11) == 0 ) {
omegarad = real_runtime_parameter_values[i]; omegarad = real_runtime_parameter_values[i];
} }
if (strncmp(real_runtime_parameter_names[i],"cosmologicalconstant", 20) == 0 ) {
*omegalambda = real_runtime_parameter_values[i];
}
} }
for (i = 0; i < nint_runtime_parameters; i++) { for (i = 0; i < nint_runtime_parameters; i++) {
@ -168,8 +171,6 @@ void h5_read_runtime_parameters
} }
} }
*omegalambda = 1-(*omegam)-omegarad;
} }
@ -376,7 +377,8 @@ void h5_read_flash3_particles (H5File* file,
/*xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ /*xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
void h5_read_flash3_header_info(H5File* file, void h5_read_flash3_header_info(H5File* file,
double* time) /* simulation time */ double* time, /* simulation time */
double* redshift) /* redshift of checkpoint */
{ {
herr_t status; herr_t status;
@ -447,6 +449,9 @@ void h5_read_flash3_header_info(H5File* file,
if (strncmp(real_names[i],"time",4) == 0 ) { if (strncmp(real_names[i],"time",4) == 0 ) {
*time = real_values[i]; *time = real_values[i];
} }
if (strncmp(real_names[i],"redshift",8) == 0 ) {
*redshift = real_values[i];
}
} }
free(real_list); free(real_list);

View File

@ -32,4 +32,5 @@ void h5_read_flash3_particles (H5File* file,
int id[]); int id[]);
void h5_read_flash3_header_info(H5File* file, void h5_read_flash3_header_info(H5File* file,
double* time); /* simulation time */ double* time, /* simulation time */
double *redshift); /* simulation redshift */

View File

@ -20,7 +20,7 @@ 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, hubble, omegam, omegalambda; double lbox, time, hubble, omegam, omegalambda, redshift;
int npart; int npart;
const double kpc2cm = 3.08568025e21; const double kpc2cm = 3.08568025e21;
@ -40,8 +40,8 @@ SimuData *CosmoTool::loadFlashMulti(const char *fname, int id, int loadflags)
H5File file (filename, H5F_ACC_RDONLY); H5File file (filename, H5F_ACC_RDONLY);
// simulation info // simulation info
h5_read_flash3_header_info(&file, &time); h5_read_flash3_header_info(&file, &time, &redshift);
data->time = time; data->time = 1/(1+redshift);
h5_read_runtime_parameters(&file, &lbox, &npart, &hubble, &omegam, &omegalambda); h5_read_runtime_parameters(&file, &lbox, &npart, &hubble, &omegam, &omegalambda);
data->TotalNumPart = data->NumPart = npart; data->TotalNumPart = data->NumPart = npart;