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 11799 for NEMO/branches/2019/dev_r11470_HPC_12_mpi3/src/ICE/icerst.F90 – NEMO

Ignore:
Timestamp:
2019-10-25T16:27:34+02:00 (4 years ago)
Author:
mocavero
Message:

Update the branch to v4.0.1 of the trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2019/dev_r11470_HPC_12_mpi3/src/ICE/icerst.F90

    r10425 r11799  
    1414   !!   ice_rst_read  : read  restart file  
    1515   !!---------------------------------------------------------------------- 
    16    USE ice            ! sea-ice variables 
     16   USE ice            ! sea-ice: variables 
    1717   USE dom_oce        ! ocean domain 
     18   USE phycst  , ONLY : rt0 
    1819   USE sbc_oce , ONLY : nn_fsbc, ln_cpl 
    19    USE icectl 
     20   USE iceistate      ! sea-ice: initial state 
     21   USE icectl         ! sea-ice: control 
    2022   ! 
    2123   USE in_out_manager ! I/O manager 
     
    5355      IF( kt == nit000 )   lrst_ice = .FALSE.   ! default definition 
    5456 
     57      IF( ln_rst_list .OR. nn_stock /= -1 ) THEN 
    5558      ! in order to get better performances with NetCDF format, we open and define the ice restart file  
    5659      ! one ice time step before writing the data (-> at nitrst - 2*nn_fsbc + 1), except if we write ice  
    5760      ! restart files every ice time step or if an ice restart file was writen at nitend - 2*nn_fsbc + 1 
    58       IF( kt == nitrst - 2*nn_fsbc + 1 .OR. nstock == nn_fsbc    & 
     61      IF( kt == nitrst - 2*nn_fsbc + 1 .OR. nn_stock == nn_fsbc    & 
    5962         &                             .OR. ( kt == nitend - nn_fsbc + 1 .AND. .NOT. lrst_ice ) ) THEN 
    6063         IF( nitrst <= nitend .AND. nitrst > 0 ) THEN 
     
    8184         ENDIF 
    8285      ENDIF 
     86      ENDIF 
    8387      ! 
    8488      IF( ln_icectl )   CALL ice_prt( kt, iiceprt, jiceprt, 1, ' - Beginning the time step - ' )   ! control print 
     
    118122 
    119123      ! Prognostic variables 
    120       CALL iom_rstput( iter, nitrst, numriw, 'v_i' , v_i  ) 
    121       CALL iom_rstput( iter, nitrst, numriw, 'v_s' , v_s  ) 
    122       CALL iom_rstput( iter, nitrst, numriw, 'sv_i', sv_i ) 
    123       CALL iom_rstput( iter, nitrst, numriw, 'oa_i', oa_i ) 
    124       CALL iom_rstput( iter, nitrst, numriw, 'a_i' , a_i  ) 
    125       CALL iom_rstput( iter, nitrst, numriw, 't_su', t_su ) 
    126       ! Melt ponds 
    127       CALL iom_rstput( iter, nitrst, numriw, 'a_ip', a_ip ) 
    128       CALL iom_rstput( iter, nitrst, numriw, 'v_ip', v_ip ) 
     124      CALL iom_rstput( iter, nitrst, numriw, 'v_i'  , v_i   ) 
     125      CALL iom_rstput( iter, nitrst, numriw, 'v_s'  , v_s   ) 
     126      CALL iom_rstput( iter, nitrst, numriw, 'sv_i' , sv_i  ) 
     127      CALL iom_rstput( iter, nitrst, numriw, 'a_i'  , a_i   ) 
     128      CALL iom_rstput( iter, nitrst, numriw, 't_su' , t_su  ) 
     129      CALL iom_rstput( iter, nitrst, numriw, 'u_ice', u_ice ) 
     130      CALL iom_rstput( iter, nitrst, numriw, 'v_ice', v_ice ) 
     131      CALL iom_rstput( iter, nitrst, numriw, 'oa_i' , oa_i  ) 
     132      CALL iom_rstput( iter, nitrst, numriw, 'a_ip' , a_ip  ) 
     133      CALL iom_rstput( iter, nitrst, numriw, 'v_ip' , v_ip  ) 
    129134      ! Snow enthalpy 
    130135      DO jk = 1, nlay_s  
     
    141146         CALL iom_rstput( iter, nitrst, numriw, znam , z3d ) 
    142147      END DO 
    143       ! ice velocity 
    144       CALL iom_rstput( iter, nitrst, numriw, 'u_ice', u_ice ) ! u_ice 
    145       CALL iom_rstput( iter, nitrst, numriw, 'v_ice', v_ice ) ! v_ice 
    146148      ! fields needed for Met Office (Jules) coupling 
    147149      IF( ln_cpl ) THEN 
     
    169171      INTEGER           ::   jk 
    170172      LOGICAL           ::   llok 
    171       INTEGER           ::   id1            ! local integer 
     173      INTEGER           ::   id0, id1, id2, id3, id4   ! local integer 
    172174      CHARACTER(len=25) ::   znam 
    173175      CHARACTER(len=2)  ::   zchar, zchar1 
     
    184186      CALL iom_open ( TRIM(cn_icerst_indir)//'/'//cn_icerst_in, numrir, kdlev = jpl ) 
    185187 
    186       CALL iom_get( numrir, 'nn_fsbc', zfice ) 
    187       CALL iom_get( numrir, 'kt_ice' , ziter )     
    188       IF(lwp) WRITE(numout,*) '   read ice restart file at time step    : ', ziter 
    189       IF(lwp) WRITE(numout,*) '   in any case we force it to nit000 - 1 : ', nit000 - 1 
    190  
    191       ! Control of date 
    192       IF( ( nit000 - NINT(ziter) ) /= 1 .AND. ABS( nrstdt ) == 1 )   & 
    193          &     CALL ctl_stop( 'ice_rst_read ===>>>> : problem with nit000 in ice restart',  & 
    194          &                   '   verify the file or rerun with the value 0 for the',        & 
    195          &                   '   control of time parameter  nrstdt' ) 
    196       IF( NINT(zfice) /= nn_fsbc          .AND. ABS( nrstdt ) == 1 )   & 
    197          &     CALL ctl_stop( 'ice_rst_read ===>>>> : problem with nn_fsbc in ice restart',  & 
    198          &                   '   verify the file or rerun with the value 0 for the',         & 
    199          &                   '   control of time parameter  nrstdt' ) 
    200  
    201       ! Prognostic variables  
    202       CALL iom_get( numrir, jpdom_autoglo, 'v_i' , v_i  ) 
    203       CALL iom_get( numrir, jpdom_autoglo, 'v_s' , v_s  ) 
    204       CALL iom_get( numrir, jpdom_autoglo, 'sv_i', sv_i ) 
    205       CALL iom_get( numrir, jpdom_autoglo, 'oa_i', oa_i ) 
    206       CALL iom_get( numrir, jpdom_autoglo, 'a_i' , a_i  ) 
    207       CALL iom_get( numrir, jpdom_autoglo, 't_su', t_su ) 
    208       ! Melt ponds 
    209       id1 = iom_varid( numrir, 'a_ip' , ldstop = .FALSE. ) 
    210       IF( id1 > 0 ) THEN                       ! fields exist (melt ponds) 
    211          CALL iom_get( numrir, jpdom_autoglo, 'a_ip' , a_ip ) 
    212          CALL iom_get( numrir, jpdom_autoglo, 'v_ip' , v_ip ) 
    213       ELSE                                     ! start from rest 
    214          IF(lwp) WRITE(numout,*) '   ==>>   previous run without melt ponds output then set it to zero' 
    215          a_ip(:,:,:) = 0._wp 
    216          v_ip(:,:,:) = 0._wp 
    217       ENDIF 
    218       ! Snow enthalpy 
    219       DO jk = 1, nlay_s 
    220          WRITE(zchar1,'(I2.2)') jk 
    221          znam = 'e_s'//'_l'//zchar1 
    222          CALL iom_get( numrir, jpdom_autoglo, znam , z3d ) 
    223          e_s(:,:,jk,:) = z3d(:,:,:) 
    224       END DO 
    225       ! Ice enthalpy 
    226       DO jk = 1, nlay_i 
    227          WRITE(zchar1,'(I2.2)') jk 
    228          znam = 'e_i'//'_l'//zchar1 
    229          CALL iom_get( numrir, jpdom_autoglo, znam , z3d ) 
    230          e_i(:,:,jk,:) = z3d(:,:,:) 
    231       END DO 
    232       ! ice velocity 
    233       CALL iom_get( numrir, jpdom_autoglo, 'u_ice', u_ice ) 
    234       CALL iom_get( numrir, jpdom_autoglo, 'v_ice', v_ice ) 
    235  
    236       CALL iom_delay_rst( 'READ', 'ICE', numrir )   ! read only ice delayed global communication variables 
    237  
    238       ! fields needed for Met Office (Jules) coupling 
    239       IF( ln_cpl ) THEN 
    240          CALL iom_get( numrir, jpdom_autoglo, 'cnd_ice', cnd_ice ) 
    241          CALL iom_get( numrir, jpdom_autoglo, 't1_ice' , t1_ice  ) 
     188      ! test if v_i exists  
     189      id0 = iom_varid( numrir, 'v_i' , ldstop = .FALSE. ) 
     190 
     191      !                    ! ------------------------------ ! 
     192      IF( id0 > 0 ) THEN   ! == case of a normal restart == ! 
     193         !                 ! ------------------------------ ! 
     194          
     195         ! Time info 
     196         CALL iom_get( numrir, 'nn_fsbc', zfice ) 
     197         CALL iom_get( numrir, 'kt_ice' , ziter )     
     198         IF(lwp) WRITE(numout,*) '   read ice restart file at time step    : ', ziter 
     199         IF(lwp) WRITE(numout,*) '   in any case we force it to nit000 - 1 : ', nit000 - 1 
     200 
     201         ! Control of date 
     202         IF( ( nit000 - NINT(ziter) ) /= 1 .AND. ABS( nrstdt ) == 1 )   & 
     203            &     CALL ctl_stop( 'ice_rst_read ===>>>> : problem with nit000 in ice restart',  & 
     204            &                   '   verify the file or rerun with the value 0 for the',        & 
     205            &                   '   control of time parameter  nrstdt' ) 
     206         IF( NINT(zfice) /= nn_fsbc          .AND. ABS( nrstdt ) == 1 )   & 
     207            &     CALL ctl_stop( 'ice_rst_read ===>>>> : problem with nn_fsbc in ice restart',  & 
     208            &                   '   verify the file or rerun with the value 0 for the',         & 
     209            &                   '   control of time parameter  nrstdt' ) 
     210 
     211         ! --- mandatory fields --- !  
     212         CALL iom_get( numrir, jpdom_autoglo, 'v_i'  , v_i   ) 
     213         CALL iom_get( numrir, jpdom_autoglo, 'v_s'  , v_s   ) 
     214         CALL iom_get( numrir, jpdom_autoglo, 'sv_i' , sv_i  ) 
     215         CALL iom_get( numrir, jpdom_autoglo, 'a_i'  , a_i   ) 
     216         CALL iom_get( numrir, jpdom_autoglo, 't_su' , t_su  ) 
     217         CALL iom_get( numrir, jpdom_autoglo, 'u_ice', u_ice ) 
     218         CALL iom_get( numrir, jpdom_autoglo, 'v_ice', v_ice ) 
     219         ! Snow enthalpy 
     220         DO jk = 1, nlay_s 
     221            WRITE(zchar1,'(I2.2)') jk 
     222            znam = 'e_s'//'_l'//zchar1 
     223            CALL iom_get( numrir, jpdom_autoglo, znam , z3d ) 
     224            e_s(:,:,jk,:) = z3d(:,:,:) 
     225         END DO 
     226         ! Ice enthalpy 
     227         DO jk = 1, nlay_i 
     228            WRITE(zchar1,'(I2.2)') jk 
     229            znam = 'e_i'//'_l'//zchar1 
     230            CALL iom_get( numrir, jpdom_autoglo, znam , z3d ) 
     231            e_i(:,:,jk,:) = z3d(:,:,:) 
     232         END DO 
     233         ! -- optional fields -- ! 
     234         ! ice age 
     235         id1 = iom_varid( numrir, 'oa_i' , ldstop = .FALSE. ) 
     236         IF( id1 > 0 ) THEN                       ! fields exist 
     237            CALL iom_get( numrir, jpdom_autoglo, 'oa_i', oa_i ) 
     238         ELSE                                     ! start from rest 
     239            IF(lwp) WRITE(numout,*) '   ==>>   previous run without ice age output then set it to zero' 
     240            oa_i(:,:,:) = 0._wp 
     241         ENDIF 
     242         ! melt ponds 
     243         id2 = iom_varid( numrir, 'a_ip' , ldstop = .FALSE. ) 
     244         IF( id2 > 0 ) THEN                       ! fields exist 
     245            CALL iom_get( numrir, jpdom_autoglo, 'a_ip' , a_ip ) 
     246            CALL iom_get( numrir, jpdom_autoglo, 'v_ip' , v_ip ) 
     247         ELSE                                     ! start from rest 
     248            IF(lwp) WRITE(numout,*) '   ==>>   previous run without melt ponds output then set it to zero' 
     249            a_ip(:,:,:) = 0._wp 
     250            v_ip(:,:,:) = 0._wp 
     251         ENDIF 
     252         ! fields needed for Met Office (Jules) coupling 
     253         IF( ln_cpl ) THEN 
     254            id3 = iom_varid( numrir, 'cnd_ice' , ldstop = .FALSE. ) 
     255            id4 = iom_varid( numrir, 't1_ice'  , ldstop = .FALSE. ) 
     256            IF( id3 > 0 .AND. id4 > 0 ) THEN         ! fields exist 
     257               CALL iom_get( numrir, jpdom_autoglo, 'cnd_ice', cnd_ice ) 
     258               CALL iom_get( numrir, jpdom_autoglo, 't1_ice' , t1_ice  ) 
     259            ELSE                                     ! start from rest 
     260               IF(lwp) WRITE(numout,*) '   ==>>   previous run without conductivity output then set it to zero' 
     261               cnd_ice(:,:,:) = 0._wp 
     262               t1_ice (:,:,:) = rt0 
     263            ENDIF 
     264         ENDIF 
     265 
     266         CALL iom_delay_rst( 'READ', 'ICE', numrir )   ! read only ice delayed global communication variables 
     267 
     268         !                 ! ---------------------------------- ! 
     269      ELSE                 ! == case of a simplified restart == ! 
     270         !                 ! ---------------------------------- ! 
     271         CALL ctl_warn('ice_rst_read: you are using a simplified ice restart') 
     272         ! 
     273         CALL ice_istate_init 
     274         CALL ice_istate( nit000 ) 
     275         ! 
     276         IF( .NOT.ln_iceini .OR. .NOT.ln_iceini_file ) & 
     277            &   CALL ctl_stop('STOP', 'ice_rst_read: you need ln_ice_ini=T and ln_iceini_file=T') 
     278         ! 
    242279      ENDIF 
    243280 
Note: See TracChangeset for help on using the changeset viewer.