Commit 20ee8445 authored by Bjarne Buchmann's avatar Bjarne Buchmann
Browse files

postinit after hotstart read for consistent mask changes

parent 5264e99d
...@@ -266,6 +266,83 @@ ...@@ -266,6 +266,83 @@
end subroutine init_2d end subroutine init_2d
!EOC !EOC
!-----------------------------------------------------------------------
!BOP
!
! !IROUTINE: postinit_2d - re-initialise some 2D after hotstart read.
!
! !INTERFACE:
subroutine postinit_2d(runtype)
IMPLICIT NONE
!
! !INPUT PARAMETERS:
integer, intent(in) :: runtype
!
! !INPUT/OUTPUT PARAMETERS:
!
! !OUTPUT PARAMETERS:
!
! !DESCRIPTION:
! This routine provides possibility to reset/initialize 2D variables to
! ensure that velocities are correctly set on land cells after read
! of a hotstart file.
!
! !LOCAL VARIABLES:
integer :: i,j, ischange
!EOP
!-------------------------------------------------------------------------
!BOC
#ifdef DEBUG
integer, save :: Ncall = 0
Ncall = Ncall+1
write(debug,*) 'postinit_2d() # ',Ncall
#endif
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
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
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
return
end subroutine postinit_2d
!EOC
!----------------------------------------------------------------------- !-----------------------------------------------------------------------
!BOP !BOP
! !
......
...@@ -295,6 +295,81 @@ ...@@ -295,6 +295,81 @@
end subroutine init_3d end subroutine init_3d
!EOC !EOC
!-----------------------------------------------------------------------
!BOP
!
! !IROUTINE: postinit_3d - re-initialise some 3D after hotstart read.
!
! !INTERFACE:
subroutine postinit_3d(runtype)
! !USES:
use domain, only: imin,imax,jmin,jmax, az,au,av
IMPLICIT NONE
!
! !INPUT PARAMETERS:
integer, intent(in) :: runtype
!
! !INPUT/OUTPUT PARAMETERS:
!
! !OUTPUT PARAMETERS:
!
! !DESCRIPTION:
! This routine provides possibility to reset/initialize 3D variables to
! ensure that velocities are correctly set on land cells after read
! of a hotstart file.
!
! !LOCAL VARIABLES:
integer :: i,j
!EOP
!-------------------------------------------------------------------------
!BOC
#ifdef DEBUG
integer, save :: Ncall = 0
Ncall = Ncall+1
write(debug,*) 'postinit_3d() # ',Ncall
#endif
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
ho(i,j,:) = _ZERO_
hn(i,j,:) = _ZERO_
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
do j=jmin-HALO,jmax+HALO
do i=imin-HALO,imax+HALO
if (au(i,j) .eq. 0) then
uu(i,j,:) = _ZERO_
huo(i,j,:) = _ZERO_
hun(i,j,:) = _ZERO_
end if
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_
hvo(i,j,:) = _ZERO_
hvn(i,j,:) = _ZERO_
end if
end do
end do
return
end subroutine postinit_3d
!EOC
!----------------------------------------------------------------------- !-----------------------------------------------------------------------
!BOP !BOP
! !
......
...@@ -45,11 +45,11 @@ ...@@ -45,11 +45,11 @@
use domain, only: vert_cord,maxdepth use domain, only: vert_cord,maxdepth
use time, only: init_time,update_time,write_time_string use time, only: init_time,update_time,write_time_string
use time, only: start,timestr,timestep use time, only: start,timestr,timestep
use m2d, only: init_2d,z,zu,zv use m2d, only: init_2d,postinit_2d, z,zu,zv
use getm_timers, only: init_getm_timers, tic, toc, TIM_INITIALIZE use getm_timers, only: init_getm_timers, tic, toc, TIM_INITIALIZE
#ifndef NO_3D #ifndef NO_3D
use m2d, only: Uint,Vint use m2d, only: Uint,Vint
use m3d, only: cord_relax,init_3d,ssen,ssun,ssvn use m3d, only: cord_relax,init_3d,postinit_3d, ssen,ssun,ssvn
#ifndef NO_BAROCLINIC #ifndef NO_BAROCLINIC
use m3d, only: T use m3d, only: T
#endif #endif
...@@ -265,6 +265,10 @@ ...@@ -265,6 +265,10 @@
hot_in = trim(out_dir) //'/'// 'restart' // trim(buf) hot_in = trim(out_dir) //'/'// 'restart' // trim(buf)
call restart_file(READING,trim(hot_in),MinN,runtype,use_epoch) call restart_file(READING,trim(hot_in),MinN,runtype,use_epoch)
LEVEL3 'MinN adjusted to ',MinN LEVEL3 'MinN adjusted to ',MinN
call postinit_2d(runtype)
#ifndef NO_3D
call postinit_3d(runtype)
#endif
call depth_update call depth_update
#ifndef NO_3D #ifndef NO_3D
if (runtype .ge. 2) then if (runtype .ge. 2) then
......
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