Commit 8800a0c4 authored by kbk's avatar kbk
Browse files

hydrostatic consistency criteria stored in .3d.nc file

parent 0831b438
#$Id: Makefile,v 1.6 2004-04-21 15:15:55 hb Exp $
#$Id: Makefile,v 1.7 2004-05-04 09:23:51 kbk 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 bdy_3d.F90 coordinates.F90 bottom_friction_3d.F90 internal_pressure.F90 uu_momentum_3d.F90 vv_momentum_3d.F90 ww_momentum_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 check_h.F90
LIBSRC = start_macro.F90 hcc_check.F90 bdy_3d.F90 coordinates.F90 check_h.F90 bottom_friction_3d.F90 internal_pressure.F90 uu_momentum_3d.F90 vv_momentum_3d.F90 ww_momentum_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
SRC = $(MODSRC) $(LIBSRC)
......@@ -36,6 +36,7 @@ $(LIB)(rivers.o)
OBJ = \
$(LIB)(start_macro.o) \
$(LIB)(hcc_check.o) \
$(LIB)(coordinates.o) \
$(LIB)(bottom_friction_3d.o) \
$(LIB)(uu_momentum_3d.o) \
......
......@@ -25,6 +25,9 @@
allocate(hvn(I3DFIELD),stat=rc) ! 3D field for new box height (v-column)
if (rc /= 0) stop 'init_3d: Error allocating memory (hvn)'
allocate(hcc(I3DFIELD),stat=rc) ! Hydrostatic consistency check
if (rc /= 0) stop 'init_3d: Error allocating memory (hcc)'
allocate(uuEx(I3DFIELD),stat=rc) ! 3D field for explicit terms in u-equation
if (rc /= 0) stop 'init_3d: Error allocating memory (uuEx)'
......
! Remember to update this value if you add more 3D arrays.
#ifdef UV_TVD
integer,parameter :: n3d_fields=29
integer,parameter :: n3d_fields=30
#else
integer,parameter :: n3d_fields=22
integer,parameter :: n3d_fields=23
#endif
! Number of vertical layers in z,u,v columns
......@@ -13,6 +13,7 @@
REALTYPE, dimension(:,:,:), allocatable :: ho,hn
REALTYPE, dimension(:,:,:), allocatable :: huo,hun
REALTYPE, dimension(:,:,:), allocatable :: hvo,hvn
REALTYPE, dimension(:,:,:), allocatable :: hcc
REALTYPE, dimension(:,:,:), allocatable :: uuEx,vvEx
REALTYPE, dimension(:,:,:), allocatable :: num,nuh
REALTYPE, dimension(:,:,:), allocatable :: tke,eps
......
!$Id: hcc_check.F90,v 1.1 2004-05-04 09:23:51 kbk Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
!
! !ROUTINE: hcc_check() - hydrostatic consistency criteria
!
! !INTERFACE:
subroutine hcc_check()
!
! !DESCRIPTION:
!
! !USES:
use domain, only: imin,imax,jmin,jmax,az,au,av,HU,HV
use domain, only: iimin,iimax,jjmin,jjmax,kmax
use variables_3d, only: hn,hun,hvn,hcc
IMPLICIT NONE
!
! !REVISION HISTORY:
! Original author(s): Karsten Bolding & Hans Burchard
!
! $Log: hcc_check.F90,v $
! Revision 1.1 2004-05-04 09:23:51 kbk
! hydrostatic consistency criteria stored in .3d.nc file
!
!
! !LOCAL VARIABLES:
integer :: i,j,k
REALTYPE :: du1,du2,dv1,dv2
REALTYPE :: x,y
!EOP
!-----------------------------------------------------------------------
!BOC
LEVEL2 'HCC check'
do j=jjmin,jjmax
do i=iimin,iimax
if (az(i,j) .ge. 1) then
du1=HU(i-1,j)
du2=HU(i,j)
dv1=HV(i,j-1)
dv2=HV(i,j)
do k=1,kmax
if (au(i-1,j) .ge. 1 .and. au(i,j) .ge. 1) then
du1 = du1+0.5*hun(i-1,j,k)
du2 = du2+0.5*hun(i,j,k)
else
du1 = _ZERO_
du2 = _ZERO_
end if
if (av(i,j-1) .ge. 1 .and. av(i,j) .ge. 1) then
dv1 = dv1+0.5*hvn(i,j-1,k)
dv2 = dv2+0.5*hvn(i,j,k)
else
dv1 = _ZERO_
dv2 = _ZERO_
end if
x = (du2-du1)/hn(i,j,k)
y = (dv2-dv1)/hn(i,j,k)
hcc(i,j,k) = max(abs(x),abs(y))
if (au(i-1,j) .ge. 1 .and. au(i,j) .ge. 1) then
du1 = du1+0.5*hun(i-1,j,k)
du2 = du2+0.5*hun(i,j,k)
else
du1 = _ZERO_
du2 = _ZERO_
end if
if (av(i,j-1) .ge. 1 .and. av(i,j) .ge. 1) then
dv1 = dv1+0.5*hvn(i,j-1,k)
dv2 = dv2+0.5*hvn(i,j,k)
else
dv1 = _ZERO_
dv2 = _ZERO_
end if
end do
end if
end do
end do
return
end subroutine hcc_check
!EOC
!-----------------------------------------------------------------------
! Copyright (C) 2004 - Hans Burchard and Karsten Bolding (BBH) !
!-----------------------------------------------------------------------
!$Id: m3d.F90,v 1.17 2004-04-23 09:03:59 kbk Exp $
!$Id: m3d.F90,v 1.18 2004-05-04 09:23:51 kbk Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -52,7 +52,10 @@
! Original author(s): Karsten Bolding & Hans Burchard
!
! $Log: m3d.F90,v $
! Revision 1.17 2004-04-23 09:03:59 kbk
! Revision 1.18 2004-05-04 09:23:51 kbk
! hydrostatic consistency criteria stored in .3d.nc file
!
! Revision 1.17 2004/04/23 09:03:59 kbk
! reverted to pre-adaptive grid version
!
! Revision 1.15 2004/04/20 16:49:37 hb
......@@ -321,6 +324,7 @@
if (.not. hotstart) then
call start_macro()
call coordinates(vert_cord,cord_relax,maxdepth)
call hcc_check()
end if
#ifndef NO_BAROCLINIC
......
......@@ -22,6 +22,7 @@
REALTYPE :: hun(I3DFIELD)
REALTYPE :: hvo(I3DFIELD)
REALTYPE :: hvn(I3DFIELD)
REALTYPE :: hcc(I3DFIELD)
REALTYPE :: uuEx(I3DFIELD)
REALTYPE :: vvEx(I3DFIELD)
REALTYPE :: num(I3DFIELD)
......
!$Id: init_3d_ncdf.F90,v 1.5 2003-12-16 12:51:04 kbk Exp $
!$Id: init_3d_ncdf.F90,v 1.6 2004-05-04 09:23:51 kbk Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -30,7 +30,10 @@
! !REVISION HISTORY:
!
! $Log: init_3d_ncdf.F90,v $
! Revision 1.5 2003-12-16 12:51:04 kbk
! Revision 1.6 2004-05-04 09:23:51 kbk
! hydrostatic consistency criteria stored in .3d.nc file
!
! Revision 1.5 2003/12/16 12:51:04 kbk
! preparing for proper support for SPM (manuel)
!
! Revision 1.4 2003/05/09 11:38:26 kbk
......@@ -220,6 +223,17 @@
long_name='bathymetry',units='meters', &
FillValue=fv,missing_value=mv,valid_range=vr)
! hydrostatic consistency criteria
err = nf_def_var(ncid,'hcc',NF_REAL,3,f4_dims,hcc_id)
if (err .NE. NF_NOERR) go to 10
fv = -_ONE_
mv = -_ONE_
vr(1) = 0.
vr(2) = 1.
call set_attributes(ncid,hcc_id, &
long_name='hcc',units=' ', &
FillValue=fv,missing_value=mv,valid_range=vr)
! now to the variables
! elevation
err = nf_def_var(ncid,'elev',NF_REAL,3,f3_dims,elev_id)
......
!$Id: ncdf_3d.F90,v 1.4 2003-12-16 12:51:04 kbk Exp $
!$Id: ncdf_3d.F90,v 1.5 2004-05-04 09:23:51 kbk Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -30,6 +30,7 @@
integer :: lonc_id,latc_id
integer :: time_id
integer :: bathymetry_id
integer :: hcc_id
integer :: h_id=-1
integer :: elev_id,u_id,v_id
integer :: uu_id,vv_id,w_id
......@@ -60,7 +61,10 @@
! Original author(s): Karsten Bolding & Hans Burchard
!
! $Log: ncdf_3d.F90,v $
! Revision 1.4 2003-12-16 12:51:04 kbk
! Revision 1.5 2004-05-04 09:23:51 kbk
! hydrostatic consistency criteria stored in .3d.nc file
!
! Revision 1.4 2003/12/16 12:51:04 kbk
! preparing for proper support for SPM (manuel)
!
! Revision 1.3 2003/05/09 11:38:26 kbk
......
!$Id: save_3d_ncdf.F90,v 1.7 2003-12-16 12:47:11 kbk Exp $
!$Id: save_3d_ncdf.F90,v 1.8 2004-05-04 09:23:51 kbk Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -23,7 +23,7 @@
use domain, only: iimin,iimax,jjmin,jjmax,kmax
use domain, only: grid_type,vert_cord,ga
use variables_2d, only: z,D,u,DU,v,DV
use variables_3d, only: kmin,hn,uu,hun,vv,hvn,ww
use variables_3d, only: kmin,hn,uu,hun,vv,hvn,ww,hcc
#ifndef NO_BAROCLINIC
use variables_3d, only: S,T,rho
#endif
......@@ -45,7 +45,10 @@
! Original author(s): Karsten Bolding & Hans Burchard
!
! $Log: save_3d_ncdf.F90,v $
! Revision 1.7 2003-12-16 12:47:11 kbk
! Revision 1.8 2004-05-04 09:23:51 kbk
! hydrostatic consistency criteria stored in .3d.nc file
!
! Revision 1.7 2003/12/16 12:47:11 kbk
! rho_0 and g from parameters (manuel)
!
! Revision 1.6 2003/12/08 07:21:53 hb
......@@ -169,6 +172,13 @@
err = nf_put_vara_real(ncid,bathymetry_id,start,edges,ws)
if (err .NE. NF_NOERR) go to 10
start(3) = 1
edges(3) = zlen
call cnv_3d(imin,jmin,imax,jmax,iimin,jjmin,iimax,jjmax,kmax, &
kmin,az,hcc,-_ONE_,ws)
err = nf_put_vara_real(ncid,hcc_id,start,edges,ws)
if (err .NE. NF_NOERR) go to 10
err = nf_sync(ncid)
if (err .NE. NF_NOERR) go to 10
......
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