As a side remark here is that setting pmask=2 is acceptable along straight boundaries
to account for the fact that tangential velocity is located half-grid interval from the boundary,
and therefore
Code: Select all
pmask(i,j)*(u(i,j,k) - u(i,j-1,k))
accurate evaluates derivarive near the boundary, if one of the points, say u(i,j-1,k)=0
because it is masked, while the other, u(i,j,k) is inside the domain, but half grid interval
from the boundary. Then pmask=2 recovers the factor of 2.
However, doing so is wrong near the coastline which is eiter 45-degree to the grid primary
direction (hence the coastline passes through both u- and v-points), or near convex
corners because it leads to an overestimate of tangential stress by a factor of 2.
Therefore, the code mentioned here,
Code: Select all
IF (gamma2.lt.0.0_r8) THEN
DO j=Jstr,Jend
DO i=Istr,Iend
pmask(i,j)=2.0_r8-pmask(i,j)
END DO
END DO
END IF
should be replaced with
Code: Select all
!
! Set no-slip boundary conditions on land-mask boundaries
! regardless of supplied value of gamma2.
!
cff1=1. !<-- computation of off-diagonal nonlinear terms
cff2=2.
if (rmask(i-1,j ).gt.0.5 .and. rmask(i,j ).gt.0.5 .and.
& rmask(i-1,j-1).gt.0.5 .and. rmask(i,j-1).gt.0.5) then
pmask(i,j)=1.
elseif(rmask(i-1,j ).lt.0.5 .and.rmask(i,j ).gt.0.5 .and.
& rmask(i-1,j-1).gt.0.5 .and.rmask(i,j-1).gt.0.5) then
pmask(i,j)=cff1
elseif(rmask(i-1,j ).gt.0.5 .and.rmask(i,j ).lt.0.5 .and.
& rmask(i-1,j-1).gt.0.5 .and.rmask(i,j-1).gt.0.5) then
pmask(i,j)=cff1
elseif(rmask(i-1,j ).gt.0.5 .and.rmask(i,j ).gt.0.5 .and.
& rmask(i-1,j-1).lt.0.5 .and.rmask(i,j-1).gt.0.5) then
pmask(i,j)=cff1
elseif(rmask(i-1,j ).gt.0.5 .and.rmask(i,j ).gt.0.5 .and.
& rmask(i-1,j-1).gt.0.5 .and.rmask(i,j-1).lt.0.5) then
pmask(i,j)=cff1
elseif(rmask(i-1,j ).gt.0.5 .and.rmask(i,j ).lt.0.5 .and.
& rmask(i-1,j-1).gt.0.5 .and.rmask(i,j-1).lt.0.5) then
pmask(i,j)=cff2
elseif(rmask(i-1,j ).lt.0.5 .and.rmask(i,j ).gt.0.5 .and.
& rmask(i-1,j-1).lt.0.5 .and.rmask(i,j-1).gt.0.5) then
pmask(i,j)=cff2
elseif(rmask(i-1,j ).gt.0.5 .and.rmask(i,j ).gt.0.5 .and.
& rmask(i-1,j-1).lt.0.5 .and.rmask(i,j-1).lt.0.5) then
pmask(i,j)=cff2
elseif(rmask(i-1,j ).lt.0.5 .and.rmask(i,j ).lt.0.5 .and.
& rmask(i-1,j-1).gt.0.5 .and.rmask(i,j-1).gt.0.5) then
pmask(i,j)=cff2
else
pmask(i,j)=0.
endif
which is a part of "setup_grid1.F" (or "metrics.F" in Rutgers codes).
Originally this matter was discovered in late 2004 during study of island wakes which it its
simplest configuration boils down to flow around cylinder made of masked points. It was
found that uniformy setting pmask=2 whenever it touches land makes the cylinger island
behave more like steppy polygon with vorticity generated predominantly at the points
where boundary bends. The above code, with pmask=1 at corner points and 2 at straight
90-degree segments gives smoother flow.
This was reported back then, but somehow slipped through and did not appear in the
officially released codes.