[3421] | 1 | !> @file surface_output_mod.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: surface_output_mod.f90 3421 2018-10-24 18:39:32Z schwenkel $ |
---|
| 27 | ! Add output variables |
---|
| 28 | ! Write data into binary file |
---|
| 29 | ! Initial implenentation from Klaus Ketelsen and Matthias Suehring |
---|
| 30 | ! |
---|
| 31 | ! 3420 2018-10-24 17:30:08Z gronemeier |
---|
| 32 | ! |
---|
| 33 | ! Description: |
---|
| 34 | ! ------------ |
---|
| 35 | !> Generate output for surface data. |
---|
| 36 | ! |
---|
| 37 | !------------------------------------------------------------------------------! |
---|
| 38 | |
---|
| 39 | MODULE surface_output_mod |
---|
| 40 | |
---|
| 41 | USE kinds |
---|
| 42 | |
---|
| 43 | USE arrays_3d, & |
---|
| 44 | ONLY: zu, zw |
---|
| 45 | USE control_parameters, & |
---|
| 46 | ONLY: surface_data_output |
---|
| 47 | USE grid_variables, & |
---|
| 48 | ONLY: dx,dy |
---|
| 49 | USE indices, & |
---|
| 50 | ONLY: nxl, nxr, nys, nyn, nzb, nzt |
---|
| 51 | USE surface_mod, & |
---|
| 52 | ONLY: surf_def_h, surf_def_v, surf_lsm_h, surf_lsm_v, & |
---|
| 53 | surf_usm_h, surf_usm_v |
---|
| 54 | |
---|
| 55 | IMPLICIT NONE |
---|
| 56 | |
---|
| 57 | TYPE surf_out !< data structure which contains all surfaces elements of all types on subdomain |
---|
| 58 | |
---|
| 59 | INTEGER(iwp) :: ns !< number of surface elements |
---|
| 60 | INTEGER(iwp) :: npoints !< number of points / vertices which define a surface element |
---|
| 61 | |
---|
| 62 | REAL(wp) :: fillvalue = -9999.9_wp !< fillvalue for surface elements which are not defined |
---|
| 63 | |
---|
| 64 | REAL(wp), DIMENSION(:), ALLOCATABLE :: var_out !< output variables |
---|
| 65 | REAL(wp), DIMENSION(:,:), ALLOCATABLE :: var_av !< variables used for averaging |
---|
| 66 | REAL(wp), DIMENSION(:,:), ALLOCATABLE :: points !< points / vertices of a surface element |
---|
| 67 | REAL(wp), DIMENSION(:,:), ALLOCATABLE :: polygons !< polygon data of a surface element |
---|
| 68 | END TYPE surf_out |
---|
| 69 | |
---|
| 70 | CHARACTER(LEN=100), DIMENSION(300) :: data_output_surf = ' ' !< namelist variable which describes the output variables |
---|
| 71 | CHARACTER(LEN=100), DIMENSION(0:1,300) :: dosurf = ' ' !< internal variable which describes the output variables and separates |
---|
| 72 | !< averaged from non-averaged output |
---|
| 73 | |
---|
| 74 | INTEGER(iwp) :: average_count_surf = 0 !< number of ensemble members used for averaging |
---|
| 75 | INTEGER(iwp) :: dosurf_no(0:1) = 0 !< number of surface output quantities |
---|
| 76 | |
---|
| 77 | LOGICAL :: first_output(0:1) = .FALSE. !< true if first output was already called |
---|
| 78 | |
---|
| 79 | REAL(wp) :: averaging_interval_surf = 9999999.9_wp !< averaging interval |
---|
| 80 | REAL(wp) :: dt_dosurf = 9999999.9_wp !< time interval for instantaneous data output |
---|
| 81 | REAL(wp) :: dt_dosurf_av = 9999999.9_wp !< time interval for averaged data output |
---|
| 82 | REAL(wp) :: skip_time_dosurf = 0.0_wp !< skip time for instantaneous data output |
---|
| 83 | REAL(wp) :: skip_time_dosurf_av = 0.0_wp !< skip time for averaged data output |
---|
| 84 | REAL(wp) :: time_dosurf = 0.0_wp !< internal counter variable to check for instantaneous data output |
---|
| 85 | REAL(wp) :: time_dosurf_av = 0.0_wp !< internal counter variable to check for averaged data output |
---|
| 86 | |
---|
| 87 | |
---|
| 88 | TYPE(surf_out) :: surfaces !< variable which contains all required output information |
---|
| 89 | |
---|
| 90 | SAVE |
---|
| 91 | |
---|
| 92 | PRIVATE |
---|
| 93 | |
---|
| 94 | INTERFACE surface_output |
---|
| 95 | MODULE PROCEDURE surface_output |
---|
| 96 | END INTERFACE surface_output |
---|
| 97 | |
---|
| 98 | INTERFACE surface_output_averaging |
---|
| 99 | MODULE PROCEDURE surface_output_averaging |
---|
| 100 | END INTERFACE surface_output_averaging |
---|
| 101 | |
---|
| 102 | INTERFACE surface_output_check_parameters |
---|
| 103 | MODULE PROCEDURE surface_output_check_parameters |
---|
| 104 | END INTERFACE surface_output_check_parameters |
---|
| 105 | |
---|
| 106 | INTERFACE surface_output_init |
---|
| 107 | MODULE PROCEDURE surface_output_init |
---|
| 108 | END INTERFACE surface_output_init |
---|
| 109 | |
---|
| 110 | INTERFACE surface_output_parin |
---|
| 111 | MODULE PROCEDURE surface_output_parin |
---|
| 112 | END INTERFACE surface_output_parin |
---|
| 113 | |
---|
| 114 | ! |
---|
| 115 | !--Public subroutines |
---|
| 116 | PUBLIC surface_output, surface_output_averaging, & |
---|
| 117 | surface_output_check_parameters, surface_output_init, & |
---|
| 118 | surface_output_parin |
---|
| 119 | ! |
---|
| 120 | !--Public variables |
---|
| 121 | PUBLIC average_count_surf, averaging_interval_surf, dt_dosurf, dt_dosurf_av,& |
---|
| 122 | skip_time_dosurf, skip_time_dosurf_av, time_dosurf, time_dosurf_av |
---|
| 123 | |
---|
| 124 | CONTAINS |
---|
| 125 | |
---|
| 126 | !------------------------------------------------------------------------------! |
---|
| 127 | ! Description: |
---|
| 128 | ! ------------ |
---|
| 129 | !> Initialization surface-data output data structure: calculation of vertices |
---|
| 130 | !> and polygon data for the surface elements, allocation of required arrays. |
---|
| 131 | !------------------------------------------------------------------------------! |
---|
| 132 | SUBROUTINE surface_output_init |
---|
| 133 | IMPLICIT NONE |
---|
| 134 | |
---|
| 135 | INTEGER(iwp) :: i !< grid index in x-direction, also running variable for counting non-average data output |
---|
| 136 | INTEGER(iwp) :: ilen !< string length |
---|
| 137 | INTEGER(iwp) :: j !< grid index in y-direction, also running variable for counting average data output |
---|
| 138 | INTEGER(iwp) :: k !< grid index in z-direction |
---|
| 139 | INTEGER(iwp) :: l !< running index for surface-element orientation |
---|
| 140 | INTEGER(iwp) :: m !< running index for surface elements |
---|
| 141 | INTEGER(iwp) :: n_out !< running index for number of output variables |
---|
| 142 | |
---|
| 143 | |
---|
| 144 | INTEGER(iwp) :: npg !< counter variable for all surface elements ( or polygons ) |
---|
| 145 | |
---|
| 146 | INTEGER(iwp), ALLOCATABLE, DIMENSION(:,:,:) :: point_index !< dummy array used to check where the reference points for surface polygons are located |
---|
| 147 | |
---|
| 148 | ! |
---|
| 149 | !-- Determine the number of surface elements on subdomain |
---|
| 150 | surfaces%ns = surf_def_h(0)%ns + surf_lsm_h%ns + surf_usm_h%ns & !horizontal upward-facing |
---|
| 151 | + surf_def_h(1)%ns & !horizontal downard-facing |
---|
| 152 | + surf_def_v(0)%ns + surf_lsm_v(0)%ns + surf_usm_v(0)%ns & !northward-facing |
---|
| 153 | + surf_def_v(1)%ns + surf_lsm_v(1)%ns + surf_usm_v(1)%ns & !southward-facing |
---|
| 154 | + surf_def_v(2)%ns + surf_lsm_v(2)%ns + surf_usm_v(2)%ns & !westward-facing |
---|
| 155 | + surf_def_v(3)%ns + surf_lsm_v(3)%ns + surf_usm_v(3)%ns !eastward-facing |
---|
| 156 | ! |
---|
| 157 | !-- Allocate output variable and set to _FillValue attribute |
---|
| 158 | ALLOCATE ( surfaces%var_out(1:surfaces%ns) ) |
---|
| 159 | surfaces%var_out = surfaces%fillvalue |
---|
| 160 | ! |
---|
| 161 | !-- If there is an output of time average output variables, allocate the |
---|
| 162 | !-- required array. |
---|
| 163 | IF ( dosurf_no(1) > 0 ) THEN |
---|
| 164 | ALLOCATE ( surfaces%var_av(1:surfaces%ns,1:dosurf_no(1)) ) |
---|
| 165 | surfaces%var_av = 0.0_wp |
---|
| 166 | ENDIF |
---|
| 167 | ! |
---|
| 168 | !-- Initialize points and polygon data. |
---|
| 169 | !-- In a first step, count the number of points which are defining |
---|
| 170 | !-- the surfaces and the polygons. |
---|
| 171 | ALLOCATE( point_index(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) ) |
---|
| 172 | point_index = -1 |
---|
| 173 | ! |
---|
| 174 | !-- Horizontal default surfaces |
---|
| 175 | surfaces%npoints = 0 |
---|
| 176 | DO l = 0, 1 |
---|
| 177 | DO m = 1, surf_def_h(0)%ns |
---|
| 178 | ! |
---|
| 179 | !-- Determine the indices of the respective grid cell inside the topography |
---|
| 180 | i = surf_def_h(0)%i(m) + surf_def_h(0)%ioff |
---|
| 181 | j = surf_def_h(0)%j(m) + surf_def_h(0)%joff |
---|
| 182 | k = surf_def_h(0)%k(m) + surf_def_h(0)%koff |
---|
| 183 | ! |
---|
| 184 | !-- Check if the vertices that define the surface element are already |
---|
| 185 | !-- defined, if not, increment the counter. |
---|
| 186 | IF ( point_index(k,j,i) < 0) THEN |
---|
| 187 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 188 | point_index(k,j,i) = surfaces%npoints |
---|
| 189 | ENDIF |
---|
| 190 | IF ( point_index(k,j+1,i) < 0) THEN |
---|
| 191 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 192 | point_index(k,j+1,i) = surfaces%npoints |
---|
| 193 | ENDIF |
---|
| 194 | IF ( point_index(k,j,i+1) < 0) THEN |
---|
| 195 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 196 | point_index(k,j,i+1) = surfaces%npoints |
---|
| 197 | ENDIF |
---|
| 198 | IF ( point_index(k,j+1,i+1) < 0) THEN |
---|
| 199 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 200 | point_index(k,j+1,i+1) = surfaces%npoints |
---|
| 201 | ENDIF |
---|
| 202 | ENDDO |
---|
| 203 | ENDDO |
---|
| 204 | DO m = 1, surf_lsm_h%ns |
---|
| 205 | i = surf_lsm_h%i(m) + surf_lsm_h%ioff |
---|
| 206 | j = surf_lsm_h%j(m) + surf_lsm_h%joff |
---|
| 207 | k = surf_lsm_h%k(m) + surf_lsm_h%koff |
---|
| 208 | |
---|
| 209 | IF ( point_index(k,j,i) < 0) THEN |
---|
| 210 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 211 | point_index(k,j,i) = surfaces%npoints |
---|
| 212 | ENDIF |
---|
| 213 | IF ( point_index(k,j+1,i) < 0) THEN |
---|
| 214 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 215 | point_index(k,j+1,i) = surfaces%npoints |
---|
| 216 | ENDIF |
---|
| 217 | IF ( point_index(k,j,i+1) < 0) THEN |
---|
| 218 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 219 | point_index(k,j,i+1) = surfaces%npoints |
---|
| 220 | ENDIF |
---|
| 221 | IF ( point_index(k,j+1,i+1) < 0) THEN |
---|
| 222 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 223 | point_index(k,j+1,i+1) = surfaces%npoints |
---|
| 224 | ENDIF |
---|
| 225 | ENDDO |
---|
| 226 | DO m = 1, surf_usm_h%ns |
---|
| 227 | i = surf_usm_h%i(m) + surf_usm_h%ioff |
---|
| 228 | j = surf_usm_h%j(m) + surf_usm_h%joff |
---|
| 229 | k = surf_usm_h%k(m) + surf_usm_h%koff |
---|
| 230 | |
---|
| 231 | IF ( point_index(k,j,i) < 0) THEN |
---|
| 232 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 233 | point_index(k,j,i) = surfaces%npoints |
---|
| 234 | ENDIF |
---|
| 235 | IF ( point_index(k,j+1,i) < 0) THEN |
---|
| 236 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 237 | point_index(k,j+1,i) = surfaces%npoints |
---|
| 238 | ENDIF |
---|
| 239 | IF ( point_index(k,j,i+1) < 0) THEN |
---|
| 240 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 241 | point_index(k,j,i+1) = surfaces%npoints |
---|
| 242 | ENDIF |
---|
| 243 | IF ( point_index(k,j+1,i+1) < 0) THEN |
---|
| 244 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 245 | point_index(k,j+1,i+1) = surfaces%npoints |
---|
| 246 | ENDIF |
---|
| 247 | ENDDO |
---|
| 248 | ! |
---|
| 249 | !-- Vertical surfaces |
---|
| 250 | DO l = 0, 3 |
---|
| 251 | DO m = 1, surf_def_v(l)%ns |
---|
| 252 | ! |
---|
| 253 | !-- Determine the indices of the respective grid cell inside the topography. |
---|
| 254 | !-- Please note, j-index for north-facing surfaces ( l==0 ) is |
---|
| 255 | !-- identical to the reference j-index outside the grid box. |
---|
| 256 | !-- Equivalent for east-facing surfaces and i-index. |
---|
| 257 | i = surf_def_v(l)%i(m) + MERGE( surf_def_v(l)%ioff, 0, l == 2 ) |
---|
| 258 | j = surf_def_v(l)%j(m) + MERGE( surf_def_v(l)%joff, 0, l == 0 ) |
---|
| 259 | k = surf_def_v(l)%k(m) + surf_def_v(l)%koff |
---|
| 260 | ! |
---|
| 261 | !-- Lower left /front vertex |
---|
| 262 | IF ( point_index(k,j,i) < 0) THEN |
---|
| 263 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 264 | point_index(k,j,i) = surfaces%npoints |
---|
| 265 | ENDIF |
---|
| 266 | ! |
---|
| 267 | !-- Upper left / front vertex |
---|
| 268 | IF ( point_index(k+1,j,i) < 0) THEN |
---|
| 269 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 270 | point_index(k+1,j,i) = surfaces%npoints |
---|
| 271 | ENDIF |
---|
| 272 | ! |
---|
| 273 | !-- Upper / lower right index for north- and south-facing surfaces |
---|
| 274 | IF ( l == 0 .AND. l == 1 ) THEN |
---|
| 275 | IF ( point_index(k,j,i+1) < 0) THEN |
---|
| 276 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 277 | point_index(k,j,i+1) = surfaces%npoints |
---|
| 278 | ENDIF |
---|
| 279 | IF ( point_index(k+1,j,i+1) < 0) THEN |
---|
| 280 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 281 | point_index(k+1,j,i+1) = surfaces%npoints |
---|
| 282 | ENDIF |
---|
| 283 | ! |
---|
| 284 | !-- Upper / lower front index for east- and west-facing surfaces |
---|
| 285 | ELSEIF ( l == 2 .AND. l == 3 ) THEN |
---|
| 286 | IF ( point_index(k,j+1,i) < 0) THEN |
---|
| 287 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 288 | point_index(k,j+1,i) = surfaces%npoints |
---|
| 289 | ENDIF |
---|
| 290 | IF ( point_index(k+1,j+1,i) < 0) THEN |
---|
| 291 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 292 | point_index(k+1,j+1,i) = surfaces%npoints |
---|
| 293 | ENDIF |
---|
| 294 | ENDIF |
---|
| 295 | |
---|
| 296 | ENDDO |
---|
| 297 | DO m = 1, surf_lsm_v(l)%ns |
---|
| 298 | i = surf_lsm_v(l)%i(m) + MERGE( surf_lsm_v(l)%ioff, 0, l == 2 ) |
---|
| 299 | j = surf_lsm_v(l)%j(m) + MERGE( surf_lsm_v(l)%joff, 0, l == 0 ) |
---|
| 300 | k = surf_lsm_v(l)%k(m) + surf_lsm_v(l)%koff |
---|
| 301 | ! |
---|
| 302 | !-- Lower left /front vertex |
---|
| 303 | IF ( point_index(k,j,i) < 0) THEN |
---|
| 304 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 305 | point_index(k,j,i) = surfaces%npoints |
---|
| 306 | ENDIF |
---|
| 307 | ! |
---|
| 308 | !-- Upper left / front vertex |
---|
| 309 | IF ( point_index(k+1,j,i) < 0) THEN |
---|
| 310 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 311 | point_index(k+1,j,i) = surfaces%npoints |
---|
| 312 | ENDIF |
---|
| 313 | ! |
---|
| 314 | !-- Upper / lower right index for north- and south-facing surfaces |
---|
| 315 | IF ( l == 0 .AND. l == 1 ) THEN |
---|
| 316 | IF ( point_index(k,j,i+1) < 0) THEN |
---|
| 317 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 318 | point_index(k,j,i+1) = surfaces%npoints |
---|
| 319 | ENDIF |
---|
| 320 | IF ( point_index(k+1,j,i+1) < 0) THEN |
---|
| 321 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 322 | point_index(k+1,j,i+1) = surfaces%npoints |
---|
| 323 | ENDIF |
---|
| 324 | ! |
---|
| 325 | !-- Upper / lower front index for east- and west-facing surfaces |
---|
| 326 | ELSEIF ( l == 2 .AND. l == 3 ) THEN |
---|
| 327 | IF ( point_index(k,j+1,i) < 0) THEN |
---|
| 328 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 329 | point_index(k,j+1,i) = surfaces%npoints |
---|
| 330 | ENDIF |
---|
| 331 | IF ( point_index(k+1,j+1,i) < 0) THEN |
---|
| 332 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 333 | point_index(k+1,j+1,i) = surfaces%npoints |
---|
| 334 | ENDIF |
---|
| 335 | ENDIF |
---|
| 336 | ENDDO |
---|
| 337 | DO m = 1, surf_usm_v(l)%ns |
---|
| 338 | i = surf_usm_v(l)%i(m) + MERGE( surf_usm_v(l)%ioff, 0, l == 2 ) |
---|
| 339 | j = surf_usm_v(l)%j(m) + MERGE( surf_usm_v(l)%joff, 0, l == 0 ) |
---|
| 340 | k = surf_usm_v(l)%k(m) + surf_usm_v(l)%koff |
---|
| 341 | ! |
---|
| 342 | !-- Lower left /front vertex |
---|
| 343 | IF ( point_index(k,j,i) < 0) THEN |
---|
| 344 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 345 | point_index(k,j,i) = surfaces%npoints |
---|
| 346 | ENDIF |
---|
| 347 | ! |
---|
| 348 | !-- Upper left / front vertex |
---|
| 349 | IF ( point_index(k+1,j,i) < 0) THEN |
---|
| 350 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 351 | point_index(k+1,j,i) = surfaces%npoints |
---|
| 352 | ENDIF |
---|
| 353 | ! |
---|
| 354 | !-- Upper / lower right index for north- and south-facing surfaces |
---|
| 355 | IF ( l == 0 .AND. l == 1 ) THEN |
---|
| 356 | IF ( point_index(k,j,i+1) < 0) THEN |
---|
| 357 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 358 | point_index(k,j,i+1) = surfaces%npoints |
---|
| 359 | ENDIF |
---|
| 360 | IF ( point_index(k+1,j,i+1) < 0) THEN |
---|
| 361 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 362 | point_index(k+1,j,i+1) = surfaces%npoints |
---|
| 363 | ENDIF |
---|
| 364 | ! |
---|
| 365 | !-- Upper / lower front index for east- and west-facing surfaces |
---|
| 366 | ELSEIF ( l == 2 .AND. l == 3 ) THEN |
---|
| 367 | IF ( point_index(k,j+1,i) < 0) THEN |
---|
| 368 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 369 | point_index(k,j+1,i) = surfaces%npoints |
---|
| 370 | ENDIF |
---|
| 371 | IF ( point_index(k+1,j+1,i) < 0) THEN |
---|
| 372 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 373 | point_index(k+1,j+1,i) = surfaces%npoints |
---|
| 374 | ENDIF |
---|
| 375 | ENDIF |
---|
| 376 | ENDDO |
---|
| 377 | ENDDO |
---|
| 378 | ! |
---|
| 379 | !-- Allocate the number of points and polygons. Note, the number of polygons |
---|
| 380 | !-- is identical to the number of surfaces elements, whereas the number |
---|
| 381 | !-- of points (vertices) which define the polygons can be larger. |
---|
| 382 | ALLOCATE( surfaces%points(3,1:surfaces%npoints) ) |
---|
| 383 | ALLOCATE( surfaces%polygons(5,1:surfaces%ns) ) |
---|
| 384 | ! |
---|
| 385 | !-- After the number of vertices is counted, repeat the loops and define the |
---|
| 386 | !-- vertices. |
---|
| 387 | !-- Start with the horizontal default surfaces |
---|
| 388 | surfaces%npoints = 0 |
---|
| 389 | point_index = -1 |
---|
| 390 | npg = 0 |
---|
| 391 | DO l = 0, 1 |
---|
| 392 | DO m = 1, surf_def_h(0)%ns |
---|
| 393 | ! |
---|
| 394 | !-- Determine the indices of the respective grid cell inside the topography |
---|
| 395 | i = surf_def_h(0)%i(m) + surf_def_h(0)%ioff |
---|
| 396 | j = surf_def_h(0)%j(m) + surf_def_h(0)%joff |
---|
| 397 | k = surf_def_h(0)%k(m) + surf_def_h(0)%koff |
---|
| 398 | ! |
---|
| 399 | !-- Check if the vertices that define the surface element are already |
---|
| 400 | !-- defined, if not, increment the counter. |
---|
| 401 | IF ( point_index(k,j,i) < 0) THEN |
---|
| 402 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 403 | point_index(k,j,i) = surfaces%npoints |
---|
| 404 | surfaces%points(1,surfaces%npoints) = ( i - 0.5_wp ) * dx |
---|
| 405 | surfaces%points(2,surfaces%npoints) = ( j - 0.5_wp ) * dy |
---|
| 406 | surfaces%points(3,surfaces%npoints) = zw(k) |
---|
| 407 | ENDIF |
---|
| 408 | IF ( point_index(k,j+1,i) < 0) THEN |
---|
| 409 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 410 | point_index(k,j+1,i) = surfaces%npoints |
---|
| 411 | surfaces%points(1,surfaces%npoints) = ( i - 0.5_wp ) * dx |
---|
| 412 | surfaces%points(2,surfaces%npoints) = ( j + 1 - 0.5_wp ) * dy |
---|
| 413 | surfaces%points(3,surfaces%npoints) = zw(k) |
---|
| 414 | ENDIF |
---|
| 415 | IF ( point_index(k,j,i+1) < 0) THEN |
---|
| 416 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 417 | point_index(k,j,i+1) = surfaces%npoints |
---|
| 418 | surfaces%points(1,surfaces%npoints) = ( i + 1 - 0.5_wp ) * dx |
---|
| 419 | surfaces%points(2,surfaces%npoints) = ( j - 0.5_wp ) * dy |
---|
| 420 | surfaces%points(3,surfaces%npoints) = zw(k) |
---|
| 421 | ENDIF |
---|
| 422 | IF ( point_index(k,j+1,i+1) < 0) THEN |
---|
| 423 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 424 | point_index(k,j+1,i+1) = surfaces%npoints |
---|
| 425 | surfaces%points(1,surfaces%npoints) = ( i + 1 - 0.5_wp ) * dx |
---|
| 426 | surfaces%points(2,surfaces%npoints) = ( j + 1 - 0.5_wp ) * dy |
---|
| 427 | surfaces%points(3,surfaces%npoints) = zw(k) |
---|
| 428 | ENDIF |
---|
| 429 | |
---|
| 430 | npg = npg + 1 |
---|
| 431 | surfaces%polygons(1,npg) = 4 |
---|
| 432 | surfaces%polygons(2,npg) = point_index(k,j,i) |
---|
| 433 | surfaces%polygons(3,npg) = point_index(k,j+1,i) |
---|
| 434 | surfaces%polygons(4,npg) = point_index(k,j+1,i+1) |
---|
| 435 | surfaces%polygons(5,npg) = point_index(k,j,i+1) |
---|
| 436 | ENDDO |
---|
| 437 | ENDDO |
---|
| 438 | DO m = 1, surf_lsm_h%ns |
---|
| 439 | i = surf_lsm_h%i(m) + surf_lsm_h%ioff |
---|
| 440 | j = surf_lsm_h%j(m) + surf_lsm_h%joff |
---|
| 441 | k = surf_lsm_h%k(m) + surf_lsm_h%koff |
---|
| 442 | |
---|
| 443 | IF ( point_index(k,j,i) < 0) THEN |
---|
| 444 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 445 | point_index(k,j,i) = surfaces%npoints |
---|
| 446 | surfaces%points(1,surfaces%npoints) = ( i - 0.5_wp ) * dx |
---|
| 447 | surfaces%points(2,surfaces%npoints) = ( j - 0.5_wp ) * dy |
---|
| 448 | surfaces%points(3,surfaces%npoints) = zw(k) |
---|
| 449 | ENDIF |
---|
| 450 | IF ( point_index(k,j+1,i) < 0) THEN |
---|
| 451 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 452 | point_index(k,j+1,i) = surfaces%npoints |
---|
| 453 | surfaces%points(1,surfaces%npoints) = ( i - 0.5_wp ) * dx |
---|
| 454 | surfaces%points(2,surfaces%npoints) = ( j + 1 - 0.5_wp ) * dy |
---|
| 455 | surfaces%points(3,surfaces%npoints) = zw(k) |
---|
| 456 | ENDIF |
---|
| 457 | IF ( point_index(k,j,i+1) < 0) THEN |
---|
| 458 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 459 | point_index(k,j,i+1) = surfaces%npoints |
---|
| 460 | surfaces%points(1,surfaces%npoints) = ( i + 1 - 0.5_wp ) * dx |
---|
| 461 | surfaces%points(2,surfaces%npoints) = ( j - 0.5_wp ) * dy |
---|
| 462 | surfaces%points(3,surfaces%npoints) = zw(k) |
---|
| 463 | ENDIF |
---|
| 464 | IF ( point_index(k,j+1,i+1) < 0) THEN |
---|
| 465 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 466 | point_index(k,j+1,i+1) = surfaces%npoints |
---|
| 467 | surfaces%points(1,surfaces%npoints) = ( i + 1 - 0.5_wp ) * dx |
---|
| 468 | surfaces%points(2,surfaces%npoints) = ( j + 1 - 0.5_wp ) * dy |
---|
| 469 | surfaces%points(3,surfaces%npoints) = zw(k) |
---|
| 470 | ENDIF |
---|
| 471 | |
---|
| 472 | npg = npg + 1 |
---|
| 473 | surfaces%polygons(1,npg) = 4 |
---|
| 474 | surfaces%polygons(2,npg) = point_index(k,j,i) |
---|
| 475 | surfaces%polygons(3,npg) = point_index(k,j+1,i) |
---|
| 476 | surfaces%polygons(4,npg) = point_index(k,j+1,i+1) |
---|
| 477 | surfaces%polygons(5,npg) = point_index(k,j,i+1) |
---|
| 478 | ENDDO |
---|
| 479 | DO m = 1, surf_usm_h%ns |
---|
| 480 | i = surf_usm_h%i(m) + surf_usm_h%ioff |
---|
| 481 | j = surf_usm_h%j(m) + surf_usm_h%joff |
---|
| 482 | k = surf_usm_h%k(m) + surf_usm_h%koff |
---|
| 483 | |
---|
| 484 | IF ( point_index(k,j,i) < 0) THEN |
---|
| 485 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 486 | point_index(k,j,i) = surfaces%npoints |
---|
| 487 | surfaces%points(1,surfaces%npoints) = ( i - 0.5_wp ) * dx |
---|
| 488 | surfaces%points(2,surfaces%npoints) = ( j - 0.5_wp ) * dy |
---|
| 489 | surfaces%points(3,surfaces%npoints) = zw(k) |
---|
| 490 | ENDIF |
---|
| 491 | IF ( point_index(k,j+1,i) < 0) THEN |
---|
| 492 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 493 | point_index(k,j+1,i) = surfaces%npoints |
---|
| 494 | surfaces%points(1,surfaces%npoints) = ( i - 0.5_wp ) * dx |
---|
| 495 | surfaces%points(2,surfaces%npoints) = ( j + 1 - 0.5_wp ) * dy |
---|
| 496 | surfaces%points(3,surfaces%npoints) = zw(k) |
---|
| 497 | ENDIF |
---|
| 498 | IF ( point_index(k,j,i+1) < 0) THEN |
---|
| 499 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 500 | point_index(k,j,i+1) = surfaces%npoints |
---|
| 501 | surfaces%points(1,surfaces%npoints) = ( i + 1 - 0.5_wp ) * dx |
---|
| 502 | surfaces%points(2,surfaces%npoints) = ( j - 0.5_wp ) * dy |
---|
| 503 | surfaces%points(3,surfaces%npoints) = zw(k) |
---|
| 504 | ENDIF |
---|
| 505 | IF ( point_index(k,j+1,i+1) < 0) THEN |
---|
| 506 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 507 | point_index(k,j+1,i+1) = surfaces%npoints |
---|
| 508 | surfaces%points(1,surfaces%npoints) = ( i + 1 - 0.5_wp ) * dx |
---|
| 509 | surfaces%points(2,surfaces%npoints) = ( j + 1 - 0.5_wp ) * dy |
---|
| 510 | surfaces%points(3,surfaces%npoints) = zw(k) |
---|
| 511 | ENDIF |
---|
| 512 | |
---|
| 513 | npg = npg + 1 |
---|
| 514 | surfaces%polygons(1,npg) = 4 |
---|
| 515 | surfaces%polygons(2,npg) = point_index(k,j,i) |
---|
| 516 | surfaces%polygons(3,npg) = point_index(k,j+1,i) |
---|
| 517 | surfaces%polygons(4,npg) = point_index(k,j+1,i+1) |
---|
| 518 | surfaces%polygons(5,npg) = point_index(k,j,i+1) |
---|
| 519 | ENDDO |
---|
| 520 | DO l = 0, 3 |
---|
| 521 | DO m = 1, surf_def_v(l)%ns |
---|
| 522 | ! |
---|
| 523 | !-- Determine the indices of the respective grid cell inside the topography. |
---|
| 524 | !-- Please note, j-index for north-facing surfaces ( l==0 ) is |
---|
| 525 | !-- identical to the reference j-index outside the grid box. |
---|
| 526 | !-- Equivalent for east-facing surfaces and i-index. |
---|
| 527 | i = surf_def_v(l)%i(m) + MERGE( surf_def_v(l)%ioff, 0, l == 2 ) |
---|
| 528 | j = surf_def_v(l)%j(m) + MERGE( surf_def_v(l)%joff, 0, l == 0 ) |
---|
| 529 | k = surf_def_v(l)%k(m) + surf_def_v(l)%koff |
---|
| 530 | ! |
---|
| 531 | !-- Lower left /front vertex |
---|
| 532 | IF ( point_index(k,j,i) < 0) THEN |
---|
| 533 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 534 | point_index(k,j,i) = surfaces%npoints |
---|
| 535 | surfaces%points(1,surfaces%npoints) = ( i - 0.5_wp ) * dx |
---|
| 536 | surfaces%points(2,surfaces%npoints) = ( j - 0.5_wp ) * dy |
---|
| 537 | surfaces%points(3,surfaces%npoints) = zw(k) |
---|
| 538 | ENDIF |
---|
| 539 | ! |
---|
| 540 | !-- Upper left / front vertex |
---|
| 541 | IF ( point_index(k+1,j,i) < 0) THEN |
---|
| 542 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 543 | point_index(k+1,j,i) = surfaces%npoints |
---|
| 544 | surfaces%points(1,surfaces%npoints) = ( i - 0.5_wp ) * dx |
---|
| 545 | surfaces%points(2,surfaces%npoints) = ( j - 0.5_wp ) * dy |
---|
| 546 | surfaces%points(3,surfaces%npoints) = zw(k+1) |
---|
| 547 | ENDIF |
---|
| 548 | ! |
---|
| 549 | !-- Upper / lower right index for north- and south-facing surfaces |
---|
| 550 | IF ( l == 0 .AND. l == 1 ) THEN |
---|
| 551 | IF ( point_index(k,j,i+1) < 0) THEN |
---|
| 552 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 553 | point_index(k,j,i+1) = surfaces%npoints |
---|
| 554 | surfaces%points(1,surfaces%npoints) = ( i + 1 - 0.5_wp ) * dx |
---|
| 555 | surfaces%points(2,surfaces%npoints) = ( j - 0.5_wp ) * dy |
---|
| 556 | surfaces%points(3,surfaces%npoints) = zw(k) |
---|
| 557 | ENDIF |
---|
| 558 | IF ( point_index(k+1,j,i+1) < 0) THEN |
---|
| 559 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 560 | point_index(k+1,j,i+1) = surfaces%npoints |
---|
| 561 | surfaces%points(1,surfaces%npoints) = ( i + 1 - 0.5_wp ) * dx |
---|
| 562 | surfaces%points(2,surfaces%npoints) = ( j - 0.5_wp ) * dy |
---|
| 563 | surfaces%points(3,surfaces%npoints) = zw(k+1) |
---|
| 564 | ENDIF |
---|
| 565 | ! |
---|
| 566 | !-- Upper / lower front index for east- and west-facing surfaces |
---|
| 567 | ELSEIF ( l == 2 .AND. l == 3 ) THEN |
---|
| 568 | IF ( point_index(k,j+1,i) < 0) THEN |
---|
| 569 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 570 | point_index(k,j+1,i) = surfaces%npoints |
---|
| 571 | surfaces%points(1,surfaces%npoints) = ( i - 0.5_wp ) * dx |
---|
| 572 | surfaces%points(2,surfaces%npoints) = ( j + 1 - 0.5_wp ) * dy |
---|
| 573 | surfaces%points(3,surfaces%npoints) = zw(k) |
---|
| 574 | ENDIF |
---|
| 575 | IF ( point_index(k+1,j+1,i) < 0) THEN |
---|
| 576 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 577 | point_index(k+1,j+1,i) = surfaces%npoints |
---|
| 578 | surfaces%points(1,surfaces%npoints) = ( i - 0.5_wp ) * dx |
---|
| 579 | surfaces%points(2,surfaces%npoints) = ( j + 1 - 0.5_wp ) * dy |
---|
| 580 | surfaces%points(3,surfaces%npoints) = zw(k+1) |
---|
| 581 | ENDIF |
---|
| 582 | ENDIF |
---|
| 583 | |
---|
| 584 | npg = npg + 1 |
---|
| 585 | IF ( l == 0 .AND. l == 1 ) THEN |
---|
| 586 | surfaces%polygons(1,npg) = 4 |
---|
| 587 | surfaces%polygons(2,npg) = point_index(k,j,i) |
---|
| 588 | surfaces%polygons(3,npg) = point_index(k,j,i+1) |
---|
| 589 | surfaces%polygons(4,npg) = point_index(k+1,j,i+1) |
---|
| 590 | surfaces%polygons(5,npg) = point_index(k+1,j,i) |
---|
| 591 | ELSE |
---|
| 592 | surfaces%polygons(1,npg) = 4 |
---|
| 593 | surfaces%polygons(2,npg) = point_index(k,j,i) |
---|
| 594 | surfaces%polygons(3,npg) = point_index(k,j+1,i) |
---|
| 595 | surfaces%polygons(4,npg) = point_index(k+1,j+1,i) |
---|
| 596 | surfaces%polygons(5,npg) = point_index(k+1,j,i) |
---|
| 597 | ENDIF |
---|
| 598 | |
---|
| 599 | ENDDO |
---|
| 600 | DO m = 1, surf_lsm_v(l)%ns |
---|
| 601 | i = surf_lsm_v(l)%i(m) + MERGE( surf_lsm_v(l)%ioff, 0, l == 2 ) |
---|
| 602 | j = surf_lsm_v(l)%j(m) + MERGE( surf_lsm_v(l)%joff, 0, l == 0 ) |
---|
| 603 | k = surf_lsm_v(l)%k(m) + surf_lsm_v(l)%koff |
---|
| 604 | ! |
---|
| 605 | !-- Lower left /front vertex |
---|
| 606 | IF ( point_index(k,j,i) < 0) THEN |
---|
| 607 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 608 | point_index(k,j,i) = surfaces%npoints |
---|
| 609 | surfaces%points(1,surfaces%npoints) = ( i - 0.5_wp ) * dx |
---|
| 610 | surfaces%points(2,surfaces%npoints) = ( j - 0.5_wp ) * dy |
---|
| 611 | surfaces%points(3,surfaces%npoints) = zw(k) |
---|
| 612 | ENDIF |
---|
| 613 | ! |
---|
| 614 | !-- Upper left / front vertex |
---|
| 615 | IF ( point_index(k+1,j,i) < 0) THEN |
---|
| 616 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 617 | point_index(k+1,j,i) = surfaces%npoints |
---|
| 618 | surfaces%points(1,surfaces%npoints) = ( i - 0.5_wp ) * dx |
---|
| 619 | surfaces%points(2,surfaces%npoints) = ( j - 0.5_wp ) * dy |
---|
| 620 | surfaces%points(3,surfaces%npoints) = zw(k+1) |
---|
| 621 | ENDIF |
---|
| 622 | ! |
---|
| 623 | !-- Upper / lower right index for north- and south-facing surfaces |
---|
| 624 | IF ( l == 0 .AND. l == 1 ) THEN |
---|
| 625 | IF ( point_index(k,j,i+1) < 0) THEN |
---|
| 626 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 627 | point_index(k,j,i+1) = surfaces%npoints |
---|
| 628 | surfaces%points(1,surfaces%npoints) = ( i + 1 - 0.5_wp ) * dx |
---|
| 629 | surfaces%points(2,surfaces%npoints) = ( j - 0.5_wp ) * dy |
---|
| 630 | surfaces%points(3,surfaces%npoints) = zw(k) |
---|
| 631 | ENDIF |
---|
| 632 | IF ( point_index(k+1,j,i+1) < 0) THEN |
---|
| 633 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 634 | point_index(k+1,j,i+1) = surfaces%npoints |
---|
| 635 | surfaces%points(1,surfaces%npoints) = ( i + 1 - 0.5_wp ) * dx |
---|
| 636 | surfaces%points(2,surfaces%npoints) = ( j - 0.5_wp ) * dy |
---|
| 637 | surfaces%points(3,surfaces%npoints) = zw(k+1) |
---|
| 638 | ENDIF |
---|
| 639 | ! |
---|
| 640 | !-- Upper / lower front index for east- and west-facing surfaces |
---|
| 641 | ELSEIF ( l == 2 .AND. l == 3 ) THEN |
---|
| 642 | IF ( point_index(k,j+1,i) < 0) THEN |
---|
| 643 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 644 | point_index(k,j+1,i) = surfaces%npoints |
---|
| 645 | surfaces%points(1,surfaces%npoints) = ( i - 0.5_wp ) * dx |
---|
| 646 | surfaces%points(2,surfaces%npoints) = ( j + 1 - 0.5_wp ) * dy |
---|
| 647 | surfaces%points(3,surfaces%npoints) = zw(k) |
---|
| 648 | ENDIF |
---|
| 649 | IF ( point_index(k+1,j+1,i) < 0) THEN |
---|
| 650 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 651 | point_index(k+1,j+1,i) = surfaces%npoints |
---|
| 652 | surfaces%points(1,surfaces%npoints) = ( i - 0.5_wp ) * dx |
---|
| 653 | surfaces%points(2,surfaces%npoints) = ( j + 1 - 0.5_wp ) * dy |
---|
| 654 | surfaces%points(3,surfaces%npoints) = zw(k+1) |
---|
| 655 | ENDIF |
---|
| 656 | ENDIF |
---|
| 657 | |
---|
| 658 | npg = npg + 1 |
---|
| 659 | IF ( l == 0 .AND. l == 1 ) THEN |
---|
| 660 | surfaces%polygons(1,npg) = 4 |
---|
| 661 | surfaces%polygons(2,npg) = point_index(k,j,i) |
---|
| 662 | surfaces%polygons(3,npg) = point_index(k,j,i+1) |
---|
| 663 | surfaces%polygons(4,npg) = point_index(k+1,j,i+1) |
---|
| 664 | surfaces%polygons(5,npg) = point_index(k+1,j,i) |
---|
| 665 | ELSE |
---|
| 666 | surfaces%polygons(1,npg) = 4 |
---|
| 667 | surfaces%polygons(2,npg) = point_index(k,j,i) |
---|
| 668 | surfaces%polygons(3,npg) = point_index(k,j+1,i) |
---|
| 669 | surfaces%polygons(4,npg) = point_index(k+1,j+1,i) |
---|
| 670 | surfaces%polygons(5,npg) = point_index(k+1,j,i) |
---|
| 671 | ENDIF |
---|
| 672 | ENDDO |
---|
| 673 | DO m = 1, surf_usm_v(l)%ns |
---|
| 674 | i = surf_usm_v(l)%i(m) + MERGE( surf_usm_v(l)%ioff, 0, l == 2 ) |
---|
| 675 | j = surf_usm_v(l)%j(m) + MERGE( surf_usm_v(l)%joff, 0, l == 0 ) |
---|
| 676 | k = surf_usm_v(l)%k(m) + surf_usm_v(l)%koff |
---|
| 677 | ! |
---|
| 678 | !-- Lower left /front vertex |
---|
| 679 | IF ( point_index(k,j,i) < 0) THEN |
---|
| 680 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 681 | point_index(k,j,i) = surfaces%npoints |
---|
| 682 | surfaces%points(1,surfaces%npoints) = ( i - 0.5_wp ) * dx |
---|
| 683 | surfaces%points(2,surfaces%npoints) = ( j - 0.5_wp ) * dy |
---|
| 684 | surfaces%points(3,surfaces%npoints) = zw(k) |
---|
| 685 | ENDIF |
---|
| 686 | ! |
---|
| 687 | !-- Upper left / front vertex |
---|
| 688 | IF ( point_index(k+1,j,i) < 0) THEN |
---|
| 689 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 690 | point_index(k+1,j,i) = surfaces%npoints |
---|
| 691 | surfaces%points(1,surfaces%npoints) = ( i - 0.5_wp ) * dx |
---|
| 692 | surfaces%points(2,surfaces%npoints) = ( j - 0.5_wp ) * dy |
---|
| 693 | surfaces%points(3,surfaces%npoints) = zw(k+1) |
---|
| 694 | ENDIF |
---|
| 695 | ! |
---|
| 696 | !-- Upper / lower right index for north- and south-facing surfaces |
---|
| 697 | IF ( l == 0 .AND. l == 1 ) THEN |
---|
| 698 | IF ( point_index(k,j,i+1) < 0) THEN |
---|
| 699 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 700 | point_index(k,j,i+1) = surfaces%npoints |
---|
| 701 | surfaces%points(1,surfaces%npoints) = ( i + 1 - 0.5_wp ) * dx |
---|
| 702 | surfaces%points(2,surfaces%npoints) = ( j - 0.5_wp ) * dy |
---|
| 703 | surfaces%points(3,surfaces%npoints) = zw(k) |
---|
| 704 | ENDIF |
---|
| 705 | IF ( point_index(k+1,j,i+1) < 0) THEN |
---|
| 706 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 707 | point_index(k+1,j,i+1) = surfaces%npoints |
---|
| 708 | surfaces%points(1,surfaces%npoints) = ( i + 1 - 0.5_wp ) * dx |
---|
| 709 | surfaces%points(2,surfaces%npoints) = ( j - 0.5_wp ) * dy |
---|
| 710 | surfaces%points(3,surfaces%npoints) = zw(k+1) |
---|
| 711 | ENDIF |
---|
| 712 | ! |
---|
| 713 | !-- Upper / lower front index for east- and west-facing surfaces |
---|
| 714 | ELSEIF ( l == 2 .AND. l == 3 ) THEN |
---|
| 715 | IF ( point_index(k,j+1,i) < 0) THEN |
---|
| 716 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 717 | point_index(k,j+1,i) = surfaces%npoints |
---|
| 718 | surfaces%points(1,surfaces%npoints) = ( i - 0.5_wp ) * dx |
---|
| 719 | surfaces%points(2,surfaces%npoints) = ( j + 1 - 0.5_wp ) * dy |
---|
| 720 | surfaces%points(3,surfaces%npoints) = zw(k) |
---|
| 721 | ENDIF |
---|
| 722 | IF ( point_index(k+1,j+1,i) < 0) THEN |
---|
| 723 | surfaces%npoints = surfaces%npoints + 1 |
---|
| 724 | point_index(k+1,j+1,i) = surfaces%npoints |
---|
| 725 | surfaces%points(1,surfaces%npoints) = ( i - 0.5_wp ) * dx |
---|
| 726 | surfaces%points(2,surfaces%npoints) = ( j + 1 - 0.5_wp ) * dy |
---|
| 727 | surfaces%points(3,surfaces%npoints) = zw(k+1) |
---|
| 728 | ENDIF |
---|
| 729 | ENDIF |
---|
| 730 | |
---|
| 731 | npg = npg + 1 |
---|
| 732 | IF ( l == 0 .AND. l == 1 ) THEN |
---|
| 733 | surfaces%polygons(1,npg) = 4 |
---|
| 734 | surfaces%polygons(2,npg) = point_index(k,j,i) |
---|
| 735 | surfaces%polygons(3,npg) = point_index(k,j,i+1) |
---|
| 736 | surfaces%polygons(4,npg) = point_index(k+1,j,i+1) |
---|
| 737 | surfaces%polygons(5,npg) = point_index(k+1,j,i) |
---|
| 738 | ELSE |
---|
| 739 | surfaces%polygons(1,npg) = 4 |
---|
| 740 | surfaces%polygons(2,npg) = point_index(k,j,i) |
---|
| 741 | surfaces%polygons(3,npg) = point_index(k,j+1,i) |
---|
| 742 | surfaces%polygons(4,npg) = point_index(k+1,j+1,i) |
---|
| 743 | surfaces%polygons(5,npg) = point_index(k+1,j,i) |
---|
| 744 | ENDIF |
---|
| 745 | ENDDO |
---|
| 746 | ENDDO |
---|
| 747 | ! |
---|
| 748 | !-- Deallocate temporary dummy variable |
---|
| 749 | DEALLOCATE ( point_index ) |
---|
| 750 | ! |
---|
| 751 | !-- Now, vertices as well as polygon data can be written to NetCDF files |
---|
| 752 | !-- ... |
---|
| 753 | END SUBROUTINE surface_output_init |
---|
| 754 | |
---|
| 755 | !------------------------------------------------------------------------------! |
---|
| 756 | ! Description: |
---|
| 757 | ! ------------ |
---|
| 758 | !> Routine for controlling the data output. Surface data is collected from |
---|
| 759 | !> different types of surfaces (default, natural, urban) and different |
---|
| 760 | !> orientation and written to one 1D-output array. Further, NetCDF routines |
---|
| 761 | !> are called to write the surface data in the respective NetCDF files. |
---|
| 762 | !------------------------------------------------------------------------------! |
---|
| 763 | SUBROUTINE surface_output( av ) |
---|
| 764 | |
---|
| 765 | USE control_parameters, & |
---|
| 766 | ONLY: io_blocks, io_group, simulated_time |
---|
| 767 | |
---|
| 768 | USE pegrid, & |
---|
| 769 | ONLY: comm2d, ierr |
---|
| 770 | |
---|
| 771 | |
---|
| 772 | IMPLICIT NONE |
---|
| 773 | |
---|
| 774 | CHARACTER(LEN=100) :: trimvar = ' ' !< dummy for single output variable |
---|
| 775 | |
---|
| 776 | INTEGER(iwp) :: av !< id indicating average or non-average data output |
---|
| 777 | INTEGER(iwp) :: i !< loop index |
---|
| 778 | INTEGER(iwp) :: l !< running index for surface-element orientation |
---|
| 779 | INTEGER(iwp) :: m !< running index for surface elements |
---|
| 780 | INTEGER(iwp) :: n_out !< counter variables for surface output |
---|
| 781 | |
---|
| 782 | ! |
---|
| 783 | !-- Return, if nothing to output |
---|
| 784 | IF ( dosurf_no(av) == 0 ) RETURN |
---|
| 785 | ! |
---|
| 786 | !-- Open files |
---|
| 787 | CALL check_open( 25+av ) |
---|
| 788 | ! |
---|
| 789 | !-- Write coordinates |
---|
| 790 | IF ( .NOT. first_output(av) ) THEN |
---|
| 791 | DO i = 0, io_blocks-1 |
---|
| 792 | IF ( i == io_group ) THEN |
---|
| 793 | WRITE ( 25+av ) surfaces%npoints |
---|
| 794 | WRITE ( 25+av ) surfaces%ns |
---|
| 795 | WRITE ( 25+av ) surfaces%points |
---|
| 796 | WRITE ( 25+av ) surfaces%polygons |
---|
| 797 | ENDIF |
---|
| 798 | CALL MPI_BARRIER( comm2d, ierr ) |
---|
| 799 | first_output(av) = .TRUE. |
---|
| 800 | ENDDO |
---|
| 801 | ENDIF |
---|
| 802 | ! |
---|
| 803 | !-- Write time coordinate |
---|
| 804 | DO i = 0, io_blocks-1 |
---|
| 805 | IF ( i == io_group ) THEN |
---|
| 806 | trimvar = 'time' |
---|
| 807 | WRITE ( 25+av ) trimvar |
---|
| 808 | WRITE ( 25+av ) simulated_time |
---|
| 809 | ENDIF |
---|
| 810 | CALL MPI_BARRIER( comm2d, ierr ) |
---|
| 811 | ENDDO |
---|
| 812 | |
---|
| 813 | |
---|
| 814 | n_out = 0 |
---|
| 815 | DO WHILE ( dosurf(av,n_out+1)(1:1) /= ' ' ) |
---|
| 816 | |
---|
| 817 | n_out = n_out + 1 |
---|
| 818 | trimvar = TRIM( dosurf(av,n_out) ) |
---|
| 819 | ! |
---|
| 820 | !-- Set the output array to the _FillValue in case it is not |
---|
| 821 | !-- defined for each type of surface. |
---|
| 822 | surfaces%var_out = surfaces%fillvalue |
---|
| 823 | SELECT CASE ( trimvar ) |
---|
| 824 | |
---|
| 825 | CASE ( 'us' ) |
---|
| 826 | ! |
---|
| 827 | !-- Output of instantaneous data |
---|
| 828 | IF ( av == 0 ) THEN |
---|
| 829 | CALL surface_output_collect( surf_def_h(0)%us, & |
---|
| 830 | surf_def_h(1)%us, & |
---|
| 831 | surf_lsm_h%us, & |
---|
| 832 | surf_usm_h%us, & |
---|
| 833 | surf_def_v(0)%us, & |
---|
| 834 | surf_lsm_v(0)%us, & |
---|
| 835 | surf_usm_v(0)%us, & |
---|
| 836 | surf_def_v(1)%us, & |
---|
| 837 | surf_lsm_v(1)%us, & |
---|
| 838 | surf_usm_v(1)%us, & |
---|
| 839 | surf_def_v(2)%us, & |
---|
| 840 | surf_lsm_v(2)%us, & |
---|
| 841 | surf_usm_v(2)%us, & |
---|
| 842 | surf_def_v(3)%us, & |
---|
| 843 | surf_lsm_v(3)%us, & |
---|
| 844 | surf_usm_v(3)%us ) |
---|
| 845 | ELSE |
---|
| 846 | ! |
---|
| 847 | !-- Output of averaged data |
---|
| 848 | surfaces%var_out(:) = surfaces%var_av(:,n_out) / & |
---|
| 849 | REAL( average_count_surf, KIND=wp ) |
---|
| 850 | surfaces%var_av(:,n_out) = 0.0_wp |
---|
| 851 | |
---|
| 852 | ENDIF |
---|
| 853 | |
---|
| 854 | CASE ( 'ts' ) |
---|
| 855 | ! |
---|
| 856 | !-- Output of instantaneous data |
---|
| 857 | IF ( av == 0 ) THEN |
---|
| 858 | CALL surface_output_collect( surf_def_h(0)%ts, & |
---|
| 859 | surf_def_h(1)%ts, & |
---|
| 860 | surf_lsm_h%ts, & |
---|
| 861 | surf_usm_h%ts, & |
---|
| 862 | surf_def_v(0)%ts, & |
---|
| 863 | surf_lsm_v(0)%ts, & |
---|
| 864 | surf_usm_v(0)%ts, & |
---|
| 865 | surf_def_v(1)%ts, & |
---|
| 866 | surf_lsm_v(1)%ts, & |
---|
| 867 | surf_usm_v(1)%ts, & |
---|
| 868 | surf_def_v(2)%ts, & |
---|
| 869 | surf_lsm_v(2)%ts, & |
---|
| 870 | surf_usm_v(2)%ts, & |
---|
| 871 | surf_def_v(3)%ts, & |
---|
| 872 | surf_lsm_v(3)%ts, & |
---|
| 873 | surf_usm_v(3)%ts ) |
---|
| 874 | ELSE |
---|
| 875 | ! |
---|
| 876 | !-- Output of averaged data |
---|
| 877 | surfaces%var_out(:) = surfaces%var_av(:,n_out) / & |
---|
| 878 | REAL( average_count_surf, KIND=wp ) |
---|
| 879 | surfaces%var_av(:,n_out) = 0.0_wp |
---|
| 880 | |
---|
| 881 | ENDIF |
---|
| 882 | |
---|
| 883 | CASE ( 'qs' ) |
---|
| 884 | ! |
---|
| 885 | !-- Output of instantaneous data |
---|
| 886 | IF ( av == 0 ) THEN |
---|
| 887 | CALL surface_output_collect( surf_def_h(0)%qs, & |
---|
| 888 | surf_def_h(1)%qs, & |
---|
| 889 | surf_lsm_h%qs, & |
---|
| 890 | surf_usm_h%qs, & |
---|
| 891 | surf_def_v(0)%qs, & |
---|
| 892 | surf_lsm_v(0)%qs, & |
---|
| 893 | surf_usm_v(0)%qs, & |
---|
| 894 | surf_def_v(1)%qs, & |
---|
| 895 | surf_lsm_v(1)%qs, & |
---|
| 896 | surf_usm_v(1)%qs, & |
---|
| 897 | surf_def_v(2)%qs, & |
---|
| 898 | surf_lsm_v(2)%qs, & |
---|
| 899 | surf_usm_v(2)%qs, & |
---|
| 900 | surf_def_v(3)%qs, & |
---|
| 901 | surf_lsm_v(3)%qs, & |
---|
| 902 | surf_usm_v(3)%qs ) |
---|
| 903 | ELSE |
---|
| 904 | ! |
---|
| 905 | !-- Output of averaged data |
---|
| 906 | surfaces%var_out(:) = surfaces%var_av(:,n_out) / & |
---|
| 907 | REAL( average_count_surf, KIND=wp ) |
---|
| 908 | surfaces%var_av(:,n_out) = 0.0_wp |
---|
| 909 | |
---|
| 910 | ENDIF |
---|
| 911 | |
---|
| 912 | CASE ( 'ss' ) |
---|
| 913 | ! |
---|
| 914 | !-- Output of instantaneous data |
---|
| 915 | IF ( av == 0 ) THEN |
---|
| 916 | CALL surface_output_collect( surf_def_h(0)%ss, & |
---|
| 917 | surf_def_h(1)%ss, & |
---|
| 918 | surf_lsm_h%ss, & |
---|
| 919 | surf_usm_h%ss, & |
---|
| 920 | surf_def_v(0)%ss, & |
---|
| 921 | surf_lsm_v(0)%ss, & |
---|
| 922 | surf_usm_v(0)%ss, & |
---|
| 923 | surf_def_v(1)%ss, & |
---|
| 924 | surf_lsm_v(1)%ss, & |
---|
| 925 | surf_usm_v(1)%ss, & |
---|
| 926 | surf_def_v(2)%ss, & |
---|
| 927 | surf_lsm_v(2)%ss, & |
---|
| 928 | surf_usm_v(2)%ss, & |
---|
| 929 | surf_def_v(3)%ss, & |
---|
| 930 | surf_lsm_v(3)%ss, & |
---|
| 931 | surf_usm_v(3)%ss ) |
---|
| 932 | ELSE |
---|
| 933 | ! |
---|
| 934 | !-- Output of averaged data |
---|
| 935 | surfaces%var_out(:) = surfaces%var_av(:,n_out) / & |
---|
| 936 | REAL( average_count_surf, KIND=wp ) |
---|
| 937 | surfaces%var_av(:,n_out) = 0.0_wp |
---|
| 938 | |
---|
| 939 | ENDIF |
---|
| 940 | |
---|
| 941 | CASE ( 'qcs' ) |
---|
| 942 | ! |
---|
| 943 | !-- Output of instantaneous data |
---|
| 944 | IF ( av == 0 ) THEN |
---|
| 945 | CALL surface_output_collect( surf_def_h(0)%qcs, & |
---|
| 946 | surf_def_h(1)%qcs, & |
---|
| 947 | surf_lsm_h%qcs, & |
---|
| 948 | surf_usm_h%qcs, & |
---|
| 949 | surf_def_v(0)%qcs, & |
---|
| 950 | surf_lsm_v(0)%qcs, & |
---|
| 951 | surf_usm_v(0)%qcs, & |
---|
| 952 | surf_def_v(1)%qcs, & |
---|
| 953 | surf_lsm_v(1)%qcs, & |
---|
| 954 | surf_usm_v(1)%qcs, & |
---|
| 955 | surf_def_v(2)%qcs, & |
---|
| 956 | surf_lsm_v(2)%qcs, & |
---|
| 957 | surf_usm_v(2)%qcs, & |
---|
| 958 | surf_def_v(3)%qcs, & |
---|
| 959 | surf_lsm_v(3)%qcs, & |
---|
| 960 | surf_usm_v(3)%qcs ) |
---|
| 961 | ELSE |
---|
| 962 | ! |
---|
| 963 | !-- Output of averaged data |
---|
| 964 | surfaces%var_out(:) = surfaces%var_av(:,n_out) / & |
---|
| 965 | REAL( average_count_surf, KIND=wp ) |
---|
| 966 | surfaces%var_av(:,n_out) = 0.0_wp |
---|
| 967 | |
---|
| 968 | ENDIF |
---|
| 969 | |
---|
| 970 | CASE ( 'ncs' ) |
---|
| 971 | ! |
---|
| 972 | !-- Output of instantaneous data |
---|
| 973 | IF ( av == 0 ) THEN |
---|
| 974 | CALL surface_output_collect( surf_def_h(0)%ncs, & |
---|
| 975 | surf_def_h(1)%ncs, & |
---|
| 976 | surf_lsm_h%ncs, & |
---|
| 977 | surf_usm_h%ncs, & |
---|
| 978 | surf_def_v(0)%ncs, & |
---|
| 979 | surf_lsm_v(0)%ncs, & |
---|
| 980 | surf_usm_v(0)%ncs, & |
---|
| 981 | surf_def_v(1)%ncs, & |
---|
| 982 | surf_lsm_v(1)%ncs, & |
---|
| 983 | surf_usm_v(1)%ncs, & |
---|
| 984 | surf_def_v(2)%ncs, & |
---|
| 985 | surf_lsm_v(2)%ncs, & |
---|
| 986 | surf_usm_v(2)%ncs, & |
---|
| 987 | surf_def_v(3)%ncs, & |
---|
| 988 | surf_lsm_v(3)%ncs, & |
---|
| 989 | surf_usm_v(3)%ncs ) |
---|
| 990 | ELSE |
---|
| 991 | ! |
---|
| 992 | !-- Output of averaged data |
---|
| 993 | surfaces%var_out(:) = surfaces%var_av(:,n_out) / & |
---|
| 994 | REAL( average_count_surf, KIND=wp ) |
---|
| 995 | surfaces%var_av(:,n_out) = 0.0_wp |
---|
| 996 | |
---|
| 997 | ENDIF |
---|
| 998 | |
---|
| 999 | CASE ( 'qrs' ) |
---|
| 1000 | ! |
---|
| 1001 | !-- Output of instantaneous data |
---|
| 1002 | IF ( av == 0 ) THEN |
---|
| 1003 | CALL surface_output_collect( surf_def_h(0)%qrs, & |
---|
| 1004 | surf_def_h(1)%qrs, & |
---|
| 1005 | surf_lsm_h%qrs, & |
---|
| 1006 | surf_usm_h%qrs, & |
---|
| 1007 | surf_def_v(0)%qrs, & |
---|
| 1008 | surf_lsm_v(0)%qrs, & |
---|
| 1009 | surf_usm_v(0)%qrs, & |
---|
| 1010 | surf_def_v(1)%qrs, & |
---|
| 1011 | surf_lsm_v(1)%qrs, & |
---|
| 1012 | surf_usm_v(1)%qrs, & |
---|
| 1013 | surf_def_v(2)%qrs, & |
---|
| 1014 | surf_lsm_v(2)%qrs, & |
---|
| 1015 | surf_usm_v(2)%qrs, & |
---|
| 1016 | surf_def_v(3)%qrs, & |
---|
| 1017 | surf_lsm_v(3)%qrs, & |
---|
| 1018 | surf_usm_v(3)%qrs ) |
---|
| 1019 | ELSE |
---|
| 1020 | ! |
---|
| 1021 | !-- Output of averaged data |
---|
| 1022 | surfaces%var_out(:) = surfaces%var_av(:,n_out) / & |
---|
| 1023 | REAL( average_count_surf, KIND=wp ) |
---|
| 1024 | surfaces%var_av(:,n_out) = 0.0_wp |
---|
| 1025 | |
---|
| 1026 | ENDIF |
---|
| 1027 | |
---|
| 1028 | CASE ( 'nrs' ) |
---|
| 1029 | ! |
---|
| 1030 | !-- Output of instantaneous data |
---|
| 1031 | IF ( av == 0 ) THEN |
---|
| 1032 | CALL surface_output_collect( surf_def_h(0)%nrs, & |
---|
| 1033 | surf_def_h(1)%nrs, & |
---|
| 1034 | surf_lsm_h%nrs, & |
---|
| 1035 | surf_usm_h%nrs, & |
---|
| 1036 | surf_def_v(0)%nrs, & |
---|
| 1037 | surf_lsm_v(0)%nrs, & |
---|
| 1038 | surf_usm_v(0)%nrs, & |
---|
| 1039 | surf_def_v(1)%nrs, & |
---|
| 1040 | surf_lsm_v(1)%nrs, & |
---|
| 1041 | surf_usm_v(1)%nrs, & |
---|
| 1042 | surf_def_v(2)%nrs, & |
---|
| 1043 | surf_lsm_v(2)%nrs, & |
---|
| 1044 | surf_usm_v(2)%nrs, & |
---|
| 1045 | surf_def_v(3)%nrs, & |
---|
| 1046 | surf_lsm_v(3)%nrs, & |
---|
| 1047 | surf_usm_v(3)%nrs ) |
---|
| 1048 | ELSE |
---|
| 1049 | ! |
---|
| 1050 | !-- Output of averaged data |
---|
| 1051 | surfaces%var_out(:) = surfaces%var_av(:,n_out) / & |
---|
| 1052 | REAL( average_count_surf, KIND=wp ) |
---|
| 1053 | surfaces%var_av(:,n_out) = 0.0_wp |
---|
| 1054 | |
---|
| 1055 | ENDIF |
---|
| 1056 | |
---|
| 1057 | CASE ( 'ol' ) |
---|
| 1058 | ! |
---|
| 1059 | !-- Output of instantaneous data |
---|
| 1060 | IF ( av == 0 ) THEN |
---|
| 1061 | CALL surface_output_collect( surf_def_h(0)%ol, & |
---|
| 1062 | surf_def_h(1)%ol, & |
---|
| 1063 | surf_lsm_h%ol, & |
---|
| 1064 | surf_usm_h%ol, & |
---|
| 1065 | surf_def_v(0)%ol, & |
---|
| 1066 | surf_lsm_v(0)%ol, & |
---|
| 1067 | surf_usm_v(0)%ol, & |
---|
| 1068 | surf_def_v(1)%ol, & |
---|
| 1069 | surf_lsm_v(1)%ol, & |
---|
| 1070 | surf_usm_v(1)%ol, & |
---|
| 1071 | surf_def_v(2)%ol, & |
---|
| 1072 | surf_lsm_v(2)%ol, & |
---|
| 1073 | surf_usm_v(2)%ol, & |
---|
| 1074 | surf_def_v(3)%ol, & |
---|
| 1075 | surf_lsm_v(3)%ol, & |
---|
| 1076 | surf_usm_v(3)%ol ) |
---|
| 1077 | ELSE |
---|
| 1078 | ! |
---|
| 1079 | !-- Output of averaged data |
---|
| 1080 | surfaces%var_out(:) = surfaces%var_av(:,n_out) / & |
---|
| 1081 | REAL( average_count_surf, KIND=wp ) |
---|
| 1082 | surfaces%var_av(:,n_out) = 0.0_wp |
---|
| 1083 | |
---|
| 1084 | ENDIF |
---|
| 1085 | |
---|
| 1086 | CASE ( 'z0' ) |
---|
| 1087 | ! |
---|
| 1088 | !-- Output of instantaneous data |
---|
| 1089 | IF ( av == 0 ) THEN |
---|
| 1090 | CALL surface_output_collect( surf_def_h(0)%z0, & |
---|
| 1091 | surf_def_h(1)%z0, & |
---|
| 1092 | surf_lsm_h%z0, & |
---|
| 1093 | surf_usm_h%z0, & |
---|
| 1094 | surf_def_v(0)%z0, & |
---|
| 1095 | surf_lsm_v(0)%z0, & |
---|
| 1096 | surf_usm_v(0)%z0, & |
---|
| 1097 | surf_def_v(1)%z0, & |
---|
| 1098 | surf_lsm_v(1)%z0, & |
---|
| 1099 | surf_usm_v(1)%z0, & |
---|
| 1100 | surf_def_v(2)%z0, & |
---|
| 1101 | surf_lsm_v(2)%z0, & |
---|
| 1102 | surf_usm_v(2)%z0, & |
---|
| 1103 | surf_def_v(3)%z0, & |
---|
| 1104 | surf_lsm_v(3)%z0, & |
---|
| 1105 | surf_usm_v(3)%z0 ) |
---|
| 1106 | ELSE |
---|
| 1107 | ! |
---|
| 1108 | !-- Output of averaged data |
---|
| 1109 | surfaces%var_out(:) = surfaces%var_av(:,n_out) / & |
---|
| 1110 | REAL( average_count_surf, KIND=wp ) |
---|
| 1111 | surfaces%var_av(:,n_out) = 0.0_wp |
---|
| 1112 | |
---|
| 1113 | ENDIF |
---|
| 1114 | |
---|
| 1115 | CASE ( 'z0h' ) |
---|
| 1116 | ! |
---|
| 1117 | !-- Output of instantaneous data |
---|
| 1118 | IF ( av == 0 ) THEN |
---|
| 1119 | CALL surface_output_collect( surf_def_h(0)%z0h, & |
---|
| 1120 | surf_def_h(1)%z0h, & |
---|
| 1121 | surf_lsm_h%z0h, & |
---|
| 1122 | surf_usm_h%z0h, & |
---|
| 1123 | surf_def_v(0)%z0h, & |
---|
| 1124 | surf_lsm_v(0)%z0h, & |
---|
| 1125 | surf_usm_v(0)%z0h, & |
---|
| 1126 | surf_def_v(1)%z0h, & |
---|
| 1127 | surf_lsm_v(1)%z0h, & |
---|
| 1128 | surf_usm_v(1)%z0h, & |
---|
| 1129 | surf_def_v(2)%z0h, & |
---|
| 1130 | surf_lsm_v(2)%z0h, & |
---|
| 1131 | surf_usm_v(2)%z0h, & |
---|
| 1132 | surf_def_v(3)%z0h, & |
---|
| 1133 | surf_lsm_v(3)%z0h, & |
---|
| 1134 | surf_usm_v(3)%z0h ) |
---|
| 1135 | ELSE |
---|
| 1136 | ! |
---|
| 1137 | !-- Output of averaged data |
---|
| 1138 | surfaces%var_out(:) = surfaces%var_av(:,n_out) / & |
---|
| 1139 | REAL( average_count_surf, KIND=wp ) |
---|
| 1140 | surfaces%var_av(:,n_out) = 0.0_wp |
---|
| 1141 | |
---|
| 1142 | ENDIF |
---|
| 1143 | |
---|
| 1144 | CASE ( 'z0q' ) |
---|
| 1145 | ! |
---|
| 1146 | !-- Output of instantaneous data |
---|
| 1147 | IF ( av == 0 ) THEN |
---|
| 1148 | CALL surface_output_collect( surf_def_h(0)%z0q, & |
---|
| 1149 | surf_def_h(1)%z0q, & |
---|
| 1150 | surf_lsm_h%z0q, & |
---|
| 1151 | surf_usm_h%z0q, & |
---|
| 1152 | surf_def_v(0)%z0q, & |
---|
| 1153 | surf_lsm_v(0)%z0q, & |
---|
| 1154 | surf_usm_v(0)%z0q, & |
---|
| 1155 | surf_def_v(1)%z0q, & |
---|
| 1156 | surf_lsm_v(1)%z0q, & |
---|
| 1157 | surf_usm_v(1)%z0q, & |
---|
| 1158 | surf_def_v(2)%z0q, & |
---|
| 1159 | surf_lsm_v(2)%z0q, & |
---|
| 1160 | surf_usm_v(2)%z0q, & |
---|
| 1161 | surf_def_v(3)%z0q, & |
---|
| 1162 | surf_lsm_v(3)%z0q, & |
---|
| 1163 | surf_usm_v(3)%z0q ) |
---|
| 1164 | ELSE |
---|
| 1165 | ! |
---|
| 1166 | !-- Output of averaged data |
---|
| 1167 | surfaces%var_out(:) = surfaces%var_av(:,n_out) / & |
---|
| 1168 | REAL( average_count_surf, KIND=wp ) |
---|
| 1169 | surfaces%var_av(:,n_out) = 0.0_wp |
---|
| 1170 | |
---|
| 1171 | ENDIF |
---|
| 1172 | |
---|
| 1173 | CASE ( 'theta1' ) |
---|
| 1174 | ! |
---|
| 1175 | !-- Output of instantaneous data |
---|
| 1176 | IF ( av == 0 ) THEN |
---|
| 1177 | CALL surface_output_collect( surf_def_h(0)%pt1, & |
---|
| 1178 | surf_def_h(1)%pt1, & |
---|
| 1179 | surf_lsm_h%pt1, & |
---|
| 1180 | surf_usm_h%pt1, & |
---|
| 1181 | surf_def_v(0)%pt1, & |
---|
| 1182 | surf_lsm_v(0)%pt1, & |
---|
| 1183 | surf_usm_v(0)%pt1, & |
---|
| 1184 | surf_def_v(1)%pt1, & |
---|
| 1185 | surf_lsm_v(1)%pt1, & |
---|
| 1186 | surf_usm_v(1)%pt1, & |
---|
| 1187 | surf_def_v(2)%pt1, & |
---|
| 1188 | surf_lsm_v(2)%pt1, & |
---|
| 1189 | surf_usm_v(2)%pt1, & |
---|
| 1190 | surf_def_v(3)%pt1, & |
---|
| 1191 | surf_lsm_v(3)%pt1, & |
---|
| 1192 | surf_usm_v(3)%pt1 ) |
---|
| 1193 | ELSE |
---|
| 1194 | ! |
---|
| 1195 | !-- Output of averaged data |
---|
| 1196 | surfaces%var_out(:) = surfaces%var_av(:,n_out) / & |
---|
| 1197 | REAL( average_count_surf, KIND=wp ) |
---|
| 1198 | surfaces%var_av(:,n_out) = 0.0_wp |
---|
| 1199 | |
---|
| 1200 | ENDIF |
---|
| 1201 | |
---|
| 1202 | CASE ( 'qv1' ) |
---|
| 1203 | ! |
---|
| 1204 | !-- Output of instantaneous data |
---|
| 1205 | IF ( av == 0 ) THEN |
---|
| 1206 | CALL surface_output_collect( surf_def_h(0)%qv1, & |
---|
| 1207 | surf_def_h(1)%qv1, & |
---|
| 1208 | surf_lsm_h%qv1, & |
---|
| 1209 | surf_usm_h%qv1, & |
---|
| 1210 | surf_def_v(0)%qv1, & |
---|
| 1211 | surf_lsm_v(0)%qv1, & |
---|
| 1212 | surf_usm_v(0)%qv1, & |
---|
| 1213 | surf_def_v(1)%qv1, & |
---|
| 1214 | surf_lsm_v(1)%qv1, & |
---|
| 1215 | surf_usm_v(1)%qv1, & |
---|
| 1216 | surf_def_v(2)%qv1, & |
---|
| 1217 | surf_lsm_v(2)%qv1, & |
---|
| 1218 | surf_usm_v(2)%qv1, & |
---|
| 1219 | surf_def_v(3)%qv1, & |
---|
| 1220 | surf_lsm_v(3)%qv1, & |
---|
| 1221 | surf_usm_v(3)%qv1 ) |
---|
| 1222 | ELSE |
---|
| 1223 | ! |
---|
| 1224 | !-- Output of averaged data |
---|
| 1225 | surfaces%var_out(:) = surfaces%var_av(:,n_out) / & |
---|
| 1226 | REAL( average_count_surf, KIND=wp ) |
---|
| 1227 | surfaces%var_av(:,n_out) = 0.0_wp |
---|
| 1228 | |
---|
| 1229 | ENDIF |
---|
| 1230 | |
---|
| 1231 | CASE ( 'thetav1' ) |
---|
| 1232 | ! |
---|
| 1233 | !-- Output of instantaneous data |
---|
| 1234 | IF ( av == 0 ) THEN |
---|
| 1235 | CALL surface_output_collect( surf_def_h(0)%vpt1, & |
---|
| 1236 | surf_def_h(1)%vpt1, & |
---|
| 1237 | surf_lsm_h%vpt1, & |
---|
| 1238 | surf_usm_h%vpt1, & |
---|
| 1239 | surf_def_v(0)%vpt1, & |
---|
| 1240 | surf_lsm_v(0)%vpt1, & |
---|
| 1241 | surf_usm_v(0)%vpt1, & |
---|
| 1242 | surf_def_v(1)%vpt1, & |
---|
| 1243 | surf_lsm_v(1)%vpt1, & |
---|
| 1244 | surf_usm_v(1)%vpt1, & |
---|
| 1245 | surf_def_v(2)%vpt1, & |
---|
| 1246 | surf_lsm_v(2)%vpt1, & |
---|
| 1247 | surf_usm_v(2)%vpt1, & |
---|
| 1248 | surf_def_v(3)%vpt1, & |
---|
| 1249 | surf_lsm_v(3)%vpt1, & |
---|
| 1250 | surf_usm_v(3)%vpt1 ) |
---|
| 1251 | ELSE |
---|
| 1252 | ! |
---|
| 1253 | !-- Output of averaged data |
---|
| 1254 | surfaces%var_out(:) = surfaces%var_av(:,n_out) / & |
---|
| 1255 | REAL( average_count_surf, KIND=wp ) |
---|
| 1256 | surfaces%var_av(:,n_out) = 0.0_wp |
---|
| 1257 | |
---|
| 1258 | ENDIF |
---|
| 1259 | |
---|
| 1260 | CASE ( 'usws' ) |
---|
| 1261 | ! |
---|
| 1262 | !-- Output of instantaneous data |
---|
| 1263 | IF ( av == 0 ) THEN |
---|
| 1264 | CALL surface_output_collect( surf_def_h(0)%usws, & |
---|
| 1265 | surf_def_h(1)%usws, & |
---|
| 1266 | surf_lsm_h%usws, & |
---|
| 1267 | surf_usm_h%usws, & |
---|
| 1268 | surf_def_v(0)%usws, & |
---|
| 1269 | surf_lsm_v(0)%usws, & |
---|
| 1270 | surf_usm_v(0)%usws, & |
---|
| 1271 | surf_def_v(1)%usws, & |
---|
| 1272 | surf_lsm_v(1)%usws, & |
---|
| 1273 | surf_usm_v(1)%usws, & |
---|
| 1274 | surf_def_v(2)%usws, & |
---|
| 1275 | surf_lsm_v(2)%usws, & |
---|
| 1276 | surf_usm_v(2)%usws, & |
---|
| 1277 | surf_def_v(3)%usws, & |
---|
| 1278 | surf_lsm_v(3)%usws, & |
---|
| 1279 | surf_usm_v(3)%usws ) |
---|
| 1280 | ELSE |
---|
| 1281 | ! |
---|
| 1282 | !-- Output of averaged data |
---|
| 1283 | surfaces%var_out(:) = surfaces%var_av(:,n_out) / & |
---|
| 1284 | REAL( average_count_surf, KIND=wp ) |
---|
| 1285 | surfaces%var_av(:,n_out) = 0.0_wp |
---|
| 1286 | |
---|
| 1287 | ENDIF |
---|
| 1288 | |
---|
| 1289 | CASE ( 'vsws' ) |
---|
| 1290 | ! |
---|
| 1291 | !-- Output of instantaneous data |
---|
| 1292 | IF ( av == 0 ) THEN |
---|
| 1293 | CALL surface_output_collect( surf_def_h(0)%vsws, & |
---|
| 1294 | surf_def_h(1)%vsws, & |
---|
| 1295 | surf_lsm_h%vsws, & |
---|
| 1296 | surf_usm_h%vsws, & |
---|
| 1297 | surf_def_v(0)%vsws, & |
---|
| 1298 | surf_lsm_v(0)%vsws, & |
---|
| 1299 | surf_usm_v(0)%vsws, & |
---|
| 1300 | surf_def_v(1)%vsws, & |
---|
| 1301 | surf_lsm_v(1)%vsws, & |
---|
| 1302 | surf_usm_v(1)%vsws, & |
---|
| 1303 | surf_def_v(2)%vsws, & |
---|
| 1304 | surf_lsm_v(2)%vsws, & |
---|
| 1305 | surf_usm_v(2)%vsws, & |
---|
| 1306 | surf_def_v(3)%vsws, & |
---|
| 1307 | surf_lsm_v(3)%vsws, & |
---|
| 1308 | surf_usm_v(3)%vsws ) |
---|
| 1309 | ELSE |
---|
| 1310 | ! |
---|
| 1311 | !-- Output of averaged data |
---|
| 1312 | surfaces%var_out(:) = surfaces%var_av(:,n_out) / & |
---|
| 1313 | REAL( average_count_surf, KIND=wp ) |
---|
| 1314 | surfaces%var_av(:,n_out) = 0.0_wp |
---|
| 1315 | |
---|
| 1316 | ENDIF |
---|
| 1317 | |
---|
| 1318 | CASE ( 'shf' ) |
---|
| 1319 | ! |
---|
| 1320 | !-- Output of instantaneous data |
---|
| 1321 | IF ( av == 0 ) THEN |
---|
| 1322 | CALL surface_output_collect( surf_def_h(0)%shf, & |
---|
| 1323 | surf_def_h(1)%shf, & |
---|
| 1324 | surf_lsm_h%shf, & |
---|
| 1325 | surf_usm_h%shf, & |
---|
| 1326 | surf_def_v(0)%shf, & |
---|
| 1327 | surf_lsm_v(0)%shf, & |
---|
| 1328 | surf_usm_v(0)%shf, & |
---|
| 1329 | surf_def_v(1)%shf, & |
---|
| 1330 | surf_lsm_v(1)%shf, & |
---|
| 1331 | surf_usm_v(1)%shf, & |
---|
| 1332 | surf_def_v(2)%shf, & |
---|
| 1333 | surf_lsm_v(2)%shf, & |
---|
| 1334 | surf_usm_v(2)%shf, & |
---|
| 1335 | surf_def_v(3)%shf, & |
---|
| 1336 | surf_lsm_v(3)%shf, & |
---|
| 1337 | surf_usm_v(3)%shf ) |
---|
| 1338 | ELSE |
---|
| 1339 | ! |
---|
| 1340 | !-- Output of averaged data |
---|
| 1341 | surfaces%var_out(:) = surfaces%var_av(:,n_out) / & |
---|
| 1342 | REAL( average_count_surf, KIND=wp ) |
---|
| 1343 | surfaces%var_av(:,n_out) = 0.0_wp |
---|
| 1344 | ENDIF |
---|
| 1345 | |
---|
| 1346 | CASE ( 'qsws' ) |
---|
| 1347 | ! |
---|
| 1348 | !-- Output of instantaneous data |
---|
| 1349 | IF ( av == 0 ) THEN |
---|
| 1350 | CALL surface_output_collect( surf_def_h(0)%qsws, & |
---|
| 1351 | surf_def_h(1)%qsws, & |
---|
| 1352 | surf_lsm_h%qsws, & |
---|
| 1353 | surf_usm_h%qsws, & |
---|
| 1354 | surf_def_v(0)%qsws, & |
---|
| 1355 | surf_lsm_v(0)%qsws, & |
---|
| 1356 | surf_usm_v(0)%qsws, & |
---|
| 1357 | surf_def_v(1)%qsws, & |
---|
| 1358 | surf_lsm_v(1)%qsws, & |
---|
| 1359 | surf_usm_v(1)%qsws, & |
---|
| 1360 | surf_def_v(2)%qsws, & |
---|
| 1361 | surf_lsm_v(2)%qsws, & |
---|
| 1362 | surf_usm_v(2)%qsws, & |
---|
| 1363 | surf_def_v(3)%qsws, & |
---|
| 1364 | surf_lsm_v(3)%qsws, & |
---|
| 1365 | surf_usm_v(3)%qsws ) |
---|
| 1366 | ELSE |
---|
| 1367 | ! |
---|
| 1368 | !-- Output of averaged data |
---|
| 1369 | surfaces%var_out(:) = surfaces%var_av(:,n_out) / & |
---|
| 1370 | REAL( average_count_surf, KIND=wp ) |
---|
| 1371 | surfaces%var_av(:,n_out) = 0.0_wp |
---|
| 1372 | |
---|
| 1373 | ENDIF |
---|
| 1374 | |
---|
| 1375 | CASE ( 'ssws' ) |
---|
| 1376 | ! |
---|
| 1377 | !-- Output of instantaneous data |
---|
| 1378 | IF ( av == 0 ) THEN |
---|
| 1379 | CALL surface_output_collect( surf_def_h(0)%ssws, & |
---|
| 1380 | surf_def_h(1)%ssws, & |
---|
| 1381 | surf_lsm_h%ssws, & |
---|
| 1382 | surf_usm_h%ssws, & |
---|
| 1383 | surf_def_v(0)%ssws, & |
---|
| 1384 | surf_lsm_v(0)%ssws, & |
---|
| 1385 | surf_usm_v(0)%ssws, & |
---|
| 1386 | surf_def_v(1)%ssws, & |
---|
| 1387 | surf_lsm_v(1)%ssws, & |
---|
| 1388 | surf_usm_v(1)%ssws, & |
---|
| 1389 | surf_def_v(2)%ssws, & |
---|
| 1390 | surf_lsm_v(2)%ssws, & |
---|
| 1391 | surf_usm_v(2)%ssws, & |
---|
| 1392 | surf_def_v(3)%ssws, & |
---|
| 1393 | surf_lsm_v(3)%ssws, & |
---|
| 1394 | surf_usm_v(3)%ssws ) |
---|
| 1395 | ELSE |
---|
| 1396 | ! |
---|
| 1397 | !-- Output of averaged data |
---|
| 1398 | surfaces%var_out(:) = surfaces%var_av(:,n_out) / & |
---|
| 1399 | REAL( average_count_surf, KIND=wp ) |
---|
| 1400 | surfaces%var_av(:,n_out) = 0.0_wp |
---|
| 1401 | |
---|
| 1402 | ENDIF |
---|
| 1403 | |
---|
| 1404 | CASE ( 'qcsws' ) |
---|
| 1405 | ! |
---|
| 1406 | !-- Output of instantaneous data |
---|
| 1407 | IF ( av == 0 ) THEN |
---|
| 1408 | CALL surface_output_collect( surf_def_h(0)%qcsws, & |
---|
| 1409 | surf_def_h(1)%qcsws, & |
---|
| 1410 | surf_lsm_h%qcsws, & |
---|
| 1411 | surf_usm_h%qcsws, & |
---|
| 1412 | surf_def_v(0)%qcsws, & |
---|
| 1413 | surf_lsm_v(0)%qcsws, & |
---|
| 1414 | surf_usm_v(0)%qcsws, & |
---|
| 1415 | surf_def_v(1)%qcsws, & |
---|
| 1416 | surf_lsm_v(1)%qcsws, & |
---|
| 1417 | surf_usm_v(1)%qcsws, & |
---|
| 1418 | surf_def_v(2)%qcsws, & |
---|
| 1419 | surf_lsm_v(2)%qcsws, & |
---|
| 1420 | surf_usm_v(2)%qcsws, & |
---|
| 1421 | surf_def_v(3)%qcsws, & |
---|
| 1422 | surf_lsm_v(3)%qcsws, & |
---|
| 1423 | surf_usm_v(3)%qcsws ) |
---|
| 1424 | ELSE |
---|
| 1425 | ! |
---|
| 1426 | !-- Output of averaged data |
---|
| 1427 | surfaces%var_out(:) = surfaces%var_av(:,n_out) / & |
---|
| 1428 | REAL( average_count_surf, KIND=wp ) |
---|
| 1429 | surfaces%var_av(:,n_out) = 0.0_wp |
---|
| 1430 | |
---|
| 1431 | ENDIF |
---|
| 1432 | |
---|
| 1433 | CASE ( 'ncsws' ) |
---|
| 1434 | ! |
---|
| 1435 | !-- Output of instantaneous data |
---|
| 1436 | IF ( av == 0 ) THEN |
---|
| 1437 | CALL surface_output_collect( surf_def_h(0)%ncsws, & |
---|
| 1438 | surf_def_h(1)%ncsws, & |
---|
| 1439 | surf_lsm_h%ncsws, & |
---|
| 1440 | surf_usm_h%ncsws, & |
---|
| 1441 | surf_def_v(0)%ncsws, & |
---|
| 1442 | surf_lsm_v(0)%ncsws, & |
---|
| 1443 | surf_usm_v(0)%ncsws, & |
---|
| 1444 | surf_def_v(1)%ncsws, & |
---|
| 1445 | surf_lsm_v(1)%ncsws, & |
---|
| 1446 | surf_usm_v(1)%ncsws, & |
---|
| 1447 | surf_def_v(2)%ncsws, & |
---|
| 1448 | surf_lsm_v(2)%ncsws, & |
---|
| 1449 | surf_usm_v(2)%ncsws, & |
---|
| 1450 | surf_def_v(3)%ncsws, & |
---|
| 1451 | surf_lsm_v(3)%ncsws, & |
---|
| 1452 | surf_usm_v(3)%ncsws ) |
---|
| 1453 | ELSE |
---|
| 1454 | ! |
---|
| 1455 | !-- Output of averaged data |
---|
| 1456 | surfaces%var_out(:) = surfaces%var_av(:,n_out) / & |
---|
| 1457 | REAL( average_count_surf, KIND=wp ) |
---|
| 1458 | surfaces%var_av(:,n_out) = 0.0_wp |
---|
| 1459 | |
---|
| 1460 | ENDIF |
---|
| 1461 | |
---|
| 1462 | CASE ( 'qrsws' ) |
---|
| 1463 | ! |
---|
| 1464 | !-- Output of instantaneous data |
---|
| 1465 | IF ( av == 0 ) THEN |
---|
| 1466 | CALL surface_output_collect( surf_def_h(0)%qrsws, & |
---|
| 1467 | surf_def_h(1)%qrsws, & |
---|
| 1468 | surf_lsm_h%qrsws, & |
---|
| 1469 | surf_usm_h%qrsws, & |
---|
| 1470 | surf_def_v(0)%qrsws, & |
---|
| 1471 | surf_lsm_v(0)%qrsws, & |
---|
| 1472 | surf_usm_v(0)%qrsws, & |
---|
| 1473 | surf_def_v(1)%qrsws, & |
---|
| 1474 | surf_lsm_v(1)%qrsws, & |
---|
| 1475 | surf_usm_v(1)%qrsws, & |
---|
| 1476 | surf_def_v(2)%qrsws, & |
---|
| 1477 | surf_lsm_v(2)%qrsws, & |
---|
| 1478 | surf_usm_v(2)%qrsws, & |
---|
| 1479 | surf_def_v(3)%qrsws, & |
---|
| 1480 | surf_lsm_v(3)%qrsws, & |
---|
| 1481 | surf_usm_v(3)%qrsws ) |
---|
| 1482 | ELSE |
---|
| 1483 | ! |
---|
| 1484 | !-- Output of averaged data |
---|
| 1485 | surfaces%var_out(:) = surfaces%var_av(:,n_out) / & |
---|
| 1486 | REAL( average_count_surf, KIND=wp ) |
---|
| 1487 | surfaces%var_av(:,n_out) = 0.0_wp |
---|
| 1488 | |
---|
| 1489 | ENDIF |
---|
| 1490 | |
---|
| 1491 | CASE ( 'nrsws' ) |
---|
| 1492 | ! |
---|
| 1493 | !-- Output of instantaneous data |
---|
| 1494 | IF ( av == 0 ) THEN |
---|
| 1495 | CALL surface_output_collect( surf_def_h(0)%nrsws, & |
---|
| 1496 | surf_def_h(1)%nrsws, & |
---|
| 1497 | surf_lsm_h%nrsws, & |
---|
| 1498 | surf_usm_h%nrsws, & |
---|
| 1499 | surf_def_v(0)%nrsws, & |
---|
| 1500 | surf_lsm_v(0)%nrsws, & |
---|
| 1501 | surf_usm_v(0)%nrsws, & |
---|
| 1502 | surf_def_v(1)%nrsws, & |
---|
| 1503 | surf_lsm_v(1)%nrsws, & |
---|
| 1504 | surf_usm_v(1)%nrsws, & |
---|
| 1505 | surf_def_v(2)%nrsws, & |
---|
| 1506 | surf_lsm_v(2)%nrsws, & |
---|
| 1507 | surf_usm_v(2)%nrsws, & |
---|
| 1508 | surf_def_v(3)%nrsws, & |
---|
| 1509 | surf_lsm_v(3)%nrsws, & |
---|
| 1510 | surf_usm_v(3)%nrsws ) |
---|
| 1511 | ELSE |
---|
| 1512 | ! |
---|
| 1513 | !-- Output of averaged data |
---|
| 1514 | surfaces%var_out(:) = surfaces%var_av(:,n_out) / & |
---|
| 1515 | REAL( average_count_surf, KIND=wp ) |
---|
| 1516 | surfaces%var_av(:,n_out) = 0.0_wp |
---|
| 1517 | |
---|
| 1518 | ENDIF |
---|
| 1519 | |
---|
| 1520 | CASE ( 'sasws' ) |
---|
| 1521 | ! |
---|
| 1522 | !-- Output of instantaneous data |
---|
| 1523 | IF ( av == 0 ) THEN |
---|
| 1524 | CALL surface_output_collect( surf_def_h(0)%sasws, & |
---|
| 1525 | surf_def_h(1)%sasws, & |
---|
| 1526 | surf_lsm_h%sasws, & |
---|
| 1527 | surf_usm_h%sasws, & |
---|
| 1528 | surf_def_v(0)%sasws, & |
---|
| 1529 | surf_lsm_v(0)%sasws, & |
---|
| 1530 | surf_usm_v(0)%sasws, & |
---|
| 1531 | surf_def_v(1)%sasws, & |
---|
| 1532 | surf_lsm_v(1)%sasws, & |
---|
| 1533 | surf_usm_v(1)%sasws, & |
---|
| 1534 | surf_def_v(2)%sasws, & |
---|
| 1535 | surf_lsm_v(2)%sasws, & |
---|
| 1536 | surf_usm_v(2)%sasws, & |
---|
| 1537 | surf_def_v(3)%sasws, & |
---|
| 1538 | surf_lsm_v(3)%sasws, & |
---|
| 1539 | surf_usm_v(3)%sasws ) |
---|
| 1540 | ELSE |
---|
| 1541 | ! |
---|
| 1542 | !-- Output of averaged data |
---|
| 1543 | surfaces%var_out(:) = surfaces%var_av(:,n_out) / & |
---|
| 1544 | REAL( average_count_surf, KIND=wp ) |
---|
| 1545 | surfaces%var_av(:,n_out) = 0.0_wp |
---|
| 1546 | |
---|
| 1547 | ENDIF |
---|
| 1548 | |
---|
| 1549 | CASE ( 'q_surface' ) |
---|
| 1550 | ! |
---|
| 1551 | !-- Output of instantaneous data |
---|
| 1552 | IF ( av == 0 ) THEN |
---|
| 1553 | CALL surface_output_collect( surf_def_h(0)%q_surface, & |
---|
| 1554 | surf_def_h(1)%q_surface, & |
---|
| 1555 | surf_lsm_h%q_surface, & |
---|
| 1556 | surf_usm_h%q_surface, & |
---|
| 1557 | surf_def_v(0)%q_surface, & |
---|
| 1558 | surf_lsm_v(0)%q_surface, & |
---|
| 1559 | surf_usm_v(0)%q_surface, & |
---|
| 1560 | surf_def_v(1)%q_surface, & |
---|
| 1561 | surf_lsm_v(1)%q_surface, & |
---|
| 1562 | surf_usm_v(1)%q_surface, & |
---|
| 1563 | surf_def_v(2)%q_surface, & |
---|
| 1564 | surf_lsm_v(2)%q_surface, & |
---|
| 1565 | surf_usm_v(2)%q_surface, & |
---|
| 1566 | surf_def_v(3)%q_surface, & |
---|
| 1567 | surf_lsm_v(3)%q_surface, & |
---|
| 1568 | surf_usm_v(3)%q_surface ) |
---|
| 1569 | ELSE |
---|
| 1570 | ! |
---|
| 1571 | !-- Output of averaged data |
---|
| 1572 | surfaces%var_out(:) = surfaces%var_av(:,n_out) / & |
---|
| 1573 | REAL( average_count_surf, KIND=wp ) |
---|
| 1574 | surfaces%var_av(:,n_out) = 0.0_wp |
---|
| 1575 | |
---|
| 1576 | ENDIF |
---|
| 1577 | |
---|
| 1578 | CASE ( 'theta_surface' ) |
---|
| 1579 | ! |
---|
| 1580 | !-- Output of instantaneous data |
---|
| 1581 | IF ( av == 0 ) THEN |
---|
| 1582 | CALL surface_output_collect( surf_def_h(0)%pt_surface, & |
---|
| 1583 | surf_def_h(1)%pt_surface, & |
---|
| 1584 | surf_lsm_h%pt_surface, & |
---|
| 1585 | surf_usm_h%pt_surface, & |
---|
| 1586 | surf_def_v(0)%pt_surface, & |
---|
| 1587 | surf_lsm_v(0)%pt_surface, & |
---|
| 1588 | surf_usm_v(0)%pt_surface, & |
---|
| 1589 | surf_def_v(1)%pt_surface, & |
---|
| 1590 | surf_lsm_v(1)%pt_surface, & |
---|
| 1591 | surf_usm_v(1)%pt_surface, & |
---|
| 1592 | surf_def_v(2)%pt_surface, & |
---|
| 1593 | surf_lsm_v(2)%pt_surface, & |
---|
| 1594 | surf_usm_v(2)%pt_surface, & |
---|
| 1595 | surf_def_v(3)%pt_surface, & |
---|
| 1596 | surf_lsm_v(3)%pt_surface, & |
---|
| 1597 | surf_usm_v(3)%pt_surface ) |
---|
| 1598 | ELSE |
---|
| 1599 | ! |
---|
| 1600 | !-- Output of averaged data |
---|
| 1601 | surfaces%var_out(:) = surfaces%var_av(:,n_out) / & |
---|
| 1602 | REAL( average_count_surf, KIND=wp ) |
---|
| 1603 | surfaces%var_av(:,n_out) = 0.0_wp |
---|
| 1604 | |
---|
| 1605 | ENDIF |
---|
| 1606 | |
---|
| 1607 | CASE ( 'thetav_surface' ) |
---|
| 1608 | ! |
---|
| 1609 | !-- Output of instantaneous data |
---|
| 1610 | IF ( av == 0 ) THEN |
---|
| 1611 | CALL surface_output_collect( surf_def_h(0)%vpt_surface, & |
---|
| 1612 | surf_def_h(1)%vpt_surface, & |
---|
| 1613 | surf_lsm_h%vpt_surface, & |
---|
| 1614 | surf_usm_h%vpt_surface, & |
---|
| 1615 | surf_def_v(0)%vpt_surface, & |
---|
| 1616 | surf_lsm_v(0)%vpt_surface, & |
---|
| 1617 | surf_usm_v(0)%vpt_surface, & |
---|
| 1618 | surf_def_v(1)%vpt_surface, & |
---|
| 1619 | surf_lsm_v(1)%vpt_surface, & |
---|
| 1620 | surf_usm_v(1)%vpt_surface, & |
---|
| 1621 | surf_def_v(2)%vpt_surface, & |
---|
| 1622 | surf_lsm_v(2)%vpt_surface, & |
---|
| 1623 | surf_usm_v(2)%vpt_surface, & |
---|
| 1624 | surf_def_v(3)%vpt_surface, & |
---|
| 1625 | surf_lsm_v(3)%vpt_surface, & |
---|
| 1626 | surf_usm_v(3)%vpt_surface) |
---|
| 1627 | ELSE |
---|
| 1628 | ! |
---|
| 1629 | !-- Output of averaged data |
---|
| 1630 | surfaces%var_out(:) = surfaces%var_av(:,n_out) / & |
---|
| 1631 | REAL( average_count_surf, KIND=wp ) |
---|
| 1632 | surfaces%var_av(:,n_out) = 0.0_wp |
---|
| 1633 | |
---|
| 1634 | ENDIF |
---|
| 1635 | |
---|
| 1636 | CASE ( 'rad_net' ) |
---|
| 1637 | ! |
---|
| 1638 | !-- Output of instantaneous data |
---|
| 1639 | IF ( av == 0 ) THEN |
---|
| 1640 | CALL surface_output_collect( surf_def_h(0)%rad_net, & |
---|
| 1641 | surf_def_h(1)%rad_net, & |
---|
| 1642 | surf_lsm_h%rad_net, & |
---|
| 1643 | surf_usm_h%rad_net, & |
---|
| 1644 | surf_def_v(0)%rad_net, & |
---|
| 1645 | surf_lsm_v(0)%rad_net, & |
---|
| 1646 | surf_usm_v(0)%rad_net, & |
---|
| 1647 | surf_def_v(1)%rad_net, & |
---|
| 1648 | surf_lsm_v(1)%rad_net, & |
---|
| 1649 | surf_usm_v(1)%rad_net, & |
---|
| 1650 | surf_def_v(2)%rad_net, & |
---|
| 1651 | surf_lsm_v(2)%rad_net, & |
---|
| 1652 | surf_usm_v(2)%rad_net, & |
---|
| 1653 | surf_def_v(3)%rad_net, & |
---|
| 1654 | surf_lsm_v(3)%rad_net, & |
---|
| 1655 | surf_usm_v(3)%rad_net ) |
---|
| 1656 | ELSE |
---|
| 1657 | ! |
---|
| 1658 | !-- Output of averaged data |
---|
| 1659 | surfaces%var_out(:) = surfaces%var_av(:,n_out) / & |
---|
| 1660 | REAL( average_count_surf, KIND=wp ) |
---|
| 1661 | surfaces%var_av(:,n_out) = 0.0_wp |
---|
| 1662 | |
---|
| 1663 | ENDIF |
---|
| 1664 | |
---|
| 1665 | CASE ( 'rad_lw_in' ) |
---|
| 1666 | ! |
---|
| 1667 | !-- Output of instantaneous data |
---|
| 1668 | IF ( av == 0 ) THEN |
---|
| 1669 | CALL surface_output_collect( surf_def_h(0)%rad_lw_in, & |
---|
| 1670 | surf_def_h(1)%rad_lw_in, & |
---|
| 1671 | surf_lsm_h%rad_lw_in, & |
---|
| 1672 | surf_usm_h%rad_lw_in, & |
---|
| 1673 | surf_def_v(0)%rad_lw_in, & |
---|
| 1674 | surf_lsm_v(0)%rad_lw_in, & |
---|
| 1675 | surf_usm_v(0)%rad_lw_in, & |
---|
| 1676 | surf_def_v(1)%rad_lw_in, & |
---|
| 1677 | surf_lsm_v(1)%rad_lw_in, & |
---|
| 1678 | surf_usm_v(1)%rad_lw_in, & |
---|
| 1679 | surf_def_v(2)%rad_lw_in, & |
---|
| 1680 | surf_lsm_v(2)%rad_lw_in, & |
---|
| 1681 | surf_usm_v(2)%rad_lw_in, & |
---|
| 1682 | surf_def_v(3)%rad_lw_in, & |
---|
| 1683 | surf_lsm_v(3)%rad_lw_in, & |
---|
| 1684 | surf_usm_v(3)%rad_lw_in ) |
---|
| 1685 | ELSE |
---|
| 1686 | ! |
---|
| 1687 | !-- Output of averaged data |
---|
| 1688 | surfaces%var_out(:) = surfaces%var_av(:,n_out) / & |
---|
| 1689 | REAL( average_count_surf, KIND=wp ) |
---|
| 1690 | surfaces%var_av(:,n_out) = 0.0_wp |
---|
| 1691 | |
---|
| 1692 | ENDIF |
---|
| 1693 | |
---|
| 1694 | CASE ( 'rad_lw_out' ) |
---|
| 1695 | ! |
---|
| 1696 | !-- Output of instantaneous data |
---|
| 1697 | IF ( av == 0 ) THEN |
---|
| 1698 | CALL surface_output_collect( surf_def_h(0)%rad_lw_out, & |
---|
| 1699 | surf_def_h(1)%rad_lw_out, & |
---|
| 1700 | surf_lsm_h%rad_lw_out, & |
---|
| 1701 | surf_usm_h%rad_lw_out, & |
---|
| 1702 | surf_def_v(0)%rad_lw_out, & |
---|
| 1703 | surf_lsm_v(0)%rad_lw_out, & |
---|
| 1704 | surf_usm_v(0)%rad_lw_out, & |
---|
| 1705 | surf_def_v(1)%rad_lw_out, & |
---|
| 1706 | surf_lsm_v(1)%rad_lw_out, & |
---|
| 1707 | surf_usm_v(1)%rad_lw_out, & |
---|
| 1708 | surf_def_v(2)%rad_lw_out, & |
---|
| 1709 | surf_lsm_v(2)%rad_lw_out, & |
---|
| 1710 | surf_usm_v(2)%rad_lw_out, & |
---|
| 1711 | surf_def_v(3)%rad_lw_out, & |
---|
| 1712 | surf_lsm_v(3)%rad_lw_out, & |
---|
| 1713 | surf_usm_v(3)%rad_lw_out ) |
---|
| 1714 | ELSE |
---|
| 1715 | ! |
---|
| 1716 | !-- Output of averaged data |
---|
| 1717 | surfaces%var_out(:) = surfaces%var_av(:,n_out) / & |
---|
| 1718 | REAL( average_count_surf, KIND=wp ) |
---|
| 1719 | surfaces%var_av(:,n_out) = 0.0_wp |
---|
| 1720 | |
---|
| 1721 | ENDIF |
---|
| 1722 | |
---|
| 1723 | CASE ( 'rad_sw_in' ) |
---|
| 1724 | ! |
---|
| 1725 | !-- Output of instantaneous data |
---|
| 1726 | IF ( av == 0 ) THEN |
---|
| 1727 | CALL surface_output_collect( surf_def_h(0)%rad_sw_in, & |
---|
| 1728 | surf_def_h(1)%rad_sw_in, & |
---|
| 1729 | surf_lsm_h%rad_sw_in, & |
---|
| 1730 | surf_usm_h%rad_sw_in, & |
---|
| 1731 | surf_def_v(0)%rad_sw_in, & |
---|
| 1732 | surf_lsm_v(0)%rad_sw_in, & |
---|
| 1733 | surf_usm_v(0)%rad_sw_in, & |
---|
| 1734 | surf_def_v(1)%rad_sw_in, & |
---|
| 1735 | surf_lsm_v(1)%rad_sw_in, & |
---|
| 1736 | surf_usm_v(1)%rad_sw_in, & |
---|
| 1737 | surf_def_v(2)%rad_sw_in, & |
---|
| 1738 | surf_lsm_v(2)%rad_sw_in, & |
---|
| 1739 | surf_usm_v(2)%rad_sw_in, & |
---|
| 1740 | surf_def_v(3)%rad_sw_in, & |
---|
| 1741 | surf_lsm_v(3)%rad_sw_in, & |
---|
| 1742 | surf_usm_v(3)%rad_sw_in ) |
---|
| 1743 | ELSE |
---|
| 1744 | ! |
---|
| 1745 | !-- Output of averaged data |
---|
| 1746 | surfaces%var_out(:) = surfaces%var_av(:,n_out) / & |
---|
| 1747 | REAL( average_count_surf, KIND=wp ) |
---|
| 1748 | surfaces%var_av(:,n_out) = 0.0_wp |
---|
| 1749 | |
---|
| 1750 | ENDIF |
---|
| 1751 | |
---|
| 1752 | CASE ( 'rad_sw_out' ) |
---|
| 1753 | ! |
---|
| 1754 | !-- Output of instantaneous data |
---|
| 1755 | IF ( av == 0 ) THEN |
---|
| 1756 | CALL surface_output_collect( surf_def_h(0)%rad_sw_out, & |
---|
| 1757 | surf_def_h(1)%rad_sw_out, & |
---|
| 1758 | surf_lsm_h%rad_sw_out, & |
---|
| 1759 | surf_usm_h%rad_sw_out, & |
---|
| 1760 | surf_def_v(0)%rad_sw_out, & |
---|
| 1761 | surf_lsm_v(0)%rad_sw_out, & |
---|
| 1762 | surf_usm_v(0)%rad_sw_out, & |
---|
| 1763 | surf_def_v(1)%rad_sw_out, & |
---|
| 1764 | surf_lsm_v(1)%rad_sw_out, & |
---|
| 1765 | surf_usm_v(1)%rad_sw_out, & |
---|
| 1766 | surf_def_v(2)%rad_sw_out, & |
---|
| 1767 | surf_lsm_v(2)%rad_sw_out, & |
---|
| 1768 | surf_usm_v(2)%rad_sw_out, & |
---|
| 1769 | surf_def_v(3)%rad_sw_out, & |
---|
| 1770 | surf_lsm_v(3)%rad_sw_out, & |
---|
| 1771 | surf_usm_v(3)%rad_sw_out ) |
---|
| 1772 | ELSE |
---|
| 1773 | ! |
---|
| 1774 | !-- Output of averaged data |
---|
| 1775 | surfaces%var_out(:) = surfaces%var_av(:,n_out) / & |
---|
| 1776 | REAL( average_count_surf, KIND=wp ) |
---|
| 1777 | surfaces%var_av(:,n_out) = 0.0_wp |
---|
| 1778 | |
---|
| 1779 | ENDIF |
---|
| 1780 | |
---|
| 1781 | CASE ( 'ghf' ) |
---|
| 1782 | ! |
---|
| 1783 | !-- Output of instantaneous data |
---|
| 1784 | IF ( av == 0 ) THEN |
---|
| 1785 | CALL surface_output_collect( surf_def_h(0)%ghf, & |
---|
| 1786 | surf_def_h(1)%ghf, & |
---|
| 1787 | surf_lsm_h%ghf, & |
---|
| 1788 | surf_usm_h%ghf, & |
---|
| 1789 | surf_def_v(0)%ghf, & |
---|
| 1790 | surf_lsm_v(0)%ghf, & |
---|
| 1791 | surf_usm_v(0)%ghf, & |
---|
| 1792 | surf_def_v(1)%ghf, & |
---|
| 1793 | surf_lsm_v(1)%ghf, & |
---|
| 1794 | surf_usm_v(1)%ghf, & |
---|
| 1795 | surf_def_v(2)%ghf, & |
---|
| 1796 | surf_lsm_v(2)%ghf, & |
---|
| 1797 | surf_usm_v(2)%ghf, & |
---|
| 1798 | surf_def_v(3)%ghf, & |
---|
| 1799 | surf_lsm_v(3)%ghf, & |
---|
| 1800 | surf_usm_v(3)%ghf ) |
---|
| 1801 | ELSE |
---|
| 1802 | ! |
---|
| 1803 | !-- Output of averaged data |
---|
| 1804 | surfaces%var_out(:) = surfaces%var_av(:,n_out) / & |
---|
| 1805 | REAL( average_count_surf, KIND=wp ) |
---|
| 1806 | surfaces%var_av(:,n_out) = 0.0_wp |
---|
| 1807 | |
---|
| 1808 | ENDIF |
---|
| 1809 | |
---|
| 1810 | CASE ( 'r_a' ) |
---|
| 1811 | ! |
---|
| 1812 | !-- Output of instantaneous data |
---|
| 1813 | IF ( av == 0 ) THEN |
---|
| 1814 | CALL surface_output_collect( surf_def_h(0)%r_a, & |
---|
| 1815 | surf_def_h(1)%r_a, & |
---|
| 1816 | surf_lsm_h%r_a, & |
---|
| 1817 | surf_usm_h%r_a, & |
---|
| 1818 | surf_def_v(0)%r_a, & |
---|
| 1819 | surf_lsm_v(0)%r_a, & |
---|
| 1820 | surf_usm_v(0)%r_a, & |
---|
| 1821 | surf_def_v(1)%r_a, & |
---|
| 1822 | surf_lsm_v(1)%r_a, & |
---|
| 1823 | surf_usm_v(1)%r_a, & |
---|
| 1824 | surf_def_v(2)%r_a, & |
---|
| 1825 | surf_lsm_v(2)%r_a, & |
---|
| 1826 | surf_usm_v(2)%r_a, & |
---|
| 1827 | surf_def_v(3)%r_a, & |
---|
| 1828 | surf_lsm_v(3)%r_a, & |
---|
| 1829 | surf_usm_v(3)%r_a ) |
---|
| 1830 | ELSE |
---|
| 1831 | ! |
---|
| 1832 | !-- Output of averaged data |
---|
| 1833 | surfaces%var_out(:) = surfaces%var_av(:,n_out) / & |
---|
| 1834 | REAL( average_count_surf, KIND=wp ) |
---|
| 1835 | surfaces%var_av(:,n_out) = 0.0_wp |
---|
| 1836 | |
---|
| 1837 | ENDIF |
---|
| 1838 | |
---|
| 1839 | CASE ( 'r_soil' ) |
---|
| 1840 | ! |
---|
| 1841 | !-- Output of instantaneous data |
---|
| 1842 | IF ( av == 0 ) THEN |
---|
| 1843 | CALL surface_output_collect( surf_def_h(0)%r_soil, & |
---|
| 1844 | surf_def_h(1)%r_soil, & |
---|
| 1845 | surf_lsm_h%r_soil, & |
---|
| 1846 | surf_usm_h%r_soil, & |
---|
| 1847 | surf_def_v(0)%r_soil, & |
---|
| 1848 | surf_lsm_v(0)%r_soil, & |
---|
| 1849 | surf_usm_v(0)%r_soil, & |
---|
| 1850 | surf_def_v(1)%r_soil, & |
---|
| 1851 | surf_lsm_v(1)%r_soil, & |
---|
| 1852 | surf_usm_v(1)%r_soil, & |
---|
| 1853 | surf_def_v(2)%r_soil, & |
---|
| 1854 | surf_lsm_v(2)%r_soil, & |
---|
| 1855 | surf_usm_v(2)%r_soil, & |
---|
| 1856 | surf_def_v(3)%r_soil, & |
---|
| 1857 | surf_lsm_v(3)%r_soil, & |
---|
| 1858 | surf_usm_v(3)%r_soil ) |
---|
| 1859 | ELSE |
---|
| 1860 | ! |
---|
| 1861 | !-- Output of averaged data |
---|
| 1862 | surfaces%var_out(:) = surfaces%var_av(:,n_out) / & |
---|
| 1863 | REAL( average_count_surf, KIND=wp ) |
---|
| 1864 | surfaces%var_av(:,n_out) = 0.0_wp |
---|
| 1865 | |
---|
| 1866 | ENDIF |
---|
| 1867 | |
---|
| 1868 | CASE ( 'r_canopy' ) |
---|
| 1869 | ! |
---|
| 1870 | !-- Output of instantaneous data |
---|
| 1871 | IF ( av == 0 ) THEN |
---|
| 1872 | CALL surface_output_collect( surf_def_h(0)%r_canopy, & |
---|
| 1873 | surf_def_h(1)%r_canopy, & |
---|
| 1874 | surf_lsm_h%r_canopy, & |
---|
| 1875 | surf_usm_h%r_canopy, & |
---|
| 1876 | surf_def_v(0)%r_canopy, & |
---|
| 1877 | surf_lsm_v(0)%r_canopy, & |
---|
| 1878 | surf_usm_v(0)%r_canopy, & |
---|
| 1879 | surf_def_v(1)%r_canopy, & |
---|
| 1880 | surf_lsm_v(1)%r_canopy, & |
---|
| 1881 | surf_usm_v(1)%r_canopy, & |
---|
| 1882 | surf_def_v(2)%r_canopy, & |
---|
| 1883 | surf_lsm_v(2)%r_canopy, & |
---|
| 1884 | surf_usm_v(2)%r_canopy, & |
---|
| 1885 | surf_def_v(3)%r_canopy, & |
---|
| 1886 | surf_lsm_v(3)%r_canopy, & |
---|
| 1887 | surf_usm_v(3)%r_canopy ) |
---|
| 1888 | ELSE |
---|
| 1889 | ! |
---|
| 1890 | !-- Output of averaged data |
---|
| 1891 | surfaces%var_out(:) = surfaces%var_av(:,n_out) / & |
---|
| 1892 | REAL( average_count_surf, KIND=wp ) |
---|
| 1893 | surfaces%var_av(:,n_out) = 0.0_wp |
---|
| 1894 | |
---|
| 1895 | ENDIF |
---|
| 1896 | |
---|
| 1897 | CASE ( 'r_s' ) |
---|
| 1898 | ! |
---|
| 1899 | !-- Output of instantaneous data |
---|
| 1900 | IF ( av == 0 ) THEN |
---|
| 1901 | CALL surface_output_collect( surf_def_h(0)%r_s, & |
---|
| 1902 | surf_def_h(1)%r_s, & |
---|
| 1903 | surf_lsm_h%r_s, & |
---|
| 1904 | surf_usm_h%r_s, & |
---|
| 1905 | surf_def_v(0)%r_s, & |
---|
| 1906 | surf_lsm_v(0)%r_s, & |
---|
| 1907 | surf_usm_v(0)%r_s, & |
---|
| 1908 | surf_def_v(1)%r_s, & |
---|
| 1909 | surf_lsm_v(1)%r_s, & |
---|
| 1910 | surf_usm_v(1)%r_s, & |
---|
| 1911 | surf_def_v(2)%r_s, & |
---|
| 1912 | surf_lsm_v(2)%r_s, & |
---|
| 1913 | surf_usm_v(2)%r_s, & |
---|
| 1914 | surf_def_v(3)%r_s, & |
---|
| 1915 | surf_lsm_v(3)%r_s, & |
---|
| 1916 | surf_usm_v(3)%r_s ) |
---|
| 1917 | ELSE |
---|
| 1918 | ! |
---|
| 1919 | !-- Output of averaged data |
---|
| 1920 | surfaces%var_out(:) = surfaces%var_av(:,n_out) / & |
---|
| 1921 | REAL( average_count_surf, KIND=wp ) |
---|
| 1922 | surfaces%var_av(:,n_out) = 0.0_wp |
---|
| 1923 | |
---|
| 1924 | ENDIF |
---|
| 1925 | |
---|
| 1926 | ! |
---|
| 1927 | !-- Add further variables: |
---|
| 1928 | !-- 'css', 'cssws', 'qsws_liq', 'qsws_soil', 'qsws_veg' |
---|
| 1929 | |
---|
| 1930 | END SELECT |
---|
| 1931 | ! |
---|
| 1932 | !-- Write to binary file: |
---|
| 1933 | !-- - surfaces%points ( 3, 1-npoints ) |
---|
| 1934 | !-- - surfaces%polygons ( 5, 1-ns ) |
---|
| 1935 | !-- - surfaces%var_out ( 1-ns, time ) |
---|
| 1936 | !-- - Dimension: 1-nsurfaces, 1-npoints - can be ordered consecutively |
---|
| 1937 | !-- - Distinguish between average and non-average data |
---|
| 1938 | DO i = 0, io_blocks-1 |
---|
| 1939 | IF ( i == io_group ) THEN |
---|
| 1940 | WRITE ( 25+av ) trimvar |
---|
| 1941 | WRITE ( 25+av ) surfaces%var_out |
---|
| 1942 | ENDIF |
---|
| 1943 | CALL MPI_BARRIER( comm2d, ierr ) |
---|
| 1944 | ENDDO |
---|
| 1945 | |
---|
| 1946 | ENDDO |
---|
| 1947 | |
---|
| 1948 | ! |
---|
| 1949 | !-- If averaged output was written to NetCDF file, set the counter to zero |
---|
| 1950 | IF ( av == 1 ) average_count_surf = 0 |
---|
| 1951 | |
---|
| 1952 | END SUBROUTINE surface_output |
---|
| 1953 | |
---|
| 1954 | !------------------------------------------------------------------------------! |
---|
| 1955 | ! Description: |
---|
| 1956 | ! ------------ |
---|
| 1957 | !> Routine for controlling the data averaging. |
---|
| 1958 | !------------------------------------------------------------------------------! |
---|
| 1959 | SUBROUTINE surface_output_averaging |
---|
| 1960 | |
---|
| 1961 | IMPLICIT NONE |
---|
| 1962 | |
---|
| 1963 | CHARACTER(LEN=100) :: trimvar !< dummy variable for current output variable |
---|
| 1964 | |
---|
| 1965 | INTEGER(iwp) :: l !< running index for surface-element orientation |
---|
| 1966 | INTEGER(iwp) :: m !< running index for surface elements |
---|
| 1967 | INTEGER(iwp) :: n_out !< counter variables for surface output |
---|
| 1968 | |
---|
| 1969 | n_out = 0 |
---|
| 1970 | DO WHILE ( dosurf(1,n_out+1)(1:1) /= ' ' ) |
---|
| 1971 | |
---|
| 1972 | n_out = n_out + 1 |
---|
| 1973 | trimvar = TRIM( dosurf(1,n_out) ) |
---|
| 1974 | |
---|
| 1975 | SELECT CASE ( trimvar ) |
---|
| 1976 | |
---|
| 1977 | CASE ( 'us' ) |
---|
| 1978 | CALL surface_output_sum_up( surf_def_h(0)%us, & |
---|
| 1979 | surf_def_h(1)%us, & |
---|
| 1980 | surf_lsm_h%us, & |
---|
| 1981 | surf_usm_h%us, & |
---|
| 1982 | surf_def_v(0)%us, & |
---|
| 1983 | surf_lsm_v(0)%us, & |
---|
| 1984 | surf_usm_v(0)%us, & |
---|
| 1985 | surf_def_v(1)%us, & |
---|
| 1986 | surf_lsm_v(1)%us, & |
---|
| 1987 | surf_usm_v(1)%us, & |
---|
| 1988 | surf_def_v(2)%us, & |
---|
| 1989 | surf_lsm_v(2)%us, & |
---|
| 1990 | surf_usm_v(2)%us, & |
---|
| 1991 | surf_def_v(3)%us, & |
---|
| 1992 | surf_lsm_v(3)%us, & |
---|
| 1993 | surf_usm_v(3)%us, n_out ) |
---|
| 1994 | |
---|
| 1995 | CASE ( 'ts' ) |
---|
| 1996 | CALL surface_output_sum_up( surf_def_h(0)%ts, & |
---|
| 1997 | surf_def_h(1)%ts, & |
---|
| 1998 | surf_lsm_h%ts, & |
---|
| 1999 | surf_usm_h%ts, & |
---|
| 2000 | surf_def_v(0)%ts, & |
---|
| 2001 | surf_lsm_v(0)%ts, & |
---|
| 2002 | surf_usm_v(0)%ts, & |
---|
| 2003 | surf_def_v(1)%ts, & |
---|
| 2004 | surf_lsm_v(1)%ts, & |
---|
| 2005 | surf_usm_v(1)%ts, & |
---|
| 2006 | surf_def_v(2)%ts, & |
---|
| 2007 | surf_lsm_v(2)%ts, & |
---|
| 2008 | surf_usm_v(2)%ts, & |
---|
| 2009 | surf_def_v(3)%ts, & |
---|
| 2010 | surf_lsm_v(3)%ts, & |
---|
| 2011 | surf_usm_v(3)%ts, n_out ) |
---|
| 2012 | |
---|
| 2013 | CASE ( 'qs' ) |
---|
| 2014 | CALL surface_output_sum_up( surf_def_h(0)%qs, & |
---|
| 2015 | surf_def_h(1)%qs, & |
---|
| 2016 | surf_lsm_h%qs, & |
---|
| 2017 | surf_usm_h%qs, & |
---|
| 2018 | surf_def_v(0)%qs, & |
---|
| 2019 | surf_lsm_v(0)%qs, & |
---|
| 2020 | surf_usm_v(0)%qs, & |
---|
| 2021 | surf_def_v(1)%qs, & |
---|
| 2022 | surf_lsm_v(1)%qs, & |
---|
| 2023 | surf_usm_v(1)%qs, & |
---|
| 2024 | surf_def_v(2)%qs, & |
---|
| 2025 | surf_lsm_v(2)%qs, & |
---|
| 2026 | surf_usm_v(2)%qs, & |
---|
| 2027 | surf_def_v(3)%qs, & |
---|
| 2028 | surf_lsm_v(3)%qs, & |
---|
| 2029 | surf_usm_v(3)%qs, n_out ) |
---|
| 2030 | |
---|
| 2031 | CASE ( 'ss' ) |
---|
| 2032 | CALL surface_output_sum_up( surf_def_h(0)%ss, & |
---|
| 2033 | surf_def_h(1)%ss, & |
---|
| 2034 | surf_lsm_h%ss, & |
---|
| 2035 | surf_usm_h%ss, & |
---|
| 2036 | surf_def_v(0)%ss, & |
---|
| 2037 | surf_lsm_v(0)%ss, & |
---|
| 2038 | surf_usm_v(0)%ss, & |
---|
| 2039 | surf_def_v(1)%ss, & |
---|
| 2040 | surf_lsm_v(1)%ss, & |
---|
| 2041 | surf_usm_v(1)%ss, & |
---|
| 2042 | surf_def_v(2)%ss, & |
---|
| 2043 | surf_lsm_v(2)%ss, & |
---|
| 2044 | surf_usm_v(2)%ss, & |
---|
| 2045 | surf_def_v(3)%ss, & |
---|
| 2046 | surf_lsm_v(3)%ss, & |
---|
| 2047 | surf_usm_v(3)%ss, n_out ) |
---|
| 2048 | |
---|
| 2049 | CASE ( 'qcs' ) |
---|
| 2050 | CALL surface_output_sum_up( surf_def_h(0)%qcs, & |
---|
| 2051 | surf_def_h(1)%qcs, & |
---|
| 2052 | surf_lsm_h%qcs, & |
---|
| 2053 | surf_usm_h%qcs, & |
---|
| 2054 | surf_def_v(0)%qcs, & |
---|
| 2055 | surf_lsm_v(0)%qcs, & |
---|
| 2056 | surf_usm_v(0)%qcs, & |
---|
| 2057 | surf_def_v(1)%qcs, & |
---|
| 2058 | surf_lsm_v(1)%qcs, & |
---|
| 2059 | surf_usm_v(1)%qcs, & |
---|
| 2060 | surf_def_v(2)%qcs, & |
---|
| 2061 | surf_lsm_v(2)%qcs, & |
---|
| 2062 | surf_usm_v(2)%qcs, & |
---|
| 2063 | surf_def_v(3)%qcs, & |
---|
| 2064 | surf_lsm_v(3)%qcs, & |
---|
| 2065 | surf_usm_v(3)%qcs, n_out ) |
---|
| 2066 | |
---|
| 2067 | CASE ( 'ncs' ) |
---|
| 2068 | CALL surface_output_sum_up( surf_def_h(0)%ncs, & |
---|
| 2069 | surf_def_h(1)%ncs, & |
---|
| 2070 | surf_lsm_h%ncs, & |
---|
| 2071 | surf_usm_h%ncs, & |
---|
| 2072 | surf_def_v(0)%ncs, & |
---|
| 2073 | surf_lsm_v(0)%ncs, & |
---|
| 2074 | surf_usm_v(0)%ncs, & |
---|
| 2075 | surf_def_v(1)%ncs, & |
---|
| 2076 | surf_lsm_v(1)%ncs, & |
---|
| 2077 | surf_usm_v(1)%ncs, & |
---|
| 2078 | surf_def_v(2)%ncs, & |
---|
| 2079 | surf_lsm_v(2)%ncs, & |
---|
| 2080 | surf_usm_v(2)%ncs, & |
---|
| 2081 | surf_def_v(3)%ncs, & |
---|
| 2082 | surf_lsm_v(3)%ncs, & |
---|
| 2083 | surf_usm_v(3)%ncs, n_out ) |
---|
| 2084 | |
---|
| 2085 | CASE ( 'qrs' ) |
---|
| 2086 | CALL surface_output_sum_up( surf_def_h(0)%qrs, & |
---|
| 2087 | surf_def_h(1)%qrs, & |
---|
| 2088 | surf_lsm_h%qrs, & |
---|
| 2089 | surf_usm_h%qrs, & |
---|
| 2090 | surf_def_v(0)%qrs, & |
---|
| 2091 | surf_lsm_v(0)%qrs, & |
---|
| 2092 | surf_usm_v(0)%qrs, & |
---|
| 2093 | surf_def_v(1)%qrs, & |
---|
| 2094 | surf_lsm_v(1)%qrs, & |
---|
| 2095 | surf_usm_v(1)%qrs, & |
---|
| 2096 | surf_def_v(2)%qrs, & |
---|
| 2097 | surf_lsm_v(2)%qrs, & |
---|
| 2098 | surf_usm_v(2)%qrs, & |
---|
| 2099 | surf_def_v(3)%qrs, & |
---|
| 2100 | surf_lsm_v(3)%qrs, & |
---|
| 2101 | surf_usm_v(3)%qrs, n_out ) |
---|
| 2102 | |
---|
| 2103 | CASE ( 'nrs' ) |
---|
| 2104 | CALL surface_output_sum_up( surf_def_h(0)%nrs, & |
---|
| 2105 | surf_def_h(1)%nrs, & |
---|
| 2106 | surf_lsm_h%nrs, & |
---|
| 2107 | surf_usm_h%nrs, & |
---|
| 2108 | surf_def_v(0)%nrs, & |
---|
| 2109 | surf_lsm_v(0)%nrs, & |
---|
| 2110 | surf_usm_v(0)%nrs, & |
---|
| 2111 | surf_def_v(1)%nrs, & |
---|
| 2112 | surf_lsm_v(1)%nrs, & |
---|
| 2113 | surf_usm_v(1)%nrs, & |
---|
| 2114 | surf_def_v(2)%nrs, & |
---|
| 2115 | surf_lsm_v(2)%nrs, & |
---|
| 2116 | surf_usm_v(2)%nrs, & |
---|
| 2117 | surf_def_v(3)%nrs, & |
---|
| 2118 | surf_lsm_v(3)%nrs, & |
---|
| 2119 | surf_usm_v(3)%nrs, n_out ) |
---|
| 2120 | |
---|
| 2121 | CASE ( 'ol' ) |
---|
| 2122 | CALL surface_output_sum_up( surf_def_h(0)%ol, & |
---|
| 2123 | surf_def_h(1)%ol, & |
---|
| 2124 | surf_lsm_h%ol, & |
---|
| 2125 | surf_usm_h%ol, & |
---|
| 2126 | surf_def_v(0)%ol, & |
---|
| 2127 | surf_lsm_v(0)%ol, & |
---|
| 2128 | surf_usm_v(0)%ol, & |
---|
| 2129 | surf_def_v(1)%ol, & |
---|
| 2130 | surf_lsm_v(1)%ol, & |
---|
| 2131 | surf_usm_v(1)%ol, & |
---|
| 2132 | surf_def_v(2)%ol, & |
---|
| 2133 | surf_lsm_v(2)%ol, & |
---|
| 2134 | surf_usm_v(2)%ol, & |
---|
| 2135 | surf_def_v(3)%ol, & |
---|
| 2136 | surf_lsm_v(3)%ol, & |
---|
| 2137 | surf_usm_v(3)%ol, n_out ) |
---|
| 2138 | |
---|
| 2139 | CASE ( 'z0' ) |
---|
| 2140 | CALL surface_output_sum_up( surf_def_h(0)%z0, & |
---|
| 2141 | surf_def_h(1)%z0, & |
---|
| 2142 | surf_lsm_h%z0, & |
---|
| 2143 | surf_usm_h%z0, & |
---|
| 2144 | surf_def_v(0)%z0, & |
---|
| 2145 | surf_lsm_v(0)%z0, & |
---|
| 2146 | surf_usm_v(0)%z0, & |
---|
| 2147 | surf_def_v(1)%z0, & |
---|
| 2148 | surf_lsm_v(1)%z0, & |
---|
| 2149 | surf_usm_v(1)%z0, & |
---|
| 2150 | surf_def_v(2)%z0, & |
---|
| 2151 | surf_lsm_v(2)%z0, & |
---|
| 2152 | surf_usm_v(2)%z0, & |
---|
| 2153 | surf_def_v(3)%z0, & |
---|
| 2154 | surf_lsm_v(3)%z0, & |
---|
| 2155 | surf_usm_v(3)%z0, n_out ) |
---|
| 2156 | |
---|
| 2157 | CASE ( 'z0h' ) |
---|
| 2158 | CALL surface_output_sum_up( surf_def_h(0)%z0h, & |
---|
| 2159 | surf_def_h(1)%z0h, & |
---|
| 2160 | surf_lsm_h%z0h, & |
---|
| 2161 | surf_usm_h%z0h, & |
---|
| 2162 | surf_def_v(0)%z0h, & |
---|
| 2163 | surf_lsm_v(0)%z0h, & |
---|
| 2164 | surf_usm_v(0)%z0h, & |
---|
| 2165 | surf_def_v(1)%z0h, & |
---|
| 2166 | surf_lsm_v(1)%z0h, & |
---|
| 2167 | surf_usm_v(1)%z0h, & |
---|
| 2168 | surf_def_v(2)%z0h, & |
---|
| 2169 | surf_lsm_v(2)%z0h, & |
---|
| 2170 | surf_usm_v(2)%z0h, & |
---|
| 2171 | surf_def_v(3)%z0h, & |
---|
| 2172 | surf_lsm_v(3)%z0h, & |
---|
| 2173 | surf_usm_v(3)%z0h, n_out ) |
---|
| 2174 | |
---|
| 2175 | CASE ( 'z0q' ) |
---|
| 2176 | CALL surface_output_sum_up( surf_def_h(0)%z0q, & |
---|
| 2177 | surf_def_h(1)%z0q, & |
---|
| 2178 | surf_lsm_h%z0q, & |
---|
| 2179 | surf_usm_h%z0q, & |
---|
| 2180 | surf_def_v(0)%z0q, & |
---|
| 2181 | surf_lsm_v(0)%z0q, & |
---|
| 2182 | surf_usm_v(0)%z0q, & |
---|
| 2183 | surf_def_v(1)%z0q, & |
---|
| 2184 | surf_lsm_v(1)%z0q, & |
---|
| 2185 | surf_usm_v(1)%z0q, & |
---|
| 2186 | surf_def_v(2)%z0q, & |
---|
| 2187 | surf_lsm_v(2)%z0q, & |
---|
| 2188 | surf_usm_v(2)%z0q, & |
---|
| 2189 | surf_def_v(3)%z0q, & |
---|
| 2190 | surf_lsm_v(3)%z0q, & |
---|
| 2191 | surf_usm_v(3)%z0q, n_out ) |
---|
| 2192 | |
---|
| 2193 | CASE ( 'theta1' ) |
---|
| 2194 | CALL surface_output_sum_up( surf_def_h(0)%pt1, & |
---|
| 2195 | surf_def_h(1)%pt1, & |
---|
| 2196 | surf_lsm_h%pt1, & |
---|
| 2197 | surf_usm_h%pt1, & |
---|
| 2198 | surf_def_v(0)%pt1, & |
---|
| 2199 | surf_lsm_v(0)%pt1, & |
---|
| 2200 | surf_usm_v(0)%pt1, & |
---|
| 2201 | surf_def_v(1)%pt1, & |
---|
| 2202 | surf_lsm_v(1)%pt1, & |
---|
| 2203 | surf_usm_v(1)%pt1, & |
---|
| 2204 | surf_def_v(2)%pt1, & |
---|
| 2205 | surf_lsm_v(2)%pt1, & |
---|
| 2206 | surf_usm_v(2)%pt1, & |
---|
| 2207 | surf_def_v(3)%pt1, & |
---|
| 2208 | surf_lsm_v(3)%pt1, & |
---|
| 2209 | surf_usm_v(3)%pt1, n_out ) |
---|
| 2210 | |
---|
| 2211 | CASE ( 'qv1' ) |
---|
| 2212 | CALL surface_output_sum_up( surf_def_h(0)%qv1, & |
---|
| 2213 | surf_def_h(1)%qv1, & |
---|
| 2214 | surf_lsm_h%qv1, & |
---|
| 2215 | surf_usm_h%qv1, & |
---|
| 2216 | surf_def_v(0)%qv1, & |
---|
| 2217 | surf_lsm_v(0)%qv1, & |
---|
| 2218 | surf_usm_v(0)%qv1, & |
---|
| 2219 | surf_def_v(1)%qv1, & |
---|
| 2220 | surf_lsm_v(1)%qv1, & |
---|
| 2221 | surf_usm_v(1)%qv1, & |
---|
| 2222 | surf_def_v(2)%qv1, & |
---|
| 2223 | surf_lsm_v(2)%qv1, & |
---|
| 2224 | surf_usm_v(2)%qv1, & |
---|
| 2225 | surf_def_v(3)%qv1, & |
---|
| 2226 | surf_lsm_v(3)%qv1, & |
---|
| 2227 | surf_usm_v(3)%qv1, n_out ) |
---|
| 2228 | |
---|
| 2229 | CASE ( 'thetav1' ) |
---|
| 2230 | CALL surface_output_sum_up( surf_def_h(0)%vpt1, & |
---|
| 2231 | surf_def_h(1)%vpt1, & |
---|
| 2232 | surf_lsm_h%vpt1, & |
---|
| 2233 | surf_usm_h%vpt1, & |
---|
| 2234 | surf_def_v(0)%vpt1, & |
---|
| 2235 | surf_lsm_v(0)%vpt1, & |
---|
| 2236 | surf_usm_v(0)%vpt1, & |
---|
| 2237 | surf_def_v(1)%vpt1, & |
---|
| 2238 | surf_lsm_v(1)%vpt1, & |
---|
| 2239 | surf_usm_v(1)%vpt1, & |
---|
| 2240 | surf_def_v(2)%vpt1, & |
---|
| 2241 | surf_lsm_v(2)%vpt1, & |
---|
| 2242 | surf_usm_v(2)%vpt1, & |
---|
| 2243 | surf_def_v(3)%vpt1, & |
---|
| 2244 | surf_lsm_v(3)%vpt1, & |
---|
| 2245 | surf_usm_v(3)%vpt1, n_out ) |
---|
| 2246 | |
---|
| 2247 | CASE ( 'usws' ) |
---|
| 2248 | CALL surface_output_sum_up( surf_def_h(0)%usws, & |
---|
| 2249 | surf_def_h(1)%usws, & |
---|
| 2250 | surf_lsm_h%usws, & |
---|
| 2251 | surf_usm_h%usws, & |
---|
| 2252 | surf_def_v(0)%usws, & |
---|
| 2253 | surf_lsm_v(0)%usws, & |
---|
| 2254 | surf_usm_v(0)%usws, & |
---|
| 2255 | surf_def_v(1)%usws, & |
---|
| 2256 | surf_lsm_v(1)%usws, & |
---|
| 2257 | surf_usm_v(1)%usws, & |
---|
| 2258 | surf_def_v(2)%usws, & |
---|
| 2259 | surf_lsm_v(2)%usws, & |
---|
| 2260 | surf_usm_v(2)%usws, & |
---|
| 2261 | surf_def_v(3)%usws, & |
---|
| 2262 | surf_lsm_v(3)%usws, & |
---|
| 2263 | surf_usm_v(3)%usws, n_out ) |
---|
| 2264 | |
---|
| 2265 | CASE ( 'vsws' ) |
---|
| 2266 | CALL surface_output_sum_up( surf_def_h(0)%vsws, & |
---|
| 2267 | surf_def_h(1)%vsws, & |
---|
| 2268 | surf_lsm_h%vsws, & |
---|
| 2269 | surf_usm_h%vsws, & |
---|
| 2270 | surf_def_v(0)%vsws, & |
---|
| 2271 | surf_lsm_v(0)%vsws, & |
---|
| 2272 | surf_usm_v(0)%vsws, & |
---|
| 2273 | surf_def_v(1)%vsws, & |
---|
| 2274 | surf_lsm_v(1)%vsws, & |
---|
| 2275 | surf_usm_v(1)%vsws, & |
---|
| 2276 | surf_def_v(2)%vsws, & |
---|
| 2277 | surf_lsm_v(2)%vsws, & |
---|
| 2278 | surf_usm_v(2)%vsws, & |
---|
| 2279 | surf_def_v(3)%vsws, & |
---|
| 2280 | surf_lsm_v(3)%vsws, & |
---|
| 2281 | surf_usm_v(3)%vsws, n_out ) |
---|
| 2282 | |
---|
| 2283 | CASE ( 'shf' ) |
---|
| 2284 | CALL surface_output_sum_up( surf_def_h(0)%shf, & |
---|
| 2285 | surf_def_h(1)%shf, & |
---|
| 2286 | surf_lsm_h%shf, & |
---|
| 2287 | surf_usm_h%shf, & |
---|
| 2288 | surf_def_v(0)%shf, & |
---|
| 2289 | surf_lsm_v(0)%shf, & |
---|
| 2290 | surf_usm_v(0)%shf, & |
---|
| 2291 | surf_def_v(1)%shf, & |
---|
| 2292 | surf_lsm_v(1)%shf, & |
---|
| 2293 | surf_usm_v(1)%shf, & |
---|
| 2294 | surf_def_v(2)%shf, & |
---|
| 2295 | surf_lsm_v(2)%shf, & |
---|
| 2296 | surf_usm_v(2)%shf, & |
---|
| 2297 | surf_def_v(3)%shf, & |
---|
| 2298 | surf_lsm_v(3)%shf, & |
---|
| 2299 | surf_usm_v(3)%shf, n_out ) |
---|
| 2300 | |
---|
| 2301 | CASE ( 'qsws' ) |
---|
| 2302 | CALL surface_output_sum_up( surf_def_h(0)%qsws, & |
---|
| 2303 | surf_def_h(1)%qsws, & |
---|
| 2304 | surf_lsm_h%qsws, & |
---|
| 2305 | surf_usm_h%qsws, & |
---|
| 2306 | surf_def_v(0)%qsws, & |
---|
| 2307 | surf_lsm_v(0)%qsws, & |
---|
| 2308 | surf_usm_v(0)%qsws, & |
---|
| 2309 | surf_def_v(1)%qsws, & |
---|
| 2310 | surf_lsm_v(1)%qsws, & |
---|
| 2311 | surf_usm_v(1)%qsws, & |
---|
| 2312 | surf_def_v(2)%qsws, & |
---|
| 2313 | surf_lsm_v(2)%qsws, & |
---|
| 2314 | surf_usm_v(2)%qsws, & |
---|
| 2315 | surf_def_v(3)%qsws, & |
---|
| 2316 | surf_lsm_v(3)%qsws, & |
---|
| 2317 | surf_usm_v(3)%qsws, n_out ) |
---|
| 2318 | |
---|
| 2319 | CASE ( 'ssws' ) |
---|
| 2320 | CALL surface_output_sum_up( surf_def_h(0)%ssws, & |
---|
| 2321 | surf_def_h(1)%ssws, & |
---|
| 2322 | surf_lsm_h%ssws, & |
---|
| 2323 | surf_usm_h%ssws, & |
---|
| 2324 | surf_def_v(0)%ssws, & |
---|
| 2325 | surf_lsm_v(0)%ssws, & |
---|
| 2326 | surf_usm_v(0)%ssws, & |
---|
| 2327 | surf_def_v(1)%ssws, & |
---|
| 2328 | surf_lsm_v(1)%ssws, & |
---|
| 2329 | surf_usm_v(1)%ssws, & |
---|
| 2330 | surf_def_v(2)%ssws, & |
---|
| 2331 | surf_lsm_v(2)%ssws, & |
---|
| 2332 | surf_usm_v(2)%ssws, & |
---|
| 2333 | surf_def_v(3)%ssws, & |
---|
| 2334 | surf_lsm_v(3)%ssws, & |
---|
| 2335 | surf_usm_v(3)%ssws, n_out ) |
---|
| 2336 | |
---|
| 2337 | CASE ( 'qcsws' ) |
---|
| 2338 | CALL surface_output_sum_up( surf_def_h(0)%qcsws, & |
---|
| 2339 | surf_def_h(1)%qcsws, & |
---|
| 2340 | surf_lsm_h%qcsws, & |
---|
| 2341 | surf_usm_h%qcsws, & |
---|
| 2342 | surf_def_v(0)%qcsws, & |
---|
| 2343 | surf_lsm_v(0)%qcsws, & |
---|
| 2344 | surf_usm_v(0)%qcsws, & |
---|
| 2345 | surf_def_v(1)%qcsws, & |
---|
| 2346 | surf_lsm_v(1)%qcsws, & |
---|
| 2347 | surf_usm_v(1)%qcsws, & |
---|
| 2348 | surf_def_v(2)%qcsws, & |
---|
| 2349 | surf_lsm_v(2)%qcsws, & |
---|
| 2350 | surf_usm_v(2)%qcsws, & |
---|
| 2351 | surf_def_v(3)%qcsws, & |
---|
| 2352 | surf_lsm_v(3)%qcsws, & |
---|
| 2353 | surf_usm_v(3)%qcsws, n_out ) |
---|
| 2354 | |
---|
| 2355 | CASE ( 'ncsws' ) |
---|
| 2356 | CALL surface_output_sum_up( surf_def_h(0)%ncsws, & |
---|
| 2357 | surf_def_h(1)%ncsws, & |
---|
| 2358 | surf_lsm_h%ncsws, & |
---|
| 2359 | surf_usm_h%ncsws, & |
---|
| 2360 | surf_def_v(0)%ncsws, & |
---|
| 2361 | surf_lsm_v(0)%ncsws, & |
---|
| 2362 | surf_usm_v(0)%ncsws, & |
---|
| 2363 | surf_def_v(1)%ncsws, & |
---|
| 2364 | surf_lsm_v(1)%ncsws, & |
---|
| 2365 | surf_usm_v(1)%ncsws, & |
---|
| 2366 | surf_def_v(2)%ncsws, & |
---|
| 2367 | surf_lsm_v(2)%ncsws, & |
---|
| 2368 | surf_usm_v(2)%ncsws, & |
---|
| 2369 | surf_def_v(3)%ncsws, & |
---|
| 2370 | surf_lsm_v(3)%ncsws, & |
---|
| 2371 | surf_usm_v(3)%ncsws, n_out ) |
---|
| 2372 | |
---|
| 2373 | CASE ( 'qrsws' ) |
---|
| 2374 | CALL surface_output_sum_up( surf_def_h(0)%qrsws, & |
---|
| 2375 | surf_def_h(1)%qrsws, & |
---|
| 2376 | surf_lsm_h%qrsws, & |
---|
| 2377 | surf_usm_h%qrsws, & |
---|
| 2378 | surf_def_v(0)%qrsws, & |
---|
| 2379 | surf_lsm_v(0)%qrsws, & |
---|
| 2380 | surf_usm_v(0)%qrsws, & |
---|
| 2381 | surf_def_v(1)%qrsws, & |
---|
| 2382 | surf_lsm_v(1)%qrsws, & |
---|
| 2383 | surf_usm_v(1)%qrsws, & |
---|
| 2384 | surf_def_v(2)%qrsws, & |
---|
| 2385 | surf_lsm_v(2)%qrsws, & |
---|
| 2386 | surf_usm_v(2)%qrsws, & |
---|
| 2387 | surf_def_v(3)%qrsws, & |
---|
| 2388 | surf_lsm_v(3)%qrsws, & |
---|
| 2389 | surf_usm_v(3)%qrsws, n_out ) |
---|
| 2390 | |
---|
| 2391 | CASE ( 'nrsws' ) |
---|
| 2392 | CALL surface_output_sum_up( surf_def_h(0)%nrsws, & |
---|
| 2393 | surf_def_h(1)%nrsws, & |
---|
| 2394 | surf_lsm_h%nrsws, & |
---|
| 2395 | surf_usm_h%nrsws, & |
---|
| 2396 | surf_def_v(0)%nrsws, & |
---|
| 2397 | surf_lsm_v(0)%nrsws, & |
---|
| 2398 | surf_usm_v(0)%nrsws, & |
---|
| 2399 | surf_def_v(1)%nrsws, & |
---|
| 2400 | surf_lsm_v(1)%nrsws, & |
---|
| 2401 | surf_usm_v(1)%nrsws, & |
---|
| 2402 | surf_def_v(2)%nrsws, & |
---|
| 2403 | surf_lsm_v(2)%nrsws, & |
---|
| 2404 | surf_usm_v(2)%nrsws, & |
---|
| 2405 | surf_def_v(3)%nrsws, & |
---|
| 2406 | surf_lsm_v(3)%nrsws, & |
---|
| 2407 | surf_usm_v(3)%nrsws, n_out ) |
---|
| 2408 | |
---|
| 2409 | CASE ( 'sasws' ) |
---|
| 2410 | CALL surface_output_sum_up( surf_def_h(0)%sasws, & |
---|
| 2411 | surf_def_h(1)%sasws, & |
---|
| 2412 | surf_lsm_h%sasws, & |
---|
| 2413 | surf_usm_h%sasws, & |
---|
| 2414 | surf_def_v(0)%sasws, & |
---|
| 2415 | surf_lsm_v(0)%sasws, & |
---|
| 2416 | surf_usm_v(0)%sasws, & |
---|
| 2417 | surf_def_v(1)%sasws, & |
---|
| 2418 | surf_lsm_v(1)%sasws, & |
---|
| 2419 | surf_usm_v(1)%sasws, & |
---|
| 2420 | surf_def_v(2)%sasws, & |
---|
| 2421 | surf_lsm_v(2)%sasws, & |
---|
| 2422 | surf_usm_v(2)%sasws, & |
---|
| 2423 | surf_def_v(3)%sasws, & |
---|
| 2424 | surf_lsm_v(3)%sasws, & |
---|
| 2425 | surf_usm_v(3)%sasws, n_out ) |
---|
| 2426 | |
---|
| 2427 | CASE ( 'q_surface' ) |
---|
| 2428 | CALL surface_output_sum_up( surf_def_h(0)%q_surface, & |
---|
| 2429 | surf_def_h(1)%q_surface, & |
---|
| 2430 | surf_lsm_h%q_surface, & |
---|
| 2431 | surf_usm_h%q_surface, & |
---|
| 2432 | surf_def_v(0)%q_surface, & |
---|
| 2433 | surf_lsm_v(0)%q_surface, & |
---|
| 2434 | surf_usm_v(0)%q_surface, & |
---|
| 2435 | surf_def_v(1)%q_surface, & |
---|
| 2436 | surf_lsm_v(1)%q_surface, & |
---|
| 2437 | surf_usm_v(1)%q_surface, & |
---|
| 2438 | surf_def_v(2)%q_surface, & |
---|
| 2439 | surf_lsm_v(2)%q_surface, & |
---|
| 2440 | surf_usm_v(2)%q_surface, & |
---|
| 2441 | surf_def_v(3)%q_surface, & |
---|
| 2442 | surf_lsm_v(3)%q_surface, & |
---|
| 2443 | surf_usm_v(3)%q_surface, n_out ) |
---|
| 2444 | |
---|
| 2445 | CASE ( 'theta_surface' ) |
---|
| 2446 | CALL surface_output_sum_up( surf_def_h(0)%pt_surface, & |
---|
| 2447 | surf_def_h(1)%pt_surface, & |
---|
| 2448 | surf_lsm_h%pt_surface, & |
---|
| 2449 | surf_usm_h%pt_surface, & |
---|
| 2450 | surf_def_v(0)%pt_surface, & |
---|
| 2451 | surf_lsm_v(0)%pt_surface, & |
---|
| 2452 | surf_usm_v(0)%pt_surface, & |
---|
| 2453 | surf_def_v(1)%pt_surface, & |
---|
| 2454 | surf_lsm_v(1)%pt_surface, & |
---|
| 2455 | surf_usm_v(1)%pt_surface, & |
---|
| 2456 | surf_def_v(2)%pt_surface, & |
---|
| 2457 | surf_lsm_v(2)%pt_surface, & |
---|
| 2458 | surf_usm_v(2)%pt_surface, & |
---|
| 2459 | surf_def_v(3)%pt_surface, & |
---|
| 2460 | surf_lsm_v(3)%pt_surface, & |
---|
| 2461 | surf_usm_v(3)%pt_surface, n_out ) |
---|
| 2462 | |
---|
| 2463 | CASE ( 'thetav_surface' ) |
---|
| 2464 | CALL surface_output_sum_up( surf_def_h(0)%vpt_surface, & |
---|
| 2465 | surf_def_h(1)%vpt_surface, & |
---|
| 2466 | surf_lsm_h%vpt_surface, & |
---|
| 2467 | surf_usm_h%vpt_surface, & |
---|
| 2468 | surf_def_v(0)%vpt_surface, & |
---|
| 2469 | surf_lsm_v(0)%vpt_surface, & |
---|
| 2470 | surf_usm_v(0)%vpt_surface, & |
---|
| 2471 | surf_def_v(1)%vpt_surface, & |
---|
| 2472 | surf_lsm_v(1)%vpt_surface, & |
---|
| 2473 | surf_usm_v(1)%vpt_surface, & |
---|
| 2474 | surf_def_v(2)%vpt_surface, & |
---|
| 2475 | surf_lsm_v(2)%vpt_surface, & |
---|
| 2476 | surf_usm_v(2)%vpt_surface, & |
---|
| 2477 | surf_def_v(3)%vpt_surface, & |
---|
| 2478 | surf_lsm_v(3)%vpt_surface, & |
---|
| 2479 | surf_usm_v(3)%vpt_surface, n_out ) |
---|
| 2480 | |
---|
| 2481 | CASE ( 'rad_net' ) |
---|
| 2482 | CALL surface_output_sum_up( surf_def_h(0)%rad_net, & |
---|
| 2483 | surf_def_h(1)%rad_net, & |
---|
| 2484 | surf_lsm_h%rad_net, & |
---|
| 2485 | surf_usm_h%rad_net, & |
---|
| 2486 | surf_def_v(0)%rad_net, & |
---|
| 2487 | surf_lsm_v(0)%rad_net, & |
---|
| 2488 | surf_usm_v(0)%rad_net, & |
---|
| 2489 | surf_def_v(1)%rad_net, & |
---|
| 2490 | surf_lsm_v(1)%rad_net, & |
---|
| 2491 | surf_usm_v(1)%rad_net, & |
---|
| 2492 | surf_def_v(2)%rad_net, & |
---|
| 2493 | surf_lsm_v(2)%rad_net, & |
---|
| 2494 | surf_usm_v(2)%rad_net, & |
---|
| 2495 | surf_def_v(3)%rad_net, & |
---|
| 2496 | surf_lsm_v(3)%rad_net, & |
---|
| 2497 | surf_usm_v(3)%rad_net, n_out ) |
---|
| 2498 | |
---|
| 2499 | CASE ( 'rad_lw_in' ) |
---|
| 2500 | CALL surface_output_sum_up( surf_def_h(0)%rad_lw_in, & |
---|
| 2501 | surf_def_h(1)%rad_lw_in, & |
---|
| 2502 | surf_lsm_h%rad_lw_in, & |
---|
| 2503 | surf_usm_h%rad_lw_in, & |
---|
| 2504 | surf_def_v(0)%rad_lw_in, & |
---|
| 2505 | surf_lsm_v(0)%rad_lw_in, & |
---|
| 2506 | surf_usm_v(0)%rad_lw_in, & |
---|
| 2507 | surf_def_v(1)%rad_lw_in, & |
---|
| 2508 | surf_lsm_v(1)%rad_lw_in, & |
---|
| 2509 | surf_usm_v(1)%rad_lw_in, & |
---|
| 2510 | surf_def_v(2)%rad_lw_in, & |
---|
| 2511 | surf_lsm_v(2)%rad_lw_in, & |
---|
| 2512 | surf_usm_v(2)%rad_lw_in, & |
---|
| 2513 | surf_def_v(3)%rad_lw_in, & |
---|
| 2514 | surf_lsm_v(3)%rad_lw_in, & |
---|
| 2515 | surf_usm_v(3)%rad_lw_in, n_out ) |
---|
| 2516 | |
---|
| 2517 | CASE ( 'rad_lw_out' ) |
---|
| 2518 | CALL surface_output_sum_up( surf_def_h(0)%rad_lw_out, & |
---|
| 2519 | surf_def_h(1)%rad_lw_out, & |
---|
| 2520 | surf_lsm_h%rad_lw_out, & |
---|
| 2521 | surf_usm_h%rad_lw_out, & |
---|
| 2522 | surf_def_v(0)%rad_lw_out, & |
---|
| 2523 | surf_lsm_v(0)%rad_lw_out, & |
---|
| 2524 | surf_usm_v(0)%rad_lw_out, & |
---|
| 2525 | surf_def_v(1)%rad_lw_out, & |
---|
| 2526 | surf_lsm_v(1)%rad_lw_out, & |
---|
| 2527 | surf_usm_v(1)%rad_lw_out, & |
---|
| 2528 | surf_def_v(2)%rad_lw_out, & |
---|
| 2529 | surf_lsm_v(2)%rad_lw_out, & |
---|
| 2530 | surf_usm_v(2)%rad_lw_out, & |
---|
| 2531 | surf_def_v(3)%rad_lw_out, & |
---|
| 2532 | surf_lsm_v(3)%rad_lw_out, & |
---|
| 2533 | surf_usm_v(3)%rad_lw_out, n_out ) |
---|
| 2534 | |
---|
| 2535 | CASE ( 'rad_sw_in' ) |
---|
| 2536 | CALL surface_output_sum_up( surf_def_h(0)%rad_sw_in, & |
---|
| 2537 | surf_def_h(1)%rad_sw_in, & |
---|
| 2538 | surf_lsm_h%rad_sw_in, & |
---|
| 2539 | surf_usm_h%rad_sw_in, & |
---|
| 2540 | surf_def_v(0)%rad_sw_in, & |
---|
| 2541 | surf_lsm_v(0)%rad_sw_in, & |
---|
| 2542 | surf_usm_v(0)%rad_sw_in, & |
---|
| 2543 | surf_def_v(1)%rad_sw_in, & |
---|
| 2544 | surf_lsm_v(1)%rad_sw_in, & |
---|
| 2545 | surf_usm_v(1)%rad_sw_in, & |
---|
| 2546 | surf_def_v(2)%rad_sw_in, & |
---|
| 2547 | surf_lsm_v(2)%rad_sw_in, & |
---|
| 2548 | surf_usm_v(2)%rad_sw_in, & |
---|
| 2549 | surf_def_v(3)%rad_sw_in, & |
---|
| 2550 | surf_lsm_v(3)%rad_sw_in, & |
---|
| 2551 | surf_usm_v(3)%rad_sw_in, n_out ) |
---|
| 2552 | |
---|
| 2553 | CASE ( 'rad_sw_out' ) |
---|
| 2554 | CALL surface_output_sum_up( surf_def_h(0)%rad_sw_out, & |
---|
| 2555 | surf_def_h(1)%rad_sw_out, & |
---|
| 2556 | surf_lsm_h%rad_sw_out, & |
---|
| 2557 | surf_usm_h%rad_sw_out, & |
---|
| 2558 | surf_def_v(0)%rad_sw_out, & |
---|
| 2559 | surf_lsm_v(0)%rad_sw_out, & |
---|
| 2560 | surf_usm_v(0)%rad_sw_out, & |
---|
| 2561 | surf_def_v(1)%rad_sw_out, & |
---|
| 2562 | surf_lsm_v(1)%rad_sw_out, & |
---|
| 2563 | surf_usm_v(1)%rad_sw_out, & |
---|
| 2564 | surf_def_v(2)%rad_sw_out, & |
---|
| 2565 | surf_lsm_v(2)%rad_sw_out, & |
---|
| 2566 | surf_usm_v(2)%rad_sw_out, & |
---|
| 2567 | surf_def_v(3)%rad_sw_out, & |
---|
| 2568 | surf_lsm_v(3)%rad_sw_out, & |
---|
| 2569 | surf_usm_v(3)%rad_sw_out, n_out ) |
---|
| 2570 | |
---|
| 2571 | CASE ( 'ghf' ) |
---|
| 2572 | CALL surface_output_sum_up( surf_def_h(0)%ghf, & |
---|
| 2573 | surf_def_h(1)%ghf, & |
---|
| 2574 | surf_lsm_h%ghf, & |
---|
| 2575 | surf_usm_h%ghf, & |
---|
| 2576 | surf_def_v(0)%ghf, & |
---|
| 2577 | surf_lsm_v(0)%ghf, & |
---|
| 2578 | surf_usm_v(0)%ghf, & |
---|
| 2579 | surf_def_v(1)%ghf, & |
---|
| 2580 | surf_lsm_v(1)%ghf, & |
---|
| 2581 | surf_usm_v(1)%ghf, & |
---|
| 2582 | surf_def_v(2)%ghf, & |
---|
| 2583 | surf_lsm_v(2)%ghf, & |
---|
| 2584 | surf_usm_v(2)%ghf, & |
---|
| 2585 | surf_def_v(3)%ghf, & |
---|
| 2586 | surf_lsm_v(3)%ghf, & |
---|
| 2587 | surf_usm_v(3)%ghf, n_out ) |
---|
| 2588 | |
---|
| 2589 | CASE ( 'r_a' ) |
---|
| 2590 | CALL surface_output_sum_up( surf_def_h(0)%r_a, & |
---|
| 2591 | surf_def_h(1)%r_a, & |
---|
| 2592 | surf_lsm_h%r_a, & |
---|
| 2593 | surf_usm_h%r_a, & |
---|
| 2594 | surf_def_v(0)%r_a, & |
---|
| 2595 | surf_lsm_v(0)%r_a, & |
---|
| 2596 | surf_usm_v(0)%r_a, & |
---|
| 2597 | surf_def_v(1)%r_a, & |
---|
| 2598 | surf_lsm_v(1)%r_a, & |
---|
| 2599 | surf_usm_v(1)%r_a, & |
---|
| 2600 | surf_def_v(2)%r_a, & |
---|
| 2601 | surf_lsm_v(2)%r_a, & |
---|
| 2602 | surf_usm_v(2)%r_a, & |
---|
| 2603 | surf_def_v(3)%r_a, & |
---|
| 2604 | surf_lsm_v(3)%r_a, & |
---|
| 2605 | surf_usm_v(3)%r_a, n_out ) |
---|
| 2606 | |
---|
| 2607 | CASE ( 'r_soil' ) |
---|
| 2608 | CALL surface_output_sum_up( surf_def_h(0)%r_soil, & |
---|
| 2609 | surf_def_h(1)%r_soil, & |
---|
| 2610 | surf_lsm_h%r_soil, & |
---|
| 2611 | surf_usm_h%r_soil, & |
---|
| 2612 | surf_def_v(0)%r_soil, & |
---|
| 2613 | surf_lsm_v(0)%r_soil, & |
---|
| 2614 | surf_usm_v(0)%r_soil, & |
---|
| 2615 | surf_def_v(1)%r_soil, & |
---|
| 2616 | surf_lsm_v(1)%r_soil, & |
---|
| 2617 | surf_usm_v(1)%r_soil, & |
---|
| 2618 | surf_def_v(2)%r_soil, & |
---|
| 2619 | surf_lsm_v(2)%r_soil, & |
---|
| 2620 | surf_usm_v(2)%r_soil, & |
---|
| 2621 | surf_def_v(3)%r_soil, & |
---|
| 2622 | surf_lsm_v(3)%r_soil, & |
---|
| 2623 | surf_usm_v(3)%r_soil, n_out ) |
---|
| 2624 | |
---|
| 2625 | CASE ( 'r_canopy' ) |
---|
| 2626 | CALL surface_output_sum_up( surf_def_h(0)%r_canopy, & |
---|
| 2627 | surf_def_h(1)%r_canopy, & |
---|
| 2628 | surf_lsm_h%r_canopy, & |
---|
| 2629 | surf_usm_h%r_canopy, & |
---|
| 2630 | surf_def_v(0)%r_canopy, & |
---|
| 2631 | surf_lsm_v(0)%r_canopy, & |
---|
| 2632 | surf_usm_v(0)%r_canopy, & |
---|
| 2633 | surf_def_v(1)%r_canopy, & |
---|
| 2634 | surf_lsm_v(1)%r_canopy, & |
---|
| 2635 | surf_usm_v(1)%r_canopy, & |
---|
| 2636 | surf_def_v(2)%r_canopy, & |
---|
| 2637 | surf_lsm_v(2)%r_canopy, & |
---|
| 2638 | surf_usm_v(2)%r_canopy, & |
---|
| 2639 | surf_def_v(3)%r_canopy, & |
---|
| 2640 | surf_lsm_v(3)%r_canopy, & |
---|
| 2641 | surf_usm_v(3)%r_canopy, n_out ) |
---|
| 2642 | |
---|
| 2643 | CASE ( 'r_s' ) |
---|
| 2644 | CALL surface_output_sum_up( surf_def_h(0)%r_s, & |
---|
| 2645 | surf_def_h(1)%r_s, & |
---|
| 2646 | surf_lsm_h%r_s, & |
---|
| 2647 | surf_usm_h%r_s, & |
---|
| 2648 | surf_def_v(0)%r_s, & |
---|
| 2649 | surf_lsm_v(0)%r_s, & |
---|
| 2650 | surf_usm_v(0)%r_s, & |
---|
| 2651 | surf_def_v(1)%r_s, & |
---|
| 2652 | surf_lsm_v(1)%r_s, & |
---|
| 2653 | surf_usm_v(1)%r_s, & |
---|
| 2654 | surf_def_v(2)%r_s, & |
---|
| 2655 | surf_lsm_v(2)%r_s, & |
---|
| 2656 | surf_usm_v(2)%r_s, & |
---|
| 2657 | surf_def_v(3)%r_s, & |
---|
| 2658 | surf_lsm_v(3)%r_s, & |
---|
| 2659 | surf_usm_v(3)%r_s, n_out ) |
---|
| 2660 | |
---|
| 2661 | END SELECT |
---|
| 2662 | ENDDO |
---|
| 2663 | |
---|
| 2664 | |
---|
| 2665 | END SUBROUTINE surface_output_averaging |
---|
| 2666 | |
---|
| 2667 | !------------------------------------------------------------------------------! |
---|
| 2668 | ! Description: |
---|
| 2669 | ! ------------ |
---|
| 2670 | !> Sum-up the surface data for average output variables. |
---|
| 2671 | !------------------------------------------------------------------------------! |
---|
| 2672 | SUBROUTINE surface_output_sum_up( var_def_h0, var_def_h1, & |
---|
| 2673 | var_lsm_h, var_usm_h, & |
---|
| 2674 | var_def_v0, var_def_v1, var_def_v2, & |
---|
| 2675 | var_def_v3, & |
---|
| 2676 | var_lsm_v0, var_lsm_v1, var_lsm_v2, & |
---|
| 2677 | var_lsm_v3, & |
---|
| 2678 | var_usm_v0, var_usm_v1, var_usm_v2, & |
---|
| 2679 | var_usm_v3, n_out ) |
---|
| 2680 | |
---|
| 2681 | IMPLICIT NONE |
---|
| 2682 | |
---|
| 2683 | INTEGER(iwp) :: m !< running index for surface elements |
---|
| 2684 | INTEGER(iwp) :: n_out !< index for output variable |
---|
| 2685 | INTEGER(iwp) :: n_surf !< running index for surface elements |
---|
| 2686 | |
---|
| 2687 | REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) :: var_def_h0 !< output variable at upward-facing default-type surfaces |
---|
| 2688 | REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) :: var_def_h1 !< output variable at downward-facing default-type surfaces |
---|
| 2689 | REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) :: var_lsm_h !< output variable at upward-facing natural-type surfaces |
---|
| 2690 | REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) :: var_usm_h !< output variable at upward-facing urban-type surfaces |
---|
| 2691 | REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) :: var_def_v0 !< output variable at northward-facing default-type surfaces |
---|
| 2692 | REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) :: var_def_v1 !< output variable at southward-facing default-type surfaces |
---|
| 2693 | REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) :: var_def_v2 !< output variable at eastward-facing default-type surfaces |
---|
| 2694 | REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) :: var_def_v3 !< output variable at westward-facing default-type surfaces |
---|
| 2695 | REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) :: var_lsm_v0 !< output variable at northward-facing natural-type surfaces |
---|
| 2696 | REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) :: var_lsm_v1 !< output variable at southward-facing natural-type surfaces |
---|
| 2697 | REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) :: var_lsm_v2 !< output variable at eastward-facing natural-type surfaces |
---|
| 2698 | REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) :: var_lsm_v3 !< output variable at westward-facing natural-type surfaces |
---|
| 2699 | REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) :: var_usm_v0 !< output variable at northward-facing urban-type surfaces |
---|
| 2700 | REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) :: var_usm_v1 !< output variable at southward-facing urban-type surfaces |
---|
| 2701 | REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) :: var_usm_v2 !< output variable at eastward-facing urban-type surfaces |
---|
| 2702 | REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) :: var_usm_v3 !< output variable at westward-facing urban-type surfaces |
---|
| 2703 | |
---|
| 2704 | ! |
---|
| 2705 | !-- Set counter variable to zero before the variable is written to |
---|
| 2706 | !-- the output array. |
---|
| 2707 | n_surf = 0 |
---|
| 2708 | |
---|
| 2709 | ! |
---|
| 2710 | !-- Write the horizontal surfaces. |
---|
| 2711 | !-- Before each the variable is written to the output data structure, first |
---|
| 2712 | !-- check if the variable for the respective surface type is defined. |
---|
| 2713 | !-- If a variable is not defined, skip the block and increment the counter |
---|
| 2714 | !-- variable by the number of surface elements of this type. Usually this |
---|
| 2715 | !-- is zere, however, there might be the situation that e.g. urban surfaces |
---|
| 2716 | !-- are defined but the respective variable is not allocated for this surface |
---|
| 2717 | !-- type. To write the data on the exact position, increment the counter. |
---|
| 2718 | IF ( ALLOCATED( var_def_h0 ) ) THEN |
---|
| 2719 | DO m = 1, surf_def_h(0)%ns |
---|
| 2720 | n_surf = n_surf + 1 |
---|
| 2721 | surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out) & |
---|
| 2722 | + var_def_h0(m) |
---|
| 2723 | ENDDO |
---|
| 2724 | ELSE |
---|
| 2725 | n_surf = n_surf + surf_def_h(0)%ns |
---|
| 2726 | ENDIF |
---|
| 2727 | IF ( ALLOCATED( var_def_h1 ) ) THEN |
---|
| 2728 | DO m = 1, surf_def_h(1)%ns |
---|
| 2729 | n_surf = n_surf + 1 |
---|
| 2730 | surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out) & |
---|
| 2731 | + var_def_h1(m) |
---|
| 2732 | ENDDO |
---|
| 2733 | ELSE |
---|
| 2734 | n_surf = n_surf + surf_def_h(1)%ns |
---|
| 2735 | ENDIF |
---|
| 2736 | IF ( ALLOCATED( var_lsm_h ) ) THEN |
---|
| 2737 | DO m = 1, surf_lsm_h%ns |
---|
| 2738 | n_surf = n_surf + 1 |
---|
| 2739 | surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out) & |
---|
| 2740 | + var_lsm_h(m) |
---|
| 2741 | ENDDO |
---|
| 2742 | ELSE |
---|
| 2743 | n_surf = n_surf + surf_lsm_h%ns |
---|
| 2744 | ENDIF |
---|
| 2745 | IF ( ALLOCATED( var_usm_h ) ) THEN |
---|
| 2746 | DO m = 1, surf_usm_h%ns |
---|
| 2747 | n_surf = n_surf + 1 |
---|
| 2748 | surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out) & |
---|
| 2749 | + var_usm_h(m) |
---|
| 2750 | ENDDO |
---|
| 2751 | ELSE |
---|
| 2752 | n_surf = n_surf + surf_usm_h%ns |
---|
| 2753 | ENDIF |
---|
| 2754 | ! |
---|
| 2755 | !-- Write northward-facing |
---|
| 2756 | IF ( ALLOCATED( var_def_v0 ) ) THEN |
---|
| 2757 | DO m = 1, surf_def_v(0)%ns |
---|
| 2758 | n_surf = n_surf + 1 |
---|
| 2759 | surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out) & |
---|
| 2760 | + var_def_v0(m) |
---|
| 2761 | ENDDO |
---|
| 2762 | ELSE |
---|
| 2763 | n_surf = n_surf + surf_def_v(0)%ns |
---|
| 2764 | ENDIF |
---|
| 2765 | IF ( ALLOCATED( var_lsm_v0 ) ) THEN |
---|
| 2766 | DO m = 1, surf_lsm_v(0)%ns |
---|
| 2767 | n_surf = n_surf + 1 |
---|
| 2768 | surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out) & |
---|
| 2769 | + var_lsm_v0(m) |
---|
| 2770 | ENDDO |
---|
| 2771 | ELSE |
---|
| 2772 | n_surf = n_surf + surf_lsm_v(0)%ns |
---|
| 2773 | ENDIF |
---|
| 2774 | IF ( ALLOCATED( var_usm_v0 ) ) THEN |
---|
| 2775 | DO m = 1, surf_usm_v(0)%ns |
---|
| 2776 | n_surf = n_surf + 1 |
---|
| 2777 | surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out) & |
---|
| 2778 | + var_usm_v0(m) |
---|
| 2779 | ENDDO |
---|
| 2780 | ELSE |
---|
| 2781 | n_surf = n_surf + surf_usm_v(0)%ns |
---|
| 2782 | ENDIF |
---|
| 2783 | ! |
---|
| 2784 | !-- Write southward-facing |
---|
| 2785 | IF ( ALLOCATED( var_def_v1 ) ) THEN |
---|
| 2786 | DO m = 1, surf_def_v(1)%ns |
---|
| 2787 | n_surf = n_surf + 1 |
---|
| 2788 | surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out) & |
---|
| 2789 | + var_def_v1(m) |
---|
| 2790 | ENDDO |
---|
| 2791 | ELSE |
---|
| 2792 | n_surf = n_surf + surf_def_v(1)%ns |
---|
| 2793 | ENDIF |
---|
| 2794 | IF ( ALLOCATED( var_lsm_v1 ) ) THEN |
---|
| 2795 | DO m = 1, surf_lsm_v(1)%ns |
---|
| 2796 | n_surf = n_surf + 1 |
---|
| 2797 | surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out) & |
---|
| 2798 | + var_lsm_v1(m) |
---|
| 2799 | ENDDO |
---|
| 2800 | ELSE |
---|
| 2801 | n_surf = n_surf + surf_lsm_v(1)%ns |
---|
| 2802 | ENDIF |
---|
| 2803 | IF ( ALLOCATED( var_usm_v1 ) ) THEN |
---|
| 2804 | DO m = 1, surf_usm_v(1)%ns |
---|
| 2805 | n_surf = n_surf + 1 |
---|
| 2806 | surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out) & |
---|
| 2807 | + var_usm_v1(m) |
---|
| 2808 | ENDDO |
---|
| 2809 | ELSE |
---|
| 2810 | n_surf = n_surf + surf_usm_v(1)%ns |
---|
| 2811 | ENDIF |
---|
| 2812 | ! |
---|
| 2813 | !-- Write eastward-facing |
---|
| 2814 | IF ( ALLOCATED( var_def_v2 ) ) THEN |
---|
| 2815 | DO m = 1, surf_def_v(2)%ns |
---|
| 2816 | n_surf = n_surf + 1 |
---|
| 2817 | surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out) & |
---|
| 2818 | + var_def_v2(m) |
---|
| 2819 | ENDDO |
---|
| 2820 | ELSE |
---|
| 2821 | n_surf = n_surf + surf_def_v(2)%ns |
---|
| 2822 | ENDIF |
---|
| 2823 | IF ( ALLOCATED( var_lsm_v2 ) ) THEN |
---|
| 2824 | DO m = 1, surf_lsm_v(2)%ns |
---|
| 2825 | n_surf = n_surf + 1 |
---|
| 2826 | surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out) & |
---|
| 2827 | + var_lsm_v2(m) |
---|
| 2828 | ENDDO |
---|
| 2829 | ELSE |
---|
| 2830 | n_surf = n_surf + surf_lsm_v(2)%ns |
---|
| 2831 | ENDIF |
---|
| 2832 | IF ( ALLOCATED( var_usm_v2 ) ) THEN |
---|
| 2833 | DO m = 1, surf_usm_v(2)%ns |
---|
| 2834 | n_surf = n_surf + 1 |
---|
| 2835 | surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out) & |
---|
| 2836 | + var_usm_v2(m) |
---|
| 2837 | ENDDO |
---|
| 2838 | ELSE |
---|
| 2839 | n_surf = n_surf + surf_usm_v(2)%ns |
---|
| 2840 | ENDIF |
---|
| 2841 | ! |
---|
| 2842 | !-- Write westward-facing |
---|
| 2843 | IF ( ALLOCATED( var_def_v3 ) ) THEN |
---|
| 2844 | DO m = 1, surf_def_v(3)%ns |
---|
| 2845 | n_surf = n_surf + 1 |
---|
| 2846 | surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out) & |
---|
| 2847 | + var_def_v3(m) |
---|
| 2848 | ENDDO |
---|
| 2849 | ELSE |
---|
| 2850 | n_surf = n_surf + surf_def_v(3)%ns |
---|
| 2851 | ENDIF |
---|
| 2852 | IF ( ALLOCATED( var_lsm_v3 ) ) THEN |
---|
| 2853 | DO m = 1, surf_lsm_v(3)%ns |
---|
| 2854 | n_surf = n_surf + 1 |
---|
| 2855 | surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out) & |
---|
| 2856 | + var_lsm_v3(m) |
---|
| 2857 | ENDDO |
---|
| 2858 | ELSE |
---|
| 2859 | n_surf = n_surf + surf_lsm_v(3)%ns |
---|
| 2860 | ENDIF |
---|
| 2861 | IF ( ALLOCATED( var_usm_v3 ) ) THEN |
---|
| 2862 | DO m = 1, surf_usm_v(3)%ns |
---|
| 2863 | n_surf = n_surf + 1 |
---|
| 2864 | surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out) & |
---|
| 2865 | + var_usm_v3(m) |
---|
| 2866 | ENDDO |
---|
| 2867 | ELSE |
---|
| 2868 | n_surf = n_surf + surf_usm_v(3)%ns |
---|
| 2869 | ENDIF |
---|
| 2870 | |
---|
| 2871 | END SUBROUTINE surface_output_sum_up |
---|
| 2872 | |
---|
| 2873 | !------------------------------------------------------------------------------! |
---|
| 2874 | ! Description: |
---|
| 2875 | ! ------------ |
---|
| 2876 | !> Collect the surface data from different types and different orientation. |
---|
| 2877 | !------------------------------------------------------------------------------! |
---|
| 2878 | SUBROUTINE surface_output_collect( var_def_h0, var_def_h1, & |
---|
| 2879 | var_lsm_h, var_usm_h, & |
---|
| 2880 | var_def_v0, var_def_v1, var_def_v2, & |
---|
| 2881 | var_def_v3, & |
---|
| 2882 | var_lsm_v0, var_lsm_v1, var_lsm_v2, & |
---|
| 2883 | var_lsm_v3, & |
---|
| 2884 | var_usm_v0, var_usm_v1, var_usm_v2, & |
---|
| 2885 | var_usm_v3 ) |
---|
| 2886 | |
---|
| 2887 | IMPLICIT NONE |
---|
| 2888 | |
---|
| 2889 | INTEGER(iwp) :: m !< running index for surface elements |
---|
| 2890 | INTEGER(iwp) :: n_surf !< running index for surface elements |
---|
| 2891 | |
---|
| 2892 | REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) :: var_def_h0 !< output variable at upward-facing default-type surfaces |
---|
| 2893 | REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) :: var_def_h1 !< output variable at downward-facing default-type surfaces |
---|
| 2894 | REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) :: var_lsm_h !< output variable at upward-facing natural-type surfaces |
---|
| 2895 | REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) :: var_usm_h !< output variable at upward-facing urban-type surfaces |
---|
| 2896 | REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) :: var_def_v0 !< output variable at northward-facing default-type surfaces |
---|
| 2897 | REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) :: var_def_v1 !< output variable at southward-facing default-type surfaces |
---|
| 2898 | REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) :: var_def_v2 !< output variable at eastward-facing default-type surfaces |
---|
| 2899 | REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) :: var_def_v3 !< output variable at westward-facing default-type surfaces |
---|
| 2900 | REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) :: var_lsm_v0 !< output variable at northward-facing natural-type surfaces |
---|
| 2901 | REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) :: var_lsm_v1 !< output variable at southward-facing natural-type surfaces |
---|
| 2902 | REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) :: var_lsm_v2 !< output variable at eastward-facing natural-type surfaces |
---|
| 2903 | REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) :: var_lsm_v3 !< output variable at westward-facing natural-type surfaces |
---|
| 2904 | REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) :: var_usm_v0 !< output variable at northward-facing urban-type surfaces |
---|
| 2905 | REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) :: var_usm_v1 !< output variable at southward-facing urban-type surfaces |
---|
| 2906 | REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) :: var_usm_v2 !< output variable at eastward-facing urban-type surfaces |
---|
| 2907 | REAL(wp), DIMENSION(:), ALLOCATABLE, INTENT(IN) :: var_usm_v3 !< output variable at westward-facing urban-type surfaces |
---|
| 2908 | |
---|
| 2909 | ! |
---|
| 2910 | !-- Set counter variable to zero before the variable is written to |
---|
| 2911 | !-- the output array. |
---|
| 2912 | n_surf = 0 |
---|
| 2913 | |
---|
| 2914 | ! |
---|
| 2915 | !-- Write the horizontal surfaces. |
---|
| 2916 | !-- Before each the variable is written to the output data structure, first |
---|
| 2917 | !-- check if the variable for the respective surface type is defined. |
---|
| 2918 | !-- If a variable is not defined, skip the block and increment the counter |
---|
| 2919 | !-- variable by the number of surface elements of this type. Usually this |
---|
| 2920 | !-- is zere, however, there might be the situation that e.g. urban surfaces |
---|
| 2921 | !-- are defined but the respective variable is not allocated for this surface |
---|
| 2922 | !-- type. To write the data on the exact position, increment the counter. |
---|
| 2923 | IF ( ALLOCATED( var_def_h0 ) ) THEN |
---|
| 2924 | DO m = 1, surf_def_h(0)%ns |
---|
| 2925 | n_surf = n_surf + 1 |
---|
| 2926 | surfaces%var_out(n_surf) = var_def_h0(m) |
---|
| 2927 | ENDDO |
---|
| 2928 | ELSE |
---|
| 2929 | n_surf = n_surf + surf_def_h(0)%ns |
---|
| 2930 | ENDIF |
---|
| 2931 | IF ( ALLOCATED( var_def_h1 ) ) THEN |
---|
| 2932 | DO m = 1, surf_def_h(1)%ns |
---|
| 2933 | n_surf = n_surf + 1 |
---|
| 2934 | surfaces%var_out(n_surf) = var_def_h1(m) |
---|
| 2935 | ENDDO |
---|
| 2936 | ELSE |
---|
| 2937 | n_surf = n_surf + surf_def_h(1)%ns |
---|
| 2938 | ENDIF |
---|
| 2939 | IF ( ALLOCATED( var_lsm_h ) ) THEN |
---|
| 2940 | DO m = 1, surf_lsm_h%ns |
---|
| 2941 | n_surf = n_surf + 1 |
---|
| 2942 | surfaces%var_out(n_surf) = var_lsm_h(m) |
---|
| 2943 | ENDDO |
---|
| 2944 | ELSE |
---|
| 2945 | n_surf = n_surf + surf_lsm_h%ns |
---|
| 2946 | ENDIF |
---|
| 2947 | IF ( ALLOCATED( var_usm_h ) ) THEN |
---|
| 2948 | DO m = 1, surf_usm_h%ns |
---|
| 2949 | n_surf = n_surf + 1 |
---|
| 2950 | surfaces%var_out(n_surf) = var_usm_h(m) |
---|
| 2951 | ENDDO |
---|
| 2952 | ELSE |
---|
| 2953 | n_surf = n_surf + surf_usm_h%ns |
---|
| 2954 | ENDIF |
---|
| 2955 | ! |
---|
| 2956 | !-- Write northward-facing |
---|
| 2957 | IF ( ALLOCATED( var_def_v0 ) ) THEN |
---|
| 2958 | DO m = 1, surf_def_v(0)%ns |
---|
| 2959 | n_surf = n_surf + 1 |
---|
| 2960 | surfaces%var_out(n_surf) = var_def_v0(m) |
---|
| 2961 | ENDDO |
---|
| 2962 | ELSE |
---|
| 2963 | n_surf = n_surf + surf_def_v(0)%ns |
---|
| 2964 | ENDIF |
---|
| 2965 | IF ( ALLOCATED( var_lsm_v0 ) ) THEN |
---|
| 2966 | DO m = 1, surf_lsm_v(0)%ns |
---|
| 2967 | n_surf = n_surf + 1 |
---|
| 2968 | surfaces%var_out(n_surf) = var_lsm_v0(m) |
---|
| 2969 | ENDDO |
---|
| 2970 | ELSE |
---|
| 2971 | n_surf = n_surf + surf_lsm_v(0)%ns |
---|
| 2972 | ENDIF |
---|
| 2973 | IF ( ALLOCATED( var_usm_v0 ) ) THEN |
---|
| 2974 | DO m = 1, surf_usm_v(0)%ns |
---|
| 2975 | n_surf = n_surf + 1 |
---|
| 2976 | surfaces%var_out(n_surf) = var_usm_v0(m) |
---|
| 2977 | ENDDO |
---|
| 2978 | ELSE |
---|
| 2979 | n_surf = n_surf + surf_usm_v(0)%ns |
---|
| 2980 | ENDIF |
---|
| 2981 | ! |
---|
| 2982 | !-- Write southward-facing |
---|
| 2983 | IF ( ALLOCATED( var_def_v1 ) ) THEN |
---|
| 2984 | DO m = 1, surf_def_v(1)%ns |
---|
| 2985 | n_surf = n_surf + 1 |
---|
| 2986 | surfaces%var_out(n_surf) = var_def_v1(m) |
---|
| 2987 | ENDDO |
---|
| 2988 | ELSE |
---|
| 2989 | n_surf = n_surf + surf_def_v(1)%ns |
---|
| 2990 | ENDIF |
---|
| 2991 | IF ( ALLOCATED( var_lsm_v1 ) ) THEN |
---|
| 2992 | DO m = 1, surf_lsm_v(1)%ns |
---|
| 2993 | n_surf = n_surf + 1 |
---|
| 2994 | surfaces%var_out(n_surf) = var_lsm_v1(m) |
---|
| 2995 | ENDDO |
---|
| 2996 | ELSE |
---|
| 2997 | n_surf = n_surf + surf_lsm_v(1)%ns |
---|
| 2998 | ENDIF |
---|
| 2999 | IF ( ALLOCATED( var_usm_v1 ) ) THEN |
---|
| 3000 | DO m = 1, surf_usm_v(1)%ns |
---|
| 3001 | n_surf = n_surf + 1 |
---|
| 3002 | surfaces%var_out(n_surf) = var_usm_v1(m) |
---|
| 3003 | ENDDO |
---|
| 3004 | ELSE |
---|
| 3005 | n_surf = n_surf + surf_usm_v(1)%ns |
---|
| 3006 | ENDIF |
---|
| 3007 | ! |
---|
| 3008 | !-- Write eastward-facing |
---|
| 3009 | IF ( ALLOCATED( var_def_v2 ) ) THEN |
---|
| 3010 | DO m = 1, surf_def_v(2)%ns |
---|
| 3011 | n_surf = n_surf + 1 |
---|
| 3012 | surfaces%var_out(n_surf) = var_def_v2(m) |
---|
| 3013 | ENDDO |
---|
| 3014 | ELSE |
---|
| 3015 | n_surf = n_surf + surf_def_v(2)%ns |
---|
| 3016 | ENDIF |
---|
| 3017 | IF ( ALLOCATED( var_lsm_v2 ) ) THEN |
---|
| 3018 | DO m = 1, surf_lsm_v(2)%ns |
---|
| 3019 | n_surf = n_surf + 1 |
---|
| 3020 | surfaces%var_out(n_surf) = var_lsm_v2(m) |
---|
| 3021 | ENDDO |
---|
| 3022 | ELSE |
---|
| 3023 | n_surf = n_surf + surf_lsm_v(2)%ns |
---|
| 3024 | ENDIF |
---|
| 3025 | IF ( ALLOCATED( var_usm_v2 ) ) THEN |
---|
| 3026 | DO m = 1, surf_usm_v(2)%ns |
---|
| 3027 | n_surf = n_surf + 1 |
---|
| 3028 | surfaces%var_out(n_surf) = var_usm_v2(m) |
---|
| 3029 | ENDDO |
---|
| 3030 | ELSE |
---|
| 3031 | n_surf = n_surf + surf_usm_v(2)%ns |
---|
| 3032 | ENDIF |
---|
| 3033 | ! |
---|
| 3034 | !-- Write westward-facing |
---|
| 3035 | IF ( ALLOCATED( var_def_v3 ) ) THEN |
---|
| 3036 | DO m = 1, surf_def_v(3)%ns |
---|
| 3037 | n_surf = n_surf + 1 |
---|
| 3038 | surfaces%var_out(n_surf) = var_def_v3(m) |
---|
| 3039 | ENDDO |
---|
| 3040 | ELSE |
---|
| 3041 | n_surf = n_surf + surf_def_v(3)%ns |
---|
| 3042 | ENDIF |
---|
| 3043 | IF ( ALLOCATED( var_lsm_v3 ) ) THEN |
---|
| 3044 | DO m = 1, surf_lsm_v(3)%ns |
---|
| 3045 | n_surf = n_surf + 1 |
---|
| 3046 | surfaces%var_out(n_surf) = var_lsm_v3(m) |
---|
| 3047 | ENDDO |
---|
| 3048 | ELSE |
---|
| 3049 | n_surf = n_surf + surf_lsm_v(3)%ns |
---|
| 3050 | ENDIF |
---|
| 3051 | IF ( ALLOCATED( var_usm_v3 ) ) THEN |
---|
| 3052 | DO m = 1, surf_usm_v(3)%ns |
---|
| 3053 | n_surf = n_surf + 1 |
---|
| 3054 | surfaces%var_out(n_surf) = var_usm_v3(m) |
---|
| 3055 | ENDDO |
---|
| 3056 | ELSE |
---|
| 3057 | n_surf = n_surf + surf_usm_v(3)%ns |
---|
| 3058 | ENDIF |
---|
| 3059 | |
---|
| 3060 | END SUBROUTINE surface_output_collect |
---|
| 3061 | |
---|
| 3062 | |
---|
| 3063 | |
---|
| 3064 | ! SUBROUTINE data_output_surf_driver (time) |
---|
| 3065 | ! IMPLICIT NONE |
---|
| 3066 | ! |
---|
| 3067 | ! REAL(kind=wp),INTENT(IN) :: time |
---|
| 3068 | ! CHARACTER(LEN=64) :: filename |
---|
| 3069 | ! INTEGER,SAVE :: file_number=1 |
---|
| 3070 | ! |
---|
| 3071 | ! if(output_mode == "legacy_VTK") then |
---|
| 3072 | ! CALL prepare_vtk_data |
---|
| 3073 | ! |
---|
| 3074 | ! write(filename,'(a,i5.5,a)') 'surface_output_',file_number,'.vtk' |
---|
| 3075 | ! if(myid == surf_io_pe) write(9,*) 'Legacy VTK surface output to file: ',trim(filename) |
---|
| 3076 | ! file_number = file_number+1 |
---|
| 3077 | ! |
---|
| 3078 | ! CALL write_ascii_vtk (filename, time) |
---|
| 3079 | ! END IF |
---|
| 3080 | ! |
---|
| 3081 | ! RETURN |
---|
| 3082 | ! END SUBROUTINE data_output_surf_driver |
---|
| 3083 | |
---|
| 3084 | |
---|
| 3085 | !------------------------------------------------------------------------------! |
---|
| 3086 | ! Description: |
---|
| 3087 | ! ------------ |
---|
| 3088 | !> Parin for output of surface parameters |
---|
| 3089 | !------------------------------------------------------------------------------! |
---|
| 3090 | SUBROUTINE surface_output_parin |
---|
| 3091 | |
---|
| 3092 | USE control_parameters, & |
---|
| 3093 | ONLY: message_string |
---|
| 3094 | |
---|
| 3095 | IMPLICIT NONE |
---|
| 3096 | |
---|
| 3097 | CHARACTER (LEN=80) :: line !< dummy string that contains the current line of the parameter file |
---|
| 3098 | |
---|
| 3099 | |
---|
| 3100 | NAMELIST /surface_output_parameters/ & |
---|
| 3101 | averaging_interval_surf, data_output_surf, & |
---|
| 3102 | dt_dosurf, dt_dosurf_av, & |
---|
| 3103 | skip_time_dosurf, skip_time_dosurf_av |
---|
| 3104 | |
---|
| 3105 | line = ' ' |
---|
| 3106 | |
---|
| 3107 | ! |
---|
| 3108 | !-- Try to find the namelist |
---|
| 3109 | REWIND ( 11 ) |
---|
| 3110 | line = ' ' |
---|
| 3111 | DO WHILE ( INDEX( line, '&surface_output_parameters' ) == 0 ) |
---|
| 3112 | READ ( 11, '(A)', END=14 ) line |
---|
| 3113 | ENDDO |
---|
| 3114 | BACKSPACE ( 11 ) |
---|
| 3115 | |
---|
| 3116 | ! |
---|
| 3117 | !-- Read namelist |
---|
| 3118 | READ ( 11, surface_output_parameters, ERR = 10 ) |
---|
| 3119 | ! |
---|
| 3120 | !-- Set flag that indicates that surface data output is switched on |
---|
| 3121 | surface_data_output = .TRUE. |
---|
| 3122 | GOTO 14 |
---|
| 3123 | |
---|
| 3124 | 10 BACKSPACE( 11 ) |
---|
| 3125 | READ( 11 , '(A)') line |
---|
| 3126 | CALL parin_fail_message( 'surface_output_parameters', line ) |
---|
| 3127 | |
---|
| 3128 | 14 CONTINUE |
---|
| 3129 | |
---|
| 3130 | |
---|
| 3131 | END SUBROUTINE surface_output_parin |
---|
| 3132 | |
---|
| 3133 | |
---|
| 3134 | !------------------------------------------------------------------------------! |
---|
| 3135 | ! Description: |
---|
| 3136 | ! ------------ |
---|
| 3137 | !> Check the input parameters for consistency. Further pre-process the given |
---|
| 3138 | !> output variables, i.e. separate them into average and non-average output |
---|
| 3139 | !> variables and map them onto internal output array. |
---|
| 3140 | !------------------------------------------------------------------------------! |
---|
| 3141 | SUBROUTINE surface_output_check_parameters |
---|
| 3142 | |
---|
| 3143 | USE control_parameters, & |
---|
| 3144 | ONLY: averaging_interval, dt_data_output, dt_data_output_av, & |
---|
| 3145 | message_string, skip_time_data_output, & |
---|
| 3146 | skip_time_data_output_av |
---|
| 3147 | |
---|
| 3148 | IMPLICIT NONE |
---|
| 3149 | |
---|
| 3150 | CHARACTER(LEN=100) :: trimvar !< dummy for single output variable |
---|
| 3151 | |
---|
| 3152 | INTEGER(iwp) :: av !< id indicating average or non-average data output |
---|
| 3153 | INTEGER(iwp) :: ilen !< string length |
---|
| 3154 | INTEGER(iwp) :: n_out !< running index for number of output variables |
---|
| 3155 | |
---|
| 3156 | ! |
---|
| 3157 | !-- Check the average interval |
---|
| 3158 | IF ( averaging_interval_surf == 9999999.9_wp ) THEN |
---|
| 3159 | averaging_interval_surf = averaging_interval |
---|
| 3160 | ENDIF |
---|
| 3161 | ! |
---|
| 3162 | !-- Set the default data-output interval dt_data_output if necessary |
---|
| 3163 | IF ( dt_dosurf == 9999999.9_wp ) dt_dosurf = dt_data_output |
---|
| 3164 | IF ( dt_dosurf_av == 9999999.9_wp ) dt_dosurf_av = dt_data_output |
---|
| 3165 | |
---|
| 3166 | IF ( averaging_interval_surf > dt_dosurf_av ) THEN |
---|
| 3167 | WRITE( message_string, * ) 'averaging_interval_surf = ', & |
---|
| 3168 | averaging_interval_surf, ' must be <= dt_dosurf_av = ', & |
---|
| 3169 | dt_dosurf_av |
---|
| 3170 | CALL message( 'surface_output_check_parameters', & |
---|
| 3171 | 'PA0087', 1, 2, 0, 6, 0 ) |
---|
| 3172 | ENDIF |
---|
| 3173 | |
---|
| 3174 | ! |
---|
| 3175 | !-- Count number of output variables and separate output strings for |
---|
| 3176 | !-- average and non-average output variables. |
---|
| 3177 | n_out = 0 |
---|
| 3178 | DO WHILE ( data_output_surf(n_out+1)(1:1) /= ' ' ) |
---|
| 3179 | |
---|
| 3180 | n_out = n_out + 1 |
---|
| 3181 | ilen = LEN_TRIM( data_output_surf(n_out) ) |
---|
| 3182 | trimvar = TRIM( data_output_surf(n_out) ) |
---|
| 3183 | |
---|
| 3184 | ! |
---|
| 3185 | !-- Check for data averaging |
---|
| 3186 | av = 0 |
---|
| 3187 | IF ( ilen > 3 ) THEN |
---|
| 3188 | IF ( data_output_surf(n_out)(ilen-2:ilen) == '_av' ) THEN |
---|
| 3189 | trimvar = data_output_surf(n_out)(1:ilen-3) |
---|
| 3190 | av = 1 |
---|
| 3191 | ENDIF |
---|
| 3192 | ENDIF |
---|
| 3193 | |
---|
| 3194 | dosurf_no(av) = dosurf_no(av) + 1 |
---|
| 3195 | dosurf(av,dosurf_no(av)) = TRIM( trimvar ) |
---|
| 3196 | |
---|
| 3197 | ! |
---|
| 3198 | !-- Check if all output variables are known |
---|
| 3199 | SELECT CASE ( TRIM( trimvar ) ) |
---|
| 3200 | |
---|
| 3201 | CASE ( 'css', 'cssws', 'qsws_liq', 'qsws_soil', 'qsws_veg' ) |
---|
| 3202 | message_string = TRIM( trimvar ) // & |
---|
| 3203 | ' is not yet implemented in the surface output' |
---|
| 3204 | CALL message( 'surface_output_check_parameters', & |
---|
| 3205 | 'PA0087', 1, 2, 0, 6, 0 ) |
---|
| 3206 | |
---|
| 3207 | CASE ( 'us', 'ts', 'qs', 'ss', 'qcs', 'ncs', 'qrs', 'nrs', 'ol' ) |
---|
| 3208 | |
---|
| 3209 | CASE ( 'z0', 'z0h', 'z0q' ) |
---|
| 3210 | |
---|
| 3211 | CASE ( 'theta1', 'qv1', 'thetav1' ) |
---|
| 3212 | |
---|
| 3213 | CASE ( 'usws', 'vsws' ) |
---|
| 3214 | |
---|
| 3215 | CASE ( 'qcsws', 'ncsws', 'qrsws', 'nrsws', 'sasws' ) |
---|
| 3216 | |
---|
| 3217 | CASE ( 'shf', 'qsws', 'ssws' ) |
---|
| 3218 | |
---|
| 3219 | CASE ( 'q_surface', 'theta_surface', 'thetav_surface' ) |
---|
| 3220 | |
---|
| 3221 | CASE ( 'rad_net' ) |
---|
| 3222 | |
---|
| 3223 | CASE ( 'rad_lw_in', 'rad_lw_out', 'rad_sw_in', 'rad_sw_out' ) |
---|
| 3224 | |
---|
| 3225 | CASE ( 'ghf' ) |
---|
| 3226 | |
---|
| 3227 | CASE ( 'r_a', 'r_canopy', 'r_soil', 'r_s' ) |
---|
| 3228 | |
---|
| 3229 | CASE DEFAULT |
---|
| 3230 | message_string = TRIM( trimvar ) // & |
---|
| 3231 | ' is not part of the surface output' |
---|
| 3232 | CALL message( 'surface_output_check_parameters', & |
---|
| 3233 | 'PA0087', 1, 2, 0, 6, 0 ) |
---|
| 3234 | END SELECT |
---|
| 3235 | |
---|
| 3236 | ENDDO |
---|
| 3237 | |
---|
| 3238 | END SUBROUTINE surface_output_check_parameters |
---|
| 3239 | |
---|
| 3240 | !--Private Subroutines (Only called from tinside his module) |
---|
| 3241 | |
---|
| 3242 | |
---|
| 3243 | |
---|
| 3244 | ! SUBROUTINE write_ascii_vtk (filename,time) |
---|
| 3245 | ! IMPLICIT NONE |
---|
| 3246 | ! CHARACTER(LEN=*),INTENT(IN) :: filename |
---|
| 3247 | ! REAL(kind=wp),INTENT(IN) :: time |
---|
| 3248 | ! |
---|
| 3249 | ! INTEGER :: file_id=251 |
---|
| 3250 | ! INTEGER :: n |
---|
| 3251 | ! |
---|
| 3252 | ! IF(myid == surf_io_pe) then |
---|
| 3253 | ! open(file_id,file=TRIM(filename)) ! Please use check_open in the final version |
---|
| 3254 | ! |
---|
| 3255 | ! write(file_id,'(a)') "# vtk DataFile Version 3.0" |
---|
| 3256 | ! write(file_id,'(a,f8.2,a)') "legacy vtk File generated by PALM, simulation time = ",time," sec" |
---|
| 3257 | ! write(file_id,'(a)') "ASCII" |
---|
| 3258 | ! |
---|
| 3259 | ! write(file_id,'(a)') "DATASET POLYDATA" |
---|
| 3260 | ! write(file_id,'(a,i5,a)') "POINTS ",npo," float" |
---|
| 3261 | ! do n=1,npo |
---|
| 3262 | ! write (file_id,'(8f10.1)') points(1:3,n) |
---|
| 3263 | ! end do |
---|
| 3264 | ! |
---|
| 3265 | ! write(file_id,'(a,8i10)') "POLYGONS ",npg, 5*npg |
---|
| 3266 | ! do n=1,npg |
---|
| 3267 | ! write(file_id,'(8i10)') polygons(:,n) |
---|
| 3268 | ! end do |
---|
| 3269 | ! |
---|
| 3270 | ! write(file_id,'(a,i10)') "CELL_DATA ",npg |
---|
| 3271 | ! write(file_id,'(a,i10)') "SCALARS cell_scalars float 1 " |
---|
| 3272 | ! write(file_id,'(a,i10)') "LOOKUP_TABLE default " |
---|
| 3273 | ! |
---|
| 3274 | ! do n=1,npg |
---|
| 3275 | ! write(file_id,'(f10.2)') cell_scalars(n) |
---|
| 3276 | ! end do |
---|
| 3277 | ! |
---|
| 3278 | ! close (file_id) |
---|
| 3279 | ! |
---|
| 3280 | ! DEALLOCATE (points,polygons,cell_scalars) |
---|
| 3281 | ! ENDIF |
---|
| 3282 | ! |
---|
| 3283 | ! RETURN |
---|
| 3284 | ! END SUBROUTINE write_ascii_vtk |
---|
| 3285 | |
---|
| 3286 | END MODULE surface_output_mod |
---|