| ... | @@ -81,4 +81,55 @@ fig.savefig("rho_a.png") | ... | @@ -81,4 +81,55 @@ fig.savefig("rho_a.png") | 
|  | plt.show() |  | plt.show() | 
|  | ``` |  | ``` | 
|  | The result of this example: |  | The result of this example: | 
|  |  |  |  | 
|  | \ No newline at end of file |  |  | 
|  |  |  | # Cross section of velocity field for quantum vortex | 
|  |  |  | ```python | 
|  |  |  | #!/usr/bin/python3 | 
|  |  |  |  | 
|  |  |  | import numpy as np | 
|  |  |  | import matplotlib.pyplot as plt | 
|  |  |  | import matplotlib.cm as cm | 
|  |  |  | from scipy.interpolate import interp1d | 
|  |  |  | from wdata.io import WData, Var | 
|  |  |  |  | 
|  |  |  | # This data set contains vortex solution of SLADE functional. | 
|  |  |  | # It is provided as supplementary material of publication: | 
|  |  |  | #   todo | 
|  |  |  | fwtxt="/home/gabrielw/Desktop/st-vortex/sv-ddcc05p00-T0p05.wtxt" | 
|  |  |  | data = WData.load(fwtxt) | 
|  |  |  |  | 
|  |  |  | j_a = data.j_a[-1] # last frame | 
|  |  |  | rho_a = data.rho_a[-1] # last frame | 
|  |  |  |  | 
|  |  |  | x = data.xyz[0] | 
|  |  |  | sec=int(data.Nxyz[0]/2) | 
|  |  |  | j_a = j_a[0,sec,:]      # extract x component of j_a along y axis for x=Nx/2 (center of box) | 
|  |  |  | rho_a = rho_a[sec,:]    # extract rho_a along y axis for x=Nx/2 (center of box) | 
|  |  |  | vs = np.abs(j_a/rho_a)  # computer velocity (absolute value) | 
|  |  |  |  | 
|  |  |  | # interpolate data | 
|  |  |  | vs_int = interp1d(x[:,0], vs, kind='quadratic') | 
|  |  |  | newx=np.linspace(-20,20,200) | 
|  |  |  |  | 
|  |  |  | # flow for ideal vortex | 
|  |  |  | r = np.linspace(3,40,100)    # take range [3-40] | 
|  |  |  | vs_ideal = 0.5 / r           # vs=1/2r (m=hbar=1, and factor 2 accounts for Cooper pairs) | 
|  |  |  |  | 
|  |  |  | # plot | 
|  |  |  | fig, ax = plt.subplots() | 
|  |  |  | ax.plot(x, vs, 'bo', markersize=3, label='data') | 
|  |  |  | ax.plot(newx, vs_int(newx), 'b', linestyle="-") | 
|  |  |  | ax.plot(r, vs_ideal, color="k", linestyle="--", label=r'$\sim 1/r$') | 
|  |  |  | ax.plot(r*(-1.0), vs_ideal, color="k", linestyle="--") | 
|  |  |  |  | 
|  |  |  | ax.set(xlabel='y', ylabel=r'$v(0,y)$') | 
|  |  |  | ax.set_xlim([-20,20]) | 
|  |  |  | ax.grid() | 
|  |  |  | plt.legend(loc='upper right') | 
|  |  |  |  | 
|  |  |  | fig.savefig("velocity.png") | 
|  |  |  | plt.show() | 
|  |  |  | ``` | 
|  |  |  | Output | 
|  |  |  |  | 
|  |  |  | \ No newline at end of file |