[1682] | 1 | !> @file data_output_3d.f90 |
---|
[2000] | 2 | !------------------------------------------------------------------------------! |
---|
[2696] | 3 | ! This file is part of the PALM model system. |
---|
[1036] | 4 | ! |
---|
[2000] | 5 | ! PALM is free software: you can redistribute it and/or modify it under the |
---|
| 6 | ! terms of the GNU General Public License as published by the Free Software |
---|
| 7 | ! Foundation, either version 3 of the License, or (at your option) any later |
---|
| 8 | ! version. |
---|
[1036] | 9 | ! |
---|
| 10 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
| 11 | ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
| 12 | ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
| 13 | ! |
---|
| 14 | ! You should have received a copy of the GNU General Public License along with |
---|
| 15 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
| 16 | ! |
---|
[2718] | 17 | ! Copyright 1997-2018 Leibniz Universitaet Hannover |
---|
[2000] | 18 | !------------------------------------------------------------------------------! |
---|
[1036] | 19 | ! |
---|
[254] | 20 | ! Current revisions: |
---|
[1106] | 21 | ! ------------------ |
---|
[1961] | 22 | ! |
---|
[3049] | 23 | ! |
---|
[1552] | 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! $Id: data_output_3d.f90 3467 2018-10-30 19:05:21Z schwenkel $ |
---|
[3467] | 27 | ! Implementation of a new aerosol module salsa. |
---|
| 28 | ! |
---|
| 29 | ! 3448 2018-10-29 18:14:31Z kanani |
---|
[3448] | 30 | ! Adjustment of biometeorology calls |
---|
| 31 | ! |
---|
| 32 | ! 3421 2018-10-24 18:39:32Z gronemeier |
---|
[3421] | 33 | ! Renamed output variables |
---|
| 34 | ! |
---|
| 35 | ! 3419 2018-10-24 17:27:31Z gronemeier |
---|
[3405] | 36 | ! bugfix: nx, ny are required in non-parallel case |
---|
| 37 | ! |
---|
| 38 | ! 3337 2018-10-12 15:17:09Z kanani |
---|
[3337] | 39 | ! (from branch resler) |
---|
| 40 | ! Add Biometeorology |
---|
| 41 | ! |
---|
| 42 | ! 3294 2018-10-01 02:37:10Z raasch |
---|
[3294] | 43 | ! changes concerning modularization of ocean option |
---|
| 44 | ! |
---|
| 45 | ! 3274 2018-09-24 15:42:55Z knoop |
---|
[3274] | 46 | ! Modularization of all bulk cloud physics code components |
---|
| 47 | ! |
---|
| 48 | ! 3241 2018-09-12 15:02:00Z raasch |
---|
[3241] | 49 | ! unused variables and format statements removed |
---|
| 50 | ! |
---|
| 51 | ! 3049 2018-05-29 13:52:36Z Giersch |
---|
[3049] | 52 | ! Error messages revised |
---|
| 53 | ! |
---|
| 54 | ! 3045 2018-05-28 07:55:41Z Giersch |
---|
[3045] | 55 | ! Error message revised |
---|
| 56 | ! |
---|
| 57 | ! 3014 2018-05-09 08:42:38Z maronga |
---|
[3014] | 58 | ! Added nzb_do and nzt_do for some modules for 3d output |
---|
| 59 | ! |
---|
| 60 | ! 3004 2018-04-27 12:33:25Z Giersch |
---|
[3004] | 61 | ! Allocation checks implemented (averaged data will be assigned to fill values |
---|
| 62 | ! if no allocation happened so far) |
---|
| 63 | ! |
---|
| 64 | ! 2967 2018-04-13 11:22:08Z raasch |
---|
[2967] | 65 | ! bugfix: missing parallel cpp-directives added |
---|
| 66 | ! |
---|
| 67 | ! 2817 2018-02-19 16:32:21Z knoop |
---|
[2817] | 68 | ! Preliminary gust module interface implemented |
---|
| 69 | ! |
---|
| 70 | ! 2766 2018-01-22 17:17:47Z kanani |
---|
[2766] | 71 | ! Removed preprocessor directive __chem |
---|
| 72 | ! |
---|
| 73 | ! 2756 2018-01-16 18:11:14Z suehring |
---|
[2756] | 74 | ! Fill values for 3D output of chemical species introduced. |
---|
| 75 | ! |
---|
| 76 | ! 2746 2018-01-15 12:06:04Z suehring |
---|
[2746] | 77 | ! Move flag plant canopy to modules |
---|
| 78 | ! |
---|
| 79 | ! 2718 2018-01-02 08:49:38Z maronga |
---|
[2716] | 80 | ! Corrected "Former revisions" section |
---|
| 81 | ! |
---|
| 82 | ! 2696 2017-12-14 17:12:51Z kanani |
---|
| 83 | ! Change in file header (GPL part) |
---|
[2696] | 84 | ! Implementation of turbulence_closure_mod (TG) |
---|
| 85 | ! Implementation of chemistry module (FK) |
---|
| 86 | ! Set fill values at topography grid points or e.g. non-natural-type surface |
---|
| 87 | ! in case of LSM output (MS) |
---|
| 88 | ! |
---|
| 89 | ! 2512 2017-10-04 08:26:59Z raasch |
---|
[2512] | 90 | ! upper bounds of 3d output changed from nx+1,ny+1 to nx,ny |
---|
| 91 | ! no output of ghost layer data |
---|
| 92 | ! |
---|
| 93 | ! 2292 2017-06-20 09:51:42Z schwenkel |
---|
[2292] | 94 | ! Implementation of new microphysic scheme: cloud_scheme = 'morrison' |
---|
| 95 | ! includes two more prognostic equations for cloud drop concentration (nc) |
---|
| 96 | ! and cloud water content (qc). |
---|
| 97 | ! |
---|
| 98 | ! 2233 2017-05-30 18:08:54Z suehring |
---|
[1552] | 99 | ! |
---|
[2233] | 100 | ! 2232 2017-05-30 17:47:52Z suehring |
---|
| 101 | ! Adjustments to new topography concept |
---|
| 102 | ! |
---|
[2210] | 103 | ! 2209 2017-04-19 09:34:46Z kanani |
---|
| 104 | ! Added plant canopy model output |
---|
| 105 | ! |
---|
[2032] | 106 | ! 2031 2016-10-21 15:11:58Z knoop |
---|
| 107 | ! renamed variable rho to rho_ocean and rho_av to rho_ocean_av |
---|
| 108 | ! |
---|
[2012] | 109 | ! 2011 2016-09-19 17:29:57Z kanani |
---|
| 110 | ! Flag urban_surface is now defined in module control_parameters, |
---|
| 111 | ! changed prefix for urban surface model output to "usm_", |
---|
| 112 | ! introduced control parameter varnamelength for LEN of trimvar. |
---|
| 113 | ! |
---|
[2008] | 114 | ! 2007 2016-08-24 15:47:17Z kanani |
---|
| 115 | ! Added support for new urban surface model (temporary modifications of |
---|
| 116 | ! SELECT CASE ( ) necessary, see variable trimvar) |
---|
| 117 | ! |
---|
[2001] | 118 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
| 119 | ! Forced header and separation lines into 80 columns |
---|
| 120 | ! |
---|
[1981] | 121 | ! 1980 2016-07-29 15:51:57Z suehring |
---|
| 122 | ! Bugfix, in order to steer user-defined output, setting flag found explicitly |
---|
| 123 | ! to .F. |
---|
| 124 | ! |
---|
[1977] | 125 | ! 1976 2016-07-27 13:28:04Z maronga |
---|
| 126 | ! Output of radiation quantities is now done directly in the respective module |
---|
| 127 | ! |
---|
[1973] | 128 | ! 1972 2016-07-26 07:52:02Z maronga |
---|
| 129 | ! Output of land surface quantities is now done directly in the respective module. |
---|
| 130 | ! Unnecessary directive __parallel removed. |
---|
| 131 | ! |
---|
[1961] | 132 | ! 1960 2016-07-12 16:34:24Z suehring |
---|
| 133 | ! Scalar surface flux added |
---|
| 134 | ! |
---|
[1851] | 135 | ! 1849 2016-04-08 11:33:18Z hoffmann |
---|
| 136 | ! prr moved to arrays_3d |
---|
| 137 | ! |
---|
[1823] | 138 | ! 1822 2016-04-07 07:49:42Z hoffmann |
---|
| 139 | ! prr vertical dimensions set to nzb_do to nzt_do. Unused variables deleted. |
---|
| 140 | ! |
---|
[1809] | 141 | ! 1808 2016-04-05 19:44:00Z raasch |
---|
| 142 | ! test output removed |
---|
| 143 | ! |
---|
[1784] | 144 | ! 1783 2016-03-06 18:36:17Z raasch |
---|
| 145 | ! name change of netcdf routines and module + related changes |
---|
| 146 | ! |
---|
[1746] | 147 | ! 1745 2016-02-05 13:06:51Z gronemeier |
---|
| 148 | ! Bugfix: test if time axis limit exceeds moved to point after call of check_open |
---|
| 149 | ! |
---|
[1692] | 150 | ! 1691 2015-10-26 16:17:44Z maronga |
---|
| 151 | ! Added output of radiative heating rates for RRTMG |
---|
| 152 | ! |
---|
[1683] | 153 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
| 154 | ! Code annotations made doxygen readable |
---|
| 155 | ! |
---|
[1586] | 156 | ! 1585 2015-04-30 07:05:52Z maronga |
---|
| 157 | ! Added support for RRTMG |
---|
| 158 | ! |
---|
[1552] | 159 | ! 1551 2015-03-03 14:18:16Z maronga |
---|
[1551] | 160 | ! Added suppport for land surface model and radiation model output. In the course |
---|
| 161 | ! of this action, the limits for vertical loops have been changed (from nzb and |
---|
| 162 | ! nzt+1 to nzb_do and nzt_do, respectively in order to allow soil model output). |
---|
| 163 | ! Moreover, a new vertical grid zs was introduced. |
---|
[1329] | 164 | ! |
---|
[1360] | 165 | ! 1359 2014-04-11 17:15:14Z hoffmann |
---|
| 166 | ! New particle structure integrated. |
---|
| 167 | ! |
---|
[1354] | 168 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
| 169 | ! REAL constants provided with KIND-attribute |
---|
| 170 | ! |
---|
[1329] | 171 | ! 1327 2014-03-21 11:00:16Z raasch |
---|
| 172 | ! parts concerning avs output removed, |
---|
| 173 | ! -netcdf output queries |
---|
| 174 | ! |
---|
[1321] | 175 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 176 | ! ONLY-attribute added to USE-statements, |
---|
| 177 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 178 | ! kinds are defined in new module kinds, |
---|
| 179 | ! old module precision_kind is removed, |
---|
| 180 | ! revision history before 2012 removed, |
---|
| 181 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 182 | ! all variable declaration statements |
---|
[674] | 183 | ! |
---|
[1319] | 184 | ! 1318 2014-03-17 13:35:16Z raasch |
---|
| 185 | ! barrier argument removed from cpu_log, |
---|
| 186 | ! module interfaces removed |
---|
| 187 | ! |
---|
[1309] | 188 | ! 1308 2014-03-13 14:58:42Z fricke |
---|
| 189 | ! Check, if the limit of the time dimension is exceeded for parallel output |
---|
| 190 | ! To increase the performance for parallel output, the following is done: |
---|
| 191 | ! - Update of time axis is only done by PE0 |
---|
| 192 | ! |
---|
[1245] | 193 | ! 1244 2013-10-31 08:16:56Z raasch |
---|
| 194 | ! Bugfix for index bounds in case of 3d-parallel output |
---|
| 195 | ! |
---|
[1116] | 196 | ! 1115 2013-03-26 18:16:16Z hoffmann |
---|
| 197 | ! ql is calculated by calc_liquid_water_content |
---|
| 198 | ! |
---|
[1107] | 199 | ! 1106 2013-03-04 05:31:38Z raasch |
---|
| 200 | ! array_kind renamed precision_kind |
---|
| 201 | ! |
---|
[1077] | 202 | ! 1076 2012-12-05 08:30:18Z hoffmann |
---|
| 203 | ! Bugfix in output of ql |
---|
| 204 | ! |
---|
[1054] | 205 | ! 1053 2012-11-13 17:11:03Z hoffmann |
---|
| 206 | ! +nr, qr, prr, qc and averaged quantities |
---|
| 207 | ! |
---|
[1037] | 208 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 209 | ! code put under GPL (PALM 3.9) |
---|
| 210 | ! |
---|
[1035] | 211 | ! 1031 2012-10-19 14:35:30Z raasch |
---|
| 212 | ! netCDF4 without parallel file support implemented |
---|
| 213 | ! |
---|
[1008] | 214 | ! 1007 2012-09-19 14:30:36Z franke |
---|
| 215 | ! Bugfix: missing calculation of ql_vp added |
---|
| 216 | ! |
---|
[1] | 217 | ! Revision 1.1 1997/09/03 06:29:36 raasch |
---|
| 218 | ! Initial revision |
---|
| 219 | ! |
---|
| 220 | ! |
---|
| 221 | ! Description: |
---|
| 222 | ! ------------ |
---|
[1682] | 223 | !> Output of the 3D-arrays in netCDF and/or AVS format. |
---|
[1] | 224 | !------------------------------------------------------------------------------! |
---|
[1682] | 225 | SUBROUTINE data_output_3d( av ) |
---|
| 226 | |
---|
[1] | 227 | |
---|
[1320] | 228 | USE arrays_3d, & |
---|
[3294] | 229 | ONLY: d_exner, e, nc, nr, p, pt, prr, q, qc, ql, ql_c, ql_v, qr, s, & |
---|
| 230 | tend, u, v, vpt, w |
---|
[3274] | 231 | |
---|
[1] | 232 | USE averaging |
---|
[3274] | 233 | |
---|
| 234 | USE basic_constants_and_equations_mod, & |
---|
| 235 | ONLY: lv_d_cp |
---|
| 236 | |
---|
[3448] | 237 | USE biometeorology_mod, & |
---|
| 238 | ONLY: biom_data_output_3d |
---|
| 239 | |
---|
[3274] | 240 | USE bulk_cloud_model_mod, & |
---|
| 241 | ONLY: bulk_cloud_model, bcm_data_output_3d |
---|
| 242 | |
---|
[2696] | 243 | USE chemistry_model_mod, & |
---|
| 244 | ONLY: chem_data_output_3d |
---|
| 245 | |
---|
[1320] | 246 | USE control_parameters, & |
---|
[3448] | 247 | ONLY: air_chemistry, biometeorology, do3d, do3d_no, do3d_time_count, & |
---|
[2696] | 248 | io_blocks, io_group, land_surface, message_string, & |
---|
[3294] | 249 | ntdim_3d, nz_do3d, ocean_mode, plant_canopy, & |
---|
[2232] | 250 | psolver, simulated_time, time_since_reference_point, & |
---|
| 251 | urban_surface, varnamelength |
---|
[3274] | 252 | |
---|
[1320] | 253 | USE cpulog, & |
---|
| 254 | ONLY: log_point, cpu_log |
---|
[2817] | 255 | |
---|
| 256 | USE gust_mod, & |
---|
| 257 | ONLY: gust_data_output_3d, gust_module_enabled |
---|
[3274] | 258 | |
---|
[3405] | 259 | #if defined( __parallel ) |
---|
[1320] | 260 | USE indices, & |
---|
[3241] | 261 | ONLY: nbgp, nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt, & |
---|
| 262 | wall_flags_0 |
---|
[3405] | 263 | #else |
---|
| 264 | USE indices, & |
---|
| 265 | ONLY: nbgp, nx, nxl, nxlg, nxr, nxrg, ny, nyn, nyng, nys, nysg, nzb, & |
---|
| 266 | nzt, wall_flags_0 |
---|
| 267 | #endif |
---|
[3274] | 268 | |
---|
[1320] | 269 | USE kinds |
---|
[3274] | 270 | |
---|
[1551] | 271 | USE land_surface_model_mod, & |
---|
[2232] | 272 | ONLY: lsm_data_output_3d, nzb_soil, nzt_soil |
---|
[1551] | 273 | |
---|
[1783] | 274 | #if defined( __netcdf ) |
---|
| 275 | USE NETCDF |
---|
| 276 | #endif |
---|
| 277 | |
---|
| 278 | USE netcdf_interface, & |
---|
[2696] | 279 | ONLY: fill_value, id_set_3d, id_var_do3d, id_var_time_3d, nc_stat, & |
---|
[1783] | 280 | netcdf_data_format, netcdf_handle_error |
---|
[1320] | 281 | |
---|
[3294] | 282 | USE ocean_mod, & |
---|
| 283 | ONLY: ocean_data_output_3d |
---|
| 284 | |
---|
[1320] | 285 | USE particle_attributes, & |
---|
[1359] | 286 | ONLY: grid_particles, number_of_particles, particles, & |
---|
| 287 | particle_advection_start, prt_count |
---|
[1320] | 288 | |
---|
[1] | 289 | USE pegrid |
---|
| 290 | |
---|
[2209] | 291 | USE plant_canopy_model_mod, & |
---|
[2746] | 292 | ONLY: pcm_data_output_3d |
---|
[2209] | 293 | |
---|
[1585] | 294 | USE radiation_model_mod, & |
---|
[2696] | 295 | ONLY: nzub, nzut, radiation, radiation_data_output_3d |
---|
[3467] | 296 | |
---|
| 297 | USE salsa_mod, & |
---|
| 298 | ONLY: salsa, salsa_data_output_3d |
---|
[1585] | 299 | |
---|
[2696] | 300 | USE turbulence_closure_mod, & |
---|
| 301 | ONLY: tcm_data_output_3d |
---|
| 302 | |
---|
[2007] | 303 | USE urban_surface_mod, & |
---|
[2696] | 304 | ONLY: usm_data_output_3d |
---|
[1585] | 305 | |
---|
[2007] | 306 | |
---|
[1] | 307 | IMPLICIT NONE |
---|
| 308 | |
---|
[1682] | 309 | INTEGER(iwp) :: av !< |
---|
[2696] | 310 | INTEGER(iwp) :: flag_nr !< number of masking flag |
---|
[1682] | 311 | INTEGER(iwp) :: i !< |
---|
| 312 | INTEGER(iwp) :: if !< |
---|
| 313 | INTEGER(iwp) :: j !< |
---|
| 314 | INTEGER(iwp) :: k !< |
---|
| 315 | INTEGER(iwp) :: n !< |
---|
| 316 | INTEGER(iwp) :: nzb_do !< vertical lower limit for data output |
---|
| 317 | INTEGER(iwp) :: nzt_do !< vertical upper limit for data output |
---|
[1] | 318 | |
---|
[1682] | 319 | LOGICAL :: found !< |
---|
| 320 | LOGICAL :: resorted !< |
---|
[1] | 321 | |
---|
[1682] | 322 | REAL(wp) :: mean_r !< |
---|
| 323 | REAL(wp) :: s_r2 !< |
---|
| 324 | REAL(wp) :: s_r3 !< |
---|
[1] | 325 | |
---|
[1682] | 326 | REAL(sp), DIMENSION(:,:,:), ALLOCATABLE :: local_pf !< |
---|
[1] | 327 | |
---|
[1682] | 328 | REAL(wp), DIMENSION(:,:,:), POINTER :: to_be_resorted !< |
---|
[1] | 329 | |
---|
[2011] | 330 | CHARACTER (LEN=varnamelength) :: trimvar !< TRIM of output-variable string |
---|
[2007] | 331 | |
---|
[1] | 332 | ! |
---|
| 333 | !-- Return, if nothing to output |
---|
| 334 | IF ( do3d_no(av) == 0 ) RETURN |
---|
| 335 | |
---|
| 336 | CALL cpu_log (log_point(14),'data_output_3d','start') |
---|
| 337 | |
---|
| 338 | ! |
---|
| 339 | !-- Open output file. |
---|
[2512] | 340 | !-- For classic or 64bit netCDF output on more than one PE, each PE opens its |
---|
| 341 | !-- own file and writes the data of its subdomain in binary format. After the |
---|
| 342 | !-- run, these files are combined to one NetCDF file by combine_plot_fields. |
---|
[1031] | 343 | !-- For netCDF4/HDF5 output, data is written in parallel into one file. |
---|
[1327] | 344 | IF ( netcdf_data_format < 5 ) THEN |
---|
[2967] | 345 | #if defined( __parallel ) |
---|
[1327] | 346 | CALL check_open( 30 ) |
---|
[2967] | 347 | #endif |
---|
[1327] | 348 | IF ( myid == 0 ) CALL check_open( 106+av*10 ) |
---|
[493] | 349 | ELSE |
---|
[1327] | 350 | CALL check_open( 106+av*10 ) |
---|
[493] | 351 | ENDIF |
---|
[1] | 352 | |
---|
| 353 | ! |
---|
[1745] | 354 | !-- For parallel netcdf output the time axis must be limited. Return, if this |
---|
| 355 | !-- limit is exceeded. This could be the case, if the simulated time exceeds |
---|
| 356 | !-- the given end time by the length of the given output interval. |
---|
| 357 | IF ( netcdf_data_format > 4 ) THEN |
---|
| 358 | IF ( do3d_time_count(av) + 1 > ntdim_3d(av) ) THEN |
---|
| 359 | WRITE ( message_string, * ) 'Output of 3d data is not given at t=', & |
---|
[3046] | 360 | simulated_time, '&because the maximum ', & |
---|
[1745] | 361 | 'number of output time levels is ', & |
---|
| 362 | 'exceeded.' |
---|
| 363 | CALL message( 'data_output_3d', 'PA0387', 0, 1, 0, 6, 0 ) |
---|
| 364 | CALL cpu_log( log_point(14), 'data_output_3d', 'stop' ) |
---|
| 365 | RETURN |
---|
| 366 | ENDIF |
---|
| 367 | ENDIF |
---|
| 368 | |
---|
| 369 | ! |
---|
[1031] | 370 | !-- Update the netCDF time axis |
---|
[1308] | 371 | !-- In case of parallel output, this is only done by PE0 to increase the |
---|
| 372 | !-- performance. |
---|
[1] | 373 | #if defined( __netcdf ) |
---|
[1308] | 374 | do3d_time_count(av) = do3d_time_count(av) + 1 |
---|
| 375 | IF ( myid == 0 ) THEN |
---|
[1327] | 376 | nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_time_3d(av), & |
---|
| 377 | (/ time_since_reference_point /), & |
---|
| 378 | start = (/ do3d_time_count(av) /), & |
---|
| 379 | count = (/ 1 /) ) |
---|
[1783] | 380 | CALL netcdf_handle_error( 'data_output_3d', 376 ) |
---|
[1] | 381 | ENDIF |
---|
| 382 | #endif |
---|
| 383 | |
---|
| 384 | ! |
---|
| 385 | !-- Loop over all variables to be written. |
---|
| 386 | if = 1 |
---|
| 387 | |
---|
| 388 | DO WHILE ( do3d(av,if)(1:1) /= ' ' ) |
---|
[2007] | 389 | |
---|
[1] | 390 | ! |
---|
[2007] | 391 | !-- Temporary solution to account for data output within the new urban |
---|
| 392 | !-- surface model (urban_surface_mod.f90), see also SELECT CASE ( trimvar ). |
---|
[1] | 393 | !-- Store the array chosen on the temporary array. |
---|
[2007] | 394 | trimvar = TRIM( do3d(av,if) ) |
---|
[2011] | 395 | IF ( urban_surface .AND. trimvar(1:4) == 'usm_' ) THEN |
---|
[2007] | 396 | trimvar = 'usm_output' |
---|
| 397 | resorted = .TRUE. |
---|
| 398 | nzb_do = nzub |
---|
| 399 | nzt_do = nzut |
---|
| 400 | ELSE |
---|
| 401 | resorted = .FALSE. |
---|
| 402 | nzb_do = nzb |
---|
| 403 | nzt_do = nz_do3d |
---|
| 404 | ENDIF |
---|
[1551] | 405 | ! |
---|
[1980] | 406 | !-- Set flag to steer output of radiation, land-surface, or user-defined |
---|
| 407 | !-- quantities |
---|
| 408 | found = .FALSE. |
---|
| 409 | ! |
---|
[1551] | 410 | !-- Allocate a temporary array with the desired output dimensions. |
---|
[2512] | 411 | ALLOCATE( local_pf(nxl:nxr,nys:nyn,nzb_do:nzt_do) ) |
---|
[2696] | 412 | ! |
---|
| 413 | !-- Before each output, set array local_pf to fill value |
---|
| 414 | local_pf = fill_value |
---|
| 415 | ! |
---|
| 416 | !-- Set masking flag for topography for not resorted arrays |
---|
| 417 | flag_nr = 0 |
---|
[1551] | 418 | |
---|
[2007] | 419 | SELECT CASE ( trimvar ) |
---|
[1] | 420 | |
---|
| 421 | CASE ( 'e' ) |
---|
| 422 | IF ( av == 0 ) THEN |
---|
| 423 | to_be_resorted => e |
---|
| 424 | ELSE |
---|
[3004] | 425 | IF ( .NOT. ALLOCATED( e_av ) ) THEN |
---|
| 426 | ALLOCATE( e_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 427 | e_av = REAL( fill_value, KIND = wp ) |
---|
| 428 | ENDIF |
---|
[1] | 429 | to_be_resorted => e_av |
---|
| 430 | ENDIF |
---|
| 431 | |
---|
[3421] | 432 | CASE ( 'thetal' ) |
---|
[771] | 433 | IF ( av == 0 ) THEN |
---|
| 434 | to_be_resorted => pt |
---|
| 435 | ELSE |
---|
[3004] | 436 | IF ( .NOT. ALLOCATED( lpt_av ) ) THEN |
---|
| 437 | ALLOCATE( lpt_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 438 | lpt_av = REAL( fill_value, KIND = wp ) |
---|
| 439 | ENDIF |
---|
[771] | 440 | to_be_resorted => lpt_av |
---|
| 441 | ENDIF |
---|
| 442 | |
---|
[1] | 443 | CASE ( 'p' ) |
---|
| 444 | IF ( av == 0 ) THEN |
---|
[727] | 445 | IF ( psolver /= 'sor' ) CALL exchange_horiz( p, nbgp ) |
---|
[1] | 446 | to_be_resorted => p |
---|
| 447 | ELSE |
---|
[3004] | 448 | IF ( .NOT. ALLOCATED( p_av ) ) THEN |
---|
| 449 | ALLOCATE( p_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 450 | p_av = REAL( fill_value, KIND = wp ) |
---|
| 451 | ENDIF |
---|
[727] | 452 | IF ( psolver /= 'sor' ) CALL exchange_horiz( p_av, nbgp ) |
---|
[1] | 453 | to_be_resorted => p_av |
---|
| 454 | ENDIF |
---|
| 455 | |
---|
| 456 | CASE ( 'pc' ) ! particle concentration (requires ghostpoint exchange) |
---|
| 457 | IF ( av == 0 ) THEN |
---|
[1359] | 458 | IF ( simulated_time >= particle_advection_start ) THEN |
---|
| 459 | tend = prt_count |
---|
| 460 | ELSE |
---|
| 461 | tend = 0.0_wp |
---|
| 462 | ENDIF |
---|
[2512] | 463 | DO i = nxl, nxr |
---|
| 464 | DO j = nys, nyn |
---|
[1551] | 465 | DO k = nzb_do, nzt_do |
---|
[1] | 466 | local_pf(i,j,k) = tend(k,j,i) |
---|
| 467 | ENDDO |
---|
| 468 | ENDDO |
---|
| 469 | ENDDO |
---|
| 470 | resorted = .TRUE. |
---|
| 471 | ELSE |
---|
[3004] | 472 | IF ( .NOT. ALLOCATED( pc_av ) ) THEN |
---|
| 473 | ALLOCATE( pc_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 474 | pc_av = REAL( fill_value, KIND = wp ) |
---|
| 475 | ENDIF |
---|
[1] | 476 | to_be_resorted => pc_av |
---|
| 477 | ENDIF |
---|
| 478 | |
---|
[1359] | 479 | CASE ( 'pr' ) ! mean particle radius (effective radius) |
---|
[1] | 480 | IF ( av == 0 ) THEN |
---|
[1359] | 481 | IF ( simulated_time >= particle_advection_start ) THEN |
---|
| 482 | DO i = nxl, nxr |
---|
| 483 | DO j = nys, nyn |
---|
[1551] | 484 | DO k = nzb_do, nzt_do |
---|
[1359] | 485 | number_of_particles = prt_count(k,j,i) |
---|
| 486 | IF (number_of_particles <= 0) CYCLE |
---|
| 487 | particles => grid_particles(k,j,i)%particles(1:number_of_particles) |
---|
| 488 | s_r2 = 0.0_wp |
---|
| 489 | s_r3 = 0.0_wp |
---|
| 490 | DO n = 1, number_of_particles |
---|
| 491 | IF ( particles(n)%particle_mask ) THEN |
---|
| 492 | s_r2 = s_r2 + particles(n)%radius**2 * & |
---|
| 493 | particles(n)%weight_factor |
---|
| 494 | s_r3 = s_r3 + particles(n)%radius**3 * & |
---|
| 495 | particles(n)%weight_factor |
---|
| 496 | ENDIF |
---|
| 497 | ENDDO |
---|
| 498 | IF ( s_r2 > 0.0_wp ) THEN |
---|
| 499 | mean_r = s_r3 / s_r2 |
---|
| 500 | ELSE |
---|
| 501 | mean_r = 0.0_wp |
---|
| 502 | ENDIF |
---|
| 503 | tend(k,j,i) = mean_r |
---|
[1] | 504 | ENDDO |
---|
| 505 | ENDDO |
---|
| 506 | ENDDO |
---|
[1359] | 507 | ELSE |
---|
| 508 | tend = 0.0_wp |
---|
| 509 | ENDIF |
---|
[2512] | 510 | DO i = nxl, nxr |
---|
| 511 | DO j = nys, nyn |
---|
[1551] | 512 | DO k = nzb_do, nzt_do |
---|
[1] | 513 | local_pf(i,j,k) = tend(k,j,i) |
---|
| 514 | ENDDO |
---|
| 515 | ENDDO |
---|
| 516 | ENDDO |
---|
| 517 | resorted = .TRUE. |
---|
| 518 | ELSE |
---|
[3004] | 519 | IF ( .NOT. ALLOCATED( pr_av ) ) THEN |
---|
| 520 | ALLOCATE( pr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 521 | pr_av = REAL( fill_value, KIND = wp ) |
---|
| 522 | ENDIF |
---|
[1] | 523 | to_be_resorted => pr_av |
---|
| 524 | ENDIF |
---|
| 525 | |
---|
[3421] | 526 | CASE ( 'theta' ) |
---|
[1] | 527 | IF ( av == 0 ) THEN |
---|
[3274] | 528 | IF ( .NOT. bulk_cloud_model ) THEN |
---|
[1] | 529 | to_be_resorted => pt |
---|
| 530 | ELSE |
---|
[2512] | 531 | DO i = nxl, nxr |
---|
| 532 | DO j = nys, nyn |
---|
[1551] | 533 | DO k = nzb_do, nzt_do |
---|
[3274] | 534 | local_pf(i,j,k) = pt(k,j,i) + lv_d_cp * & |
---|
| 535 | d_exner(k) * & |
---|
[1] | 536 | ql(k,j,i) |
---|
| 537 | ENDDO |
---|
| 538 | ENDDO |
---|
| 539 | ENDDO |
---|
| 540 | resorted = .TRUE. |
---|
| 541 | ENDIF |
---|
| 542 | ELSE |
---|
[3004] | 543 | IF ( .NOT. ALLOCATED( pt_av ) ) THEN |
---|
| 544 | ALLOCATE( pt_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 545 | pt_av = REAL( fill_value, KIND = wp ) |
---|
| 546 | ENDIF |
---|
[1] | 547 | to_be_resorted => pt_av |
---|
| 548 | ENDIF |
---|
| 549 | |
---|
| 550 | CASE ( 'q' ) |
---|
| 551 | IF ( av == 0 ) THEN |
---|
| 552 | to_be_resorted => q |
---|
| 553 | ELSE |
---|
[3004] | 554 | IF ( .NOT. ALLOCATED( q_av ) ) THEN |
---|
| 555 | ALLOCATE( q_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 556 | q_av = REAL( fill_value, KIND = wp ) |
---|
| 557 | ENDIF |
---|
[1] | 558 | to_be_resorted => q_av |
---|
| 559 | ENDIF |
---|
[691] | 560 | |
---|
[1053] | 561 | CASE ( 'ql' ) |
---|
| 562 | IF ( av == 0 ) THEN |
---|
[1115] | 563 | to_be_resorted => ql |
---|
[1053] | 564 | ELSE |
---|
[3004] | 565 | IF ( .NOT. ALLOCATED( ql_av ) ) THEN |
---|
| 566 | ALLOCATE( ql_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 567 | ql_av = REAL( fill_value, KIND = wp ) |
---|
| 568 | ENDIF |
---|
[1115] | 569 | to_be_resorted => ql_av |
---|
[1053] | 570 | ENDIF |
---|
| 571 | |
---|
[1] | 572 | CASE ( 'ql_c' ) |
---|
| 573 | IF ( av == 0 ) THEN |
---|
| 574 | to_be_resorted => ql_c |
---|
| 575 | ELSE |
---|
[3004] | 576 | IF ( .NOT. ALLOCATED( ql_c_av ) ) THEN |
---|
| 577 | ALLOCATE( ql_c_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 578 | ql_c_av = REAL( fill_value, KIND = wp ) |
---|
| 579 | ENDIF |
---|
[1] | 580 | to_be_resorted => ql_c_av |
---|
| 581 | ENDIF |
---|
| 582 | |
---|
| 583 | CASE ( 'ql_v' ) |
---|
| 584 | IF ( av == 0 ) THEN |
---|
| 585 | to_be_resorted => ql_v |
---|
| 586 | ELSE |
---|
[3004] | 587 | IF ( .NOT. ALLOCATED( ql_v_av ) ) THEN |
---|
| 588 | ALLOCATE( ql_v_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 589 | ql_v_av = REAL( fill_value, KIND = wp ) |
---|
| 590 | ENDIF |
---|
[1] | 591 | to_be_resorted => ql_v_av |
---|
| 592 | ENDIF |
---|
| 593 | |
---|
| 594 | CASE ( 'ql_vp' ) |
---|
| 595 | IF ( av == 0 ) THEN |
---|
[1359] | 596 | IF ( simulated_time >= particle_advection_start ) THEN |
---|
| 597 | DO i = nxl, nxr |
---|
| 598 | DO j = nys, nyn |
---|
[1551] | 599 | DO k = nzb_do, nzt_do |
---|
[1359] | 600 | number_of_particles = prt_count(k,j,i) |
---|
| 601 | IF (number_of_particles <= 0) CYCLE |
---|
| 602 | particles => grid_particles(k,j,i)%particles(1:number_of_particles) |
---|
| 603 | DO n = 1, number_of_particles |
---|
| 604 | IF ( particles(n)%particle_mask ) THEN |
---|
| 605 | tend(k,j,i) = tend(k,j,i) + & |
---|
| 606 | particles(n)%weight_factor / & |
---|
| 607 | prt_count(k,j,i) |
---|
| 608 | ENDIF |
---|
| 609 | ENDDO |
---|
[1007] | 610 | ENDDO |
---|
| 611 | ENDDO |
---|
| 612 | ENDDO |
---|
[1359] | 613 | ELSE |
---|
| 614 | tend = 0.0_wp |
---|
| 615 | ENDIF |
---|
[2512] | 616 | DO i = nxl, nxr |
---|
| 617 | DO j = nys, nyn |
---|
[1551] | 618 | DO k = nzb_do, nzt_do |
---|
[1007] | 619 | local_pf(i,j,k) = tend(k,j,i) |
---|
| 620 | ENDDO |
---|
| 621 | ENDDO |
---|
| 622 | ENDDO |
---|
| 623 | resorted = .TRUE. |
---|
[1] | 624 | ELSE |
---|
[3004] | 625 | IF ( .NOT. ALLOCATED( ql_vp_av ) ) THEN |
---|
| 626 | ALLOCATE( ql_vp_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 627 | ql_vp_av = REAL( fill_value, KIND = wp ) |
---|
| 628 | ENDIF |
---|
[1] | 629 | to_be_resorted => ql_vp_av |
---|
| 630 | ENDIF |
---|
| 631 | |
---|
| 632 | CASE ( 'qv' ) |
---|
| 633 | IF ( av == 0 ) THEN |
---|
[2512] | 634 | DO i = nxl, nxr |
---|
| 635 | DO j = nys, nyn |
---|
[1551] | 636 | DO k = nzb_do, nzt_do |
---|
[1] | 637 | local_pf(i,j,k) = q(k,j,i) - ql(k,j,i) |
---|
| 638 | ENDDO |
---|
| 639 | ENDDO |
---|
| 640 | ENDDO |
---|
| 641 | resorted = .TRUE. |
---|
| 642 | ELSE |
---|
[3004] | 643 | IF ( .NOT. ALLOCATED( qv_av ) ) THEN |
---|
| 644 | ALLOCATE( qv_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 645 | qv_av = REAL( fill_value, KIND = wp ) |
---|
| 646 | ENDIF |
---|
[1] | 647 | to_be_resorted => qv_av |
---|
| 648 | ENDIF |
---|
| 649 | |
---|
| 650 | CASE ( 's' ) |
---|
| 651 | IF ( av == 0 ) THEN |
---|
[1960] | 652 | to_be_resorted => s |
---|
[1] | 653 | ELSE |
---|
[3004] | 654 | IF ( .NOT. ALLOCATED( s_av ) ) THEN |
---|
| 655 | ALLOCATE( s_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 656 | s_av = REAL( fill_value, KIND = wp ) |
---|
| 657 | ENDIF |
---|
[355] | 658 | to_be_resorted => s_av |
---|
[1] | 659 | ENDIF |
---|
[691] | 660 | |
---|
[1] | 661 | CASE ( 'u' ) |
---|
[2696] | 662 | flag_nr = 1 |
---|
[1] | 663 | IF ( av == 0 ) THEN |
---|
| 664 | to_be_resorted => u |
---|
| 665 | ELSE |
---|
[3004] | 666 | IF ( .NOT. ALLOCATED( u_av ) ) THEN |
---|
| 667 | ALLOCATE( u_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 668 | u_av = REAL( fill_value, KIND = wp ) |
---|
| 669 | ENDIF |
---|
[1] | 670 | to_be_resorted => u_av |
---|
| 671 | ENDIF |
---|
| 672 | |
---|
| 673 | CASE ( 'v' ) |
---|
[2696] | 674 | flag_nr = 2 |
---|
[1] | 675 | IF ( av == 0 ) THEN |
---|
| 676 | to_be_resorted => v |
---|
| 677 | ELSE |
---|
[3004] | 678 | IF ( .NOT. ALLOCATED( v_av ) ) THEN |
---|
| 679 | ALLOCATE( v_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 680 | v_av = REAL( fill_value, KIND = wp ) |
---|
| 681 | ENDIF |
---|
[1] | 682 | to_be_resorted => v_av |
---|
| 683 | ENDIF |
---|
| 684 | |
---|
[3421] | 685 | CASE ( 'thetav' ) |
---|
[1] | 686 | IF ( av == 0 ) THEN |
---|
| 687 | to_be_resorted => vpt |
---|
| 688 | ELSE |
---|
[3004] | 689 | IF ( .NOT. ALLOCATED( vpt_av ) ) THEN |
---|
| 690 | ALLOCATE( vpt_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 691 | vpt_av = REAL( fill_value, KIND = wp ) |
---|
| 692 | ENDIF |
---|
[1] | 693 | to_be_resorted => vpt_av |
---|
| 694 | ENDIF |
---|
| 695 | |
---|
| 696 | CASE ( 'w' ) |
---|
[2696] | 697 | flag_nr = 3 |
---|
[1] | 698 | IF ( av == 0 ) THEN |
---|
| 699 | to_be_resorted => w |
---|
| 700 | ELSE |
---|
[3004] | 701 | IF ( .NOT. ALLOCATED( w_av ) ) THEN |
---|
| 702 | ALLOCATE( w_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 703 | w_av = REAL( fill_value, KIND = wp ) |
---|
| 704 | ENDIF |
---|
[1] | 705 | to_be_resorted => w_av |
---|
| 706 | ENDIF |
---|
[2007] | 707 | ! |
---|
| 708 | !-- Block of urban surface model outputs |
---|
| 709 | CASE ( 'usm_output' ) |
---|
[3274] | 710 | CALL usm_data_output_3d( av, do3d(av,if), found, local_pf, & |
---|
[2007] | 711 | nzb_do, nzt_do ) |
---|
[1] | 712 | |
---|
| 713 | CASE DEFAULT |
---|
[1972] | 714 | |
---|
[1] | 715 | ! |
---|
[3294] | 716 | !-- Quantities of other modules |
---|
[3274] | 717 | IF ( .NOT. found .AND. bulk_cloud_model ) THEN |
---|
| 718 | CALL bcm_data_output_3d( av, do3d(av,if), found, local_pf, & |
---|
| 719 | nzb_do, nzt_do ) |
---|
| 720 | resorted = .TRUE. |
---|
| 721 | ENDIF |
---|
| 722 | |
---|
[3294] | 723 | IF ( .NOT. found .AND. air_chemistry ) THEN |
---|
| 724 | CALL chem_data_output_3d( av, do3d(av,if), found, & |
---|
| 725 | local_pf, fill_value, nzb_do, nzt_do ) |
---|
| 726 | resorted = .TRUE. |
---|
| 727 | ENDIF |
---|
| 728 | |
---|
| 729 | IF ( .NOT. found .AND. gust_module_enabled ) THEN |
---|
| 730 | CALL gust_data_output_3d( av, do3d(av,if), found, local_pf, & |
---|
| 731 | nzb_do, nzt_do ) |
---|
| 732 | resorted = .TRUE. |
---|
| 733 | ENDIF |
---|
| 734 | |
---|
[3274] | 735 | IF ( .NOT. found .AND. land_surface ) THEN |
---|
[1972] | 736 | ! |
---|
| 737 | !-- For soil model quantities, it is required to re-allocate local_pf |
---|
| 738 | nzb_do = nzb_soil |
---|
| 739 | nzt_do = nzt_soil |
---|
| 740 | |
---|
| 741 | DEALLOCATE ( local_pf ) |
---|
[2512] | 742 | ALLOCATE( local_pf(nxl:nxr,nys:nyn,nzb_do:nzt_do) ) |
---|
[2696] | 743 | local_pf = fill_value |
---|
[1972] | 744 | |
---|
| 745 | CALL lsm_data_output_3d( av, do3d(av,if), found, local_pf ) |
---|
| 746 | resorted = .TRUE. |
---|
[1976] | 747 | |
---|
| 748 | ! |
---|
| 749 | !-- If no soil model variable was found, re-allocate local_pf |
---|
| 750 | IF ( .NOT. found ) THEN |
---|
| 751 | nzb_do = nzb |
---|
| 752 | nzt_do = nz_do3d |
---|
| 753 | |
---|
| 754 | DEALLOCATE ( local_pf ) |
---|
[2512] | 755 | ALLOCATE( local_pf(nxl:nxr,nys:nyn,nzb_do:nzt_do) ) |
---|
[1976] | 756 | ENDIF |
---|
| 757 | |
---|
[1972] | 758 | ENDIF |
---|
| 759 | |
---|
[3294] | 760 | IF ( .NOT. found .AND. ocean_mode ) THEN |
---|
| 761 | CALL ocean_data_output_3d( av, do3d(av,if), found, local_pf, & |
---|
| 762 | nzb_do, nzt_do ) |
---|
[1976] | 763 | resorted = .TRUE. |
---|
| 764 | ENDIF |
---|
| 765 | |
---|
[3294] | 766 | IF ( .NOT. found .AND. plant_canopy ) THEN |
---|
| 767 | CALL pcm_data_output_3d( av, do3d(av,if), found, local_pf, & |
---|
| 768 | fill_value, nzb_do, nzt_do ) |
---|
[2817] | 769 | resorted = .TRUE. |
---|
| 770 | ENDIF |
---|
| 771 | |
---|
[3294] | 772 | IF ( .NOT. found .AND. radiation ) THEN |
---|
| 773 | CALL radiation_data_output_3d( av, do3d(av,if), found, & |
---|
| 774 | local_pf, nzb_do, nzt_do ) |
---|
[2696] | 775 | resorted = .TRUE. |
---|
| 776 | ENDIF |
---|
| 777 | |
---|
[3294] | 778 | IF ( .NOT. found ) THEN |
---|
| 779 | CALL tcm_data_output_3d( av, do3d(av,if), found, local_pf, & |
---|
| 780 | nzb_do, nzt_do ) |
---|
[2209] | 781 | resorted = .TRUE. |
---|
| 782 | ENDIF |
---|
[3467] | 783 | |
---|
| 784 | ! |
---|
| 785 | !-- SALSA output |
---|
| 786 | IF ( .NOT. found .AND. salsa ) THEN |
---|
| 787 | CALL salsa_data_output_3d( av, do3d(av,if), found, local_pf ) |
---|
| 788 | resorted = .TRUE. |
---|
| 789 | ENDIF |
---|
[2209] | 790 | |
---|
[3448] | 791 | IF ( .NOT. found .AND. biometeorology ) THEN |
---|
| 792 | CALL biom_data_output_3d( av, do3d(av,if), found, local_pf, & |
---|
| 793 | nzb_do, nzt_do ) |
---|
| 794 | ENDIF |
---|
| 795 | |
---|
[2209] | 796 | ! |
---|
[3294] | 797 | !-- User defined quantities |
---|
[1972] | 798 | IF ( .NOT. found ) THEN |
---|
| 799 | CALL user_data_output_3d( av, do3d(av,if), found, local_pf, & |
---|
| 800 | nzb_do, nzt_do ) |
---|
| 801 | resorted = .TRUE. |
---|
| 802 | ENDIF |
---|
[1] | 803 | |
---|
[254] | 804 | IF ( .NOT. found ) THEN |
---|
[1320] | 805 | message_string = 'no output available for: ' // & |
---|
[274] | 806 | TRIM( do3d(av,if) ) |
---|
[254] | 807 | CALL message( 'data_output_3d', 'PA0182', 0, 0, 0, 6, 0 ) |
---|
[1] | 808 | ENDIF |
---|
| 809 | |
---|
| 810 | END SELECT |
---|
| 811 | |
---|
| 812 | ! |
---|
| 813 | !-- Resort the array to be output, if not done above |
---|
| 814 | IF ( .NOT. resorted ) THEN |
---|
[2512] | 815 | DO i = nxl, nxr |
---|
| 816 | DO j = nys, nyn |
---|
[1551] | 817 | DO k = nzb_do, nzt_do |
---|
[2696] | 818 | local_pf(i,j,k) = MERGE( & |
---|
| 819 | to_be_resorted(k,j,i), & |
---|
| 820 | REAL( fill_value, KIND = wp ), & |
---|
| 821 | BTEST( wall_flags_0(k,j,i), flag_nr ) ) |
---|
[1] | 822 | ENDDO |
---|
| 823 | ENDDO |
---|
| 824 | ENDDO |
---|
| 825 | ENDIF |
---|
| 826 | |
---|
| 827 | ! |
---|
[1327] | 828 | !-- Output of the 3D-array |
---|
| 829 | #if defined( __parallel ) |
---|
| 830 | IF ( netcdf_data_format < 5 ) THEN |
---|
[1] | 831 | ! |
---|
[1327] | 832 | !-- Non-parallel netCDF output. Data is output in parallel in |
---|
| 833 | !-- FORTRAN binary format here, and later collected into one file by |
---|
| 834 | !-- combine_plot_fields |
---|
| 835 | IF ( myid == 0 ) THEN |
---|
| 836 | WRITE ( 30 ) time_since_reference_point, & |
---|
| 837 | do3d_time_count(av), av |
---|
[1] | 838 | ENDIF |
---|
[1327] | 839 | DO i = 0, io_blocks-1 |
---|
| 840 | IF ( i == io_group ) THEN |
---|
[2512] | 841 | WRITE ( 30 ) nxl, nxr, nys, nyn, nzb_do, nzt_do |
---|
[1551] | 842 | WRITE ( 30 ) local_pf(:,:,nzb_do:nzt_do) |
---|
[1327] | 843 | ENDIF |
---|
[1972] | 844 | |
---|
[1327] | 845 | CALL MPI_BARRIER( comm2d, ierr ) |
---|
[1972] | 846 | |
---|
[1327] | 847 | ENDDO |
---|
[559] | 848 | |
---|
[1327] | 849 | ELSE |
---|
[646] | 850 | #if defined( __netcdf ) |
---|
[493] | 851 | ! |
---|
[1327] | 852 | !-- Parallel output in netCDF4/HDF5 format. |
---|
[2512] | 853 | ! IF ( nxr == nx .AND. nyn /= ny ) THEN |
---|
| 854 | ! nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if), & |
---|
| 855 | ! local_pf(nxl:nxr+1,nys:nyn,nzb_do:nzt_do), & |
---|
| 856 | ! start = (/ nxl+1, nys+1, nzb_do+1, do3d_time_count(av) /), & |
---|
| 857 | ! count = (/ nxr-nxl+2, nyn-nys+1, nzt_do-nzb_do+1, 1 /) ) |
---|
| 858 | ! ELSEIF ( nxr /= nx .AND. nyn == ny ) THEN |
---|
| 859 | ! nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if), & |
---|
| 860 | ! local_pf(nxl:nxr,nys:nyn+1,nzb_do:nzt_do), & |
---|
| 861 | ! start = (/ nxl+1, nys+1, nzb_do+1, do3d_time_count(av) /), & |
---|
| 862 | ! count = (/ nxr-nxl+1, nyn-nys+2, nzt_do-nzb_do+1, 1 /) ) |
---|
| 863 | ! ELSEIF ( nxr == nx .AND. nyn == ny ) THEN |
---|
| 864 | ! nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if), & |
---|
| 865 | ! local_pf(nxl:nxr+1,nys:nyn+1,nzb_do:nzt_do ), & |
---|
| 866 | ! start = (/ nxl+1, nys+1, nzb_do+1, do3d_time_count(av) /), & |
---|
| 867 | ! count = (/ nxr-nxl+2, nyn-nys+2, nzt_do-nzb_do+1, 1 /) ) |
---|
| 868 | ! ELSE |
---|
[1327] | 869 | nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if), & |
---|
[1551] | 870 | local_pf(nxl:nxr,nys:nyn,nzb_do:nzt_do), & |
---|
| 871 | start = (/ nxl+1, nys+1, nzb_do+1, do3d_time_count(av) /), & |
---|
| 872 | count = (/ nxr-nxl+1, nyn-nys+1, nzt_do-nzb_do+1, 1 /) ) |
---|
[2512] | 873 | ! ENDIF |
---|
[1783] | 874 | CALL netcdf_handle_error( 'data_output_3d', 386 ) |
---|
[646] | 875 | #endif |
---|
[1327] | 876 | ENDIF |
---|
[1] | 877 | #else |
---|
| 878 | #if defined( __netcdf ) |
---|
[1327] | 879 | nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if), & |
---|
[1551] | 880 | local_pf(nxl:nxr+1,nys:nyn+1,nzb_do:nzt_do), & |
---|
[1327] | 881 | start = (/ 1, 1, 1, do3d_time_count(av) /), & |
---|
[2512] | 882 | count = (/ nx+1, ny+1, nzt_do-nzb_do+1, 1 /) ) |
---|
[1783] | 883 | CALL netcdf_handle_error( 'data_output_3d', 446 ) |
---|
[1] | 884 | #endif |
---|
| 885 | #endif |
---|
| 886 | |
---|
| 887 | if = if + 1 |
---|
| 888 | |
---|
| 889 | ! |
---|
[1551] | 890 | !-- Deallocate temporary array |
---|
| 891 | DEALLOCATE ( local_pf ) |
---|
[1] | 892 | |
---|
[1551] | 893 | ENDDO |
---|
[1] | 894 | |
---|
[1318] | 895 | CALL cpu_log( log_point(14), 'data_output_3d', 'stop' ) |
---|
[1] | 896 | |
---|
| 897 | END SUBROUTINE data_output_3d |
---|