Commit d89df3d8 authored by Knut's avatar Knut

smarter flexout of staggered velocities

parent ea8effdc
Pipeline #156 failed with stages
......@@ -350,6 +350,8 @@
#endif
end if
call finalize_register_all_variables(runtype)
if (.not. dryrun) then
if (save_initial) then
call output_manager_prepare_save(julianday, int(secondsofday), 0, int(MinN-1))
......
......@@ -16,7 +16,7 @@
#ifdef _FABM_
use getm_fabm, only: register_fabm_variables
#endif
use output_processing, only: register_processed_variables
use output_processing, only: register_processed_variables, finalize_register_processed_variables
IMPLICIT NONE
!
! default: all is private.
......@@ -359,6 +359,8 @@
!BOC
LEVEL1 'finalize_register_all_variables()'
call finalize_register_processed_variables(fm)
return
end subroutine finalize_register_all_variables
!EOC
......
......@@ -18,18 +18,22 @@
private
!
! !PUBLIC DATA FUNCTIONS:
public init_output_processing, register_processed_variables, do_output_processing
public init_output_processing, do_output_processing
public register_processed_variables, finalize_register_processed_variables
!
! !PUBLIC DATA MEMBERS:
!
! !PRIVATE 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 :: u2d_destag, v2d_destag
REALTYPE, dimension(:,:,:), allocatable, target :: u3d_destag, v3d_destag
!
! !PRIVATE DATA MEMBERS:
logical, target:: u2d_use, v2d_use
logical :: u2d_used, v2d_used
logical :: u3d_used, v3d_used
logical, target :: u2d_now, v2d_now
logical, target :: u3d_now, v3d_now
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_)
!
......@@ -65,12 +69,7 @@
!EOP
!-------------------------------------------------------------------------
!BOC
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
......@@ -79,10 +78,6 @@
v2d_destag = 0._rk
#if 0
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)
......@@ -117,8 +112,15 @@
!BOC
LEVEL2 'register_processed_variables()'
call fm%register('u2d', 'm/s', 'velocity in local x-direction', standard_name='', data2d=u2d(_2D_W_), fill_value=-9999._rk, category='velocities', used_now=u2d_use)
call fm%register('v2d', 'm/s', 'velocity in local y-direction', standard_name='', data2d=v2d(_2D_W_), fill_value=-9999._rk, category='velocities', used_now=v2d_use)
call fm%register('u2d', 'm/s', 'velocity in local x-direction', standard_name='', fill_value=-9999._rk, category='velocities', output_level=output_level_debug, used=u2d_used, used_now=u2d_now)
call fm%register('v2d', 'm/s', 'velocity in local y-direction', standard_name='', fill_value=-9999._rk, category='velocities', output_level=output_level_debug, used=v2d_used, used_now=v2d_now)
#ifndef NO_3D
call fm%register('u3d', 'm/s', 'velocity in local x-direction (3D)', standard_name='', dimensions=(/id_dim_z/), fill_value=-9999._rk, category='velocities', output_level=output_level_debug, used=u3d_used, used_now=u3d_now)
call fm%register('v3d', 'm/s', 'velocity in local y-direction (3D)', standard_name='', dimensions=(/id_dim_z/), fill_value=-9999._rk, category='velocities', output_level=output_level_debug, used=v3d_used, used_now=v3d_now)
#endif
call fm%register('u2d-destag', 'm/s', 'velocity in local x-direction(destag)', standard_name='', data2d=u2d_destag(_2D_W_), fill_value=-9999._rk, 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_), fill_value=-9999._rk, category='velocities',output_level=output_level_debug, used_now=v2d_destag_use)
......@@ -126,6 +128,67 @@
end subroutine register_processed_variables
!EOC
!-----------------------------------------------------------------------
!BOP
!
! !ROUTINE: finalize_register_processed_variables() - send optional variables.
!
! !INTERFACE:
subroutine finalize_register_processed_variables(fm)
!
! !DESCRIPTION:
!
! !USES:
use field_manager
IMPLICIT NONE
!
! !INPUT PARAMETERS:
type (type_field_manager) :: fm
!
! !REVISION HISTORY:
! Original author(s): Knut Klingbeil
!
! !LOCAL VARIABLES:
integer :: rc
!EOP
!-----------------------------------------------------------------------
!BOC
LEVEL1 'finalize_register_processed_variables()'
if (u2d_used) then
allocate(u2d(E2DFIELD),stat=rc)
if (rc /= 0) stop 'finalize_register_processed_variables: Error allocating memory (u2d)'
u2d = 0._rk
call fm%send_data('u2d', u2d(_2D_W_))
end if
if (v2d_used) then
allocate(v2d(E2DFIELD),stat=rc)
if (rc /= 0) stop 'finalize_register_processed_variables: Error allocating memory (v2d)'
v2d = 0._rk
call fm%send_data('v2d', v2d(_2D_W_))
end if
#ifndef NO_3D
if (u3d_used) then
allocate(u3d(I3DFIELD),stat=rc)
if (rc /= 0) stop 'finalize_register_processed_variables: Error allocating memory (u3d)'
u3d = 0._rk
call fm%send_data('u3d', u3d(_3D_W_))
end if
if (v3d_used) then
allocate(v3d(I3DFIELD),stat=rc)
if (rc /= 0) stop 'finalize_register_processed_variables: Error allocating memory (v3d)'
v3d = 0._rk
call fm%send_data('v3d', v3d(_3D_W_))
end if
#endif
return
end subroutine finalize_register_processed_variables
!EOC
!-----------------------------------------------------------------------
!BOP
! !IROUTINE: do_output_processing - read required variables
......@@ -137,7 +200,9 @@
use domain, only: az, au, av
use variables_2d, only: z,D
use variables_2d, only: U,V,DU,DV
#ifndef NO_3D
use variables_3d, only: kmin,hn,uu,hun,vv,hvn
#endif
IMPLICIT NONE
!
! !DESCRIPTION:
......@@ -154,29 +219,40 @@
!BOC
! 2D - velocities
if (u2d_use .and. v2d_use) then
if (u2d_now) then
call to_2d_vel(imin,jmin,imax,jmax,au,U,DU,vel_missing, &
imin,jmin,imax,jmax,u2d)
end if
if (v2d_now) then
call to_2d_vel(imin,jmin,imax,jmax,av,V,DV,vel_missing, &
imin,jmin,imax,jmax,v2d)
end if
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,u2d_destag)
call to_2d_v(imin,jmin,imax,jmax,az,V,DV,vel_missing, &
imin,jmin,imax,jmax,v2d_destag)
end if
#if 0
! 3D - velocities
#ifndef NO_3D
if (allocated(u3d) .and. allocated(v3d)) then
if (u3d_now) then
call to_3d_uu(imin,jmin,imax,jmax,kmin,kmax,az, &
hun,uu,vel_missing,u3d)
end if
if (v3d_now) then
call to_3d_vv (imin,jmin,imax,jmax,kmin,kmax,az, &
hvn,vv,vel_missing,v3d)
end if
#endif
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,u2d_destag)
call to_2d_v(imin,jmin,imax,jmax,az,V,DV,vel_missing, &
imin,jmin,imax,jmax,v2d_destag)
end if
#if 0
#ifndef NO_3D
if (allocated(u3d_destag) .and. allocated(v3d_destag)) then
call to_3d_vel(imin,jmin,imax,jmax,kmin,kmax,au, &
hun,uu,vel_missing,u3d_destag)
......
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