[211] | 1 | SUBROUTINE user_3d_data_averaging( mode, variable ) |
---|
| 2 | |
---|
| 3 | !------------------------------------------------------------------------------! |
---|
| 4 | ! Actual revisions: |
---|
| 5 | ! ----------------- |
---|
[226] | 6 | ! |
---|
[211] | 7 | ! |
---|
| 8 | ! Former revisions: |
---|
| 9 | ! ----------------- |
---|
| 10 | ! $Id: user_3d_data_averaging.f90 226 2009-02-02 07:39:34Z letzel $ |
---|
| 11 | ! |
---|
[226] | 12 | ! 211 2008-11-11 04:46:24Z raasch |
---|
| 13 | ! Former file user_interface.f90 split into one file per subroutine |
---|
| 14 | ! |
---|
[211] | 15 | ! Description: |
---|
| 16 | ! ------------ |
---|
| 17 | ! Sum up and time-average user-defined output quantities as well as allocate |
---|
| 18 | ! the array necessary for storing the average. |
---|
| 19 | !------------------------------------------------------------------------------! |
---|
| 20 | |
---|
| 21 | USE control_parameters |
---|
| 22 | USE indices |
---|
| 23 | USE user |
---|
| 24 | |
---|
| 25 | IMPLICIT NONE |
---|
| 26 | |
---|
| 27 | CHARACTER (LEN=*) :: mode, variable |
---|
| 28 | |
---|
| 29 | INTEGER :: i, j, k |
---|
| 30 | |
---|
| 31 | |
---|
| 32 | IF ( mode == 'allocate' ) THEN |
---|
| 33 | |
---|
| 34 | SELECT CASE ( TRIM( variable ) ) |
---|
| 35 | |
---|
| 36 | ! |
---|
| 37 | !-- Uncomment and extend the following lines, if necessary. |
---|
| 38 | !-- The arrays for storing the user defined quantities (here u2_av) have |
---|
| 39 | !-- to be declared and defined by the user! |
---|
| 40 | !-- Sample for user-defined output: |
---|
| 41 | ! CASE ( 'u2' ) |
---|
| 42 | ! IF ( .NOT. ALLOCATED( u2_av ) ) THEN |
---|
| 43 | ! ALLOCATE( u2_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) ) |
---|
| 44 | ! ENDIF |
---|
| 45 | ! u2_av = 0.0 |
---|
| 46 | |
---|
| 47 | CASE DEFAULT |
---|
| 48 | CONTINUE |
---|
| 49 | |
---|
| 50 | END SELECT |
---|
| 51 | |
---|
| 52 | ELSEIF ( mode == 'sum' ) THEN |
---|
| 53 | |
---|
| 54 | SELECT CASE ( TRIM( variable ) ) |
---|
| 55 | |
---|
| 56 | ! |
---|
| 57 | !-- Uncomment and extend the following lines, if necessary. |
---|
| 58 | !-- The arrays for storing the user defined quantities (here u2 and |
---|
| 59 | !-- u2_av) have to be declared and defined by the user! |
---|
| 60 | !-- Sample for user-defined output: |
---|
| 61 | ! CASE ( 'u2' ) |
---|
| 62 | ! DO i = nxl-1, nxr+1 |
---|
| 63 | ! DO j = nys-1, nyn+1 |
---|
| 64 | ! DO k = nzb, nzt+1 |
---|
| 65 | ! u2_av(k,j,i) = u2_av(k,j,i) + u2(k,j,i) |
---|
| 66 | ! ENDDO |
---|
| 67 | ! ENDDO |
---|
| 68 | ! ENDDO |
---|
| 69 | |
---|
| 70 | CASE DEFAULT |
---|
| 71 | CONTINUE |
---|
| 72 | |
---|
| 73 | END SELECT |
---|
| 74 | |
---|
| 75 | ELSEIF ( mode == 'average' ) THEN |
---|
| 76 | |
---|
| 77 | SELECT CASE ( TRIM( variable ) ) |
---|
| 78 | |
---|
| 79 | ! |
---|
| 80 | !-- Uncomment and extend the following lines, if necessary. |
---|
| 81 | !-- The arrays for storing the user defined quantities (here u2_av) have |
---|
| 82 | !-- to be declared and defined by the user! |
---|
| 83 | !-- Sample for user-defined output: |
---|
| 84 | ! CASE ( 'u2' ) |
---|
| 85 | ! DO i = nxl-1, nxr+1 |
---|
| 86 | ! DO j = nys-1, nyn+1 |
---|
| 87 | ! DO k = nzb, nzt+1 |
---|
| 88 | ! u2_av(k,j,i) = u2_av(k,j,i) / REAL( average_count_3d ) |
---|
| 89 | ! ENDDO |
---|
| 90 | ! ENDDO |
---|
| 91 | ! ENDDO |
---|
| 92 | |
---|
| 93 | END SELECT |
---|
| 94 | |
---|
| 95 | ENDIF |
---|
| 96 | |
---|
| 97 | |
---|
| 98 | END SUBROUTINE user_3d_data_averaging |
---|