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

almost feature complete new output method

parent 632a52f5
...@@ -132,6 +132,7 @@ ...@@ -132,6 +132,7 @@
integer :: i,j integer :: i,j
integer :: elev_method=1 integer :: elev_method=1
REALTYPE :: elev_const=_ZERO_ REALTYPE :: elev_const=_ZERO_
integer,parameter :: rk = kind(_ONE_)
character(LEN = PATH_MAX) :: elev_file='elev.nc' character(LEN = PATH_MAX) :: elev_file='elev.nc'
namelist /m2d/ & namelist /m2d/ &
elev_method,elev_const,elev_file, & elev_method,elev_const,elev_file, &
...@@ -162,11 +163,9 @@ ...@@ -162,11 +163,9 @@
read(NAMLST,m2d) read(NAMLST,m2d)
! Allocates memory for the public data members - if not static ! 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 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' LEVEL2 'Advection of depth-averaged velocities'
#ifdef NO_ADVECT #ifdef NO_ADVECT
if (vel2d_adv_hor .ne. NOADV) then if (vel2d_adv_hor .ne. NOADV) then
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
! {\tt PUBLIC DATA MEMBERS}. ! {\tt PUBLIC DATA MEMBERS}.
! !
! !USES: ! !USES:
use field_manager
use domain, only: imin,imax,jmin,jmax use domain, only: imin,imax,jmin,jmax
IMPLICIT NONE IMPLICIT NONE
! !
...@@ -43,7 +44,7 @@ ...@@ -43,7 +44,7 @@
! !IROUTINE: init_variables_2d - initialise 2D related stuff. ! !IROUTINE: init_variables_2d - initialise 2D related stuff.
! !
! !INTERFACE: ! !INTERFACE:
subroutine init_variables_2d(runtype) subroutine init_variables_2d(runtype,field_manager)
IMPLICIT NONE IMPLICIT NONE
! !
! !DESCRIPTION: ! !DESCRIPTION:
...@@ -88,9 +89,11 @@ ...@@ -88,9 +89,11 @@
! !
! !INPUT PARAMETERS: ! !INPUT PARAMETERS:
integer, intent(in) :: runtype integer, intent(in) :: runtype
class (type_field_manager),intent(inout),optional :: field_manager
! !
! !LOCAL VARIABLES: ! !LOCAL VARIABLES:
integer :: rc integer :: rc
integer,parameter :: rk = kind(_ONE_)
!EOP !EOP
!------------------------------------------------------------------------- !-------------------------------------------------------------------------
!BOC !BOC
...@@ -114,9 +117,13 @@ ...@@ -114,9 +117,13 @@
#endif #endif
z = _ZERO_; zo =_ZERO_ 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_ zub=_ZERO_ ; zub0=_ZERO_
zvb=_ZERO_ ; zvb0=_ZERO_ zvb=_ZERO_ ; zvb0=_ZERO_
D = _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_ U = _ZERO_; DU = _ZERO_; fU = _ZERO_; Uint = _ZERO_; UEx = _ZERO_
V = _ZERO_; DV = _ZERO_; fV = _ZERO_; Vint = _ZERO_; VEx = _ZERO_ V = _ZERO_; DV = _ZERO_; fV = _ZERO_; Vint = _ZERO_; VEx = _ZERO_
......
...@@ -155,7 +155,7 @@ ...@@ -155,7 +155,7 @@
end if end if
! Allocates memory for the public data members - if not static ! 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() call init_advection_3d()
! Sanity checks for advection specifications ! Sanity checks for advection specifications
...@@ -286,14 +286,6 @@ ...@@ -286,14 +286,6 @@
if (vert_cord .eq. _ADAPTIVE_COORDS_) call preadapt_coordinates(preadapt) 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 #ifdef DEBUG
write(debug,*) 'Leaving init_3d()' write(debug,*) 'Leaving init_3d()'
write(debug,*) write(debug,*)
......
...@@ -111,6 +111,7 @@ ...@@ -111,6 +111,7 @@
! {\tt init\_variables\_3d}) and cleanup (see {\tt clean\_variables\_3d}). ! {\tt init\_variables\_3d}) and cleanup (see {\tt clean\_variables\_3d}).
! !
! !USES: ! !USES:
use field_manager
use domain, only: imin,imax,jmin,jmax,kmax use domain, only: imin,imax,jmin,jmax,kmax
IMPLICIT NONE IMPLICIT NONE
! !
...@@ -159,11 +160,12 @@ ...@@ -159,11 +160,12 @@
! \label{sec-init-variables} ! \label{sec-init-variables}
! !
! !INTERFACE: ! !INTERFACE:
subroutine init_variables_3d(runtype) subroutine init_variables_3d(runtype,field_manager)
IMPLICIT NONE IMPLICIT NONE
! !
! !INPUT PARAMETERS: ! !INPUT PARAMETERS:
integer, intent(in) :: runtype integer, intent(in) :: runtype
class (type_field_manager),intent(inout),optional :: field_manager
! !
! !DESCRIPTION: ! !DESCRIPTION:
! Dynamic allocation of memory for 3D related fields via ! Dynamic allocation of memory for 3D related fields via
...@@ -172,6 +174,7 @@ ...@@ -172,6 +174,7 @@
! !
! !LOCAL VARIABLES: ! !LOCAL VARIABLES:
integer :: rc integer :: rc
integer,parameter :: rk = kind(_ONE_)
!EOP !EOP
!------------------------------------------------------------------------- !-------------------------------------------------------------------------
!BOC !BOC
...@@ -192,7 +195,14 @@ ...@@ -192,7 +195,14 @@
#endif #endif
hn = _ZERO_ ; hun = _ZERO_ ; hvn = _ZERO_ 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_ uu = _ZERO_ ; vv = _ZERO_ ; ww = _ZERO_
#ifdef _MOMENTUM_TERMS_ #ifdef _MOMENTUM_TERMS_
tdv_u = _ZERO_ ; adv_u = _ZERO_ ; vsd_u = _ZERO_ ; hsd_u = _ZERO_ tdv_u = _ZERO_ ; adv_u = _ZERO_ ; vsd_u = _ZERO_ ; hsd_u = _ZERO_
cor_u = _ZERO_ ; epg_u = _ZERO_ ; ipg_u = _ZERO_ cor_u = _ZERO_ ; epg_u = _ZERO_ ; ipg_u = _ZERO_
...@@ -200,7 +210,15 @@ ...@@ -200,7 +210,15 @@
cor_v = _ZERO_ ; epg_v = _ZERO_ ; ipg_v = _ZERO_ cor_v = _ZERO_ ; epg_v = _ZERO_ ; ipg_v = _ZERO_
#endif #endif
ssen = _ZERO_ ; ssun = _ZERO_ ; ssvn = _ZERO_ 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_ 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_ rru= _ZERO_ ; rrv= _ZERO_
uuEx= _ZERO_ ; vvEx= _ZERO_ uuEx= _ZERO_ ; vvEx= _ZERO_
tke=1.e-10 ; eps=1.e-10 tke=1.e-10 ; eps=1.e-10
...@@ -211,6 +229,8 @@ ...@@ -211,6 +229,8 @@
light=_ONE_ light=_ONE_
idpdx=_ZERO_ idpdx=_ZERO_
idpdy=_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 #endif
#ifdef DEBUG #ifdef DEBUG
......
...@@ -53,8 +53,10 @@ ...@@ -53,8 +53,10 @@
use output, only: init_output,do_output,restart_file,out_dir use output, only: init_output,do_output,restart_file,out_dir
use input, only: init_input use input, only: init_input
use domain, only: init_domain use domain, only: init_domain
use domain, only: iextr,jextr,imin,imax,jmin,jmax,kmax use domain, only: H
use domain, only: vert_cord,maxdepth 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: init_time,update_time,write_time_string
use time, only: start,timestr,timestep use time, only: start,timestr,timestep
use time, only: julianday,secondsofday use time, only: julianday,secondsofday
...@@ -118,16 +120,26 @@ ...@@ -118,16 +120,26 @@
character(len=PATH_MAX) :: hot_in='' character(len=PATH_MAX) :: hot_in=''
#if defined SPHERICAL #if defined SPHERICAL
character(len=8) :: xname='lonc' character(len=16) :: xname='lonc'
character(len=8) :: yname='latc' 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 #elif defined CURVILINEAR
character(len=8) :: xname='xic' character(len=16) :: xname='xic'
character(len=8) :: yname='etac' character(len=16) :: yname='etac'
#else #else
character(len=8) :: xname='xc' character(len=16) :: xname='xc'
character(len=8) :: yname='yc' character(len=16) :: yname='yc'
#endif #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' !KB character(len=PATH_MAX) :: zname='lonc'
...@@ -243,25 +255,40 @@ ...@@ -243,25 +255,40 @@
#ifndef NO_3D #ifndef NO_3D
select case (vert_cord) select case (vert_cord)
case (1) case (1)
zname = 'sigma' zname = 'sigma'
! zunits = 'sigma_level' zlongname = 'sigma layers'
zunits = 'sigma_level'
case (2) case (2)
zname = 'z' zname = 'z'
! zunits = 'm' zlongname = 'geopotential'
zunits = 'm'
case (3,4,5) case (3,4,5)
zname = 'level' zname = 'level'
! zunits = 'level' zlongname = 'general vertical coordinates'
zunits = 'level'
case default case default
end select end select
#endif #endif
call field_manager_%register_dimension(trim(xname),(imax+HALO)-(imin-HALO)+1,id=id_dim_lon) 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+HALO)-(jmin-HALO)+1,id=id_dim_lat) 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(trim(zname),kmax+1,id=id_dim_z)
call field_manager_%register_dimension('time',id=id_dim_time) 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/)) 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) allocate(type_getm_host::output_manager_host)
call output_manager_init(field_manager_)
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) call init_meteo(hotstart)
...@@ -274,6 +301,8 @@ ...@@ -274,6 +301,8 @@
#ifndef NO_3D #ifndef NO_3D
if (runtype .gt. 1) then if (runtype .gt. 1) then
call init_3d(runtype,timestep,hotstart,field_manager_) 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 #ifndef CONSTANT_VISCOSITY
call init_turbulence(60,trim(input_dir) // 'gotmturb.nml',kmax) call init_turbulence(60,trim(input_dir) // 'gotmturb.nml',kmax)
#else #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