14 use grdvars, only : x,y,xsgp1,ysgp1,sg_maxlat
15 use grdvars, only : latbu,lonbu,lonct
28 integer :: i,j,i1,i2,m,n
31 integer(int_kind) :: ipolesg(2)
34 real(dbl_kind) :: len_lon
35 real(dbl_kind) :: pi_720deg
36 real(dbl_kind) :: lonb(2,2)
37 real(dbl_kind) :: lon_scale = 0.0
44 xsgp1 = 0.0; ysgp1 = 0.0
49 if(y(i,j) .eq. sg_maxlat)ipolesg(1) = i
52 if(y(i,j) .eq. sg_maxlat)ipolesg(2) = i
54 if(debug)print *,
'poles found at ',ipolesg
56 xsgp1(:,0:ny) = x(:,0:ny)
57 ysgp1(:,0:ny) = y(:,0:ny)
60 do i = ipolesg(1)-5,ipolesg(1)+5
61 i2 = ipolesg(2)+(ipolesg(1)-i)+1
65 do i = ipolesg(2)-5,ipolesg(2)+5
66 i2 = ipolesg(2)+(ipolesg(1)-i)+1
72 i2 = ipolesg(2)+(ipolesg(1)-i)
73 xsgp1(i,ny+1) = xsgp1(i2,ny)
74 ysgp1(i,ny+1) = ysgp1(i2,ny)
79 i1 = ipolesg(1); i2 = ipolesg(2)-(ipolesg(1)-i1)
80 print *,
'replicate X across seam on SG'
81 print *,xsgp1(i1-2,j),xsgp1(i2+2,j)
82 print *,xsgp1(i1-1,j),xsgp1(i2+1,j)
83 print *,xsgp1(i1, j),xsgp1(i2, j)
84 print *,xsgp1(i1+1,j),xsgp1(i2-1,j)
85 print *,xsgp1(i1+2,j),xsgp1(i2-2,j)
87 print *,
'replicate Y across seam on SG'
88 print *,ysgp1(i1-2,j),ysgp1(i2+2,j)
89 print *,ysgp1(i1-1,j),ysgp1(i2+1,j)
90 print *,ysgp1(i1, j),ysgp1(i2, j)
91 print *,ysgp1(i1+1,j),ysgp1(i2-1,j)
92 print *,ysgp1(i1+2,j),ysgp1(i2-2,j)
101 pi_720deg = atan(1.0) / 180.0
103 do j=1,ny ;
do i=1,nx-1
107 lon_scale = cos(pi_720deg*(ysgp1(i-1,j-1) + ysgp1(i+1,j-1) + &
108 ysgp1(i-1,j+1) + ysgp1(i+1,j+1)) )
109 angq(i,j) = atan2(lon_scale*((lonb(1,2) - lonb(2,1)) + (lonb(2,2) - lonb(1,1))), &
110 ysgp1(i-1,j+1) + ysgp1(i+1,j+1) - &
111 ysgp1(i-1,j-1) - ysgp1(i+1,j-1) )
117 i1 = ipolesg(1); i2 = ipolesg(2)-(ipolesg(1)-i1)
118 print *,
'angq along seam on SG'
119 print *,angq(i1-2,j),angq(i2+2,j)
120 print *,angq(i1-1,j),angq(i2+1,j)
121 print *,angq(i1, j),angq(i2, j)
122 print *,angq(i1+1,j),angq(i2-1,j)
123 print *,angq(i1+2,j),angq(i2-2,j)
138 real(dbl_kind) :: len_lon
139 real(dbl_kind) :: pi_720deg
140 real(dbl_kind) :: lonb(2,2)
141 real(dbl_kind) :: lon_scale = 0.0
152 pi_720deg = atan(1.0) / 180.0
154 do j=1,nj;
do i = 1,ni
156 jj = j+n-2; ii = i+m-2
165 lon_scale = cos(pi_720deg*((latbu(ii,jj) + latbu(i,j)) + &
166 (latbu(i,jj) + latbu(ii,j)) ) )
167 anglet(i,j) = atan2(lon_scale*((lonb(1,2) - lonb(2,1)) + (lonb(2,2) - lonb(1,1))), &
168 (latbu(ii,j) - latbu(i,jj)) + &
169 (latbu(i,j) - latbu(ii,jj)) )
191 real(dbl_kind),
intent(in) :: x
192 real(dbl_kind),
intent(in) :: xc
193 real(dbl_kind),
intent(in) :: lx
194 real(dbl_kind) :: x_mod
197 x_mod = modulo(x - (xc - 0.5*lx), lx) + (xc - 0.5*lx)
subroutine find_ang
Find the rotation angle on center (Ct) grid points.
real(dbl_kind) function modulo_around_point(x, xc, Lx)
Return the modulo value of x in an interval [xc-(Lx/2) xc+(Lx/2)] If Lx<=0, then it returns x without...
subroutine find_angq
Find the rotation angle on corner grid (Bu) points using the full MOM6 supergrid. ...