New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
makebdy_tc7.py in branches/2016/dev_merge_2016/NEMOGCM/CONFIG/WAD_TEST_CASES/EXP00 – NEMO

source: branches/2016/dev_merge_2016/NEMOGCM/CONFIG/WAD_TEST_CASES/EXP00/makebdy_tc7.py @ 7609

Last change on this file since 7609 was 7609, checked in by acc, 7 years ago

Branch 2016/dev_merge_2016. Additional WAD test case with a sinusoidally forced open boundary. Changes include additions to usrdef routines (WAD_TEST_CASES/MYSRC), configuration namelist and documentation only

File size: 2.0 KB
Line 
1from netCDF4 import Dataset
2import numpy as np
3
4pathout = "bdyssh_tc7"
5
6nx = 34 
7ny = 1
8nt = 24
9ndays=4
10
11#-------------------------------------------------------
12# Create bdyssh_tc7_m01d01.nc, bdyssh_tc7_m01d02.nc etc.
13#-------------------------------------------------------
14
15pathstart="{}_m12d30.nc".format(pathout)
16for nd in range(ndays):
17 print pathstart
18 ssh = np.zeros((nt,ny,nx))
19 for nnt in range(nd*nt,(nd+1)*nt):
20   tx = 2.5*np.cos((3.141592654/6.0)*(nnt+1.0))
21   print nnt, tx
22   for nnx in range(nx):
23     for nny in range(ny):
24       ssh[nnt-nd*nt,nny,nnx] = tx
25
26
27 fo = Dataset(pathstart, 'w', format='NETCDF4')
28 nxo = fo.createDimension('x', nx)
29 nyo = fo.createDimension('y', ny)
30 nto = fo.createDimension('t', None)
31 ssho = fo.createVariable('sshbdy', 'f4',('t','y','x'))
32
33 ssho[:,:,:] = ssh[:,:,:]
34 ssho.long_name = 'bdy ssh boundary condition'
35 ssho.standard_name = 'sshbdy'
36 ssho.units = 'm'
37#
38 fo.close()
39 pathstart="{}_m01d{:0>2d}.nc".format(pathout,nd+1)
40
41#-------------------------------------------------------
42# Create bdyuv_tc7_m01d01.nc, bdyuv_tc7_m01d02.nc etc.
43# u is -(1/H)*d(ssh)/dt; v =0.0
44#-------------------------------------------------------
45
46pathout = "bdyuv_tc7"
47
48
49pathstart="{}_m12d30.nc".format(pathout)
50for nd in range(ndays):
51 print pathstart
52 u = np.zeros((nt,ny,nx))
53 for nnt in range(nd*nt,(nd+1)*nt):
54  tx = 2.5*(3.141592654/6.0)*np.sin((3.141592654/6.0)*(nnt+1.0))/10.0
55  print nnt, tx
56  for nnx in range(nx):
57    for nny in range(ny):
58       u[nnt-nd*nt,nny,nnx] = tx
59
60 v = np.zeros((nt,ny,nx))
61
62 fo = Dataset(pathstart, 'w', format='NETCDF4')
63 nxo = fo.createDimension('x', nx)
64 nyo = fo.createDimension('y', ny)
65 nto = fo.createDimension('t', None)
66 uo = fo.createVariable('ubdy', 'f4',('t','y','x'))
67 vo = fo.createVariable('vbdy', 'f4',('t','y','x'))
68
69 uo[:,:,:] = u[:,:,:]
70 uo.long_name = 'bdy u boundary condition'
71 uo.standard_name = 'ubdy'
72 uo.units = 'm/s'
73#
74 vo[:,:,:] = v[:,:,:]
75 vo.long_name = 'bdy v boundary condition'
76 vo.standard_name = 'vbdy'
77 vo.units = 'm/s'
78#
79 fo.close()
80 pathstart="{}_m01d{:0>2d}.nc".format(pathout,nd+1)
Note: See TracBrowser for help on using the repository browser.