[1682] | 1 | !> @file check_open.f90 |
---|
[2000] | 2 | !------------------------------------------------------------------------------! |
---|
[1036] | 3 | ! This file is part of PALM. |
---|
| 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 | ! |
---|
[1804] | 14 | ! You should have received a copy of the GNU fGeneral Public License along with |
---|
[1036] | 15 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
| 16 | ! |
---|
[1818] | 17 | ! Copyright 1997-2016 Leibniz Universitaet Hannover |
---|
[2000] | 18 | !------------------------------------------------------------------------------! |
---|
[1036] | 19 | ! |
---|
[247] | 20 | ! Current revisions: |
---|
[1] | 21 | ! ----------------- |
---|
[2039] | 22 | ! Removed open of file 'PLOTTS_DATA' ( CASE(50:59) ) as it is no longer needed |
---|
[1805] | 23 | ! |
---|
[1321] | 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! $Id: check_open.f90 2039 2016-10-26 16:53:23Z gronemeier $ |
---|
| 27 | ! |
---|
[2001] | 28 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
| 29 | ! Forced header and separation lines into 80 columns |
---|
| 30 | ! |
---|
[1989] | 31 | ! 1988 2016-08-10 14:49:06Z gronemeier |
---|
| 32 | ! informative message added if files cannot be opened in newly created directory |
---|
| 33 | ! |
---|
[1987] | 34 | ! 1986 2016-08-10 14:07:17Z gronemeier |
---|
| 35 | ! Bugfix: check if output can be opened in newly created directory. If not |
---|
| 36 | ! wait one second and try again. |
---|
| 37 | ! |
---|
[1975] | 38 | ! 1974 2016-07-26 08:43:25Z gronemeier |
---|
| 39 | ! Bugfix: MPI barriers after deleting non-extendable files must only be called |
---|
| 40 | ! in case of parallel I/O |
---|
| 41 | ! |
---|
[1958] | 42 | ! 1957 2016-07-07 10:43:48Z suehring |
---|
| 43 | ! flight module added |
---|
| 44 | ! |
---|
[1805] | 45 | ! 1804 2016-04-05 16:30:18Z maronga |
---|
| 46 | ! Removed code for parameter file check (__check) |
---|
| 47 | ! |
---|
[1784] | 48 | ! 1783 2016-03-06 18:36:17Z raasch |
---|
| 49 | ! name change of netcdf routines and module + related changes |
---|
| 50 | ! |
---|
[1780] | 51 | ! 1779 2016-03-03 08:01:28Z raasch |
---|
| 52 | ! coupling_char is trimmed at every place it occurs, because it can have |
---|
| 53 | ! different length now |
---|
| 54 | ! |
---|
[1746] | 55 | ! 1745 2016-02-05 13:06:51Z gronemeier |
---|
| 56 | ! Bugfix: added MPI barrier after deleting existing non-extendable file by PE0 |
---|
| 57 | ! |
---|
[1683] | 58 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
| 59 | ! Code annotations made doxygen readable |
---|
| 60 | ! |
---|
[1552] | 61 | ! 1551 2015-03-03 14:18:16Z maronga |
---|
| 62 | ! Removed redundant output for combine_plot_fields |
---|
| 63 | ! |
---|
[1469] | 64 | ! 1468 2014-09-24 14:06:57Z maronga |
---|
| 65 | ! Adapted for use on up to 6-digit processor cores |
---|
| 66 | ! Added file unit 117 (PROGRESS) |
---|
| 67 | ! |
---|
[1360] | 68 | ! 1359 2014-04-11 17:15:14Z hoffmann |
---|
| 69 | ! Format of particle exchange statistics extended to reasonable numbers of |
---|
| 70 | ! particles. |
---|
| 71 | ! |
---|
[1354] | 72 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
| 73 | ! REAL constants provided with KIND-attribute, |
---|
| 74 | ! declaration for unused variables xkoor, ykoor, zkoor removed |
---|
| 75 | ! |
---|
[1329] | 76 | ! 1327 2014-03-21 11:00:16Z raasch |
---|
| 77 | ! parts concerning iso2d and avs output removed |
---|
| 78 | ! |
---|
[1321] | 79 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 80 | ! ONLY-attribute added to USE-statements, |
---|
| 81 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 82 | ! kinds are defined in new module kinds, |
---|
| 83 | ! old module precision_kind is removed, |
---|
| 84 | ! revision history before 2012 removed, |
---|
| 85 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 86 | ! all variable declaration statements |
---|
[1] | 87 | ! |
---|
[1107] | 88 | ! 1106 2013-03-04 05:31:38Z raasch |
---|
| 89 | ! array_kind renamed precision_kind |
---|
| 90 | ! |
---|
[1093] | 91 | ! 1092 2013-02-02 11:24:22Z raasch |
---|
| 92 | ! unused variables removed |
---|
| 93 | ! |
---|
[1037] | 94 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 95 | ! code put under GPL (PALM 3.9) |
---|
| 96 | ! |
---|
[1035] | 97 | ! 1031 2012-10-19 14:35:30Z raasch |
---|
| 98 | ! netCDF4 without parallel file support implemented, |
---|
| 99 | ! opening of netCDF files are done by new routines create_netcdf_file and |
---|
| 100 | ! open_write_netcdf_file |
---|
| 101 | ! |
---|
[965] | 102 | ! 964 2012-07-26 09:14:24Z raasch |
---|
| 103 | ! old profil-units (40:49) removed, |
---|
| 104 | ! append feature removed from unit 14 |
---|
| 105 | ! |
---|
[850] | 106 | ! 849 2012-03-15 10:35:09Z raasch |
---|
| 107 | ! comment changed |
---|
| 108 | ! |
---|
[810] | 109 | ! 809 2012-01-30 13:32:58Z maronga |
---|
| 110 | ! Bugfix: replaced .AND. and .NOT. with && and ! in the preprocessor directives |
---|
| 111 | ! |
---|
[808] | 112 | ! 807 2012-01-25 11:53:51Z maronga |
---|
| 113 | ! New cpp directive "__check" implemented which is used by check_namelist_files |
---|
| 114 | ! |
---|
[1] | 115 | ! Revision 1.1 1997/08/11 06:10:55 raasch |
---|
| 116 | ! Initial revision |
---|
| 117 | ! |
---|
| 118 | ! |
---|
| 119 | ! Description: |
---|
| 120 | ! ------------ |
---|
[1682] | 121 | !> Check if file unit is open. If not, open file and, if necessary, write a |
---|
| 122 | !> header or start other initializing actions, respectively. |
---|
[1] | 123 | !------------------------------------------------------------------------------! |
---|
[1682] | 124 | SUBROUTINE check_open( file_id ) |
---|
| 125 | |
---|
[1] | 126 | |
---|
[1320] | 127 | USE arrays_3d, & |
---|
| 128 | ONLY: zu |
---|
| 129 | |
---|
| 130 | USE control_parameters, & |
---|
[1327] | 131 | ONLY: avs_data_file, coupling_char, data_output_2d_on_each_pe, host, & |
---|
[1783] | 132 | max_masks, message_string, mid, nz_do3d, openfile, & |
---|
[1320] | 133 | return_addres, return_username, run_description_header, runnr |
---|
| 134 | |
---|
| 135 | USE grid_variables, & |
---|
| 136 | ONLY: dx, dy |
---|
| 137 | |
---|
| 138 | USE indices, & |
---|
[1551] | 139 | ONLY: nbgp, nx, nxl, nxr, ny, nyn, nyng, nys, nysg, nz, nzb, nzt |
---|
[1320] | 140 | |
---|
| 141 | USE kinds |
---|
| 142 | |
---|
[1783] | 143 | #if defined( __netcdf ) |
---|
| 144 | USE NETCDF |
---|
| 145 | #endif |
---|
[1320] | 146 | |
---|
[1783] | 147 | USE netcdf_interface, & |
---|
[1957] | 148 | ONLY: id_set_fl, id_set_mask, id_set_pr, id_set_prt, id_set_pts, & |
---|
| 149 | id_set_sp, id_set_ts, id_set_xy, id_set_xz, id_set_yz, & |
---|
| 150 | id_set_3d, nc_stat, netcdf_create_file, netcdf_data_format, & |
---|
| 151 | netcdf_define_header, netcdf_handle_error, netcdf_open_write_file |
---|
[1783] | 152 | |
---|
[1320] | 153 | USE particle_attributes, & |
---|
| 154 | ONLY: max_number_of_particle_groups, number_of_particle_groups, & |
---|
| 155 | particle_groups |
---|
| 156 | |
---|
[1] | 157 | USE pegrid |
---|
| 158 | |
---|
[1986] | 159 | USE posix_calls_from_fortran, & |
---|
| 160 | ONLY: fortran_sleep |
---|
| 161 | |
---|
[1320] | 162 | USE profil_parameter, & |
---|
| 163 | ONLY: cross_ts_numbers, cross_ts_number_count |
---|
| 164 | |
---|
| 165 | |
---|
[1] | 166 | IMPLICIT NONE |
---|
| 167 | |
---|
[1682] | 168 | CHARACTER (LEN=2) :: mask_char !< |
---|
| 169 | CHARACTER (LEN=2) :: suffix !< |
---|
| 170 | CHARACTER (LEN=20) :: xtext = 'time in s' !< |
---|
| 171 | CHARACTER (LEN=30) :: filename !< |
---|
| 172 | CHARACTER (LEN=40) :: avs_coor_file !< |
---|
| 173 | CHARACTER (LEN=40) :: avs_coor_file_localname !< |
---|
| 174 | CHARACTER (LEN=40) :: avs_data_file_localname !< |
---|
| 175 | CHARACTER (LEN=80) :: rtext !< |
---|
| 176 | CHARACTER (LEN=100) :: avs_coor_file_catalog !< |
---|
| 177 | CHARACTER (LEN=100) :: avs_data_file_catalog !< |
---|
| 178 | CHARACTER (LEN=100) :: batch_scp !< |
---|
| 179 | CHARACTER (LEN=100) :: line !< |
---|
| 180 | CHARACTER (LEN=400) :: command !< |
---|
[1] | 181 | |
---|
[1682] | 182 | INTEGER(iwp) :: av !< |
---|
| 183 | INTEGER(iwp) :: numline = 1 !< |
---|
| 184 | INTEGER(iwp) :: cranz !< |
---|
| 185 | INTEGER(iwp) :: file_id !< |
---|
| 186 | INTEGER(iwp) :: i !< |
---|
| 187 | INTEGER(iwp) :: iaddres !< |
---|
[1986] | 188 | INTEGER(iwp) :: ioerr !< IOSTAT flag for IO-commands ( 0 = no error ) |
---|
[1682] | 189 | INTEGER(iwp) :: iusern !< |
---|
| 190 | INTEGER(iwp) :: j !< |
---|
| 191 | INTEGER(iwp) :: k !< |
---|
| 192 | INTEGER(iwp) :: legpos = 1 !< |
---|
| 193 | INTEGER(iwp) :: timodex = 1 !< |
---|
[1320] | 194 | |
---|
[1682] | 195 | INTEGER(iwp), DIMENSION(10) :: klist !< |
---|
[1] | 196 | |
---|
[1682] | 197 | LOGICAL :: avs_coor_file_found = .FALSE. !< |
---|
| 198 | LOGICAL :: avs_data_file_found = .FALSE. !< |
---|
| 199 | LOGICAL :: datleg = .TRUE. !< |
---|
| 200 | LOGICAL :: get_filenames !< |
---|
| 201 | LOGICAL :: grid = .TRUE. !< |
---|
| 202 | LOGICAL :: netcdf_extend !< |
---|
| 203 | LOGICAL :: rand = .TRUE. !< |
---|
| 204 | LOGICAL :: swap = .TRUE. !< |
---|
| 205 | LOGICAL :: twoxa = .TRUE. !< |
---|
| 206 | LOGICAL :: twoya = .TRUE. !< |
---|
[1] | 207 | |
---|
[1682] | 208 | REAL(wp) :: ansx = -999.999_wp !< |
---|
| 209 | REAL(wp) :: ansy = -999.999_wp !< |
---|
| 210 | REAL(wp) :: gwid = 0.1_wp !< |
---|
| 211 | REAL(wp) :: rlegfak = 1.5_wp !< |
---|
| 212 | REAL(wp) :: sizex = 250.0_wp !< |
---|
| 213 | REAL(wp) :: sizey = 40.0_wp !< |
---|
| 214 | REAL(wp) :: texfac = 1.5_wp !< |
---|
[1] | 215 | |
---|
[1682] | 216 | REAL(wp), DIMENSION(:), ALLOCATABLE :: eta !< |
---|
| 217 | REAL(wp), DIMENSION(:), ALLOCATABLE :: ho !< |
---|
| 218 | REAL(wp), DIMENSION(:), ALLOCATABLE :: hu !< |
---|
[1353] | 219 | |
---|
[1] | 220 | |
---|
| 221 | |
---|
[1320] | 222 | NAMELIST /RAHMEN/ numline, cranz, datleg, rtext, swap |
---|
| 223 | NAMELIST /CROSS/ ansx, ansy, grid, gwid, klist, legpos, & |
---|
| 224 | rand, rlegfak, sizex, sizey, texfac, & |
---|
[1] | 225 | timodex, twoxa, twoya, xtext |
---|
| 226 | |
---|
| 227 | |
---|
| 228 | ! |
---|
| 229 | !-- Immediate return if file already open |
---|
| 230 | IF ( openfile(file_id)%opened ) RETURN |
---|
| 231 | |
---|
| 232 | ! |
---|
| 233 | !-- Only certain files are allowed to be re-opened |
---|
| 234 | !-- NOTE: some of the other files perhaps also could be re-opened, but it |
---|
| 235 | !-- has not been checked so far, if it works! |
---|
| 236 | IF ( openfile(file_id)%opened_before ) THEN |
---|
| 237 | SELECT CASE ( file_id ) |
---|
[1468] | 238 | CASE ( 13, 14, 21, 22, 23, 80:85, 117 ) |
---|
[1] | 239 | IF ( file_id == 14 .AND. openfile(file_id)%opened_before ) THEN |
---|
[1320] | 240 | message_string = 're-open of unit ' // & |
---|
[274] | 241 | '14 is not verified. Please check results!' |
---|
[247] | 242 | CALL message( 'check_open', 'PA0165', 0, 1, 0, 6, 0 ) |
---|
[1] | 243 | ENDIF |
---|
[143] | 244 | |
---|
[1] | 245 | CASE DEFAULT |
---|
[1320] | 246 | WRITE( message_string, * ) 're-opening of file-id ', file_id, & |
---|
[274] | 247 | ' is not allowed' |
---|
[247] | 248 | CALL message( 'check_open', 'PA0166', 0, 1, 0, 6, 0 ) |
---|
| 249 | |
---|
[1] | 250 | RETURN |
---|
[143] | 251 | |
---|
[1] | 252 | END SELECT |
---|
| 253 | ENDIF |
---|
| 254 | |
---|
| 255 | ! |
---|
| 256 | !-- Check if file may be opened on the relevant PE |
---|
| 257 | SELECT CASE ( file_id ) |
---|
| 258 | |
---|
[1468] | 259 | CASE ( 15, 16, 17, 18, 19, 50:59, 81:84, 104:105, 107, 109, 117 ) |
---|
[410] | 260 | |
---|
[493] | 261 | IF ( myid /= 0 ) THEN |
---|
[1320] | 262 | WRITE( message_string, * ) 'opening file-id ',file_id, & |
---|
[493] | 263 | ' not allowed for PE ',myid |
---|
| 264 | CALL message( 'check_open', 'PA0167', 2, 2, -1, 6, 1 ) |
---|
| 265 | ENDIF |
---|
| 266 | |
---|
[564] | 267 | CASE ( 101:103, 106, 111:113, 116, 201:200+2*max_masks ) |
---|
[493] | 268 | |
---|
[1031] | 269 | IF ( netcdf_data_format < 5 ) THEN |
---|
[247] | 270 | |
---|
[410] | 271 | IF ( myid /= 0 ) THEN |
---|
[1320] | 272 | WRITE( message_string, * ) 'opening file-id ',file_id, & |
---|
[410] | 273 | ' not allowed for PE ',myid |
---|
| 274 | CALL message( 'check_open', 'PA0167', 2, 2, -1, 6, 1 ) |
---|
| 275 | ENDIF |
---|
| 276 | |
---|
[493] | 277 | ENDIF |
---|
[1] | 278 | |
---|
| 279 | CASE ( 21, 22, 23 ) |
---|
| 280 | |
---|
| 281 | IF ( .NOT. data_output_2d_on_each_pe ) THEN |
---|
| 282 | IF ( myid /= 0 ) THEN |
---|
[1320] | 283 | WRITE( message_string, * ) 'opening file-id ',file_id, & |
---|
[247] | 284 | ' not allowed for PE ',myid |
---|
[277] | 285 | CALL message( 'check_open', 'PA0167', 2, 2, -1, 6, 1 ) |
---|
[247] | 286 | END IF |
---|
[1] | 287 | ENDIF |
---|
| 288 | |
---|
[1327] | 289 | CASE ( 27, 28, 29, 31, 33, 71:73, 90:99 ) |
---|
[1] | 290 | |
---|
| 291 | ! |
---|
| 292 | !-- File-ids that are used temporarily in other routines |
---|
[1320] | 293 | WRITE( message_string, * ) 'opening file-id ',file_id, & |
---|
[274] | 294 | ' is not allowed since it is used otherwise' |
---|
[247] | 295 | CALL message( 'check_open', 'PA0168', 0, 1, 0, 6, 0 ) |
---|
| 296 | |
---|
[1] | 297 | END SELECT |
---|
| 298 | |
---|
| 299 | ! |
---|
| 300 | !-- Open relevant files |
---|
| 301 | SELECT CASE ( file_id ) |
---|
| 302 | |
---|
| 303 | CASE ( 11 ) |
---|
| 304 | |
---|
[1779] | 305 | OPEN ( 11, FILE='PARIN'//TRIM( coupling_char ), FORM='FORMATTED', & |
---|
[102] | 306 | STATUS='OLD' ) |
---|
[1] | 307 | |
---|
| 308 | CASE ( 13 ) |
---|
| 309 | |
---|
| 310 | IF ( myid_char == '' ) THEN |
---|
[1779] | 311 | OPEN ( 13, FILE='BININ'//TRIM( coupling_char )//myid_char, & |
---|
[102] | 312 | FORM='UNFORMATTED', STATUS='OLD' ) |
---|
[1] | 313 | ELSE |
---|
[143] | 314 | ! |
---|
[1468] | 315 | !-- First opening of unit 13 openes file _000000 on all PEs because |
---|
| 316 | !-- only this file contains the global variables |
---|
[143] | 317 | IF ( .NOT. openfile(file_id)%opened_before ) THEN |
---|
[1779] | 318 | OPEN ( 13, FILE='BININ'//TRIM( coupling_char )//'/_000000', & |
---|
[143] | 319 | FORM='UNFORMATTED', STATUS='OLD' ) |
---|
| 320 | ELSE |
---|
[1779] | 321 | OPEN ( 13, FILE='BININ'//TRIM( coupling_char )//'/'// & |
---|
| 322 | myid_char, FORM='UNFORMATTED', STATUS='OLD' ) |
---|
[143] | 323 | ENDIF |
---|
[1] | 324 | ENDIF |
---|
| 325 | |
---|
| 326 | CASE ( 14 ) |
---|
| 327 | |
---|
| 328 | IF ( myid_char == '' ) THEN |
---|
[1779] | 329 | OPEN ( 14, FILE='BINOUT'//TRIM( coupling_char )//myid_char, & |
---|
[102] | 330 | FORM='UNFORMATTED', POSITION='APPEND' ) |
---|
[1] | 331 | ELSE |
---|
| 332 | IF ( myid == 0 .AND. .NOT. openfile(file_id)%opened_before ) THEN |
---|
[1779] | 333 | CALL local_system( 'mkdir BINOUT' // TRIM( coupling_char ) ) |
---|
[1] | 334 | ENDIF |
---|
[1804] | 335 | #if defined( __parallel ) |
---|
[1] | 336 | ! |
---|
| 337 | !-- Set a barrier in order to allow that all other processors in the |
---|
| 338 | !-- directory created by PE0 can open their file |
---|
| 339 | CALL MPI_BARRIER( comm2d, ierr ) |
---|
| 340 | #endif |
---|
[1986] | 341 | ioerr = 1 |
---|
| 342 | DO WHILE ( ioerr /= 0 ) |
---|
| 343 | OPEN ( 14, FILE='BINOUT'//TRIM(coupling_char)//'/'//myid_char, & |
---|
| 344 | FORM='UNFORMATTED', IOSTAT=ioerr ) |
---|
[1988] | 345 | IF ( ioerr /= 0 ) THEN |
---|
| 346 | WRITE( 9, * ) '*** could not open "BINOUT'// & |
---|
| 347 | TRIM(coupling_char)//'/'//myid_char// & |
---|
| 348 | '"! Trying again in 1 sec.' |
---|
| 349 | CALL fortran_sleep( 1 ) |
---|
| 350 | ENDIF |
---|
[1986] | 351 | ENDDO |
---|
| 352 | |
---|
[1] | 353 | ENDIF |
---|
| 354 | |
---|
| 355 | CASE ( 15 ) |
---|
| 356 | |
---|
[1779] | 357 | OPEN ( 15, FILE='RUN_CONTROL'//TRIM( coupling_char ), & |
---|
| 358 | FORM='FORMATTED' ) |
---|
[1] | 359 | |
---|
| 360 | CASE ( 16 ) |
---|
| 361 | |
---|
[1779] | 362 | OPEN ( 16, FILE='LIST_PROFIL'//TRIM( coupling_char ), & |
---|
| 363 | FORM='FORMATTED' ) |
---|
[1] | 364 | |
---|
| 365 | CASE ( 17 ) |
---|
| 366 | |
---|
[1779] | 367 | OPEN ( 17, FILE='LIST_PROFIL_1D'//TRIM( coupling_char ), & |
---|
| 368 | FORM='FORMATTED' ) |
---|
[1] | 369 | |
---|
| 370 | CASE ( 18 ) |
---|
| 371 | |
---|
[1779] | 372 | OPEN ( 18, FILE='CPU_MEASURES'//TRIM( coupling_char ), & |
---|
| 373 | FORM='FORMATTED' ) |
---|
[1] | 374 | |
---|
| 375 | CASE ( 19 ) |
---|
| 376 | |
---|
[1779] | 377 | OPEN ( 19, FILE='HEADER'//TRIM( coupling_char ), FORM='FORMATTED' ) |
---|
[1] | 378 | |
---|
| 379 | CASE ( 20 ) |
---|
| 380 | |
---|
| 381 | IF ( myid == 0 .AND. .NOT. openfile(file_id)%opened_before ) THEN |
---|
[1779] | 382 | CALL local_system( 'mkdir DATA_LOG' // TRIM( coupling_char ) ) |
---|
[1] | 383 | ENDIF |
---|
| 384 | IF ( myid_char == '' ) THEN |
---|
[1779] | 385 | OPEN ( 20, FILE='DATA_LOG'//TRIM( coupling_char )//'/_000000', & |
---|
[102] | 386 | FORM='UNFORMATTED', POSITION='APPEND' ) |
---|
[1] | 387 | ELSE |
---|
[1804] | 388 | #if defined( __parallel ) |
---|
[1] | 389 | ! |
---|
| 390 | !-- Set a barrier in order to allow that all other processors in the |
---|
| 391 | !-- directory created by PE0 can open their file |
---|
| 392 | CALL MPI_BARRIER( comm2d, ierr ) |
---|
| 393 | #endif |
---|
[1986] | 394 | ioerr = 1 |
---|
| 395 | DO WHILE ( ioerr /= 0 ) |
---|
| 396 | OPEN ( 20, FILE='DATA_LOG'//TRIM( coupling_char )//'/'// & |
---|
| 397 | myid_char, FORM='UNFORMATTED', POSITION='APPEND', & |
---|
| 398 | IOSTAT=ioerr ) |
---|
[1988] | 399 | IF ( ioerr /= 0 ) THEN |
---|
| 400 | WRITE( 9, * ) '*** could not open "DATA_LOG'// & |
---|
| 401 | TRIM( coupling_char )//'/'//myid_char// & |
---|
| 402 | '"! Trying again in 1 sec.' |
---|
| 403 | CALL fortran_sleep( 1 ) |
---|
| 404 | ENDIF |
---|
[1986] | 405 | ENDDO |
---|
| 406 | |
---|
[1] | 407 | ENDIF |
---|
| 408 | |
---|
| 409 | CASE ( 21 ) |
---|
| 410 | |
---|
| 411 | IF ( data_output_2d_on_each_pe ) THEN |
---|
[1320] | 412 | OPEN ( 21, FILE='PLOT2D_XY'//TRIM( coupling_char )//myid_char, & |
---|
[102] | 413 | FORM='UNFORMATTED', POSITION='APPEND' ) |
---|
[1] | 414 | ELSE |
---|
[1779] | 415 | OPEN ( 21, FILE='PLOT2D_XY'//TRIM( coupling_char ), & |
---|
[102] | 416 | FORM='UNFORMATTED', POSITION='APPEND' ) |
---|
[1] | 417 | ENDIF |
---|
| 418 | |
---|
| 419 | IF ( myid == 0 .AND. .NOT. openfile(file_id)%opened_before ) THEN |
---|
| 420 | ! |
---|
| 421 | !-- Output for combine_plot_fields |
---|
| 422 | IF ( data_output_2d_on_each_pe .AND. myid_char /= '' ) THEN |
---|
[667] | 423 | WRITE (21) -nbgp, nx+nbgp, -nbgp, ny+nbgp ! total array size |
---|
[1] | 424 | WRITE (21) 0, nx+1, 0, ny+1 ! output part |
---|
| 425 | ENDIF |
---|
| 426 | ! |
---|
| 427 | !-- Determine and write ISO2D coordiante header |
---|
| 428 | ALLOCATE( eta(0:ny+1), ho(0:nx+1), hu(0:nx+1) ) |
---|
[1353] | 429 | hu = 0.0_wp |
---|
[1] | 430 | ho = (ny+1) * dy |
---|
| 431 | DO i = 1, ny |
---|
[1353] | 432 | eta(i) = REAL( i ) / ( ny + 1.0_wp ) |
---|
[1] | 433 | ENDDO |
---|
[1353] | 434 | eta(0) = 0.0_wp |
---|
| 435 | eta(ny+1) = 1.0_wp |
---|
[1] | 436 | |
---|
| 437 | WRITE (21) dx,eta,hu,ho |
---|
| 438 | DEALLOCATE( eta, ho, hu ) |
---|
| 439 | |
---|
| 440 | ENDIF |
---|
| 441 | |
---|
| 442 | CASE ( 22 ) |
---|
| 443 | |
---|
| 444 | IF ( data_output_2d_on_each_pe ) THEN |
---|
[1320] | 445 | OPEN ( 22, FILE='PLOT2D_XZ'//TRIM( coupling_char )//myid_char, & |
---|
[102] | 446 | FORM='UNFORMATTED', POSITION='APPEND' ) |
---|
[1] | 447 | ELSE |
---|
[1779] | 448 | OPEN ( 22, FILE='PLOT2D_XZ'//TRIM( coupling_char ), & |
---|
| 449 | FORM='UNFORMATTED', POSITION='APPEND' ) |
---|
[1] | 450 | ENDIF |
---|
| 451 | |
---|
| 452 | IF ( myid == 0 .AND. .NOT. openfile(file_id)%opened_before ) THEN |
---|
| 453 | ! |
---|
| 454 | !-- Output for combine_plot_fields |
---|
| 455 | IF ( data_output_2d_on_each_pe .AND. myid_char /= '' ) THEN |
---|
[667] | 456 | WRITE (22) -nbgp, nx+nbgp, 0, nz+1 ! total array size |
---|
[1] | 457 | WRITE (22) 0, nx+1, 0, nz+1 ! output part |
---|
| 458 | ENDIF |
---|
| 459 | ! |
---|
[1327] | 460 | !-- Determine and write ISO2D coordinate header |
---|
[1] | 461 | ALLOCATE( eta(0:nz+1), ho(0:nx+1), hu(0:nx+1) ) |
---|
[1353] | 462 | hu = 0.0_wp |
---|
[1] | 463 | ho = zu(nz+1) |
---|
| 464 | DO i = 1, nz |
---|
| 465 | eta(i) = REAL( zu(i) ) / zu(nz+1) |
---|
| 466 | ENDDO |
---|
[1353] | 467 | eta(0) = 0.0_wp |
---|
| 468 | eta(nz+1) = 1.0_wp |
---|
[1] | 469 | |
---|
| 470 | WRITE (22) dx,eta,hu,ho |
---|
| 471 | DEALLOCATE( eta, ho, hu ) |
---|
| 472 | |
---|
| 473 | ENDIF |
---|
| 474 | |
---|
| 475 | CASE ( 23 ) |
---|
| 476 | |
---|
| 477 | IF ( data_output_2d_on_each_pe ) THEN |
---|
[1320] | 478 | OPEN ( 23, FILE='PLOT2D_YZ'//TRIM( coupling_char )//myid_char, & |
---|
[102] | 479 | FORM='UNFORMATTED', POSITION='APPEND' ) |
---|
[1] | 480 | ELSE |
---|
[1779] | 481 | OPEN ( 23, FILE='PLOT2D_YZ'//TRIM( coupling_char ), & |
---|
| 482 | FORM='UNFORMATTED', POSITION='APPEND' ) |
---|
[1] | 483 | ENDIF |
---|
| 484 | |
---|
| 485 | IF ( myid == 0 .AND. .NOT. openfile(file_id)%opened_before ) THEN |
---|
| 486 | ! |
---|
| 487 | !-- Output for combine_plot_fields |
---|
| 488 | IF ( data_output_2d_on_each_pe .AND. myid_char /= '' ) THEN |
---|
[667] | 489 | WRITE (23) -nbgp, ny+nbgp, 0, nz+1 ! total array size |
---|
[1] | 490 | WRITE (23) 0, ny+1, 0, nz+1 ! output part |
---|
| 491 | ENDIF |
---|
| 492 | ! |
---|
| 493 | !-- Determine and write ISO2D coordiante header |
---|
| 494 | ALLOCATE( eta(0:nz+1), ho(0:ny+1), hu(0:ny+1) ) |
---|
[1353] | 495 | hu = 0.0_wp |
---|
[1] | 496 | ho = zu(nz+1) |
---|
| 497 | DO i = 1, nz |
---|
| 498 | eta(i) = REAL( zu(i) ) / zu(nz+1) |
---|
| 499 | ENDDO |
---|
[1353] | 500 | eta(0) = 0.0_wp |
---|
| 501 | eta(nz+1) = 1.0_wp |
---|
[1] | 502 | |
---|
| 503 | WRITE (23) dx,eta,hu,ho |
---|
| 504 | DEALLOCATE( eta, ho, hu ) |
---|
| 505 | |
---|
| 506 | ENDIF |
---|
| 507 | |
---|
| 508 | CASE ( 30 ) |
---|
| 509 | |
---|
[1320] | 510 | OPEN ( 30, FILE='PLOT3D_DATA'//TRIM( coupling_char )//myid_char, & |
---|
[102] | 511 | FORM='UNFORMATTED' ) |
---|
[1] | 512 | ! |
---|
| 513 | !-- Write coordinate file for AVS |
---|
| 514 | IF ( myid == 0 ) THEN |
---|
| 515 | #if defined( __parallel ) |
---|
| 516 | ! |
---|
| 517 | !-- Specifications for combine_plot_fields |
---|
[1551] | 518 | WRITE ( 30 ) -nbgp,nx+nbgp,-nbgp,ny+nbgp |
---|
[1327] | 519 | WRITE ( 30 ) 0,nx+1,0,ny+1,0,nz_do3d |
---|
[1] | 520 | #endif |
---|
| 521 | ENDIF |
---|
| 522 | |
---|
| 523 | CASE ( 80 ) |
---|
| 524 | |
---|
| 525 | IF ( myid_char == '' ) THEN |
---|
[105] | 526 | OPEN ( 80, FILE='PARTICLE_INFOS'//TRIM(coupling_char)//myid_char, & |
---|
[102] | 527 | FORM='FORMATTED', POSITION='APPEND' ) |
---|
[1] | 528 | ELSE |
---|
| 529 | IF ( myid == 0 .AND. .NOT. openfile(80)%opened_before ) THEN |
---|
[1779] | 530 | CALL local_system( 'mkdir PARTICLE_INFOS' // & |
---|
| 531 | TRIM( coupling_char ) ) |
---|
[1] | 532 | ENDIF |
---|
[1804] | 533 | #if defined( __parallel ) |
---|
[1] | 534 | ! |
---|
| 535 | !-- Set a barrier in order to allow that thereafter all other |
---|
| 536 | !-- processors in the directory created by PE0 can open their file. |
---|
| 537 | !-- WARNING: The following barrier will lead to hanging jobs, if |
---|
| 538 | !-- check_open is first called from routine |
---|
| 539 | !-- allocate_prt_memory! |
---|
| 540 | IF ( .NOT. openfile(80)%opened_before ) THEN |
---|
| 541 | CALL MPI_BARRIER( comm2d, ierr ) |
---|
| 542 | ENDIF |
---|
| 543 | #endif |
---|
[1320] | 544 | OPEN ( 80, FILE='PARTICLE_INFOS'//TRIM( coupling_char )//'/'// & |
---|
| 545 | myid_char, & |
---|
[102] | 546 | FORM='FORMATTED', POSITION='APPEND' ) |
---|
[1] | 547 | ENDIF |
---|
| 548 | |
---|
| 549 | IF ( .NOT. openfile(80)%opened_before ) THEN |
---|
| 550 | WRITE ( 80, 8000 ) TRIM( run_description_header ) |
---|
| 551 | ENDIF |
---|
| 552 | |
---|
| 553 | CASE ( 81 ) |
---|
| 554 | |
---|
[1779] | 555 | OPEN ( 81, FILE='PLOTSP_X_PAR'//TRIM( coupling_char ), & |
---|
| 556 | FORM='FORMATTED', DELIM='APOSTROPHE', RECL=1500, & |
---|
| 557 | POSITION='APPEND' ) |
---|
[1] | 558 | |
---|
| 559 | CASE ( 82 ) |
---|
| 560 | |
---|
[1779] | 561 | OPEN ( 82, FILE='PLOTSP_X_DATA'//TRIM( coupling_char ), & |
---|
| 562 | FORM='FORMATTED', POSITION = 'APPEND' ) |
---|
[1] | 563 | |
---|
| 564 | CASE ( 83 ) |
---|
| 565 | |
---|
[1779] | 566 | OPEN ( 83, FILE='PLOTSP_Y_PAR'//TRIM( coupling_char ), & |
---|
| 567 | FORM='FORMATTED', DELIM='APOSTROPHE', RECL=1500, & |
---|
| 568 | POSITION='APPEND' ) |
---|
[1] | 569 | |
---|
| 570 | CASE ( 84 ) |
---|
| 571 | |
---|
[1779] | 572 | OPEN ( 84, FILE='PLOTSP_Y_DATA'//TRIM( coupling_char ), & |
---|
| 573 | FORM='FORMATTED', POSITION='APPEND' ) |
---|
[1] | 574 | |
---|
| 575 | CASE ( 85 ) |
---|
| 576 | |
---|
| 577 | IF ( myid_char == '' ) THEN |
---|
[1320] | 578 | OPEN ( 85, FILE='PARTICLE_DATA'//TRIM(coupling_char)//myid_char, & |
---|
[102] | 579 | FORM='UNFORMATTED', POSITION='APPEND' ) |
---|
[1] | 580 | ELSE |
---|
| 581 | IF ( myid == 0 .AND. .NOT. openfile(85)%opened_before ) THEN |
---|
[1779] | 582 | CALL local_system( 'mkdir PARTICLE_DATA' // & |
---|
| 583 | TRIM( coupling_char ) ) |
---|
[1] | 584 | ENDIF |
---|
[1804] | 585 | #if defined( __parallel ) |
---|
[1] | 586 | ! |
---|
| 587 | !-- Set a barrier in order to allow that thereafter all other |
---|
| 588 | !-- processors in the directory created by PE0 can open their file |
---|
| 589 | CALL MPI_BARRIER( comm2d, ierr ) |
---|
| 590 | #endif |
---|
[1986] | 591 | ioerr = 1 |
---|
| 592 | DO WHILE ( ioerr /= 0 ) |
---|
| 593 | OPEN ( 85, FILE='PARTICLE_DATA'//TRIM( coupling_char )//'/'// & |
---|
| 594 | myid_char, & |
---|
| 595 | FORM='UNFORMATTED', POSITION='APPEND', IOSTAT=ioerr ) |
---|
[1988] | 596 | IF ( ioerr /= 0 ) THEN |
---|
| 597 | WRITE( 9, * ) '*** could not open "PARTICLE_DATA'// & |
---|
| 598 | TRIM( coupling_char )//'/'//myid_char// & |
---|
| 599 | '"! Trying again in 1 sec.' |
---|
| 600 | CALL fortran_sleep( 1 ) |
---|
| 601 | ENDIF |
---|
[1986] | 602 | ENDDO |
---|
| 603 | |
---|
[1] | 604 | ENDIF |
---|
| 605 | |
---|
| 606 | IF ( .NOT. openfile(85)%opened_before ) THEN |
---|
| 607 | WRITE ( 85 ) run_description_header |
---|
| 608 | ! |
---|
| 609 | !-- Attention: change version number whenever the output format on |
---|
[849] | 610 | !-- unit 85 is changed (see also in routine |
---|
| 611 | !-- lpm_data_output_particles) |
---|
[1359] | 612 | rtext = 'data format version 3.1' |
---|
[1] | 613 | WRITE ( 85 ) rtext |
---|
[1320] | 614 | WRITE ( 85 ) number_of_particle_groups, & |
---|
[1] | 615 | max_number_of_particle_groups |
---|
| 616 | WRITE ( 85 ) particle_groups |
---|
[1359] | 617 | WRITE ( 85 ) nxl, nxr, nys, nyn, nzb, nzt, nbgp |
---|
[1] | 618 | ENDIF |
---|
| 619 | |
---|
| 620 | #if defined( __netcdf ) |
---|
| 621 | CASE ( 101, 111 ) |
---|
| 622 | ! |
---|
| 623 | !-- Set filename depending on unit number |
---|
| 624 | IF ( file_id == 101 ) THEN |
---|
[1779] | 625 | filename = 'DATA_2D_XY_NETCDF' // TRIM( coupling_char ) |
---|
[1] | 626 | av = 0 |
---|
| 627 | ELSE |
---|
[1779] | 628 | filename = 'DATA_2D_XY_AV_NETCDF' // TRIM( coupling_char ) |
---|
[1] | 629 | av = 1 |
---|
| 630 | ENDIF |
---|
| 631 | ! |
---|
[1031] | 632 | !-- Inquire, if there is a netCDF file from a previuos run. This should |
---|
[1] | 633 | !-- be opened for extension, if its dimensions and variables match the |
---|
| 634 | !-- actual run. |
---|
| 635 | INQUIRE( FILE=filename, EXIST=netcdf_extend ) |
---|
| 636 | IF ( netcdf_extend ) THEN |
---|
| 637 | ! |
---|
[1031] | 638 | !-- Open an existing netCDF file for output |
---|
[1783] | 639 | CALL netcdf_open_write_file( filename, id_set_xy(av), .TRUE., 20 ) |
---|
[1] | 640 | ! |
---|
| 641 | !-- Read header information and set all ids. If there is a mismatch |
---|
| 642 | !-- between the previuos and the actual run, netcdf_extend is returned |
---|
| 643 | !-- as .FALSE. |
---|
[1783] | 644 | CALL netcdf_define_header( 'xy', netcdf_extend, av ) |
---|
[1] | 645 | |
---|
| 646 | ! |
---|
| 647 | !-- Remove the local file, if it can not be extended |
---|
| 648 | IF ( .NOT. netcdf_extend ) THEN |
---|
| 649 | nc_stat = NF90_CLOSE( id_set_xy(av) ) |
---|
[1783] | 650 | CALL netcdf_handle_error( 'check_open', 21 ) |
---|
[493] | 651 | IF ( myid == 0 ) CALL local_system( 'rm ' // TRIM( filename ) ) |
---|
[1804] | 652 | #if defined( __parallel ) |
---|
[1745] | 653 | ! |
---|
| 654 | !-- Set a barrier in order to assure that PE0 deleted the old file |
---|
[1974] | 655 | !-- before any other processor tries to open a new file. |
---|
| 656 | !-- Barrier is only needed in case of parallel I/O |
---|
| 657 | IF ( netcdf_data_format > 4 ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
[1745] | 658 | #endif |
---|
[1] | 659 | ENDIF |
---|
| 660 | |
---|
[1745] | 661 | ENDIF |
---|
[1] | 662 | |
---|
| 663 | IF ( .NOT. netcdf_extend ) THEN |
---|
| 664 | ! |
---|
[1031] | 665 | !-- Create a new netCDF output file with requested netCDF format |
---|
[1783] | 666 | CALL netcdf_create_file( filename, id_set_xy(av), .TRUE., 22 ) |
---|
[493] | 667 | |
---|
| 668 | ! |
---|
[1] | 669 | !-- Define the header |
---|
[1783] | 670 | CALL netcdf_define_header( 'xy', netcdf_extend, av ) |
---|
[1] | 671 | |
---|
[493] | 672 | ! |
---|
[1031] | 673 | !-- In case of parallel netCDF output, create flag file which tells |
---|
[493] | 674 | !-- combine_plot_fields that nothing is to do. |
---|
[1031] | 675 | IF ( myid == 0 .AND. netcdf_data_format > 4 ) THEN |
---|
[493] | 676 | OPEN( 99, FILE='NO_COMBINE_PLOT_FIELDS_XY' ) |
---|
| 677 | WRITE ( 99, '(A)' ) 'no combine_plot_fields.x neccessary' |
---|
| 678 | CLOSE( 99 ) |
---|
| 679 | ENDIF |
---|
| 680 | |
---|
[1] | 681 | ENDIF |
---|
| 682 | |
---|
| 683 | CASE ( 102, 112 ) |
---|
| 684 | ! |
---|
| 685 | !-- Set filename depending on unit number |
---|
| 686 | IF ( file_id == 102 ) THEN |
---|
[1779] | 687 | filename = 'DATA_2D_XZ_NETCDF' // TRIM( coupling_char ) |
---|
[1] | 688 | av = 0 |
---|
| 689 | ELSE |
---|
[1779] | 690 | filename = 'DATA_2D_XZ_AV_NETCDF' // TRIM( coupling_char ) |
---|
[1] | 691 | av = 1 |
---|
| 692 | ENDIF |
---|
| 693 | ! |
---|
[1031] | 694 | !-- Inquire, if there is a netCDF file from a previuos run. This should |
---|
[1] | 695 | !-- be opened for extension, if its dimensions and variables match the |
---|
| 696 | !-- actual run. |
---|
| 697 | INQUIRE( FILE=filename, EXIST=netcdf_extend ) |
---|
| 698 | |
---|
| 699 | IF ( netcdf_extend ) THEN |
---|
| 700 | ! |
---|
[1031] | 701 | !-- Open an existing netCDF file for output |
---|
[1783] | 702 | CALL netcdf_open_write_file( filename, id_set_xz(av), .TRUE., 23 ) |
---|
[1] | 703 | ! |
---|
| 704 | !-- Read header information and set all ids. If there is a mismatch |
---|
| 705 | !-- between the previuos and the actual run, netcdf_extend is returned |
---|
| 706 | !-- as .FALSE. |
---|
[1783] | 707 | CALL netcdf_define_header( 'xz', netcdf_extend, av ) |
---|
[1] | 708 | |
---|
| 709 | ! |
---|
| 710 | !-- Remove the local file, if it can not be extended |
---|
| 711 | IF ( .NOT. netcdf_extend ) THEN |
---|
| 712 | nc_stat = NF90_CLOSE( id_set_xz(av) ) |
---|
[1783] | 713 | CALL netcdf_handle_error( 'check_open', 24 ) |
---|
[493] | 714 | IF ( myid == 0 ) CALL local_system( 'rm ' // TRIM( filename ) ) |
---|
[1804] | 715 | #if defined( __parallel ) |
---|
[1745] | 716 | ! |
---|
| 717 | !-- Set a barrier in order to assure that PE0 deleted the old file |
---|
| 718 | !-- before any other processor tries to open a new file |
---|
[1974] | 719 | !-- Barrier is only needed in case of parallel I/O |
---|
| 720 | IF ( netcdf_data_format > 4 ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
[1745] | 721 | #endif |
---|
[1] | 722 | ENDIF |
---|
| 723 | |
---|
[1745] | 724 | ENDIF |
---|
[1] | 725 | |
---|
| 726 | IF ( .NOT. netcdf_extend ) THEN |
---|
| 727 | ! |
---|
[1031] | 728 | !-- Create a new netCDF output file with requested netCDF format |
---|
[1783] | 729 | CALL netcdf_create_file( filename, id_set_xz(av), .TRUE., 25 ) |
---|
[493] | 730 | |
---|
| 731 | ! |
---|
[1] | 732 | !-- Define the header |
---|
[1783] | 733 | CALL netcdf_define_header( 'xz', netcdf_extend, av ) |
---|
[1] | 734 | |
---|
[493] | 735 | ! |
---|
[1031] | 736 | !-- In case of parallel netCDF output, create flag file which tells |
---|
[493] | 737 | !-- combine_plot_fields that nothing is to do. |
---|
[1031] | 738 | IF ( myid == 0 .AND. netcdf_data_format > 4 ) THEN |
---|
[493] | 739 | OPEN( 99, FILE='NO_COMBINE_PLOT_FIELDS_XZ' ) |
---|
| 740 | WRITE ( 99, '(A)' ) 'no combine_plot_fields.x neccessary' |
---|
| 741 | CLOSE( 99 ) |
---|
| 742 | ENDIF |
---|
| 743 | |
---|
[1] | 744 | ENDIF |
---|
| 745 | |
---|
| 746 | CASE ( 103, 113 ) |
---|
| 747 | ! |
---|
| 748 | !-- Set filename depending on unit number |
---|
| 749 | IF ( file_id == 103 ) THEN |
---|
[1779] | 750 | filename = 'DATA_2D_YZ_NETCDF' // TRIM( coupling_char ) |
---|
[1] | 751 | av = 0 |
---|
| 752 | ELSE |
---|
[1779] | 753 | filename = 'DATA_2D_YZ_AV_NETCDF' // TRIM( coupling_char ) |
---|
[1] | 754 | av = 1 |
---|
| 755 | ENDIF |
---|
| 756 | ! |
---|
[1031] | 757 | !-- Inquire, if there is a netCDF file from a previuos run. This should |
---|
[1] | 758 | !-- be opened for extension, if its dimensions and variables match the |
---|
| 759 | !-- actual run. |
---|
| 760 | INQUIRE( FILE=filename, EXIST=netcdf_extend ) |
---|
| 761 | |
---|
| 762 | IF ( netcdf_extend ) THEN |
---|
| 763 | ! |
---|
[1031] | 764 | !-- Open an existing netCDF file for output |
---|
[1783] | 765 | CALL netcdf_open_write_file( filename, id_set_yz(av), .TRUE., 26 ) |
---|
[1] | 766 | ! |
---|
| 767 | !-- Read header information and set all ids. If there is a mismatch |
---|
| 768 | !-- between the previuos and the actual run, netcdf_extend is returned |
---|
| 769 | !-- as .FALSE. |
---|
[1783] | 770 | CALL netcdf_define_header( 'yz', netcdf_extend, av ) |
---|
[1] | 771 | |
---|
| 772 | ! |
---|
| 773 | !-- Remove the local file, if it can not be extended |
---|
| 774 | IF ( .NOT. netcdf_extend ) THEN |
---|
| 775 | nc_stat = NF90_CLOSE( id_set_yz(av) ) |
---|
[1783] | 776 | CALL netcdf_handle_error( 'check_open', 27 ) |
---|
[493] | 777 | IF ( myid == 0 ) CALL local_system( 'rm ' // TRIM( filename ) ) |
---|
[1804] | 778 | #if defined( __parallel ) |
---|
[1745] | 779 | ! |
---|
| 780 | !-- Set a barrier in order to assure that PE0 deleted the old file |
---|
| 781 | !-- before any other processor tries to open a new file |
---|
[1974] | 782 | !-- Barrier is only needed in case of parallel I/O |
---|
| 783 | IF ( netcdf_data_format > 4 ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
[1745] | 784 | #endif |
---|
[1] | 785 | ENDIF |
---|
| 786 | |
---|
[1745] | 787 | ENDIF |
---|
[1] | 788 | |
---|
| 789 | IF ( .NOT. netcdf_extend ) THEN |
---|
| 790 | ! |
---|
[1031] | 791 | !-- Create a new netCDF output file with requested netCDF format |
---|
[1783] | 792 | CALL netcdf_create_file( filename, id_set_yz(av), .TRUE., 28 ) |
---|
[493] | 793 | |
---|
| 794 | ! |
---|
[1] | 795 | !-- Define the header |
---|
[1783] | 796 | CALL netcdf_define_header( 'yz', netcdf_extend, av ) |
---|
[1] | 797 | |
---|
[493] | 798 | ! |
---|
[1031] | 799 | !-- In case of parallel netCDF output, create flag file which tells |
---|
[493] | 800 | !-- combine_plot_fields that nothing is to do. |
---|
[1031] | 801 | IF ( myid == 0 .AND. netcdf_data_format > 4 ) THEN |
---|
[493] | 802 | OPEN( 99, FILE='NO_COMBINE_PLOT_FIELDS_YZ' ) |
---|
| 803 | WRITE ( 99, '(A)' ) 'no combine_plot_fields.x neccessary' |
---|
| 804 | CLOSE( 99 ) |
---|
| 805 | ENDIF |
---|
| 806 | |
---|
[1] | 807 | ENDIF |
---|
| 808 | |
---|
| 809 | CASE ( 104 ) |
---|
| 810 | ! |
---|
[102] | 811 | !-- Set filename |
---|
[1779] | 812 | filename = 'DATA_1D_PR_NETCDF' // TRIM( coupling_char ) |
---|
[102] | 813 | |
---|
| 814 | ! |
---|
[1031] | 815 | !-- Inquire, if there is a netCDF file from a previuos run. This should |
---|
[1] | 816 | !-- be opened for extension, if its variables match the actual run. |
---|
[102] | 817 | INQUIRE( FILE=filename, EXIST=netcdf_extend ) |
---|
[1] | 818 | |
---|
| 819 | IF ( netcdf_extend ) THEN |
---|
| 820 | ! |
---|
[1031] | 821 | !-- Open an existing netCDF file for output |
---|
[1783] | 822 | CALL netcdf_open_write_file( filename, id_set_pr, .FALSE., 29 ) |
---|
[1] | 823 | ! |
---|
| 824 | !-- Read header information and set all ids. If there is a mismatch |
---|
| 825 | !-- between the previuos and the actual run, netcdf_extend is returned |
---|
| 826 | !-- as .FALSE. |
---|
[1783] | 827 | CALL netcdf_define_header( 'pr', netcdf_extend, 0 ) |
---|
[1] | 828 | |
---|
| 829 | ! |
---|
| 830 | !-- Remove the local file, if it can not be extended |
---|
| 831 | IF ( .NOT. netcdf_extend ) THEN |
---|
| 832 | nc_stat = NF90_CLOSE( id_set_pr ) |
---|
[1783] | 833 | CALL netcdf_handle_error( 'check_open', 30 ) |
---|
[102] | 834 | CALL local_system( 'rm ' // TRIM( filename ) ) |
---|
[1] | 835 | ENDIF |
---|
| 836 | |
---|
| 837 | ENDIF |
---|
| 838 | |
---|
| 839 | IF ( .NOT. netcdf_extend ) THEN |
---|
| 840 | ! |
---|
[1031] | 841 | !-- Create a new netCDF output file with requested netCDF format |
---|
[1783] | 842 | CALL netcdf_create_file( filename, id_set_pr, .FALSE., 31 ) |
---|
[1] | 843 | ! |
---|
| 844 | !-- Define the header |
---|
[1783] | 845 | CALL netcdf_define_header( 'pr', netcdf_extend, 0 ) |
---|
[1] | 846 | |
---|
| 847 | ENDIF |
---|
| 848 | |
---|
| 849 | CASE ( 105 ) |
---|
| 850 | ! |
---|
[102] | 851 | !-- Set filename |
---|
[1779] | 852 | filename = 'DATA_1D_TS_NETCDF' // TRIM( coupling_char ) |
---|
[102] | 853 | |
---|
| 854 | ! |
---|
[1031] | 855 | !-- Inquire, if there is a netCDF file from a previuos run. This should |
---|
[1] | 856 | !-- be opened for extension, if its variables match the actual run. |
---|
[102] | 857 | INQUIRE( FILE=filename, EXIST=netcdf_extend ) |
---|
[1] | 858 | |
---|
| 859 | IF ( netcdf_extend ) THEN |
---|
| 860 | ! |
---|
[1031] | 861 | !-- Open an existing netCDF file for output |
---|
[1783] | 862 | CALL netcdf_open_write_file( filename, id_set_ts, .FALSE., 32 ) |
---|
[1] | 863 | ! |
---|
| 864 | !-- Read header information and set all ids. If there is a mismatch |
---|
| 865 | !-- between the previuos and the actual run, netcdf_extend is returned |
---|
| 866 | !-- as .FALSE. |
---|
[1783] | 867 | CALL netcdf_define_header( 'ts', netcdf_extend, 0 ) |
---|
[1] | 868 | |
---|
| 869 | ! |
---|
| 870 | !-- Remove the local file, if it can not be extended |
---|
| 871 | IF ( .NOT. netcdf_extend ) THEN |
---|
| 872 | nc_stat = NF90_CLOSE( id_set_ts ) |
---|
[1783] | 873 | CALL netcdf_handle_error( 'check_open', 33 ) |
---|
[102] | 874 | CALL local_system( 'rm ' // TRIM( filename ) ) |
---|
[1] | 875 | ENDIF |
---|
| 876 | |
---|
| 877 | ENDIF |
---|
| 878 | |
---|
| 879 | IF ( .NOT. netcdf_extend ) THEN |
---|
| 880 | ! |
---|
[1031] | 881 | !-- Create a new netCDF output file with requested netCDF format |
---|
[1783] | 882 | CALL netcdf_create_file( filename, id_set_ts, .FALSE., 34 ) |
---|
[1] | 883 | ! |
---|
| 884 | !-- Define the header |
---|
[1783] | 885 | CALL netcdf_define_header( 'ts', netcdf_extend, 0 ) |
---|
[1] | 886 | |
---|
| 887 | ENDIF |
---|
| 888 | |
---|
| 889 | |
---|
| 890 | CASE ( 106, 116 ) |
---|
| 891 | ! |
---|
| 892 | !-- Set filename depending on unit number |
---|
| 893 | IF ( file_id == 106 ) THEN |
---|
[1779] | 894 | filename = 'DATA_3D_NETCDF' // TRIM( coupling_char ) |
---|
[1] | 895 | av = 0 |
---|
| 896 | ELSE |
---|
[1779] | 897 | filename = 'DATA_3D_AV_NETCDF' // TRIM( coupling_char ) |
---|
[1] | 898 | av = 1 |
---|
| 899 | ENDIF |
---|
| 900 | ! |
---|
[1031] | 901 | !-- Inquire, if there is a netCDF file from a previous run. This should |
---|
[1] | 902 | !-- be opened for extension, if its dimensions and variables match the |
---|
| 903 | !-- actual run. |
---|
| 904 | INQUIRE( FILE=filename, EXIST=netcdf_extend ) |
---|
| 905 | |
---|
| 906 | IF ( netcdf_extend ) THEN |
---|
| 907 | ! |
---|
[1031] | 908 | !-- Open an existing netCDF file for output |
---|
[1783] | 909 | CALL netcdf_open_write_file( filename, id_set_3d(av), .TRUE., 35 ) |
---|
[1] | 910 | ! |
---|
| 911 | !-- Read header information and set all ids. If there is a mismatch |
---|
| 912 | !-- between the previuos and the actual run, netcdf_extend is returned |
---|
| 913 | !-- as .FALSE. |
---|
[1783] | 914 | CALL netcdf_define_header( '3d', netcdf_extend, av ) |
---|
[1] | 915 | |
---|
| 916 | ! |
---|
| 917 | !-- Remove the local file, if it can not be extended |
---|
| 918 | IF ( .NOT. netcdf_extend ) THEN |
---|
| 919 | nc_stat = NF90_CLOSE( id_set_3d(av) ) |
---|
[1783] | 920 | CALL netcdf_handle_error( 'check_open', 36 ) |
---|
[1745] | 921 | IF ( myid == 0 ) CALL local_system( 'rm ' // TRIM( filename ) ) |
---|
[1804] | 922 | #if defined( __parallel ) |
---|
[1745] | 923 | ! |
---|
| 924 | !-- Set a barrier in order to assure that PE0 deleted the old file |
---|
| 925 | !-- before any other processor tries to open a new file |
---|
[1974] | 926 | !-- Barrier is only needed in case of parallel I/O |
---|
| 927 | IF ( netcdf_data_format > 4 ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
[1745] | 928 | #endif |
---|
[1] | 929 | ENDIF |
---|
| 930 | |
---|
[1745] | 931 | ENDIF |
---|
[1] | 932 | |
---|
| 933 | IF ( .NOT. netcdf_extend ) THEN |
---|
| 934 | ! |
---|
[1031] | 935 | !-- Create a new netCDF output file with requested netCDF format |
---|
[1783] | 936 | CALL netcdf_create_file( filename, id_set_3d(av), .TRUE., 37 ) |
---|
[493] | 937 | |
---|
| 938 | ! |
---|
[1] | 939 | !-- Define the header |
---|
[1783] | 940 | CALL netcdf_define_header( '3d', netcdf_extend, av ) |
---|
[1] | 941 | |
---|
[493] | 942 | ! |
---|
[1031] | 943 | !-- In case of parallel netCDF output, create flag file which tells |
---|
[493] | 944 | !-- combine_plot_fields that nothing is to do. |
---|
[1031] | 945 | IF ( myid == 0 .AND. netcdf_data_format > 4 ) THEN |
---|
[493] | 946 | OPEN( 99, FILE='NO_COMBINE_PLOT_FIELDS_3D' ) |
---|
| 947 | WRITE ( 99, '(A)' ) 'no combine_plot_fields.x neccessary' |
---|
| 948 | CLOSE( 99 ) |
---|
| 949 | ENDIF |
---|
| 950 | |
---|
[1] | 951 | ENDIF |
---|
| 952 | |
---|
| 953 | |
---|
| 954 | CASE ( 107 ) |
---|
| 955 | ! |
---|
[102] | 956 | !-- Set filename |
---|
[1779] | 957 | filename = 'DATA_1D_SP_NETCDF' // TRIM( coupling_char ) |
---|
[102] | 958 | |
---|
| 959 | ! |
---|
[1031] | 960 | !-- Inquire, if there is a netCDF file from a previuos run. This should |
---|
[1] | 961 | !-- be opened for extension, if its variables match the actual run. |
---|
[102] | 962 | INQUIRE( FILE=filename, EXIST=netcdf_extend ) |
---|
[1] | 963 | |
---|
| 964 | IF ( netcdf_extend ) THEN |
---|
| 965 | ! |
---|
[1031] | 966 | !-- Open an existing netCDF file for output |
---|
[1783] | 967 | CALL netcdf_open_write_file( filename, id_set_sp, .FALSE., 38 ) |
---|
[263] | 968 | |
---|
[1] | 969 | ! |
---|
| 970 | !-- Read header information and set all ids. If there is a mismatch |
---|
| 971 | !-- between the previuos and the actual run, netcdf_extend is returned |
---|
| 972 | !-- as .FALSE. |
---|
[1783] | 973 | CALL netcdf_define_header( 'sp', netcdf_extend, 0 ) |
---|
[1] | 974 | |
---|
| 975 | ! |
---|
| 976 | !-- Remove the local file, if it can not be extended |
---|
| 977 | IF ( .NOT. netcdf_extend ) THEN |
---|
| 978 | nc_stat = NF90_CLOSE( id_set_sp ) |
---|
[1783] | 979 | CALL netcdf_handle_error( 'check_open', 39 ) |
---|
[102] | 980 | CALL local_system( 'rm ' // TRIM( filename ) ) |
---|
[1] | 981 | ENDIF |
---|
| 982 | |
---|
| 983 | ENDIF |
---|
| 984 | |
---|
| 985 | IF ( .NOT. netcdf_extend ) THEN |
---|
| 986 | ! |
---|
[1031] | 987 | !-- Create a new netCDF output file with requested netCDF format |
---|
[1783] | 988 | CALL netcdf_create_file( filename, id_set_sp, .FALSE., 40 ) |
---|
[1] | 989 | ! |
---|
| 990 | !-- Define the header |
---|
[1783] | 991 | CALL netcdf_define_header( 'sp', netcdf_extend, 0 ) |
---|
[1] | 992 | |
---|
| 993 | ENDIF |
---|
| 994 | |
---|
| 995 | |
---|
| 996 | CASE ( 108 ) |
---|
| 997 | |
---|
| 998 | IF ( myid_char == '' ) THEN |
---|
[1779] | 999 | filename = 'DATA_PRT_NETCDF' // TRIM( coupling_char ) |
---|
[1] | 1000 | ELSE |
---|
[1320] | 1001 | filename = 'DATA_PRT_NETCDF' // TRIM( coupling_char ) // '/' // & |
---|
[105] | 1002 | myid_char |
---|
[1] | 1003 | ENDIF |
---|
| 1004 | ! |
---|
[1031] | 1005 | !-- Inquire, if there is a netCDF file from a previuos run. This should |
---|
[1] | 1006 | !-- be opened for extension, if its variables match the actual run. |
---|
| 1007 | INQUIRE( FILE=filename, EXIST=netcdf_extend ) |
---|
| 1008 | |
---|
| 1009 | IF ( netcdf_extend ) THEN |
---|
| 1010 | ! |
---|
[1031] | 1011 | !-- Open an existing netCDF file for output |
---|
[1783] | 1012 | CALL netcdf_open_write_file( filename, id_set_prt, .FALSE., 41 ) |
---|
[1] | 1013 | ! |
---|
| 1014 | !-- Read header information and set all ids. If there is a mismatch |
---|
| 1015 | !-- between the previuos and the actual run, netcdf_extend is returned |
---|
| 1016 | !-- as .FALSE. |
---|
[1783] | 1017 | CALL netcdf_define_header( 'pt', netcdf_extend, 0 ) |
---|
[1] | 1018 | |
---|
| 1019 | ! |
---|
| 1020 | !-- Remove the local file, if it can not be extended |
---|
| 1021 | IF ( .NOT. netcdf_extend ) THEN |
---|
| 1022 | nc_stat = NF90_CLOSE( id_set_prt ) |
---|
[1783] | 1023 | CALL netcdf_handle_error( 'check_open', 42 ) |
---|
[1745] | 1024 | CALL local_system( 'rm ' // TRIM( filename ) ) |
---|
[1] | 1025 | ENDIF |
---|
| 1026 | |
---|
| 1027 | ENDIF |
---|
| 1028 | |
---|
| 1029 | IF ( .NOT. netcdf_extend ) THEN |
---|
| 1030 | |
---|
| 1031 | ! |
---|
| 1032 | !-- For runs on multiple processors create the subdirectory |
---|
| 1033 | IF ( myid_char /= '' ) THEN |
---|
[1320] | 1034 | IF ( myid == 0 .AND. .NOT. openfile(file_id)%opened_before ) & |
---|
[1] | 1035 | THEN ! needs modification in case of non-extendable sets |
---|
[1320] | 1036 | CALL local_system( 'mkdir DATA_PRT_NETCDF' // & |
---|
[105] | 1037 | TRIM( coupling_char ) // '/' ) |
---|
[1] | 1038 | ENDIF |
---|
[1804] | 1039 | #if defined( __parallel ) |
---|
[807] | 1040 | ! |
---|
[1] | 1041 | !-- Set a barrier in order to allow that all other processors in the |
---|
| 1042 | !-- directory created by PE0 can open their file |
---|
| 1043 | CALL MPI_BARRIER( comm2d, ierr ) |
---|
| 1044 | #endif |
---|
| 1045 | ENDIF |
---|
| 1046 | |
---|
| 1047 | ! |
---|
[1031] | 1048 | !-- Create a new netCDF output file with requested netCDF format |
---|
[1783] | 1049 | CALL netcdf_create_file( filename, id_set_prt, .FALSE., 43 ) |
---|
[519] | 1050 | |
---|
| 1051 | ! |
---|
[1] | 1052 | !-- Define the header |
---|
[1783] | 1053 | CALL netcdf_define_header( 'pt', netcdf_extend, 0 ) |
---|
[1] | 1054 | |
---|
| 1055 | ENDIF |
---|
| 1056 | |
---|
| 1057 | CASE ( 109 ) |
---|
| 1058 | ! |
---|
[102] | 1059 | !-- Set filename |
---|
[1779] | 1060 | filename = 'DATA_1D_PTS_NETCDF' // TRIM( coupling_char ) |
---|
[102] | 1061 | |
---|
| 1062 | ! |
---|
[1031] | 1063 | !-- Inquire, if there is a netCDF file from a previuos run. This should |
---|
[1] | 1064 | !-- be opened for extension, if its variables match the actual run. |
---|
[102] | 1065 | INQUIRE( FILE=filename, EXIST=netcdf_extend ) |
---|
[1] | 1066 | |
---|
| 1067 | IF ( netcdf_extend ) THEN |
---|
| 1068 | ! |
---|
[1031] | 1069 | !-- Open an existing netCDF file for output |
---|
[1783] | 1070 | CALL netcdf_open_write_file( filename, id_set_pts, .FALSE., 393 ) |
---|
[1] | 1071 | ! |
---|
| 1072 | !-- Read header information and set all ids. If there is a mismatch |
---|
| 1073 | !-- between the previuos and the actual run, netcdf_extend is returned |
---|
| 1074 | !-- as .FALSE. |
---|
[1783] | 1075 | CALL netcdf_define_header( 'ps', netcdf_extend, 0 ) |
---|
[1] | 1076 | |
---|
| 1077 | ! |
---|
| 1078 | !-- Remove the local file, if it can not be extended |
---|
| 1079 | IF ( .NOT. netcdf_extend ) THEN |
---|
| 1080 | nc_stat = NF90_CLOSE( id_set_pts ) |
---|
[1783] | 1081 | CALL netcdf_handle_error( 'check_open', 394 ) |
---|
[102] | 1082 | CALL local_system( 'rm ' // TRIM( filename ) ) |
---|
[1] | 1083 | ENDIF |
---|
| 1084 | |
---|
| 1085 | ENDIF |
---|
| 1086 | |
---|
| 1087 | IF ( .NOT. netcdf_extend ) THEN |
---|
| 1088 | ! |
---|
[1031] | 1089 | !-- Create a new netCDF output file with requested netCDF format |
---|
[1783] | 1090 | CALL netcdf_create_file( filename, id_set_pts, .FALSE., 395 ) |
---|
[1] | 1091 | ! |
---|
| 1092 | !-- Define the header |
---|
[1783] | 1093 | CALL netcdf_define_header( 'ps', netcdf_extend, 0 ) |
---|
[1] | 1094 | |
---|
| 1095 | ENDIF |
---|
[410] | 1096 | |
---|
[1468] | 1097 | |
---|
| 1098 | ! |
---|
| 1099 | !-- Progress file that is used by the PALM watchdog |
---|
| 1100 | CASE ( 117 ) |
---|
| 1101 | |
---|
[1779] | 1102 | OPEN ( 117, FILE='PROGRESS'//TRIM( coupling_char ), & |
---|
| 1103 | STATUS='REPLACE', FORM='FORMATTED' ) |
---|
[1957] | 1104 | ! |
---|
| 1105 | !-- nc-file for virtual flight measurements |
---|
| 1106 | CASE ( 199 ) |
---|
| 1107 | ! |
---|
| 1108 | !-- Set filename |
---|
| 1109 | filename = 'DATA_1D_FL_NETCDF' // TRIM( coupling_char ) |
---|
[1468] | 1110 | |
---|
[1957] | 1111 | ! |
---|
| 1112 | !-- Inquire, if there is a netCDF file from a previuos run. This should |
---|
| 1113 | !-- be opened for extension, if its variables match the actual run. |
---|
| 1114 | INQUIRE( FILE=filename, EXIST=netcdf_extend ) |
---|
[1468] | 1115 | |
---|
[1957] | 1116 | IF ( netcdf_extend ) THEN |
---|
| 1117 | ! |
---|
| 1118 | !-- Open an existing netCDF file for output |
---|
| 1119 | CALL netcdf_open_write_file( filename, id_set_fl, .FALSE., 532 ) |
---|
| 1120 | ! |
---|
| 1121 | !-- Read header information and set all ids. If there is a mismatch |
---|
| 1122 | !-- between the previuos and the actual run, netcdf_extend is returned |
---|
| 1123 | !-- as .FALSE. |
---|
| 1124 | CALL netcdf_define_header( 'fl', netcdf_extend, 0 ) |
---|
| 1125 | |
---|
| 1126 | ! |
---|
| 1127 | !-- Remove the local file, if it can not be extended |
---|
| 1128 | IF ( .NOT. netcdf_extend ) THEN |
---|
| 1129 | nc_stat = NF90_CLOSE( id_set_fl ) |
---|
| 1130 | CALL netcdf_handle_error( 'check_open', 533 ) |
---|
| 1131 | CALL local_system( 'rm ' // TRIM( filename ) ) |
---|
| 1132 | ENDIF |
---|
| 1133 | |
---|
| 1134 | ENDIF |
---|
| 1135 | |
---|
| 1136 | IF ( .NOT. netcdf_extend ) THEN |
---|
| 1137 | ! |
---|
| 1138 | !-- Create a new netCDF output file with requested netCDF format |
---|
| 1139 | CALL netcdf_create_file( filename, id_set_fl, .FALSE., 534 ) |
---|
| 1140 | ! |
---|
| 1141 | !-- Define the header |
---|
| 1142 | CALL netcdf_define_header( 'fl', netcdf_extend, 0 ) |
---|
| 1143 | |
---|
| 1144 | ENDIF |
---|
| 1145 | |
---|
| 1146 | |
---|
[564] | 1147 | CASE ( 201:200+2*max_masks ) |
---|
[410] | 1148 | ! |
---|
| 1149 | !-- Set filename depending on unit number |
---|
[564] | 1150 | IF ( file_id <= 200+max_masks ) THEN |
---|
| 1151 | mid = file_id - 200 |
---|
[410] | 1152 | WRITE ( mask_char,'(I2.2)') mid |
---|
[1779] | 1153 | filename = 'DATA_MASK_' // mask_char // '_NETCDF' // & |
---|
| 1154 | TRIM( coupling_char ) |
---|
[410] | 1155 | av = 0 |
---|
| 1156 | ELSE |
---|
[564] | 1157 | mid = file_id - (200+max_masks) |
---|
[410] | 1158 | WRITE ( mask_char,'(I2.2)') mid |
---|
[1320] | 1159 | filename = 'DATA_MASK_' // mask_char // '_AV_NETCDF' // & |
---|
[1779] | 1160 | TRIM( coupling_char ) |
---|
[410] | 1161 | av = 1 |
---|
| 1162 | ENDIF |
---|
| 1163 | ! |
---|
[1031] | 1164 | !-- Inquire, if there is a netCDF file from a previuos run. This should |
---|
[410] | 1165 | !-- be opened for extension, if its dimensions and variables match the |
---|
| 1166 | !-- actual run. |
---|
| 1167 | INQUIRE( FILE=filename, EXIST=netcdf_extend ) |
---|
| 1168 | |
---|
| 1169 | IF ( netcdf_extend ) THEN |
---|
| 1170 | ! |
---|
[1031] | 1171 | !-- Open an existing netCDF file for output |
---|
[1783] | 1172 | CALL netcdf_open_write_file( filename, id_set_mask(mid,av), & |
---|
[1031] | 1173 | .TRUE., 456 ) |
---|
[410] | 1174 | ! |
---|
| 1175 | !-- Read header information and set all ids. If there is a mismatch |
---|
| 1176 | !-- between the previuos and the actual run, netcdf_extend is returned |
---|
| 1177 | !-- as .FALSE. |
---|
[1783] | 1178 | CALL netcdf_define_header( 'ma', netcdf_extend, file_id ) |
---|
[1] | 1179 | |
---|
[410] | 1180 | ! |
---|
| 1181 | !-- Remove the local file, if it can not be extended |
---|
| 1182 | IF ( .NOT. netcdf_extend ) THEN |
---|
| 1183 | nc_stat = NF90_CLOSE( id_set_mask(mid,av) ) |
---|
[1783] | 1184 | CALL netcdf_handle_error( 'check_open', 457 ) |
---|
[410] | 1185 | CALL local_system('rm ' // TRIM( filename ) ) |
---|
| 1186 | ENDIF |
---|
[1] | 1187 | |
---|
[410] | 1188 | ENDIF |
---|
| 1189 | |
---|
| 1190 | IF ( .NOT. netcdf_extend ) THEN |
---|
[1] | 1191 | ! |
---|
[1031] | 1192 | !-- Create a new netCDF output file with requested netCDF format |
---|
[1783] | 1193 | CALL netcdf_create_file( filename, id_set_mask(mid,av), .TRUE., 458 ) |
---|
[493] | 1194 | ! |
---|
[410] | 1195 | !-- Define the header |
---|
[1783] | 1196 | CALL netcdf_define_header( 'ma', netcdf_extend, file_id ) |
---|
[410] | 1197 | |
---|
| 1198 | ENDIF |
---|
| 1199 | |
---|
| 1200 | |
---|
| 1201 | #else |
---|
| 1202 | |
---|
[564] | 1203 | CASE ( 101:109, 111:113, 116, 201:200+2*max_masks ) |
---|
[410] | 1204 | |
---|
| 1205 | ! |
---|
[1] | 1206 | !-- Nothing is done in case of missing netcdf support |
---|
| 1207 | RETURN |
---|
| 1208 | |
---|
| 1209 | #endif |
---|
| 1210 | |
---|
| 1211 | CASE DEFAULT |
---|
| 1212 | |
---|
[247] | 1213 | WRITE( message_string, * ) 'no OPEN-statement for file-id ',file_id |
---|
[277] | 1214 | CALL message( 'check_open', 'PA0172', 2, 2, -1, 6, 1 ) |
---|
[1] | 1215 | |
---|
| 1216 | END SELECT |
---|
| 1217 | |
---|
| 1218 | ! |
---|
| 1219 | !-- Set open flag |
---|
| 1220 | openfile(file_id)%opened = .TRUE. |
---|
| 1221 | |
---|
| 1222 | ! |
---|
| 1223 | !-- Formats |
---|
[1320] | 1224 | 3300 FORMAT ('#'/ & |
---|
| 1225 | 'coord 1 file=',A,' filetype=unformatted'/ & |
---|
| 1226 | 'coord 2 file=',A,' filetype=unformatted skip=',I6/ & |
---|
| 1227 | 'coord 3 file=',A,' filetype=unformatted skip=',I6/ & |
---|
[1] | 1228 | '#') |
---|
| 1229 | 4000 FORMAT ('# ',A) |
---|
[1320] | 1230 | 5000 FORMAT ('# ',A/ & |
---|
| 1231 | '#1 E'/'#2 E*'/'#3 dt'/'#4 u*'/'#5 th*'/'#6 umax'/'#7 vmax'/ & |
---|
| 1232 | '#8 wmax'/'#9 div_new'/'#10 div_old'/'#11 z_i_wpt'/'#12 z_i_pt'/ & |
---|
| 1233 | '#13 w*'/'#14 w''pt''0'/'#15 w''pt'''/'#16 wpt'/'#17 pt(0)'/ & |
---|
[1] | 1234 | '#18 pt(zp)'/'#19 splptx'/'#20 splpty'/'#21 splptz') |
---|
[1320] | 1235 | 8000 FORMAT (A/ & |
---|
[1359] | 1236 | ' step time # of parts lPE sent/recv rPE sent/recv ',& |
---|
| 1237 | 'sPE sent/recv nPE sent/recv max # of parts '/ & |
---|
| 1238 | 109('-')) |
---|
[1] | 1239 | |
---|
| 1240 | END SUBROUTINE check_open |
---|