[1] | 1 | SUBROUTINE data_output_3d( 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 | ! ----------------- |
---|
[1076] | 22 | ! Bugfix in output of ql |
---|
[674] | 23 | ! |
---|
[392] | 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! $Id: data_output_3d.f90 1076 2012-12-05 08:30:18Z hoffmann $ |
---|
| 27 | ! |
---|
[1054] | 28 | ! 1053 2012-11-13 17:11:03Z hoffmann |
---|
| 29 | ! +nr, qr, prr, qc and averaged quantities |
---|
| 30 | ! |
---|
[1037] | 31 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 32 | ! code put under GPL (PALM 3.9) |
---|
| 33 | ! |
---|
[1035] | 34 | ! 1031 2012-10-19 14:35:30Z raasch |
---|
| 35 | ! netCDF4 without parallel file support implemented |
---|
| 36 | ! |
---|
[1008] | 37 | ! 1007 2012-09-19 14:30:36Z franke |
---|
| 38 | ! Bugfix: missing calculation of ql_vp added |
---|
| 39 | ! |
---|
[791] | 40 | ! 790 2011-11-29 03:11:20Z raasch |
---|
| 41 | ! bugfix: calculation of 'pr' must depend on the particle weighting factor, |
---|
| 42 | ! nzt+1 replaced by nz_do3d for 'pr' |
---|
| 43 | ! |
---|
[772] | 44 | ! 771 2011-10-27 10:56:21Z heinze |
---|
| 45 | ! +lpt |
---|
| 46 | ! |
---|
[760] | 47 | ! 759 2011-09-15 13:58:31Z raasch |
---|
| 48 | ! Splitting of parallel I/O |
---|
| 49 | ! |
---|
[728] | 50 | ! 727 2011-04-20 20:05:25Z suehring |
---|
| 51 | ! Exchange ghost layers also for p_av. |
---|
| 52 | ! |
---|
[726] | 53 | ! 725 2011-04-11 09:37:01Z suehring |
---|
| 54 | ! Exchange ghost layers for p regardless of used pressure solver (except SOR). |
---|
| 55 | ! |
---|
[692] | 56 | ! 691 2011-03-04 08:45:30Z maronga |
---|
| 57 | ! Replaced simulated_time by time_since_reference_point |
---|
| 58 | ! |
---|
[674] | 59 | ! 673 2011-01-18 16:19:48Z suehring |
---|
| 60 | ! When using Multigrid or SOR solver an additional CALL exchange_horiz is |
---|
| 61 | ! is needed for pressure output. |
---|
| 62 | ! |
---|
[668] | 63 | ! 667 2010-12-23 12:06:00Z suehring/gryschka |
---|
| 64 | ! nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng in loops and |
---|
| 65 | ! allocation of arrays. Calls of exchange_horiz are modified. |
---|
| 66 | ! Skip-value skip_do_avs changed to a dynamic adaption of ghost points. |
---|
| 67 | ! |
---|
[647] | 68 | ! 646 2010-12-15 13:03:52Z raasch |
---|
| 69 | ! bugfix: missing define statements for netcdf added |
---|
| 70 | ! |
---|
[494] | 71 | ! 493 2010-03-01 08:30:24Z raasch |
---|
[1031] | 72 | ! netCDF4 support (parallel output) |
---|
[494] | 73 | ! |
---|
[392] | 74 | ! 355 2009-07-17 01:03:01Z letzel |
---|
[1031] | 75 | ! simulated_time in netCDF output replaced by time_since_reference_point. |
---|
| 76 | ! Output of netCDF messages with aid of message handling routine. |
---|
[254] | 77 | ! Output of messages replaced by message handling routine. |
---|
[355] | 78 | ! Bugfix: to_be_resorted => s_av for time-averaged scalars |
---|
[1] | 79 | ! |
---|
[98] | 80 | ! 96 2007-06-04 08:07:41Z raasch |
---|
| 81 | ! Output of density and salinity |
---|
| 82 | ! |
---|
[77] | 83 | ! 75 2007-03-22 09:54:05Z raasch |
---|
| 84 | ! 2nd+3rd argument removed from exchange horiz |
---|
| 85 | ! |
---|
[3] | 86 | ! RCS Log replace by Id keyword, revision history cleaned up |
---|
| 87 | ! |
---|
[1] | 88 | ! Revision 1.3 2006/06/02 15:18:59 raasch |
---|
| 89 | ! +argument "found", -argument grid in call of routine user_data_output_3d |
---|
| 90 | ! |
---|
| 91 | ! Revision 1.2 2006/02/23 10:23:07 raasch |
---|
| 92 | ! Former subroutine plot_3d renamed data_output_3d, pl.. renamed do.., |
---|
| 93 | ! .._anz renamed .._n, |
---|
| 94 | ! output extended to (almost) all quantities, output of user-defined quantities |
---|
| 95 | ! |
---|
| 96 | ! Revision 1.1 1997/09/03 06:29:36 raasch |
---|
| 97 | ! Initial revision |
---|
| 98 | ! |
---|
| 99 | ! |
---|
| 100 | ! Description: |
---|
| 101 | ! ------------ |
---|
[1031] | 102 | ! Output of the 3D-arrays in netCDF and/or AVS format. |
---|
[1] | 103 | !------------------------------------------------------------------------------! |
---|
| 104 | |
---|
| 105 | USE array_kind |
---|
| 106 | USE arrays_3d |
---|
| 107 | USE averaging |
---|
| 108 | USE cloud_parameters |
---|
| 109 | USE control_parameters |
---|
| 110 | USE cpulog |
---|
| 111 | USE indices |
---|
| 112 | USE interfaces |
---|
| 113 | USE netcdf_control |
---|
| 114 | USE particle_attributes |
---|
| 115 | USE pegrid |
---|
| 116 | |
---|
| 117 | IMPLICIT NONE |
---|
| 118 | |
---|
| 119 | CHARACTER (LEN=9) :: simulated_time_mod |
---|
| 120 | |
---|
[559] | 121 | INTEGER :: av, i, if, j, k, n, pos, prec, psi |
---|
[1] | 122 | |
---|
| 123 | LOGICAL :: found, resorted |
---|
| 124 | |
---|
| 125 | REAL :: mean_r, s_r3, s_r4 |
---|
| 126 | |
---|
| 127 | REAL(spk), DIMENSION(:,:,:), ALLOCATABLE :: local_pf |
---|
| 128 | |
---|
| 129 | REAL, DIMENSION(:,:,:), POINTER :: to_be_resorted |
---|
| 130 | |
---|
| 131 | ! |
---|
| 132 | !-- Return, if nothing to output |
---|
| 133 | IF ( do3d_no(av) == 0 ) RETURN |
---|
| 134 | |
---|
| 135 | CALL cpu_log (log_point(14),'data_output_3d','start') |
---|
| 136 | |
---|
| 137 | ! |
---|
| 138 | !-- Open output file. |
---|
| 139 | !-- Also creates coordinate and fld-file for AVS. |
---|
[1031] | 140 | !-- For classic or 64bit netCDF output or output of other (old) data formats, |
---|
[493] | 141 | !-- for a run on more than one PE, each PE opens its own file and |
---|
[1] | 142 | !-- writes the data of its subdomain in binary format (regardless of the format |
---|
| 143 | !-- the user has requested). After the run, these files are combined to one |
---|
| 144 | !-- file by combine_plot_fields in the format requested by the user (netcdf |
---|
[493] | 145 | !-- and/or avs). |
---|
[1031] | 146 | !-- For netCDF4/HDF5 output, data is written in parallel into one file. |
---|
[493] | 147 | IF ( netcdf_output ) THEN |
---|
[1031] | 148 | IF ( netcdf_data_format < 5 ) THEN |
---|
[493] | 149 | CALL check_open( 30 ) |
---|
| 150 | IF ( myid == 0 ) CALL check_open( 106+av*10 ) |
---|
| 151 | ELSE |
---|
| 152 | CALL check_open( 106+av*10 ) |
---|
| 153 | ENDIF |
---|
| 154 | ELSE |
---|
| 155 | IF ( avs_output .OR. ( numprocs > 1 ) ) CALL check_open( 30 ) |
---|
| 156 | ENDIF |
---|
[1] | 157 | |
---|
| 158 | ! |
---|
| 159 | !-- Allocate a temporary array with the desired output dimensions. |
---|
[667] | 160 | ALLOCATE( local_pf(nxlg:nxrg,nysg:nyng,nzb:nz_do3d) ) |
---|
[1] | 161 | |
---|
| 162 | ! |
---|
[1031] | 163 | !-- Update the netCDF time axis |
---|
[1] | 164 | #if defined( __netcdf ) |
---|
[1031] | 165 | IF ( myid == 0 .OR. netcdf_data_format > 4 ) THEN |
---|
[493] | 166 | do3d_time_count(av) = do3d_time_count(av) + 1 |
---|
| 167 | IF ( netcdf_output ) THEN |
---|
| 168 | nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_time_3d(av), & |
---|
| 169 | (/ time_since_reference_point /), & |
---|
| 170 | start = (/ do3d_time_count(av) /), & |
---|
| 171 | count = (/ 1 /) ) |
---|
| 172 | CALL handle_netcdf_error( 'data_output_3d', 376 ) |
---|
| 173 | ENDIF |
---|
[1] | 174 | ENDIF |
---|
| 175 | #endif |
---|
| 176 | |
---|
| 177 | ! |
---|
| 178 | !-- Loop over all variables to be written. |
---|
| 179 | if = 1 |
---|
| 180 | |
---|
| 181 | DO WHILE ( do3d(av,if)(1:1) /= ' ' ) |
---|
| 182 | ! |
---|
| 183 | !-- Set the precision for data compression. |
---|
| 184 | IF ( do3d_compress ) THEN |
---|
| 185 | DO i = 1, 100 |
---|
| 186 | IF ( plot_3d_precision(i)%variable == do3d(av,if) ) THEN |
---|
| 187 | prec = plot_3d_precision(i)%precision |
---|
| 188 | EXIT |
---|
| 189 | ENDIF |
---|
| 190 | ENDDO |
---|
| 191 | ENDIF |
---|
| 192 | |
---|
| 193 | ! |
---|
| 194 | !-- Store the array chosen on the temporary array. |
---|
| 195 | resorted = .FALSE. |
---|
| 196 | SELECT CASE ( TRIM( do3d(av,if) ) ) |
---|
| 197 | |
---|
| 198 | CASE ( 'e' ) |
---|
| 199 | IF ( av == 0 ) THEN |
---|
| 200 | to_be_resorted => e |
---|
| 201 | ELSE |
---|
| 202 | to_be_resorted => e_av |
---|
| 203 | ENDIF |
---|
| 204 | |
---|
[771] | 205 | CASE ( 'lpt' ) |
---|
| 206 | IF ( av == 0 ) THEN |
---|
| 207 | to_be_resorted => pt |
---|
| 208 | ELSE |
---|
| 209 | to_be_resorted => lpt_av |
---|
| 210 | ENDIF |
---|
| 211 | |
---|
[1053] | 212 | CASE ( 'nr' ) |
---|
| 213 | IF ( av == 0 ) THEN |
---|
| 214 | to_be_resorted => nr |
---|
| 215 | ELSE |
---|
| 216 | to_be_resorted => nr_av |
---|
| 217 | ENDIF |
---|
| 218 | |
---|
[1] | 219 | CASE ( 'p' ) |
---|
| 220 | IF ( av == 0 ) THEN |
---|
[727] | 221 | IF ( psolver /= 'sor' ) CALL exchange_horiz( p, nbgp ) |
---|
[1] | 222 | to_be_resorted => p |
---|
| 223 | ELSE |
---|
[727] | 224 | IF ( psolver /= 'sor' ) CALL exchange_horiz( p_av, nbgp ) |
---|
[1] | 225 | to_be_resorted => p_av |
---|
| 226 | ENDIF |
---|
| 227 | |
---|
| 228 | CASE ( 'pc' ) ! particle concentration (requires ghostpoint exchange) |
---|
| 229 | IF ( av == 0 ) THEN |
---|
| 230 | tend = prt_count |
---|
[667] | 231 | CALL exchange_horiz( tend, nbgp ) |
---|
| 232 | DO i = nxlg, nxrg |
---|
| 233 | DO j = nysg, nyng |
---|
[1] | 234 | DO k = nzb, nz_do3d |
---|
| 235 | local_pf(i,j,k) = tend(k,j,i) |
---|
| 236 | ENDDO |
---|
| 237 | ENDDO |
---|
| 238 | ENDDO |
---|
| 239 | resorted = .TRUE. |
---|
| 240 | ELSE |
---|
[667] | 241 | CALL exchange_horiz( pc_av, nbgp ) |
---|
[1] | 242 | to_be_resorted => pc_av |
---|
| 243 | ENDIF |
---|
| 244 | |
---|
| 245 | CASE ( 'pr' ) ! mean particle radius |
---|
| 246 | IF ( av == 0 ) THEN |
---|
| 247 | DO i = nxl, nxr |
---|
| 248 | DO j = nys, nyn |
---|
[790] | 249 | DO k = nzb, nz_do3d |
---|
[1] | 250 | psi = prt_start_index(k,j,i) |
---|
| 251 | s_r3 = 0.0 |
---|
| 252 | s_r4 = 0.0 |
---|
| 253 | DO n = psi, psi+prt_count(k,j,i)-1 |
---|
[790] | 254 | s_r3 = s_r3 + particles(n)%radius**3 * & |
---|
| 255 | particles(n)%weight_factor |
---|
| 256 | s_r4 = s_r4 + particles(n)%radius**4 * & |
---|
| 257 | particles(n)%weight_factor |
---|
[1] | 258 | ENDDO |
---|
| 259 | IF ( s_r3 /= 0.0 ) THEN |
---|
| 260 | mean_r = s_r4 / s_r3 |
---|
| 261 | ELSE |
---|
| 262 | mean_r = 0.0 |
---|
| 263 | ENDIF |
---|
| 264 | tend(k,j,i) = mean_r |
---|
| 265 | ENDDO |
---|
| 266 | ENDDO |
---|
| 267 | ENDDO |
---|
[667] | 268 | CALL exchange_horiz( tend, nbgp ) |
---|
| 269 | DO i = nxlg, nxrg |
---|
| 270 | DO j = nysg, nyng |
---|
[790] | 271 | DO k = nzb, nz_do3d |
---|
[1] | 272 | local_pf(i,j,k) = tend(k,j,i) |
---|
| 273 | ENDDO |
---|
| 274 | ENDDO |
---|
| 275 | ENDDO |
---|
| 276 | resorted = .TRUE. |
---|
| 277 | ELSE |
---|
[667] | 278 | CALL exchange_horiz( pr_av, nbgp ) |
---|
[1] | 279 | to_be_resorted => pr_av |
---|
| 280 | ENDIF |
---|
| 281 | |
---|
[1053] | 282 | CASE ( 'prr' ) |
---|
| 283 | IF ( av == 0 ) THEN |
---|
| 284 | CALL exchange_horiz( prr, nbgp ) |
---|
| 285 | DO i = nxlg, nxrg |
---|
| 286 | DO j = nysg, nyng |
---|
| 287 | DO k = nzb, nzt+1 |
---|
| 288 | local_pf(i,j,k) = prr(k,j,i) |
---|
| 289 | ENDDO |
---|
| 290 | ENDDO |
---|
| 291 | ENDDO |
---|
| 292 | ELSE |
---|
| 293 | CALL exchange_horiz( prr_av, nbgp ) |
---|
| 294 | DO i = nxlg, nxrg |
---|
| 295 | DO j = nysg, nyng |
---|
| 296 | DO k = nzb, nzt+1 |
---|
| 297 | local_pf(i,j,k) = prr_av(k,j,i) |
---|
| 298 | ENDDO |
---|
| 299 | ENDDO |
---|
| 300 | ENDDO |
---|
| 301 | ENDIF |
---|
| 302 | resorted = .TRUE. |
---|
| 303 | |
---|
[1] | 304 | CASE ( 'pt' ) |
---|
| 305 | IF ( av == 0 ) THEN |
---|
| 306 | IF ( .NOT. cloud_physics ) THEN |
---|
| 307 | to_be_resorted => pt |
---|
| 308 | ELSE |
---|
[667] | 309 | DO i = nxlg, nxrg |
---|
| 310 | DO j = nysg, nyng |
---|
[1] | 311 | DO k = nzb, nz_do3d |
---|
| 312 | local_pf(i,j,k) = pt(k,j,i) + l_d_cp * & |
---|
| 313 | pt_d_t(k) * & |
---|
| 314 | ql(k,j,i) |
---|
| 315 | ENDDO |
---|
| 316 | ENDDO |
---|
| 317 | ENDDO |
---|
| 318 | resorted = .TRUE. |
---|
| 319 | ENDIF |
---|
| 320 | ELSE |
---|
| 321 | to_be_resorted => pt_av |
---|
| 322 | ENDIF |
---|
| 323 | |
---|
| 324 | CASE ( 'q' ) |
---|
| 325 | IF ( av == 0 ) THEN |
---|
| 326 | to_be_resorted => q |
---|
| 327 | ELSE |
---|
| 328 | to_be_resorted => q_av |
---|
| 329 | ENDIF |
---|
[691] | 330 | |
---|
[1053] | 331 | CASE ( 'qc' ) |
---|
[1] | 332 | IF ( av == 0 ) THEN |
---|
| 333 | to_be_resorted => ql |
---|
| 334 | ELSE |
---|
| 335 | to_be_resorted => ql_av |
---|
| 336 | ENDIF |
---|
| 337 | |
---|
[1053] | 338 | CASE ( 'ql' ) |
---|
| 339 | IF ( av == 0 ) THEN |
---|
[1076] | 340 | IF ( cloud_physics .AND. icloud_scheme == 0 ) THEN |
---|
[1053] | 341 | DO i = nxlg, nxrg |
---|
| 342 | DO j = nysg, nyng |
---|
| 343 | DO k = nzb, nz_do3d |
---|
| 344 | local_pf(i,j,k) = ql(k,j,i) + qr(k,j,i) |
---|
| 345 | ENDDO |
---|
| 346 | ENDDO |
---|
| 347 | ENDDO |
---|
| 348 | resorted = .TRUE. |
---|
| 349 | ELSE |
---|
| 350 | to_be_resorted => ql |
---|
| 351 | ENDIF |
---|
| 352 | ELSE |
---|
[1076] | 353 | IF ( cloud_physics .AND. icloud_scheme == 0 ) THEN |
---|
[1053] | 354 | DO i = nxlg, nxrg |
---|
| 355 | DO j = nysg, nyng |
---|
| 356 | DO k = nzb, nz_do3d |
---|
| 357 | local_pf(i,j,k) = ql_av(k,j,i) + qr_av(k,j,i) |
---|
| 358 | ENDDO |
---|
| 359 | ENDDO |
---|
| 360 | ENDDO |
---|
| 361 | resorted = .TRUE. |
---|
| 362 | ELSE |
---|
| 363 | to_be_resorted => ql_av |
---|
| 364 | ENDIF |
---|
| 365 | ENDIF |
---|
| 366 | |
---|
[1] | 367 | CASE ( 'ql_c' ) |
---|
| 368 | IF ( av == 0 ) THEN |
---|
| 369 | to_be_resorted => ql_c |
---|
| 370 | ELSE |
---|
| 371 | to_be_resorted => ql_c_av |
---|
| 372 | ENDIF |
---|
| 373 | |
---|
| 374 | CASE ( 'ql_v' ) |
---|
| 375 | IF ( av == 0 ) THEN |
---|
| 376 | to_be_resorted => ql_v |
---|
| 377 | ELSE |
---|
| 378 | to_be_resorted => ql_v_av |
---|
| 379 | ENDIF |
---|
| 380 | |
---|
| 381 | CASE ( 'ql_vp' ) |
---|
| 382 | IF ( av == 0 ) THEN |
---|
[1007] | 383 | DO i = nxl, nxr |
---|
| 384 | DO j = nys, nyn |
---|
| 385 | DO k = nzb, nz_do3d |
---|
| 386 | psi = prt_start_index(k,j,i) |
---|
| 387 | DO n = psi, psi+prt_count(k,j,i)-1 |
---|
| 388 | tend(k,j,i) = tend(k,j,i) + & |
---|
| 389 | particles(n)%weight_factor / & |
---|
| 390 | prt_count(k,j,i) |
---|
| 391 | ENDDO |
---|
| 392 | ENDDO |
---|
| 393 | ENDDO |
---|
| 394 | ENDDO |
---|
| 395 | CALL exchange_horiz( tend, nbgp ) |
---|
| 396 | DO i = nxlg, nxrg |
---|
| 397 | DO j = nysg, nyng |
---|
| 398 | DO k = nzb, nz_do3d |
---|
| 399 | local_pf(i,j,k) = tend(k,j,i) |
---|
| 400 | ENDDO |
---|
| 401 | ENDDO |
---|
| 402 | ENDDO |
---|
| 403 | resorted = .TRUE. |
---|
[1] | 404 | ELSE |
---|
[1007] | 405 | CALL exchange_horiz( ql_vp_av, nbgp ) |
---|
[1] | 406 | to_be_resorted => ql_vp_av |
---|
| 407 | ENDIF |
---|
| 408 | |
---|
[1053] | 409 | CASE ( 'qr' ) |
---|
| 410 | IF ( av == 0 ) THEN |
---|
| 411 | to_be_resorted => qr |
---|
| 412 | ELSE |
---|
| 413 | to_be_resorted => qr_av |
---|
| 414 | ENDIF |
---|
| 415 | |
---|
[1] | 416 | CASE ( 'qv' ) |
---|
| 417 | IF ( av == 0 ) THEN |
---|
[667] | 418 | DO i = nxlg, nxrg |
---|
| 419 | DO j = nysg, nyng |
---|
[1] | 420 | DO k = nzb, nz_do3d |
---|
| 421 | local_pf(i,j,k) = q(k,j,i) - ql(k,j,i) |
---|
| 422 | ENDDO |
---|
| 423 | ENDDO |
---|
| 424 | ENDDO |
---|
| 425 | resorted = .TRUE. |
---|
| 426 | ELSE |
---|
| 427 | to_be_resorted => qv_av |
---|
| 428 | ENDIF |
---|
| 429 | |
---|
[96] | 430 | CASE ( 'rho' ) |
---|
| 431 | IF ( av == 0 ) THEN |
---|
| 432 | to_be_resorted => rho |
---|
| 433 | ELSE |
---|
| 434 | to_be_resorted => rho_av |
---|
| 435 | ENDIF |
---|
[691] | 436 | |
---|
[1] | 437 | CASE ( 's' ) |
---|
| 438 | IF ( av == 0 ) THEN |
---|
| 439 | to_be_resorted => q |
---|
| 440 | ELSE |
---|
[355] | 441 | to_be_resorted => s_av |
---|
[1] | 442 | ENDIF |
---|
[691] | 443 | |
---|
[96] | 444 | CASE ( 'sa' ) |
---|
| 445 | IF ( av == 0 ) THEN |
---|
| 446 | to_be_resorted => sa |
---|
| 447 | ELSE |
---|
| 448 | to_be_resorted => sa_av |
---|
| 449 | ENDIF |
---|
[691] | 450 | |
---|
[1] | 451 | CASE ( 'u' ) |
---|
| 452 | IF ( av == 0 ) THEN |
---|
| 453 | to_be_resorted => u |
---|
| 454 | ELSE |
---|
| 455 | to_be_resorted => u_av |
---|
| 456 | ENDIF |
---|
| 457 | |
---|
| 458 | CASE ( 'v' ) |
---|
| 459 | IF ( av == 0 ) THEN |
---|
| 460 | to_be_resorted => v |
---|
| 461 | ELSE |
---|
| 462 | to_be_resorted => v_av |
---|
| 463 | ENDIF |
---|
| 464 | |
---|
| 465 | CASE ( 'vpt' ) |
---|
| 466 | IF ( av == 0 ) THEN |
---|
| 467 | to_be_resorted => vpt |
---|
| 468 | ELSE |
---|
| 469 | to_be_resorted => vpt_av |
---|
| 470 | ENDIF |
---|
| 471 | |
---|
| 472 | CASE ( 'w' ) |
---|
| 473 | IF ( av == 0 ) THEN |
---|
| 474 | to_be_resorted => w |
---|
| 475 | ELSE |
---|
| 476 | to_be_resorted => w_av |
---|
| 477 | ENDIF |
---|
| 478 | |
---|
| 479 | CASE DEFAULT |
---|
| 480 | ! |
---|
| 481 | !-- User defined quantity |
---|
| 482 | CALL user_data_output_3d( av, do3d(av,if), found, local_pf, & |
---|
| 483 | nz_do3d ) |
---|
| 484 | resorted = .TRUE. |
---|
| 485 | |
---|
[254] | 486 | IF ( .NOT. found ) THEN |
---|
[274] | 487 | message_string = 'no output available for: ' // & |
---|
| 488 | TRIM( do3d(av,if) ) |
---|
[254] | 489 | CALL message( 'data_output_3d', 'PA0182', 0, 0, 0, 6, 0 ) |
---|
[1] | 490 | ENDIF |
---|
| 491 | |
---|
| 492 | END SELECT |
---|
| 493 | |
---|
| 494 | ! |
---|
| 495 | !-- Resort the array to be output, if not done above |
---|
| 496 | IF ( .NOT. resorted ) THEN |
---|
[667] | 497 | DO i = nxlg, nxrg |
---|
| 498 | DO j = nysg, nyng |
---|
[1] | 499 | DO k = nzb, nz_do3d |
---|
| 500 | local_pf(i,j,k) = to_be_resorted(k,j,i) |
---|
| 501 | ENDDO |
---|
| 502 | ENDDO |
---|
| 503 | ENDDO |
---|
| 504 | ENDIF |
---|
| 505 | |
---|
| 506 | ! |
---|
| 507 | !-- Output of the volume data information for the AVS-FLD-file. |
---|
| 508 | do3d_avs_n = do3d_avs_n + 1 |
---|
| 509 | IF ( myid == 0 .AND. avs_output ) THEN |
---|
| 510 | ! |
---|
| 511 | !-- AVS-labels must not contain any colons. Hence they must be removed |
---|
| 512 | !-- from the time character string. |
---|
| 513 | simulated_time_mod = simulated_time_chr |
---|
| 514 | DO WHILE ( SCAN( simulated_time_mod, ':' ) /= 0 ) |
---|
| 515 | pos = SCAN( simulated_time_mod, ':' ) |
---|
| 516 | simulated_time_mod(pos:pos) = '/' |
---|
| 517 | ENDDO |
---|
| 518 | |
---|
| 519 | IF ( av == 0 ) THEN |
---|
| 520 | WRITE ( 33, 3300 ) do3d_avs_n, TRIM( avs_data_file ), & |
---|
| 521 | skip_do_avs, TRIM( do3d(av,if) ), & |
---|
| 522 | TRIM( simulated_time_mod ) |
---|
| 523 | ELSE |
---|
| 524 | WRITE ( 33, 3300 ) do3d_avs_n, TRIM( avs_data_file ), & |
---|
| 525 | skip_do_avs, TRIM( do3d(av,if) ) // & |
---|
| 526 | ' averaged', TRIM( simulated_time_mod ) |
---|
| 527 | ENDIF |
---|
| 528 | ! |
---|
| 529 | !-- Determine the Skip-value for the next array. Record end and start |
---|
| 530 | !-- require 4 byte each. |
---|
[759] | 531 | skip_do_avs = skip_do_avs + ( ( ( nx+2*nbgp ) * ( ny+2*nbgp ) * & |
---|
| 532 | ( nz_do3d+1 ) ) * 4 + 8 ) |
---|
[1] | 533 | ENDIF |
---|
| 534 | |
---|
| 535 | ! |
---|
| 536 | !-- Output of the 3D-array. (compressed/uncompressed) |
---|
| 537 | IF ( do3d_compress ) THEN |
---|
| 538 | ! |
---|
| 539 | !-- Compression, output of compression information on FLD-file and output |
---|
| 540 | !-- of compressed data. |
---|
[559] | 541 | CALL write_compressed( local_pf, 30, 33, myid, nxl, nxr, nyn, nys, & |
---|
[667] | 542 | nzb, nz_do3d, prec, nbgp ) |
---|
[1] | 543 | ELSE |
---|
| 544 | ! |
---|
| 545 | !-- Uncompressed output. |
---|
| 546 | #if defined( __parallel ) |
---|
[493] | 547 | IF ( netcdf_output ) THEN |
---|
[1031] | 548 | IF ( netcdf_data_format < 5 ) THEN |
---|
[493] | 549 | ! |
---|
[1031] | 550 | !-- Non-parallel netCDF output. Data is output in parallel in |
---|
| 551 | !-- FORTRAN binary format here, and later collected into one file by |
---|
[493] | 552 | !-- combine_plot_fields |
---|
| 553 | IF ( myid == 0 ) THEN |
---|
[691] | 554 | WRITE ( 30 ) time_since_reference_point, & |
---|
| 555 | do3d_time_count(av), av |
---|
[493] | 556 | ENDIF |
---|
[759] | 557 | DO i = 0, io_blocks-1 |
---|
| 558 | IF ( i == io_group ) THEN |
---|
| 559 | WRITE ( 30 ) nxlg, nxrg, nysg, nyng, nzb, nz_do3d |
---|
| 560 | WRITE ( 30 ) local_pf |
---|
| 561 | ENDIF |
---|
| 562 | #if defined( __parallel ) |
---|
| 563 | CALL MPI_BARRIER( comm2d, ierr ) |
---|
| 564 | #endif |
---|
| 565 | ENDDO |
---|
[559] | 566 | |
---|
[493] | 567 | ELSE |
---|
[646] | 568 | #if defined( __netcdf ) |
---|
[493] | 569 | ! |
---|
[1031] | 570 | !-- Parallel output in netCDF4/HDF5 format. |
---|
[493] | 571 | !-- Do not output redundant ghost point data except for the |
---|
| 572 | !-- boundaries of the total domain. |
---|
| 573 | IF ( nxr == nx .AND. nyn /= ny ) THEN |
---|
| 574 | nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if), & |
---|
[667] | 575 | local_pf(nxl:nxrg,nys:nyn,nzb:nz_do3d), & |
---|
[493] | 576 | start = (/ nxl+1, nys+1, nzb+1, do3d_time_count(av) /), & |
---|
[667] | 577 | count = (/ nxr-nxl+1+nbgp, nyn-nys+1, nz_do3d-nzb+1, 1 /) ) |
---|
[493] | 578 | ELSEIF ( nxr /= nx .AND. nyn == ny ) THEN |
---|
| 579 | nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if), & |
---|
[667] | 580 | local_pf(nxl:nxr,nys:nyng,nzb:nz_do3d), & |
---|
[493] | 581 | start = (/ nxl+1, nys+1, nzb+1, do3d_time_count(av) /), & |
---|
[667] | 582 | count = (/ nxr-nxl+1, nyn-nys+1+nbgp, nz_do3d-nzb+1, 1 /) ) |
---|
[493] | 583 | ELSEIF ( nxr == nx .AND. nyn == ny ) THEN |
---|
| 584 | nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if), & |
---|
[667] | 585 | local_pf(nxl:nxrg,nys:nyng,nzb:nz_do3d), & |
---|
[493] | 586 | start = (/ nxl+1, nys+1, nzb+1, do3d_time_count(av) /), & |
---|
[667] | 587 | count = (/ nxr-nxl+1+nbgp, nyn-nys+1+nbgp, nz_do3d-nzb+1, 1 /) ) |
---|
[493] | 588 | ELSE |
---|
| 589 | nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if), & |
---|
| 590 | local_pf(nxl:nxr,nys:nyn,nzb:nz_do3d), & |
---|
| 591 | start = (/ nxl+1, nys+1, nzb+1, do3d_time_count(av) /), & |
---|
| 592 | count = (/ nxr-nxl+1, nyn-nys+1, nz_do3d-nzb+1, 1 /) ) |
---|
| 593 | ENDIF |
---|
| 594 | CALL handle_netcdf_error( 'data_output_3d', 386 ) |
---|
[646] | 595 | #endif |
---|
[493] | 596 | ENDIF |
---|
[1] | 597 | ENDIF |
---|
| 598 | #else |
---|
| 599 | IF ( avs_output ) THEN |
---|
| 600 | WRITE ( 30 ) local_pf(nxl:nxr+1,nys:nyn+1,:) |
---|
| 601 | ENDIF |
---|
| 602 | #if defined( __netcdf ) |
---|
| 603 | IF ( netcdf_output ) THEN |
---|
[493] | 604 | |
---|
| 605 | nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if), & |
---|
| 606 | local_pf(nxl:nxr+1,nys:nyn+1,nzb:nz_do3d), & |
---|
| 607 | start = (/ 1, 1, 1, do3d_time_count(av) /), & |
---|
| 608 | count = (/ nx+2, ny+2, nz_do3d-nzb+1, 1 /) ) |
---|
| 609 | CALL handle_netcdf_error( 'data_output_3d', 446 ) |
---|
| 610 | |
---|
[1] | 611 | ENDIF |
---|
| 612 | #endif |
---|
| 613 | #endif |
---|
| 614 | ENDIF |
---|
| 615 | |
---|
| 616 | if = if + 1 |
---|
| 617 | |
---|
| 618 | ENDDO |
---|
| 619 | |
---|
| 620 | ! |
---|
| 621 | !-- Deallocate temporary array. |
---|
| 622 | DEALLOCATE( local_pf ) |
---|
| 623 | |
---|
| 624 | |
---|
| 625 | CALL cpu_log (log_point(14),'data_output_3d','stop','nobarrier') |
---|
| 626 | |
---|
| 627 | ! |
---|
| 628 | !-- Formats. |
---|
| 629 | 3300 FORMAT ('variable ',I4,' file=',A,' filetype=unformatted skip=',I12/ & |
---|
| 630 | 'label = ',A,A) |
---|
| 631 | |
---|
| 632 | END SUBROUTINE data_output_3d |
---|