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