diff --git a/bfps/NavierStokes.py b/bfps/NavierStokes.py index 9c88e40111c1139026fe4849a88774e8ace7d885..70a4426d6f81c0610aff559b7cb8620194f74a0a 100644 --- a/bfps/NavierStokes.py +++ b/bfps/NavierStokes.py @@ -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 += """ diff --git a/bfps/fluid_base.py b/bfps/fluid_base.py index 2c9096aad2cb9ec5c2b5f8af5517cf0b34310884..ba0be9ed8e3660dc66c9fa0a89a2eb2b8979a99f 100644 --- a/bfps/fluid_base.py +++ b/bfps/fluid_base.py @@ -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 diff --git a/done.txt b/done.txt index f96403d7fa2afd47148c2e184f278ac478471639..e08b0573c70e27fd417a579096ad111def02c90e 100644 --- a/done.txt +++ b/done.txt @@ -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 diff --git a/tests/base.py b/tests/base.py index 79c2646a83cede058ece671aaa300a1c0526f4e3..abe5cf861ecc35b9211b76bd32a7f43e84a82148 100644 --- a/tests/base.py +++ b/tests/base.py @@ -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 diff --git a/todo.txt b/todo.txt index 8c38aeb973e9da0aabd488502b5acaf2d067aa57..2d40075b184779cfccb37cbf60cff4846184b8e7 100644 --- a/todo.txt +++ b/todo.txt @@ -1,5 +1,4 @@ (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