The following command is important to view matplotlib plots on a jupyter notebook
In [2]:
%matplotlib notebook
In [3]:
import matplotlib.pyplot as plt
In [4]:
from mpl_toolkits.mplot3d import Axes3D
In [5]:
import os, sys
In [6]:
from matplotlib.mlab import griddata
In [7]:
import numpy as np
In [8]:
os.getcwd() # current directory
Out[8]:
In [22]:
os.listdir( os.getcwd() )
Out[22]:
In [10]:
import pandas as pd
In [11]:
u_data = pd.read_table( 'velocity_gpu.dat') # t=1.4 or time=1.4
In [12]:
u_data.columns
Out[12]:
In [13]:
u_data.size
Out[13]:
In [14]:
u_data.head()
Out[14]:
In [15]:
u_data.describe()
Out[15]:
In [16]:
xi = np.linspace(0.0, 1.0, 512)
yi = np.linspace(0.0, 1.0, 512)
In [17]:
zi = griddata( u_data.iloc[:,0], u_data.iloc[:,1], u_data.iloc[:,2], xi, yi,interp='linear') # t=1.4 or time = 1.4,
# u velocity component or x-component of velocity
In [20]:
plt.contour( xi,yi,zi, 1000, cmap=plt.cm.rainbow, vmax=abs(zi).max(), vmin=-abs(zi).max() )
plt.colorbar()
Out[20]:
In [37]:
figure014 = plt.figure()
ax014 = figure014.add_subplot(121) # 2x1 grid, 1st subplot
In [26]:
u_datat014 = pd.read_table( 'velocity_gput014.dat') # t=1.4 or time=1.4
In [28]:
u_t014i = griddata( u_datat014.iloc[:,0], u_datat014.iloc[:,1], u_datat014.iloc[:,2], xi, yi,interp='linear') # t=1.4 or time = 1.4,
# u velocity component or x-component of velocity
In [29]:
v_t014i = griddata( u_datat014.iloc[:,0], u_datat014.iloc[:,1], u_datat014.iloc[:,3], xi, yi,interp='linear') # t=1.4 or time = 1.4,
# v velocity component or y-component of velocity
In [43]:
ax014.set_title("$u$ or $x$-component of velocity field, \n $Re = 1000$, $t=1.4$ time evolution")
Out[43]:
In [39]:
plt.contour( xi,yi,u_t014i, 1000, cmap=plt.cm.rainbow, vmax=abs(u_t014i).max(), vmin=-abs(u_t014i).max() )
plt.colorbar()
Out[39]:
In [42]:
ax014v = figure014.add_subplot(122) # 2x1 grid, 2nd subplot
ax014v.set_title("$v$ or $y$-component of velocity field, \n $Re = 1000$, $t=1.4$ time evolution")
Out[42]:
In [41]:
plt.contour( xi,yi,v_t014i, 1000, cmap=plt.cm.rainbow, vmax=abs(v_t014i).max(), vmin=-abs(v_t014i).max() )
plt.colorbar()
Out[41]:
In [66]:
figure014_u_only = plt.figure()
plt.title("$u$ or $x$-component of velocity field, \n $Re = 1000$, $t=1.4$ time evolution")
plt.xlabel('x')
plt.ylabel('y')
plt.contour( xi,yi,u_t014i, 1000, cmap=plt.cm.rainbow, vmax=abs(u_t014i).max(), vmin=-abs(u_t014i).max() )
plt.colorbar()
Out[66]:
In [45]:
figure024 = plt.figure()
ax024 = figure024.add_subplot(121) # 2x1 grid, 1st subplot
In [46]:
u_datat024 = pd.read_table( 'velocity_gput024.dat') # t=2.4 or time=2.4
In [47]:
u_t024i = griddata( u_datat024.iloc[:,0], u_datat024.iloc[:,1], u_datat024.iloc[:,2], xi, yi,interp='linear') # t=2.4 or time = 2.4,
# u velocity component or x-component of velocity
In [48]:
v_t024i = griddata( u_datat024.iloc[:,0], u_datat024.iloc[:,1], u_datat024.iloc[:,3], xi, yi,interp='linear') # t=2.4 or time = 2.4,
# v velocity component or y-component of velocity
In [49]:
ax024.set_title("$u$ or $x$-component of velocity field, \n $Re = 1000$, $t=2.4$ time evolution")
Out[49]:
In [50]:
plt.contour( xi,yi,u_t024i, 1000, cmap=plt.cm.rainbow, vmax=abs(u_t024i).max(), vmin=-abs(u_t024i).max() )
plt.colorbar()
Out[50]:
In [51]:
ax024v = figure024.add_subplot(122) # 2x1 grid, 2nd subplot
ax024v.set_title("$v$ or $y$-component of velocity field, \n $Re = 1000$, $t=2.4$ time evolution")
Out[51]:
In [52]:
plt.contour( xi,yi,v_t024i, 1000, cmap=plt.cm.rainbow, vmax=abs(v_t024i).max(), vmin=-abs(v_t024i).max() )
plt.colorbar()
Out[52]:
In [67]:
figure024_u_only = plt.figure()
plt.title("$u$ or $x$-component of velocity field, \n $Re = 1000$, $t=2.4$ time evolution")
plt.xlabel('x')
plt.ylabel('y')
plt.contour( xi,yi,u_t024i, 1000, cmap=plt.cm.rainbow, vmax=abs(u_t024i).max(), vmin=-abs(u_t024i).max() )
plt.colorbar()
Out[67]:
In [60]:
figure034 = plt.figure()
ax034 = figure034.add_subplot(121) # 2x1 grid, 1st subplot
In [59]:
u_datat034 = pd.read_table( 'velocity_gput034.dat') # t=3.4 or time=3.4
u_t034i = griddata( u_datat034.iloc[:,0], u_datat034.iloc[:,1], u_datat034.iloc[:,2], xi, yi,interp='linear') # t=3.4 or time = 3.4,
# u velocity component or x-component of velocity
v_t034i = griddata( u_datat034.iloc[:,0], u_datat034.iloc[:,1], u_datat034.iloc[:,3], xi, yi,interp='linear') # t=3.4 or time = 3.4,
# v velocity component or y-component of velocity
In [61]:
ax034.set_title("$u$ or $x$-component of velocity field, \n $Re = 1000$, $t=3.4$ time evolution")
Out[61]:
In [62]:
plt.contour( xi,yi,u_t034i, 1000, cmap=plt.cm.rainbow, vmax=abs(u_t034i).max(), vmin=-abs(u_t034i).max() )
plt.colorbar()
Out[62]:
In [63]:
ax034v = figure034.add_subplot(122) # 2x1 grid, 2nd subplot
ax034v.set_title("$v$ or $y$-component of velocity field, \n $Re = 1000$, $t=3.4$ time evolution")
Out[63]:
In [64]:
plt.contour( xi,yi,v_t034i, 1000, cmap=plt.cm.rainbow, vmax=abs(v_t034i).max(), vmin=-abs(v_t034i).max() )
plt.colorbar()
Out[64]:
In [68]:
figure034_u_only = plt.figure()
plt.title("$u$ or $x$-component of velocity field, \n $Re = 1000$, $t=3.4$ time evolution")
plt.xlabel('x')
plt.ylabel('y')
plt.contour( xi,yi,u_t034i, 1000, cmap=plt.cm.rainbow, vmax=abs(u_t034i).max(), vmin=-abs(u_t034i).max() )
plt.colorbar()
Out[68]:
In [69]:
figure044 = plt.figure()
ax044 = figure044.add_subplot(121) # 2x1 grid, 1st subplot
In [70]:
u_datat044 = pd.read_table( 'velocity_gput044.dat') # t=4.4 or time=4.4
u_t044i = griddata( u_datat044.iloc[:,0], u_datat044.iloc[:,1], u_datat044.iloc[:,2], xi, yi,interp='linear') # t=4.4 or time = 4.4,
# u velocity component or x-component of velocity
v_t044i = griddata( u_datat044.iloc[:,0], u_datat044.iloc[:,1], u_datat044.iloc[:,3], xi, yi,interp='linear') # t=4.4 or time = 4.4,
# v velocity component or y-component of velocity
In [71]:
ax044.set_title("$u$ or $x$-component of velocity field, \n $Re = 1000$, $t=4.4$ time evolution")
Out[71]:
In [72]:
plt.contour( xi,yi,u_t044i, 1000, cmap=plt.cm.rainbow, vmax=abs(u_t044i).max(), vmin=-abs(u_t044i).max() )
plt.colorbar()
Out[72]:
In [73]:
ax044v = figure044.add_subplot(122) # 2x1 grid, 2nd subplot
ax044v.set_title("$v$ or $y$-component of velocity field, \n $Re = 1000$, $t=4.4$ time evolution")
Out[73]:
In [74]:
plt.contour( xi,yi,v_t044i, 1000, cmap=plt.cm.rainbow, vmax=abs(v_t044i).max(), vmin=-abs(v_t044i).max() )
plt.colorbar()
Out[74]:
In [75]:
figure044_u_only = plt.figure()
plt.title("$u$ or $x$-component of velocity field, \n $Re = 1000$, $t=4.4$ time evolution")
plt.xlabel('x')
plt.ylabel('y')
plt.contour( xi,yi,u_t044i, 1000, cmap=plt.cm.rainbow, vmax=abs(u_t044i).max(), vmin=-abs(u_t044i).max() )
plt.colorbar()
Out[75]:
In [76]:
figure054 = plt.figure()
ax054 = figure054.add_subplot(121) # 2x1 grid, 1st subplot
In [77]:
u_datat054 = pd.read_table( 'velocity_gput054.dat') # t=5.4 or time=5.4
u_t054i = griddata( u_datat054.iloc[:,0], u_datat054.iloc[:,1], u_datat054.iloc[:,2], xi, yi,interp='linear') # t=5.4 or time = 5.4,
# u velocity component or x-component of velocity
v_t054i = griddata( u_datat054.iloc[:,0], u_datat054.iloc[:,1], u_datat054.iloc[:,3], xi, yi,interp='linear') # t=5.4 or time = 5.4,
# v velocity component or y-component of velocity
In [78]:
ax054.set_title("$u$ or $x$-component of velocity field, \n $Re = 1000$, $t=5.4$ time evolution")
Out[78]:
In [79]:
plt.contour( xi,yi,u_t054i, 1000, cmap=plt.cm.rainbow, vmax=abs(u_t054i).max(), vmin=-abs(u_t054i).max() )
plt.colorbar()
Out[79]:
In [80]:
ax054v = figure054.add_subplot(122) # 2x1 grid, 2nd subplot
ax054v.set_title("$v$ or $y$-component of velocity field, \n $Re = 1000$, $t=5.4$ time evolution")
Out[80]:
In [81]:
plt.contour( xi,yi,v_t054i, 1000, cmap=plt.cm.rainbow, vmax=abs(v_t054i).max(), vmin=-abs(v_t054i).max() )
plt.colorbar()
Out[81]:
In [82]:
figure054_u_only = plt.figure()
plt.title("$u$ or $x$-component of velocity field, \n $Re = 1000$, $t=5.4$ time evolution")
plt.xlabel('x')
plt.ylabel('y')
plt.contour( xi,yi,u_t054i, 1000, cmap=plt.cm.rainbow, vmax=abs(u_t054i).max(), vmin=-abs(u_t054i).max() )
plt.colorbar()
Out[82]:
In [83]:
figure064 = plt.figure()
ax064 = figure064.add_subplot(121) # 2x1 grid, 1st subplot
In [84]:
u_datat064 = pd.read_table( 'velocity_gput064.dat') # t=6.4 or time=6.4
u_t064i = griddata( u_datat064.iloc[:,0], u_datat064.iloc[:,1], u_datat064.iloc[:,2], xi, yi,interp='linear') # t=6.4 or time = 6.4,
# u velocity component or x-component of velocity
v_t064i = griddata( u_datat064.iloc[:,0], u_datat064.iloc[:,1], u_datat064.iloc[:,3], xi, yi,interp='linear') # t=6.4 or time = 6.4,
# v velocity component or y-component of velocity
In [85]:
ax064.set_title("$u$ or $x$-component of velocity field, \n $Re = 1000$, $t=6.4$ time evolution")
Out[85]:
In [86]:
plt.contour( xi,yi,u_t064i, 1000, cmap=plt.cm.rainbow, vmax=abs(u_t064i).max(), vmin=-abs(u_t064i).max() )
plt.colorbar()
Out[86]:
In [87]:
ax064v = figure064.add_subplot(122) # 2x1 grid, 2nd subplot
ax064v.set_title("$v$ or $y$-component of velocity field, \n $Re = 1000$, $t=6.4$ time evolution")
Out[87]:
In [88]:
plt.contour( xi,yi,v_t064i, 1000, cmap=plt.cm.rainbow, vmax=abs(v_t064i).max(), vmin=-abs(v_t064i).max() )
plt.colorbar()
Out[88]:
In [89]:
figure064_u_only = plt.figure()
plt.title("$u$ or $x$-component of velocity field, \n $Re = 1000$, $t=6.4$ time evolution")
plt.xlabel('x')
plt.ylabel('y')
plt.contour( xi,yi,u_t064i, 1000, cmap=plt.cm.rainbow, vmax=abs(u_t064i).max(), vmin=-abs(u_t064i).max() )
plt.colorbar()
Out[89]:
In [90]:
figure074 = plt.figure()
ax074 = figure074.add_subplot(121) # 2x1 grid, 1st subplot
In [91]:
u_datat074 = pd.read_table( 'velocity_gput074.dat') # t=7.4 or time=7.4
u_t074i = griddata( u_datat074.iloc[:,0], u_datat074.iloc[:,1], u_datat074.iloc[:,2], xi, yi,interp='linear') # t=7.4 or time = 7.4,
# u velocity component or x-component of velocity
v_t074i = griddata( u_datat074.iloc[:,0], u_datat074.iloc[:,1], u_datat074.iloc[:,3], xi, yi,interp='linear') # t=7.4 or time = 7.4,
# v velocity component or y-component of velocity
In [92]:
ax074.set_title("$u$ or $x$-component of velocity field, \n $Re = 1000$, $t=7.4$ time evolution")
Out[92]:
In [93]:
plt.contour( xi,yi,u_t074i, 1000, cmap=plt.cm.rainbow, vmax=abs(u_t074i).max(), vmin=-abs(u_t074i).max() )
plt.colorbar()
Out[93]:
In [94]:
ax074v = figure074.add_subplot(122) # 2x1 grid, 2nd subplot
ax074v.set_title("$v$ or $y$-component of velocity field, \n $Re = 1000$, $t=7.4$ time evolution")
Out[94]:
In [95]:
plt.contour( xi,yi,v_t074i, 1000, cmap=plt.cm.rainbow, vmax=abs(v_t074i).max(), vmin=-abs(v_t074i).max() )
plt.colorbar()
Out[95]:
In [96]:
figure074_u_only = plt.figure()
plt.title("$u$ or $x$-component of velocity field, \n $Re = 1000$, $t=7.4$ time evolution")
plt.xlabel('x')
plt.ylabel('y')
plt.contour( xi,yi,u_t074i, 1000, cmap=plt.cm.rainbow, vmax=abs(u_t074i).max(), vmin=-abs(u_t074i).max() )
plt.colorbar()
Out[96]:
In [97]:
figure084 = plt.figure()
ax084 = figure084.add_subplot(121) # 2x1 grid, 1st subplot
In [98]:
u_datat084 = pd.read_table( 'velocity_gput084.dat') # t=8.4 or time=8.4
u_t084i = griddata( u_datat084.iloc[:,0], u_datat084.iloc[:,1], u_datat084.iloc[:,2], xi, yi,interp='linear') # t=8.4 or time = 8.4,
# u velocity component or x-component of velocity
v_t084i = griddata( u_datat084.iloc[:,0], u_datat084.iloc[:,1], u_datat084.iloc[:,3], xi, yi,interp='linear') # t=8.4 or time = 8.4,
# v velocity component or y-component of velocity
In [99]:
ax084.set_title("$u$ or $x$-component of velocity field, \n $Re = 1000$, $t=8.4$ time evolution")
Out[99]:
In [100]:
plt.contour( xi,yi,u_t084i, 1000, cmap=plt.cm.rainbow, vmax=abs(u_t084i).max(), vmin=-abs(u_t084i).max() )
plt.colorbar()
Out[100]:
In [101]:
ax084v = figure084.add_subplot(122) # 2x1 grid, 2nd subplot
ax084v.set_title("$v$ or $y$-component of velocity field, \n $Re = 1000$, $t=8.4$ time evolution")
Out[101]:
In [102]:
plt.contour( xi,yi,v_t084i, 1000, cmap=plt.cm.rainbow, vmax=abs(v_t084i).max(), vmin=-abs(v_t084i).max() )
plt.colorbar()
Out[102]:
In [103]:
figure084_u_only = plt.figure()
plt.title("$u$ or $x$-component of velocity field, \n $Re = 1000$, $t=8.4$ time evolution")
plt.xlabel('x')
plt.ylabel('y')
plt.contour( xi,yi,u_t084i, 1000, cmap=plt.cm.rainbow, vmax=abs(u_t084i).max(), vmin=-abs(u_t084i).max() )
plt.colorbar()
Out[103]:
In [ ]: