Commit a0225d79 authored by Karsten Bolding's avatar Karsten Bolding

cleanup, merged processed_variables into output_processing, hack for...

cleanup, merged processed_variables into output_processing, hack for update_time() - should be looked at
parent e0579c24
......@@ -217,12 +217,6 @@
call fm%register('D', 'm', 'water depth', standard_name='water depth', fill_value=-10009.0_rk, data2d=D(_2D_W_), category="2d")
call fm%register('U', 'm2/s', 'transport in local x-direction', standard_name='', data2d=U(_2D_W_), category='2d', output_level=output_level_debug)
call fm%register('V', 'm2/s', 'transport in local y-direction', standard_name='', data2d=V(_2D_W_), category='2d', output_level=output_level_debug)
#if 0
call fm%register('u2d', 'm/s', 'velocity in local x-direction', standard_name='', data2d=u_2d(_2D_W_), category='velocities')
call fm%register('v2d', 'm/s', 'velocity in local y-direction', standard_name='', data2d=v_2d(_2D_W_), category='velocities')
call fm%register('u2d_destag', 'm/s', 'velocity in local x-direction(destag)', standard_name='', data2d=u_2d_destag(_2D_W_), category='velocities',output_level=output_level_debug)
call fm%register('v2d_destag', 'm/s', 'velocity in local y-direction(destag)', standard_name='', data2d=v_2d_destag(_2D_W_), category='velocities',output_level=output_level_debug)
#endif
return
end subroutine register_2d_variables
......
......@@ -353,7 +353,6 @@ add_library(output OBJECT
output/diagnostic_variables.F90
output/ncdf_out.F90
output/nesting.F90
output/processed_variables.F90
output/output_processing.F90
output/output.F90
)
......
......@@ -101,6 +101,8 @@
LEVEL1 t_(1:2),':',t_(3:4),':',t_(5:10),' n=',n
end if
call output_manager_prepare_save(julianday, int(secondsofday), 0, int(n))
#ifndef NO_3D
do_3d = (runtype .ge. 2 .and. mod(n,M) .eq. 0)
#endif
......@@ -152,6 +154,8 @@
call nesting_file(WRITING)
end if
#endif
call do_output_processing()
call output_manager_save(julianday,secondsofday,n)
call update_time(n)
#ifndef NO_3D
......@@ -160,8 +164,6 @@
end if
#endif
call do_output(runtype,n,timestep)
call do_output_processing()
call output_manager_save(julianday,secondsofday,n)
#ifdef DIAGNOSE
call diagnose(n,MaxN,runtype)
#endif
......
......@@ -17,7 +17,6 @@
use getm_fabm, only: register_fabm_variables
#endif
use output_processing, only: register_processed_variables
use processed_variables
IMPLICIT NONE
!
! default: all is private.
......
......@@ -12,13 +12,25 @@
! !USES:
use domain, only: imin,imax,jmin,jmax,kmax
use domain, only: az, au, av
use processed_variables
use field_manager
IMPLICIT NONE
!
! !PUBLIC DATA FUNCTIONS:
public init_output_processing, do_output_processing
!
! !PUBLIC DATA MEMBERS:
REALTYPE, dimension(:,:), allocatable, target :: u2d, v2d
REALTYPE, dimension(:,:), allocatable, target :: u2d_destag, v2d_destag
REALTYPE, dimension(:,:,:), allocatable, target :: u3d, v3d
REALTYPE, dimension(:,:,:), allocatable, target :: u3d_destag, v3d_destag
!
! !PRIVATE DATA MEMBERS:
logical, target:: u2d_use, v2d_use
logical, target:: u2d_destag_use, v2d_destag_use
logical, target:: u3d_use, v3d_use
logical, target:: u3d_destag_use, v3d_destag_use
integer, parameter :: rk = kind(_ONE_)
!
! !REVISION HISTORY:
! Original author(s): Karsten Bolding & Hans Burchard
!
......@@ -51,24 +63,28 @@
!EOP
!-------------------------------------------------------------------------
!BOC
allocate(u_2d(E2DFIELD),stat=rc)
if (rc /= 0) stop 'init_output_processing: Error allocating memory (u_2d)'
allocate(v_2d(E2DFIELD),stat=rc)
if (rc /= 0) stop 'init_output_processing: Error allocating memory (v_2d)'
allocate(u_2d_destag(E2DFIELD),stat=rc)
if (rc /= 0) stop 'init_output_processing: Error allocating memory (u_2d_destag)'
allocate(v_2d_destag(E2DFIELD),stat=rc)
if (rc /= 0) stop 'init_output_processing: Error allocating memory (v_2d_destag)'
allocate(u2d(E2DFIELD),stat=rc)
if (rc /= 0) stop 'init_output_processing: Error allocating memory (u2d)'
u2d = 0._rk
allocate(v2d(E2DFIELD),stat=rc)
if (rc /= 0) stop 'init_output_processing: Error allocating memory (v2d)'
v2d = 0._rk
allocate(u2d_destag(E2DFIELD),stat=rc)
if (rc /= 0) stop 'init_output_processing: Error allocating memory (u2d_destag)'
u2d_destag = 0._rk
allocate(v2d_destag(E2DFIELD),stat=rc)
if (rc /= 0) stop 'init_output_processing: Error allocating memory (v2d_destag)'
v2d_destag = 0._rk
#if 0
allocate(u_3d(I3DFIELD),stat=rc)
if (rc /= 0) stop 'init_output_processing: Error allocating memory (u_3d)'
allocate(v_3d(I3DFIELD),stat=rc)
if (rc /= 0) stop 'init_output_processing: Error allocating memory (v_3d)'
allocate(u_3d_destag(I3DFIELD),stat=rc)
if (rc /= 0) stop 'init_output_processing: Error allocating memory (u_3d_destag)'
allocate(v_3d_destag(I3DFIELD),stat=rc)
if (rc /= 0) stop 'init_output_processing: Error allocating memory (v_3d_destag)'
allocate(u3d(I3DFIELD),stat=rc)
if (rc /= 0) stop 'init_output_processing: Error allocating memory (u3d)'
allocate(v3d(I3DFIELD),stat=rc)
if (rc /= 0) stop 'init_output_processing: Error allocating memory (v3d)'
allocate(u3d_destag(I3DFIELD),stat=rc)
if (rc /= 0) stop 'init_output_processing: Error allocating memory (u3d_destag)'
allocate(v3d_destag(I3DFIELD),stat=rc)
if (rc /= 0) stop 'init_output_processing: Error allocating memory (v3d_destag)'
#endif
return
end subroutine init_output_processing
......@@ -85,8 +101,6 @@
! !DESCRIPTION:
!
! !USES:
! use variables_2d
use field_manager
IMPLICIT NONE
!
! !INPUT PARAMETERS:
......@@ -96,17 +110,15 @@
! Original author(s): Karsten Bolding & Jorn Bruggeman
!
! !LOCAL VARIABLES:
logical :: used
integer,parameter :: rk = kind(_ONE_)
!EOP
!-----------------------------------------------------------------------
!BOC
LEVEL2 'register_processed_variables()'
call fm%register('u2d', 'm/s', 'velocity in local x-direction', standard_name='', data2d=u_2d(_2D_W_), category='velocities')
call fm%register('v2d', 'm/s', 'velocity in local y-direction', standard_name='', data2d=v_2d(_2D_W_), category='velocities')
call fm%register('u2d_destag', 'm/s', 'velocity in local x-direction(destag)', standard_name='', data2d=u_2d_destag(_2D_W_), category='velocities',output_level=output_level_debug)
call fm%register('v2d_destag', 'm/s', 'velocity in local y-direction(destag)', standard_name='', data2d=v_2d_destag(_2D_W_), category='velocities',output_level=output_level_debug)
call fm%register('u2d', 'm/s', 'velocity in local x-direction', standard_name='', data2d=u2d(_2D_W_), category='velocities', used_now=u2d_use)
call fm%register('v2d', 'm/s', 'velocity in local y-direction', standard_name='', data2d=v2d(_2D_W_), category='velocities', used_now=v2d_use)
call fm%register('u2d-destag', 'm/s', 'velocity in local x-direction(destag)', standard_name='', data2d=u2d_destag(_2D_W_), category='velocities',output_level=output_level_debug, used_now=u2d_destag_use)
call fm%register('v2d-destag', 'm/s', 'velocity in local y-direction(destag)', standard_name='', data2d=v2d_destag(_2D_W_), category='velocities',output_level=output_level_debug, used_now=v2d_destag_use)
return
end subroutine register_processed_variables
......@@ -120,6 +132,7 @@
subroutine do_output_processing
!
! !USES:
use domain, only: az, au, av
use variables_2d, only: z,D
use variables_2d, only: U,V,DU,DV
use variables_3d, only: kmin,hn,uu,hun,vv,hvn
......@@ -128,45 +141,47 @@
! !DESCRIPTION:
!
! !INPUT PARAMETERS:
! character(len=*), intent(in) :: filename
!
! !REVISION HISTORY:
! Original author(s): Karsten Bolding
!
! !LOCAL VARIABLES:
! integer :: ncid
!KB - maybe this should go
REALTYPE, parameter :: vel_missing =-9999.
!EOP
!-------------------------------------------------------------------------
!BOC
if (allocated(u_2d) .and. allocated(v_2d)) then
! 2D - velocities
if (u2d_use .and. v2d_use) then
call to_2d_vel(imin,jmin,imax,jmax,au,U,DU,vel_missing, &
imin,jmin,imax,jmax,u_2d)
imin,jmin,imax,jmax,u2d)
call to_2d_vel(imin,jmin,imax,jmax,av,V,DV,vel_missing, &
imin,jmin,imax,jmax,v_2d)
imin,jmin,imax,jmax,v2d)
end if
if (allocated(u_2d_destag) .and. allocated(v_2d_destag)) then
if (u2d_destag_use .and. v2d_destag_use) then
call to_2d_u(imin,jmin,imax,jmax,az,U,DU,vel_missing, &
imin,jmin,imax,jmax,u_2d_destag)
imin,jmin,imax,jmax,u2d_destag)
call to_2d_v(imin,jmin,imax,jmax,az,V,DV,vel_missing, &
imin,jmin,imax,jmax,v_2d_destag)
imin,jmin,imax,jmax,v2d_destag)
end if
#if 0
! 3D - velocities
#ifndef NO_3D
if (allocated(u_3d) .and. allocated(v_3d)) then
if (allocated(u3d) .and. allocated(v3d)) then
call to_3d_uu(imin,jmin,imax,jmax,kmin,kmax,az, &
hun,uu,vel_missing,u_3d)
hun,uu,vel_missing,u3d)
call to_3d_vv (imin,jmin,imax,jmax,kmin,kmax,az, &
hvn,vv,vel_missing,v_3d)
hvn,vv,vel_missing,v3d)
end if
if (allocated(u_3d_destag) .and. allocated(v_3d_destag)) then
if (allocated(u3d_destag) .and. allocated(v3d_destag)) then
call to_3d_vel(imin,jmin,imax,jmax,kmin,kmax,au, &
hun,uu,vel_missing,u_3d_destag)
hun,uu,vel_missing,u3d_destag)
call to_3d_vel(imin,jmin,imax,jmax,kmin,kmax,av, &
hvn,vv,vel_missing,v_3d_destag)
hvn,vv,vel_missing,v3d_destag)
end if
#endif
#endif
return
......
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
!
! !MODULE: processed_variables
!
! !INTERFACE:
module processed_variables
!
! !DESCRIPTION:
! This modules serves as a container for diagnostic variables. It is the
! responsibillity of the subroutine(s) using these variables to properly
! allocate memory. Have a look at {\tt .../src/output/calc\_mean\_fields.F90}.
!
! !USES:
IMPLICIT NONE
!
! !PUBLIC DATA MEMBERS:
REALTYPE,dimension(:,:), allocatable :: u_2d, v_2d
REALTYPE,dimension(:,:), allocatable :: u_2d_destag, v_2d_destag
REALTYPE,dimension(:,:,:), allocatable :: u_3d, v_3d
REALTYPE,dimension(:,:,:), allocatable :: u_3d_destag, v_3d_destag
!
! !REVISION HISTORY:
! Original author(s): Karsten Bolding & Jorn Bruggeman
!
!EOP
!-----------------------------------------------------------------------
end module processed_variables
!-----------------------------------------------------------------------
! Copyright (C) 2018 - Karsten Bolding & 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