Commit b4c1553d authored by Veit Lüschow's avatar Veit Lüschow

first topo version ready for mistral

parent 87b7e002
......@@ -2,8 +2,8 @@
#from IPython import get_ipython
#get_ipython().magic('reset -sf')
# from side_tools import *
# clean()
from side_tools import *
clean()
from veros import VerosSetup, veros_method
from veros.tools import cli
......@@ -43,11 +43,11 @@ class DWBC2Setup(VerosSetup):
"""
GRID, TIMESTEP,...
"""
vs.nx, vs.ny, vs.nz = 30, 60, 30
vs.nx, vs.ny, vs.nz = 45, 100, 30
vs.dt_mom = 300 # normally 2400
vs.dt_tracer = 86400 / 16
vs.runlen = 86400 * 365 * 1
# vs.runlen = 86400 * 100
vs.runlen = 86400 * 100
# vs.restart_frequency = 86400 * 100
# vs.runlen = 100
......@@ -121,10 +121,20 @@ class DWBC2Setup(VerosSetup):
def set_topography(self, vs):
x, y = np.meshgrid(vs.xt, vs.yt, indexing='ij')
vs.kbot[:,:] = np.int(1)
vs.kbot[:3,:] = np.int(0)
vs.kbot[:3,:] = np.int(0) # western boundary
vs.kbot[3,:] = np.int(22) # slope
vs.kbot[4,:] = np.int(16)
vs.kbot[5,:] = np.int(10)
vs.kbot[6,:] = np.int(7)
vs.kbot[7,:] = np.int(5)
vs.kbot[8,:] = np.int(3)
vs.kbot[9,:] = np.int(2)
# import matplotlib.pyplot as plt
# plt.contourf(vs.kbot)
# plt.contourf(x,y,vs.kbot)
# plt.colorbar()
# raise SystemExit(0)
......@@ -135,9 +145,9 @@ class DWBC2Setup(VerosSetup):
Flow initial and restoring profile
"""
zcenter = 1500
zvariance = 3e5
xvariance = 1.2
xcenter = 5.5 # normally 16
zvariance = 2e5
xvariance = 1.1
xcenter = 6.5 # normally 16
xx,zz = np.meshgrid(vs.xt,vs.zt,indexing='ij')
uz = np.exp(- ( (zz+(zcenter) )**2 / zvariance ) ) # exponential decay in z
ux = np.exp(- ( (xx-(xcenter) )**2 / xvariance ) ) # gaussian in x
......@@ -145,11 +155,6 @@ class DWBC2Setup(VerosSetup):
vs.v_ini = allocate(vs, ('xt','yu','zt'))
vs.v_ini = -0.2 * np.tile(uu[:,np.newaxis,:],[1, vs.yu.shape[0] , 1]) * vs.maskV
# vs.v[...,0:2] = np.tile(vs.v_ini[...,np.newaxis],[1,1,1,2])
# vs.v[:,:2,:,0:2] = 0.
# vs.v[:,-3:,:,0:2] = 0.
"""
......@@ -163,7 +168,7 @@ class DWBC2Setup(VerosSetup):
vs.temp_surface = vs.temp[:,:,:,0].copy()
# import matplotlib.pyplot as plt
# plt.pcolormesh(xx,zz,vs.v[:,5,:,0])
# plt.pcolormesh(xx,zz,vs.v_ini[:,5,:])
# plt.colorbar()
# plt.show()
# raise SystemExit(0)
......@@ -220,23 +225,8 @@ class DWBC2Setup(VerosSetup):
Restoring timescales
"""
ytmp = np.zeros(vs.yt.shape[0])
ytmp[2:-2] = vs.yt[2:-2]
# t_tmp = 2-np.tanh((xtmp[-3]-xtmp)/1) + np.tanh((-xtmp)/2)
t_tmp = 1-np.tanh((ytmp[-4]-ytmp[:]))
t_tmp [-2:] = t_tmp[-3]
ft = np.flipud(t_tmp)
vs.t_restoring = allocate(vs,('xt','yt','zt'))
vs.t_restoring_tr = allocate(vs,('xt','yt','zt'))
# vs.t_restoring_tr = 2e-5 * np.tile((ft+t_tmp)[np.newaxis,:,np.newaxis],[vs.nx+4,1,vs.nz])
# vs.t_restoring[-3:,:,:] = 1 / (1e1 * vs.dt_mom)
# vs.t_restoring[-5:-3,:,:] = 1 / (2e1 * vs.dt_mom)
vs.tscl_tr = 2e-5
......@@ -245,7 +235,6 @@ class DWBC2Setup(VerosSetup):
@veros_method
def set_forcing(self, vs):
pass
# vs.dv_rest[...] = vs.maskV * vs.t_restoring * (vs.v_ini[...] - vs.v[...,vs.tau])
vs.temp_source[...] = vs.maskT * vs.t_restoring_tr * (vs.temp_surface - vs.temp[... , vs.tau])
......@@ -254,7 +243,7 @@ class DWBC2Setup(VerosSetup):
@veros_method
def set_diagnostics(self, vs):
vs.diagnostics['snapshot'].output_frequency = 86400. * 1.
vs.diagnostics['snapshot'].output_frequency = 1 * 86400
#vs.diagnostics['snapshot'].output_frequency = 1.
vs.diagnostics['snapshot'].output_variables = (
'temp', 'psi', 'u', 'v', 'w', 'coriolis_t','rho','salt'
......
......@@ -31,6 +31,8 @@ class section:
self.var[axis]
if axis == 'xu':
self.data = self.var.isel(xu=position).isel(Time=timestep)
if axis == 'yu':
self.data = self.var.isel(yu=position).isel(Time=timestep)
elif axis == 'yt':
self.data = self.var.isel(yt=position).isel(Time=timestep)
elif axis == 'zt':
......@@ -61,7 +63,7 @@ p = section('dwbc2.snapshot.nc','v')
high=0.2
plt.figure()
p.select(360,'zt',15).plot.contourf(vmin=-high,vmax=high,levels=30,cmap='RdBu_r')
p.select(99,'yu',15).plot.contourf(levels=30,cmap='RdBu_r')
#
# plt.colorbar()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment