Commit 1eac6344 authored by Tobias Baetge's avatar Tobias Baetge Committed by Cristian Lalescu
Browse files

adds initialisation for Stokes particles

parent 8628541d
......@@ -703,6 +703,9 @@ class DNS(_code):
pars['spectrum_slope'] = float(-5./3)
pars['spectrum_k_cutoff'] = float(16)
pars['spectrum_coefficient'] = float(1)
if dns_type == 'NSVE_Stokes_particles':
pars['initial_field_amplitude'] = float(0.05)
pars['initial_particle_vel'] = float(0.05)
return pars
def prepare_launch(
self,
......@@ -897,12 +900,18 @@ class DNS(_code):
if nn > batch_size:
dset[cc*batch_size:(cc+1)*batch_size, :3] = get_random_phases(batch_size)
if dset.shape[1] == 6:
dset[cc*batch_size:(cc+1)*batch_size, 3:] = get_random_versors(batch_size)
if self.dns_type == 'NSVE_Stokes_particles':
dset[cc*batch_size:(cc+1)*batch_size, 3:] = self.parameters['initial_particle_vel']*get_random_versors(batch_size)
else:
dset[cc*batch_size:(cc+1)*batch_size, 3:] = get_random_versors(batch_size)
nn -= batch_size
else:
dset[cc*batch_size:cc*batch_size+nn, :3] = get_random_phases(nn)
if dset.shape[1] == 6:
dset[cc*batch_size:cc*batch_size+nn, 3:] = get_random_versors(nn)
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)
else:
dset[cc*batch_size:cc*batch_size+nn, 3:] = get_random_versors(nn)
nn = 0
cc += 1
except Exception as e:
......@@ -1107,10 +1116,16 @@ class DNS(_code):
f,
'vorticity/complex/{0}'.format(0))
else:
data = self.generate_vector_field(
if self.dns_type == 'NSVE_Stokes_particles':
data = self.generate_vector_field(
write_to_file = False,
spectra_slope = 2.0,
amplitude = 0.05)
amplitude = self.parameters['initial_field_amplitude'])
else:
data = self.generate_vector_field(
write_to_file = False,
spectra_slope = 2.0,
amplitude = 0.05)
f['vorticity/complex/{0}'.format(0)] = data
f.close()
if self.dns_type == 'kraichnan_field':
......
Markdown is supported
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