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

add a test of divergence

parent 0e6891a2
Branches
No related tags found
1 merge request!23WIP: Feature/use cmake
Pipeline #
...@@ -42,6 +42,10 @@ def main(): ...@@ -42,6 +42,10 @@ def main():
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]
assert(np.max(np.abs(vort0-vort1) / np.abs(vort0)) <= 1e-5) assert(np.max(np.abs(vort0-vort1) / np.abs(vort0)) <= 1e-5)
divergence = vel_gradient[:, 0] + vel_gradient[:, 4] + vel_gradient[:, 8]
divergence_error = np.abs(divergence) / (vel_gradient[:, 0]**2 + vel_gradient[:, 1]**2 + vel_gradient[:, 2]**2)**.5
print('mean divergence error is ', np.mean(divergence_error))
print('maximum divergence error is ', np.max(divergence_error))
print('SUCCESS! Interpolated vorticity agrees with vorticity from interpolated velocity gradient.') print('SUCCESS! Interpolated vorticity agrees with vorticity from interpolated velocity gradient.')
return None return None
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment