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