diff --git a/TurTLE/DNS.py b/TurTLE/DNS.py index a59aa12ab268b5b554abfddfe7ba9cd0300acc63..d7da0753d41aef9cd4edc08218155fe795bd3027 100644 --- a/TurTLE/DNS.py +++ b/TurTLE/DNS.py @@ -909,7 +909,7 @@ class DNS(_code): dset[cc*batch_size:cc*batch_size+nn, :3] = get_random_phases(nn) if dset.shape[1] == 6: if self.dns_type == 'NSVE_Stokes_particles': - dset[cc*batch_size:cc*batch_size+nn, 3:] = self.parameters['initial_particle_vel']*get_random_versors(batch_size) + dset[cc*batch_size:cc*batch_size+nn, 3:] = self.parameters['initial_particle_vel']*get_random_versors(nn) else: dset[cc*batch_size:cc*batch_size+nn, 3:] = get_random_versors(nn) nn = 0 diff --git a/TurTLE/test/test_turtle_NSVE_Stokes_particles.py b/TurTLE/test/test_turtle_NSVE_Stokes_particles.py new file mode 100644 index 0000000000000000000000000000000000000000..825ad1c8890aa699611c72638bfdafb11e549d42 --- /dev/null +++ b/TurTLE/test/test_turtle_NSVE_Stokes_particles.py @@ -0,0 +1,71 @@ +#! /usr/bin/env python +####################################################################### +# # +# Copyright 2019 Max Planck Institute # +# for Dynamics and Self-Organization # +# # +# This file is part of TurTLE. # +# # +# TurTLE is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published # +# by the Free Software Foundation, either version 3 of the License, # +# or (at your option) any later version. # +# # +# TurTLE is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with TurTLE. If not, see <http://www.gnu.org/licenses/> # +# # +# Contact: Cristian.Lalescu@ds.mpg.de # +# # +####################################################################### + + + +import os +import numpy as np +import h5py +import sys + +import TurTLE +from TurTLE import DNS + + +def main(): + """ + Run test where the trajectory of initially moving particles in a + quiescent flow is compared to the analytical exponential + """ + niterations = 100 + nparticles = 10 + njobs = 1 + c = DNS() + c.launch( + ['NSVE_Stokes_particles', + '-n', '32', + '--simname', 'quiescent_nsve_stokes_particles', + '--np', '4', + '--ntpp', '1', + '--fftw_plan_rigor', 'FFTW_PATIENT', + '--niter_todo', '{0}'.format(niterations), + '--niter_out', '{0}'.format(niterations), + '--niter_stat', '1', + '--checkpoints_per_file', '{0}'.format(3), + '--nparticles', '{0}'.format(nparticles), + '--initial_field_amplitude', '0', + '--initial_particle_vel', '0.05', + '--famplitude', '0', + '--njobs', '{0}'.format(njobs), + '--wd', './'] + + sys.argv[1:]) + f = h5py.File('quiescent_nsve_stokes_particles_particles.h5', 'r') + print(f['tracers0/momentum/0'][:]) + print(f['tracers0/momentum/100'][:]) + return None + +if __name__ == '__main__': + main() +