def LambDipole(model, U=.01,R = 1.):
""" Generate Lamb's dipole vorticity field.
Parameters
-----------
U: float
Translation speed (dipole's strength).
R: float
Diple's radius.
Return
-------
q: array of floats
Vorticity (physical space).
"""
N = model.nx
x, y = model.x, model.y
x0,y0 = x[N//2,N//2],y[N//2,N//2]
r = np.sqrt( (x-x0)**2 + (y-y0)**2 )
s = np.zeros_like(r)
for i in range(N):
for j in range(N):
if r[i,j] == 0.:
s[i,j] = 0.
else:
s[i,j] = (y[i,j]-y0)/r[i,j]
lam = (3.8317)/R
C = -(2.*U*lam)/(special.j0(lam*R))
q = np.zeros_like(r)
q[r<=R] = C*special.j1(lam*r[r<=R])*s[r<=R]
return q
评论列表
文章目录