[1] | 1 | SUBROUTINE data_output_2d( mode, av ) |
---|
| 2 | |
---|
[1036] | 3 | !--------------------------------------------------------------------------------! |
---|
| 4 | ! This file is part of PALM. |
---|
| 5 | ! |
---|
| 6 | ! PALM is free software: you can redistribute it and/or modify it under the terms |
---|
| 7 | ! of the GNU General Public License as published by the Free Software Foundation, |
---|
| 8 | ! either version 3 of the License, or (at your option) any later 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-2012 Leibniz University Hannover |
---|
| 18 | !--------------------------------------------------------------------------------! |
---|
| 19 | ! |
---|
[254] | 20 | ! Current revisions: |
---|
[1] | 21 | ! ----------------- |
---|
[674] | 22 | ! |
---|
[392] | 23 | ! Former revisions: |
---|
| 24 | ! ----------------- |
---|
| 25 | ! $Id: data_output_2d.f90 1066 2012-11-22 17:52:43Z maronga $ |
---|
| 26 | ! |
---|
[1066] | 27 | ! 1065 2012-11-22 17:42:36Z hoffmann |
---|
| 28 | ! Bugfix: Output of cross sections of ql |
---|
| 29 | ! |
---|
[1054] | 30 | ! 1053 2012-11-13 17:11:03Z hoffmann |
---|
| 31 | ! +qr, nr, qc and cross sections |
---|
| 32 | ! |
---|
[1037] | 33 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 34 | ! code put under GPL (PALM 3.9) |
---|
| 35 | ! |
---|
[1035] | 36 | ! 1031 2012-10-19 14:35:30Z raasch |
---|
| 37 | ! netCDF4 without parallel file support implemented |
---|
| 38 | ! |
---|
[1008] | 39 | ! 1007 2012-09-19 14:30:36Z franke |
---|
| 40 | ! Bugfix: missing calculation of ql_vp added |
---|
| 41 | ! |
---|
[979] | 42 | ! 978 2012-08-09 08:28:32Z fricke |
---|
| 43 | ! +z0h |
---|
| 44 | ! |
---|
[791] | 45 | ! 790 2011-11-29 03:11:20Z raasch |
---|
| 46 | ! bugfix: calculation of 'pr' must depend on the particle weighting factor |
---|
| 47 | ! |
---|
[772] | 48 | ! 771 2011-10-27 10:56:21Z heinze |
---|
| 49 | ! +lpt |
---|
| 50 | ! |
---|
[760] | 51 | ! 759 2011-09-15 13:58:31Z raasch |
---|
| 52 | ! Splitting of parallel I/O |
---|
| 53 | ! |
---|
[730] | 54 | ! 729 2011-05-26 10:33:34Z heinze |
---|
| 55 | ! Exchange ghost layers for p regardless of used pressure solver (except SOR). |
---|
| 56 | ! |
---|
[692] | 57 | ! 691 2011-03-04 08:45:30Z maronga |
---|
| 58 | ! Replaced simulated_time by time_since_reference_point |
---|
| 59 | ! |
---|
[674] | 60 | ! 673 2011-01-18 16:19:48Z suehring |
---|
| 61 | ! When using Multigrid or SOR solver an additional CALL exchange_horiz is |
---|
| 62 | ! is needed for pressure output. |
---|
| 63 | ! |
---|
[668] | 64 | ! 667 2010-12-23 12:06:00Z suehring/gryschka |
---|
| 65 | ! nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng in loops and |
---|
| 66 | ! allocation of arrays local_2d and total_2d. |
---|
| 67 | ! Calls of exchange_horiz are modiefied. |
---|
| 68 | ! |
---|
[623] | 69 | ! 622 2010-12-10 08:08:13Z raasch |
---|
| 70 | ! optional barriers included in order to speed up collective operations |
---|
| 71 | ! |
---|
[494] | 72 | ! 493 2010-03-01 08:30:24Z raasch |
---|
[1031] | 73 | ! netCDF4 support (parallel output) |
---|
[494] | 74 | ! |
---|
[392] | 75 | ! 367 2009-08-25 08:35:52Z maronga |
---|
[1031] | 76 | ! simulated_time in netCDF output replaced by time_since_reference_point. |
---|
| 77 | ! Output of netCDF messages with aid of message handling routine. |
---|
[336] | 78 | ! Bugfix: averaging along z is not allowed for 2d quantities (e.g. u* and z0) |
---|
[254] | 79 | ! Output of messages replaced by message handling routine. |
---|
[343] | 80 | ! Output of user defined 2D (XY) arrays at z=nzb+1 is now possible |
---|
[355] | 81 | ! Bugfix: to_be_resorted => s_av for time-averaged scalars |
---|
[367] | 82 | ! Calculation of shf* and qsws* added. |
---|
[1] | 83 | ! |
---|
[226] | 84 | ! 215 2008-11-18 09:54:31Z raasch |
---|
| 85 | ! Bugfix: no output of particle concentration and radius unless particles |
---|
| 86 | ! have been started |
---|
| 87 | ! |
---|
[98] | 88 | ! 96 2007-06-04 08:07:41Z raasch |
---|
| 89 | ! Output of density and salinity |
---|
| 90 | ! |
---|
[77] | 91 | ! 75 2007-03-22 09:54:05Z raasch |
---|
| 92 | ! Output of precipitation amount/rate and roughness length, |
---|
| 93 | ! 2nd+3rd argument removed from exchange horiz |
---|
| 94 | ! |
---|
[3] | 95 | ! RCS Log replace by Id keyword, revision history cleaned up |
---|
| 96 | ! |
---|
[1] | 97 | ! Revision 1.5 2006/08/22 13:50:29 raasch |
---|
| 98 | ! xz and yz cross sections now up to nzt+1 |
---|
| 99 | ! |
---|
| 100 | ! Revision 1.2 2006/02/23 10:19:22 raasch |
---|
| 101 | ! Output of time-averaged data, output of averages along x, y, or z, |
---|
| 102 | ! output of user-defined quantities, |
---|
| 103 | ! section data are copied from local_pf to local_2d before they are output, |
---|
| 104 | ! output of particle concentration and mean radius, |
---|
| 105 | ! Former subroutine plot_2d renamed data_output_2d, pl2d.. renamed do2d.., |
---|
| 106 | ! anz renamed ngp, ebene renamed section, pl2d_.._anz renamed do2d_.._n |
---|
| 107 | ! |
---|
| 108 | ! Revision 1.1 1997/08/11 06:24:09 raasch |
---|
| 109 | ! Initial revision |
---|
| 110 | ! |
---|
| 111 | ! |
---|
| 112 | ! Description: |
---|
| 113 | ! ------------ |
---|
[1031] | 114 | ! Data output of horizontal cross-sections in netCDF format or binary format |
---|
[1] | 115 | ! compatible to old graphic software iso2d. |
---|
| 116 | ! Attention: The position of the sectional planes is still not always computed |
---|
| 117 | ! --------- correctly. (zu is used always)! |
---|
| 118 | !------------------------------------------------------------------------------! |
---|
| 119 | |
---|
| 120 | USE arrays_3d |
---|
| 121 | USE averaging |
---|
| 122 | USE cloud_parameters |
---|
| 123 | USE control_parameters |
---|
| 124 | USE cpulog |
---|
| 125 | USE grid_variables |
---|
| 126 | USE indices |
---|
| 127 | USE interfaces |
---|
| 128 | USE netcdf_control |
---|
| 129 | USE particle_attributes |
---|
| 130 | USE pegrid |
---|
| 131 | |
---|
| 132 | IMPLICIT NONE |
---|
| 133 | |
---|
| 134 | CHARACTER (LEN=2) :: do2d_mode, mode |
---|
| 135 | CHARACTER (LEN=4) :: grid |
---|
| 136 | CHARACTER (LEN=25) :: section_chr |
---|
| 137 | CHARACTER (LEN=50) :: rtext |
---|
[493] | 138 | INTEGER :: av, ngp, file_id, i, if, is, iis, j, k, l, layer_xy, n, psi, & |
---|
[559] | 139 | s, sender, & |
---|
[1] | 140 | ind(4) |
---|
| 141 | LOGICAL :: found, resorted, two_d |
---|
| 142 | REAL :: mean_r, s_r3, s_r4 |
---|
| 143 | REAL, DIMENSION(:), ALLOCATABLE :: level_z |
---|
| 144 | REAL, DIMENSION(:,:), ALLOCATABLE :: local_2d, local_2d_l |
---|
| 145 | REAL, DIMENSION(:,:,:), ALLOCATABLE :: local_pf |
---|
| 146 | #if defined( __parallel ) |
---|
| 147 | REAL, DIMENSION(:,:), ALLOCATABLE :: total_2d |
---|
| 148 | #endif |
---|
| 149 | REAL, DIMENSION(:,:,:), POINTER :: to_be_resorted |
---|
| 150 | |
---|
| 151 | NAMELIST /LOCAL/ rtext |
---|
| 152 | |
---|
| 153 | CALL cpu_log (log_point(3),'data_output_2d','start') |
---|
| 154 | |
---|
| 155 | ! |
---|
| 156 | !-- Immediate return, if no output is requested (no respective sections |
---|
| 157 | !-- found in parameter data_output) |
---|
| 158 | IF ( mode == 'xy' .AND. .NOT. data_output_xy(av) ) RETURN |
---|
| 159 | IF ( mode == 'xz' .AND. .NOT. data_output_xz(av) ) RETURN |
---|
| 160 | IF ( mode == 'yz' .AND. .NOT. data_output_yz(av) ) RETURN |
---|
| 161 | |
---|
| 162 | two_d = .FALSE. ! local variable to distinguish between output of pure 2D |
---|
| 163 | ! arrays and cross-sections of 3D arrays. |
---|
| 164 | |
---|
| 165 | ! |
---|
| 166 | !-- Depending on the orientation of the cross-section, the respective output |
---|
| 167 | !-- files have to be opened. |
---|
| 168 | SELECT CASE ( mode ) |
---|
| 169 | |
---|
| 170 | CASE ( 'xy' ) |
---|
| 171 | s = 1 |
---|
[667] | 172 | ALLOCATE( level_z(nzb:nzt+1), local_2d(nxlg:nxrg,nysg:nyng) ) |
---|
[1] | 173 | |
---|
[493] | 174 | ! |
---|
[1031] | 175 | !-- Parallel netCDF4/HDF5 output is done on all PEs, all other on PE0 only |
---|
| 176 | IF ( netcdf_output .AND. ( myid == 0 .OR. netcdf_data_format > 4 ) ) & |
---|
[493] | 177 | THEN |
---|
| 178 | CALL check_open( 101+av*10 ) |
---|
| 179 | ENDIF |
---|
[1] | 180 | |
---|
| 181 | IF ( data_output_2d_on_each_pe ) THEN |
---|
| 182 | CALL check_open( 21 ) |
---|
| 183 | ELSE |
---|
| 184 | IF ( myid == 0 ) THEN |
---|
| 185 | IF ( iso2d_output ) CALL check_open( 21 ) |
---|
| 186 | #if defined( __parallel ) |
---|
[667] | 187 | ALLOCATE( total_2d(-nbgp:nx+nbgp,-nbgp:ny+nbgp) ) |
---|
[1] | 188 | #endif |
---|
| 189 | ENDIF |
---|
| 190 | ENDIF |
---|
| 191 | |
---|
| 192 | CASE ( 'xz' ) |
---|
| 193 | s = 2 |
---|
[667] | 194 | ALLOCATE( local_2d(nxlg:nxrg,nzb:nzt+1) ) |
---|
[1] | 195 | |
---|
[493] | 196 | ! |
---|
[1031] | 197 | !-- Parallel netCDF4/HDF5 output is done on all PEs, all other on PE0 only |
---|
| 198 | IF ( netcdf_output .AND. ( myid == 0 .OR. netcdf_data_format > 4 ) ) & |
---|
[493] | 199 | THEN |
---|
| 200 | CALL check_open( 102+av*10 ) |
---|
| 201 | ENDIF |
---|
[1] | 202 | |
---|
| 203 | IF ( data_output_2d_on_each_pe ) THEN |
---|
| 204 | CALL check_open( 22 ) |
---|
| 205 | ELSE |
---|
| 206 | IF ( myid == 0 ) THEN |
---|
| 207 | IF ( iso2d_output ) CALL check_open( 22 ) |
---|
| 208 | #if defined( __parallel ) |
---|
[667] | 209 | ALLOCATE( total_2d(-nbgp:nx+nbgp,nzb:nzt+1) ) |
---|
[1] | 210 | #endif |
---|
| 211 | ENDIF |
---|
| 212 | ENDIF |
---|
| 213 | |
---|
| 214 | CASE ( 'yz' ) |
---|
| 215 | |
---|
| 216 | s = 3 |
---|
[667] | 217 | ALLOCATE( local_2d(nysg:nyng,nzb:nzt+1) ) |
---|
[1] | 218 | |
---|
[493] | 219 | ! |
---|
[1031] | 220 | !-- Parallel netCDF4/HDF5 output is done on all PEs, all other on PE0 only |
---|
| 221 | IF ( netcdf_output .AND. ( myid == 0 .OR. netcdf_data_format > 4 ) ) & |
---|
[493] | 222 | THEN |
---|
| 223 | CALL check_open( 103+av*10 ) |
---|
| 224 | ENDIF |
---|
[1] | 225 | |
---|
| 226 | IF ( data_output_2d_on_each_pe ) THEN |
---|
| 227 | CALL check_open( 23 ) |
---|
| 228 | ELSE |
---|
| 229 | IF ( myid == 0 ) THEN |
---|
| 230 | IF ( iso2d_output ) CALL check_open( 23 ) |
---|
| 231 | #if defined( __parallel ) |
---|
[667] | 232 | ALLOCATE( total_2d(-nbgp:ny+nbgp,nzb:nzt+1) ) |
---|
[1] | 233 | #endif |
---|
| 234 | ENDIF |
---|
| 235 | ENDIF |
---|
| 236 | |
---|
| 237 | CASE DEFAULT |
---|
| 238 | |
---|
[254] | 239 | message_string = 'unknown cross-section: ' // TRIM( mode ) |
---|
| 240 | CALL message( 'data_output_2d', 'PA0180', 1, 2, 0, 6, 0 ) |
---|
[1] | 241 | |
---|
| 242 | END SELECT |
---|
| 243 | |
---|
| 244 | ! |
---|
| 245 | !-- Allocate a temporary array for resorting (kji -> ijk). |
---|
[667] | 246 | ALLOCATE( local_pf(nxlg:nxrg,nysg:nyng,nzb:nzt+1) ) |
---|
[1] | 247 | |
---|
| 248 | ! |
---|
| 249 | !-- Loop of all variables to be written. |
---|
| 250 | !-- Output dimensions chosen |
---|
| 251 | if = 1 |
---|
| 252 | l = MAX( 2, LEN_TRIM( do2d(av,if) ) ) |
---|
| 253 | do2d_mode = do2d(av,if)(l-1:l) |
---|
| 254 | |
---|
| 255 | DO WHILE ( do2d(av,if)(1:1) /= ' ' ) |
---|
| 256 | |
---|
| 257 | IF ( do2d_mode == mode ) THEN |
---|
| 258 | ! |
---|
| 259 | !-- Store the array chosen on the temporary array. |
---|
| 260 | resorted = .FALSE. |
---|
| 261 | SELECT CASE ( TRIM( do2d(av,if) ) ) |
---|
| 262 | |
---|
| 263 | CASE ( 'e_xy', 'e_xz', 'e_yz' ) |
---|
| 264 | IF ( av == 0 ) THEN |
---|
| 265 | to_be_resorted => e |
---|
| 266 | ELSE |
---|
| 267 | to_be_resorted => e_av |
---|
| 268 | ENDIF |
---|
| 269 | IF ( mode == 'xy' ) level_z = zu |
---|
| 270 | |
---|
[771] | 271 | CASE ( 'lpt_xy', 'lpt_xz', 'lpt_yz' ) |
---|
| 272 | IF ( av == 0 ) THEN |
---|
| 273 | to_be_resorted => pt |
---|
| 274 | ELSE |
---|
| 275 | to_be_resorted => lpt_av |
---|
| 276 | ENDIF |
---|
| 277 | IF ( mode == 'xy' ) level_z = zu |
---|
| 278 | |
---|
[1] | 279 | CASE ( 'lwp*_xy' ) ! 2d-array |
---|
| 280 | IF ( av == 0 ) THEN |
---|
[667] | 281 | DO i = nxlg, nxrg |
---|
| 282 | DO j = nysg, nyng |
---|
[1] | 283 | local_pf(i,j,nzb+1) = SUM( ql(nzb:nzt,j,i) * & |
---|
| 284 | dzw(1:nzt+1) ) |
---|
| 285 | ENDDO |
---|
| 286 | ENDDO |
---|
| 287 | ELSE |
---|
[667] | 288 | DO i = nxlg, nxrg |
---|
| 289 | DO j = nysg, nyng |
---|
[1] | 290 | local_pf(i,j,nzb+1) = lwp_av(j,i) |
---|
| 291 | ENDDO |
---|
| 292 | ENDDO |
---|
| 293 | ENDIF |
---|
| 294 | resorted = .TRUE. |
---|
| 295 | two_d = .TRUE. |
---|
| 296 | level_z(nzb+1) = zu(nzb+1) |
---|
| 297 | |
---|
[1053] | 298 | CASE ( 'nr_xy', 'nr_xz', 'nr_yz' ) |
---|
| 299 | IF ( av == 0 ) THEN |
---|
| 300 | to_be_resorted => nr |
---|
| 301 | ELSE |
---|
| 302 | to_be_resorted => nr_av |
---|
| 303 | ENDIF |
---|
| 304 | IF ( mode == 'xy' ) level_z = zu |
---|
| 305 | |
---|
[1] | 306 | CASE ( 'p_xy', 'p_xz', 'p_yz' ) |
---|
| 307 | IF ( av == 0 ) THEN |
---|
[729] | 308 | IF ( psolver /= 'sor' ) CALL exchange_horiz( p, nbgp ) |
---|
[1] | 309 | to_be_resorted => p |
---|
| 310 | ELSE |
---|
[729] | 311 | IF ( psolver /= 'sor' ) CALL exchange_horiz( p_av, nbgp ) |
---|
[1] | 312 | to_be_resorted => p_av |
---|
| 313 | ENDIF |
---|
| 314 | IF ( mode == 'xy' ) level_z = zu |
---|
| 315 | |
---|
| 316 | CASE ( 'pc_xy', 'pc_xz', 'pc_yz' ) ! particle concentration |
---|
| 317 | IF ( av == 0 ) THEN |
---|
[215] | 318 | IF ( simulated_time >= particle_advection_start ) THEN |
---|
| 319 | tend = prt_count |
---|
[667] | 320 | CALL exchange_horiz( tend, nbgp ) |
---|
[215] | 321 | ELSE |
---|
| 322 | tend = 0.0 |
---|
| 323 | ENDIF |
---|
[667] | 324 | DO i = nxlg, nxrg |
---|
| 325 | DO j = nysg, nyng |
---|
[1] | 326 | DO k = nzb, nzt+1 |
---|
| 327 | local_pf(i,j,k) = tend(k,j,i) |
---|
| 328 | ENDDO |
---|
| 329 | ENDDO |
---|
| 330 | ENDDO |
---|
| 331 | resorted = .TRUE. |
---|
| 332 | ELSE |
---|
[667] | 333 | CALL exchange_horiz( pc_av, nbgp ) |
---|
[1] | 334 | to_be_resorted => pc_av |
---|
| 335 | ENDIF |
---|
| 336 | |
---|
| 337 | CASE ( 'pr_xy', 'pr_xz', 'pr_yz' ) ! mean particle radius |
---|
| 338 | IF ( av == 0 ) THEN |
---|
[215] | 339 | IF ( simulated_time >= particle_advection_start ) THEN |
---|
| 340 | DO i = nxl, nxr |
---|
| 341 | DO j = nys, nyn |
---|
| 342 | DO k = nzb, nzt+1 |
---|
| 343 | psi = prt_start_index(k,j,i) |
---|
| 344 | s_r3 = 0.0 |
---|
| 345 | s_r4 = 0.0 |
---|
| 346 | DO n = psi, psi+prt_count(k,j,i)-1 |
---|
[790] | 347 | s_r3 = s_r3 + particles(n)%radius**3 * & |
---|
| 348 | particles(n)%weight_factor |
---|
| 349 | s_r4 = s_r4 + particles(n)%radius**4 * & |
---|
| 350 | particles(n)%weight_factor |
---|
[215] | 351 | ENDDO |
---|
| 352 | IF ( s_r3 /= 0.0 ) THEN |
---|
| 353 | mean_r = s_r4 / s_r3 |
---|
| 354 | ELSE |
---|
| 355 | mean_r = 0.0 |
---|
| 356 | ENDIF |
---|
| 357 | tend(k,j,i) = mean_r |
---|
[1] | 358 | ENDDO |
---|
| 359 | ENDDO |
---|
| 360 | ENDDO |
---|
[667] | 361 | CALL exchange_horiz( tend, nbgp ) |
---|
[215] | 362 | ELSE |
---|
| 363 | tend = 0.0 |
---|
[667] | 364 | END IF |
---|
| 365 | DO i = nxlg, nxrg |
---|
| 366 | DO j = nysg, nyng |
---|
[1] | 367 | DO k = nzb, nzt+1 |
---|
| 368 | local_pf(i,j,k) = tend(k,j,i) |
---|
| 369 | ENDDO |
---|
| 370 | ENDDO |
---|
| 371 | ENDDO |
---|
| 372 | resorted = .TRUE. |
---|
| 373 | ELSE |
---|
[667] | 374 | CALL exchange_horiz( pr_av, nbgp ) |
---|
[1] | 375 | to_be_resorted => pr_av |
---|
| 376 | ENDIF |
---|
| 377 | |
---|
[72] | 378 | CASE ( 'pra*_xy' ) ! 2d-array / integral quantity => no av |
---|
| 379 | CALL exchange_horiz_2d( precipitation_amount ) |
---|
[667] | 380 | DO i = nxlg, nxrg |
---|
| 381 | DO j = nysg, nyng |
---|
[72] | 382 | local_pf(i,j,nzb+1) = precipitation_amount(j,i) |
---|
| 383 | ENDDO |
---|
| 384 | ENDDO |
---|
| 385 | precipitation_amount = 0.0 ! reset for next integ. interval |
---|
| 386 | resorted = .TRUE. |
---|
| 387 | two_d = .TRUE. |
---|
| 388 | level_z(nzb+1) = zu(nzb+1) |
---|
| 389 | |
---|
| 390 | CASE ( 'prr*_xy' ) ! 2d-array |
---|
[1053] | 391 | IF ( icloud_scheme == 1 ) THEN |
---|
| 392 | IF ( av == 0 ) THEN |
---|
| 393 | CALL exchange_horiz_2d( precipitation_rate ) |
---|
| 394 | DO i = nxlg, nxrg |
---|
| 395 | DO j = nysg, nyng |
---|
| 396 | local_pf(i,j,nzb+1) = precipitation_rate(j,i) |
---|
| 397 | ENDDO |
---|
| 398 | ENDDO |
---|
| 399 | ELSE |
---|
| 400 | CALL exchange_horiz_2d( precipitation_rate_av ) |
---|
| 401 | DO i = nxlg, nxrg |
---|
| 402 | DO j = nysg, nyng |
---|
| 403 | local_pf(i,j,nzb+1) = precipitation_rate_av(j,i) |
---|
| 404 | ENDDO |
---|
| 405 | ENDDO |
---|
| 406 | ENDIF |
---|
| 407 | ELSE |
---|
| 408 | IF ( av == 0 ) THEN |
---|
| 409 | CALL exchange_horiz_2d( prr(nzb+1,:,:) ) |
---|
| 410 | DO i = nxlg, nxrg |
---|
| 411 | DO j = nysg, nyng |
---|
| 412 | local_pf(i,j,nzb+1) = prr(nzb+1,j,i) * hyrho(nzb+1) |
---|
| 413 | ENDDO |
---|
| 414 | ENDDO |
---|
| 415 | ELSE |
---|
| 416 | CALL exchange_horiz_2d( prr_av(nzb+1,:,:) ) |
---|
| 417 | DO i = nxlg, nxrg |
---|
| 418 | DO j = nysg, nyng |
---|
| 419 | local_pf(i,j,nzb+1) = prr_av(nzb+1,j,i) * hyrho(nzb+1) |
---|
| 420 | ENDDO |
---|
| 421 | ENDDO |
---|
| 422 | ENDIF |
---|
| 423 | ENDIF |
---|
| 424 | resorted = .TRUE. |
---|
| 425 | two_d = .TRUE. |
---|
| 426 | level_z(nzb+1) = zu(nzb+1) |
---|
| 427 | |
---|
| 428 | CASE ( 'prr_xy', 'prr_xz', 'prr_yz' ) |
---|
[72] | 429 | IF ( av == 0 ) THEN |
---|
[1053] | 430 | CALL exchange_horiz( prr, nbgp ) |
---|
[667] | 431 | DO i = nxlg, nxrg |
---|
| 432 | DO j = nysg, nyng |
---|
[1053] | 433 | DO k = nzb, nzt+1 |
---|
| 434 | local_pf(i,j,k) = prr(k,j,i) |
---|
| 435 | ENDDO |
---|
[72] | 436 | ENDDO |
---|
| 437 | ENDDO |
---|
| 438 | ELSE |
---|
[1053] | 439 | CALL exchange_horiz( prr_av, nbgp ) |
---|
[667] | 440 | DO i = nxlg, nxrg |
---|
| 441 | DO j = nysg, nyng |
---|
[1053] | 442 | DO k = nzb, nzt+1 |
---|
| 443 | local_pf(i,j,k) = prr_av(k,j,i) |
---|
| 444 | ENDDO |
---|
[72] | 445 | ENDDO |
---|
| 446 | ENDDO |
---|
| 447 | ENDIF |
---|
| 448 | resorted = .TRUE. |
---|
[1053] | 449 | IF ( mode == 'xy' ) level_z = zu |
---|
[72] | 450 | |
---|
[1] | 451 | CASE ( 'pt_xy', 'pt_xz', 'pt_yz' ) |
---|
| 452 | IF ( av == 0 ) THEN |
---|
| 453 | IF ( .NOT. cloud_physics ) THEN |
---|
| 454 | to_be_resorted => pt |
---|
| 455 | ELSE |
---|
[667] | 456 | DO i = nxlg, nxrg |
---|
| 457 | DO j = nysg, nyng |
---|
[1] | 458 | DO k = nzb, nzt+1 |
---|
| 459 | local_pf(i,j,k) = pt(k,j,i) + l_d_cp * & |
---|
| 460 | pt_d_t(k) * & |
---|
| 461 | ql(k,j,i) |
---|
| 462 | ENDDO |
---|
| 463 | ENDDO |
---|
| 464 | ENDDO |
---|
| 465 | resorted = .TRUE. |
---|
| 466 | ENDIF |
---|
| 467 | ELSE |
---|
| 468 | to_be_resorted => pt_av |
---|
| 469 | ENDIF |
---|
| 470 | IF ( mode == 'xy' ) level_z = zu |
---|
| 471 | |
---|
| 472 | CASE ( 'q_xy', 'q_xz', 'q_yz' ) |
---|
| 473 | IF ( av == 0 ) THEN |
---|
| 474 | to_be_resorted => q |
---|
| 475 | ELSE |
---|
| 476 | to_be_resorted => q_av |
---|
| 477 | ENDIF |
---|
| 478 | IF ( mode == 'xy' ) level_z = zu |
---|
| 479 | |
---|
[1053] | 480 | CASE ( 'qc_xy', 'qc_xz', 'qc_yz' ) |
---|
[1] | 481 | IF ( av == 0 ) THEN |
---|
| 482 | to_be_resorted => ql |
---|
| 483 | ELSE |
---|
| 484 | to_be_resorted => ql_av |
---|
| 485 | ENDIF |
---|
| 486 | IF ( mode == 'xy' ) level_z = zu |
---|
| 487 | |
---|
[1053] | 488 | CASE ( 'ql_xy', 'ql_xz', 'ql_yz' ) |
---|
| 489 | IF ( av == 0 ) THEN |
---|
| 490 | IF ( icloud_scheme == 0 ) THEN |
---|
| 491 | DO i = nxlg, nxrg |
---|
| 492 | DO j = nysg, nyng |
---|
[1065] | 493 | DO k = nzb, nzt+1 |
---|
[1053] | 494 | local_pf(i,j,k) = ql(k,j,i) + qr(k,j,i) |
---|
| 495 | ENDDO |
---|
| 496 | ENDDO |
---|
| 497 | ENDDO |
---|
| 498 | resorted = .TRUE. |
---|
| 499 | ELSE |
---|
| 500 | to_be_resorted => ql |
---|
| 501 | ENDIF |
---|
| 502 | ELSE |
---|
| 503 | IF ( icloud_scheme == 0 ) THEN |
---|
| 504 | DO i = nxlg, nxrg |
---|
| 505 | DO j = nysg, nyng |
---|
[1065] | 506 | DO k = nzb, nzt+1 |
---|
[1053] | 507 | local_pf(i,j,k) = ql_av(k,j,i) + qr_av(k,j,i) |
---|
| 508 | ENDDO |
---|
| 509 | ENDDO |
---|
| 510 | ENDDO |
---|
| 511 | resorted = .TRUE. |
---|
| 512 | ELSE |
---|
| 513 | to_be_resorted => ql_av |
---|
| 514 | ENDIF |
---|
| 515 | ENDIF |
---|
| 516 | IF ( mode == 'xy' ) level_z = zu |
---|
| 517 | |
---|
[1] | 518 | CASE ( 'ql_c_xy', 'ql_c_xz', 'ql_c_yz' ) |
---|
| 519 | IF ( av == 0 ) THEN |
---|
| 520 | to_be_resorted => ql_c |
---|
| 521 | ELSE |
---|
| 522 | to_be_resorted => ql_c_av |
---|
| 523 | ENDIF |
---|
| 524 | IF ( mode == 'xy' ) level_z = zu |
---|
| 525 | |
---|
| 526 | CASE ( 'ql_v_xy', 'ql_v_xz', 'ql_v_yz' ) |
---|
| 527 | IF ( av == 0 ) THEN |
---|
| 528 | to_be_resorted => ql_v |
---|
| 529 | ELSE |
---|
| 530 | to_be_resorted => ql_v_av |
---|
| 531 | ENDIF |
---|
| 532 | IF ( mode == 'xy' ) level_z = zu |
---|
| 533 | |
---|
| 534 | CASE ( 'ql_vp_xy', 'ql_vp_xz', 'ql_vp_yz' ) |
---|
| 535 | IF ( av == 0 ) THEN |
---|
[1007] | 536 | IF ( simulated_time >= particle_advection_start ) THEN |
---|
| 537 | DO i = nxl, nxr |
---|
| 538 | DO j = nys, nyn |
---|
| 539 | DO k = nzb, nzt+1 |
---|
| 540 | psi = prt_start_index(k,j,i) |
---|
| 541 | DO n = psi, psi+prt_count(k,j,i)-1 |
---|
| 542 | tend(k,j,i) = tend(k,j,i) + & |
---|
| 543 | particles(n)%weight_factor / & |
---|
| 544 | prt_count(k,j,i) |
---|
| 545 | ENDDO |
---|
| 546 | ENDDO |
---|
| 547 | ENDDO |
---|
| 548 | ENDDO |
---|
| 549 | CALL exchange_horiz( tend, nbgp ) |
---|
| 550 | ELSE |
---|
| 551 | tend = 0.0 |
---|
| 552 | END IF |
---|
| 553 | DO i = nxlg, nxrg |
---|
| 554 | DO j = nysg, nyng |
---|
| 555 | DO k = nzb, nzt+1 |
---|
| 556 | local_pf(i,j,k) = tend(k,j,i) |
---|
| 557 | ENDDO |
---|
| 558 | ENDDO |
---|
| 559 | ENDDO |
---|
| 560 | resorted = .TRUE. |
---|
| 561 | ELSE |
---|
| 562 | CALL exchange_horiz( ql_vp_av, nbgp ) |
---|
[1] | 563 | to_be_resorted => ql_vp |
---|
| 564 | ENDIF |
---|
| 565 | IF ( mode == 'xy' ) level_z = zu |
---|
| 566 | |
---|
[1053] | 567 | CASE ( 'qr_xy', 'qr_xz', 'qr_yz' ) |
---|
| 568 | IF ( av == 0 ) THEN |
---|
| 569 | to_be_resorted => qr |
---|
| 570 | ELSE |
---|
| 571 | to_be_resorted => qr_av |
---|
| 572 | ENDIF |
---|
| 573 | IF ( mode == 'xy' ) level_z = zu |
---|
| 574 | |
---|
[354] | 575 | CASE ( 'qsws*_xy' ) ! 2d-array |
---|
| 576 | IF ( av == 0 ) THEN |
---|
[667] | 577 | DO i = nxlg, nxrg |
---|
| 578 | DO j = nysg, nyng |
---|
[354] | 579 | local_pf(i,j,nzb+1) = qsws(j,i) |
---|
| 580 | ENDDO |
---|
| 581 | ENDDO |
---|
| 582 | ELSE |
---|
[667] | 583 | DO i = nxlg, nxrg |
---|
| 584 | DO j = nysg, nyng |
---|
[354] | 585 | local_pf(i,j,nzb+1) = qsws_av(j,i) |
---|
| 586 | ENDDO |
---|
| 587 | ENDDO |
---|
| 588 | ENDIF |
---|
| 589 | resorted = .TRUE. |
---|
| 590 | two_d = .TRUE. |
---|
| 591 | level_z(nzb+1) = zu(nzb+1) |
---|
| 592 | |
---|
[1] | 593 | CASE ( 'qv_xy', 'qv_xz', 'qv_yz' ) |
---|
| 594 | IF ( av == 0 ) THEN |
---|
[667] | 595 | DO i = nxlg, nxrg |
---|
| 596 | DO j = nysg, nyng |
---|
[1] | 597 | DO k = nzb, nzt+1 |
---|
| 598 | local_pf(i,j,k) = q(k,j,i) - ql(k,j,i) |
---|
| 599 | ENDDO |
---|
| 600 | ENDDO |
---|
| 601 | ENDDO |
---|
| 602 | resorted = .TRUE. |
---|
| 603 | ELSE |
---|
| 604 | to_be_resorted => qv_av |
---|
| 605 | ENDIF |
---|
| 606 | IF ( mode == 'xy' ) level_z = zu |
---|
| 607 | |
---|
[96] | 608 | CASE ( 'rho_xy', 'rho_xz', 'rho_yz' ) |
---|
| 609 | IF ( av == 0 ) THEN |
---|
| 610 | to_be_resorted => rho |
---|
| 611 | ELSE |
---|
| 612 | to_be_resorted => rho_av |
---|
| 613 | ENDIF |
---|
| 614 | |
---|
[1] | 615 | CASE ( 's_xy', 's_xz', 's_yz' ) |
---|
| 616 | IF ( av == 0 ) THEN |
---|
| 617 | to_be_resorted => q |
---|
| 618 | ELSE |
---|
[355] | 619 | to_be_resorted => s_av |
---|
[1] | 620 | ENDIF |
---|
| 621 | |
---|
[96] | 622 | CASE ( 'sa_xy', 'sa_xz', 'sa_yz' ) |
---|
| 623 | IF ( av == 0 ) THEN |
---|
| 624 | to_be_resorted => sa |
---|
| 625 | ELSE |
---|
| 626 | to_be_resorted => sa_av |
---|
| 627 | ENDIF |
---|
| 628 | |
---|
[354] | 629 | CASE ( 'shf*_xy' ) ! 2d-array |
---|
| 630 | IF ( av == 0 ) THEN |
---|
[667] | 631 | DO i = nxlg, nxrg |
---|
| 632 | DO j = nysg, nyng |
---|
[354] | 633 | local_pf(i,j,nzb+1) = shf(j,i) |
---|
| 634 | ENDDO |
---|
| 635 | ENDDO |
---|
| 636 | ELSE |
---|
[667] | 637 | DO i = nxlg, nxrg |
---|
| 638 | DO j = nysg, nyng |
---|
[354] | 639 | local_pf(i,j,nzb+1) = shf_av(j,i) |
---|
| 640 | ENDDO |
---|
| 641 | ENDDO |
---|
| 642 | ENDIF |
---|
| 643 | resorted = .TRUE. |
---|
| 644 | two_d = .TRUE. |
---|
| 645 | level_z(nzb+1) = zu(nzb+1) |
---|
| 646 | |
---|
[1] | 647 | CASE ( 't*_xy' ) ! 2d-array |
---|
| 648 | IF ( av == 0 ) THEN |
---|
[667] | 649 | DO i = nxlg, nxrg |
---|
| 650 | DO j = nysg, nyng |
---|
[1] | 651 | local_pf(i,j,nzb+1) = ts(j,i) |
---|
| 652 | ENDDO |
---|
| 653 | ENDDO |
---|
| 654 | ELSE |
---|
[667] | 655 | DO i = nxlg, nxrg |
---|
| 656 | DO j = nysg, nyng |
---|
[1] | 657 | local_pf(i,j,nzb+1) = ts_av(j,i) |
---|
| 658 | ENDDO |
---|
| 659 | ENDDO |
---|
| 660 | ENDIF |
---|
| 661 | resorted = .TRUE. |
---|
| 662 | two_d = .TRUE. |
---|
| 663 | level_z(nzb+1) = zu(nzb+1) |
---|
| 664 | |
---|
| 665 | CASE ( 'u_xy', 'u_xz', 'u_yz' ) |
---|
| 666 | IF ( av == 0 ) THEN |
---|
| 667 | to_be_resorted => u |
---|
| 668 | ELSE |
---|
| 669 | to_be_resorted => u_av |
---|
| 670 | ENDIF |
---|
| 671 | IF ( mode == 'xy' ) level_z = zu |
---|
| 672 | ! |
---|
| 673 | !-- Substitute the values generated by "mirror" boundary condition |
---|
| 674 | !-- at the bottom boundary by the real surface values. |
---|
| 675 | IF ( do2d(av,if) == 'u_xz' .OR. do2d(av,if) == 'u_yz' ) THEN |
---|
| 676 | IF ( ibc_uv_b == 0 ) local_pf(:,:,nzb) = 0.0 |
---|
| 677 | ENDIF |
---|
| 678 | |
---|
| 679 | CASE ( 'u*_xy' ) ! 2d-array |
---|
| 680 | IF ( av == 0 ) THEN |
---|
[667] | 681 | DO i = nxlg, nxrg |
---|
| 682 | DO j = nysg, nyng |
---|
[1] | 683 | local_pf(i,j,nzb+1) = us(j,i) |
---|
| 684 | ENDDO |
---|
| 685 | ENDDO |
---|
| 686 | ELSE |
---|
[667] | 687 | DO i = nxlg, nxrg |
---|
| 688 | DO j = nysg, nyng |
---|
[1] | 689 | local_pf(i,j,nzb+1) = us_av(j,i) |
---|
| 690 | ENDDO |
---|
| 691 | ENDDO |
---|
| 692 | ENDIF |
---|
| 693 | resorted = .TRUE. |
---|
| 694 | two_d = .TRUE. |
---|
| 695 | level_z(nzb+1) = zu(nzb+1) |
---|
| 696 | |
---|
| 697 | CASE ( 'v_xy', 'v_xz', 'v_yz' ) |
---|
| 698 | IF ( av == 0 ) THEN |
---|
| 699 | to_be_resorted => v |
---|
| 700 | ELSE |
---|
| 701 | to_be_resorted => v_av |
---|
| 702 | ENDIF |
---|
| 703 | IF ( mode == 'xy' ) level_z = zu |
---|
| 704 | ! |
---|
| 705 | !-- Substitute the values generated by "mirror" boundary condition |
---|
| 706 | !-- at the bottom boundary by the real surface values. |
---|
| 707 | IF ( do2d(av,if) == 'v_xz' .OR. do2d(av,if) == 'v_yz' ) THEN |
---|
| 708 | IF ( ibc_uv_b == 0 ) local_pf(:,:,nzb) = 0.0 |
---|
| 709 | ENDIF |
---|
| 710 | |
---|
| 711 | CASE ( 'vpt_xy', 'vpt_xz', 'vpt_yz' ) |
---|
| 712 | IF ( av == 0 ) THEN |
---|
| 713 | to_be_resorted => vpt |
---|
| 714 | ELSE |
---|
| 715 | to_be_resorted => vpt_av |
---|
| 716 | ENDIF |
---|
| 717 | IF ( mode == 'xy' ) level_z = zu |
---|
| 718 | |
---|
| 719 | CASE ( 'w_xy', 'w_xz', 'w_yz' ) |
---|
| 720 | IF ( av == 0 ) THEN |
---|
| 721 | to_be_resorted => w |
---|
| 722 | ELSE |
---|
| 723 | to_be_resorted => w_av |
---|
| 724 | ENDIF |
---|
| 725 | IF ( mode == 'xy' ) level_z = zw |
---|
| 726 | |
---|
[72] | 727 | CASE ( 'z0*_xy' ) ! 2d-array |
---|
| 728 | IF ( av == 0 ) THEN |
---|
[667] | 729 | DO i = nxlg, nxrg |
---|
| 730 | DO j = nysg, nyng |
---|
[72] | 731 | local_pf(i,j,nzb+1) = z0(j,i) |
---|
| 732 | ENDDO |
---|
| 733 | ENDDO |
---|
| 734 | ELSE |
---|
[667] | 735 | DO i = nxlg, nxrg |
---|
| 736 | DO j = nysg, nyng |
---|
[72] | 737 | local_pf(i,j,nzb+1) = z0_av(j,i) |
---|
| 738 | ENDDO |
---|
| 739 | ENDDO |
---|
| 740 | ENDIF |
---|
| 741 | resorted = .TRUE. |
---|
| 742 | two_d = .TRUE. |
---|
| 743 | level_z(nzb+1) = zu(nzb+1) |
---|
| 744 | |
---|
[978] | 745 | CASE ( 'z0h*_xy' ) ! 2d-array |
---|
| 746 | IF ( av == 0 ) THEN |
---|
| 747 | DO i = nxlg, nxrg |
---|
| 748 | DO j = nysg, nyng |
---|
| 749 | local_pf(i,j,nzb+1) = z0h(j,i) |
---|
| 750 | ENDDO |
---|
| 751 | ENDDO |
---|
| 752 | ELSE |
---|
| 753 | DO i = nxlg, nxrg |
---|
| 754 | DO j = nysg, nyng |
---|
| 755 | local_pf(i,j,nzb+1) = z0h_av(j,i) |
---|
| 756 | ENDDO |
---|
| 757 | ENDDO |
---|
| 758 | ENDIF |
---|
| 759 | resorted = .TRUE. |
---|
| 760 | two_d = .TRUE. |
---|
| 761 | level_z(nzb+1) = zu(nzb+1) |
---|
| 762 | |
---|
[1] | 763 | CASE DEFAULT |
---|
| 764 | ! |
---|
| 765 | !-- User defined quantity |
---|
| 766 | CALL user_data_output_2d( av, do2d(av,if), found, grid, & |
---|
[343] | 767 | local_pf, two_d ) |
---|
[1] | 768 | resorted = .TRUE. |
---|
| 769 | |
---|
| 770 | IF ( grid == 'zu' ) THEN |
---|
| 771 | IF ( mode == 'xy' ) level_z = zu |
---|
| 772 | ELSEIF ( grid == 'zw' ) THEN |
---|
| 773 | IF ( mode == 'xy' ) level_z = zw |
---|
[343] | 774 | ELSEIF ( grid == 'zu1' ) THEN |
---|
| 775 | IF ( mode == 'xy' ) level_z(nzb+1) = zu(nzb+1) |
---|
[1] | 776 | ENDIF |
---|
| 777 | |
---|
| 778 | IF ( .NOT. found ) THEN |
---|
[274] | 779 | message_string = 'no output provided for: ' // & |
---|
| 780 | TRIM( do2d(av,if) ) |
---|
[254] | 781 | CALL message( 'data_output_2d', 'PA0181', 0, 0, 0, 6, 0 ) |
---|
[1] | 782 | ENDIF |
---|
| 783 | |
---|
| 784 | END SELECT |
---|
| 785 | |
---|
| 786 | ! |
---|
| 787 | !-- Resort the array to be output, if not done above |
---|
| 788 | IF ( .NOT. resorted ) THEN |
---|
[667] | 789 | DO i = nxlg, nxrg |
---|
| 790 | DO j = nysg, nyng |
---|
[1] | 791 | DO k = nzb, nzt+1 |
---|
| 792 | local_pf(i,j,k) = to_be_resorted(k,j,i) |
---|
| 793 | ENDDO |
---|
| 794 | ENDDO |
---|
| 795 | ENDDO |
---|
| 796 | ENDIF |
---|
| 797 | |
---|
| 798 | ! |
---|
| 799 | !-- Output of the individual cross-sections, depending on the cross- |
---|
| 800 | !-- section mode chosen. |
---|
| 801 | is = 1 |
---|
| 802 | loop1: DO WHILE ( section(is,s) /= -9999 .OR. two_d ) |
---|
| 803 | |
---|
| 804 | SELECT CASE ( mode ) |
---|
| 805 | |
---|
| 806 | CASE ( 'xy' ) |
---|
| 807 | ! |
---|
| 808 | !-- Determine the cross section index |
---|
| 809 | IF ( two_d ) THEN |
---|
| 810 | layer_xy = nzb+1 |
---|
| 811 | ELSE |
---|
| 812 | layer_xy = section(is,s) |
---|
| 813 | ENDIF |
---|
| 814 | |
---|
| 815 | ! |
---|
[1031] | 816 | !-- Update the netCDF xy cross section time axis |
---|
| 817 | IF ( myid == 0 .OR. netcdf_data_format > 4 ) THEN |
---|
[1] | 818 | IF ( simulated_time /= do2d_xy_last_time(av) ) THEN |
---|
| 819 | do2d_xy_time_count(av) = do2d_xy_time_count(av) + 1 |
---|
| 820 | do2d_xy_last_time(av) = simulated_time |
---|
[493] | 821 | IF ( ( .NOT. data_output_2d_on_each_pe .AND. & |
---|
[1031] | 822 | netcdf_output ) .OR. netcdf_data_format > 4 ) & |
---|
[493] | 823 | THEN |
---|
[1] | 824 | #if defined( __netcdf ) |
---|
| 825 | nc_stat = NF90_PUT_VAR( id_set_xy(av), & |
---|
| 826 | id_var_time_xy(av), & |
---|
[291] | 827 | (/ time_since_reference_point /), & |
---|
[1] | 828 | start = (/ do2d_xy_time_count(av) /), & |
---|
| 829 | count = (/ 1 /) ) |
---|
[493] | 830 | CALL handle_netcdf_error( 'data_output_2d', 53 ) |
---|
[1] | 831 | #endif |
---|
| 832 | ENDIF |
---|
| 833 | ENDIF |
---|
| 834 | ENDIF |
---|
| 835 | ! |
---|
| 836 | !-- If required, carry out averaging along z |
---|
[336] | 837 | IF ( section(is,s) == -1 .AND. .NOT. two_d ) THEN |
---|
[1] | 838 | |
---|
| 839 | local_2d = 0.0 |
---|
| 840 | ! |
---|
| 841 | !-- Carry out the averaging (all data are on the PE) |
---|
| 842 | DO k = nzb, nzt+1 |
---|
[667] | 843 | DO j = nysg, nyng |
---|
| 844 | DO i = nxlg, nxrg |
---|
[1] | 845 | local_2d(i,j) = local_2d(i,j) + local_pf(i,j,k) |
---|
| 846 | ENDDO |
---|
| 847 | ENDDO |
---|
| 848 | ENDDO |
---|
| 849 | |
---|
[667] | 850 | local_2d = local_2d / ( nzt -nzb + 2.0) |
---|
[1] | 851 | |
---|
| 852 | ELSE |
---|
| 853 | ! |
---|
| 854 | !-- Just store the respective section on the local array |
---|
| 855 | local_2d = local_pf(:,:,layer_xy) |
---|
| 856 | |
---|
| 857 | ENDIF |
---|
| 858 | |
---|
| 859 | #if defined( __parallel ) |
---|
[1031] | 860 | IF ( netcdf_output .AND. netcdf_data_format > 4 ) THEN |
---|
[1] | 861 | ! |
---|
[1031] | 862 | !-- Parallel output in netCDF4/HDF5 format. |
---|
[493] | 863 | !-- Do not output redundant ghost point data except for the |
---|
| 864 | !-- boundaries of the total domain. |
---|
| 865 | IF ( two_d ) THEN |
---|
| 866 | iis = 1 |
---|
| 867 | ELSE |
---|
| 868 | iis = is |
---|
| 869 | ENDIF |
---|
| 870 | |
---|
[1] | 871 | #if defined( __netcdf ) |
---|
[493] | 872 | IF ( nxr == nx .AND. nyn /= ny ) THEN |
---|
| 873 | nc_stat = NF90_PUT_VAR( id_set_xy(av), & |
---|
| 874 | id_var_do2d(av,if), & |
---|
| 875 | local_2d(nxl:nxr+1,nys:nyn), & |
---|
| 876 | start = (/ nxl+1, nys+1, iis, & |
---|
| 877 | do2d_xy_time_count(av) /), & |
---|
| 878 | count = (/ nxr-nxl+2, & |
---|
| 879 | nyn-nys+1, 1, 1 /) ) |
---|
| 880 | ELSEIF ( nxr /= nx .AND. nyn == ny ) THEN |
---|
| 881 | nc_stat = NF90_PUT_VAR( id_set_xy(av), & |
---|
| 882 | id_var_do2d(av,if), & |
---|
| 883 | local_2d(nxl:nxr,nys:nyn+1), & |
---|
| 884 | start = (/ nxl+1, nys+1, iis, & |
---|
| 885 | do2d_xy_time_count(av) /), & |
---|
| 886 | count = (/ nxr-nxl+1, & |
---|
| 887 | nyn-nys+2, 1, 1 /) ) |
---|
| 888 | ELSEIF ( nxr == nx .AND. nyn == ny ) THEN |
---|
| 889 | nc_stat = NF90_PUT_VAR( id_set_xy(av), & |
---|
| 890 | id_var_do2d(av,if), & |
---|
| 891 | local_2d(nxl:nxr+1,nys:nyn+1),& |
---|
| 892 | start = (/ nxl+1, nys+1, iis, & |
---|
| 893 | do2d_xy_time_count(av) /), & |
---|
| 894 | count = (/ nxr-nxl+2, & |
---|
| 895 | nyn-nys+2, 1, 1 /) ) |
---|
| 896 | ELSE |
---|
| 897 | nc_stat = NF90_PUT_VAR( id_set_xy(av), & |
---|
| 898 | id_var_do2d(av,if), & |
---|
| 899 | local_2d(nxl:nxr,nys:nyn), & |
---|
| 900 | start = (/ nxl+1, nys+1, iis, & |
---|
| 901 | do2d_xy_time_count(av) /), & |
---|
| 902 | count = (/ nxr-nxl+1, & |
---|
| 903 | nyn-nys+1, 1, 1 /) ) |
---|
[1] | 904 | ENDIF |
---|
[493] | 905 | |
---|
| 906 | CALL handle_netcdf_error( 'data_output_2d', 55 ) |
---|
[1] | 907 | #endif |
---|
[493] | 908 | ELSE |
---|
[1] | 909 | |
---|
[493] | 910 | IF ( data_output_2d_on_each_pe ) THEN |
---|
[1] | 911 | ! |
---|
[493] | 912 | !-- Output of partial arrays on each PE |
---|
| 913 | #if defined( __netcdf ) |
---|
| 914 | IF ( netcdf_output .AND. myid == 0 ) THEN |
---|
[691] | 915 | WRITE ( 21 ) time_since_reference_point, & |
---|
[493] | 916 | do2d_xy_time_count(av), av |
---|
| 917 | ENDIF |
---|
| 918 | #endif |
---|
[759] | 919 | DO i = 0, io_blocks-1 |
---|
| 920 | IF ( i == io_group ) THEN |
---|
| 921 | WRITE ( 21 ) nxlg, nxrg, nysg, nyng |
---|
| 922 | WRITE ( 21 ) local_2d |
---|
| 923 | ENDIF |
---|
| 924 | #if defined( __parallel ) |
---|
| 925 | CALL MPI_BARRIER( comm2d, ierr ) |
---|
| 926 | #endif |
---|
| 927 | ENDDO |
---|
[559] | 928 | |
---|
[493] | 929 | ELSE |
---|
[1] | 930 | ! |
---|
[493] | 931 | !-- PE0 receives partial arrays from all processors and |
---|
| 932 | !-- then outputs them. Here a barrier has to be set, |
---|
| 933 | !-- because otherwise "-MPI- FATAL: Remote protocol queue |
---|
| 934 | !-- full" may occur. |
---|
| 935 | CALL MPI_BARRIER( comm2d, ierr ) |
---|
| 936 | |
---|
[667] | 937 | ngp = ( nxrg-nxlg+1 ) * ( nyng-nysg+1 ) |
---|
[493] | 938 | IF ( myid == 0 ) THEN |
---|
[1] | 939 | ! |
---|
[493] | 940 | !-- Local array can be relocated directly. |
---|
[667] | 941 | total_2d(nxlg:nxrg,nysg:nyng) = local_2d |
---|
[1] | 942 | ! |
---|
[493] | 943 | !-- Receive data from all other PEs. |
---|
| 944 | DO n = 1, numprocs-1 |
---|
[1] | 945 | ! |
---|
[493] | 946 | !-- Receive index limits first, then array. |
---|
| 947 | !-- Index limits are received in arbitrary order from |
---|
| 948 | !-- the PEs. |
---|
| 949 | CALL MPI_RECV( ind(1), 4, MPI_INTEGER, & |
---|
| 950 | MPI_ANY_SOURCE, 0, comm2d, & |
---|
| 951 | status, ierr ) |
---|
| 952 | sender = status(MPI_SOURCE) |
---|
| 953 | DEALLOCATE( local_2d ) |
---|
| 954 | ALLOCATE( local_2d(ind(1):ind(2),ind(3):ind(4)) ) |
---|
| 955 | CALL MPI_RECV( local_2d(ind(1),ind(3)), ngp, & |
---|
| 956 | MPI_REAL, sender, 1, comm2d, & |
---|
| 957 | status, ierr ) |
---|
| 958 | total_2d(ind(1):ind(2),ind(3):ind(4)) = local_2d |
---|
| 959 | ENDDO |
---|
[1] | 960 | ! |
---|
[493] | 961 | !-- Output of the total cross-section. |
---|
| 962 | IF ( iso2d_output ) THEN |
---|
[667] | 963 | WRITE (21) total_2d(-nbgp:nx+nbgp,-nbgp:ny+nbgp) |
---|
[493] | 964 | ENDIF |
---|
| 965 | ! |
---|
| 966 | !-- Relocate the local array for the next loop increment |
---|
| 967 | DEALLOCATE( local_2d ) |
---|
[667] | 968 | ALLOCATE( local_2d(nxlg:nxrg,nysg:nyng) ) |
---|
[1] | 969 | |
---|
| 970 | #if defined( __netcdf ) |
---|
[493] | 971 | IF ( netcdf_output ) THEN |
---|
| 972 | IF ( two_d ) THEN |
---|
| 973 | nc_stat = NF90_PUT_VAR( id_set_xy(av), & |
---|
| 974 | id_var_do2d(av,if), & |
---|
[1] | 975 | total_2d(0:nx+1,0:ny+1), & |
---|
| 976 | start = (/ 1, 1, 1, do2d_xy_time_count(av) /), & |
---|
| 977 | count = (/ nx+2, ny+2, 1, 1 /) ) |
---|
[493] | 978 | ELSE |
---|
| 979 | nc_stat = NF90_PUT_VAR( id_set_xy(av), & |
---|
| 980 | id_var_do2d(av,if), & |
---|
[1] | 981 | total_2d(0:nx+1,0:ny+1), & |
---|
| 982 | start = (/ 1, 1, is, do2d_xy_time_count(av) /), & |
---|
| 983 | count = (/ nx+2, ny+2, 1, 1 /) ) |
---|
[493] | 984 | ENDIF |
---|
| 985 | CALL handle_netcdf_error( 'data_output_2d', 54 ) |
---|
[1] | 986 | ENDIF |
---|
| 987 | #endif |
---|
| 988 | |
---|
[493] | 989 | ELSE |
---|
[1] | 990 | ! |
---|
[493] | 991 | !-- First send the local index limits to PE0 |
---|
[667] | 992 | ind(1) = nxlg; ind(2) = nxrg |
---|
| 993 | ind(3) = nysg; ind(4) = nyng |
---|
[493] | 994 | CALL MPI_SEND( ind(1), 4, MPI_INTEGER, 0, 0, & |
---|
| 995 | comm2d, ierr ) |
---|
[1] | 996 | ! |
---|
[493] | 997 | !-- Send data to PE0 |
---|
[667] | 998 | CALL MPI_SEND( local_2d(nxlg,nysg), ngp, & |
---|
[493] | 999 | MPI_REAL, 0, 1, comm2d, ierr ) |
---|
| 1000 | ENDIF |
---|
| 1001 | ! |
---|
| 1002 | !-- A barrier has to be set, because otherwise some PEs may |
---|
| 1003 | !-- proceed too fast so that PE0 may receive wrong data on |
---|
| 1004 | !-- tag 0 |
---|
| 1005 | CALL MPI_BARRIER( comm2d, ierr ) |
---|
[1] | 1006 | ENDIF |
---|
[493] | 1007 | |
---|
[1] | 1008 | ENDIF |
---|
| 1009 | #else |
---|
| 1010 | IF ( iso2d_output ) THEN |
---|
| 1011 | WRITE (21) local_2d(nxl:nxr+1,nys:nyn+1) |
---|
| 1012 | ENDIF |
---|
| 1013 | #if defined( __netcdf ) |
---|
| 1014 | IF ( netcdf_output ) THEN |
---|
| 1015 | IF ( two_d ) THEN |
---|
| 1016 | nc_stat = NF90_PUT_VAR( id_set_xy(av), & |
---|
| 1017 | id_var_do2d(av,if), & |
---|
| 1018 | local_2d(nxl:nxr+1,nys:nyn+1), & |
---|
| 1019 | start = (/ 1, 1, 1, do2d_xy_time_count(av) /), & |
---|
| 1020 | count = (/ nx+2, ny+2, 1, 1 /) ) |
---|
| 1021 | ELSE |
---|
| 1022 | nc_stat = NF90_PUT_VAR( id_set_xy(av), & |
---|
| 1023 | id_var_do2d(av,if), & |
---|
| 1024 | local_2d(nxl:nxr+1,nys:nyn+1), & |
---|
| 1025 | start = (/ 1, 1, is, do2d_xy_time_count(av) /), & |
---|
| 1026 | count = (/ nx+2, ny+2, 1, 1 /) ) |
---|
| 1027 | ENDIF |
---|
[493] | 1028 | CALL handle_netcdf_error( 'data_output_2d', 447 ) |
---|
[1] | 1029 | ENDIF |
---|
| 1030 | #endif |
---|
| 1031 | #endif |
---|
| 1032 | do2d_xy_n = do2d_xy_n + 1 |
---|
| 1033 | ! |
---|
| 1034 | !-- Write LOCAL parameter set for ISO2D. |
---|
| 1035 | IF ( myid == 0 .AND. iso2d_output ) THEN |
---|
| 1036 | IF ( section(is,s) /= -1 ) THEN |
---|
| 1037 | WRITE ( section_chr, '(''z = '',F7.2,'' m (GP '',I3, & |
---|
| 1038 | &'')'')' & |
---|
| 1039 | ) level_z(layer_xy), layer_xy |
---|
| 1040 | ELSE |
---|
| 1041 | section_chr = 'averaged along z' |
---|
| 1042 | ENDIF |
---|
| 1043 | IF ( av == 0 ) THEN |
---|
| 1044 | rtext = TRIM( do2d(av,if) ) // ' t = ' // & |
---|
| 1045 | TRIM( simulated_time_chr ) // ' ' // & |
---|
| 1046 | TRIM( section_chr ) |
---|
| 1047 | ELSE |
---|
| 1048 | rtext = TRIM( do2d(av,if) ) // ' averaged t = ' // & |
---|
| 1049 | TRIM( simulated_time_chr ) // ' ' // & |
---|
| 1050 | TRIM( section_chr ) |
---|
| 1051 | ENDIF |
---|
| 1052 | WRITE (27,LOCAL) |
---|
| 1053 | ENDIF |
---|
| 1054 | ! |
---|
| 1055 | !-- For 2D-arrays (e.g. u*) only one cross-section is available. |
---|
| 1056 | !-- Hence exit loop of output levels. |
---|
| 1057 | IF ( two_d ) THEN |
---|
| 1058 | two_d = .FALSE. |
---|
| 1059 | EXIT loop1 |
---|
| 1060 | ENDIF |
---|
| 1061 | |
---|
| 1062 | CASE ( 'xz' ) |
---|
| 1063 | ! |
---|
[1031] | 1064 | !-- Update the netCDF xz cross section time axis |
---|
| 1065 | IF ( myid == 0 .OR. netcdf_data_format > 4 ) THEN |
---|
[493] | 1066 | |
---|
[1] | 1067 | IF ( simulated_time /= do2d_xz_last_time(av) ) THEN |
---|
| 1068 | do2d_xz_time_count(av) = do2d_xz_time_count(av) + 1 |
---|
| 1069 | do2d_xz_last_time(av) = simulated_time |
---|
[493] | 1070 | IF ( ( .NOT. data_output_2d_on_each_pe .AND. & |
---|
[1031] | 1071 | netcdf_output ) .OR. netcdf_data_format > 4 ) & |
---|
[493] | 1072 | THEN |
---|
[1] | 1073 | #if defined( __netcdf ) |
---|
| 1074 | nc_stat = NF90_PUT_VAR( id_set_xz(av), & |
---|
| 1075 | id_var_time_xz(av), & |
---|
[291] | 1076 | (/ time_since_reference_point /), & |
---|
[1] | 1077 | start = (/ do2d_xz_time_count(av) /), & |
---|
| 1078 | count = (/ 1 /) ) |
---|
[493] | 1079 | CALL handle_netcdf_error( 'data_output_2d', 56 ) |
---|
[1] | 1080 | #endif |
---|
| 1081 | ENDIF |
---|
| 1082 | ENDIF |
---|
[493] | 1083 | |
---|
[1] | 1084 | ENDIF |
---|
[667] | 1085 | |
---|
[1] | 1086 | ! |
---|
| 1087 | !-- If required, carry out averaging along y |
---|
| 1088 | IF ( section(is,s) == -1 ) THEN |
---|
| 1089 | |
---|
[667] | 1090 | ALLOCATE( local_2d_l(nxlg:nxrg,nzb:nzt+1) ) |
---|
[1] | 1091 | local_2d_l = 0.0 |
---|
[667] | 1092 | ngp = ( nxrg-nxlg+1 ) * ( nzt-nzb+2 ) |
---|
[1] | 1093 | ! |
---|
| 1094 | !-- First local averaging on the PE |
---|
| 1095 | DO k = nzb, nzt+1 |
---|
| 1096 | DO j = nys, nyn |
---|
[667] | 1097 | DO i = nxlg, nxrg |
---|
[1] | 1098 | local_2d_l(i,k) = local_2d_l(i,k) + & |
---|
| 1099 | local_pf(i,j,k) |
---|
| 1100 | ENDDO |
---|
| 1101 | ENDDO |
---|
| 1102 | ENDDO |
---|
| 1103 | #if defined( __parallel ) |
---|
| 1104 | ! |
---|
| 1105 | !-- Now do the averaging over all PEs along y |
---|
[622] | 1106 | IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
[667] | 1107 | CALL MPI_ALLREDUCE( local_2d_l(nxlg,nzb), & |
---|
| 1108 | local_2d(nxlg,nzb), ngp, MPI_REAL, & |
---|
[1] | 1109 | MPI_SUM, comm1dy, ierr ) |
---|
| 1110 | #else |
---|
| 1111 | local_2d = local_2d_l |
---|
| 1112 | #endif |
---|
| 1113 | local_2d = local_2d / ( ny + 1.0 ) |
---|
| 1114 | |
---|
| 1115 | DEALLOCATE( local_2d_l ) |
---|
| 1116 | |
---|
| 1117 | ELSE |
---|
| 1118 | ! |
---|
| 1119 | !-- Just store the respective section on the local array |
---|
| 1120 | !-- (but only if it is available on this PE!) |
---|
| 1121 | IF ( section(is,s) >= nys .AND. section(is,s) <= nyn ) & |
---|
| 1122 | THEN |
---|
| 1123 | local_2d = local_pf(:,section(is,s),nzb:nzt+1) |
---|
| 1124 | ENDIF |
---|
| 1125 | |
---|
| 1126 | ENDIF |
---|
| 1127 | |
---|
| 1128 | #if defined( __parallel ) |
---|
[1031] | 1129 | IF ( netcdf_output .AND. netcdf_data_format > 4 ) THEN |
---|
[1] | 1130 | ! |
---|
[493] | 1131 | !-- ATTENTION: The following lines are a workaround, because |
---|
| 1132 | !-- independet output does not work with the |
---|
[1031] | 1133 | !-- current netCDF4 installation. Therefore, data |
---|
[493] | 1134 | !-- are transferred from PEs having the cross |
---|
| 1135 | !-- sections to other PEs along y having no cross |
---|
| 1136 | !-- section data. Some of these data are the |
---|
| 1137 | !-- output. |
---|
| 1138 | !-- BEGIN WORKAROUND--------------------------------------- |
---|
| 1139 | IF ( npey /= 1 .AND. section(is,s) /= -1) THEN |
---|
[667] | 1140 | ALLOCATE( local_2d_l(nxlg:nxrg,nzb:nzt+1) ) |
---|
[493] | 1141 | local_2d_l = 0.0 |
---|
| 1142 | IF ( section(is,s) >= nys .AND. section(is,s) <= nyn )& |
---|
| 1143 | THEN |
---|
| 1144 | local_2d_l = local_2d |
---|
| 1145 | ENDIF |
---|
| 1146 | #if defined( __parallel ) |
---|
| 1147 | ! |
---|
| 1148 | !-- Distribute data over all PEs along y |
---|
[667] | 1149 | ngp = ( nxrg-nxlg+1 ) * ( nzt-nzb+2 ) |
---|
[622] | 1150 | IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
[667] | 1151 | CALL MPI_ALLREDUCE( local_2d_l(nxlg,nzb), & |
---|
| 1152 | local_2d(nxlg,nzb), ngp, & |
---|
[493] | 1153 | MPI_REAL, MPI_SUM, comm1dy, ierr ) |
---|
| 1154 | #else |
---|
| 1155 | local_2d = local_2d_l |
---|
| 1156 | #endif |
---|
| 1157 | DEALLOCATE( local_2d_l ) |
---|
| 1158 | ENDIF |
---|
| 1159 | !-- END WORKAROUND----------------------------------------- |
---|
| 1160 | |
---|
| 1161 | ! |
---|
[1031] | 1162 | !-- Output in netCDF4/HDF5 format. |
---|
[493] | 1163 | !-- Output only on those PEs where the respective cross |
---|
| 1164 | !-- sections reside. Cross sections averaged along y are |
---|
| 1165 | !-- output on the respective first PE along y (myidy=0). |
---|
| 1166 | IF ( ( section(is,s) >= nys .AND. & |
---|
| 1167 | section(is,s) <= nyn ) .OR. & |
---|
| 1168 | ( section(is,s) == -1 .AND. myidy == 0 ) ) THEN |
---|
| 1169 | ! |
---|
| 1170 | !-- Do not output redundant ghost point data except for the |
---|
| 1171 | !-- boundaries of the total domain. |
---|
[1] | 1172 | #if defined( __netcdf ) |
---|
[493] | 1173 | IF ( nxr == nx ) THEN |
---|
| 1174 | nc_stat = NF90_PUT_VAR( id_set_xz(av), & |
---|
| 1175 | id_var_do2d(av,if), & |
---|
| 1176 | local_2d(nxl:nxr+1,nzb:nzt+1), & |
---|
| 1177 | start = (/ nxl+1, is, 1, & |
---|
| 1178 | do2d_xz_time_count(av) /), & |
---|
| 1179 | count = (/ nxr-nxl+2, 1, & |
---|
| 1180 | nzt+2, 1 /) ) |
---|
| 1181 | ELSE |
---|
| 1182 | nc_stat = NF90_PUT_VAR( id_set_xz(av), & |
---|
| 1183 | id_var_do2d(av,if), & |
---|
| 1184 | local_2d(nxl:nxr,nzb:nzt+1), & |
---|
| 1185 | start = (/ nxl+1, is, 1, & |
---|
| 1186 | do2d_xz_time_count(av) /), & |
---|
| 1187 | count = (/ nxr-nxl+1, 1, & |
---|
| 1188 | nzt+2, 1 /) ) |
---|
| 1189 | ENDIF |
---|
| 1190 | |
---|
| 1191 | CALL handle_netcdf_error( 'data_output_2d', 57 ) |
---|
| 1192 | |
---|
| 1193 | ELSE |
---|
| 1194 | ! |
---|
| 1195 | !-- Output on other PEs. Only one point is output!! |
---|
| 1196 | !-- ATTENTION: This is a workaround (see above)!! |
---|
| 1197 | IF ( npey /= 1 ) THEN |
---|
| 1198 | nc_stat = NF90_PUT_VAR( id_set_xz(av), & |
---|
| 1199 | id_var_do2d(av,if), & |
---|
| 1200 | local_2d(nxl:nxl,nzb:nzb), & |
---|
| 1201 | start = (/ nxl+1, is, 1, & |
---|
| 1202 | do2d_xz_time_count(av) /), & |
---|
| 1203 | count = (/ 1, 1, 1, 1 /) ) |
---|
| 1204 | CALL handle_netcdf_error( 'data_output_2d', 451 ) |
---|
| 1205 | ENDIF |
---|
[1] | 1206 | #endif |
---|
| 1207 | ENDIF |
---|
| 1208 | |
---|
| 1209 | ELSE |
---|
| 1210 | |
---|
[493] | 1211 | IF ( data_output_2d_on_each_pe ) THEN |
---|
[1] | 1212 | ! |
---|
[493] | 1213 | !-- Output of partial arrays on each PE. If the cross |
---|
| 1214 | !-- section does not reside on the PE, output special |
---|
| 1215 | !-- index values. |
---|
| 1216 | #if defined( __netcdf ) |
---|
| 1217 | IF ( netcdf_output .AND. myid == 0 ) THEN |
---|
[691] | 1218 | WRITE ( 22 ) time_since_reference_point, & |
---|
[493] | 1219 | do2d_xz_time_count(av), av |
---|
| 1220 | ENDIF |
---|
| 1221 | #endif |
---|
[759] | 1222 | DO i = 0, io_blocks-1 |
---|
| 1223 | IF ( i == io_group ) THEN |
---|
| 1224 | IF ( ( section(is,s) >= nys .AND. & |
---|
| 1225 | section(is,s) <= nyn ) .OR. & |
---|
| 1226 | ( section(is,s) == -1 .AND. & |
---|
| 1227 | nys-1 == -1 ) ) & |
---|
| 1228 | THEN |
---|
| 1229 | WRITE (22) nxlg, nxrg, nzb, nzt+1 |
---|
| 1230 | WRITE (22) local_2d |
---|
| 1231 | ELSE |
---|
| 1232 | WRITE (22) -1, -1, -1, -1 |
---|
| 1233 | ENDIF |
---|
| 1234 | ENDIF |
---|
| 1235 | #if defined( __parallel ) |
---|
| 1236 | CALL MPI_BARRIER( comm2d, ierr ) |
---|
| 1237 | #endif |
---|
| 1238 | ENDDO |
---|
[493] | 1239 | |
---|
| 1240 | ELSE |
---|
[1] | 1241 | ! |
---|
[493] | 1242 | !-- PE0 receives partial arrays from all processors of the |
---|
| 1243 | !-- respective cross section and outputs them. Here a |
---|
| 1244 | !-- barrier has to be set, because otherwise |
---|
| 1245 | !-- "-MPI- FATAL: Remote protocol queue full" may occur. |
---|
| 1246 | CALL MPI_BARRIER( comm2d, ierr ) |
---|
| 1247 | |
---|
[667] | 1248 | ngp = ( nxrg-nxlg+1 ) * ( nzt-nzb+2 ) |
---|
[493] | 1249 | IF ( myid == 0 ) THEN |
---|
[1] | 1250 | ! |
---|
[493] | 1251 | !-- Local array can be relocated directly. |
---|
| 1252 | IF ( ( section(is,s) >= nys .AND. & |
---|
| 1253 | section(is,s) <= nyn ) .OR. & |
---|
| 1254 | ( section(is,s) == -1 .AND. nys-1 == -1 ) ) & |
---|
| 1255 | THEN |
---|
[667] | 1256 | total_2d(nxlg:nxrg,nzb:nzt+1) = local_2d |
---|
[493] | 1257 | ENDIF |
---|
[1] | 1258 | ! |
---|
[493] | 1259 | !-- Receive data from all other PEs. |
---|
| 1260 | DO n = 1, numprocs-1 |
---|
| 1261 | ! |
---|
| 1262 | !-- Receive index limits first, then array. |
---|
| 1263 | !-- Index limits are received in arbitrary order from |
---|
| 1264 | !-- the PEs. |
---|
| 1265 | CALL MPI_RECV( ind(1), 4, MPI_INTEGER, & |
---|
| 1266 | MPI_ANY_SOURCE, 0, comm2d, & |
---|
[1] | 1267 | status, ierr ) |
---|
[493] | 1268 | ! |
---|
| 1269 | !-- Not all PEs have data for XZ-cross-section. |
---|
| 1270 | IF ( ind(1) /= -9999 ) THEN |
---|
| 1271 | sender = status(MPI_SOURCE) |
---|
| 1272 | DEALLOCATE( local_2d ) |
---|
| 1273 | ALLOCATE( local_2d(ind(1):ind(2), & |
---|
| 1274 | ind(3):ind(4)) ) |
---|
| 1275 | CALL MPI_RECV( local_2d(ind(1),ind(3)), ngp, & |
---|
| 1276 | MPI_REAL, sender, 1, comm2d, & |
---|
| 1277 | status, ierr ) |
---|
| 1278 | total_2d(ind(1):ind(2),ind(3):ind(4)) = & |
---|
| 1279 | local_2d |
---|
| 1280 | ENDIF |
---|
| 1281 | ENDDO |
---|
| 1282 | ! |
---|
| 1283 | !-- Output of the total cross-section. |
---|
| 1284 | IF ( iso2d_output ) THEN |
---|
[667] | 1285 | WRITE (22) total_2d(-nbgp:nx+nbgp,nzb:nzt+1) |
---|
[1] | 1286 | ENDIF |
---|
| 1287 | ! |
---|
[493] | 1288 | !-- Relocate the local array for the next loop increment |
---|
| 1289 | DEALLOCATE( local_2d ) |
---|
[667] | 1290 | ALLOCATE( local_2d(nxlg:nxrg,nzb:nzt+1) ) |
---|
[1] | 1291 | |
---|
| 1292 | #if defined( __netcdf ) |
---|
[493] | 1293 | IF ( netcdf_output ) THEN |
---|
| 1294 | nc_stat = NF90_PUT_VAR( id_set_xz(av), & |
---|
[1] | 1295 | id_var_do2d(av,if), & |
---|
| 1296 | total_2d(0:nx+1,nzb:nzt+1),& |
---|
| 1297 | start = (/ 1, is, 1, do2d_xz_time_count(av) /), & |
---|
| 1298 | count = (/ nx+2, 1, nz+2, 1 /) ) |
---|
[493] | 1299 | CALL handle_netcdf_error( 'data_output_2d', 58 ) |
---|
| 1300 | ENDIF |
---|
[1] | 1301 | #endif |
---|
| 1302 | |
---|
[493] | 1303 | ELSE |
---|
[1] | 1304 | ! |
---|
[493] | 1305 | !-- If the cross section resides on the PE, send the |
---|
| 1306 | !-- local index limits, otherwise send -9999 to PE0. |
---|
| 1307 | IF ( ( section(is,s) >= nys .AND. & |
---|
| 1308 | section(is,s) <= nyn ) .OR. & |
---|
| 1309 | ( section(is,s) == -1 .AND. nys-1 == -1 ) ) & |
---|
| 1310 | THEN |
---|
[667] | 1311 | ind(1) = nxlg; ind(2) = nxrg |
---|
[493] | 1312 | ind(3) = nzb; ind(4) = nzt+1 |
---|
| 1313 | ELSE |
---|
| 1314 | ind(1) = -9999; ind(2) = -9999 |
---|
| 1315 | ind(3) = -9999; ind(4) = -9999 |
---|
| 1316 | ENDIF |
---|
| 1317 | CALL MPI_SEND( ind(1), 4, MPI_INTEGER, 0, 0, & |
---|
| 1318 | comm2d, ierr ) |
---|
| 1319 | ! |
---|
| 1320 | !-- If applicable, send data to PE0. |
---|
| 1321 | IF ( ind(1) /= -9999 ) THEN |
---|
[667] | 1322 | CALL MPI_SEND( local_2d(nxlg,nzb), ngp, & |
---|
[493] | 1323 | MPI_REAL, 0, 1, comm2d, ierr ) |
---|
| 1324 | ENDIF |
---|
[1] | 1325 | ENDIF |
---|
| 1326 | ! |
---|
[493] | 1327 | !-- A barrier has to be set, because otherwise some PEs may |
---|
| 1328 | !-- proceed too fast so that PE0 may receive wrong data on |
---|
| 1329 | !-- tag 0 |
---|
| 1330 | CALL MPI_BARRIER( comm2d, ierr ) |
---|
[1] | 1331 | ENDIF |
---|
[493] | 1332 | |
---|
[1] | 1333 | ENDIF |
---|
| 1334 | #else |
---|
| 1335 | IF ( iso2d_output ) THEN |
---|
| 1336 | WRITE (22) local_2d(nxl:nxr+1,nzb:nzt+1) |
---|
| 1337 | ENDIF |
---|
| 1338 | #if defined( __netcdf ) |
---|
| 1339 | IF ( netcdf_output ) THEN |
---|
| 1340 | nc_stat = NF90_PUT_VAR( id_set_xz(av), & |
---|
| 1341 | id_var_do2d(av,if), & |
---|
| 1342 | local_2d(nxl:nxr+1,nzb:nzt+1), & |
---|
| 1343 | start = (/ 1, is, 1, do2d_xz_time_count(av) /), & |
---|
| 1344 | count = (/ nx+2, 1, nz+2, 1 /) ) |
---|
[493] | 1345 | CALL handle_netcdf_error( 'data_output_2d', 451 ) |
---|
[1] | 1346 | ENDIF |
---|
| 1347 | #endif |
---|
| 1348 | #endif |
---|
| 1349 | do2d_xz_n = do2d_xz_n + 1 |
---|
| 1350 | ! |
---|
| 1351 | !-- Write LOCAL-parameter set for ISO2D. |
---|
| 1352 | IF ( myid == 0 .AND. iso2d_output ) THEN |
---|
| 1353 | IF ( section(is,s) /= -1 ) THEN |
---|
| 1354 | WRITE ( section_chr, '(''y = '',F8.2,'' m (GP '',I3, & |
---|
| 1355 | &'')'')' & |
---|
| 1356 | ) section(is,s)*dy, section(is,s) |
---|
| 1357 | ELSE |
---|
| 1358 | section_chr = 'averaged along y' |
---|
| 1359 | ENDIF |
---|
| 1360 | IF ( av == 0 ) THEN |
---|
| 1361 | rtext = TRIM( do2d(av,if) ) // ' t = ' // & |
---|
| 1362 | TRIM( simulated_time_chr ) // ' ' // & |
---|
| 1363 | TRIM( section_chr ) |
---|
| 1364 | ELSE |
---|
| 1365 | rtext = TRIM( do2d(av,if) ) // ' averaged t = ' // & |
---|
| 1366 | TRIM( simulated_time_chr ) // ' ' // & |
---|
| 1367 | TRIM( section_chr ) |
---|
| 1368 | ENDIF |
---|
| 1369 | WRITE (28,LOCAL) |
---|
| 1370 | ENDIF |
---|
| 1371 | |
---|
| 1372 | CASE ( 'yz' ) |
---|
| 1373 | ! |
---|
[1031] | 1374 | !-- Update the netCDF yz cross section time axis |
---|
| 1375 | IF ( myid == 0 .OR. netcdf_data_format > 4 ) THEN |
---|
[493] | 1376 | |
---|
[1] | 1377 | IF ( simulated_time /= do2d_yz_last_time(av) ) THEN |
---|
| 1378 | do2d_yz_time_count(av) = do2d_yz_time_count(av) + 1 |
---|
| 1379 | do2d_yz_last_time(av) = simulated_time |
---|
[493] | 1380 | IF ( ( .NOT. data_output_2d_on_each_pe .AND. & |
---|
[1031] | 1381 | netcdf_output ) .OR. netcdf_data_format > 4 ) & |
---|
[493] | 1382 | THEN |
---|
[1] | 1383 | #if defined( __netcdf ) |
---|
| 1384 | nc_stat = NF90_PUT_VAR( id_set_yz(av), & |
---|
| 1385 | id_var_time_yz(av), & |
---|
[291] | 1386 | (/ time_since_reference_point /), & |
---|
[1] | 1387 | start = (/ do2d_yz_time_count(av) /), & |
---|
| 1388 | count = (/ 1 /) ) |
---|
[263] | 1389 | CALL handle_netcdf_error( 'data_output_2d', 59 ) |
---|
[1] | 1390 | #endif |
---|
| 1391 | ENDIF |
---|
| 1392 | ENDIF |
---|
[493] | 1393 | |
---|
[1] | 1394 | ENDIF |
---|
| 1395 | ! |
---|
| 1396 | !-- If required, carry out averaging along x |
---|
| 1397 | IF ( section(is,s) == -1 ) THEN |
---|
| 1398 | |
---|
[667] | 1399 | ALLOCATE( local_2d_l(nysg:nyng,nzb:nzt+1) ) |
---|
[1] | 1400 | local_2d_l = 0.0 |
---|
[667] | 1401 | ngp = ( nyng-nysg+1 ) * ( nzt-nzb+2 ) |
---|
[1] | 1402 | ! |
---|
| 1403 | !-- First local averaging on the PE |
---|
| 1404 | DO k = nzb, nzt+1 |
---|
[667] | 1405 | DO j = nysg, nyng |
---|
[1] | 1406 | DO i = nxl, nxr |
---|
| 1407 | local_2d_l(j,k) = local_2d_l(j,k) + & |
---|
| 1408 | local_pf(i,j,k) |
---|
| 1409 | ENDDO |
---|
| 1410 | ENDDO |
---|
| 1411 | ENDDO |
---|
| 1412 | #if defined( __parallel ) |
---|
| 1413 | ! |
---|
| 1414 | !-- Now do the averaging over all PEs along x |
---|
[622] | 1415 | IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
[667] | 1416 | CALL MPI_ALLREDUCE( local_2d_l(nysg,nzb), & |
---|
| 1417 | local_2d(nysg,nzb), ngp, MPI_REAL, & |
---|
[1] | 1418 | MPI_SUM, comm1dx, ierr ) |
---|
| 1419 | #else |
---|
| 1420 | local_2d = local_2d_l |
---|
| 1421 | #endif |
---|
| 1422 | local_2d = local_2d / ( nx + 1.0 ) |
---|
| 1423 | |
---|
| 1424 | DEALLOCATE( local_2d_l ) |
---|
| 1425 | |
---|
| 1426 | ELSE |
---|
| 1427 | ! |
---|
| 1428 | !-- Just store the respective section on the local array |
---|
| 1429 | !-- (but only if it is available on this PE!) |
---|
| 1430 | IF ( section(is,s) >= nxl .AND. section(is,s) <= nxr ) & |
---|
| 1431 | THEN |
---|
| 1432 | local_2d = local_pf(section(is,s),:,nzb:nzt+1) |
---|
| 1433 | ENDIF |
---|
| 1434 | |
---|
| 1435 | ENDIF |
---|
| 1436 | |
---|
| 1437 | #if defined( __parallel ) |
---|
[1031] | 1438 | IF ( netcdf_output .AND. netcdf_data_format > 4 ) THEN |
---|
[1] | 1439 | ! |
---|
[493] | 1440 | !-- ATTENTION: The following lines are a workaround, because |
---|
| 1441 | !-- independet output does not work with the |
---|
[1031] | 1442 | !-- current netCDF4 installation. Therefore, data |
---|
[493] | 1443 | !-- are transferred from PEs having the cross |
---|
| 1444 | !-- sections to other PEs along y having no cross |
---|
| 1445 | !-- section data. Some of these data are the |
---|
| 1446 | !-- output. |
---|
| 1447 | !-- BEGIN WORKAROUND--------------------------------------- |
---|
| 1448 | IF ( npex /= 1 .AND. section(is,s) /= -1) THEN |
---|
[667] | 1449 | ALLOCATE( local_2d_l(nysg:nyng,nzb:nzt+1) ) |
---|
[493] | 1450 | local_2d_l = 0.0 |
---|
| 1451 | IF ( section(is,s) >= nxl .AND. section(is,s) <= nxr )& |
---|
| 1452 | THEN |
---|
| 1453 | local_2d_l = local_2d |
---|
| 1454 | ENDIF |
---|
| 1455 | #if defined( __parallel ) |
---|
| 1456 | ! |
---|
| 1457 | !-- Distribute data over all PEs along x |
---|
[667] | 1458 | ngp = ( nyng-nysg+1 ) * ( nzt-nzb + 2 ) |
---|
[622] | 1459 | IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
[667] | 1460 | CALL MPI_ALLREDUCE( local_2d_l(nysg,nzb), & |
---|
| 1461 | local_2d(nysg,nzb), ngp, & |
---|
[493] | 1462 | MPI_REAL, MPI_SUM, comm1dx, ierr ) |
---|
| 1463 | #else |
---|
| 1464 | local_2d = local_2d_l |
---|
| 1465 | #endif |
---|
| 1466 | DEALLOCATE( local_2d_l ) |
---|
| 1467 | ENDIF |
---|
| 1468 | !-- END WORKAROUND----------------------------------------- |
---|
| 1469 | |
---|
| 1470 | ! |
---|
[1031] | 1471 | !-- Output in netCDF4/HDF5 format. |
---|
[493] | 1472 | !-- Output only on those PEs where the respective cross |
---|
| 1473 | !-- sections reside. Cross sections averaged along x are |
---|
| 1474 | !-- output on the respective first PE along x (myidx=0). |
---|
| 1475 | IF ( ( section(is,s) >= nxl .AND. & |
---|
| 1476 | section(is,s) <= nxr ) .OR. & |
---|
| 1477 | ( section(is,s) == -1 .AND. myidx == 0 ) ) THEN |
---|
| 1478 | ! |
---|
| 1479 | !-- Do not output redundant ghost point data except for the |
---|
| 1480 | !-- boundaries of the total domain. |
---|
[1] | 1481 | #if defined( __netcdf ) |
---|
[493] | 1482 | IF ( nyn == ny ) THEN |
---|
| 1483 | nc_stat = NF90_PUT_VAR( id_set_yz(av), & |
---|
| 1484 | id_var_do2d(av,if), & |
---|
| 1485 | local_2d(nys:nyn+1,nzb:nzt+1), & |
---|
| 1486 | start = (/ is, nys+1, 1, & |
---|
| 1487 | do2d_yz_time_count(av) /), & |
---|
| 1488 | count = (/ 1, nyn-nys+2, & |
---|
| 1489 | nzt+2, 1 /) ) |
---|
| 1490 | ELSE |
---|
| 1491 | nc_stat = NF90_PUT_VAR( id_set_yz(av), & |
---|
| 1492 | id_var_do2d(av,if), & |
---|
| 1493 | local_2d(nys:nyn,nzb:nzt+1), & |
---|
| 1494 | start = (/ is, nys+1, 1, & |
---|
| 1495 | do2d_yz_time_count(av) /), & |
---|
| 1496 | count = (/ 1, nyn-nys+1, & |
---|
| 1497 | nzt+2, 1 /) ) |
---|
| 1498 | ENDIF |
---|
| 1499 | |
---|
| 1500 | CALL handle_netcdf_error( 'data_output_2d', 60 ) |
---|
| 1501 | |
---|
| 1502 | ELSE |
---|
| 1503 | ! |
---|
| 1504 | !-- Output on other PEs. Only one point is output!! |
---|
| 1505 | !-- ATTENTION: This is a workaround (see above)!! |
---|
| 1506 | IF ( npex /= 1 ) THEN |
---|
| 1507 | nc_stat = NF90_PUT_VAR( id_set_yz(av), & |
---|
| 1508 | id_var_do2d(av,if), & |
---|
| 1509 | local_2d(nys:nys,nzb:nzb), & |
---|
| 1510 | start = (/ is, nys+1, 1, & |
---|
| 1511 | do2d_yz_time_count(av) /), & |
---|
| 1512 | count = (/ 1, 1, 1, 1 /) ) |
---|
| 1513 | CALL handle_netcdf_error( 'data_output_2d', 452 ) |
---|
| 1514 | ENDIF |
---|
[1] | 1515 | #endif |
---|
| 1516 | ENDIF |
---|
| 1517 | |
---|
| 1518 | ELSE |
---|
| 1519 | |
---|
[493] | 1520 | IF ( data_output_2d_on_each_pe ) THEN |
---|
[1] | 1521 | ! |
---|
[493] | 1522 | !-- Output of partial arrays on each PE. If the cross |
---|
| 1523 | !-- section does not reside on the PE, output special |
---|
| 1524 | !-- index values. |
---|
| 1525 | #if defined( __netcdf ) |
---|
| 1526 | IF ( netcdf_output .AND. myid == 0 ) THEN |
---|
[691] | 1527 | WRITE ( 23 ) time_since_reference_point, & |
---|
[493] | 1528 | do2d_yz_time_count(av), av |
---|
| 1529 | ENDIF |
---|
| 1530 | #endif |
---|
[759] | 1531 | DO i = 0, io_blocks-1 |
---|
| 1532 | IF ( i == io_group ) THEN |
---|
| 1533 | IF ( ( section(is,s) >= nxl .AND. & |
---|
| 1534 | section(is,s) <= nxr ) .OR. & |
---|
| 1535 | ( section(is,s) == -1 .AND. & |
---|
| 1536 | nxl-1 == -1 ) ) & |
---|
| 1537 | THEN |
---|
| 1538 | WRITE (23) nysg, nyng, nzb, nzt+1 |
---|
| 1539 | WRITE (23) local_2d |
---|
| 1540 | ELSE |
---|
| 1541 | WRITE (23) -1, -1, -1, -1 |
---|
| 1542 | ENDIF |
---|
| 1543 | ENDIF |
---|
| 1544 | #if defined( __parallel ) |
---|
| 1545 | CALL MPI_BARRIER( comm2d, ierr ) |
---|
| 1546 | #endif |
---|
| 1547 | ENDDO |
---|
[493] | 1548 | |
---|
| 1549 | ELSE |
---|
[1] | 1550 | ! |
---|
[493] | 1551 | !-- PE0 receives partial arrays from all processors of the |
---|
| 1552 | !-- respective cross section and outputs them. Here a |
---|
| 1553 | !-- barrier has to be set, because otherwise |
---|
| 1554 | !-- "-MPI- FATAL: Remote protocol queue full" may occur. |
---|
| 1555 | CALL MPI_BARRIER( comm2d, ierr ) |
---|
| 1556 | |
---|
[667] | 1557 | ngp = ( nyng-nysg+1 ) * ( nzt-nzb+2 ) |
---|
[493] | 1558 | IF ( myid == 0 ) THEN |
---|
[1] | 1559 | ! |
---|
[493] | 1560 | !-- Local array can be relocated directly. |
---|
| 1561 | IF ( ( section(is,s) >= nxl .AND. & |
---|
| 1562 | section(is,s) <= nxr ) .OR. & |
---|
| 1563 | ( section(is,s) == -1 .AND. nxl-1 == -1 ) ) & |
---|
| 1564 | THEN |
---|
[667] | 1565 | total_2d(nysg:nyng,nzb:nzt+1) = local_2d |
---|
[493] | 1566 | ENDIF |
---|
[1] | 1567 | ! |
---|
[493] | 1568 | !-- Receive data from all other PEs. |
---|
| 1569 | DO n = 1, numprocs-1 |
---|
| 1570 | ! |
---|
| 1571 | !-- Receive index limits first, then array. |
---|
| 1572 | !-- Index limits are received in arbitrary order from |
---|
| 1573 | !-- the PEs. |
---|
| 1574 | CALL MPI_RECV( ind(1), 4, MPI_INTEGER, & |
---|
| 1575 | MPI_ANY_SOURCE, 0, comm2d, & |
---|
[1] | 1576 | status, ierr ) |
---|
[493] | 1577 | ! |
---|
| 1578 | !-- Not all PEs have data for YZ-cross-section. |
---|
| 1579 | IF ( ind(1) /= -9999 ) THEN |
---|
| 1580 | sender = status(MPI_SOURCE) |
---|
| 1581 | DEALLOCATE( local_2d ) |
---|
| 1582 | ALLOCATE( local_2d(ind(1):ind(2), & |
---|
| 1583 | ind(3):ind(4)) ) |
---|
| 1584 | CALL MPI_RECV( local_2d(ind(1),ind(3)), ngp, & |
---|
| 1585 | MPI_REAL, sender, 1, comm2d, & |
---|
| 1586 | status, ierr ) |
---|
| 1587 | total_2d(ind(1):ind(2),ind(3):ind(4)) = & |
---|
| 1588 | local_2d |
---|
| 1589 | ENDIF |
---|
| 1590 | ENDDO |
---|
| 1591 | ! |
---|
| 1592 | !-- Output of the total cross-section. |
---|
| 1593 | IF ( iso2d_output ) THEN |
---|
| 1594 | WRITE (23) total_2d(0:ny+1,nzb:nzt+1) |
---|
[1] | 1595 | ENDIF |
---|
| 1596 | ! |
---|
[493] | 1597 | !-- Relocate the local array for the next loop increment |
---|
| 1598 | DEALLOCATE( local_2d ) |
---|
[667] | 1599 | ALLOCATE( local_2d(nysg:nyng,nzb:nzt+1) ) |
---|
[1] | 1600 | |
---|
| 1601 | #if defined( __netcdf ) |
---|
[493] | 1602 | IF ( netcdf_output ) THEN |
---|
| 1603 | nc_stat = NF90_PUT_VAR( id_set_yz(av), & |
---|
[1] | 1604 | id_var_do2d(av,if), & |
---|
| 1605 | total_2d(0:ny+1,nzb:nzt+1),& |
---|
| 1606 | start = (/ is, 1, 1, do2d_yz_time_count(av) /), & |
---|
| 1607 | count = (/ 1, ny+2, nz+2, 1 /) ) |
---|
[493] | 1608 | CALL handle_netcdf_error( 'data_output_2d', 61 ) |
---|
| 1609 | ENDIF |
---|
[1] | 1610 | #endif |
---|
| 1611 | |
---|
[493] | 1612 | ELSE |
---|
[1] | 1613 | ! |
---|
[493] | 1614 | !-- If the cross section resides on the PE, send the |
---|
| 1615 | !-- local index limits, otherwise send -9999 to PE0. |
---|
| 1616 | IF ( ( section(is,s) >= nxl .AND. & |
---|
| 1617 | section(is,s) <= nxr ) .OR. & |
---|
| 1618 | ( section(is,s) == -1 .AND. nxl-1 == -1 ) ) & |
---|
| 1619 | THEN |
---|
[667] | 1620 | ind(1) = nysg; ind(2) = nyng |
---|
[493] | 1621 | ind(3) = nzb; ind(4) = nzt+1 |
---|
| 1622 | ELSE |
---|
| 1623 | ind(1) = -9999; ind(2) = -9999 |
---|
| 1624 | ind(3) = -9999; ind(4) = -9999 |
---|
| 1625 | ENDIF |
---|
| 1626 | CALL MPI_SEND( ind(1), 4, MPI_INTEGER, 0, 0, & |
---|
| 1627 | comm2d, ierr ) |
---|
| 1628 | ! |
---|
| 1629 | !-- If applicable, send data to PE0. |
---|
| 1630 | IF ( ind(1) /= -9999 ) THEN |
---|
[667] | 1631 | CALL MPI_SEND( local_2d(nysg,nzb), ngp, & |
---|
[493] | 1632 | MPI_REAL, 0, 1, comm2d, ierr ) |
---|
| 1633 | ENDIF |
---|
[1] | 1634 | ENDIF |
---|
| 1635 | ! |
---|
[493] | 1636 | !-- A barrier has to be set, because otherwise some PEs may |
---|
| 1637 | !-- proceed too fast so that PE0 may receive wrong data on |
---|
| 1638 | !-- tag 0 |
---|
| 1639 | CALL MPI_BARRIER( comm2d, ierr ) |
---|
[1] | 1640 | ENDIF |
---|
[493] | 1641 | |
---|
[1] | 1642 | ENDIF |
---|
| 1643 | #else |
---|
| 1644 | IF ( iso2d_output ) THEN |
---|
| 1645 | WRITE (23) local_2d(nys:nyn+1,nzb:nzt+1) |
---|
| 1646 | ENDIF |
---|
| 1647 | #if defined( __netcdf ) |
---|
| 1648 | IF ( netcdf_output ) THEN |
---|
| 1649 | nc_stat = NF90_PUT_VAR( id_set_yz(av), & |
---|
| 1650 | id_var_do2d(av,if), & |
---|
| 1651 | local_2d(nys:nyn+1,nzb:nzt+1), & |
---|
| 1652 | start = (/ is, 1, 1, do2d_xz_time_count(av) /), & |
---|
| 1653 | count = (/ 1, ny+2, nz+2, 1 /) ) |
---|
[493] | 1654 | CALL handle_netcdf_error( 'data_output_2d', 452 ) |
---|
[1] | 1655 | ENDIF |
---|
| 1656 | #endif |
---|
| 1657 | #endif |
---|
| 1658 | do2d_yz_n = do2d_yz_n + 1 |
---|
| 1659 | ! |
---|
| 1660 | !-- Write LOCAL-parameter set for ISO2D. |
---|
| 1661 | IF ( myid == 0 .AND. iso2d_output ) THEN |
---|
| 1662 | IF ( section(is,s) /= -1 ) THEN |
---|
| 1663 | WRITE ( section_chr, '(''x = '',F8.2,'' m (GP '',I3, & |
---|
| 1664 | &'')'')' & |
---|
| 1665 | ) section(is,s)*dx, section(is,s) |
---|
| 1666 | ELSE |
---|
| 1667 | section_chr = 'averaged along x' |
---|
| 1668 | ENDIF |
---|
| 1669 | IF ( av == 0 ) THEN |
---|
| 1670 | rtext = TRIM( do2d(av,if) ) // ' t = ' // & |
---|
| 1671 | TRIM( simulated_time_chr ) // ' ' // & |
---|
| 1672 | TRIM( section_chr ) |
---|
| 1673 | ELSE |
---|
| 1674 | rtext = TRIM( do2d(av,if) ) // ' averaged t = ' // & |
---|
| 1675 | TRIM( simulated_time_chr ) // ' ' // & |
---|
| 1676 | TRIM( section_chr ) |
---|
| 1677 | ENDIF |
---|
| 1678 | WRITE (29,LOCAL) |
---|
| 1679 | ENDIF |
---|
| 1680 | |
---|
| 1681 | END SELECT |
---|
| 1682 | |
---|
| 1683 | is = is + 1 |
---|
| 1684 | ENDDO loop1 |
---|
| 1685 | |
---|
| 1686 | ENDIF |
---|
| 1687 | |
---|
| 1688 | if = if + 1 |
---|
| 1689 | l = MAX( 2, LEN_TRIM( do2d(av,if) ) ) |
---|
| 1690 | do2d_mode = do2d(av,if)(l-1:l) |
---|
| 1691 | |
---|
| 1692 | ENDDO |
---|
| 1693 | |
---|
| 1694 | ! |
---|
| 1695 | !-- Deallocate temporary arrays. |
---|
| 1696 | IF ( ALLOCATED( level_z ) ) DEALLOCATE( level_z ) |
---|
| 1697 | DEALLOCATE( local_pf, local_2d ) |
---|
| 1698 | #if defined( __parallel ) |
---|
| 1699 | IF ( .NOT. data_output_2d_on_each_pe .AND. myid == 0 ) THEN |
---|
| 1700 | DEALLOCATE( total_2d ) |
---|
| 1701 | ENDIF |
---|
| 1702 | #endif |
---|
| 1703 | |
---|
| 1704 | ! |
---|
| 1705 | !-- Close plot output file. |
---|
| 1706 | file_id = 20 + s |
---|
| 1707 | |
---|
| 1708 | IF ( data_output_2d_on_each_pe ) THEN |
---|
[759] | 1709 | DO i = 0, io_blocks-1 |
---|
| 1710 | IF ( i == io_group ) THEN |
---|
| 1711 | CALL close_file( file_id ) |
---|
| 1712 | ENDIF |
---|
| 1713 | #if defined( __parallel ) |
---|
| 1714 | CALL MPI_BARRIER( comm2d, ierr ) |
---|
| 1715 | #endif |
---|
| 1716 | ENDDO |
---|
[1] | 1717 | ELSE |
---|
| 1718 | IF ( myid == 0 ) CALL close_file( file_id ) |
---|
| 1719 | ENDIF |
---|
| 1720 | |
---|
| 1721 | |
---|
| 1722 | CALL cpu_log (log_point(3),'data_output_2d','stop','nobarrier') |
---|
| 1723 | |
---|
| 1724 | END SUBROUTINE data_output_2d |
---|