diff --git a/bfps/TEST.py b/bfps/TEST.py index 9a36cbfcdd6bc459a7150101c439ef3f4ebb60ac..a95756e10db814134537c44e572f8b22110139a4 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 023b40f8f04cb0b0d6e8a91b92a40773ba6efc10..2150d51f0240d97e7deb697297907e863da905a4 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",