Commit d4772c2c authored by Chichi Lalescu's avatar Chichi Lalescu
Browse files

make complex_particles use new read_parameters

parent 89a5e915
Pipeline #36230 passed with stage
in 14 minutes and 38 seconds
......@@ -148,6 +148,11 @@ class DNS(_code):
self.NSVEp_extra_parameters['tracers0_integration_steps'] = int(4)
self.NSVEp_extra_parameters['tracers0_neighbours'] = int(1)
self.NSVEp_extra_parameters['tracers0_smoothness'] = int(1)
self.NSVEp_extra_parameters['tracers0_enable_p2p'] = int(0)
self.NSVEp_extra_parameters['tracers0_enable_inner'] = int(0)
self.NSVEp_extra_parameters['tracers0_enable_vorticity_omega'] = int(0)
self.NSVEp_extra_parameters['tracers0_cutoff'] = float(1)
self.NSVEp_extra_parameters['tracers0_inner_v0'] = float(1)
#self.extra_parameters = {}
#for key in ['NSVE', 'NSVE_no_output', 'NSVEparticles', 'NSVEparticles_no_output', 'NSVEcomplex_particles']:
# self.extra_parameters[key] = {}
......
......@@ -18,7 +18,6 @@ class NSVE_no_output: public NSVE<rnumber>
{
return 0;
}
int read_parameters(void);
};
#endif//NSVE_NO_OUTPUT_HPP
......
......@@ -184,6 +184,29 @@ int NSVEcomplex_particles<rnumber>::do_stats()
this->ps->getLocalNbParticles(),
this->ps->get_step_idx()-1);
// deallocate temporary data array
// TODO: is it required/safe to call the release method here?
//pdata.release();
return EXIT_SUCCESS;
}
template <typename rnumber>
int NSVEcomplex_particles<rnumber>::read_parameters(void)
{
this->NSVE<rnumber>::read_parameters();
hid_t parameter_file = H5Fopen((this->simname + ".h5").c_str(), H5F_ACC_RDONLY, H5P_DEFAULT);
this->niter_part = hdf5_tools::read_value<int>(parameter_file, "parameters/niter_part");
this->nparticles = hdf5_tools::read_value<int>(parameter_file, "parameters/nparticles");
this->tracers0_integration_steps = hdf5_tools::read_value<int>(parameter_file, "parameters/tracers0_integration_steps");
this->tracers0_neighbours = hdf5_tools::read_value<int>(parameter_file, "parameters/tracers0_neighbours");
this->tracers0_smoothness = hdf5_tools::read_value<int>(parameter_file, "parameters/tracers0_smoothness");
this->enable_p2p = hdf5_tools::read_value<int>(parameter_file, "parameters/tracers0_enable_p2p");
this->enable_inner = hdf5_tools::read_value<int>(parameter_file, "parameters/tracers0_enable_inner");
this->enable_vorticity_omega = hdf5_tools::read_value<int>(parameter_file, "parameters/tracers0_enable_vorticity_omega");
this->cutoff = hdf5_tools::read_value<double>(parameter_file, "parameters/tracers0_cutoff");
this->inner_v0 = hdf5_tools::read_value<double>(parameter_file, "parameters/tracers0_inner_v0");
H5Fclose(parameter_file);
return EXIT_SUCCESS;
}
......
......@@ -18,7 +18,6 @@ class NSVEparticles_no_output: public NSVEparticles<rnumber>
{
return 0;
}
int read_parameters(void);
};
#endif//NSVEPARTICLES_NO_OUTPUT_HPP
......
......@@ -33,41 +33,19 @@ int postprocess::main_loop(void)
int postprocess::read_parameters()
{
hid_t parameter_file;
char fname[256];
sprintf(fname, "%s.h5", this->simname.c_str());
parameter_file = H5Fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT);
this->dealias_type = hdf5_tools::read_value<int>(
parameter_file, "/parameters/dealias_type");
this->dkx = hdf5_tools::read_value<double>(
parameter_file, "/parameters/dkx");
this->dky = hdf5_tools::read_value<double>(
parameter_file, "/parameters/dky");
this->dkz = hdf5_tools::read_value<double>(
parameter_file, "/parameters/dkz");
this->dt = hdf5_tools::read_value<double>(
parameter_file, "/parameters/dt");
this->famplitude = hdf5_tools::read_value<double>(
parameter_file, "/parameters/famplitude");
this->friction_coefficient = hdf5_tools::read_value<double>(
parameter_file, "/parameters/friction_coefficient");
this->fk0 = hdf5_tools::read_value<double>(
parameter_file, "/parameters/fk0");
this->fk1 = hdf5_tools::read_value<double>(
parameter_file, "/parameters/fk1");
this->fmode = hdf5_tools::read_value<int>(
parameter_file, "/parameters/fmode");
sprintf(this->forcing_type, "%s",
hdf5_tools::read_string(parameter_file, "/parameters/forcing_type").c_str());
this->nu = hdf5_tools::read_value<double>(
parameter_file, "/parameters/nu");
this->nx = hdf5_tools::read_value<int>(
parameter_file, "/parameters/nx");
this->ny = hdf5_tools::read_value<int>(
parameter_file, "/parameters/ny");
this->nz = hdf5_tools::read_value<int>(
parameter_file, "/parameters/nz");
this->code_base::read_parameters();
hid_t parameter_file = H5Fopen((this->simname + ".h5").c_str(), H5F_ACC_RDONLY, H5P_DEFAULT);
this->nu = hdf5_tools::read_value<double>(parameter_file, "parameters/nu");
this->dt = hdf5_tools::read_value<double>(parameter_file, "parameters/dt");
this->fmode = hdf5_tools::read_value<int>(parameter_file, "parameters/fmode");
this->famplitude = hdf5_tools::read_value<double>(parameter_file, "parameters/famplitude");
this->friction_coefficient = hdf5_tools::read_value<double>(parameter_file, "parameters/friction_coefficient");
this->fk0 = hdf5_tools::read_value<double>(parameter_file, "parameters/fk0");
this->fk1 = hdf5_tools::read_value<double>(parameter_file, "parameters/fk1");
this->energy = hdf5_tools::read_value<double>(parameter_file, "parameters/energy");
std::string tmp = hdf5_tools::read_string(parameter_file, "parameters/forcing_type");
snprintf(this->forcing_type, 511, "%s", tmp.c_str());
H5Fclose(parameter_file);
return 0;
return EXIT_SUCCESS;
}
......@@ -46,6 +46,7 @@ class postprocess: public code_base
double friction_coefficient;
double fk0;
double fk1;
double energy;
int fmode;
char forcing_type[512];
double nu;
......
......@@ -18,36 +18,3 @@ int test::main_loop(void)
return EXIT_SUCCESS;
}
int test::read_parameters()
{
hid_t parameter_file;
hid_t dset;
char fname[256];
sprintf(fname, "%s.h5", this->simname.c_str());
parameter_file = H5Fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT);
dset = H5Dopen(parameter_file, "/parameters/dealias_type", H5P_DEFAULT);
H5Dread(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &this->dealias_type);
H5Dclose(dset);
dset = H5Dopen(parameter_file, "/parameters/dkx", H5P_DEFAULT);
H5Dread(dset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &this->dkx);
H5Dclose(dset);
dset = H5Dopen(parameter_file, "/parameters/dky", H5P_DEFAULT);
H5Dread(dset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &this->dky);
H5Dclose(dset);
dset = H5Dopen(parameter_file, "/parameters/dkz", H5P_DEFAULT);
H5Dread(dset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &this->dkz);
H5Dclose(dset);
dset = H5Dopen(parameter_file, "/parameters/nx", H5P_DEFAULT);
H5Dread(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &this->nx);
H5Dclose(dset);
dset = H5Dopen(parameter_file, "/parameters/ny", H5P_DEFAULT);
H5Dread(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &this->ny);
H5Dclose(dset);
dset = H5Dopen(parameter_file, "/parameters/nz", H5P_DEFAULT);
H5Dread(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &this->nz);
H5Dclose(dset);
H5Fclose(parameter_file);
return 0;
}
......@@ -56,7 +56,6 @@ class test: public code_base
virtual int finalize(void) = 0;
int main_loop(void);
virtual int read_parameters(void);
};
#endif//TEST_HPP
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment