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