...
 
Commits (4)
......@@ -2,6 +2,7 @@ from .. import veros_method
from ..variables import allocate
from . import friction, isoneutral, streamfunction
from veros.core import utilities
@veros_method
def momentum(vs):
......@@ -71,12 +72,8 @@ def momentum(vs):
vs.dv[:, :, :, vs.tau] += vs.dv_adv
if vs.dwbc2:
print('linear at boundary')
# vs.du[:,:1,:,vs.tau] = vs.du[:,:1,:,vs.tau] - vs.du_adv[:,:1,:]
vs.du[:,:3,:,vs.tau] -= vs.du_adv[:,:3,:]
vs.du[:,-4:,:,vs.tau] -= vs.du_adv[:,-4:,:]
vs.dv[:,:3,:,vs.tau] -= vs.dv_adv[:,:3,:]
vs.dv[:,-4:,:,vs.tau] -= vs.dv_adv[:,-4:,:]
utilities.set_obc_momentum(vs)
"""
add momentum restoring that is computed in set_forcing
......
......@@ -55,11 +55,27 @@ def obc_boundaries(vs,arr):
@veros_method
def set_obc_temp_salt(vs):
print('do phase speed stuff')
vs.temp[:,2,:,vs.taup1] = vs.temp_ini[:,5,:].copy()
vs.temp[:,-4,:,vs.taup1] = vs.temp_ini[:,-5,:].copy()
# temp(:,j,:,taup1) = temp(:,j,:,taup1) + dt_tracer*maskT(:,j,:)*obc_tscl*(temp_wall_north - temp(:,j,:,tau) )
vs.temp[:,2,:,vs.taup1] = vs.temp[:,2,:,vs.taup1] + vs.dt_tracer \
* vs.tscl_tr * ( vs.temp_ini[:,5,:] - vs.temp[:,2,:,vs.tau] )
vs.temp[:,-4,:,vs.taup1] = vs.temp[:,-4,:,vs.taup1] + vs.dt_tracer \
* vs.tscl_tr * ( vs.temp_ini[:,-5,:] - vs.temp[:,-4,:,vs.tau] )
# vs.temp[:,2,:,vs.taup1] = vs.temp_ini[:,5,:].copy() # WORKS!
# vs.temp[:,-4,:,vs.taup1] = vs.temp_ini[:,-5,:].copy() # WORKS!
print('restore temp and salt')
@veros_method
def set_obc_momentum(vs):
print('linear momentum equation at boundaries')
vs.du[:,:3,:,vs.tau] -= vs.du_adv[:,:3,:]
vs.du[:,-4:,:,vs.tau] -= vs.du_adv[:,-4:,:]
vs.dv[:,:3,:,vs.tau] -= vs.dv_adv[:,:3,:]
vs.dv[:,-4:,:,vs.tau] -= vs.dv_adv[:,-4:,:]
print('danmping terms')
@veros_method(inline=True)
......
......@@ -230,25 +230,20 @@ class DWBC2Setup(VerosSetup):
ft = np.flipud(t_tmp)
vs.tscl_tr = 2e-5
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.t_restoring_tr[:,:,-1] = 2e-5
vs.t_restoring_tr[:,:,-2] = 1e-5
vs.t_restoring_tr[:,:,-1] = vs.tscl_tr
vs.t_restoring_tr[:,:,-2] = vs.tscl_tr / 2
@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])
# vs.salt_source[...] = vs.maskT * vs.t_restoring_tr * (35 - vs.salt[... , vs.tau])
vs.temp_source[...] = vs.maskT * vs.t_restoring_tr * (vs.temp_surface - vs.temp[... , vs.tau])
vs.salt_source[...] = vs.maskT * vs.t_restoring_tr * (35 - vs.salt[... , vs.tau])
@veros_method
......