Skip to content
Snippets Groups Projects
Commit 4cd6b342 authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

finalize velocity gradient interpolation test

parent cf1d40f4
Branches
Tags
1 merge request!23WIP: Feature/use cmake
Pipeline #
...@@ -34,20 +34,15 @@ def main(): ...@@ -34,20 +34,15 @@ def main():
'r') 'r')
pos0 = ifile['tracers0/state/0'].value pos0 = ifile['tracers0/state/0'].value
pos1 = ofile['tracers0/position/0'].value pos1 = ofile['tracers0/position/0'].value
print('maximum position error is ', np.max(np.abs(pos0-pos1) / np.abs(pos0))) assert(np.max(np.abs(pos0-pos1) / np.abs(pos0)) <= 1e-5)
vort0 = ofile['tracers0/vorticity/0'].value vort0 = ofile['tracers0/vorticity/0'].value
print(vort0)
vel_gradient = ofile['tracers0/velocity_gradient/0'].value vel_gradient = ofile['tracers0/velocity_gradient/0'].value
print(vel_gradient)
vort1 = vort0.copy() vort1 = vort0.copy()
vort1[:, 0] = vel_gradient[:, 7] - vel_gradient[:, 5]
vort1[:, 1] = vel_gradient[:, 2] - vel_gradient[:, 6]
vort1[:, 2] = vel_gradient[:, 3] - vel_gradient[:, 1]
print(np.abs(vort0-vort1) / np.abs(vort0))
vort1[:, 0] = vel_gradient[:, 5] - vel_gradient[:, 7] vort1[:, 0] = vel_gradient[:, 5] - vel_gradient[:, 7]
vort1[:, 1] = vel_gradient[:, 6] - vel_gradient[:, 2] vort1[:, 1] = vel_gradient[:, 6] - vel_gradient[:, 2]
vort1[:, 2] = vel_gradient[:, 1] - vel_gradient[:, 3] vort1[:, 2] = vel_gradient[:, 1] - vel_gradient[:, 3]
print(np.abs(vort0-vort1) / np.abs(vort0)) assert(np.max(np.abs(vort0-vort1) / np.abs(vort0)) <= 1e-5)
print('SUCCESS! Interpolated vorticity agrees with vorticity from interpolated velocity gradient.')
return None return None
if __name__ == '__main__': if __name__ == '__main__':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment