Commit 4d08bf2d authored by Bjarne Buchmann's avatar Bjarne Buchmann
Browse files

Update of mask-change postinit feature

parent 4f267377
......@@ -264,11 +264,13 @@
! !IROUTINE: postinit_2d - re-initialise some 2D after hotstart read.
!
! !INTERFACE:
subroutine postinit_2d(runtype)
subroutine postinit_2d(runtype,timestep,hotstart)
IMPLICIT NONE
!
! !INPUT PARAMETERS:
integer, intent(in) :: runtype
REALTYPE, intent(in) :: timestep
logical, intent(in) :: hotstart
!
! !INPUT/OUTPUT PARAMETERS:
!
......@@ -292,45 +294,47 @@
LEVEL1 'postinit_2d'
ischange = 0
! The first two loops are pure diagnostics, logging where changes will actually take place
! (and if there is something to do at all, to be able to skip the second part)
do j=jmin-HALO,jmax+HALO
do i=imin-HALO,imax+HALO
if ( au(i,j).eq.0 .and. U(i,j).ne._ZERO_ ) then
LEVEL3 'postinit_2d: Reset to mask(au), U=0 for i,j=',i,j
ischange = 1
end if
!
! It is possible that a user changes the land mask and reads an "old" hotstart file.
! In this case the "old" velocities will need to be zeroed out.
if (hotstart) then
ischange = 0
! The first two loops are pure diagnostics, logging where changes will actually take place
! (and if there is something to do at all, to be able to skip the second part)
do j=jmin-HALO,jmax+HALO
do i=imin-HALO,imax+HALO
if ( au(i,j).eq.0 .and. U(i,j).ne._ZERO_ ) then
LEVEL3 'postinit_2d: Reset to mask(au), U=0 for i,j=',i,j
ischange = 1
end if
end do
end do
end do
do j=jmin-HALO,jmax+HALO
do i=imin-HALO,imax+HALO
if ( av(i,j).eq.0 .and. V(i,j).ne._ZERO_ ) then
LEVEL3 'postinit_2d: Reset to mask(av), V=0 for i,j=',i,j
ischange = 1
end if
do j=jmin-HALO,jmax+HALO
do i=imin-HALO,imax+HALO
if ( av(i,j).eq.0 .and. V(i,j).ne._ZERO_ ) then
LEVEL3 'postinit_2d: Reset to mask(av), V=0 for i,j=',i,j
ischange = 1
end if
end do
end do
end do
! The actual reset is below here - independent of the above diagnostics (except for the if)
if (ischange.ne.0) then
where (au .eq. 0)
U = _ZERO_
Uint = _ZERO_
Uinto = _ZERO_
end where
where (av .eq. 0)
V = _ZERO_
Vint = _ZERO_
Vinto = _ZERO_
end where
where (az .eq. 0)
z = _ZERO_
zo = _ZERO_
end where
end if
! The actual reset is below here - independent of the above diagnostics (except for the if)
if (ischange.ne.0) then
where (au .eq. 0)
U = _ZERO_
Uinto = _ZERO_
end where
where (av .eq. 0)
V = _ZERO_
Vinto = _ZERO_
end where
! This is probably not absolutely necessary:
where (az .eq. 0)
z = _ZERO_
zo = _ZERO_
end where
end if
end if
return
end subroutine postinit_2d
!EOC
......
......@@ -301,13 +301,15 @@
! !IROUTINE: postinit_3d - re-initialise some 3D after hotstart read.
!
! !INTERFACE:
subroutine postinit_3d(runtype)
subroutine postinit_3d(runtype,timestep,hotstart)
! !USES:
use domain, only: imin,imax,jmin,jmax, az,au,av
IMPLICIT NONE
!
! !INPUT PARAMETERS:
integer, intent(in) :: runtype
REALTYPE, intent(in) :: timestep
logical, intent(in) :: hotstart
!
! !INPUT/OUTPUT PARAMETERS:
!
......@@ -331,34 +333,37 @@
LEVEL1 'postinit_3d'
! Go over mask and make sure that velocities are zero on land.
do j=jmin-HALO,jmax+HALO
do i=imin-HALO,imax+HALO
if(az(i,j) .eq. 0) then
tke(i,j,:) = _ZERO_
num(i,j,:) = 1.e-15
nuh(i,j,:) = 1.e-15
#ifndef NO_BAROCLINIC
S(i,j,:) = _ZERO_
T(i,j,:) = _ZERO_
#endif
end if
! Hotstart fix - see postinit_2d
if (hotstart) then
do j=jmin-HALO,jmax+HALO
do i=imin-HALO,imax+HALO
if (au(i,j) .eq. 0) then
uu(i,j,:) = _ZERO_
end if
end do
end do
end do
do j=jmin-HALO,jmax+HALO
do i=imin-HALO,imax+HALO
if (au(i,j) .eq. 0) then
uu(i,j,:) = _ZERO_
end if
do j=jmin-HALO,jmax+HALO
do i=imin-HALO,imax+HALO
if (av(i,j) .eq. 0) then
vv(i,j,:) = _ZERO_
end if
end do
end do
end do
do j=jmin-HALO,jmax+HALO
do i=imin-HALO,imax+HALO
if (av(i,j) .eq. 0) then
vv(i,j,:) = _ZERO_
end if
! These may not be necessary, but we clean up anyway just in case.
do j=jmin-HALO,jmax+HALO
do i=imin-HALO,imax+HALO
if(az(i,j) .eq. 0) then
tke(i,j,:) = _ZERO_
num(i,j,:) = 1.e-15
nuh(i,j,:) = 1.e-15
#ifndef NO_BAROCLINIC
S(i,j,:) = _ZERO_
T(i,j,:) = _ZERO_
#endif
end if
end do
end do
end do
end if
return
end subroutine postinit_3d
......
......@@ -265,9 +265,9 @@
hot_in = trim(out_dir) //'/'// 'restart' // trim(buf)
call restart_file(READING,trim(hot_in),MinN,runtype,use_epoch)
LEVEL3 'MinN adjusted to ',MinN
call postinit_2d(runtype)
call postinit_2d(runtype,timestep,hotstart)
#ifndef NO_3D
call postinit_3d(runtype)
call postinit_3d(runtype,timestep,hotstart)
#endif
call depth_update
#ifndef NO_3D
......
......@@ -136,7 +136,6 @@
LEVEL3 "read_restart_ncdf(): setting U=0"
U=_ZERO_
else
where(au .eq. 0) U=_ZERO_
call update_2d_halo(U,U,au,imin,jmin,imax,jmax,U_TAG)
call wait_halo(U_TAG)
end if
......@@ -166,7 +165,6 @@
LEVEL3 "read_restart_ncdf(): setting V=0"
V=_ZERO_
else
where(av .eq. 0) V=_ZERO_
call update_2d_halo(V,V,av,imin,jmin,imax,jmax,V_TAG)
call wait_halo(V_TAG)
end if
......@@ -285,8 +283,6 @@
LEVEL3 "read_restart_ncdf(): setting uu=0"
uu=_ZERO_
else
forall(i=imin-HALO:imax+HALO,j=jmin-HALO:jmax+HALO, au(i,j).eq.0) &
uu(i,j,:)=_ZERO_
call update_3d_halo(uu,uu,au,imin,jmin,imax,jmax,kmax,U_TAG)
call wait_halo(U_TAG)
end if
......@@ -297,8 +293,6 @@
LEVEL3 "read_restart_ncdf(): setting vv=0"
vv=_ZERO_
else
forall(i=imin-HALO:imax+HALO,j=jmin-HALO:jmax+HALO, av(i,j).eq.0) &
vv(i,j,:)=_ZERO_
call update_3d_halo(vv,vv,av,imin,jmin,imax,jmax,kmax,V_TAG)
call wait_halo(V_TAG)
end if
......
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