[1682] | 1 | !> @file user_data_output_2d.f90 |
---|
[2000] | 2 | !------------------------------------------------------------------------------! |
---|
[1036] | 3 | ! This file is part of PALM. |
---|
| 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 | ! |
---|
[2101] | 17 | ! Copyright 1997-2017 Leibniz Universitaet Hannover |
---|
[2000] | 18 | !------------------------------------------------------------------------------! |
---|
[1036] | 19 | ! |
---|
[484] | 20 | ! Current revisions: |
---|
[211] | 21 | ! ----------------- |
---|
[1321] | 22 | ! |
---|
[2233] | 23 | ! |
---|
[1321] | 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! $Id: user_data_output_2d.f90 2512 2017-10-04 08:26:59Z schwenkel $ |
---|
[2512] | 27 | ! ghost layer points removed from output array local_pf |
---|
| 28 | ! |
---|
| 29 | ! 2233 2017-05-30 18:08:54Z suehring |
---|
[1321] | 30 | ! |
---|
[2233] | 31 | ! 2232 2017-05-30 17:47:52Z suehring |
---|
| 32 | ! Example code added for accessing output quantities stored on surface-data |
---|
| 33 | ! types |
---|
| 34 | ! |
---|
[2001] | 35 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
| 36 | ! Forced header and separation lines into 80 columns |
---|
| 37 | ! |
---|
[1683] | 38 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
| 39 | ! Code annotations made doxygen readable |
---|
| 40 | ! |
---|
[1552] | 41 | ! 1551 2015-03-03 14:18:16Z maronga |
---|
| 42 | ! Replaced nzb and nzt+1 with the new array bounds nzb_do and nzt_do. |
---|
| 43 | ! |
---|
[1321] | 44 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 45 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 46 | ! kinds are defined in new module kinds, |
---|
| 47 | ! revision history before 2012 removed, |
---|
| 48 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 49 | ! all variable declaration statements |
---|
[211] | 50 | ! |
---|
[1037] | 51 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 52 | ! code put under GPL (PALM 3.9) |
---|
| 53 | ! |
---|
[226] | 54 | ! 211 2008-11-11 04:46:24Z raasch |
---|
| 55 | ! Former file user_interface.f90 split into one file per subroutine |
---|
| 56 | ! |
---|
[211] | 57 | ! Description: |
---|
| 58 | ! ------------ |
---|
[1682] | 59 | !> Resorts the user-defined output quantity with indices (k,j,i) to a |
---|
| 60 | !> temporary array with indices (i,j,k) and sets the grid on which it is defined. |
---|
| 61 | !> Allowed values for grid are "zu" and "zw". |
---|
[211] | 62 | !------------------------------------------------------------------------------! |
---|
[1682] | 63 | SUBROUTINE user_data_output_2d( av, variable, found, grid, local_pf, two_d, nzb_do, nzt_do ) |
---|
| 64 | |
---|
[211] | 65 | |
---|
| 66 | USE indices |
---|
[1320] | 67 | |
---|
| 68 | USE kinds |
---|
| 69 | |
---|
[2232] | 70 | USE surface_mod |
---|
| 71 | |
---|
[211] | 72 | USE user |
---|
| 73 | |
---|
| 74 | IMPLICIT NONE |
---|
| 75 | |
---|
[1682] | 76 | CHARACTER (LEN=*) :: grid !< |
---|
| 77 | CHARACTER (LEN=*) :: variable !< |
---|
[211] | 78 | |
---|
[2232] | 79 | INTEGER(iwp) :: av !< flag to control data output of instantaneous or time-averaged data |
---|
| 80 | INTEGER(iwp) :: i !< grid index along x-direction |
---|
| 81 | INTEGER(iwp) :: j !< grid index along y-direction |
---|
| 82 | INTEGER(iwp) :: k !< grid index along z-direction |
---|
| 83 | INTEGER(iwp) :: m !< running index surface elements |
---|
[1682] | 84 | INTEGER(iwp) :: nzb_do !< lower limit of the domain (usually nzb) |
---|
| 85 | INTEGER(iwp) :: nzt_do !< upper limit of the domain (usually nzt+1) |
---|
[211] | 86 | |
---|
[1682] | 87 | LOGICAL :: found !< |
---|
| 88 | LOGICAL :: two_d !< flag parameter that indicates 2D variables (horizontal cross sections) |
---|
[211] | 89 | |
---|
[2512] | 90 | REAL(wp), DIMENSION(nxl:nxr,nys:nyn,nzb:nzt+1) :: local_pf !< |
---|
[211] | 91 | |
---|
| 92 | |
---|
| 93 | found = .TRUE. |
---|
| 94 | |
---|
| 95 | SELECT CASE ( TRIM( variable ) ) |
---|
| 96 | |
---|
| 97 | ! |
---|
| 98 | !-- Uncomment and extend the following lines, if necessary. |
---|
| 99 | !-- The arrays for storing the user defined quantities (here u2 and u2_av) |
---|
| 100 | !-- have to be declared and defined by the user! |
---|
| 101 | !-- Sample for user-defined output: |
---|
| 102 | ! CASE ( 'u2_xy', 'u2_xz', 'u2_yz' ) |
---|
| 103 | ! IF ( av == 0 ) THEN |
---|
[2512] | 104 | ! DO i = nxl, nxr |
---|
| 105 | ! DO j = nys, nyn |
---|
[1551] | 106 | ! DO k = nzb_do, nzt_do |
---|
[211] | 107 | ! local_pf(i,j,k) = u2(k,j,i) |
---|
| 108 | ! ENDDO |
---|
| 109 | ! ENDDO |
---|
| 110 | ! ENDDO |
---|
| 111 | ! ELSE |
---|
[2512] | 112 | ! DO i = nxl, nxr |
---|
| 113 | ! DO j = nys, nyn |
---|
[1551] | 114 | ! DO k = nzb_do, nzt_do |
---|
[211] | 115 | ! local_pf(i,j,k) = u2_av(k,j,i) |
---|
| 116 | ! ENDDO |
---|
| 117 | ! ENDDO |
---|
| 118 | ! ENDDO |
---|
| 119 | ! ENDIF |
---|
| 120 | ! |
---|
| 121 | ! grid = 'zu' |
---|
[2232] | 122 | ! |
---|
[2512] | 123 | !-- In case two-dimensional surface variables are output, the user |
---|
[2232] | 124 | !-- has to access related surface-type. Uncomment and extend following lines |
---|
| 125 | !-- appropriately (example output of vertical surface momentum flux of u- |
---|
| 126 | !-- component). Please note, surface elements can be distributed over |
---|
| 127 | !-- several data type, depending on their respective surface properties. |
---|
| 128 | ! CASE ( 'usws_xy' ) |
---|
| 129 | ! IF ( av == 0 ) THEN |
---|
| 130 | ! |
---|
| 131 | !-- Horizontal default-type surfaces |
---|
| 132 | ! DO m = 1, surf_def_h(0)%ns |
---|
| 133 | ! i = surf_def_h(0)%i(m) |
---|
| 134 | ! j = surf_def_h(0)%j(m) |
---|
| 135 | ! local_pf(i,j,1) = surf_def_h(0)%usws(m) |
---|
| 136 | ! ENDDO |
---|
| 137 | ! |
---|
| 138 | !-- Horizontal natural-type surfaces |
---|
| 139 | ! DO m = 1, surf_lsm_h%ns |
---|
| 140 | ! i = surf_lsm_h%i(m) |
---|
| 141 | ! j = surf_lsm_h%j(m) |
---|
| 142 | ! local_pf(i,j,1) = surf_lsm_h%usws(m) |
---|
| 143 | ! ENDDO |
---|
| 144 | ! |
---|
| 145 | !-- Horizontal urban-type surfaces |
---|
| 146 | ! DO m = 1, surf_usm_h%ns |
---|
| 147 | ! i = surf_usm_h%i(m) |
---|
| 148 | ! j = surf_usm_h%j(m) |
---|
| 149 | ! local_pf(i,j,1) = surf_usm_h%usws(m) |
---|
| 150 | ! ENDDO |
---|
| 151 | ! ENDIF |
---|
| 152 | ! |
---|
| 153 | ! grid = 'zu' |
---|
| 154 | !-- |
---|
[211] | 155 | |
---|
[343] | 156 | |
---|
[211] | 157 | CASE DEFAULT |
---|
| 158 | found = .FALSE. |
---|
| 159 | grid = 'none' |
---|
| 160 | |
---|
| 161 | END SELECT |
---|
| 162 | |
---|
| 163 | |
---|
| 164 | END SUBROUTINE user_data_output_2d |
---|