New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 5250 – NEMO

Changeset 5250


Ignore:
Timestamp:
2015-05-01T15:07:32+02:00 (10 years ago)
Author:
davestorkey
Message:

2014 restarts_functionality branch: extend changes to icebergs restarts.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2014/dev_r4650_UKMO11_restart_functionality/NEMOGCM/NEMO/OPA_SRC/ICB/icbrst.F90

    r5235 r5250  
    6464                                                                                            ! start and count arrays 
    6565      LOGICAL                      ::   ll_found_restart 
     66      CHARACTER(len=256)           ::   cl_path 
    6667      CHARACTER(len=256)           ::   cl_filename 
    6768      CHARACTER(len=NF90_MAX_NAME) ::   cl_dname 
     
    7071      !!---------------------------------------------------------------------- 
    7172 
    72       ! Find a restart file 
     73      ! Find a restart file. Assume iceberg restarts in same directory as ocean restarts.  
     74      clpath = TRIM(cn_ocerst_indir) 
     75      IF( clpath(LEN_TRIM(clpath):) /= '/' ) clpath = TRIM(clpath) // '/' 
    7376      cl_filename = ' ' 
    7477      IF ( lk_mpp ) THEN 
    7578         cl_filename = ' ' 
    7679         WRITE( cl_filename, '("restart_icebergs_",I4.4,".nc")' ) narea-1 
    77          INQUIRE( file=TRIM(cl_filename), exist=ll_found_restart ) 
     80         INQUIRE( file=TRIM(cl_path)//TRIM(cl_filename), exist=ll_found_restart ) 
    7881      ELSE 
    7982         cl_filename = 'restart_icebergs.nc' 
    80          INQUIRE( file=TRIM(cl_filename), exist=ll_found_restart ) 
     83         INQUIRE( file=TRIM(cl_path)//TRIM(cl_filename), exist=ll_found_restart ) 
    8184      ENDIF 
    8285 
     
    8689 
    8790      IF (nn_verbose_level >= 0 .AND. lwp)  & 
    88          WRITE(numout,'(2a)') 'icebergs, read_restart_bergs: found restart file = ',TRIM(cl_filename) 
    89  
    90       nret = NF90_OPEN(TRIM(cl_filename), NF90_NOWRITE, ncid) 
     91         WRITE(numout,'(2a)') 'icebergs, read_restart_bergs: found restart file = ',TRIM(cl_path)//TRIM(cl_filename) 
     92 
     93      nret = NF90_OPEN(TRIM(cl_path)//TRIM(cl_filename), NF90_NOWRITE, ncid) 
    9194      IF (nret .ne. NF90_NOERR) CALL ctl_stop('icebergs, read_restart_bergs: nf_open failed') 
    9295 
     
    228231      INTEGER ::   jn   ! dummy loop index 
    229232      INTEGER ::   ix_dim, iy_dim, ik_dim, in_dim 
     233      CHARACTER(len=256)     :: cl_path 
    230234      CHARACTER(len=256)     :: cl_filename 
    231235      TYPE(iceberg), POINTER :: this 
     
    233237      !!---------------------------------------------------------------------- 
    234238 
     239      ! Assume we write iceberg restarts to same directory as ocean restarts. 
     240      clpath = TRIM(cn_ocerst_outdir) 
     241      IF( clpath(LEN_TRIM(clpath):) /= '/' ) clpath = TRIM(clpath) // '/' 
    235242      IF( lk_mpp ) THEN 
    236243         WRITE(cl_filename,'("icebergs_",I8.8,"_restart_",I4.4,".nc")') kt, narea-1 
     
    238245         WRITE(cl_filename,'("icebergs_",I8.8,"_restart.nc")') kt 
    239246      ENDIF 
    240       IF (nn_verbose_level >= 0) WRITE(numout,'(2a)') 'icebergs, write_restart: creating ',TRIM(cl_filename) 
    241  
    242       nret = NF90_CREATE(TRIM(cl_filename), NF90_CLOBBER, ncid) 
     247      IF (nn_verbose_level >= 0) WRITE(numout,'(2a)') 'icebergs, write_restart: creating ',TRIM(cl_path)//TRIM(cl_filename) 
     248 
     249      nret = NF90_CREATE(TRIM(cl_path)//TRIM(cl_filename), NF90_CLOBBER, ncid) 
    243250      IF (nret .ne. NF90_NOERR) CALL ctl_stop('icebergs, write_restart: nf_create failed') 
    244251 
     
    372379         ENDIF 
    373380      ENDDO 
    374       IF( lwp ) WRITE(numout,*) 'file: ',TRIM(cl_filename),' var: stored_ice  written' 
     381      IF( lwp ) WRITE(numout,*) 'file: ',TRIM(cl_path)//TRIM(cl_filename),' var: stored_ice  written' 
    375382 
    376383      nret = NF90_PUT_VAR( ncid, nkountid, num_bergs(:) ) 
     
    379386      nret = NF90_PUT_VAR( ncid, nsheatid, berg_grid%stored_heat(:,:) ) 
    380387      IF (nret .ne. NF90_NOERR) CALL ctl_stop('icebergs, write_restart: nf_put_var stored_heat failed') 
    381       IF( lwp ) WRITE(numout,*) 'file: ',TRIM(cl_filename),' var: stored_heat written' 
     388      IF( lwp ) WRITE(numout,*) 'file: ',TRIM(cl_path)//TRIM(cl_filename),' var: stored_heat written' 
    382389 
    383390      nret = NF90_PUT_VAR( ncid, ncalvid , src_calving(:,:) ) 
     
    385392      nret = NF90_PUT_VAR( ncid, ncalvhid, src_calving_hflx(:,:) ) 
    386393      IF (nret .ne. NF90_NOERR) CALL ctl_stop('icebergs, write_restart: nf_put_var calving_hflx failed') 
    387       IF( lwp ) WRITE(numout,*) 'file: ',TRIM(cl_filename),' var: calving written' 
     394      IF( lwp ) WRITE(numout,*) 'file: ',TRIM(cl_path)//TRIM(cl_filename),' var: calving written' 
    388395 
    389396      IF ( ASSOCIATED(first_berg) ) THEN 
Note: See TracChangeset for help on using the changeset viewer.