Commit 257e2e8c authored by Karsten Bolding's avatar Karsten Bolding

moved all registration of variables to register_all_variables()

parent 247916c3
......@@ -18,7 +18,6 @@
! in from the library {\tt lib2d.a}.
!
! !USES:
use field_manager
use exceptions
use time, only: julianday,secondsofday
use parameters, only: avmmol
......@@ -106,14 +105,13 @@
! !IROUTINE: init_2d - initialise 2D related stuff.
!
! !INTERFACE:
subroutine init_2d(runtype,timestep,hotstart,field_manager)
subroutine init_2d(runtype,timestep,hotstart)
IMPLICIT NONE
!
! !INPUT PARAMETERS:
integer, intent(in) :: runtype
REALTYPE, intent(in) :: timestep
logical, intent(in) :: hotstart
class (type_field_manager),intent(inout),optional :: field_manager
!
! !INPUT/OUTPUT PARAMETERS:
!
......@@ -163,7 +161,7 @@
read(NAMLST,m2d)
! Allocates memory for the public data members - if not static
call init_variables_2d(runtype,field_manager)
call init_variables_2d(runtype)
call init_advection()
LEVEL2 'Advection of depth-averaged velocities'
......
......@@ -17,7 +17,6 @@
! {\tt PUBLIC DATA MEMBERS}.
!
! !USES:
use field_manager
use domain, only: imin,imax,jmin,jmax
IMPLICIT NONE
!
......@@ -44,7 +43,7 @@
! !IROUTINE: init_variables_2d - initialise 2D related stuff.
!
! !INTERFACE:
subroutine init_variables_2d(runtype,field_manager)
subroutine init_variables_2d(runtype)
IMPLICIT NONE
!
! !DESCRIPTION:
......@@ -89,7 +88,6 @@
!
! !INPUT PARAMETERS:
integer, intent(in) :: runtype
class (type_field_manager),intent(inout),optional :: field_manager
!
! !LOCAL VARIABLES:
integer :: rc
......@@ -117,13 +115,10 @@
#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_
......
......@@ -23,7 +23,6 @@
! section \ref{sec-clean-3d} on page \pageref{sec-clean-3d}.
!
! !USES:
use field_manager
use exceptions
use parameters, only: avmmol
use domain, only: openbdy,maxdepth,vert_cord,az
......@@ -86,7 +85,7 @@
! !IROUTINE: init_3d - initialise 3D related stuff \label{sec-init-3d}
!
! !INTERFACE:
subroutine init_3d(runtype,timestep,hotstart,field_manager)
subroutine init_3d(runtype,timestep,hotstart)
!
IMPLICIT NONE
!
......@@ -94,7 +93,6 @@
integer, intent(in) :: runtype
REALTYPE, intent(in) :: timestep
logical, intent(in) :: hotstart
class (type_field_manager),intent(inout),optional :: field_manager
!
! !DESCRIPTION:
! Here, the {\tt m3d} namelist is read from {\tt getm.inp}, and the
......@@ -155,7 +153,7 @@
end if
! Allocates memory for the public data members - if not static
call init_variables_3d(runtype,field_manager)
call init_variables_3d(runtype)
call init_advection_3d()
! Sanity checks for advection specifications
......
......@@ -111,7 +111,6 @@
! {\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
!
......@@ -160,12 +159,11 @@
! \label{sec-init-variables}
!
! !INTERFACE:
subroutine init_variables_3d(runtype,field_manager)
subroutine init_variables_3d(runtype)
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
......@@ -195,11 +193,6 @@
#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_
......@@ -210,15 +203,6 @@
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
......@@ -229,8 +213,6 @@
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
......
......@@ -275,6 +275,7 @@ add_library(getm OBJECT
getm/cleanup.F90
getm/initialise.F90
getm/integration.F90
getm/register_all_variables.F90
)
add_library(input OBJECT
......
......@@ -24,7 +24,7 @@
! !REVISION HISTORY:
! Original author(s): Karsten Bolding & Hans Burchard
type (type_field_manager),target :: field_manager_
type (type_field_manager),target :: fm
type,extends(type_output_manager_host) :: type_getm_host
contains
......@@ -119,30 +119,8 @@
#endif
character(len=PATH_MAX) :: hot_in=''
#if defined SPHERICAL
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=16) :: xname='xic'
character(len=16) :: yname='etac'
#else
character(len=16) :: xname='xc'
character(len=16) :: yname='yc'
#endif
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'
namelist /param/ &
dryrun,runid,title,parallel,runtype, &
hotstart,use_epoch,save_initial
......@@ -243,7 +221,6 @@
FATAL 'A non valid runtype has been specified.'
stop 'initialise()'
end select
!KB
call init_time(MinN,MaxN)
if(use_epoch) then
......@@ -252,57 +229,17 @@
call init_domain(input_dir)
#ifndef NO_3D
select case (vert_cord)
case (1)
zname = 'sigma'
zlongname = 'sigma layers'
zunits = 'sigma_level'
case (2)
zname = 'z'
zlongname = 'geopotential'
zunits = 'm'
case (3,4,5)
zname = 'level'
zlongname = 'general vertical coordinates'
zunits = 'level'
case default
end select
#endif
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)
#ifndef NO_3D
call init_rivers()
#endif
call init_2d(runtype,timestep,hotstart,field_manager_)
call init_2d(runtype,timestep,hotstart)
#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)
call init_3d(runtype,timestep,hotstart)
#ifndef CONSTANT_VISCOSITY
call init_turbulence(60,trim(input_dir) // 'gotmturb.nml',kmax)
#else
......@@ -325,6 +262,14 @@ STDERR ga
#endif
end if
#endif
call register_all_variables(fm)
allocate(type_getm_host::output_manager_host)
if (myid .ge. 0) then
write(postfix,'(A,I4.4)') '.',myid
call output_manager_init(fm,trim(postfix))
else
call output_manager_init(fm)
end if
! call init_output(runid,title,start,runtype,dryrun,myid)
call init_output(runid,title,start,runtype,dryrun,myid,MinN,MaxN,save_initial)
......
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
!
! !ROUTINE: register_all_variables() - register GETM variables.
!
! !INTERFACE:
subroutine register_all_variables(fm)
!
! !DESCRIPTION:
!
! !USES:
use field_manager
use domain
use meteo
use variables_2d
use variables_3d
IMPLICIT NONE
!
! !INPUT/OUTPUT PARAMETERS:
!KB class (type_field_manager), target intent(inout) :: fm
type (type_field_manager), target :: fm
!
! !OUTPUT PARAMETERS:
!
! !REVISION HISTORY:
! Original author(s): Karsten Bolding & Hans Burchard
!
! !LOCAL VARIABLES:
integer,parameter :: rk = kind(_ONE_)
#if defined SPHERICAL
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=16) :: xname='xic'
character(len=16) :: yname='etac'
#else
character(len=16) :: xname='xc'
character(len=16) :: yname='yc'
#endif
character(len=16) :: zname='sigma'
character(len=64) :: zlongname='sigma'
character(len=16) :: zunits='sigma'
!EOP
!-----------------------------------------------------------------------
!BOC
LEVEL1 'register_all_variables()'
#ifndef NO_3D
select case (vert_cord)
case (1)
zname = 'sigma'
zlongname = 'sigma layers'
zunits = 'sigma_level'
case (2)
zname = 'z'
zlongname = 'geopotential'
zunits = 'm'
case (3,4,5)
zname = 'level'
zlongname = 'general vertical coordinates'
zunits = 'level'
case default
end select
#endif
! register - dimensions
call fm%register_dimension(trim(xname),imax-imin+1,global_length=iextr,offset=ioff,id=id_dim_lon)
call fm%register_dimension(trim(yname),jmax-jmin+1,global_length=jextr,offset=joff,id=id_dim_lat)
call fm%register_dimension(trim(zname),kmax+1,id=id_dim_z)
call fm%register_dimension('time',id=id_dim_time)
call fm%initialize(prepend_by_default=(/id_dim_lon,id_dim_lat/),append_by_default=(/id_dim_time/))
! register - domain
call fm%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 fm%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 fm%register(trim(zname),trim(zunits),trim(zlongname),dimensions=(/id_dim_z/),no_default_dimensions=.true.,data1d=ga,coordinate_dimension=id_dim_z)
call fm%register('bathymetry', 'm', 'bathymetry', standard_name='bathymetry', dimensions=(/id_dim_lon,id_dim_lat/), no_default_dimensions=.true., fill_value=-10._rk, data2d=H(_2D_W_), category='domain',output_level=output_level_required)
! register - metric
call fm%register('dxc', 'm', 'dx at T-points', dimensions=(/id_dim_lon,id_dim_lat/), no_default_dimensions=.true., data2d=dxc(_2D_W_), category="metrics", output_level=output_level_debug)
call fm%register('dyc', 'm', 'dy at T-points', dimensions=(/id_dim_lon,id_dim_lat/), no_default_dimensions=.true., data2d=dyc(_2D_W_), category="metrics", output_level=output_level_debug)
! category - 2d
call fm%register('z', 'm', 'sea surface elevation', standard_name='sea surface elevation', fill_value=10.05_rk, data2d=z(_2D_W_), category="2d")
call fm%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)
call fm%register('D', 'm', 'water depth', standard_name='water depth', fill_value=10.05_rk, data2d=D(_2D_W_), category="2d")
! category - 3d
call fm%register('hn', 'm', 'layer thickness', standard_name='cell_thickness', dimensions=(/id_dim_z/),data3d=hn(_3D_W_), category='grid')
call fm%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 fm%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 fm%register('ssen', 'm', 'elevtion at T-points (3D)', standard_name='', data2d=ssen(_2D_W_), category='3d', output_level=output_level_debug)
call fm%register('ssun', 'm', 'elevtion at U-points (3D)', standard_name='', data2d=ssun(_2D_W_), category='3d', output_level=output_level_debug)
call fm%register('ssvn', 'm', 'elevtion at V-points (3D)', standard_name='', data2d=ssvn(_2D_W_), category='3d', output_level=output_level_debug)
#ifndef NO_BAROCLINIC
call fm%register('temp', 'Celsius', 'temperature', standard_name='', dimensions=(/id_dim_z/),data3d=T(_3D_W_), category='baroclinic')
call fm%register('salt', 'PSU', 'salinity', standard_name='', dimensions=(/id_dim_z/),data3d=S(_3D_W_), category='baroclinic')
call fm%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 fm%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
return
end subroutine register_all_variables
!EOC
!-----------------------------------------------------------------------
! Copyright (C) 2015 - Karsten Bolding and Jorn Bruggeman(BB) !
!-----------------------------------------------------------------------
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