Commit 904f1a4a authored by bjb's avatar bjb
Browse files

Consistent treatment of topo in halo zones

parent 5e8904dc
!$Id: domain.F90,v 1.32 2009-05-15 06:59:10 bjb Exp $
!$Id: domain.F90,v 1.33 2009-08-31 10:37:03 bjb Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -95,6 +95,9 @@
! Original author(s): Karsten Bolding & Hans Burchard
!
! $Log: domain.F90,v $
! Revision 1.33 2009-08-31 10:37:03 bjb
! Consistent treatment of topo in halo zones
!
! Revision 1.32 2009-05-15 06:59:10 bjb
! typo fix
!
......@@ -473,7 +476,7 @@
end if
end do
end do
call update_2d_halo(mask,mask,az,imin,jmin,imax,jmax,H_TAG)
call update_2d_halo(mask,mask,az,imin,jmin,imax,jmax,H_TAG,mirror=.false.)
call wait_halo(H_TAG)
au = mask
......@@ -493,7 +496,7 @@
end if
end do
end do
call update_2d_halo(mask,mask,az,imin,jmin,imax,jmax,H_TAG)
call update_2d_halo(mask,mask,az,imin,jmin,imax,jmax,H_TAG,mirror=.false.)
call wait_halo(H_TAG)
av = mask
......
!$Id: mirror_bdy_2d.F90,v 1.4 2007-05-14 08:12:43 kbk Exp $
!$Id: mirror_bdy_2d.F90,v 1.5 2009-08-31 10:37:03 bjb Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -30,6 +30,9 @@
! Original author(s): Karsten Bolding & Hans Burchard
!
! $Log: mirror_bdy_2d.F90,v $
! Revision 1.5 2009-08-31 10:37:03 bjb
! Consistent treatment of topo in halo zones
!
! Revision 1.4 2007-05-14 08:12:43 kbk
! fixed loops
!
......@@ -57,71 +60,55 @@
case (U_TAG)
do n = 1,NNB
j = nj(n)
f(nfi(n)-2,j) = f(nfi(n)-2,j-1)
f(nfi(n)-1,j) = f(nfi(n)-1,j-1)
do i = nfi(n),nli(n)
do i = nfi(n)-HALO,nli(n)+HALO
if (au(i,j) .eq. 3) f(i,j) = f(i,j-1)
end do
f(nli(n)+1,j) = f(nli(n)+1,j-1)
f(nli(n)+2,j) = f(nli(n)+2,j-1)
end do
end do
do n = 1,NSB
j = sj(n)
f(sfi(n)-2,j) = f(sfi(n)-2,j+1)
f(sfi(n)-1,j) = f(sfi(n)-1,j+1)
do i = sfi(n),sli(n)
do i = sfi(n)-HALO,sli(n)+HALO
if (au(i,j) .eq. 3) f(i,j) = f(i,j+1)
end do
f(sli(n)+1,j) = f(sli(n)+1,j+1)
f(sli(n)+2,j) = f(sli(n)+2,j+1)
end do
case (V_TAG)
do n = 1,NWB
i = wi(n)
f(i,wfj(n)-2) = f(i+1,wfj(n)-2)
f(i,wfj(n)-1) = f(i+1,wfj(n)-1)
do j = wfj(n),wlj(n)
do j = wfj(n)-HALO,wlj(n)+HALO
if (av(i,j) .eq. 3) f(i,j) = f(i+1,j)
end do
f(i,wlj(n)+1) = f(i+1,wlj(n)+1)
f(i,wlj(n)+2) = f(i+1,wlj(n)+2)
end do
do n = 1,NEB
i = ei(n)
f(i,efj(n)-2) = f(i-1,efj(n)-2)
f(i,efj(n)-1) = f(i-1,efj(n)-1)
do j = efj(n),elj(n)
do j = efj(n)-HALO,elj(n)+HALO
if (av(i,j) .eq. 3) f(i,j) = f(i-1,j)
end do
f(i,elj(n)+1) = f(i-1,elj(n)+1)
f(i,elj(n)+2) = f(i-1,elj(n)+2)
end do
case default
do n = 1,NWB
i = wi(n)
do j = wfj(n),wlj(n)
f(i-1,j) = f(i,j)
do j = wfj(n)-HALO,wlj(n)+HALO
if (az(i,j) .gt. 1) f(i-1,j) = f(i,j)
end do
end do
do n = 1,NNB
j = nj(n)
do i = nfi(n),nli(n)
f(i,j+1) = f(i,j)
do i = nfi(n)-HALO,nli(n)+HALO
if (az(i,j) .gt. 1) f(i,j+1) = f(i,j)
end do
end do
do n = 1,NEB
i = ei(n)
do j = efj(n),elj(n)
f(i+1,j) = f(i,j)
do j = efj(n)-HALO,elj(n)+HALO
if (az(i,j) .gt. 1) f(i+1,j) = f(i,j)
end do
end do
do n = 1,NSB
j = sj(n)
do i = sfi(n),sli(n)
f(i,j-1) = f(i,j)
do i = sfi(n)-HALO,sli(n)+HALO
if (az(i,j) .gt. 1) f(i,j-1) = f(i,j)
end do
end do
end select
......
!$Id: mirror_bdy_3d.F90,v 1.5 2007-06-07 10:25:19 kbk Exp $
!$Id: mirror_bdy_3d.F90,v 1.6 2009-08-31 10:37:03 bjb Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -30,6 +30,9 @@
! Original author(s): Karsten Bolding & Hans Burchard
!
! $Log: mirror_bdy_3d.F90,v $
! Revision 1.6 2009-08-31 10:37:03 bjb
! Consistent treatment of topo in halo zones
!
! Revision 1.5 2007-06-07 10:25:19 kbk
! iimin,iimax,jjmin,jjmax -> imin,imax,jmin,jmax
!
......@@ -62,85 +65,53 @@
case (U_TAG)
do n = 1,NNB
j = nj(n)
f(nfi(n)-2,j,:) = f(nfi(n)-2,j-1,:)
f(nfi(n)-1,j,:) = f(nfi(n)-1,j-1,:)
do i = nfi(n),nli(n)
do i = nfi(n)-HALO,nli(n)+HALO
if (au(i,j) .eq. 3) f(i,j,:) = f(i,j-1,:)
end do
f(nli(n)+1,j,:) = f(nli(n)+1,j-1,:)
f(nli(n)+2,j,:) = f(nli(n)+2,j-1,:)
end do
do n = 1,NSB
j = sj(n)
f(sfi(n)-2,j,:) = f(sfi(n)-2,j+1,:)
f(sfi(n)-1,j,:) = f(sfi(n)-1,j+1,:)
do i = sfi(n),sli(n)
do i = sfi(n)-HALO,sli(n)+HALO
if (au(i,j) .eq. 3) f(i,j,:) = f(i,j+1,:)
end do
f(sli(n)+1,j,:) = f(sli(n)+1,j+1,:)
f(sli(n)+2,j,:) = f(sli(n)+2,j+1,:)
end do
case (V_TAG)
do n = 1,NWB
i = wi(n)
f(i,wfj(n)-2,:) = f(i+1,wfj(n)-2,:)
f(i,wfj(n)-1,:) = f(i+1,wfj(n)-1,:)
do j = wfj(n),wlj(n)
do j = wfj(n)-HALO,wlj(n)+HALO
if (av(i,j) .eq. 3) f(i,j,:) = f(i+1,j,:)
end do
f(i,wlj(n)+1,:) = f(i+1,wlj(n)+1,:)
f(i,wlj(n)+2,:) = f(i+1,wlj(n)+2,:)
end do
do n = 1,NEB
i = ei(n)
f(i,efj(n)-2,:) = f(i+1,efj(n)-2,:)
f(i,efj(n)-1,:) = f(i+1,efj(n)-1,:)
do j = efj(n),elj(n)
do j = efj(n)-HALO,elj(n)+HALO
if (av(i,j) .eq. 3) f(i,j,:) = f(i-1,j,:)
end do
f(i,elj(n)+1,:) = f(i+1,elj(n)+1,:)
f(i,elj(n)+2,:) = f(i+1,elj(n)+2,:)
end do
case (H_TAG,D_TAG)
do n = 1,NWB
i = wi(n)
f(i-1,wfj(n)-2,:) = f(i,wfj(n)-2,:)
f(i-1,wfj(n)-1,:) = f(i,wfj(n)-1,:)
do j = wfj(n),wlj(n)
f(i-1,j,:) = f(i,j,:)
do j = wfj(n)-HALO,wlj(n)+HALO
if (az(i,j) .gt. 1) f(i-1,j,:) = f(i,j,:)
end do
f(i-1,wlj(n)+1,:) = f(i,wlj(n)+1,:)
f(i-1,wlj(n)+2,:) = f(i,wlj(n)+2,:)
end do
do n = 1,NNB
j = nj(n)
f(nfi(n)-2,j+1,:) = f(nfi(n)-2,j,:)
f(nfi(n)-1,j+1,:) = f(nfi(n)-1,j,:)
do i = nfi(n),nli(n)
f(i,j+1,:) = f(i,j,:)
do i = nfi(n)-HALO,nli(n)+HALO
if (az(i,j) .gt. 1) f(i,j+1,:) = f(i,j,:)
end do
f(nli(n)+1,j+1,:) = f(nli(n)+1,j,:)
f(nli(n)+2,j+1,:) = f(nli(n)+2,j,:)
end do
do n = 1,NEB
i = ei(n)
f(i+1,efj(n)-2,:) = f(i,efj(n)-2,:)
f(i+1,efj(n)-1,:) = f(i,efj(n)-1,:)
do j = efj(n),elj(n)
f(i+1,j,:) = f(i,j,:)
do j = efj(n)-HALO,elj(n)+HALO
if (az(i,j) .gt. 1) f(i+1,j,:) = f(i,j,:)
end do
f(i+1,elj(n)+1,:) = f(i,elj(n)+1,:)
f(i+1,elj(n)+2,:) = f(i,elj(n)+2,:)
end do
do n = 1,NSB
j = sj(n)
f(sfi(n)-2,j-1,:) = f(sfi(n)-2,j,:)
f(sfi(n)-1,j-1,:) = f(sfi(n)-1,j,:)
do i = sfi(n),sli(n)
f(i,j-1,:) = f(i,j,:)
do i = sfi(n)-HALO,sli(n)+HALO
if (az(i,j) .gt. 1) f(i,j-1,:) = f(i,j,:)
end do
f(sli(n)+1,j-1,:) = f(sli(n)+1,j,:)
f(sli(n)+2,j-1,:) = f(sli(n)+2,j,:)
end do
case default
end select
......
!$Id: ncdf_topo.F90,v 1.15 2007-05-26 15:20:37 kbk Exp $
!$Id: ncdf_topo.F90,v 1.16 2009-08-31 10:37:04 bjb Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -90,6 +90,9 @@
! Karsten Bolding and Hans Burchard)
!
! $Log: ncdf_topo.F90,v $
! Revision 1.16 2009-08-31 10:37:04 bjb
! Consistent treatment of topo in halo zones
!
! Revision 1.15 2007-05-26 15:20:37 kbk
! print NetCDF version info
!
......@@ -692,6 +695,7 @@ contains
integer :: status
integer :: il,ih,jl,jh,iloc,jloc,i,j
integer :: ilocl,iloch,jlocl,jloch
integer :: iskipl,jskipl
integer :: indx(1)
!
!-------------------------------------------------------------------------
......@@ -707,13 +711,28 @@ contains
end where
! GLOBAL index range for variable to be read
#define READ_HALOS
#ifdef READ_HALOS
il = max(imin-HALO+ioff,1); ih = min(imax+HALO+ioff,iextr)
jl = max(jmin-HALO+joff,1); jh = min(jmax+HALO+joff,jextr)
iskipl= il - (imin-HALO+ioff)
jskipl= jl - (jmin-HALO+joff)
#else
il = max(imin+ioff,1); ih = min(imax+ioff,iextr)
jl = max(jmin+joff,1); jh = min(jmax+joff,jextr)
#endif
! LOCAL index range for variable to be read
! (different from GLOBAL range only for parallel runs)
#ifdef READ_HALOS
ilocl = imin-HALO+iskipl;
jlocl = jmin-HALO+jskipl;
iloch = ih-il+ilocl; jloch = jh-jl+jlocl;
#else
ilocl = max(imin-ioff,1); jlocl = max(jmin-joff,1)
iloch = ih-il+ilocl; jloch = jh-jl+jlocl;
#endif
#undef READ_HALOS
! Read bathymetry
call ncdf_read_2d(ncbathy,bathymetry_id,H(ilocl:iloch,jlocl:jloch),il,ih,jl,jh)
......@@ -1003,7 +1022,7 @@ contains
! Compute x0 as dx/2 before first read value.
! x0 should be an X-point (not a T-point).
!
x0 = startval - 0.50*dx
x0 = startval - _HALF_*dx
!
! Test that the read values are approximately equidistantly spaced.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment