Commit f390107d authored by Karsten Bolding's avatar Karsten Bolding

prepare for processing in relation to output only

parent 95178fbb
......@@ -353,6 +353,8 @@ 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
)
......
......@@ -49,6 +49,7 @@
use halo_mpi, only: init_mpi,print_MPI_info
#endif
use output, only: init_output,do_output,restart_file,out_dir
use output_processing
use input, only: init_input
use domain, only: init_domain
use domain, only: H
......@@ -265,6 +266,7 @@
#endif
end if
#endif
call init_output_processing()
call init_register_all_variables(runtype)
......@@ -277,7 +279,6 @@
end if
call do_register_all_variables(runtype)
! call fm%list()
! call init_output(runid,title,start,runtype,dryrun,myid)
call init_output(runid,title,start,runtype,dryrun,myid,MinN,MaxN,save_initial)
......@@ -349,6 +350,7 @@
if (.not. dryrun) then
call do_output(runtype,MinN-1,timestep)
call do_output_processing()
if (save_initial) call output_manager_save(julianday,secondsofday,MinN-1)
end if
......
......@@ -63,6 +63,7 @@
#endif
use input, only: do_input
use output, only: do_output,meanout
use output_processing, only: do_output_processing
#ifdef TEST_NESTING
use nesting, only: nesting_file
#endif
......@@ -159,6 +160,7 @@
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)
......
......@@ -11,6 +11,7 @@
!
! !USES:
use field_manager
use processed_variables
IMPLICIT NONE
!
! default: all is private.
......@@ -361,6 +362,10 @@
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)
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)
return
end subroutine register_2d_variables
......
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
!
! !MODULE: output_processing
!
! !INTERFACE:
module output_processing
!
! !DESCRIPTION:
! This modules serves as a container for processing output variables.
! !USES:
use domain, only: imin,imax,jmin,jmax,kmax
use domain, only: az, au, av
use processed_variables
IMPLICIT NONE
!
! !PUBLIC DATA FUNCTIONS:
public init_output_processing, do_output_processing
!
! !REVISION HISTORY:
! Original author(s): Karsten Bolding & Hans Burchard
!
!EOP
!-----------------------------------------------------------------------
contains
!-----------------------------------------------------------------------
!BOP
!
! !IROUTINE: init_output_processing - read required variables
!
! !INTERFACE:
subroutine init_output_processing
!
! !USES:
IMPLICIT NONE
!
! !DESCRIPTION:
!
! !INPUT PARAMETERS:
! character(len=*), intent(in) :: filename
!
! !REVISION HISTORY:
! Original author(s): Karsten Bolding
!
! !LOCAL VARIABLES:
integer :: rc
!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)'
#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)'
#endif
return
end subroutine init_output_processing
!EOC
!-----------------------------------------------------------------------
!BOP
! !IROUTINE: init_output_processing - read required variables
!
! !INTERFACE:
subroutine do_output_processing
!
! !USES:
use variables_2d, only: z,D
use variables_2d, only: U,V,DU,DV
use variables_3d, only: kmin,hn,uu,hun,vv,hvn
IMPLICIT NONE
!
! !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
call to_2d_vel(imin,jmin,imax,jmax,au,U,DU,vel_missing, &
imin,jmin,imax,jmax,u_2d)
call to_2d_vel(imin,jmin,imax,jmax,av,V,DV,vel_missing, &
imin,jmin,imax,jmax,v_2d)
end if
if (allocated(u_2d_destag) .and. allocated(v_2d_destag)) then
call to_2d_u(imin,jmin,imax,jmax,az,U,DU,vel_missing, &
imin,jmin,imax,jmax,u_2d_destag)
call to_2d_v(imin,jmin,imax,jmax,az,V,DV,vel_missing, &
imin,jmin,imax,jmax,v_2d_destag)
end if
#ifndef NO_3D
if (allocated(u_3d) .and. allocated(v_3d)) then
call to_3d_uu(imin,jmin,imax,jmax,kmin,kmax,az, &
hun,uu,vel_missing,u_3d)
call to_3d_vv (imin,jmin,imax,jmax,kmin,kmax,az, &
hvn,vv,vel_missing,v_3d)
end if
if (allocated(u_3d_destag) .and. allocated(v_3d_destag)) then
call to_3d_vel(imin,jmin,imax,jmax,kmin,kmax,au, &
hun,uu,vel_missing,u_3d_destag)
call to_3d_vel(imin,jmin,imax,jmax,kmin,kmax,av, &
hvn,vv,vel_missing,v_3d_destag)
end if
#endif
return
end subroutine do_output_processing
!EOC
end module output_processing
!-----------------------------------------------------------------------
! Copyright (C) 2019 - Karsten Bolding & Jorn Bruggeman (BB) !
!-----------------------------------------------------------------------
#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