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-2018 Leibniz Universitaet Hannover |
---|
18 | !------------------------------------------------------------------------------! |
---|
19 | ! |
---|
20 | ! Current revisions: |
---|
21 | ! ------------------ |
---|
22 | ! |
---|
23 | ! |
---|
24 | ! Former revisions: |
---|
25 | ! ----------------- |
---|
26 | ! $Id: user_data_output_mask.f90 3435 2018-10-26 18:25:44Z gronemeier $ |
---|
27 | ! Add terrain-following output |
---|
28 | ! |
---|
29 | ! 2718 2018-01-02 08:49:38Z maronga |
---|
30 | ! Corrected "Former revisions" section |
---|
31 | ! |
---|
32 | ! 2696 2017-12-14 17:12:51Z kanani |
---|
33 | ! Change in file header (GPL part) |
---|
34 | ! |
---|
35 | ! 2101 2017-01-05 16:42:31Z suehring |
---|
36 | ! |
---|
37 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
38 | ! Forced header and separation lines into 80 columns |
---|
39 | ! |
---|
40 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
41 | ! Code annotations made doxygen readable |
---|
42 | ! |
---|
43 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
44 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
45 | ! kinds are defined in new module kinds, |
---|
46 | ! old module precision_kind is removed, |
---|
47 | ! comment fields (!:) to be used for variable explanations added to |
---|
48 | ! all variable declaration statements |
---|
49 | ! |
---|
50 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
51 | ! code put under GPL (PALM 3.9) |
---|
52 | ! |
---|
53 | ! Description: |
---|
54 | ! ------------ |
---|
55 | !> Resorts the user-defined output quantity with indices (k,j,i) to a |
---|
56 | !> temporary array with indices (i,j,k) for masked data output. |
---|
57 | !------------------------------------------------------------------------------! |
---|
58 | SUBROUTINE user_data_output_mask( av, variable, found, local_pf ) |
---|
59 | |
---|
60 | |
---|
61 | USE control_parameters |
---|
62 | |
---|
63 | USE indices |
---|
64 | |
---|
65 | USE kinds |
---|
66 | |
---|
67 | USE surface_mod, & |
---|
68 | ONLY: get_topography_top_index_ji |
---|
69 | |
---|
70 | USE user |
---|
71 | |
---|
72 | IMPLICIT NONE |
---|
73 | |
---|
74 | CHARACTER (LEN=*) :: variable !< |
---|
75 | CHARACTER (LEN=5) :: grid !< flag to distinquish between staggered grids |
---|
76 | |
---|
77 | INTEGER(iwp) :: av !< |
---|
78 | INTEGER(iwp) :: i !< |
---|
79 | INTEGER(iwp) :: j !< |
---|
80 | INTEGER(iwp) :: k !< |
---|
81 | INTEGER(iwp) :: topo_top_ind !< k index of highest horizontal surface |
---|
82 | |
---|
83 | LOGICAL :: found !< |
---|
84 | |
---|
85 | REAL(wp), & |
---|
86 | DIMENSION(mask_size_l(mid,1),mask_size_l(mid,2),mask_size_l(mid,3)) :: & |
---|
87 | local_pf !< |
---|
88 | |
---|
89 | |
---|
90 | found = .TRUE. |
---|
91 | grid = 's' |
---|
92 | |
---|
93 | SELECT CASE ( TRIM( variable ) ) |
---|
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' ) |
---|
100 | ! IF ( av == 0 ) THEN |
---|
101 | ! IF ( .NOT. mask_surface(mid) ) THEN |
---|
102 | !! |
---|
103 | !!-- Default masked output |
---|
104 | ! DO i = 1, mask_size_l(mid,1) |
---|
105 | ! DO j = 1, mask_size_l(mid,2) |
---|
106 | ! DO k = 1, mask_size_l(mid,3) |
---|
107 | ! local_pf(i,j,k) = u2(mask_k(mid,k), & |
---|
108 | ! mask_j(mid,j), & |
---|
109 | ! mask_i(mid,i)) |
---|
110 | ! ENDDO |
---|
111 | ! ENDDO |
---|
112 | ! ENDDO |
---|
113 | ! ELSE |
---|
114 | !! |
---|
115 | !!-- Terrain-following masked output |
---|
116 | ! DO i = 1, mask_size_l(mid,1) |
---|
117 | ! DO j = 1, mask_size_l(mid,2) |
---|
118 | !! |
---|
119 | !!-- Get k index of highest horizontal surface |
---|
120 | ! topo_top_ind = get_topography_top_index_ji( & |
---|
121 | ! mask_j(mid,j), & |
---|
122 | ! mask_i(mid,i), & |
---|
123 | ! grid ) |
---|
124 | !! |
---|
125 | !!-- Save output array |
---|
126 | ! DO k = 1, mask_size_l(mid,3) |
---|
127 | ! local_pf(i,j,k) = u2(MIN( topo_top_ind+mask_k(mid,k),& |
---|
128 | ! nzt+1 ), & |
---|
129 | ! mask_j(mid,j), & |
---|
130 | ! mask_i(mid,i) ) |
---|
131 | ! ENDDO |
---|
132 | ! ENDDO |
---|
133 | ! ENDDO |
---|
134 | ! ENDIF |
---|
135 | ! ELSE |
---|
136 | ! IF ( .NOT. mask_surface(mid) ) THEN |
---|
137 | !! |
---|
138 | !!-- Default masked output |
---|
139 | ! DO i = 1, mask_size_l(mid,1) |
---|
140 | ! DO j = 1, mask_size_l(mid,2) |
---|
141 | ! DO k = 1, mask_size_l(mid,3) |
---|
142 | ! local_pf(i,j,k) = u2_av(mask_k(mid,k), & |
---|
143 | ! mask_j(mid,j), & |
---|
144 | ! mask_i(mid,i) ) |
---|
145 | ! ENDDO |
---|
146 | ! ENDDO |
---|
147 | ! ENDDO |
---|
148 | ! ELSE |
---|
149 | !! |
---|
150 | !!-- Terrain-following masked output |
---|
151 | ! DO i = 1, mask_size_l(mid,1) |
---|
152 | ! DO j = 1, mask_size_l(mid,2) |
---|
153 | !! |
---|
154 | !!-- Get k index of highest horizontal surface |
---|
155 | ! topo_top_ind = get_topography_top_index_ji( & |
---|
156 | ! mask_j(mid,j), & |
---|
157 | ! mask_i(mid,i), & |
---|
158 | ! grid ) |
---|
159 | !! |
---|
160 | !!-- Save output array |
---|
161 | ! DO k = 1, mask_size_l(mid,3) |
---|
162 | ! local_pf(i,j,k) = u2_av( & |
---|
163 | ! MIN( topo_top_ind+mask_k(mid,k),& |
---|
164 | ! nzt+1 ), & |
---|
165 | ! mask_j(mid,j), & |
---|
166 | ! mask_i(mid,i) ) |
---|
167 | ! ENDDO |
---|
168 | ! ENDDO |
---|
169 | ! ENDDO |
---|
170 | ! ENDIF |
---|
171 | ! ENDIF |
---|
172 | |
---|
173 | CASE DEFAULT |
---|
174 | found = .FALSE. |
---|
175 | |
---|
176 | END SELECT |
---|
177 | |
---|
178 | |
---|
179 | END SUBROUTINE user_data_output_mask |
---|