More cosmological parameters
This commit is contained in:
parent
42c6f11034
commit
b5b44fdead
@ -23,8 +23,11 @@ int ipvz_out = 5;
|
||||
|
||||
void h5_read_runtime_parameters
|
||||
(H5File* file, /* file handle */
|
||||
double* LBox, // box size
|
||||
int* numPart) // number of particles
|
||||
double* LBox, // box size
|
||||
int* numPart,
|
||||
double *hubble,
|
||||
double *omegam,
|
||||
double *omegalambda) // number of particles
|
||||
{
|
||||
|
||||
int MAX_PARM = 200;
|
||||
@ -47,6 +50,8 @@ void h5_read_runtime_parameters
|
||||
str_runtime_params_t *str_rt_parms;
|
||||
log_runtime_params_t *log_rt_parms;
|
||||
|
||||
double omegarad;
|
||||
|
||||
int i;
|
||||
|
||||
nint_runtime_parameters = MAX_PARM;
|
||||
@ -141,18 +146,30 @@ void h5_read_runtime_parameters
|
||||
/* done with reals */
|
||||
|
||||
// grab the data we want
|
||||
for (i = 0; i < nreal_runtime_parameters; i++) {
|
||||
for (i = 0; i < nreal_runtime_parameters; i++) {
|
||||
if (strncmp(real_runtime_parameter_names[i],"xmax",4) == 0 ) {
|
||||
*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++) {
|
||||
if (strncmp(int_runtime_parameter_names[i],"pt_numx",7) == 0 ) {
|
||||
*numPart = int_runtime_parameter_values[i];
|
||||
*numPart = *numPart * *numPart * *numPart;
|
||||
}
|
||||
}
|
||||
|
||||
*omegalambda = 1-(*omegam)-omegarad;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -14,7 +14,10 @@ using namespace H5;
|
||||
void h5_read_runtime_parameters
|
||||
(H5File* file, /* file handle */
|
||||
double* LBox,
|
||||
int* numPart);
|
||||
int* numPart,
|
||||
double* hubble,
|
||||
double* omegam,
|
||||
double* omegalambda);
|
||||
|
||||
void h5_read_flash3_particles (H5File* file,
|
||||
int* totalparticles,
|
||||
|
@ -20,11 +20,12 @@ SimuData *CosmoTool::loadFlashMulti(const char *fname, int id, int loadflags)
|
||||
H5File *fileID;
|
||||
H5std_string filename;
|
||||
//char filename[81];
|
||||
double lbox, time;
|
||||
double lbox, time, hubble, omegam, omegalambda;
|
||||
int npart;
|
||||
|
||||
const double kpc2cm = 3.08568025e21;
|
||||
const double km2cm = 1.e5;
|
||||
const double hubble2cm = 3.240779270005e-18;
|
||||
|
||||
if (id != 0)
|
||||
throw NoSuchFileException();
|
||||
@ -42,9 +43,12 @@ SimuData *CosmoTool::loadFlashMulti(const char *fname, int id, int loadflags)
|
||||
h5_read_flash3_header_info(&file, &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->BoxSize = lbox/kpc2cm;
|
||||
data->Hubble = hubble/hubble2cm;
|
||||
data->Omega_M = omegam;
|
||||
data->Omega_Lambda = omegalambda;
|
||||
|
||||
// particle data
|
||||
for (int i = 0; i < 3; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user