Commit d6c14d77 authored by Chichi Lalescu's avatar Chichi Lalescu
Browse files

particle parameters are only accessed for NSVEp class

parent 8c388633
...@@ -364,9 +364,10 @@ class DNS(_code): ...@@ -364,9 +364,10 @@ class DNS(_code):
particle_ic = None): particle_ic = None):
assert (self.parameters['niter_todo'] % self.parameters['niter_stat'] == 0) assert (self.parameters['niter_todo'] % self.parameters['niter_stat'] == 0)
assert (self.parameters['niter_todo'] % self.parameters['niter_out'] == 0) assert (self.parameters['niter_todo'] % self.parameters['niter_out'] == 0)
assert (self.parameters['niter_todo'] % self.parameters['niter_part'] == 0)
assert (self.parameters['niter_out'] % self.parameters['niter_stat'] == 0) assert (self.parameters['niter_out'] % self.parameters['niter_stat'] == 0)
assert (self.parameters['niter_out'] % self.parameters['niter_part'] == 0) if self.dns_type == 'NSVEp':
assert (self.parameters['niter_todo'] % self.parameters['niter_part'] == 0)
assert (self.parameters['niter_out'] % self.parameters['niter_part'] == 0)
_code.write_par(self, iter0 = iter0) _code.write_par(self, iter0 = iter0)
with h5py.File(self.get_data_file_name(), 'r+') as ofile: with h5py.File(self.get_data_file_name(), 'r+') as ofile:
ofile['bfps_info/exec_name'] = self.name ofile['bfps_info/exec_name'] = self.name
...@@ -786,35 +787,37 @@ class DNS(_code): ...@@ -786,35 +787,37 @@ class DNS(_code):
f['vorticity/complex/{0}'.format(0)] = data f['vorticity/complex/{0}'.format(0)] = data
f.close() f.close()
# take care of particles' initial condition # take care of particles' initial condition
if opt.pclouds > 1: if self.dns_type == 'NSVEp':
np.random.seed(opt.particle_rand_seed) if opt.pclouds > 1:
if opt.pcloud_type == 'random-cube': np.random.seed(opt.particle_rand_seed)
particle_initial_condition = ( if opt.pcloud_type == 'random-cube':
np.random.random((opt.pclouds, 1, 3))*2*np.pi + particle_initial_condition = (
np.random.random((1, self.parameters['nparticles'], 3))*opt.particle_cloud_size) np.random.random((opt.pclouds, 1, 3))*2*np.pi +
elif opt.pcloud_type == 'regular-cube': np.random.random((1, self.parameters['nparticles'], 3))*opt.particle_cloud_size)
onedarray = np.linspace( elif opt.pcloud_type == 'regular-cube':
-opt.particle_cloud_size/2, onedarray = np.linspace(
opt.particle_cloud_size/2, -opt.particle_cloud_size/2,
self.parameters['nparticles']) opt.particle_cloud_size/2,
particle_initial_condition = np.zeros( self.parameters['nparticles'])
(opt.pclouds, particle_initial_condition = np.zeros(
self.parameters['nparticles'], (opt.pclouds,
self.parameters['nparticles'], self.parameters['nparticles'],
self.parameters['nparticles'], 3), self.parameters['nparticles'],
dtype = np.float64) self.parameters['nparticles'], 3),
particle_initial_condition[:] = \ dtype = np.float64)
np.random.random((opt.pclouds, 1, 1, 1, 3))*2*np.pi particle_initial_condition[:] = \
particle_initial_condition[..., 0] += onedarray[None, None, None, :] np.random.random((opt.pclouds, 1, 1, 1, 3))*2*np.pi
particle_initial_condition[..., 1] += onedarray[None, None, :, None] particle_initial_condition[..., 0] += onedarray[None, None, None, :]
particle_initial_condition[..., 2] += onedarray[None, :, None, None] particle_initial_condition[..., 1] += onedarray[None, None, :, None]
particle_initial_condition[..., 2] += onedarray[None, :, None, None]
self.write_par( self.write_par(
particle_ic = particle_initial_condition) particle_ic = particle_initial_condition)
if self.parameters['nparticles'] > 0: if self.dns_type == 'NSVEp':
data = self.generate_tracer_state( if self.parameters['nparticles'] > 0:
species = 0, data = self.generate_tracer_state(
rseed = opt.particle_rand_seed, species = 0,
data = particle_initial_condition) rseed = opt.particle_rand_seed,
data = particle_initial_condition)
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,
......
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