[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 2298 2017-06-29 09:28:18Z raasch $ |
---|
[2298] | 27 | ! -return_addres, return_username, avs_coor_file_..., avs_data_file_..., |
---|
| 28 | ! cross_ts_numbers, cross_ts_number_count |
---|
[1321] | 29 | ! |
---|
[2298] | 30 | ! 2101 2017-01-05 16:42:31Z suehring |
---|
| 31 | ! |
---|
[2064] | 32 | ! 2063 2016-11-10 17:14:35Z raasch |
---|
| 33 | ! bugfix: opening of PROGRESS file moved out of the NetCDF block |
---|
| 34 | ! |
---|
[2041] | 35 | ! 2040 2016-10-26 16:58:09Z gronemeier |
---|
[2040] | 36 | ! Removed open of file 'PLOTTS_DATA' ( CASE(50:59) ) as it is no longer needed |
---|
| 37 | ! |
---|
[2001] | 38 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
| 39 | ! Forced header and separation lines into 80 columns |
---|
| 40 | ! |
---|
[1989] | 41 | ! 1988 2016-08-10 14:49:06Z gronemeier |
---|
| 42 | ! informative message added if files cannot be opened in newly created directory |
---|
| 43 | ! |
---|
[1987] | 44 | ! 1986 2016-08-10 14:07:17Z gronemeier |
---|
| 45 | ! Bugfix: check if output can be opened in newly created directory. If not |
---|
| 46 | ! wait one second and try again. |
---|
| 47 | ! |
---|
[1975] | 48 | ! 1974 2016-07-26 08:43:25Z gronemeier |
---|
| 49 | ! Bugfix: MPI barriers after deleting non-extendable files must only be called |
---|
| 50 | ! in case of parallel I/O |
---|
| 51 | ! |
---|
[1958] | 52 | ! 1957 2016-07-07 10:43:48Z suehring |
---|
| 53 | ! flight module added |
---|
| 54 | ! |
---|
[1805] | 55 | ! 1804 2016-04-05 16:30:18Z maronga |
---|
| 56 | ! Removed code for parameter file check (__check) |
---|
| 57 | ! |
---|
[1784] | 58 | ! 1783 2016-03-06 18:36:17Z raasch |
---|
| 59 | ! name change of netcdf routines and module + related changes |
---|
| 60 | ! |
---|
[1780] | 61 | ! 1779 2016-03-03 08:01:28Z raasch |
---|
| 62 | ! coupling_char is trimmed at every place it occurs, because it can have |
---|
| 63 | ! different length now |
---|
| 64 | ! |
---|
[1746] | 65 | ! 1745 2016-02-05 13:06:51Z gronemeier |
---|
| 66 | ! Bugfix: added MPI barrier after deleting existing non-extendable file by PE0 |
---|
| 67 | ! |
---|
[1683] | 68 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
| 69 | ! Code annotations made doxygen readable |
---|
| 70 | ! |
---|
[1552] | 71 | ! 1551 2015-03-03 14:18:16Z maronga |
---|
| 72 | ! Removed redundant output for combine_plot_fields |
---|
| 73 | ! |
---|
[1469] | 74 | ! 1468 2014-09-24 14:06:57Z maronga |
---|
| 75 | ! Adapted for use on up to 6-digit processor cores |
---|
| 76 | ! Added file unit 117 (PROGRESS) |
---|
| 77 | ! |
---|
[1360] | 78 | ! 1359 2014-04-11 17:15:14Z hoffmann |
---|
| 79 | ! Format of particle exchange statistics extended to reasonable numbers of |
---|
| 80 | ! particles. |
---|
| 81 | ! |
---|
[1354] | 82 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
| 83 | ! REAL constants provided with KIND-attribute, |
---|
| 84 | ! declaration for unused variables xkoor, ykoor, zkoor removed |
---|
| 85 | ! |
---|
[1329] | 86 | ! 1327 2014-03-21 11:00:16Z raasch |
---|
| 87 | ! parts concerning iso2d and avs output removed |
---|
| 88 | ! |
---|
[1321] | 89 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 90 | ! ONLY-attribute added to USE-statements, |
---|
| 91 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 92 | ! kinds are defined in new module kinds, |
---|
| 93 | ! old module precision_kind is removed, |
---|
| 94 | ! revision history before 2012 removed, |
---|
| 95 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 96 | ! all variable declaration statements |
---|
[1] | 97 | ! |
---|
[1107] | 98 | ! 1106 2013-03-04 05:31:38Z raasch |
---|
| 99 | ! array_kind renamed precision_kind |
---|
| 100 | ! |
---|
[1093] | 101 | ! 1092 2013-02-02 11:24:22Z raasch |
---|
| 102 | ! unused variables removed |
---|
| 103 | ! |
---|
[1037] | 104 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 105 | ! code put under GPL (PALM 3.9) |
---|
| 106 | ! |
---|
[1035] | 107 | ! 1031 2012-10-19 14:35:30Z raasch |
---|
| 108 | ! netCDF4 without parallel file support implemented, |
---|
| 109 | ! opening of netCDF files are done by new routines create_netcdf_file and |
---|
| 110 | ! open_write_netcdf_file |
---|
| 111 | ! |
---|
[965] | 112 | ! 964 2012-07-26 09:14:24Z raasch |
---|
| 113 | ! old profil-units (40:49) removed, |
---|
| 114 | ! append feature removed from unit 14 |
---|
| 115 | ! |
---|
[850] | 116 | ! 849 2012-03-15 10:35:09Z raasch |
---|
| 117 | ! comment changed |
---|
| 118 | ! |
---|
[810] | 119 | ! 809 2012-01-30 13:32:58Z maronga |
---|
| 120 | ! Bugfix: replaced .AND. and .NOT. with && and ! in the preprocessor directives |
---|
| 121 | ! |
---|
[808] | 122 | ! 807 2012-01-25 11:53:51Z maronga |
---|
| 123 | ! New cpp directive "__check" implemented which is used by check_namelist_files |
---|
| 124 | ! |
---|
[1] | 125 | ! Revision 1.1 1997/08/11 06:10:55 raasch |
---|
| 126 | ! Initial revision |
---|
| 127 | ! |
---|
| 128 | ! |
---|
| 129 | ! Description: |
---|
| 130 | ! ------------ |
---|
[1682] | 131 | !> Check if file unit is open. If not, open file and, if necessary, write a |
---|
| 132 | !> header or start other initializing actions, respectively. |
---|
[1] | 133 | !------------------------------------------------------------------------------! |
---|
[1682] | 134 | SUBROUTINE check_open( file_id ) |
---|
| 135 | |
---|
[1] | 136 | |
---|
[1320] | 137 | USE arrays_3d, & |
---|
| 138 | ONLY: zu |
---|
| 139 | |
---|
| 140 | USE control_parameters, & |
---|
[2298] | 141 | ONLY: coupling_char, data_output_2d_on_each_pe, host, max_masks, & |
---|
| 142 | message_string, mid, nz_do3d, openfile, run_description_header, & |
---|
| 143 | runnr |
---|
[1320] | 144 | |
---|
| 145 | USE grid_variables, & |
---|
| 146 | ONLY: dx, dy |
---|
| 147 | |
---|
| 148 | USE indices, & |
---|
[1551] | 149 | ONLY: nbgp, nx, nxl, nxr, ny, nyn, nyng, nys, nysg, nz, nzb, nzt |
---|
[1320] | 150 | |
---|
| 151 | USE kinds |
---|
| 152 | |
---|
[1783] | 153 | #if defined( __netcdf ) |
---|
| 154 | USE NETCDF |
---|
| 155 | #endif |
---|
[1320] | 156 | |
---|
[1783] | 157 | USE netcdf_interface, & |
---|
[1957] | 158 | ONLY: id_set_fl, id_set_mask, id_set_pr, id_set_prt, id_set_pts, & |
---|
| 159 | id_set_sp, id_set_ts, id_set_xy, id_set_xz, id_set_yz, & |
---|
| 160 | id_set_3d, nc_stat, netcdf_create_file, netcdf_data_format, & |
---|
| 161 | netcdf_define_header, netcdf_handle_error, netcdf_open_write_file |
---|
[1783] | 162 | |
---|
[1320] | 163 | USE particle_attributes, & |
---|
| 164 | ONLY: max_number_of_particle_groups, number_of_particle_groups, & |
---|
| 165 | particle_groups |
---|
| 166 | |
---|
[1] | 167 | USE pegrid |
---|
| 168 | |
---|
[1986] | 169 | USE posix_calls_from_fortran, & |
---|
| 170 | ONLY: fortran_sleep |
---|
| 171 | |
---|
[1320] | 172 | |
---|
[1] | 173 | IMPLICIT NONE |
---|
| 174 | |
---|
[1682] | 175 | CHARACTER (LEN=2) :: mask_char !< |
---|
| 176 | CHARACTER (LEN=2) :: suffix !< |
---|
| 177 | CHARACTER (LEN=20) :: xtext = 'time in s' !< |
---|
| 178 | CHARACTER (LEN=30) :: filename !< |
---|
| 179 | CHARACTER (LEN=80) :: rtext !< |
---|
| 180 | CHARACTER (LEN=100) :: batch_scp !< |
---|
| 181 | CHARACTER (LEN=100) :: line !< |
---|
| 182 | CHARACTER (LEN=400) :: command !< |
---|
[1] | 183 | |
---|
[1682] | 184 | INTEGER(iwp) :: av !< |
---|
| 185 | INTEGER(iwp) :: numline = 1 !< |
---|
| 186 | INTEGER(iwp) :: cranz !< |
---|
| 187 | INTEGER(iwp) :: file_id !< |
---|
| 188 | INTEGER(iwp) :: i !< |
---|
| 189 | INTEGER(iwp) :: iaddres !< |
---|
[1986] | 190 | INTEGER(iwp) :: ioerr !< IOSTAT flag for IO-commands ( 0 = no error ) |
---|
[1682] | 191 | INTEGER(iwp) :: iusern !< |
---|
| 192 | INTEGER(iwp) :: j !< |
---|
| 193 | INTEGER(iwp) :: k !< |
---|
| 194 | INTEGER(iwp) :: legpos = 1 !< |
---|
| 195 | INTEGER(iwp) :: timodex = 1 !< |
---|
[1320] | 196 | |
---|
[1682] | 197 | INTEGER(iwp), DIMENSION(10) :: klist !< |
---|
[1] | 198 | |
---|
[1682] | 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 | |
---|
[2063] | 620 | ! |
---|
| 621 | !-- Progress file that is used by the PALM watchdog |
---|
| 622 | CASE ( 117 ) |
---|
| 623 | |
---|
| 624 | OPEN ( 117, FILE='PROGRESS'//TRIM( coupling_char ), & |
---|
| 625 | STATUS='REPLACE', FORM='FORMATTED' ) |
---|
| 626 | |
---|
[1] | 627 | #if defined( __netcdf ) |
---|
| 628 | CASE ( 101, 111 ) |
---|
| 629 | ! |
---|
| 630 | !-- Set filename depending on unit number |
---|
| 631 | IF ( file_id == 101 ) THEN |
---|
[1779] | 632 | filename = 'DATA_2D_XY_NETCDF' // TRIM( coupling_char ) |
---|
[1] | 633 | av = 0 |
---|
| 634 | ELSE |
---|
[1779] | 635 | filename = 'DATA_2D_XY_AV_NETCDF' // TRIM( coupling_char ) |
---|
[1] | 636 | av = 1 |
---|
| 637 | ENDIF |
---|
| 638 | ! |
---|
[1031] | 639 | !-- Inquire, if there is a netCDF file from a previuos run. This should |
---|
[1] | 640 | !-- be opened for extension, if its dimensions and variables match the |
---|
| 641 | !-- actual run. |
---|
| 642 | INQUIRE( FILE=filename, EXIST=netcdf_extend ) |
---|
| 643 | IF ( netcdf_extend ) THEN |
---|
| 644 | ! |
---|
[1031] | 645 | !-- Open an existing netCDF file for output |
---|
[1783] | 646 | CALL netcdf_open_write_file( filename, id_set_xy(av), .TRUE., 20 ) |
---|
[1] | 647 | ! |
---|
| 648 | !-- Read header information and set all ids. If there is a mismatch |
---|
| 649 | !-- between the previuos and the actual run, netcdf_extend is returned |
---|
| 650 | !-- as .FALSE. |
---|
[1783] | 651 | CALL netcdf_define_header( 'xy', netcdf_extend, av ) |
---|
[1] | 652 | |
---|
| 653 | ! |
---|
| 654 | !-- Remove the local file, if it can not be extended |
---|
| 655 | IF ( .NOT. netcdf_extend ) THEN |
---|
| 656 | nc_stat = NF90_CLOSE( id_set_xy(av) ) |
---|
[1783] | 657 | CALL netcdf_handle_error( 'check_open', 21 ) |
---|
[493] | 658 | IF ( myid == 0 ) CALL local_system( 'rm ' // TRIM( filename ) ) |
---|
[1804] | 659 | #if defined( __parallel ) |
---|
[1745] | 660 | ! |
---|
| 661 | !-- Set a barrier in order to assure that PE0 deleted the old file |
---|
[1974] | 662 | !-- before any other processor tries to open a new file. |
---|
| 663 | !-- Barrier is only needed in case of parallel I/O |
---|
| 664 | IF ( netcdf_data_format > 4 ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
[1745] | 665 | #endif |
---|
[1] | 666 | ENDIF |
---|
| 667 | |
---|
[1745] | 668 | ENDIF |
---|
[1] | 669 | |
---|
| 670 | IF ( .NOT. netcdf_extend ) THEN |
---|
| 671 | ! |
---|
[1031] | 672 | !-- Create a new netCDF output file with requested netCDF format |
---|
[1783] | 673 | CALL netcdf_create_file( filename, id_set_xy(av), .TRUE., 22 ) |
---|
[493] | 674 | |
---|
| 675 | ! |
---|
[1] | 676 | !-- Define the header |
---|
[1783] | 677 | CALL netcdf_define_header( 'xy', netcdf_extend, av ) |
---|
[1] | 678 | |
---|
[493] | 679 | ! |
---|
[1031] | 680 | !-- In case of parallel netCDF output, create flag file which tells |
---|
[493] | 681 | !-- combine_plot_fields that nothing is to do. |
---|
[1031] | 682 | IF ( myid == 0 .AND. netcdf_data_format > 4 ) THEN |
---|
[493] | 683 | OPEN( 99, FILE='NO_COMBINE_PLOT_FIELDS_XY' ) |
---|
| 684 | WRITE ( 99, '(A)' ) 'no combine_plot_fields.x neccessary' |
---|
| 685 | CLOSE( 99 ) |
---|
| 686 | ENDIF |
---|
| 687 | |
---|
[1] | 688 | ENDIF |
---|
| 689 | |
---|
| 690 | CASE ( 102, 112 ) |
---|
| 691 | ! |
---|
| 692 | !-- Set filename depending on unit number |
---|
| 693 | IF ( file_id == 102 ) THEN |
---|
[1779] | 694 | filename = 'DATA_2D_XZ_NETCDF' // TRIM( coupling_char ) |
---|
[1] | 695 | av = 0 |
---|
| 696 | ELSE |
---|
[1779] | 697 | filename = 'DATA_2D_XZ_AV_NETCDF' // TRIM( coupling_char ) |
---|
[1] | 698 | av = 1 |
---|
| 699 | ENDIF |
---|
| 700 | ! |
---|
[1031] | 701 | !-- Inquire, if there is a netCDF file from a previuos run. This should |
---|
[1] | 702 | !-- be opened for extension, if its dimensions and variables match the |
---|
| 703 | !-- actual run. |
---|
| 704 | INQUIRE( FILE=filename, EXIST=netcdf_extend ) |
---|
| 705 | |
---|
| 706 | IF ( netcdf_extend ) THEN |
---|
| 707 | ! |
---|
[1031] | 708 | !-- Open an existing netCDF file for output |
---|
[1783] | 709 | CALL netcdf_open_write_file( filename, id_set_xz(av), .TRUE., 23 ) |
---|
[1] | 710 | ! |
---|
| 711 | !-- Read header information and set all ids. If there is a mismatch |
---|
| 712 | !-- between the previuos and the actual run, netcdf_extend is returned |
---|
| 713 | !-- as .FALSE. |
---|
[1783] | 714 | CALL netcdf_define_header( 'xz', netcdf_extend, av ) |
---|
[1] | 715 | |
---|
| 716 | ! |
---|
| 717 | !-- Remove the local file, if it can not be extended |
---|
| 718 | IF ( .NOT. netcdf_extend ) THEN |
---|
| 719 | nc_stat = NF90_CLOSE( id_set_xz(av) ) |
---|
[1783] | 720 | CALL netcdf_handle_error( 'check_open', 24 ) |
---|
[493] | 721 | IF ( myid == 0 ) CALL local_system( 'rm ' // TRIM( filename ) ) |
---|
[1804] | 722 | #if defined( __parallel ) |
---|
[1745] | 723 | ! |
---|
| 724 | !-- Set a barrier in order to assure that PE0 deleted the old file |
---|
| 725 | !-- before any other processor tries to open a new file |
---|
[1974] | 726 | !-- Barrier is only needed in case of parallel I/O |
---|
| 727 | IF ( netcdf_data_format > 4 ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
[1745] | 728 | #endif |
---|
[1] | 729 | ENDIF |
---|
| 730 | |
---|
[1745] | 731 | ENDIF |
---|
[1] | 732 | |
---|
| 733 | IF ( .NOT. netcdf_extend ) THEN |
---|
| 734 | ! |
---|
[1031] | 735 | !-- Create a new netCDF output file with requested netCDF format |
---|
[1783] | 736 | CALL netcdf_create_file( filename, id_set_xz(av), .TRUE., 25 ) |
---|
[493] | 737 | |
---|
| 738 | ! |
---|
[1] | 739 | !-- Define the header |
---|
[1783] | 740 | CALL netcdf_define_header( 'xz', netcdf_extend, av ) |
---|
[1] | 741 | |
---|
[493] | 742 | ! |
---|
[1031] | 743 | !-- In case of parallel netCDF output, create flag file which tells |
---|
[493] | 744 | !-- combine_plot_fields that nothing is to do. |
---|
[1031] | 745 | IF ( myid == 0 .AND. netcdf_data_format > 4 ) THEN |
---|
[493] | 746 | OPEN( 99, FILE='NO_COMBINE_PLOT_FIELDS_XZ' ) |
---|
| 747 | WRITE ( 99, '(A)' ) 'no combine_plot_fields.x neccessary' |
---|
| 748 | CLOSE( 99 ) |
---|
| 749 | ENDIF |
---|
| 750 | |
---|
[1] | 751 | ENDIF |
---|
| 752 | |
---|
| 753 | CASE ( 103, 113 ) |
---|
| 754 | ! |
---|
| 755 | !-- Set filename depending on unit number |
---|
| 756 | IF ( file_id == 103 ) THEN |
---|
[1779] | 757 | filename = 'DATA_2D_YZ_NETCDF' // TRIM( coupling_char ) |
---|
[1] | 758 | av = 0 |
---|
| 759 | ELSE |
---|
[1779] | 760 | filename = 'DATA_2D_YZ_AV_NETCDF' // TRIM( coupling_char ) |
---|
[1] | 761 | av = 1 |
---|
| 762 | ENDIF |
---|
| 763 | ! |
---|
[1031] | 764 | !-- Inquire, if there is a netCDF file from a previuos run. This should |
---|
[1] | 765 | !-- be opened for extension, if its dimensions and variables match the |
---|
| 766 | !-- actual run. |
---|
| 767 | INQUIRE( FILE=filename, EXIST=netcdf_extend ) |
---|
| 768 | |
---|
| 769 | IF ( netcdf_extend ) THEN |
---|
| 770 | ! |
---|
[1031] | 771 | !-- Open an existing netCDF file for output |
---|
[1783] | 772 | CALL netcdf_open_write_file( filename, id_set_yz(av), .TRUE., 26 ) |
---|
[1] | 773 | ! |
---|
| 774 | !-- Read header information and set all ids. If there is a mismatch |
---|
| 775 | !-- between the previuos and the actual run, netcdf_extend is returned |
---|
| 776 | !-- as .FALSE. |
---|
[1783] | 777 | CALL netcdf_define_header( 'yz', netcdf_extend, av ) |
---|
[1] | 778 | |
---|
| 779 | ! |
---|
| 780 | !-- Remove the local file, if it can not be extended |
---|
| 781 | IF ( .NOT. netcdf_extend ) THEN |
---|
| 782 | nc_stat = NF90_CLOSE( id_set_yz(av) ) |
---|
[1783] | 783 | CALL netcdf_handle_error( 'check_open', 27 ) |
---|
[493] | 784 | IF ( myid == 0 ) CALL local_system( 'rm ' // TRIM( filename ) ) |
---|
[1804] | 785 | #if defined( __parallel ) |
---|
[1745] | 786 | ! |
---|
| 787 | !-- Set a barrier in order to assure that PE0 deleted the old file |
---|
| 788 | !-- before any other processor tries to open a new file |
---|
[1974] | 789 | !-- Barrier is only needed in case of parallel I/O |
---|
| 790 | IF ( netcdf_data_format > 4 ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
[1745] | 791 | #endif |
---|
[1] | 792 | ENDIF |
---|
| 793 | |
---|
[1745] | 794 | ENDIF |
---|
[1] | 795 | |
---|
| 796 | IF ( .NOT. netcdf_extend ) THEN |
---|
| 797 | ! |
---|
[1031] | 798 | !-- Create a new netCDF output file with requested netCDF format |
---|
[1783] | 799 | CALL netcdf_create_file( filename, id_set_yz(av), .TRUE., 28 ) |
---|
[493] | 800 | |
---|
| 801 | ! |
---|
[1] | 802 | !-- Define the header |
---|
[1783] | 803 | CALL netcdf_define_header( 'yz', netcdf_extend, av ) |
---|
[1] | 804 | |
---|
[493] | 805 | ! |
---|
[1031] | 806 | !-- In case of parallel netCDF output, create flag file which tells |
---|
[493] | 807 | !-- combine_plot_fields that nothing is to do. |
---|
[1031] | 808 | IF ( myid == 0 .AND. netcdf_data_format > 4 ) THEN |
---|
[493] | 809 | OPEN( 99, FILE='NO_COMBINE_PLOT_FIELDS_YZ' ) |
---|
| 810 | WRITE ( 99, '(A)' ) 'no combine_plot_fields.x neccessary' |
---|
| 811 | CLOSE( 99 ) |
---|
| 812 | ENDIF |
---|
| 813 | |
---|
[1] | 814 | ENDIF |
---|
| 815 | |
---|
| 816 | CASE ( 104 ) |
---|
| 817 | ! |
---|
[102] | 818 | !-- Set filename |
---|
[1779] | 819 | filename = 'DATA_1D_PR_NETCDF' // TRIM( coupling_char ) |
---|
[102] | 820 | |
---|
| 821 | ! |
---|
[1031] | 822 | !-- Inquire, if there is a netCDF file from a previuos run. This should |
---|
[1] | 823 | !-- be opened for extension, if its variables match the actual run. |
---|
[102] | 824 | INQUIRE( FILE=filename, EXIST=netcdf_extend ) |
---|
[1] | 825 | |
---|
| 826 | IF ( netcdf_extend ) THEN |
---|
| 827 | ! |
---|
[1031] | 828 | !-- Open an existing netCDF file for output |
---|
[1783] | 829 | CALL netcdf_open_write_file( filename, id_set_pr, .FALSE., 29 ) |
---|
[1] | 830 | ! |
---|
| 831 | !-- Read header information and set all ids. If there is a mismatch |
---|
| 832 | !-- between the previuos and the actual run, netcdf_extend is returned |
---|
| 833 | !-- as .FALSE. |
---|
[1783] | 834 | CALL netcdf_define_header( 'pr', netcdf_extend, 0 ) |
---|
[1] | 835 | |
---|
| 836 | ! |
---|
| 837 | !-- Remove the local file, if it can not be extended |
---|
| 838 | IF ( .NOT. netcdf_extend ) THEN |
---|
| 839 | nc_stat = NF90_CLOSE( id_set_pr ) |
---|
[1783] | 840 | CALL netcdf_handle_error( 'check_open', 30 ) |
---|
[102] | 841 | CALL local_system( 'rm ' // TRIM( filename ) ) |
---|
[1] | 842 | ENDIF |
---|
| 843 | |
---|
| 844 | ENDIF |
---|
| 845 | |
---|
| 846 | IF ( .NOT. netcdf_extend ) THEN |
---|
| 847 | ! |
---|
[1031] | 848 | !-- Create a new netCDF output file with requested netCDF format |
---|
[1783] | 849 | CALL netcdf_create_file( filename, id_set_pr, .FALSE., 31 ) |
---|
[1] | 850 | ! |
---|
| 851 | !-- Define the header |
---|
[1783] | 852 | CALL netcdf_define_header( 'pr', netcdf_extend, 0 ) |
---|
[1] | 853 | |
---|
| 854 | ENDIF |
---|
| 855 | |
---|
| 856 | CASE ( 105 ) |
---|
| 857 | ! |
---|
[102] | 858 | !-- Set filename |
---|
[1779] | 859 | filename = 'DATA_1D_TS_NETCDF' // TRIM( coupling_char ) |
---|
[102] | 860 | |
---|
| 861 | ! |
---|
[1031] | 862 | !-- Inquire, if there is a netCDF file from a previuos run. This should |
---|
[1] | 863 | !-- be opened for extension, if its variables match the actual run. |
---|
[102] | 864 | INQUIRE( FILE=filename, EXIST=netcdf_extend ) |
---|
[1] | 865 | |
---|
| 866 | IF ( netcdf_extend ) THEN |
---|
| 867 | ! |
---|
[1031] | 868 | !-- Open an existing netCDF file for output |
---|
[1783] | 869 | CALL netcdf_open_write_file( filename, id_set_ts, .FALSE., 32 ) |
---|
[1] | 870 | ! |
---|
| 871 | !-- Read header information and set all ids. If there is a mismatch |
---|
| 872 | !-- between the previuos and the actual run, netcdf_extend is returned |
---|
| 873 | !-- as .FALSE. |
---|
[1783] | 874 | CALL netcdf_define_header( 'ts', netcdf_extend, 0 ) |
---|
[1] | 875 | |
---|
| 876 | ! |
---|
| 877 | !-- Remove the local file, if it can not be extended |
---|
| 878 | IF ( .NOT. netcdf_extend ) THEN |
---|
| 879 | nc_stat = NF90_CLOSE( id_set_ts ) |
---|
[1783] | 880 | CALL netcdf_handle_error( 'check_open', 33 ) |
---|
[102] | 881 | CALL local_system( 'rm ' // TRIM( filename ) ) |
---|
[1] | 882 | ENDIF |
---|
| 883 | |
---|
| 884 | ENDIF |
---|
| 885 | |
---|
| 886 | IF ( .NOT. netcdf_extend ) THEN |
---|
| 887 | ! |
---|
[1031] | 888 | !-- Create a new netCDF output file with requested netCDF format |
---|
[1783] | 889 | CALL netcdf_create_file( filename, id_set_ts, .FALSE., 34 ) |
---|
[1] | 890 | ! |
---|
| 891 | !-- Define the header |
---|
[1783] | 892 | CALL netcdf_define_header( 'ts', netcdf_extend, 0 ) |
---|
[1] | 893 | |
---|
| 894 | ENDIF |
---|
| 895 | |
---|
| 896 | |
---|
| 897 | CASE ( 106, 116 ) |
---|
| 898 | ! |
---|
| 899 | !-- Set filename depending on unit number |
---|
| 900 | IF ( file_id == 106 ) THEN |
---|
[1779] | 901 | filename = 'DATA_3D_NETCDF' // TRIM( coupling_char ) |
---|
[1] | 902 | av = 0 |
---|
| 903 | ELSE |
---|
[1779] | 904 | filename = 'DATA_3D_AV_NETCDF' // TRIM( coupling_char ) |
---|
[1] | 905 | av = 1 |
---|
| 906 | ENDIF |
---|
| 907 | ! |
---|
[1031] | 908 | !-- Inquire, if there is a netCDF file from a previous run. This should |
---|
[1] | 909 | !-- be opened for extension, if its dimensions and variables match the |
---|
| 910 | !-- actual run. |
---|
| 911 | INQUIRE( FILE=filename, EXIST=netcdf_extend ) |
---|
| 912 | |
---|
| 913 | IF ( netcdf_extend ) THEN |
---|
| 914 | ! |
---|
[1031] | 915 | !-- Open an existing netCDF file for output |
---|
[1783] | 916 | CALL netcdf_open_write_file( filename, id_set_3d(av), .TRUE., 35 ) |
---|
[1] | 917 | ! |
---|
| 918 | !-- Read header information and set all ids. If there is a mismatch |
---|
| 919 | !-- between the previuos and the actual run, netcdf_extend is returned |
---|
| 920 | !-- as .FALSE. |
---|
[1783] | 921 | CALL netcdf_define_header( '3d', netcdf_extend, av ) |
---|
[1] | 922 | |
---|
| 923 | ! |
---|
| 924 | !-- Remove the local file, if it can not be extended |
---|
| 925 | IF ( .NOT. netcdf_extend ) THEN |
---|
| 926 | nc_stat = NF90_CLOSE( id_set_3d(av) ) |
---|
[1783] | 927 | CALL netcdf_handle_error( 'check_open', 36 ) |
---|
[1745] | 928 | IF ( myid == 0 ) CALL local_system( 'rm ' // TRIM( filename ) ) |
---|
[1804] | 929 | #if defined( __parallel ) |
---|
[1745] | 930 | ! |
---|
| 931 | !-- Set a barrier in order to assure that PE0 deleted the old file |
---|
| 932 | !-- before any other processor tries to open a new file |
---|
[1974] | 933 | !-- Barrier is only needed in case of parallel I/O |
---|
| 934 | IF ( netcdf_data_format > 4 ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
[1745] | 935 | #endif |
---|
[1] | 936 | ENDIF |
---|
| 937 | |
---|
[1745] | 938 | ENDIF |
---|
[1] | 939 | |
---|
| 940 | IF ( .NOT. netcdf_extend ) THEN |
---|
| 941 | ! |
---|
[1031] | 942 | !-- Create a new netCDF output file with requested netCDF format |
---|
[1783] | 943 | CALL netcdf_create_file( filename, id_set_3d(av), .TRUE., 37 ) |
---|
[493] | 944 | |
---|
| 945 | ! |
---|
[1] | 946 | !-- Define the header |
---|
[1783] | 947 | CALL netcdf_define_header( '3d', netcdf_extend, av ) |
---|
[1] | 948 | |
---|
[493] | 949 | ! |
---|
[1031] | 950 | !-- In case of parallel netCDF output, create flag file which tells |
---|
[493] | 951 | !-- combine_plot_fields that nothing is to do. |
---|
[1031] | 952 | IF ( myid == 0 .AND. netcdf_data_format > 4 ) THEN |
---|
[493] | 953 | OPEN( 99, FILE='NO_COMBINE_PLOT_FIELDS_3D' ) |
---|
| 954 | WRITE ( 99, '(A)' ) 'no combine_plot_fields.x neccessary' |
---|
| 955 | CLOSE( 99 ) |
---|
| 956 | ENDIF |
---|
| 957 | |
---|
[1] | 958 | ENDIF |
---|
| 959 | |
---|
| 960 | |
---|
| 961 | CASE ( 107 ) |
---|
| 962 | ! |
---|
[102] | 963 | !-- Set filename |
---|
[1779] | 964 | filename = 'DATA_1D_SP_NETCDF' // TRIM( coupling_char ) |
---|
[102] | 965 | |
---|
| 966 | ! |
---|
[1031] | 967 | !-- Inquire, if there is a netCDF file from a previuos run. This should |
---|
[1] | 968 | !-- be opened for extension, if its variables match the actual run. |
---|
[102] | 969 | INQUIRE( FILE=filename, EXIST=netcdf_extend ) |
---|
[1] | 970 | |
---|
| 971 | IF ( netcdf_extend ) THEN |
---|
| 972 | ! |
---|
[1031] | 973 | !-- Open an existing netCDF file for output |
---|
[1783] | 974 | CALL netcdf_open_write_file( filename, id_set_sp, .FALSE., 38 ) |
---|
[263] | 975 | |
---|
[1] | 976 | ! |
---|
| 977 | !-- Read header information and set all ids. If there is a mismatch |
---|
| 978 | !-- between the previuos and the actual run, netcdf_extend is returned |
---|
| 979 | !-- as .FALSE. |
---|
[1783] | 980 | CALL netcdf_define_header( 'sp', netcdf_extend, 0 ) |
---|
[1] | 981 | |
---|
| 982 | ! |
---|
| 983 | !-- Remove the local file, if it can not be extended |
---|
| 984 | IF ( .NOT. netcdf_extend ) THEN |
---|
| 985 | nc_stat = NF90_CLOSE( id_set_sp ) |
---|
[1783] | 986 | CALL netcdf_handle_error( 'check_open', 39 ) |
---|
[102] | 987 | CALL local_system( 'rm ' // TRIM( filename ) ) |
---|
[1] | 988 | ENDIF |
---|
| 989 | |
---|
| 990 | ENDIF |
---|
| 991 | |
---|
| 992 | IF ( .NOT. netcdf_extend ) THEN |
---|
| 993 | ! |
---|
[1031] | 994 | !-- Create a new netCDF output file with requested netCDF format |
---|
[1783] | 995 | CALL netcdf_create_file( filename, id_set_sp, .FALSE., 40 ) |
---|
[1] | 996 | ! |
---|
| 997 | !-- Define the header |
---|
[1783] | 998 | CALL netcdf_define_header( 'sp', netcdf_extend, 0 ) |
---|
[1] | 999 | |
---|
| 1000 | ENDIF |
---|
| 1001 | |
---|
| 1002 | |
---|
| 1003 | CASE ( 108 ) |
---|
| 1004 | |
---|
| 1005 | IF ( myid_char == '' ) THEN |
---|
[1779] | 1006 | filename = 'DATA_PRT_NETCDF' // TRIM( coupling_char ) |
---|
[1] | 1007 | ELSE |
---|
[1320] | 1008 | filename = 'DATA_PRT_NETCDF' // TRIM( coupling_char ) // '/' // & |
---|
[105] | 1009 | myid_char |
---|
[1] | 1010 | ENDIF |
---|
| 1011 | ! |
---|
[1031] | 1012 | !-- Inquire, if there is a netCDF file from a previuos run. This should |
---|
[1] | 1013 | !-- be opened for extension, if its variables match the actual run. |
---|
| 1014 | INQUIRE( FILE=filename, EXIST=netcdf_extend ) |
---|
| 1015 | |
---|
| 1016 | IF ( netcdf_extend ) THEN |
---|
| 1017 | ! |
---|
[1031] | 1018 | !-- Open an existing netCDF file for output |
---|
[1783] | 1019 | CALL netcdf_open_write_file( filename, id_set_prt, .FALSE., 41 ) |
---|
[1] | 1020 | ! |
---|
| 1021 | !-- Read header information and set all ids. If there is a mismatch |
---|
| 1022 | !-- between the previuos and the actual run, netcdf_extend is returned |
---|
| 1023 | !-- as .FALSE. |
---|
[1783] | 1024 | CALL netcdf_define_header( 'pt', netcdf_extend, 0 ) |
---|
[1] | 1025 | |
---|
| 1026 | ! |
---|
| 1027 | !-- Remove the local file, if it can not be extended |
---|
| 1028 | IF ( .NOT. netcdf_extend ) THEN |
---|
| 1029 | nc_stat = NF90_CLOSE( id_set_prt ) |
---|
[1783] | 1030 | CALL netcdf_handle_error( 'check_open', 42 ) |
---|
[1745] | 1031 | CALL local_system( 'rm ' // TRIM( filename ) ) |
---|
[1] | 1032 | ENDIF |
---|
| 1033 | |
---|
| 1034 | ENDIF |
---|
| 1035 | |
---|
| 1036 | IF ( .NOT. netcdf_extend ) THEN |
---|
| 1037 | |
---|
| 1038 | ! |
---|
| 1039 | !-- For runs on multiple processors create the subdirectory |
---|
| 1040 | IF ( myid_char /= '' ) THEN |
---|
[1320] | 1041 | IF ( myid == 0 .AND. .NOT. openfile(file_id)%opened_before ) & |
---|
[1] | 1042 | THEN ! needs modification in case of non-extendable sets |
---|
[1320] | 1043 | CALL local_system( 'mkdir DATA_PRT_NETCDF' // & |
---|
[105] | 1044 | TRIM( coupling_char ) // '/' ) |
---|
[1] | 1045 | ENDIF |
---|
[1804] | 1046 | #if defined( __parallel ) |
---|
[807] | 1047 | ! |
---|
[1] | 1048 | !-- Set a barrier in order to allow that all other processors in the |
---|
| 1049 | !-- directory created by PE0 can open their file |
---|
| 1050 | CALL MPI_BARRIER( comm2d, ierr ) |
---|
| 1051 | #endif |
---|
| 1052 | ENDIF |
---|
| 1053 | |
---|
| 1054 | ! |
---|
[1031] | 1055 | !-- Create a new netCDF output file with requested netCDF format |
---|
[1783] | 1056 | CALL netcdf_create_file( filename, id_set_prt, .FALSE., 43 ) |
---|
[519] | 1057 | |
---|
| 1058 | ! |
---|
[1] | 1059 | !-- Define the header |
---|
[1783] | 1060 | CALL netcdf_define_header( 'pt', netcdf_extend, 0 ) |
---|
[1] | 1061 | |
---|
| 1062 | ENDIF |
---|
| 1063 | |
---|
| 1064 | CASE ( 109 ) |
---|
| 1065 | ! |
---|
[102] | 1066 | !-- Set filename |
---|
[1779] | 1067 | filename = 'DATA_1D_PTS_NETCDF' // TRIM( coupling_char ) |
---|
[102] | 1068 | |
---|
| 1069 | ! |
---|
[1031] | 1070 | !-- Inquire, if there is a netCDF file from a previuos run. This should |
---|
[1] | 1071 | !-- be opened for extension, if its variables match the actual run. |
---|
[102] | 1072 | INQUIRE( FILE=filename, EXIST=netcdf_extend ) |
---|
[1] | 1073 | |
---|
| 1074 | IF ( netcdf_extend ) THEN |
---|
| 1075 | ! |
---|
[1031] | 1076 | !-- Open an existing netCDF file for output |
---|
[1783] | 1077 | CALL netcdf_open_write_file( filename, id_set_pts, .FALSE., 393 ) |
---|
[1] | 1078 | ! |
---|
| 1079 | !-- Read header information and set all ids. If there is a mismatch |
---|
| 1080 | !-- between the previuos and the actual run, netcdf_extend is returned |
---|
| 1081 | !-- as .FALSE. |
---|
[1783] | 1082 | CALL netcdf_define_header( 'ps', netcdf_extend, 0 ) |
---|
[1] | 1083 | |
---|
| 1084 | ! |
---|
| 1085 | !-- Remove the local file, if it can not be extended |
---|
| 1086 | IF ( .NOT. netcdf_extend ) THEN |
---|
| 1087 | nc_stat = NF90_CLOSE( id_set_pts ) |
---|
[1783] | 1088 | CALL netcdf_handle_error( 'check_open', 394 ) |
---|
[102] | 1089 | CALL local_system( 'rm ' // TRIM( filename ) ) |
---|
[1] | 1090 | ENDIF |
---|
| 1091 | |
---|
| 1092 | ENDIF |
---|
| 1093 | |
---|
| 1094 | IF ( .NOT. netcdf_extend ) THEN |
---|
| 1095 | ! |
---|
[1031] | 1096 | !-- Create a new netCDF output file with requested netCDF format |
---|
[1783] | 1097 | CALL netcdf_create_file( filename, id_set_pts, .FALSE., 395 ) |
---|
[1] | 1098 | ! |
---|
| 1099 | !-- Define the header |
---|
[1783] | 1100 | CALL netcdf_define_header( 'ps', netcdf_extend, 0 ) |
---|
[1] | 1101 | |
---|
| 1102 | ENDIF |
---|
[410] | 1103 | |
---|
[1468] | 1104 | ! |
---|
[1957] | 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 |
---|