Skip to content
Snippets Groups Projects
Commit 738102b6 authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

code runs with no obvious errors

parent 520a5356
Branches
Tags
1 merge request!23WIP: Feature/use cmake
Pipeline #
...@@ -37,6 +37,7 @@ import warnings ...@@ -37,6 +37,7 @@ import warnings
import bfps import bfps
from ._code import _code from ._code import _code
from bfps import tools from bfps import tools
from bfps import DNS
class TEST(_code): class TEST(_code):
"""This class is meant to stitch together the C++ code into a final source file, """This class is meant to stitch together the C++ code into a final source file,
...@@ -339,6 +340,20 @@ class TEST(_code): ...@@ -339,6 +340,20 @@ class TEST(_code):
pbase_shape + pbase_shape +
(ncomponents,)), (ncomponents,)),
dtype = np.float) 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( self.run(
nb_processes = opt.nb_processes, nb_processes = opt.nb_processes,
nb_threads_per_process = opt.nb_threads_per_process, nb_threads_per_process = opt.nb_threads_per_process,
......
...@@ -24,10 +24,12 @@ int test_interpolation<rnumber>::read_parameters(void) ...@@ -24,10 +24,12 @@ int test_interpolation<rnumber>::read_parameters(void)
template <typename rnumber> template <typename rnumber>
int test_interpolation<rnumber>::initialize(void) int test_interpolation<rnumber>::initialize(void)
{ {
this->read_parameters();
this->vorticity = new field<rnumber, FFTW, THREE>( this->vorticity = new field<rnumber, FFTW, THREE>(
this->nx, this->ny, this->nz, this->nx, this->ny, this->nz,
this->comm, this->comm,
DEFAULT_FFTW_FLAG); DEFAULT_FFTW_FLAG);
this->vorticity->real_space_representation = false;
this->velocity = new field<rnumber, FFTW, THREE>( this->velocity = new field<rnumber, FFTW, THREE>(
this->nx, this->ny, this->nz, this->nx, this->ny, this->nz,
...@@ -97,6 +99,7 @@ int test_interpolation<rnumber>::do_work() ...@@ -97,6 +99,7 @@ int test_interpolation<rnumber>::do_work()
{ {
std::string fname = this->simname + std::string("_input.h5"); std::string fname = this->simname + std::string("_input.h5");
// read vorticity field // read vorticity field
this->vorticity->real_space_representation = false;
this->vorticity->io( this->vorticity->io(
fname, fname,
"vorticity", "vorticity",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment