10 use init_mod ,
only : nlevs, nxr, nyr
11 use init_mod,
only : debug, logunit
13 use arrays_mod,
only : hmin, maskspval, b3d, nbilin3d, rgb3d, eta
31 subroutine calc_eta(fname,dims,bathy)
33 character(len=*),
intent(in) :: fname
34 integer,
intent(in) :: dims(:)
35 real(kind=8),
intent(in) :: bathy(:)
40 real(kind=8),
allocatable,
dimension(:) :: ssh,dilate
41 real(kind=8),
allocatable,
dimension(:,:) :: h
42 real(kind=8),
allocatable,
dimension(:,:) :: etmp
43 character(len=20) :: subname =
'calc_eta' 46 if (debug)
write(logunit,
'(a)')
'enter '//trim(subname)
48 allocate(ssh(dims(1)*dims(2))); ssh = 0.0
49 allocate(dilate(dims(1)*dims(2))); dilate = 0.0
50 allocate(h(dims(3),dims(1)*dims(2))); h = 0.0
52 allocate(etmp(dims(3)+1,dims(1)*dims(2))); etmp = 0.0
54 call getfield(trim(fname),
'sfc', (/dims(1),dims(2)/), ssh)
55 call getfield(trim(fname),
'h', (/dims(1),dims(2),dims(3)/), h)
58 etmp(dims(3)+1,:) = -bathy(:)
60 etmp(k,:) = etmp(k+1,:) + h(k,:)
63 do i = 1,dims(1)*dims(2)
64 denom = etmp(1,i) + bathy(i)
65 if (denom .ne. 0.0)
then 66 dilate(i) = (ssh(i) + bathy(i)) / (etmp(1,i) + bathy(i))
72 eta(k,:) = dilate(:)*(etmp(k,:) + bathy(:)) - bathy(:)
75 if (debug)
write(logunit,
'(a)')
'exit '//trim(subname)
76 end subroutine calc_eta
85 integer :: idx1, klast
86 character(len=20) :: subname =
'vfill' 89 if (debug)
write(logunit,
'(a)')
'enter '//trim(subname)
93 if (trim(b3d(n)%var_name) .eq.
'h') idx1 = n
99 if (rgb3d(idx1,k,i) .lt. maskspval)klast = k
103 if (trim(b3d(n)%var_name) .eq.
'h')
then 106 rgb3d(n,k,i) = rgb3d(n,klast,i)
112 if (debug)
write(logunit,
'(a)')
'exit '//trim(subname)
114 end module ocncalc_mod