source: palm/trunk/SOURCE/user_data_output_2d.f90 @ 3012

Last change on this file since 3012 was 3004, checked in by Giersch, 6 years ago

precipitation_rate removed, further allocation checks for data output of averaged quantities implemented, double CALL of flow_statistics at the beginning of time_integration removed, further minor bugfixes, comments added

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