From 738102b68efc05ff25a337fd3597742aa20f23e7 Mon Sep 17 00:00:00 2001 From: Cristian C Lalescu <Cristian.Lalescu@ds.mpg.de> Date: Fri, 20 Apr 2018 12:45:05 +0200 Subject: [PATCH] code runs with no obvious errors --- bfps/TEST.py | 15 +++++++++++++++ bfps/cpp/full_code/test_interpolation.cpp | 3 +++ 2 files changed, 18 insertions(+) diff --git a/bfps/TEST.py b/bfps/TEST.py index 9a36cbfc..a95756e1 100644 --- a/bfps/TEST.py +++ b/bfps/TEST.py @@ -37,6 +37,7 @@ import warnings import bfps from ._code import _code from bfps import tools +from bfps import DNS class TEST(_code): """This class is meant to stitch together the C++ code into a final source file, @@ -339,6 +340,20 @@ class TEST(_code): pbase_shape + (ncomponents,)), dtype = np.float) + if type(particle_initial_condition) == type(None): + ofile['tracers0/state/0'][:] = np.random.random(pbase_shape + (ncomponents,))*2*np.pi + else: + ofile['tracers0/state/0'][:] = particle_initial_condition + with h5py.File(os.path.join(self.work_dir, self.simname + '_input.h5'), 'a') as ofile: + data = DNS.generate_vector_field(self, + write_to_file = False, + spectra_slope = 1.0, + amplitude = 0.05) + ofile['vorticity/complex/{0}'.format(0)] = data + with h5py.File(os.path.join(self.work_dir, self.simname + '_output.h5'), 'a') as ofile: + ofile.require_group('tracers0') + for kk in ['velocity', 'vorticity', 'velocity_gradient']: + ofile['tracers0'].require_group(kk) self.run( nb_processes = opt.nb_processes, nb_threads_per_process = opt.nb_threads_per_process, diff --git a/bfps/cpp/full_code/test_interpolation.cpp b/bfps/cpp/full_code/test_interpolation.cpp index 023b40f8..2150d51f 100644 --- a/bfps/cpp/full_code/test_interpolation.cpp +++ b/bfps/cpp/full_code/test_interpolation.cpp @@ -24,10 +24,12 @@ int test_interpolation<rnumber>::read_parameters(void) template <typename rnumber> int test_interpolation<rnumber>::initialize(void) { + this->read_parameters(); this->vorticity = new field<rnumber, FFTW, THREE>( this->nx, this->ny, this->nz, this->comm, DEFAULT_FFTW_FLAG); + this->vorticity->real_space_representation = false; this->velocity = new field<rnumber, FFTW, THREE>( this->nx, this->ny, this->nz, @@ -97,6 +99,7 @@ int test_interpolation<rnumber>::do_work() { std::string fname = this->simname + std::string("_input.h5"); // read vorticity field + this->vorticity->real_space_representation = false; this->vorticity->io( fname, "vorticity", -- GitLab