Commit 4bc96b16 authored by Knut's avatar Knut

save_fluxes: register velx2dadv,velx2dadv

parent db0fc4e9
......@@ -16,6 +16,12 @@
allocate(w(I3DFIELD),stat=rc) ! 3D field for w-velocity
if (rc /= 0) stop 'init_3d: Error allocating memory (w)'
allocate(velx2dadv(I2DFIELD),stat=rc) ! 2D field for Uadv-velocity
if (rc /= 0) stop 'init_3d: Error allocating memory (velx2dadv)'
allocate(vely2dadv(I2DFIELD),stat=rc) ! 2D field for Vadv-velocity
if (rc /= 0) stop 'init_3d: Error allocating memory (vely2dadv)'
#ifdef _MOMENTUM_TERMS_
allocate(tdv_u(I3DFIELD),stat=rc) ! 3D field for tdv_u
if (rc /= 0) stop 'init_3d: Error allocating memory (tdv_u)'
......
......@@ -8,6 +8,7 @@
REALTYPE, dimension(:,:,:), allocatable :: uu,vv
REALTYPE, dimension(:,:,:), allocatable, target :: ww
REALTYPE, dimension(:,:,:), allocatable, target :: velx3d,vely3d,w
REALTYPE, dimension(:,:) , allocatable, target :: velx2dadv,vely2dadv
#ifdef _MOMENTUM_TERMS_
REALTYPE, dimension(:,:,:), allocatable, target :: tdv_u,adv_u,vsd_u
......
......@@ -634,7 +634,7 @@
end if
call velocity_update_3d()
call velocity_update_3d(.true.)
call slow_terms()
#endif
......
......@@ -16,6 +16,7 @@
REALTYPE :: vv(I3DFIELD)
REALTYPE, target :: ww(I3DFIELD)
REALTYPE,dimension(I3DFIELD),target :: velx3d,vely3d,w
REALTYPE,dimension(I2DFIELD),target :: velx2dadv,vely2dadv
#ifdef _MOMENTUM_TERMS_
REALTYPE :: tdv_u(I3DFIELD)
......
......@@ -195,6 +195,7 @@
hn = _ZERO_ ; hvel = _ZERO_ ; hun = _ZERO_ ; hvn = _ZERO_
uu = _ZERO_ ; vv = _ZERO_ ; ww = _ZERO_
velx3d = -9999.0 ; vely3d = -9999.0 ; w = -9999.0
velx2dadv = -9999.0 ; vely2dadv = -9999.0
#ifdef _MOMENTUM_TERMS_
tdv_u = _ZERO_ ; adv_u = _ZERO_ ; vsd_u = _ZERO_ ; hsd_u = _ZERO_
......
......@@ -5,18 +5,21 @@
! !ROUTINE: velocity_update_3d - calculate new 3D velocities.
!
! !INTERFACE:
subroutine velocity_update_3d()
subroutine velocity_update_3d(calc_2d)
!
! !DESCRIPTION:
!
! !USES:
use domain
use m2d, only: velocity_update
use variables_3d, only: kmin
use variables_3d, only: hn,ho,uu,vv,ww,hun,hvn,hvel,velx3d,vely3d,w,dt
use variables_2d, only: Uint,Vint
use variables_3d, only: kmin,dt
use variables_3d, only: hn,ho,uu,vv,ww,hun,hvn,hvel,velx3d,vely3d,w
use variables_3d, only: ssen,sseo,Dun,Dvn,Dveln,velx2dadv,vely2dadv
IMPLICIT NONE
!
! !INPUT PARAMETERS:
logical,intent(in) :: calc_2d
!
! !OUTPUT PARAMETERS:
!
......@@ -46,6 +49,12 @@
dxv,dyu,arcd1, &
H,HU,HV,hn,ho,hvel,uu,hun,vv,hvn,ww,vel_missing,w)
if (calc_2d) then
call velocity_update(dt,ssen,sseo,Dveln,Uint,Dun,Vint,Dvn, &
velx=velx2dadv,vely=vely2dadv)
end if
#ifdef DEBUG
write(debug,*) 'Leaving velocity_update_3d()'
write(debug,*)
......
......@@ -455,6 +455,8 @@
call fm%register('velx3d', 'm/s', 'velocity in global x-direction (3D)', standard_name='', dimensions=(/id_dim_z/), data3d=velx3d(_3D_W_), category='3d', fill_value=-9999.0_rk, output_level=output_level_debug)
call fm%register('vely3d', 'm/s', 'velocity in global y-direction (3D)', standard_name='', dimensions=(/id_dim_z/), data3d=vely3d(_3D_W_), category='3d', fill_value=-9999.0_rk, output_level=output_level_debug)
call fm%register('w', 'm2/s', 'vertical velocity', standard_name='', dimensions=(/id_dim_z/), data3d=w(_3D_W_), category='3d', fill_value=-9999.0_rk, output_level=output_level_debug)
call fm%register('velx2dadv', 'm/s', 'depth-avg. velocity in global x-direction (3D)', standard_name='', data2d=velx2dadv(_2D_W_), category='3d', fill_value=-9999.0_rk, output_level=output_level_debug)
call fm%register('vely2dadv', 'm/s', 'depth-avg. velocity in global y-direction (3D)', standard_name='', data2d=vely2dadv(_2D_W_), category='3d', fill_value=-9999.0_rk, output_level=output_level_debug)
call fm%register('SS', 's-2', 'shear frequency squared', standard_name='', dimensions=(/id_dim_z/), data3d=SS(_3D_W_), category='3d', output_level=output_level_debug)
end if
......
......@@ -14,15 +14,13 @@
use exceptions
use ncdf_3d
use grid_ncdf, only: xlen,ylen,zlen
use domain, only: ioff,joff,imin,imax,jmin,jmax,kmax
use domain, only: H,HU,HV,az,au,av,min_depth
use domain, only: convc
use domain, only: grid_type,xc,xu,xv,yc,yu,yv
use domain, only: imin,imax,jmin,jmax,kmax
use domain, only: H,az,au,av,min_depth
use domain, only: dxv,dyu,arcd1
use variables_2d, only: Uinto,Vinto
use variables_3d, only: sseo,ssen,Dn,Dveln,Dun,Dvn
use variables_3d, only: dt,kmin,ho,hn,hvel,uu,hun,vv,hvn,ww,hcc,SS
use variables_3d, only: velx3d,vely3d,w
use variables_3d, only: ssen,Dn
use variables_3d, only: kmin,hn,uu,vv,ww,hcc,SS
use variables_3d, only: velx3d,vely3d,w,velx2dadv,vely2dadv
use variables_3d, only: taubx,tauby
#ifdef _MOMENTUM_TERMS_
use variables_3d, only: tdv_u,adv_u,vsd_u,hsd_u,cor_u,epg_u,ipg_u
......@@ -65,7 +63,7 @@
integer :: start(4),edges(4)
integer, save :: n3d=0
REALTYPE :: dum(1)
REALTYPE,dimension(E2DFIELD) :: ws2d,wrk2d
REALTYPE,dimension(E2DFIELD) :: ws2d
REALTYPE,dimension(I3DFIELD) :: ws
integer :: k
!EOP
......@@ -131,21 +129,11 @@
! avg. velocities
if (u_id .ne. -1) then
wrk2d = _ZERO_
call to_u(imin,jmin,imax,jmax,az, &
dt,grid_type, &
dxv,dyu,arcd1, &
xc,xu,xv,ssen,sseo,Dveln,Uinto,Dun,Vinto,Dvn,wrk2d,wrk2d,vel_missing,ws2d)
err = nf90_put_var(ncid,u_id,ws2d(_2D_W_),start,edges)
err = nf90_put_var(ncid,u_id,velx2dadv(_2D_W_),start,edges)
if (err .NE. NF90_NOERR) go to 10
end if
if (v_id .ne. -1) then
wrk2d = _ZERO_
call to_v(imin,jmin,imax,jmax,az, &
dt,grid_type, &
dxv,dyu,arcd1, &
yc,yu,yv,ssen,sseo,Dveln,Uinto,Dun,Vinto,Dvn,wrk2d,wrk2d,vel_missing,ws2d)
err = nf90_put_var(ncid,v_id,ws2d(_2D_W_),start,edges)
err = nf90_put_var(ncid,v_id,vely2dadv(_2D_W_),start,edges)
if (err .NE. NF90_NOERR) go to 10
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