Commit b5bcd505 authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

change add_particles

1 particle species seems to be correctly integrated at the moment.
parent 76581747
This diff is collapsed.
......@@ -445,25 +445,24 @@ class fluid_particle_base(bfps.code):
dtype = np.int64,
compression = 'gzip')
for s in range(self.particle_species):
if self.parameters['tracers{0}_integration_method'.format(s)] == 'AdamsBashforth':
time_chunk = 2**20 // (8*3*
self.parameters['nparticles']*
self.parameters['tracers{0}_integration_steps'.format(s)])
time_chunk = max(time_chunk, 1)
ofile.create_dataset('particles/tracers{0}/rhs'.format(s),
(1,
self.parameters['tracers{0}_integration_steps'.format(s)],
self.parameters['nparticles'],
3),
maxshape = (None,
self.parameters['tracers{0}_integration_steps'.format(s)],
self.parameters['nparticles'],
3),
chunks = (time_chunk,
self.parameters['tracers{0}_integration_steps'.format(s)],
self.parameters['nparticles'],
3),
dtype = np.float64)
time_chunk = 2**20 // (8*3*
self.parameters['nparticles']*
self.parameters['tracers{0}_integration_steps'.format(s)])
time_chunk = max(time_chunk, 1)
ofile.create_dataset('particles/tracers{0}/rhs'.format(s),
(1,
self.parameters['tracers{0}_integration_steps'.format(s)],
self.parameters['nparticles'],
3),
maxshape = (None,
self.parameters['tracers{0}_integration_steps'.format(s)],
self.parameters['nparticles'],
3),
chunks = (time_chunk,
self.parameters['tracers{0}_integration_steps'.format(s)],
self.parameters['nparticles'],
3),
dtype = np.float64)
time_chunk = 2**20 // (8*3*self.parameters['nparticles'])
time_chunk = max(time_chunk, 1)
ofile.create_dataset(
......
......@@ -102,30 +102,21 @@ def launch(
c.parameters['famplitude'] = 0.2
c.fill_up_fluid_code()
if c.parameters['nparticles'] > 0:
c.add_3D_rFFTW_field()
c.add_particle_fields(
name = 'regular',
c.add_3D_rFFTW_field(name = 'rFFTW_acc')
c.add_interpolator(
name = 'spline',
neighbours = opt.neighbours,
smoothness = opt.smoothness)
c.add_particle_fields(kcut = 'fs->kM/2', name = 'filtered', neighbours = opt.neighbours)
intsteps = [2] #[2, 3, 4, 6]
c.add_particles(
kcut = 'fs->kM/2',
integration_steps = 1,
fields_name = 'filtered')
#for integr_steps in range(1, 7):
# c.add_particles(
# integration_steps = integr_steps,
# neighbours = opt.neighbours,
# smoothness = opt.smoothness,
# fields_name = 'regular')
for info in [(2, 'AdamsBashforth'),
(3, 'AdamsBashforth'),
(4, 'AdamsBashforth'),
(6, 'AdamsBashforth')]:
c.add_particles(
integration_steps = info[0],
integration_method = info[1],
fields_name = 'regular')
integration_steps = intsteps,
interpolator = ['spline' for i in range(len(intsteps))],
acc_name = 'rFFTW_acc')
#c.add_particle_fields(kcut = 'fs->kM/2', name = 'filtered', neighbours = opt.neighbours)
#c.add_particles(
# kcut = 'fs->kM/2',
# integration_steps = 1,
# fields_name = 'filtered')
c.finalize_code()
c.write_src()
c.write_par()
......@@ -183,13 +174,12 @@ def acceleration_test(c, m = 3, species = 0):
pid = np.argmin(SNR(num_acc1, acc[n+1:-n-1]))
pars = d['parameters']
to_print = (
'integration={0}, steps={1}, interp={2}, neighbours={3}, '.format(
pars['tracers{0}_integration_method'.format(species)].value,
'steps={0}, interp={1}, neighbours={2}, '.format(
pars['tracers{0}_integration_steps'.format(species)].value,
pars[str(pars['tracers{0}_field'.format(species)].value) + '_type'].value,
pars[str(pars['tracers{0}_field'.format(species)].value) + '_neighbours'].value))
if 'spline' in pars['tracers{0}_field'.format(species)].value:
to_print += 'smoothness = {0}, '.format(pars[str(pars['tracers{0}_field'.format(species)].value) + '_smoothness'].value)
pars[str(pars['tracers{0}_interpolator'.format(species)].value) + '_type'].value,
pars[str(pars['tracers{0}_interpolator'.format(species)].value) + '_neighbours'].value))
if 'spline' in pars['tracers{0}_interpolator'.format(species)].value:
to_print += 'smoothness = {0}, '.format(pars[str(pars['tracers{0}_interpolator'.format(species)].value) + '_smoothness'].value)
to_print += (
'SNR d1p-vel={0:.3f}, d1v-acc={1:.3f}, d2p-acc={2:.3f}'.format(
np.mean(SNR(num_vel1, vel[n+1:-n-1])),
......
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