Back to home page

MITgcm

 
 

    


File indexing completed on 2021-09-24 05:17:27 UTC

view on githubraw file Latest commit 3bb0c0ba on 2021-09-23 16:31:24 UTC
ce0d9af5ea Jeff*0001 import numpy as np
                0002 from numpy import cos, pi
                0003 
                0004 Ho = 1800  # depth of ocean (m)
                0005 nx = 62    # gridpoints in x
                0006 ny = 62    # gridpoints in y
                0007 xo = 0     # origin in x,y for ocean domain
                0008 yo = 15    # (i.e. southwestern corner of ocean domain)
                0009 dx = 1     # grid spacing in x (degrees longitude)
                0010 dy = 1     # grid spacing in y (degrees latitude)
                0011 xeast  = xo + (nx-2)*dx   # eastern extent of ocean domain
                0012 ynorth = yo + (ny-2)*dy   # northern extent of ocean domain
                0013 
                0014 # Flat bottom at z=-Ho
                0015 h = -Ho * np.ones((ny, nx))
                0016 
                0017 # create a border ring of walls around edge of domain
                0018 h[:, [0,-1]] = 0   # set ocean depth to zero at east and west walls
                0019 h[[0,-1], :] = 0   # set ocean depth to zero at south and north walls
                0020 # save as single-precision (float32) with big-endian byte ordering
                0021 h.astype('>f4').tofile('bathy.bin')
                0022 
                0023 # ocean domain extends from (xo,yo) to (xeast,ynorth)
                0024 # (i.e. the ocean spans nx-2, ny-2 grid cells)
                0025 # out-of-box-config: xo=0, yo=15, dx=dy=1 deg, ocean extent (0E,15N)-(60E,75N)
                0026 # model domain includes a land cell surrounding the ocean domain
                0027 # The full model domain cell centers are located at:
                0028 #    XC(:,1) = -0.5, +0.5, ..., +60.5 (degrees longitiude)
                0029 #    YC(1,:) = 14.5, 15.5, ..., 75.5 (degrees latitude)
                0030 # and full model domain cell corners are located at:
                0031 #    XG(:,1) = -1,  0, ..., 60 [, 61] (degrees longitiude)
                0032 #    YG(1,:) = 14, 15, ..., 75 [, 76] (degrees latitude)
                0033 # where the last value in brackets is not included 
                0034 # in the MITgcm grid variables XG,YG (but is in variables Xp1,Yp1)
                0035 # and reflects the eastern and northern edge of the model domain respectively.
                0036 # See section 2.11.4 of the MITgcm users manual.
                0037 
                0038 # Zonal wind-stress
                0039 tauMax = 0.1
                0040 x = np.linspace(xo-dx, xeast, nx)
                0041 y = np.linspace(yo-dy, ynorth, ny) + dy/2
                0042 Y, X = np.meshgrid(y, x, indexing='ij')     # zonal wind-stress on (XG,YC) points
                0043 tau = -tauMax * cos(2*pi*((Y-yo)/(ny-2)/dy))  # ny-2 accounts for walls at N,S boundaries
                0044 tau.astype('>f4').tofile('windx_cosy.bin')
                0045 
3bb0c0ba57 Jeff*0046 # Restoring temperature (function of y only,
                0047 # from Tmax at southern edge to Tmin at northern edge)
ce0d9af5ea Jeff*0048 Tmax = 30
                0049 Tmin = 0
3bb0c0ba57 Jeff*0050 Trest = (Tmax-Tmin)/(ny-2)/dy * (ynorth-Y) + Tmin # located and computed at YC points
ce0d9af5ea Jeff*0051 Trest.astype('>f4').tofile('SST_relax.bin')