In [35]:
import numpy as np
from numpy import pi
import matplotlib.pyplot as plt
%matplotlib inline
import pyqg
In [43]:
# the model object
year = 1.
U0 = -.01
dt = 0.01
nmax = 10000 # of timesteps
m = pyqg.BTModel(L=2.*pi,nx=256, tmax = nmax*dt,
beta = 0., U = U0, H = 1., rek = 0., rd = None, dt = dt,
taveint=year, ntd=4)
In [44]:
N = m.nx
R = 0.75
E0 = .5
U = -m.U
import scipy.special as special
x, y = m.x, m.y
x0,y0 = x[N/2,N/2],y[N/2,N/2]
r = np.sqrt( (x-x0)**2 + (y-y0)**2 )
s = np.ma.zeros(r.shape)
s = (y-y0)/r
s = np.ma.masked_invalid(s).filled(0.)
lam = (pi*1.2197)/R
# Lamb's
C = (-2.*U*lam)/(special.j0(lam*R))
qi = np.zeros_like(r)
qi[r<=R] = C*special.j1(lam*r[r<R])*s[r<R]
In [45]:
m.set_q(qi[np.newaxis])
In [46]:
plt.imshow(m.q[0])
plt.colorbar()
Out[46]:
In [47]:
m.run()
In [53]:
plt.imshow(m.q[0])
plt.colorbar()
Out[53]:
In [ ]: