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