Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ice_ocean_SIS2/FLOR2/INPUT/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Undo *.nc in top-level .gitignore
!*.nc
9 changes: 9 additions & 0 deletions ice_ocean_SIS2/FLOR2/INPUT/MOM_channels_FLOR
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
! This file specifies restricted channel widths in MOM. The order is:
! [U|V]_width, min_longitude, max_longitude, min_latitude, max_latitude, width

U_width, -5.9, -5.4, 35.8, 36.2, 12000.0 ! Gibraltar
U_width, 26.4, 26.8, 40.4, 40.6, 5000.0 ! Dardanelles

V_width, 28.8, 29.4, 41.1, 41.2, 2500.0 ! Bosporus - should be 1km wide.
V_width, 43.25, 43.5, 12.6, 12.8, 10000.0 ! Red Sea, Bab-el-Mendeb
V_width, 141.5, 141.7, 52.0, 52.15, 2500.0 ! Between Sakhalin & Russia
1 change: 1 addition & 0 deletions ice_ocean_SIS2/FLOR2/INPUT/WOA05_pottemp_salt.nc
1 change: 1 addition & 0 deletions ice_ocean_SIS2/FLOR2/INPUT/grid_spec.nc
1 change: 1 addition & 0 deletions ice_ocean_SIS2/FLOR2/INPUT/land_mask.nc
Binary file added ice_ocean_SIS2/FLOR2/INPUT/layer_coord.nc
Binary file not shown.
1 change: 1 addition & 0 deletions ice_ocean_SIS2/FLOR2/INPUT/ncar_precip.clim.nc
1 change: 1 addition & 0 deletions ice_ocean_SIS2/FLOR2/INPUT/ncar_rad.clim.nc
1 change: 1 addition & 0 deletions ice_ocean_SIS2/FLOR2/INPUT/ocean_hgrid.nc
1 change: 1 addition & 0 deletions ice_ocean_SIS2/FLOR2/INPUT/ocean_mask.nc
1 change: 1 addition & 0 deletions ice_ocean_SIS2/FLOR2/INPUT/ocean_mosaic.nc
1 change: 1 addition & 0 deletions ice_ocean_SIS2/FLOR2/INPUT/q_10_mod.clim.nc
1 change: 1 addition & 0 deletions ice_ocean_SIS2/FLOR2/INPUT/runoff.nc
1 change: 1 addition & 0 deletions ice_ocean_SIS2/FLOR2/INPUT/slp.clim.nc
1 change: 1 addition & 0 deletions ice_ocean_SIS2/FLOR2/INPUT/t_10_mod.clim.nc
1 change: 1 addition & 0 deletions ice_ocean_SIS2/FLOR2/INPUT/tidal_amplitude.nc
1 change: 1 addition & 0 deletions ice_ocean_SIS2/FLOR2/INPUT/topog.nc
1 change: 1 addition & 0 deletions ice_ocean_SIS2/FLOR2/INPUT/u_10_mod.clim.nc
1 change: 1 addition & 0 deletions ice_ocean_SIS2/FLOR2/INPUT/v_10_mod.clim.nc
69 changes: 69 additions & 0 deletions ice_ocean_SIS2/FLOR2/INPUT/vgrid.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import numpy
import math

def dzIter(nk, Htot, dzTop, Huniform, fnPow, prec):
"""
Optimizes the highest ratio dzFn so that the sum(dz)=Htot.
"""
def dzFn(nk, Huniform, dzTop, fnPow, zFac):
"""
Returns dz = dzTop * ( 1 + zFac \int \fn(k) dk ) and sum(dz).
"""
dz = numpy.ones(nk) * dzTop
k = math.ceil( Huniform/dzTop )
dz = dzTop * numpy.cumprod( 1. + zFac * (fn( numpy.linspace(1, nk, nk).astype(numpy.float64), k, nk )**fnPow) )
return dz, numpy.sum(dz)

def fn(z, z0, z1):
"""
Cosine bell function between z0 and z1 s.t. f(z<z0)=0 and f(z>z1)=0.
"""
zStar = (z-z0)/(z1-z0) # non-dimensional coordinate 0..1
zStar = numpy.maximum(0., zStar)
zStar = numpy.minimum(1., zStar)
return 0.5*(1. - numpy.cos(2.*math.pi*zStar))

def optimizeZfac(nk, Htot, dzTop, Huniform, fnPow, prec):
"""
Optimizes the highest ratio dzFn() so that the sum(dz)=Htot.
"""
it = 0
zc0 = 0; dz, H0 = dzFn( nk, Huniform, dzTop, fnPow, zc0 )
zc2 = 2; dz, H2 = dzFn( nk, Huniform, dzTop, fnPow, zc2 )
while H2-H0 > prec/8 and it<200: # Binary search
zc1 = (zc0 + zc2)/2; dz, H1 = dzFn( nk, Huniform, dzTop, fnPow, zc1 )
if Htot<H1: zc2, H2 = 1.*zc1, 1.*H1
else: zc0, H0 = 1.*zc1, 1.*H1
it += 1
#print 'zFac=',zc1,'max ratio=',(dz[1:]/dz[:-1]).max()
return dz

def roundDz(nk, Htot, dzTop, Huniform, fnPow, prec):
"""
Returns dz = optimizeZfac() rounded to the precision "prec", and sum(dz).
"""
dz = prec * numpy.rint( optimizeZfac(nk, Htot, dzTop, Huniform, fnPow, prec)/prec ) # Round to a given precision
return dz, numpy.sum(dz)

dz, H = roundDz( nk, Htot, dzTop, Huniform, fnPow, prec )
return dz

def zFromDz(dz):
"""
Sums dz to return zInterface and zCenter.
"""
zInt = zeros(dz.shape[0]+1)
zInt[1:] = -numpy.cumsum(dz)
zCenter = 0.5*( zInt[:-1] + zInt[1:] )
return zInt, zCenter

nk = 75 # number of levels
Htot=6500 # deepest ocean point
Huniform = 0 # upper region of uniform resolution
dzTop = 2 # thickness of top level
fnPow = 1.42865 # ???
prec = .01 # precision to round thicknesses/depths todz = dzIter(nk, Htot, dzTop, Huniform, fnPow, prec)
dz = dzIter(nk, Htot, dzTop, Huniform, fnPow, prec)
print 'dz=',dz
print 'sum(dz)=',numpy.sum(dz)
print 'max ratio=',(dz[1:]/dz[:-1]).max()
Binary file added ice_ocean_SIS2/FLOR2/INPUT/vgrid_75_2m.nc
Binary file not shown.
Loading