Commit 2c96c06d authored by kb's avatar kb
Browse files

adaptive vertical coordinates - Hofmeister

parent a74a60db
#$Id: Makefile,v 1.17 2009-05-05 07:39:47 kb Exp $
#$Id: Makefile,v 1.18 2010-02-23 08:23:34 kb Exp $
#
# Makefile to build the 3D specific library - libm3d.a
#
......@@ -11,7 +11,7 @@ LIB = $(LIBDIR)/lib3d${buildtype}.a
MODSRC = m3d.F90 variables_3d.F90 advection_3d.F90 eqstate.F90 \
temperature.F90 salinity.F90 spm.F90 bdy_3d.F90 rivers.F90
LIBSRC = start_macro.F90 hcc_check.F90 bdy_3d.F90 coordinates.F90 sigma_coordinates.F90 general_coordinates.F90 hybrid_coordinates.F90 adaptive_coordinates.F90 check_h.F90 bottom_friction_3d.F90 internal_pressure.F90 uu_momentum_3d.F90 vv_momentum_3d.F90 ww_momentum_3d.F90 structure_friction_3d.F90 uv_advect_3d.F90 uv_diffusion_3d.F90 stresses_3d.F90 ss_nn.F90 gotm.F90 slow_bottom_friction.F90 slow_advection.F90 slow_diffusion.F90 slow_terms.F90 stop_macro.F90
LIBSRC = start_macro.F90 hcc_check.F90 bdy_3d.F90 coordinates.F90 sigma_coordinates.F90 general_coordinates.F90 hybrid_coordinates.F90 check_h.F90 bottom_friction_3d.F90 internal_pressure.F90 uu_momentum_3d.F90 vv_momentum_3d.F90 ww_momentum_3d.F90 structure_friction_3d.F90 uv_advect_3d.F90 uv_diffusion_3d.F90 stresses_3d.F90 ss_nn.F90 gotm.F90 slow_bottom_friction.F90 slow_advection.F90 slow_diffusion.F90 slow_terms.F90 stop_macro.F90
TEXSRC = m3d.F90 variables_3d.F90 coordinates.F90 sigma_coordinates.F90 general_coordinates.F90 hybrid_coordinates.F90 adaptive_coordinates.F90 check_h.F90 hcc_check.F90 uu_momentum_3d.F90 vv_momentum_3d.F90 ww_momentum_3d.F90 structure_friction_3d.F90 uv_advect_3d.F90 uv_diffusion_3d.F90 bottom_friction_3d.F90 internal_pressure.F90 ip_blumberg_mellor.F90 ip_blumberg_mellor_lin.F90 ip_z_interpol.F90 ip_song_wright.F90 ip_chu_fan.F90 ip_shchepetkin_mcwilliams.F90 advection_3d.F90 upstream_adv.F90 upstream_2dh_adv.F90 u_split_adv.F90 v_split_adv.F90 w_split_adv.F90 w_split_it_adv.F90 fct_2dh_adv.F90 temperature.F90 salinity.F90 spm.F90 eqstate.F90 ss_nn.F90 stresses_3d.F90 gotm.F90 rivers.F90 bdy_3d.F90 slow_bottom_friction.F90 slow_advection.F90 slow_diffusion.F90 slow_terms.F90 start_macro.F90 stop_macro.F90
......@@ -46,7 +46,6 @@ $(LIB)(coordinates.o) \
$(LIB)(sigma_coordinates.o) \
$(LIB)(general_coordinates.o) \
$(LIB)(hybrid_coordinates.o) \
$(LIB)(adaptive_coordinates.o) \
$(LIB)(bottom_friction_3d.o) \
$(LIB)(uu_momentum_3d.o) \
$(LIB)(vv_momentum_3d.o) \
......@@ -60,6 +59,7 @@ $(LIB)(uv_advect_3d.o) \
$(LIB)(uv_diffusion_3d.o)
ifneq ($(GETM_NO_BAROCLINIC),true)
OBJ += \
$(LIB)(adaptive_coordinates.o) \
$(LIB)(ip_blumberg_mellor.o) \
$(LIB)(ip_blumberg_mellor_lin.o) \
$(LIB)(ip_z_interpol.o) \
......
This diff is collapsed.
......@@ -10,8 +10,8 @@
REALTYPE :: zpos(I3DFIELD),hn(I3DFIELD),depthmin
integer :: i,j,k
do k=1,kmax
do j=jmin,jmax
do i=imin,imax
do j=jmin-HALO,jmax+HALO
do i=imin-HALO,imax+HALO
hn(i,j,k)= zpos(i,j,k)-zpos(i,j,k-1)
hn(i,j,k)=max(hn(i,j,k),depthmin)
enddo
......@@ -31,8 +31,8 @@
REALTYPE :: zpos(I3DFIELD),hn(I3DFIELD),depthmin
integer :: i,j,k
! write(6,*) 'htoz',imax,hn(imax/2,2,kmax/2),H(imax/2,2)
do j=jmin,jmax
do i=imin,imax
do j=jmin-HALO,jmax+HALO
do i=imin-HALO,imax+HALO
zpos(i,j,0)=-H(i,j)
do k=1,kmax
zpos(i,j,k)=zpos(i,j,k-1)+hn(i,j,k)
......@@ -41,7 +41,7 @@
enddo
return
end
subroutine hcheck(hn,ssen,h)
subroutine hcheck(hn,ssen,H)
#include "cppdefs.h"
!
! !DESCRIPTION:
......@@ -50,7 +50,7 @@
use domain, only: imin,imax,jmin,jmax,kmax
IMPLICIT NONE
REALTYPE :: ssen(I2DFIELD),hn(I3DFIELD)
REALTYPE :: h(I2DFIELD),HH,depthmin
REALTYPE :: H(I2DFIELD),HH,depthmin
integer :: i,j,k
! Final check of layer thicnkess thoug not necessary if zpos treated correctly
! write(6,*) 'Inside',hn(imax/2,2,kmax/2)
......
!$Id: coordinates.F90,v 1.16 2009-08-18 10:24:44 bjb Exp $
!$Id: coordinates.F90,v 1.17 2010-02-23 08:23:35 kb Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -7,7 +7,7 @@
! \label{sec-coordinates}
!
! !INTERFACE:
subroutine coordinates(cord_type,cord_relax,maxdepth)
subroutine coordinates(cord_type,cord_relax,maxdepth,hotstart)
!
! !DESCRIPTION:
!
......@@ -80,6 +80,7 @@
integer, intent(in) :: cord_type
REALTYPE, intent(in) :: cord_relax
REALTYPE, intent(in) :: maxdepth
logical, intent(in) :: hotstart
!
! !REVISION HISTORY:
! Original author(s): Hans Burchard & Karsten Bolding
......@@ -115,8 +116,9 @@ STDERR 'coordinates(): hybrid_coordinates not coded yet'
stop
case (5) ! adaptive vertical coordinates
LEVEL2 'using adaptive vertical coordinates'
call adaptive_coordinates(.true.)
STDERR 'coordinates(): adaptive_coordinates not coded yet'
#ifndef NO_BAROCLINIC
call adaptive_coordinates(.true.,hotstart)
#endif
case default
end select
first = .false.
......@@ -130,7 +132,9 @@ STDERR 'coordinates(): adaptive_coordinates not coded yet'
case (4) ! hybrid vertical coordinates
call hybrid_coordinates(.false.)
case (5) ! adaptive vertical coordinates
call adaptive_coordinates(.false.)
#ifndef NO_BAROCLINIC
call adaptive_coordinates(.false.,hotstart)
#endif
case default
end select
end if ! first
......
!$Id: m3d.F90,v 1.46 2009-09-04 11:50:33 bjb Exp $
!$Id: m3d.F90,v 1.47 2010-02-23 08:23:35 kb Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -264,7 +264,7 @@
! Needed for interpolation of temperature and salinity
if (.not. hotstart) then
call start_macro()
call coordinates(vert_cord,cord_relax,maxdepth)
call coordinates(vert_cord,cord_relax,maxdepth,hotstart)
call hcc_check()
end if
......@@ -281,6 +281,35 @@
call init_eqstate()
#ifndef PECS
call do_eqstate()
call ss_nn()
#endif
if (.not. openbdy) bdy3d=.false.
if (bdy3d) call init_bdy_3d()
#ifdef PREADAPT
if (bdy3d) call do_bdy_3d(0,T)
if (vert_cord .eq. 5) then
LEVEL2 'pre-adapting coordinates'
do ii=1,PREADAPT
call start_macro()
call coordinates(vert_cord,cord_relax,maxdepth)
call ww_momentum_3d()
if(calc_salt) call do_salinity(1)
if(calc_temp) call do_temperature(1)
call do_eqstate()
call ss_nn()
call stop_macro()
if (mod(ii,10).eq._ZERO_) LEVEL3 ii
end do
end if
LEVEL2 'reinterpolating initial salinity'
if(calc_salt) call init_salinity(1)
LEVEL2 'reinterpolating initial temperature'
if(calc_temp) call init_temperature(1)
call do_eqstate()
if (runtype .eq. 4) call do_internal_pressure()
call ss_nn()
#endif
if (runtype .ge. 3) call init_internal_pressure()
if (runtype .eq. 3) call do_internal_pressure()
......@@ -290,9 +319,6 @@
end if
#endif
if (.not. openbdy) bdy3d=.false.
if (bdy3d) call init_bdy_3d()
#ifdef DEBUG
write(debug,*) 'Leaving init_3d()'
write(debug,*)
......@@ -440,6 +466,7 @@
ufirst=.true.
end if
#ifndef MUDFLAT
if (vert_cord .eq. 5) call ss_nn()
call coordinates(vert_cord,cord_relax,maxdepth)
#endif
if (kmax .gt. 1) then
......@@ -462,7 +489,7 @@
#endif
#ifndef CONSTANT_VISCOSITY
#ifndef PARABOLIC_VISCOSITY
call ss_nn()
if (vert_cord .ne. 5) call ss_nn()
#endif
call gotm()
#endif
......
!$Id: domain.F90,v 1.39 2009-11-06 07:04:25 bjb Exp $
!$Id: domain.F90,v 1.40 2010-02-23 08:23:35 kb Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -99,6 +99,9 @@
! Original author(s): Karsten Bolding & Hans Burchard
!
! $Log: domain.F90,v $
! Revision 1.40 2010-02-23 08:23:35 kb
! adaptive vertical coordinates - Hofmeister
!
! Revision 1.39 2009-11-06 07:04:25 bjb
! Consistent application of bathymetry.adjust with new bathy read
!
......@@ -383,8 +386,10 @@
stop
case (5) ! adaptive vertical coordinates
LEVEL2 'using adaptive vertical coordinates'
STDERR 'domain: adaptive_coordinates not coded yet'
#ifdef NO_BAROCLINIC
LEVEL2 'adaptive coordinates are not working with NO_BAROCLINIC'
stop
#endif
case default
call getm_error("init_domain()", &
"A non valid vertical coordinate system has been chosen");
......
!$Id: initialise.F90,v 1.23 2009-08-21 08:56:34 bjb Exp $
!$Id: initialise.F90,v 1.24 2010-02-23 08:23:35 kb Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -22,6 +22,9 @@
! Original author(s): Karsten Bolding & Hans Burchard
!
! $Log: initialise.F90,v $
! Revision 1.24 2010-02-23 08:23:35 kb
! adaptive vertical coordinates - Hofmeister
!
! Revision 1.23 2009-08-21 08:56:34 bjb
! Fix name clash on PARALLEL with OpenMP key word
!
......@@ -369,7 +372,7 @@
call depth_update
#ifndef NO_3D
if (runtype .ge. 2) then
call coordinates(vert_cord,cord_relax,maxdepth)
call coordinates(vert_cord,cord_relax,maxdepth,hotstart)
Uint=_ZERO_
Vint=_ZERO_
end if
......
!$Id: create_restart_ncdf.F90,v 1.8 2010-01-21 15:46:23 kb Exp $
!$Id: create_restart_ncdf.F90,v 1.9 2010-02-23 08:23:35 kb Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -40,6 +40,9 @@
! Original author(s): Karsten Bolding
!
! $Log: create_restart_ncdf.F90,v $
! Revision 1.9 2010-02-23 08:23:35 kb
! adaptive vertical coordinates - Hofmeister
!
! Revision 1.8 2010-01-21 15:46:23 kb
! fixed BIO-restart
!
......@@ -233,6 +236,10 @@
(/ xdim_id, ydim_id, zdim_id /), nuh_id)
if (status .NE. NF90_NOERR) go to 10
status = nf90_def_var(ncid, "hn", nf90_double, &
(/ xdim_id, ydim_id, zdim_id /), hn_id)
if (status .NE. NF90_NOERR) go to 10
#ifndef NO_BAROCLINIC
status = nf90_def_var(ncid, "T", nf90_double, &
(/ xdim_id, ydim_id, zdim_id /), T_id)
......
!$Id: ncdf_restart.F90,v 1.3 2009-09-23 09:54:52 kb Exp $
!$Id: ncdf_restart.F90,v 1.4 2010-02-23 08:23:35 kb Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -48,6 +48,7 @@
integer :: uuEx_id,vvEx_id
integer :: tke_id,eps_id
integer :: num_id,nuh_id
integer :: hn_id
#ifndef NO_BAROCLINIC
integer :: T_id,S_id
#endif
......@@ -68,6 +69,9 @@
! Original author(s): Karsten Bolding
!
! $Log: ncdf_restart.F90,v $
! Revision 1.4 2010-02-23 08:23:35 kb
! adaptive vertical coordinates - Hofmeister
!
! Revision 1.3 2009-09-23 09:54:52 kb
! fixed typos in DESCRIPTION
!
......
!$Id: open_restart_ncdf.F90,v 1.5 2010-01-21 15:46:23 kb Exp $
!$Id: open_restart_ncdf.F90,v 1.6 2010-02-23 08:23:36 kb Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -32,6 +32,9 @@
! Original author(s): Karsten Bolding
!
! $Log: open_restart_ncdf.F90,v $
! Revision 1.6 2010-02-23 08:23:36 kb
! adaptive vertical coordinates - Hofmeister
!
! Revision 1.5 2010-01-21 15:46:23 kb
! fixed BIO-restart
!
......@@ -161,6 +164,9 @@
status = nf90_inq_varid(ncid, "nuh", nuh_id)
if (status .NE. NF90_NOERR) go to 10
status = nf90_inq_varid(ncid, "hn", hn_id)
if (status .NE. NF90_NOERR) go to 10
#ifndef NO_BAROCLINIC
status = nf90_inq_varid(ncid, "T", T_id)
if (status .NE. NF90_NOERR) go to 10
......
!$Id: read_restart_ncdf.F90,v 1.12 2010-01-21 15:46:24 kb Exp $
!$Id: read_restart_ncdf.F90,v 1.13 2010-02-23 08:23:36 kb Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -57,6 +57,9 @@
! Original author(s): Karsten Bolding
!
! $Log: read_restart_ncdf.F90,v $
! Revision 1.13 2010-02-23 08:23:36 kb
! adaptive vertical coordinates - Hofmeister
!
! Revision 1.12 2010-01-21 15:46:24 kb
! fixed BIO-restart
!
......@@ -413,6 +416,14 @@
call update_3d_halo(nuh,nuh,az,imin,jmin,imax,jmax,kmax,H_TAG)
call wait_halo(H_TAG)
! hn is required for adaptive coordinates
status = &
nf90_get_var(ncid,hn_id,hn(iloc:ilen,jloc:jlen,0:kmax),start,edges)
if (status .NE. NF90_NOERR) go to 10
call update_3d_halo(hn,hn,az,imin,jmin,imax,jmax,kmax,H_TAG)
call wait_halo(H_TAG)
#ifndef NO_BAROCLINIC
if (runtype .ge. 3) then
! T is required
......
!$Id: write_restart_ncdf.F90,v 1.11 2010-01-21 15:46:24 kb Exp $
!$Id: write_restart_ncdf.F90,v 1.12 2010-02-23 08:23:36 kb Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -44,6 +44,9 @@
! Original author(s): Karsten Bolding
!
! $Log: write_restart_ncdf.F90,v $
! Revision 1.12 2010-02-23 08:23:36 kb
! adaptive vertical coordinates - Hofmeister
!
! Revision 1.11 2010-01-21 15:46:24 kb
! fixed BIO-restart
!
......@@ -239,6 +242,10 @@
nf90_put_var(ncid,nuh_id,nuh(IRANGE,JRANGE,0:kmax),start,edges)
if (status .NE. NF90_NOERR) go to 10
status = &
nf90_put_var(ncid,hn_id,hn(IRANGE,JRANGE,0:kmax),start,edges)
if (status .NE. NF90_NOERR) go to 10
#ifndef NO_BAROCLINIC
if (runtype .ge. 3) then
status = &
......
!$Id: output.F90,v 1.31 2009-11-20 09:56:55 kb Exp $
!$Id: output.F90,v 1.32 2010-02-23 08:23:36 kb Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -60,6 +60,9 @@
! Original author(s): Karsten Bolding & Hans Burchard
!
! $Log: output.F90,v $
! Revision 1.32 2010-02-23 08:23:36 kb
! adaptive vertical coordinates - Hofmeister
!
! Revision 1.31 2009-11-20 09:56:55 kb
! use new GOTM/BIO interface
!
......@@ -453,6 +456,7 @@
use variables_3d, only: uu,vv,ww
use variables_3d, only: uuEx,vvEx
use variables_3d, only: tke,eps,num,nuh
use variables_3d, only: hn
#ifndef NO_BAROCLINIC
use variables_3d, only: T,S
#endif
......@@ -528,6 +532,7 @@
write(RESTART) uuEx,vvEx
write(RESTART) tke,eps
write(RESTART) num,nuh
write(RESTART) hn
#ifndef NO_BAROCLINIC
if (runtype .ge. 3) then
LEVEL3 'saving 3D baroclinic variables'
......@@ -584,6 +589,7 @@
read(RESTART) uuEx,vvEx
read(RESTART) tke,eps
read(RESTART) num,nuh
read(RESTART) hn
#ifndef NO_BAROCLINIC
if(runtype .ge. 3) then
LEVEL3 'reading 3D baroclinic variables'
......
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