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 11401 for NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/ICE/icerst.F90 – NEMO

Ignore:
Timestamp:
2019-08-05T14:36:23+02:00 (5 years ago)
Author:
clem
Message:

add new functionality for initialization. Now you can use a simplified restart for starting a simulation (as for the initialization)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/ICE/icerst.F90

    r11385 r11401  
    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 
    1818   USE sbc_oce , ONLY : nn_fsbc, ln_cpl 
    19    USE icectl 
     19   USE iceistate      ! sea-ice: initial state 
     20   USE icectl         ! sea-ice: control 
    2021   ! 
    2122   USE in_out_manager ! I/O manager 
     
    120121 
    121122      ! Prognostic variables 
    122       CALL iom_rstput( iter, nitrst, numriw, 'v_i' , v_i  ) 
    123       CALL iom_rstput( iter, nitrst, numriw, 'v_s' , v_s  ) 
    124       CALL iom_rstput( iter, nitrst, numriw, 'sv_i', sv_i ) 
    125       CALL iom_rstput( iter, nitrst, numriw, 'a_i' , a_i  ) 
    126       CALL iom_rstput( iter, nitrst, numriw, 't_su', t_su ) 
    127       ! ice age 
    128       CALL iom_rstput( iter, nitrst, numriw, 'oa_i', oa_i ) 
    129       ! Melt ponds 
    130       CALL iom_rstput( iter, nitrst, numriw, 'a_ip', a_ip ) 
    131       CALL iom_rstput( iter, nitrst, numriw, 'v_ip', v_ip ) 
     123      CALL iom_rstput( iter, nitrst, numriw, 'v_i'  , v_i   ) 
     124      CALL iom_rstput( iter, nitrst, numriw, 'v_s'  , v_s   ) 
     125      CALL iom_rstput( iter, nitrst, numriw, 'sv_i' , sv_i ) 
     126      CALL iom_rstput( iter, nitrst, numriw, 'a_i'  , a_i   ) 
     127      CALL iom_rstput( iter, nitrst, numriw, 't_su' , t_su ) 
     128      CALL iom_rstput( iter, nitrst, numriw, 'u_ice', u_ice ) 
     129      CALL iom_rstput( iter, nitrst, numriw, 'v_ice', v_ice ) 
     130      CALL iom_rstput( iter, nitrst, numriw, 'oa_i' , oa_i  ) 
     131      CALL iom_rstput( iter, nitrst, numriw, 'a_ip' , a_ip ) 
     132      CALL iom_rstput( iter, nitrst, numriw, 'v_ip' , v_ip ) 
    132133      ! Snow enthalpy 
    133134      DO jk = 1, nlay_s  
     
    144145         CALL iom_rstput( iter, nitrst, numriw, znam , z3d ) 
    145146      END DO 
    146       ! ice velocity 
    147       CALL iom_rstput( iter, nitrst, numriw, 'u_ice', u_ice ) 
    148       CALL iom_rstput( iter, nitrst, numriw, 'v_ice', v_ice ) 
    149147      ! fields needed for Met Office (Jules) coupling 
    150148      IF( ln_cpl ) THEN 
     
    172170      INTEGER           ::   jk 
    173171      LOGICAL           ::   llok 
    174       INTEGER           ::   id1, id2            ! local integer 
     172      INTEGER           ::   id0, id1, id2, id3, id4   ! local integer 
    175173      CHARACTER(len=25) ::   znam 
    176174      CHARACTER(len=2)  ::   zchar, zchar1 
     
    187185      CALL iom_open ( TRIM(cn_icerst_indir)//'/'//cn_icerst_in, numrir, kdlev = jpl ) 
    188186 
    189       CALL iom_get( numrir, 'nn_fsbc', zfice ) 
    190       CALL iom_get( numrir, 'kt_ice' , ziter )     
    191       IF(lwp) WRITE(numout,*) '   read ice restart file at time step    : ', ziter 
    192       IF(lwp) WRITE(numout,*) '   in any case we force it to nit000 - 1 : ', nit000 - 1 
    193  
    194       ! Control of date 
    195       IF( ( nit000 - NINT(ziter) ) /= 1 .AND. ABS( nrstdt ) == 1 )   & 
    196          &     CALL ctl_stop( 'ice_rst_read ===>>>> : problem with nit000 in ice restart',  & 
    197          &                   '   verify the file or rerun with the value 0 for the',        & 
    198          &                   '   control of time parameter  nrstdt' ) 
    199       IF( NINT(zfice) /= nn_fsbc          .AND. ABS( nrstdt ) == 1 )   & 
    200          &     CALL ctl_stop( 'ice_rst_read ===>>>> : problem with nn_fsbc in ice restart',  & 
    201          &                   '   verify the file or rerun with the value 0 for the',         & 
    202          &                   '   control of time parameter  nrstdt' ) 
    203  
    204       ! Prognostic variables  
    205       CALL iom_get( numrir, jpdom_autoglo, 'v_i' , v_i  ) 
    206       CALL iom_get( numrir, jpdom_autoglo, 'v_s' , v_s  ) 
    207       CALL iom_get( numrir, jpdom_autoglo, 'sv_i', sv_i ) 
    208       CALL iom_get( numrir, jpdom_autoglo, 'a_i' , a_i  ) 
    209       CALL iom_get( numrir, jpdom_autoglo, 't_su', t_su ) 
    210       ! ice age 
    211       id1 = iom_varid( numrir, 'oa_i' , ldstop = .FALSE. ) 
    212       IF( id1 > 0 ) THEN                       ! fields exist 
    213          CALL iom_get( numrir, jpdom_autoglo, 'oa_i', oa_i ) 
    214       ELSE                                     ! start from rest 
    215          IF(lwp) WRITE(numout,*) '   ==>>   previous run without ice age output then set it to zero' 
    216          oa_i(:,:,:) = 0._wp 
    217       ENDIF 
    218       ! Melt ponds 
    219       id2 = iom_varid( numrir, 'a_ip' , ldstop = .FALSE. ) 
    220       IF( id2 > 0 ) THEN                       ! fields exist 
    221          CALL iom_get( numrir, jpdom_autoglo, 'a_ip' , a_ip ) 
    222          CALL iom_get( numrir, jpdom_autoglo, 'v_ip' , v_ip ) 
    223       ELSE                                     ! start from rest 
    224          IF(lwp) WRITE(numout,*) '   ==>>   previous run without melt ponds output then set it to zero' 
    225          a_ip(:,:,:) = 0._wp 
    226          v_ip(:,:,:) = 0._wp 
    227       ENDIF 
    228       ! Snow enthalpy 
    229       DO jk = 1, nlay_s 
    230          WRITE(zchar1,'(I2.2)') jk 
    231          znam = 'e_s'//'_l'//zchar1 
    232          CALL iom_get( numrir, jpdom_autoglo, znam , z3d ) 
    233          e_s(:,:,jk,:) = z3d(:,:,:) 
    234       END DO 
    235       ! Ice enthalpy 
    236       DO jk = 1, nlay_i 
    237          WRITE(zchar1,'(I2.2)') jk 
    238          znam = 'e_i'//'_l'//zchar1 
    239          CALL iom_get( numrir, jpdom_autoglo, znam , z3d ) 
    240          e_i(:,:,jk,:) = z3d(:,:,:) 
    241       END DO 
    242       ! ice velocity 
    243       CALL iom_get( numrir, jpdom_autoglo, 'u_ice', u_ice ) 
    244       CALL iom_get( numrir, jpdom_autoglo, 'v_ice', v_ice ) 
    245  
    246       CALL iom_delay_rst( 'READ', 'ICE', numrir )   ! read only ice delayed global communication variables 
    247  
    248       ! fields needed for Met Office (Jules) coupling 
    249       IF( ln_cpl ) THEN 
    250          CALL iom_get( numrir, jpdom_autoglo, 'cnd_ice', cnd_ice ) 
    251          CALL iom_get( numrir, jpdom_autoglo, 't1_ice' , t1_ice  ) 
     187      ! test if v_i exists  
     188      id0 = iom_varid( numrir, 'v_i' , ldstop = .FALSE. ) 
     189 
     190      !                    ! ------------------------------ ! 
     191      IF( id0 > 0 ) THEN   ! == case of a normal restart == ! 
     192         !                 ! ------------------------------ ! 
     193          
     194         ! Time info 
     195         CALL iom_get( numrir, 'nn_fsbc', zfice ) 
     196         CALL iom_get( numrir, 'kt_ice' , ziter )     
     197         IF(lwp) WRITE(numout,*) '   read ice restart file at time step    : ', ziter 
     198         IF(lwp) WRITE(numout,*) '   in any case we force it to nit000 - 1 : ', nit000 - 1 
     199 
     200         ! Control of date 
     201         IF( ( nit000 - NINT(ziter) ) /= 1 .AND. ABS( nrstdt ) == 1 )   & 
     202            &     CALL ctl_stop( 'ice_rst_read ===>>>> : problem with nit000 in ice restart',  & 
     203            &                   '   verify the file or rerun with the value 0 for the',        & 
     204            &                   '   control of time parameter  nrstdt' ) 
     205         IF( NINT(zfice) /= nn_fsbc          .AND. ABS( nrstdt ) == 1 )   & 
     206            &     CALL ctl_stop( 'ice_rst_read ===>>>> : problem with nn_fsbc in ice restart',  & 
     207            &                   '   verify the file or rerun with the value 0 for the',         & 
     208            &                   '   control of time parameter  nrstdt' ) 
     209 
     210         ! --- mandatory fields --- !  
     211         CALL iom_get( numrir, jpdom_autoglo, 'v_i'  , v_i   ) 
     212         CALL iom_get( numrir, jpdom_autoglo, 'v_s'  , v_s   ) 
     213         CALL iom_get( numrir, jpdom_autoglo, 'sv_i' , sv_i  ) 
     214         CALL iom_get( numrir, jpdom_autoglo, 'a_i'  , a_i   ) 
     215         CALL iom_get( numrir, jpdom_autoglo, 't_su' , t_su  ) 
     216         CALL iom_get( numrir, jpdom_autoglo, 'u_ice', u_ice ) 
     217         CALL iom_get( numrir, jpdom_autoglo, 'v_ice', v_ice ) 
     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         ! -- optional fields -- ! 
     233         ! ice age 
     234         id1 = iom_varid( numrir, 'oa_i' , ldstop = .FALSE. ) 
     235         IF( id1 > 0 ) THEN                       ! fields exist 
     236            CALL iom_get( numrir, jpdom_autoglo, 'oa_i', oa_i ) 
     237         ELSE                                     ! start from rest 
     238            IF(lwp) WRITE(numout,*) '   ==>>   previous run without ice age output then set it to zero' 
     239            oa_i(:,:,:) = 0._wp 
     240         ENDIF 
     241         ! melt ponds 
     242         id2 = iom_varid( numrir, 'a_ip' , ldstop = .FALSE. ) 
     243         IF( id2 > 0 ) THEN                       ! fields exist 
     244            CALL iom_get( numrir, jpdom_autoglo, 'a_ip' , a_ip ) 
     245            CALL iom_get( numrir, jpdom_autoglo, 'v_ip' , v_ip ) 
     246         ELSE                                     ! start from rest 
     247            IF(lwp) WRITE(numout,*) '   ==>>   previous run without melt ponds output then set it to zero' 
     248            a_ip(:,:,:) = 0._wp 
     249            v_ip(:,:,:) = 0._wp 
     250         ENDIF 
     251         ! fields needed for Met Office (Jules) coupling 
     252         IF( ln_cpl ) THEN 
     253            id3 = iom_varid( numrir, 'cnd_ice' , ldstop = .FALSE. ) 
     254            id4 = iom_varid( numrir, 't1_ice'  , ldstop = .FALSE. ) 
     255            IF( id3 > 0 .AND. id4 > 0 ) THEN         ! fields exist 
     256               CALL iom_get( numrir, jpdom_autoglo, 'cnd_ice', cnd_ice ) 
     257               CALL iom_get( numrir, jpdom_autoglo, 't1_ice' , t1_ice  ) 
     258            ELSE                                     ! start from rest 
     259               IF(lwp) WRITE(numout,*) '   ==>>   previous run without conductivity output then set it to zero' 
     260               cnd_ice(:,:,:) = 0._wp 
     261               t1_ice (:,:,:) = rt0 
     262            ENDIF 
     263         ENDIF 
     264 
     265         CALL iom_delay_rst( 'READ', 'ICE', numrir )   ! read only ice delayed global communication variables 
     266 
     267         !                 ! ---------------------------------- ! 
     268      ELSE                 ! == case of a simplified restart == ! 
     269         !                 ! ---------------------------------- ! 
     270         CALL ctl_warn('ice_rst_read: you are using a simplified ice restart') 
     271         ! 
     272         CALL ice_istate_init 
     273         CALL ice_istate( nit000 ) 
     274         ! 
     275         IF( .NOT.ln_iceini .OR. .NOT.ln_iceini_file ) & 
     276            &   CALL ctl_stop('STOP', 'ice_rst_read: you need ln_ice_ini=T and ln_iceini_file=T') 
     277         ! 
    252278      ENDIF 
    253279 
Note: See TracChangeset for help on using the changeset viewer.