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