Commit 25383a84 authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

fix particle_finite_diff_test

parent 163e9740
......@@ -579,7 +579,6 @@ class NavierStokes(_fluid_particle_base):
self.particle_loop += '{0}->field = fs->rvelocity;\n'.format(interpolator[s])
self.particle_loop += 'ps{0}->step();\n'.format(s0 + s)
self.particle_stat_src += 'ps{0}->write(particle_file, false);\n'.format(s0 + s)
self.particle_start += output_vel_acc
self.particle_stat_src += output_vel_acc
self.particle_stat_src += '}\n'
self.particle_species += nspecies
......@@ -615,11 +614,6 @@ class NavierStokes(_fluid_particle_base):
self.statistics['kshell'] = data_file['kspace/kshell'].value
self.statistics['kM'] = data_file['kspace/kM'].value
self.statistics['dk'] = data_file['kspace/dk'].value
#if self.particle_species > 0:
# self.trajectories = [data_file['particles/' + key + '/state'][
# iter0//self.parameters['niter_part'] :
# iter1//self.parameters['niter_part']+1]
# for key in data_file['particles'].keys()]
computation_needed = True
pp_file = h5py.File(self.get_postprocess_file_name(), 'a')
if 'ii0' in pp_file.keys():
......
......@@ -198,8 +198,12 @@ def particle_finite_diff_test(
.. seealso:: :func:`get_fornberg_coeffs`
"""
d = c.get_data_file()
group = d['particles/tracers{0}'.format(species)]
df = c.get_data_file()
if 'particles' in df.keys():
group = df['particles/tracers{0}'.format(species)]
else:
pf = c.get_particle_file()
group = pf['tracers{0}'.format(species)]
acc_on = 'acceleration' in group.keys()
pos = group['state'].value
vel = group['velocity'].value
......@@ -207,7 +211,7 @@ def particle_finite_diff_test(
acc = group['acceleration'].value
n = m
fc = get_fornberg_coeffs(0, range(-n, n+1))
dt = d['parameters/dt'].value*d['parameters/niter_part'].value
dt = c.parameters['dt']*c.parameters['niter_part']
num_vel1 = sum(fc[1, n-i]*pos[1+n-i:pos.shape[0]-i-n-1] for i in range(-n, n+1)) / dt
if acc_on:
......@@ -220,7 +224,7 @@ def particle_finite_diff_test(
pid = np.argmin(SNR(num_acc1, acc[n+1:-n-1]))
else:
pid = np.argmin(SNR(num_vel1, vel[n+1:-n-1]))
pars = d['parameters']
pars = df['parameters']
to_print = (
'steps={0}, interp={1}, neighbours={2}, '.format(
pars['tracers{0}_integration_steps'.format(species)].value,
......@@ -246,7 +250,6 @@ def particle_finite_diff_test(
for n in range(1, m):
fc = get_fornberg_coeffs(0, range(-n, n+1))
dt = d['parameters/dt'].value*d['parameters/niter_part'].value
num_acc1 = sum(fc[1, n-i]*vel[n-i:vel.shape[0]-i-n] for i in range(-n, n+1)) / dt
num_acc2 = sum(fc[2, n-i]*pos[n-i:pos.shape[0]-i-n] for i in range(-n, n+1)) / dt**2
......
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