Changeset 297 for codes


Ignore:
Timestamp:
11/27/14 15:01:16 (10 years ago)
Author:
millour
Message:

Make restart file format be netcdf4, so that output files of size greater than 2GB may be written.
EM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • codes/icosagcm/branches/SATURN_DYNAMICO/ICOSAGCM/src/restart.f90

    r290 r297  
    7474 
    7575    IF (is_mpi_root) THEN 
    76       status = NF90_CREATE(TRIM(ADJUSTL(restart_file_name))//'.nc', NF90_CLOBBER, ncid) 
     76      status = NF90_CREATE(TRIM(ADJUSTL(restart_file_name))//'.nc', IOR(NF90_CLOBBER,NF90_NETCDF4), ncid) 
     77      IF (status/=NF90_NOERR) THEN 
     78        WRITE(*,*) "write_restart error: failed to create ",TRIM(ADJUSTL(restart_file_name))//'.nc' 
     79        WRITE(*,*) TRIM(NF90_STRERROR(status)) 
     80      ELSE 
     81        WRITE(*,*) "write_restart: created ",TRIM(ADJUSTL(restart_file_name))//'.nc' 
     82      ENDIF 
    7783      status = NF90_DEF_DIM(ncid,'cell',ncell_glo,cellId) 
    7884      status = NF90_DEF_DIM(ncid,'edge',3*ncell_glo,edgeId) 
     
    119125          ENDIF 
    120126        ENDIF 
     127        IF (status/=NF90_NOERR) THEN 
     128          WRITE(*,*) "write_restart error: for ",TRIM(ADJUSTL(field(1)%name)) 
     129          WRITE(*,*) TRIM(NF90_STRERROR(status)) 
     130        ENDIF 
    121131      ENDDO 
    122132           
    123133       
    124134      status = NF90_ENDDEF(ncid) 
     135      IF (status/=NF90_NOERR) THEN 
     136         WRITE(*,*) "write_restart error: failed to switch out of netcdf define mode" 
     137         WRITE(*,*) TRIM(NF90_STRERROR(status)) 
     138         STOP 
     139      ENDIF 
    125140       
    126141      ALLOCATE(lon(ncell_glo),lat(ncell_glo),bounds_lon(0:nvert-1,ncell_glo),bounds_lat(0:nvert-1,ncell_glo)) 
     
    147162      status=NF90_PUT_VAR(ncid,bounds_latId,REAL(bounds_lat,r8),start=(/ 1,1 /),count=(/ nvert,ncell_glo /)) 
    148163      status=NF90_PUT_VAR(ncid,levAxisId,REAL(presnivs,r8),start=(/ 1 /),count=(/ llm /)) 
    149     ENDIF 
     164    ENDIF ! of IF (is_mpi_root) 
    150165 
    151166    DO nf=1,nfield 
     
    163178    IF (is_mpi_root) THEN 
    164179      status = NF90_CLOSE(ncid)       
     180      IF (status/=NF90_NOERR) THEN 
     181         WRITE(*,*) "write_restart error: failed to close ",TRIM(ADJUSTL(restart_file_name))//'.nc' 
     182         WRITE(*,*) TRIM(NF90_STRERROR(status)) 
     183         STOP 
     184      ELSE 
     185         WRITE(*,*) "write_restart: finished writing ",TRIM(ADJUSTL(restart_file_name))//'.nc' 
     186      ENDIF 
    165187    ENDIF 
    166188!$OMP END MASTER 
Note: See TracChangeset for help on using the changeset viewer.