Commit 9d489684 authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

bugfix/particle file creation

particle file no longer gets generated if nparticles is 0. I'm not sure
I like the current solution, but it's better than nothing
parent 8f51d992
......@@ -374,17 +374,20 @@ class NavierStokes(_fluid_particle_base):
H5Tinsert(H5T_field_complex, "r", HOFFSET(tmp_complex_type, re), {2});
H5Tinsert(H5T_field_complex, "i", HOFFSET(tmp_complex_type, im), {2});
}}
//endcpp
""".format(self.C_dtype, self.fftw_plan_rigor, field_H5T)
if self.parameters['nparticles'] > 0:
self.fluid_start += """
if (myrank == 0)
{{
{
// set caching parameters
hid_t fapl = H5Pcreate(H5P_FILE_ACCESS);
herr_t cache_err = H5Pset_cache(fapl, 0, 521, 134217728, 1.0);
DEBUG_MSG("when setting cache for particles I got %d\\n", cache_err);
sprintf(fname, "%s_particles.h5", simname);
particle_file = H5Fopen(fname, H5F_ACC_RDWR, fapl);
}}
//endcpp
""".format(self.C_dtype, self.fftw_plan_rigor, field_H5T)
}
"""
if not self.frozen_fields:
self.fluid_loop = 'fs->step(dt);\n'
else:
......@@ -399,6 +402,8 @@ class NavierStokes(_fluid_particle_base):
'H5Tclose(H5T_field_complex);\n' +
'}\n' +
'delete fs;\n')
if self.parameters['nparticles'] > 0:
self.fluid_end += 'H5Fclose(particle_file);\n'
return None
def add_3D_rFFTW_field(
self,
......
......@@ -113,7 +113,6 @@ class _code(_base):
H5Dwrite(Cdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &iteration);
H5Dclose(Cdset);
H5Fclose(stat_file);
H5Fclose(particle_file);
}
fftwf_mpi_cleanup();
fftw_mpi_cleanup();
......
Markdown is supported
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