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