SUBROUTINE user_3d_data_averaging( mode, variable ) !------------------------------------------------------------------------------! ! Current revisions: ! ----------------- ! ! ! Former revisions: ! ----------------- ! $Id: user_3d_data_averaging.f90 667 2010-12-23 12:06:00Z helmke $ ! ! 211 2008-11-11 04:46:24Z raasch ! Former file user_interface.f90 split into one file per subroutine ! ! Description: ! ------------ ! Sum up and time-average user-defined output quantities as well as allocate ! the array necessary for storing the average. !------------------------------------------------------------------------------! USE control_parameters USE indices USE user IMPLICIT NONE CHARACTER (LEN=*) :: mode, variable INTEGER :: i, j, k IF ( mode == 'allocate' ) THEN SELECT CASE ( TRIM( variable ) ) ! !-- Uncomment and extend the following lines, if necessary. !-- The arrays for storing the user defined quantities (here u2_av) have !-- to be declared and defined by the user! !-- Sample for user-defined output: ! CASE ( 'u2' ) ! IF ( .NOT. ALLOCATED( u2_av ) ) THEN ! ALLOCATE( u2_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) ! ENDIF ! u2_av = 0.0 CASE DEFAULT CONTINUE END SELECT ELSEIF ( mode == 'sum' ) THEN SELECT CASE ( TRIM( variable ) ) ! !-- Uncomment and extend the following lines, if necessary. !-- The arrays for storing the user defined quantities (here u2 and !-- u2_av) have to be declared and defined by the user! !-- Sample for user-defined output: ! CASE ( 'u2' ) ! DO i = nxlg, nxrg ! DO j = nysg, nyng ! DO k = nzb, nzt+1 ! u2_av(k,j,i) = u2_av(k,j,i) + u2(k,j,i) ! ENDDO ! ENDDO ! ENDDO CASE DEFAULT CONTINUE END SELECT ELSEIF ( mode == 'average' ) THEN SELECT CASE ( TRIM( variable ) ) ! !-- Uncomment and extend the following lines, if necessary. !-- The arrays for storing the user defined quantities (here u2_av) have !-- to be declared and defined by the user! !-- Sample for user-defined output: ! CASE ( 'u2' ) ! DO i = nxlg, nxrg ! DO j = nysg, nyng ! DO k = nzb, nzt+1 ! u2_av(k,j,i) = u2_av(k,j,i) / REAL( average_count_3d ) ! ENDDO ! ENDDO ! ENDDO END SELECT ENDIF END SUBROUTINE user_3d_data_averaging