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