Commit b4c1e5ae authored by Knut's avatar Knut
Browse files

optional initialisation of surface elevation

parent fad488e7
......@@ -189,6 +189,15 @@
......@@ -225,6 +225,18 @@
<element name="m2d" label="variables related to 2D model">
<element name="elev_method" type="int" label="method for initial surface elevation">
<option value="1" label="constant"/>
<option value="2" label="from 2D field"/>
<element name="elev_const" type="float" label="constant initial surface elevation">
<condition type="eq" variable="./elev_method" value="1"/>
<element name="elev_file" type="string" label="name of file with initial surface elevation">
<condition type="eq" variable="./elev_method" value="2"/>
<element name="MM" type="int" label="time steps between calls to bottom_friction()" unit="micro time steps" minInclusive="0"/>
<element name="Am" type="float" label="constant horizontal momentum diffusion coefficient" unit="m²/s"/>
<element name="An_method" type="int" label="method for constant horizontal numerical diffusion coefficient (m²/s) used to filter the surface elevation">
......@@ -100,7 +100,11 @@
integer :: rc
integer :: i,j
integer :: elev_method=1
REALTYPE :: elev_const=_ZERO_
character(LEN = PATH_MAX) :: elev_file=''
namelist /m2d/ &
elev_method,elev_const,elev_file, &
MM,Am,An_method,An_const,An_file,residual, &
......@@ -114,18 +118,41 @@
LEVEL1 'init_2d'
dtm = timestep
! Read 2D-model specific things from the namelist.
dtm = timestep
! Allocates memory for the public data members - if not static
call init_variables_2d(runtype)
if (.not. hotstart) then
select case (elev_method)
LEVEL2 'setting initial surface elevation to ',real(elev_const)
z = elev_const
LEVEL2 'getting initial surface elevation from ',trim(elev_file)
call get_2d_field(trim(elev_file),"elev",ilg,ihg,jlg,jhg,z(ill:ihl,jll:jhl))
! Note (KK): we need halo update only for periodic domains
call update_2d_halo(z,z,az,imin,jmin,imax,jmax,H_TAG)
call wait_halo(H_TAG)
case default
stop 'init_2d(): invalid elev_method'
end select
where ( z .lt. -H+min_depth)
z = -H+min_depth
end where
zo = z
call depth_update()
end if
#if defined(GETM_PARALLEL) || defined(NO_BAROTROPIC)
! STDERR 'Not calling cfl_check() - GETM_PARALLEL or NO_BAROTROPIC'
! call cfl_check()
! KK-TODO: why is cfl_check not in terms of D?
call cfl_check()
......@@ -220,11 +247,6 @@
LEVEL2 'Format=',bdyfmt_2d
end if
where ( -H+min_depth .gt. _ZERO_ )
z = -H+min_depth
end where
! bottom roughness
if (z0_method .eq. 0) then
zub0 = z0_const
......@@ -245,8 +267,6 @@
call depth_update()
#ifdef DEBUG
write(debug,*) 'Leaving init_2d()'
......@@ -295,6 +315,7 @@
! 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)
......@@ -331,7 +352,11 @@
zo = _ZERO_
end where
end if
call depth_update()
end if
end subroutine postinit_2d
......@@ -258,6 +258,7 @@
! Needed for interpolation of temperature and salinity
if (.not. hotstart) then
ssen = z
call start_macro()
call coordinates(hotstart)
call hcc_check()
......@@ -337,6 +338,7 @@
! 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
......@@ -365,6 +367,9 @@
end if
end do
end do
call coordinates(hotstart)
end if
......@@ -266,10 +266,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 depth_update
#ifndef NO_3D
if (runtype .ge. 2) then
call coordinates(hotstart)
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