0

我正在尝试为 eady 流函数模型定义一些函数,如下一行所示:

# Geometry of the wave / domain / mean state:
Lx = 3800                          # Zonal Wavelength in km
H = 10000                          # tropopause height in meters
Shear = 30/H                       # shear in sec^-1

k = 2*np.pi/(Lx*1000)              # wavenumber (zonal)
l = np.pi/3.e6                     # meridional wavenumber in 1/m

# Constants:
cor = 2*(7.292e-5)*np.sin(np.pi/4) # Coriolis parameter
bv2 = 1.e-4                        # buoyancy frequency squared
sigma = 2.e-6                      # static stability parameter
R = 287                            # gas constant

# Grid points on which fields are computed:
xx = np.linspace(0,1.5*Lx,151)     # gridpoints in x
yy = np.linspace( -1500,1500,101)  # gridpoints in y
zz = np.linspace(0,H,51)           # gridpoints in z

# Set array for grid system in x, y, and z
x,y,z = np.meshgrid(xx*1000, yy*1000, zz)

# Define coefficients for the model
mu2 = ((bv2*(H**2))/cor**2)*(k**2 + l**2)
mu = np.sqrt(mu2)
c = (Shear*H/2) + ((Shear*H)/mu)*np.sqrt((mu/2 - coth(mu/2))*(mu/2 - tanh(mu/2)))
# Note: try switching this to (Shear*H/2) - (Shear*H/mu)*...

ci = np.imag(c)
cr = np.real(c)
t = 0*np.pi/(10*cr*k)

A = 2.e7                     # streamfunction amplitude (arbitrary)
B = -A*Shear*H/(mu*c)
Psi_z = A*cosh(mu*z/H) + B*sinh(mu*z/H)

我注意到在使用以下消息获取数组的双曲 sin 和 cos 时出现错误:

TypeError: cannot create mpf from array (mu*z/H) for both sin and cos. 

我以前从未遇到过此错误消息,因此我不够熟悉,无法尝试找出解决此错误的方法。

4

0 回答 0