Commit 247916c3 authored by Karsten Bolding's avatar Karsten Bolding

almost feature complete new output method

parent 632a52f5
......@@ -132,6 +132,7 @@
integer :: i,j
integer :: elev_method=1
REALTYPE :: elev_const=_ZERO_
integer,parameter :: rk = kind(_ONE_)
character(LEN = PATH_MAX) :: elev_file='elev.nc'
namelist /m2d/ &
elev_method,elev_const,elev_file, &
......@@ -162,11 +163,9 @@
read(NAMLST,m2d)
! Allocates memory for the public data members - if not static
call init_variables_2d(runtype)
call init_variables_2d(runtype,field_manager)
call init_advection()
call field_manager%register('z', 'm', 'sea surface elevation', standard_name='sea surface elevation', data2d=z(I2DFIELD))
LEVEL2 'Advection of depth-averaged velocities'
#ifdef NO_ADVECT
if (vel2d_adv_hor .ne. NOADV) then
......
......@@ -17,6 +17,7 @@
! {\tt PUBLIC DATA MEMBERS}.
!
! !USES:
use field_manager
use domain, only: imin,imax,jmin,jmax
IMPLICIT NONE
!
......@@ -43,7 +44,7 @@
! !IROUTINE: init_variables_2d - initialise 2D related stuff.
!
! !INTERFACE:
subroutine init_variables_2d(runtype)
subroutine init_variables_2d(runtype,field_manager)
IMPLICIT NONE
!
! !DESCRIPTION:
......@@ -88,9 +89,11 @@
!
! !INPUT PARAMETERS:
integer, intent(in) :: runtype
class (type_field_manager),intent(inout),optional :: field_manager
!
! !LOCAL VARIABLES:
integer :: rc
integer,parameter :: rk = kind(_ONE_)
!EOP
!-------------------------------------------------------------------------
!BOC
......@@ -114,9 +117,13 @@
#endif
z = _ZERO_; zo =_ZERO_
call field_manager%register('z', 'm', 'sea surface elevation', standard_name='sea surface elevation', fill_value=10.05_rk, data2d=z(_2D_W_), category="2d")
call field_manager%register('zo', 'm', 'sea surface elevation', standard_name='sea surface elevation', fill_value=10.05_rk, data2d=zo(_2D_W_), category="2d", output_level=output_level_debug)
zub=_ZERO_ ; zub0=_ZERO_
zvb=_ZERO_ ; zvb0=_ZERO_
D = _ZERO_;
call field_manager%register('D', 'm', 'water depth', standard_name='water depth', fill_value=10.05_rk, data2d=D(_2D_W_), category="2d")
U = _ZERO_; DU = _ZERO_; fU = _ZERO_; Uint = _ZERO_; UEx = _ZERO_
V = _ZERO_; DV = _ZERO_; fV = _ZERO_; Vint = _ZERO_; VEx = _ZERO_
......
......@@ -155,7 +155,7 @@
end if
! Allocates memory for the public data members - if not static
call init_variables_3d(runtype)
call init_variables_3d(runtype,field_manager)
call init_advection_3d()
! Sanity checks for advection specifications
......@@ -286,14 +286,6 @@
if (vert_cord .eq. _ADAPTIVE_COORDS_) call preadapt_coordinates(preadapt)
! need to get a variable of type_field_manager already initialized to here
#if 1
call field_manager%register('hn', 'm', 'layer thickness', standard_name='cell_thickness', dimensions=(/id_dim_z/),data3d=hn(I3DFIELD))
call field_manager%register('temp', 'Celsius', 'temperature', standard_name='', dimensions=(/id_dim_z/),data3d=T(I3DFIELD))
#endif
call field_manager%list()
#ifdef DEBUG
write(debug,*) 'Leaving init_3d()'
write(debug,*)
......
......@@ -111,6 +111,7 @@
! {\tt init\_variables\_3d}) and cleanup (see {\tt clean\_variables\_3d}).
!
! !USES:
use field_manager
use domain, only: imin,imax,jmin,jmax,kmax
IMPLICIT NONE
!
......@@ -159,11 +160,12 @@
! \label{sec-init-variables}
!
! !INTERFACE:
subroutine init_variables_3d(runtype)
subroutine init_variables_3d(runtype,field_manager)
IMPLICIT NONE
!
! !INPUT PARAMETERS:
integer, intent(in) :: runtype
class (type_field_manager),intent(inout),optional :: field_manager
!
! !DESCRIPTION:
! Dynamic allocation of memory for 3D related fields via
......@@ -172,6 +174,7 @@
!
! !LOCAL VARIABLES:
integer :: rc
integer,parameter :: rk = kind(_ONE_)
!EOP
!-------------------------------------------------------------------------
!BOC
......@@ -192,7 +195,14 @@
#endif
hn = _ZERO_ ; hun = _ZERO_ ; hvn = _ZERO_
call field_manager%register('hn', 'm', 'layer thickness', standard_name='cell_thickness', dimensions=(/id_dim_z/),data3d=hn(_3D_W_), category='grid')
call field_manager%register('hun', 'm', 'layer thickness - U-points', standard_name='cell_thickness', dimensions=(/id_dim_z/),data3d=hun(_3D_W_), category='grid', output_level=output_level_debug)
call field_manager%register('hvn', 'm', 'layer thickness - V-points', standard_name='cell_thickness', dimensions=(/id_dim_z/),data3d=hvn(_3D_W_), category='grid', output_level=output_level_debug)
call field_manager%register('temp', 'Celsius', 'temperature', standard_name='', dimensions=(/id_dim_z/),data3d=T(_3D_W_), category='baroclinic')
call field_manager%register('salt', 'PSU', 'salinity', standard_name='', dimensions=(/id_dim_z/),data3d=S(_3D_W_), category='baroclinic')
uu = _ZERO_ ; vv = _ZERO_ ; ww = _ZERO_
#ifdef _MOMENTUM_TERMS_
tdv_u = _ZERO_ ; adv_u = _ZERO_ ; vsd_u = _ZERO_ ; hsd_u = _ZERO_
cor_u = _ZERO_ ; epg_u = _ZERO_ ; ipg_u = _ZERO_
......@@ -200,7 +210,15 @@
cor_v = _ZERO_ ; epg_v = _ZERO_ ; ipg_v = _ZERO_
#endif
ssen = _ZERO_ ; ssun = _ZERO_ ; ssvn = _ZERO_
call field_manager%register('ssen', 'm', 'elevtion at T-points (3D)', standard_name='', data2d=ssen(_2D_W_), category='3d', output_level=output_level_debug)
call field_manager%register('ssun', 'm', 'elevtion at U-points (3D)', standard_name='', data2d=ssun(_2D_W_), category='3d', output_level=output_level_debug)
call field_manager%register('ssvn', 'm', 'elevtion at V-points (3D)', standard_name='', data2d=ssvn(_2D_W_), category='3d', output_level=output_level_debug)
Dn = _ZERO_ ; Dun = _ZERO_ ; Dvn = _ZERO_
#if 0
call field_manager%register('ssen', 'm', 'elevtion at T-points (3D)', standard_name='', data2d=ssen(_2D_W_), category='3d', output_level=output_level_debug)
call field_manager%register('ssun', 'm', 'elevtion at U-points (3D)', standard_name='', data2d=ssun(_2D_W_), category='3d', output_level=output_level_debug)
call field_manager%register('ssvn', 'm', 'elevtion at V-points (3D)', standard_name='', data2d=ssvn(_2D_W_), category='3d', output_level=output_level_debug)
#endif
rru= _ZERO_ ; rrv= _ZERO_
uuEx= _ZERO_ ; vvEx= _ZERO_
tke=1.e-10 ; eps=1.e-10
......@@ -211,6 +229,8 @@
light=_ONE_
idpdx=_ZERO_
idpdy=_ZERO_
call field_manager%register('idpdx', 'm', 'baroclinic pressure gradient - x', standard_name='', dimensions=(/id_dim_z/),data3d=idpdx(_3D_W_), category='baroclinic', output_level=output_level_debug)
call field_manager%register('idpdy', 'm', 'baroclinic pressure gradient - y', standard_name='', dimensions=(/id_dim_z/),data3d=idpdy(_3D_W_), category='baroclinic', output_level=output_level_debug)
#endif
#ifdef DEBUG
......
......@@ -53,8 +53,10 @@
use output, only: init_output,do_output,restart_file,out_dir
use input, only: init_input
use domain, only: init_domain
use domain, only: iextr,jextr,imin,imax,jmin,jmax,kmax
use domain, only: vert_cord,maxdepth
use domain, only: H
use domain, only: iextr,jextr,imin,imax,ioff,jmin,jmax,joff,kmax
use domain, only: xcord,ycord
use domain, only: vert_cord,maxdepth,ga
use time, only: init_time,update_time,write_time_string
use time, only: start,timestr,timestep
use time, only: julianday,secondsofday
......@@ -118,16 +120,26 @@
character(len=PATH_MAX) :: hot_in=''
#if defined SPHERICAL
character(len=8) :: xname='lonc'
character(len=8) :: yname='latc'
character(len=16) :: xname='lonc'
character(len=16) :: xlongname='longitude'
character(len=16) :: xunits='degrees_east'
character(len=16) :: yname='latc'
character(len=16) :: ylongname='latitude'
character(len=16) :: yunits='degrees_north'
#elif defined CURVILINEAR
character(len=8) :: xname='xic'
character(len=8) :: yname='etac'
character(len=16) :: xname='xic'
character(len=16) :: yname='etac'
#else
character(len=8) :: xname='xc'
character(len=8) :: yname='yc'
character(len=16) :: xname='xc'
character(len=16) :: yname='yc'
#endif
character(len=8) :: zname='sigma'
character(len=16) :: zname='sigma'
character(len=64) :: zlongname='sigma'
character(len=16) :: zunits='sigma'
character(len=16) :: postfix
integer,parameter :: rk = kind(_ONE_)
!KB character(len=PATH_MAX) :: zname='lonc'
......@@ -244,24 +256,39 @@
select case (vert_cord)
case (1)
zname = 'sigma'
! zunits = 'sigma_level'
zlongname = 'sigma layers'
zunits = 'sigma_level'
case (2)
zname = 'z'
! zunits = 'm'
zlongname = 'geopotential'
zunits = 'm'
case (3,4,5)
zname = 'level'
! zunits = 'level'
zlongname = 'general vertical coordinates'
zunits = 'level'
case default
end select
#endif
call field_manager_%register_dimension(trim(xname),(imax+HALO)-(imin-HALO)+1,id=id_dim_lon)
call field_manager_%register_dimension(trim(yname),(jmax+HALO)-(jmin-HALO)+1,id=id_dim_lat)
call field_manager_%register_dimension(trim(xname),imax-imin+1,global_length=iextr,offset=ioff,id=id_dim_lon)
call field_manager_%register_dimension(trim(yname),jmax-jmin+1,global_length=jextr,offset=joff,id=id_dim_lat)
call field_manager_%register_dimension(trim(zname),kmax+1,id=id_dim_z)
call field_manager_%register_dimension('time',id=id_dim_time)
call field_manager_%initialize(prepend_by_default=(/id_dim_lon,id_dim_lat/),append_by_default=(/id_dim_time/))
allocate(type_getm_host::output_manager_host)
if (myid .ge. 0) then
write(postfix,'(A,I4.4)') '.',myid
call output_manager_init(field_manager_,trim(postfix))
else
call output_manager_init(field_manager_)
end if
call field_manager_%register(trim(xname),trim(xunits),trim(xlongname),dimensions=(/id_dim_lon/),no_default_dimensions=.true.,data1d=xcord(_IRANGE_NO_HALO_),coordinate_dimension=id_dim_lon)
call field_manager_%register(trim(yname),trim(yunits),trim(ylongname),dimensions=(/id_dim_lat/),no_default_dimensions=.true.,data1d=ycord(_JRANGE_NO_HALO_),coordinate_dimension=id_dim_lat)
call field_manager_%register('bathymetry', 'm', 'bathymetry', standard_name='bathymetry', fill_value=-10._rk, data2d=H(_2D_W_), category='depth',output_level=output_level_required)
!KB call field_manager_%register('bathymetry', 'm', 'bathymetry', standard_name='bathymetry', fill_value=-10._rk, data2d=H(_2D_W_), category='depth',output_level=output_level_required)
!KB call field_manager_%register('bathymetry', 'm', 'bathymetry', standard_name='bathymetry', fill_value=-10._rk, data2d=H(_2D_W_), category='depth',output_level=output_level_required)
call init_meteo(hotstart)
......@@ -274,6 +301,8 @@
#ifndef NO_3D
if (runtype .gt. 1) then
call init_3d(runtype,timestep,hotstart,field_manager_)
STDERR ga
call field_manager_%register(trim(zname),trim(zunits),trim(zlongname),dimensions=(/id_dim_z/),no_default_dimensions=.true.,data1d=ga,coordinate_dimension=id_dim_z)
#ifndef CONSTANT_VISCOSITY
call init_turbulence(60,trim(input_dir) // 'gotmturb.nml',kmax)
#else
......
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