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

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