Commit c4ed2027 authored by kbk's avatar kbk
Browse files

calculate in HALO-zones instead of using update_3d_halo()

parent 3a336eda
!$Id: coordinates.F90,v 1.3 2003-04-23 12:16:27 kbk Exp $
!$Id: coordinates.F90,v 1.4 2003-09-02 14:45:46 kbk Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -30,7 +30,10 @@
! Original author(s): Hans Burchard & Karsten Bolding
!
! $Log: coordinates.F90,v $
! Revision 1.3 2003-04-23 12:16:27 kbk
! Revision 1.4 2003-09-02 14:45:46 kbk
! calculate in HALO-zones instead of using update_3d_halo()
!
! Revision 1.3 2003/04/23 12:16:27 kbk
! added calls to wait_halo()
!
! Revision 1.2 2003/04/07 16:27:32 kbk
......@@ -159,8 +162,8 @@
else
kk=1
end if
do j=jjmin,jjmax
do i=iimin,iimax
do j=jjmin-HALO,jjmax+HALO
do i=iimin-HALO,iimax+HALO
HH=max(H(i,j),min_depth)
alpha=min(&
((be(kk)-be(kk-1))-D_gamma/HH&
......@@ -168,7 +171,7 @@
/((be(kk)-be(kk-1))-(sig(kk)-sig(kk-1))),_ONE_)
gga(i,j,0)=-_ONE_
do k=1,kmax
gga(i,j,k)=alpha*sig(k)+(1.-alpha)*be(k)
gga(i,j,k)=alpha*sig(k)+(1.-alpha)*be(k)
if (gga(i,j,k) .lt. gga(i,j,k-1)) then
STDERR kk,(be(kk)-be(kk-1)),(sig(kk)-sig(kk-1))
STDERR D_gamma,HH
......@@ -181,50 +184,41 @@
end do
end do
gga(iimin:iimax,jjmin-1,:) = gga(iimin:iimax,jjmin,:)
gga(iimin:iimax,jjmax+1,:) = gga(iimin:iimax,jjmax,:)
gga(iimin-1,jjmin:jjmax,:)=gga(iimin,jjmin:jjmax,:)
gga(iimax+1,jjmin:jjmax,:)=gga(iimax,jjmin:jjmax,:)
call update_3d_halo(gga,gga,az,iimin,jjmin,iimax,jjmax,kmax,H_TAG)
call wait_halo(H_TAG)
kmin=1
kumin=1
kvmin=1
! Here, the initial layer distribution is calculated.
do k=1,kmax
do j=jjmin,jjmax
do i=iimin,iimax
HH=max(sseo(i,j)+H(i,j),min_depth)
hn(i,j,k)=HH*(gga(i,j,k)-gga(i,j,k-1))
do k=1,kmax
do j=jjmin-HALO,jjmax+HALO
do i=iimin-HALO,iimax+HALO
HH=max(sseo(i,j)+H(i,j),min_depth)
hn(i,j,k)=HH*(gga(i,j,k)-gga(i,j,k-1))
end do
end do
end do
end do
do k=1,kmax
do j=jjmin,jjmax
do i=iimin-1,iimax
HH=max(ssuo(i,j)+HU(i,j),min_depth)
huo(i,j,k)=HH*0.5* &
(gga(i,j,k)-gga(i,j,k-1)+gga(i+1,j,k)-gga(i+1,j,k-1))
hun(i,j,k)=huo(i,j,k)
do k=1,kmax
do j=jjmin-HALO,jjmax+HALO
do i=iimin-HALO,iimax+HALO-1
HH=max(ssuo(i,j)+HU(i,j),min_depth)
huo(i,j,k)=HH*0.5* &
(gga(i,j,k)-gga(i,j,k-1)+gga(i+1,j,k)-gga(i+1,j,k-1))
hun(i,j,k)=huo(i,j,k)
end do
end do
end do
end do
do k=1,kmax
do j=jjmin-1,jjmax
do i=iimin,iimax
HH=max(ssvo(i,j)+HV(i,j),min_depth)
hvo(i,j,k)=HH*0.5* &
(gga(i,j,k)-gga(i,j,k-1)+gga(i,j+1,k)-gga(i,j+1,k-1))
hvn(i,j,k)=hvo(i,j,k)
do k=1,kmax
do j=jjmin-HALO,jjmax+HALO-1
do i=iimin-HALO,iimax+HALO
HH=max(ssvo(i,j)+HV(i,j),min_depth)
hvo(i,j,k)=HH*0.5* &
(gga(i,j,k)-gga(i,j,k-1)+gga(i,j+1,k)-gga(i,j+1,k-1))
hvn(i,j,k)=hvo(i,j,k)
end do
end do
end do
end do
case default
end select
......@@ -234,44 +228,45 @@
case (1) ! sigma coordinates
if (equiv_sigma) then
kmaxm1= _ONE_/float(kmax)
do j=jjmin,jjmax
do i=iimin,iimax
do j=jjmin-HALO,jjmax+HALO
do i=iimin-HALO,iimax+HALO
ho(i,j,:)=(sseo(i,j)+H(i,j))*kmaxm1
hn(i,j,:)=(ssen(i,j)+H(i,j))*kmaxm1
end do
end do
do j=jjmin,jjmax
do i=iimin-1,iimax
do j=jjmin-HALO,jjmax+HALO
do i=iimin-HALO,iimax+HALO-1
huo(i,j,:)=(ssuo(i,j)+HU(i,j))*kmaxm1
hun(i,j,:)=(ssun(i,j)+HU(i,j))*kmaxm1
end do
end do
do j=jjmin-1,jjmax
do i=iimin,iimax
do j=jjmin-HALO,jjmax+HALO-1
do i=iimin-HALO,iimax+HALO
hvo(i,j,:)=(ssvo(i,j)+HV(i,j))*kmaxm1
hvn(i,j,:)=(ssvn(i,j)+HV(i,j))*kmaxm1
end do
end do
else ! non-equivdistant
do j=jjmin,jjmax
do i=iimin,iimax
do j=jjmin-HALO,jjmax+HALO
do i=iimin-HALO,iimax+HALO
ho(i,j,1:kmax)=(sseo(i,j)+H(i,j))*dga(1:kmax)
hn(i,j,1:kmax)=(ssen(i,j)+H(i,j))*dga(1:kmax)
end do
end do
do j=jjmin,jjmax
do i=iimin-1,iimax
do j=jjmin-HALO,jjmax+HALO
do i=iimin-HALO,iimax+HALO-1
huo(i,j,1:kmax)=(ssuo(i,j)+HU(i,j))*dga(1:kmax)
hun(i,j,1:kmax)=(ssun(i,j)+HU(i,j))*dga(1:kmax)
end do
end do
do j=jjmin-1,jjmax
do i=iimin,iimax
do j=jjmin-HALO,jjmax+HALO-1
do i=iimin-HALO,iimax+HALO
hvo(i,j,1:kmax)=(ssvo(i,j)+HV(i,j))*dga(1:kmax)
hvn(i,j,1:kmax)=(ssvn(i,j)+HV(i,j))*dga(1:kmax)
end do
......@@ -285,8 +280,8 @@
! later be generalised also for sigma coordinates.
maxdepth=600. ! needs to be calculated later ... HB
do j=jjmin,jjmax
do i=iimin,iimax
do j=jjmin-HALO,jjmax+HALO
do i=iimin-HALO,iimax+HALO
r = cord_relax/dt*H(i,j)/maxdepth
zz = -H(i,j)
do k=1,kmax-1
......@@ -300,9 +295,9 @@
end do
end do
do j=jjmin,jjmax
do i=iimin-1,iimax
if (au(i,j) .gt. 0) then
do j=jjmin-HALO,jjmax+HALO
do i=iimin-HALO,iimax+HALO-1
!KBK if (au(i,j) .gt. 0) then
r = cord_relax/dt*HU(i,j)/maxdepth
zz = -HU(i,j)
do k=1,kmax-1
......@@ -314,13 +309,13 @@
end do
huo(i,j,kmax) = hun(i,j,kmax)
hun(i,j,kmax)=ssun(i,j)-zz
end if
!KBK end if
end do
end do
do j=jjmin-1,jjmax
do i=iimin,iimax
if (av(i,j).gt.0) then
do j=jjmin-HALO,jjmax+HALO-1
do i=iimin-HALO,iimax+HALO
!KBK if (av(i,j).gt.0) then
r = cord_relax/dt*HV(i,j)/maxdepth
zz = -HV(i,j)
do k=1,kmax-1
......@@ -332,29 +327,16 @@
end do
hvo(i,j,kmax) = hvn(i,j,kmax)
hvn(i,j,kmax)=ssvn(i,j)-zz
end if
!KBK end if
end do
end do
case default
end select
call update_3d_halo(ho,ho,az,iimin,jjmin,iimax,jjmax,kmax,H_TAG)
call wait_halo(H_TAG)
call update_3d_halo(hn,hn,az,iimin,jjmin,iimax,jjmax,kmax,H_TAG)
call wait_halo(H_TAG)
call update_3d_halo(huo,huo,au,iimin,jjmin,iimax,jjmax,kmax,HU_TAG)
call wait_halo(HU_TAG)
call update_3d_halo(hun,hun,au,iimin,jjmin,iimax,jjmax,kmax,HU_TAG)
call wait_halo(HU_TAG)
call update_3d_halo(hvo,hvo,av,iimin,jjmin,iimax,jjmax,kmax,HV_TAG)
call wait_halo(HV_TAG)
call update_3d_halo(hvn,hvn,av,iimin,jjmin,iimax,jjmax,kmax,HV_TAG)
call wait_halo(HV_TAG)
#ifdef DEBUG
write(debug,*) 'Leaving Coordinates()'
write(debug,*) 'Leaving coordinates()'
write(debug,*)
#endif
return
......
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