Commit d8da05ef authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

only generate acc dataset when needed

parent 35da9e90
......@@ -458,6 +458,7 @@ class NavierStokes(bfps.fluid_base.fluid_particle_base):
neighbours = self.parameters[interpolator[s] + '_neighbours']
if type(kcut) == list:
self.parameters['tracers{0}_kcut'.format(s0 + s)] = kcut[s]
self.parameters['tracers{0}_acc_on'.format(s0 + s)] = not type(acc_name) == type(None)
self.parameters['tracers{0}_interpolator'.format(s0 + s)] = interpolator[s]
self.parameters['tracers{0}_integration_steps'.format(s0 + s)] = integration_steps[s]
self.file_datasets_grow += """
......
......@@ -130,9 +130,10 @@ class fluid_particle_base(bfps.code):
'hsize_t dset;\n')
for key in ['state', 'velocity', 'acceleration']:
self.definitions += ('full_name = (std::string(name) + std::string("/{0}"));\n'.format(key) +
'if (H5Lexists(g_id, full_name.c_str(), H5P_DEFAULT))\n{\n' +
'dset = H5Dopen(g_id, full_name.c_str(), H5P_DEFAULT);\n' +
'grow_single_dataset(dset, niter_todo/niter_part);\n' +
'H5Dclose(dset);\n')
'H5Dclose(dset);\n}\n')
self.definitions += ('full_name = (std::string(name) + std::string("/rhs"));\n' +
'if (H5Lexists(g_id, full_name.c_str(), H5P_DEFAULT))\n{\n' +
'dset = H5Dopen(g_id, full_name.c_str(), H5P_DEFAULT);\n' +
......@@ -473,14 +474,15 @@ class fluid_particle_base(bfps.code):
chunks = (time_chunk, self.parameters['nparticles'], 3),
maxshape = (None, self.parameters['nparticles'], 3),
dtype = np.float64)
ofile.create_dataset(
'/particles/tracers{0}/acceleration'.format(s),
(1,
self.parameters['nparticles'],
3),
chunks = (time_chunk, self.parameters['nparticles'], 3),
maxshape = (None, self.parameters['nparticles'], 3),
dtype = np.float64)
if self.parameters['tracers{0}_acc_on'.format(s)]:
ofile.create_dataset(
'/particles/tracers{0}/acceleration'.format(s),
(1,
self.parameters['nparticles'],
3),
chunks = (time_chunk, self.parameters['nparticles'], 3),
maxshape = (None, self.parameters['nparticles'], 3),
dtype = np.float64)
ofile.close()
return None
......@@ -8,3 +8,4 @@ x 2016-01-03 check divfree function
x 2016-01-03 compute kMeta(t) as well
x 2016-01-03 split library into core and extra @optimization +v1.0
x 2016-01-07 FFTW interpolator doesn't need its own field @optimization +v1.0 +particle_api
x 2016-01-08 simplify tracer/field addition mechanism @design +v1.0 +particle_api
......@@ -148,6 +148,8 @@ def launch(
def acceleration_test(c, m = 3, species = 0):
if not c.parameters['tracers{0}_acc_on'.format(species)]:
return None
import numpy as np
import matplotlib.pyplot as plt
from bfps.tools import get_fornberg_coeffs
......
(B) add stat choice parameter to add_particles @design +v1.0 +particle_api
(B) simplify tracer/field addition mechanism @design +v1.0 +particle_api
(B) compute z polynomials only when needed @optimization +v1.0
(B) read https://www.xsede.org/documents/271087/369161/ExtScale-Koziol.pdf @optimization @HDF5 +I/O
(B) set up mechanism for adding in new PDEs @design +v2.0 +alternate_algorithms
......
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