[211] | 1 | SUBROUTINE user_3d_data_averaging( mode, variable ) |
---|
| 2 | |
---|
[1036] | 3 | !--------------------------------------------------------------------------------! |
---|
| 4 | ! This file is part of PALM. |
---|
| 5 | ! |
---|
| 6 | ! PALM is free software: you can redistribute it and/or modify it under the terms |
---|
| 7 | ! of the GNU General Public License as published by the Free Software Foundation, |
---|
| 8 | ! either version 3 of the License, or (at your option) any later version. |
---|
| 9 | ! |
---|
| 10 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
| 11 | ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
| 12 | ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
| 13 | ! |
---|
| 14 | ! You should have received a copy of the GNU General Public License along with |
---|
| 15 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
| 16 | ! |
---|
[1310] | 17 | ! Copyright 1997-2014 Leibniz Universitaet Hannover |
---|
[1036] | 18 | !--------------------------------------------------------------------------------! |
---|
| 19 | ! |
---|
[484] | 20 | ! Current revisions: |
---|
[211] | 21 | ! ----------------- |
---|
[1321] | 22 | ! |
---|
[1323] | 23 | ! |
---|
[1321] | 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! $Id: user_3d_data_averaging.f90 1323 2014-03-20 17:09:54Z kanani $ |
---|
| 27 | ! |
---|
[1323] | 28 | ! 1322 2014-03-20 16:38:49Z raasch |
---|
| 29 | ! REAL functions provided with KIND-attribute |
---|
| 30 | ! |
---|
[1321] | 31 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 32 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 33 | ! kinds are defined in new module kinds, |
---|
| 34 | ! revision history before 2012 removed, |
---|
| 35 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 36 | ! all variable declaration statements |
---|
[211] | 37 | ! |
---|
[1037] | 38 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 39 | ! code put under GPL (PALM 3.9) |
---|
| 40 | ! |
---|
[226] | 41 | ! 211 2008-11-11 04:46:24Z raasch |
---|
| 42 | ! Former file user_interface.f90 split into one file per subroutine |
---|
| 43 | ! |
---|
[211] | 44 | ! Description: |
---|
| 45 | ! ------------ |
---|
| 46 | ! Sum up and time-average user-defined output quantities as well as allocate |
---|
| 47 | ! the array necessary for storing the average. |
---|
| 48 | !------------------------------------------------------------------------------! |
---|
| 49 | |
---|
| 50 | USE control_parameters |
---|
[1320] | 51 | |
---|
[211] | 52 | USE indices |
---|
[1320] | 53 | |
---|
| 54 | USE kinds |
---|
| 55 | |
---|
[211] | 56 | USE user |
---|
| 57 | |
---|
| 58 | IMPLICIT NONE |
---|
| 59 | |
---|
[1320] | 60 | CHARACTER (LEN=*) :: mode !: |
---|
| 61 | CHARACTER (LEN=*) :: variable !: |
---|
[211] | 62 | |
---|
[1320] | 63 | INTEGER(iwp) :: i !: |
---|
| 64 | INTEGER(iwp) :: j !: |
---|
| 65 | INTEGER(iwp) :: k !: |
---|
[211] | 66 | |
---|
| 67 | IF ( mode == 'allocate' ) THEN |
---|
| 68 | |
---|
| 69 | SELECT CASE ( TRIM( variable ) ) |
---|
| 70 | |
---|
| 71 | ! |
---|
| 72 | !-- Uncomment and extend the following lines, if necessary. |
---|
| 73 | !-- The arrays for storing the user defined quantities (here u2_av) have |
---|
| 74 | !-- to be declared and defined by the user! |
---|
| 75 | !-- Sample for user-defined output: |
---|
| 76 | ! CASE ( 'u2' ) |
---|
| 77 | ! IF ( .NOT. ALLOCATED( u2_av ) ) THEN |
---|
[667] | 78 | ! ALLOCATE( u2_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[211] | 79 | ! ENDIF |
---|
| 80 | ! u2_av = 0.0 |
---|
| 81 | |
---|
| 82 | CASE DEFAULT |
---|
| 83 | CONTINUE |
---|
| 84 | |
---|
| 85 | END SELECT |
---|
| 86 | |
---|
| 87 | ELSEIF ( mode == 'sum' ) THEN |
---|
| 88 | |
---|
| 89 | SELECT CASE ( TRIM( variable ) ) |
---|
| 90 | |
---|
| 91 | ! |
---|
| 92 | !-- Uncomment and extend the following lines, if necessary. |
---|
| 93 | !-- The arrays for storing the user defined quantities (here u2 and |
---|
| 94 | !-- u2_av) have to be declared and defined by the user! |
---|
| 95 | !-- Sample for user-defined output: |
---|
| 96 | ! CASE ( 'u2' ) |
---|
[667] | 97 | ! DO i = nxlg, nxrg |
---|
| 98 | ! DO j = nysg, nyng |
---|
[211] | 99 | ! DO k = nzb, nzt+1 |
---|
| 100 | ! u2_av(k,j,i) = u2_av(k,j,i) + u2(k,j,i) |
---|
| 101 | ! ENDDO |
---|
| 102 | ! ENDDO |
---|
| 103 | ! ENDDO |
---|
| 104 | |
---|
| 105 | CASE DEFAULT |
---|
| 106 | CONTINUE |
---|
| 107 | |
---|
| 108 | END SELECT |
---|
| 109 | |
---|
| 110 | ELSEIF ( mode == 'average' ) THEN |
---|
| 111 | |
---|
| 112 | SELECT CASE ( TRIM( variable ) ) |
---|
| 113 | |
---|
| 114 | ! |
---|
| 115 | !-- Uncomment and extend the following lines, if necessary. |
---|
| 116 | !-- The arrays for storing the user defined quantities (here u2_av) have |
---|
| 117 | !-- to be declared and defined by the user! |
---|
| 118 | !-- Sample for user-defined output: |
---|
| 119 | ! CASE ( 'u2' ) |
---|
[667] | 120 | ! DO i = nxlg, nxrg |
---|
| 121 | ! DO j = nysg, nyng |
---|
[211] | 122 | ! DO k = nzb, nzt+1 |
---|
[1322] | 123 | ! u2_av(k,j,i) = u2_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
[211] | 124 | ! ENDDO |
---|
| 125 | ! ENDDO |
---|
| 126 | ! ENDDO |
---|
| 127 | |
---|
| 128 | END SELECT |
---|
| 129 | |
---|
| 130 | ENDIF |
---|
| 131 | |
---|
| 132 | |
---|
| 133 | END SUBROUTINE user_3d_data_averaging |
---|