forked from HYCOM/HYCOM-src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dpthuv.F90
124 lines (124 loc) · 3.58 KB
/
dpthuv.F90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#if defined(ROW_LAND)
#define SEA_Q .true.
#elif defined(ROW_ALLSEA)
#define SEA_Q alliq(j).or.iq(i,j).ne.0
#else
#define SEA_Q iq(i,j).ne.0
#endif
subroutine dpthuv
use mod_xc ! HYCOM communication interface
use mod_cb_arrays ! HYCOM saved arrays
implicit none
!
! --- define water depth (bottom pressure) at u,v points and barotp.pot.vort.
!
integer i,j,l,margin
!
! --- depth at u,v points
real uvdep,a,b
uvdep(a,b)=min(a,b)
!
! --- initialize ports.
!
#if ! defined(RELO)
if (lbflag.eq.1) then
call latbdp( 0)
elseif (lbflag.eq.3) then
call latbdf( 0,0)
endif
#endif
if (lbflag.eq.2) then
call latbdt( 0,0)
elseif (lbflag.eq.4) then
call latbdtf(0,0)
else
!$OMP PARALLEL DO PRIVATE(j,i) &
!$OMP SCHEDULE(STATIC,jblk)
do j= 1-nbdy,jj+nbdy
do i= 1-nbdy,ii+nbdy
iuopn(i,j) = 0
ivopn(i,j) = 0
enddo
enddo
endif
!
call xctilr(pbot, 1,1, nbdy,nbdy, halo_ps)
call xctilr(corio,1,1, nbdy,nbdy, halo_qs)
!
! --- rhs: pbot+,corio+
! --- lhs: depthu, depthv, pvtrop+
!
margin = 1
!
do j=1-margin,jj+margin
do l=1,isu(j) !ok
i=ifu(j,l)-1
if (i.ge.1-margin) then
if (iuopn(i,j).ne.0) then
depthu(i,j)=pbot(i ,j)
! write(lp,*) 'depthu - i,j,d = ',
! & i+i0,j+j0,depthu(i,j)*qonem
endif
endif
i=ilu(j,l)+1
if (i.le.ii+margin) then
if (iuopn(i,j).ne.0) then
depthu(i,j)=pbot(i-1,j)
! write(lp,*) 'depthu - i,j,d = ',
! & i+i0,j+j0,depthu(i,j)*qonem
endif
endif
do i=max(1-margin,ifu(j,l)),min(ii+margin,ilu(j,l))
depthu(i,j)=uvdep(pbot(i,j),pbot(i-1,j))
pvtrop(i,j )=corio(i,j )*2./(pbot(i,j)+pbot(i-1,j))
pvtrop(i,j+1)=corio(i,j+1)*2./(pbot(i,j)+pbot(i-1,j))
enddo
enddo
enddo
call xcsync(flush_lp)
!
do i=1-margin,ii+margin
do l=1,jsv(i) !ok
j=jfv(i,l)-1
if (j.ge.1-margin) then
if (ivopn(i,j).ne.0) then
depthv(i,j)=pbot(i,j )
! write(lp,*) 'depthv - i,j,d = ',
! & i+i0,j+j0,depthv(i,j)*qonem
endif
endif
j=jlv(i,l)+1
if (j.le.jj+margin) then
if (ivopn(i,j).ne.0) then
depthv(i,j)=pbot(i,j-1)
! write(lp,*) 'depthv - i,j,d = ',
! & i+i0,j+j0,depthv(i,j)*qonem
endif
endif
do j=max(1-margin,jfv(i,l)),min(jj+margin,jlv(i,l))
depthv(i,j)=uvdep(pbot(i,j),pbot(i,j-1))
pvtrop(i ,j)=corio(i ,j)*2./(pbot(i,j)+pbot(i,j-1))
pvtrop(i+1,j)=corio(i+1,j)*2./(pbot(i,j)+pbot(i,j-1))
enddo
enddo
enddo
call xcsync(flush_lp)
!
!$OMP PARALLEL DO PRIVATE(j,l,i) &
!$OMP SCHEDULE(STATIC,jblk)
do j=1,jj
do i=1,ii
if (SEA_Q) then
pvtrop(i,j)=corio(i,j)*4./(pbot(i,j )+pbot(i-1,j ) &
+pbot(i,j-1)+pbot(i-1,j-1))
endif !iq
enddo !i
enddo !j
!
call xctilr(depthu,1,1, nbdy,nbdy, halo_us)
call xctilr(depthv,1,1, nbdy,nbdy, halo_vs)
call xctilr(pvtrop,1,1, nbdy,nbdy, halo_qs)
return
end subroutine dpthuv
!> May 2014 -- use land/sea masks (e.g. iq) to skip land
!> May 2014 -- removed lbflag==6 for latbdtc