source: palm/trunk/SOURCE/user_data_output_mask.f90 @ 4180

Last change on this file since 4180 was 4180, checked in by scharf, 5 years ago

removed comments in 'Former revisions' section that are older than 01.01.2019

  • Property svn:keywords set to Id
File size: 6.3 KB
Line 
1!> @file user_data_output_mask.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-2019 Leibniz Universitaet Hannover
18!------------------------------------------------------------------------------!
19!
20! Current revisions:
21! ------------------
22!
23!
24! Former revisions:
25! -----------------
26! $Id: user_data_output_mask.f90 4180 2019-08-21 14:37:54Z scharf $
27! Remove dependency on surface_mod + example for terrain-following output
28! adjusted
29!
30! 4069 2019-07-01 14:05:51Z Giersch
31! Masked output running index mid has been introduced as a local variable to
32! avoid runtime error (Loop variable has been modified) in time_integration
33!
34! 3768 2019-02-27 14:35:58Z raasch
35! variables commented + statement added to avoid compiler warnings about unused variables
36!
37! 3655 2019-01-07 16:51:22Z knoop
38! Add terrain-following output
39!
40!
41! Description:
42! ------------
43!> Resorts the user-defined output quantity with indices (k,j,i) to a
44!> temporary array with indices (i,j,k) for masked data output.
45!------------------------------------------------------------------------------!
46 SUBROUTINE user_data_output_mask( av, variable, found, local_pf, mid )
47 
48
49    USE control_parameters
50       
51    USE indices
52   
53    USE kinds
54   
55    USE user
56
57    IMPLICIT NONE
58
59    CHARACTER (LEN=*) ::  variable  !<
60
61    INTEGER(iwp) ::  av             !<
62    INTEGER(iwp) ::  mid            !< masked output running index
63!    INTEGER(iwp) ::  i              !<
64!    INTEGER(iwp) ::  j              !<
65!    INTEGER(iwp) ::  k              !<
66!    INTEGER(iwp) ::  topo_top_index !< k index of highest horizontal surface
67
68    LOGICAL ::  found               !<
69
70    REAL(wp),                                                                  &
71       DIMENSION(mask_size_l(mid,1),mask_size_l(mid,2),mask_size_l(mid,3)) ::  &
72          local_pf   !<
73
74!
75!-- Next line is to avoid compiler warning about unused variables. Please remove.
76    IF ( av == 0  .OR.                                                                             &
77         local_pf(mask_size_l(mid,1),mask_size_l(mid,2),mask_size_l(mid,3)) == 0.0_wp )  CONTINUE
78
79
80    found = .TRUE.
81
82    SELECT CASE ( TRIM( variable ) )
83
84!--    Uncomment and extend the following lines, if necessary.
85!--    The arrays for storing the user defined quantities (here u2 and u2_av)
86!--    have to be declared and defined by the user!
87!--    Sample for user-defined output:
88!       CASE ( 'u2' )
89!          IF ( av == 0 )  THEN
90!             IF ( .NOT. mask_surface(mid) )  THEN
91!!
92!!--             Default masked output
93!                DO  i = 1, mask_size_l(mid,1)
94!                   DO  j = 1, mask_size_l(mid,2)
95!                      DO  k = 1, mask_size_l(mid,3)
96!                         local_pf(i,j,k) = u2(mask_k(mid,k),                  &
97!                                              mask_j(mid,j),                  &
98!                                              mask_i(mid,i))
99!                      ENDDO
100!                   ENDDO
101!                ENDDO
102!             ELSE
103!!
104!!--             Terrain-following masked output
105!                DO  i = 1, mask_size_l(mid,1)
106!                   DO  j = 1, mask_size_l(mid,2)
107!!
108!!--                   Get k index of highest horizontal surface
109!                      topo_top_index = topo_top_ind( &
110!                                        mask_j(mid,j), &
111!                                        mask_i(mid,i), &
112!                                        1          )
113!!
114!!--                   Save output array
115!                      DO  k = 1, mask_size_l(mid,3)
116!                         local_pf(i,j,k) = u2(MIN( topo_top_index+mask_k(mid,k),&
117!                                                   nzt+1 ),                     &
118!                                              mask_j(mid,j),                    &
119!                                              mask_i(mid,i)                   )
120!                      ENDDO
121!                   ENDDO
122!                ENDDO
123!             ENDIF
124!          ELSE
125!             IF ( .NOT. mask_surface(mid) )  THEN
126!!
127!!--             Default masked output
128!                DO  i = 1, mask_size_l(mid,1)
129!                   DO  j = 1, mask_size_l(mid,2)
130!                      DO  k = 1, mask_size_l(mid,3)
131!                          local_pf(i,j,k) = u2_av(mask_k(mid,k),              &
132!                                                  mask_j(mid,j),              &
133!                                                  mask_i(mid,i) )
134!                       ENDDO
135!                    ENDDO
136!                 ENDDO
137!             ELSE
138!!
139!!--             Terrain-following masked output
140!                DO  i = 1, mask_size_l(mid,1)
141!                   DO  j = 1, mask_size_l(mid,2)
142!!
143!!--                   Get k index of highest horizontal surface
144!                      topo_top_index = topo_top_ind(   &
145!                                        mask_j(mid,j), &
146!                                        mask_i(mid,i), &
147!                                        1 )
148!!
149!!--                   Save output array
150!                      DO  k = 1, mask_size_l(mid,3)
151!                         local_pf(i,j,k) = u2_av(                               &
152!                                              MIN( topo_top_index+mask_k(mid,k),&
153!                                                   nzt+1 ),                     &
154!                                              mask_j(mid,j),                    &
155!                                              mask_i(mid,i)                   )
156!                      ENDDO
157!                   ENDDO
158!                ENDDO
159!             ENDIF
160!          ENDIF
161
162       CASE DEFAULT
163          found = .FALSE.
164
165    END SELECT
166
167
168 END SUBROUTINE user_data_output_mask
Note: See TracBrowser for help on using the repository browser.