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