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 8565 for branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3/icedyn_rdgrft.F90 – NEMO

Ignore:
Timestamp:
2017-09-27T12:09:10+02:00 (7 years ago)
Author:
clem
Message:

trying to respect naming convention

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3/icedyn_rdgrft.F90

    r8564 r8565  
    6161   REAL(wp) ::   rn_pstar         ! determines ice strength, Hibler JPO79 
    6262   REAL(wp) ::   rn_crhg          ! determines changes in ice strength 
    63    LOGICAL  ::   ln_str_R75       ! ice strength parameterization (Rothrock75) 
    64    REAL(wp) ::   rn_perdg         ! ridging work divided by pot. energy change in ridging 
    6563   REAL(wp) ::   rn_csrdg         ! fraction of shearing energy contributing to ridging             
    6664   LOGICAL  ::   ln_partf_lin     ! participation function linear (Thorndike et al. (1975)) 
     
    130128      !! 
    131129      INTEGER  ::   ji, jj, jk, jl             ! dummy loop index 
    132       INTEGER  ::   niter, iterate_ridging     ! local integer  
    133       INTEGER  ::   nidx2                      ! local integer 
     130      INTEGER  ::   iter, iterate_ridging      ! local integer  
     131      INTEGER  ::   ipti                       ! local integer 
    134132      REAL(wp) ::   zfac                       ! local scalar 
    135       INTEGER , DIMENSION(jpij) ::   idxice2       ! compute ridge/raft or not 
     133      INTEGER , DIMENSION(jpij) ::   iptidx        ! compute ridge/raft or not 
    136134      REAL(wp), DIMENSION(jpij) ::   zdivu_adv     ! divu as implied by transport scheme  (1/s) 
    137135      REAL(wp), DIMENSION(jpij) ::   zdivu, zdelt  ! 1D divu_i & delta_i 
    138136      ! 
    139       INTEGER, PARAMETER ::   nitermax = 20     
     137      INTEGER, PARAMETER ::   jp_itermax = 20     
    140138      !!------------------------------------------------------------------- 
    141139      ! controls 
     
    154152      ! 0) Identify grid cells with ice 
    155153      !-------------------------------- 
    156       nidx = 0   ;   idxice(:) = 0 
     154      npti = 0   ;   nptidx(:) = 0 
    157155      DO jj = 1, jpj 
    158156         DO ji = 1, jpi 
    159157            IF ( SUM(a_i(ji,jj,:)) > 0._wp ) THEN 
    160                nidx           = nidx + 1 
    161                idxice( nidx ) = (jj - 1) * jpi + ji 
     158               npti           = npti + 1 
     159               nptidx( npti ) = (jj - 1) * jpi + ji 
    162160            ENDIF 
    163161         END DO 
    164162      END DO 
    165163 
    166       IF( nidx > 0 ) THEN 
     164      IF( npti > 0 ) THEN 
    167165         
    168166         ! just needed here 
    169          CALL tab_2d_1d( nidx, idxice(1:nidx), zdivu(1:nidx), divu_i(:,:) ) 
    170          CALL tab_2d_1d( nidx, idxice(1:nidx), zdelt(1:nidx), delta_i(:,:) ) 
     167         CALL tab_2d_1d( npti, nptidx(1:npti), zdivu(1:npti), divu_i(:,:) ) 
     168         CALL tab_2d_1d( npti, nptidx(1:npti), zdelt(1:npti), delta_i(:,:) ) 
    171169         ! needed here and in the iteration loop 
    172          CALL tab_3d_2d( nidx, idxice(1:nidx), a_i_2d  (1:nidx,1:jpl), a_i(:,:,:) ) 
    173          CALL tab_3d_2d( nidx, idxice(1:nidx), v_i_2d  (1:nidx,1:jpl), v_i(:,:,:) ) 
    174          CALL tab_2d_1d( nidx, idxice(1:nidx), ato_i_1d(1:nidx)      , ato_i(:,:) ) 
    175  
    176          DO ji = 1, nidx 
     170         CALL tab_3d_2d( npti, nptidx(1:npti), a_i_2d  (1:npti,1:jpl), a_i(:,:,:) ) 
     171         CALL tab_3d_2d( npti, nptidx(1:npti), v_i_2d  (1:npti,1:jpl), v_i(:,:,:) ) 
     172         CALL tab_2d_1d( npti, nptidx(1:npti), ato_i_1d(1:npti)      , ato_i(:,:) ) 
     173 
     174         DO ji = 1, npti 
    177175            !-----------------------------------------------------------------------------! 
    178176            ! 2) Dynamical inputs (closing rate, divu_adv, opning) 
     
    219217         !------------------------------------------------ 
    220218         CALL rdgrft_prep( a_i_2d, v_i_2d, ato_i_1d ) 
    221          nidx2 = 0 ; idxice2(:) = 0 
    222          DO ji = 1, nidx 
     219         ipti = 0 ; iptidx(:) = 0 
     220         DO ji = 1, npti 
    223221            IF( SUM( ABS(apartf(ji,1:jpl)) ) > 0._wp .AND. closing_gross(ji) > 0._wp ) THEN 
    224                nidx2 = nidx2 + 1 
    225                idxice2    (nidx2)   = idxice     (ji) 
    226                a_i_2d     (nidx2,:) = a_i_2d     (ji,:)  ! adjust to new indices 
    227                v_i_2d     (nidx2,:) = v_i_2d     (ji,:)  ! adjust to new indices 
    228                ato_i_1d   (nidx2)   = ato_i_1d   (ji)    ! adjust to new indices 
    229                closing_net(nidx2)   = closing_net(ji)    ! adjust to new indices 
    230                zdivu_adv  (nidx2)   = zdivu_adv  (ji)    ! adjust to new indices 
    231                opning     (nidx2)   = opning     (ji)    ! adjust to new indices 
     222               ipti = ipti + 1 
     223               iptidx     (ipti)   = nptidx     (ji) 
     224               a_i_2d     (ipti,:) = a_i_2d     (ji,:)  ! adjust to new indices 
     225               v_i_2d     (ipti,:) = v_i_2d     (ji,:)  ! adjust to new indices 
     226               ato_i_1d   (ipti)   = ato_i_1d   (ji)    ! adjust to new indices 
     227               closing_net(ipti)   = closing_net(ji)    ! adjust to new indices 
     228               zdivu_adv  (ipti)   = zdivu_adv  (ji)    ! adjust to new indices 
     229               opning     (ipti)   = opning     (ji)    ! adjust to new indices 
    232230            ENDIF 
    233231         END DO 
    234          idxice(:) = idxice2(:) 
    235          nidx      = nidx2 
     232         nptidx(:) = iptidx(:) 
     233         npti      = ipti 
    236234 
    237235      ENDIF 
     
    240238      ! Start ridging 
    241239      !-------------- 
    242       IF( nidx > 0 ) THEN 
     240      IF( npti > 0 ) THEN 
    243241          
    244242         !----------- 
     
    246244         !----------- 
    247245         ! fields used but not modified 
    248          CALL tab_2d_1d( nidx, idxice(1:nidx), sss_1d(1:nidx), sss_m(:,:) ) 
    249          CALL tab_2d_1d( nidx, idxice(1:nidx), sst_1d(1:nidx), sst_m(:,:) ) 
     246         CALL tab_2d_1d( npti, nptidx(1:npti), sss_1d(1:npti), sss_m(:,:) ) 
     247         CALL tab_2d_1d( npti, nptidx(1:npti), sst_1d(1:npti), sst_m(:,:) ) 
    250248         ! the following fields are modified in this routine 
    251          !!CALL tab_2d_1d( nidx, idxice(1:nidx), ato_i_1d(1:nidx), ato_i(:,:) ) 
    252          !!CALL tab_3d_2d( nidx, idxice(1:nidx), a_i_2d(1:nidx,1:jpl), a_i(:,:,:) ) 
    253          !!CALL tab_3d_2d( nidx, idxice(1:nidx), v_i_2d  (1:nidx,1:jpl), v_i  (:,:,:) ) 
    254          CALL tab_3d_2d( nidx, idxice(1:nidx), v_s_2d (1:nidx,1:jpl), v_s (:,:,:) ) 
    255          CALL tab_3d_2d( nidx, idxice(1:nidx), sv_i_2d(1:nidx,1:jpl), sv_i(:,:,:) ) 
    256          CALL tab_3d_2d( nidx, idxice(1:nidx), oa_i_2d(1:nidx,1:jpl), oa_i(:,:,:) ) 
     249         !!CALL tab_2d_1d( npti, nptidx(1:npti), ato_i_1d(1:npti), ato_i(:,:) ) 
     250         !!CALL tab_3d_2d( npti, nptidx(1:npti), a_i_2d(1:npti,1:jpl), a_i(:,:,:) ) 
     251         !!CALL tab_3d_2d( npti, nptidx(1:npti), v_i_2d  (1:npti,1:jpl), v_i  (:,:,:) ) 
     252         CALL tab_3d_2d( npti, nptidx(1:npti), v_s_2d (1:npti,1:jpl), v_s (:,:,:) ) 
     253         CALL tab_3d_2d( npti, nptidx(1:npti), sv_i_2d(1:npti,1:jpl), sv_i(:,:,:) ) 
     254         CALL tab_3d_2d( npti, nptidx(1:npti), oa_i_2d(1:npti,1:jpl), oa_i(:,:,:) ) 
    257255         IF ( nn_pnd_scheme > 0 ) THEN 
    258             CALL tab_3d_2d( nidx, idxice(1:nidx), a_ip_2d(1:nidx,1:jpl), a_ip(:,:,:) ) 
    259             CALL tab_3d_2d( nidx, idxice(1:nidx), v_ip_2d(1:nidx,1:jpl), v_ip(:,:,:) ) 
     256            CALL tab_3d_2d( npti, nptidx(1:npti), a_ip_2d(1:npti,1:jpl), a_ip(:,:,:) ) 
     257            CALL tab_3d_2d( npti, nptidx(1:npti), v_ip_2d(1:npti,1:jpl), v_ip(:,:,:) ) 
    260258         ENDIF 
    261259         DO jl = 1, jpl 
    262260            DO jk = 1, nlay_s 
    263                CALL tab_2d_1d( nidx, idxice(1:nidx), ze_s_2d(1:nidx,jk,jl), e_s(:,:,jk,jl) ) 
     261               CALL tab_2d_1d( npti, nptidx(1:npti), ze_s_2d(1:npti,jk,jl), e_s(:,:,jk,jl) ) 
    264262            END DO 
    265263            DO jk = 1, nlay_i 
    266                CALL tab_2d_1d( nidx, idxice(1:nidx), ze_i_2d(1:nidx,jk,jl), e_i(:,:,jk,jl) ) 
    267             END DO 
    268          END DO 
    269          CALL tab_2d_1d( nidx, idxice(1:nidx), sfx_dyn_1d    (1:nidx), sfx_dyn    (:,:) ) 
    270          CALL tab_2d_1d( nidx, idxice(1:nidx), sfx_bri_1d    (1:nidx), sfx_bri    (:,:) ) 
    271          CALL tab_2d_1d( nidx, idxice(1:nidx), wfx_dyn_1d    (1:nidx), wfx_dyn    (:,:) ) 
    272          CALL tab_2d_1d( nidx, idxice(1:nidx), hfx_dyn_1d    (1:nidx), hfx_dyn    (:,:) ) 
    273          CALL tab_2d_1d( nidx, idxice(1:nidx), wfx_snw_dyn_1d(1:nidx), wfx_snw_dyn(:,:) ) 
     264               CALL tab_2d_1d( npti, nptidx(1:npti), ze_i_2d(1:npti,jk,jl), e_i(:,:,jk,jl) ) 
     265            END DO 
     266         END DO 
     267         CALL tab_2d_1d( npti, nptidx(1:npti), sfx_dyn_1d    (1:npti), sfx_dyn    (:,:) ) 
     268         CALL tab_2d_1d( npti, nptidx(1:npti), sfx_bri_1d    (1:npti), sfx_bri    (:,:) ) 
     269         CALL tab_2d_1d( npti, nptidx(1:npti), wfx_dyn_1d    (1:npti), wfx_dyn    (:,:) ) 
     270         CALL tab_2d_1d( npti, nptidx(1:npti), hfx_dyn_1d    (1:npti), hfx_dyn    (:,:) ) 
     271         CALL tab_2d_1d( npti, nptidx(1:npti), wfx_snw_dyn_1d(1:npti), wfx_snw_dyn(:,:) ) 
    274272         IF ( nn_pnd_scheme > 0 ) THEN 
    275             CALL tab_2d_1d( nidx, idxice(1:nidx), wfx_pnd_1d(1:nidx), wfx_pnd(:,:) ) 
     273            CALL tab_2d_1d( npti, nptidx(1:npti), wfx_pnd_1d(1:npti), wfx_pnd(:,:) ) 
    276274         ENDIF 
    277275          
     
    279277         ! 3) Ridging iteration 
    280278         !-----------------------------------------------------------------------------! 
    281          niter           = 1 
     279         iter            = 1 
    282280         iterate_ridging = 1       
    283          DO WHILE( iterate_ridging > 0 .AND. niter < nitermax ) 
     281         DO WHILE( iterate_ridging > 0 .AND. iter < jp_itermax ) 
    284282 
    285283            CALL rdgrft_prep( a_i_2d, v_i_2d, ato_i_1d ) 
     
    294292            ! rates were reduced above), ridge again with new rates. 
    295293            iterate_ridging = 0 
    296             DO ji = 1, nidx 
     294            DO ji = 1, npti 
    297295               zfac = 1._wp - ( ato_i_1d(ji) + SUM( a_i_2d(ji,:) ) ) 
    298296               IF( ABS( zfac ) < epsi10 ) THEN 
     
    308306            END DO 
    309307            ! 
    310             niter = niter + 1 
    311             IF( niter  >  nitermax )    CALL ctl_warn( 'icedyn_rdgrft: non-converging ridging scheme' ) 
     308            iter = iter + 1 
     309            IF( iter  >  jp_itermax )    CALL ctl_warn( 'icedyn_rdgrft: non-converging ridging scheme' ) 
    312310            ! 
    313311         END DO 
     
    316314         ! 1D <==> 2D 
    317315         !----------- 
    318          CALL tab_1d_2d( nidx, idxice(1:nidx), ato_i_1d(1:nidx), ato_i(:,:) ) 
    319          CALL tab_2d_3d( nidx, idxice(1:nidx), a_i_2d (1:nidx,1:jpl), a_i (:,:,:) ) 
    320          CALL tab_2d_3d( nidx, idxice(1:nidx), v_i_2d (1:nidx,1:jpl), v_i (:,:,:) ) 
    321          CALL tab_2d_3d( nidx, idxice(1:nidx), v_s_2d (1:nidx,1:jpl), v_s (:,:,:) ) 
    322          CALL tab_2d_3d( nidx, idxice(1:nidx), sv_i_2d(1:nidx,1:jpl), sv_i(:,:,:) ) 
    323          CALL tab_2d_3d( nidx, idxice(1:nidx), oa_i_2d(1:nidx,1:jpl), oa_i(:,:,:) ) 
     316         CALL tab_1d_2d( npti, nptidx(1:npti), ato_i_1d(1:npti), ato_i(:,:) ) 
     317         CALL tab_2d_3d( npti, nptidx(1:npti), a_i_2d (1:npti,1:jpl), a_i (:,:,:) ) 
     318         CALL tab_2d_3d( npti, nptidx(1:npti), v_i_2d (1:npti,1:jpl), v_i (:,:,:) ) 
     319         CALL tab_2d_3d( npti, nptidx(1:npti), v_s_2d (1:npti,1:jpl), v_s (:,:,:) ) 
     320         CALL tab_2d_3d( npti, nptidx(1:npti), sv_i_2d(1:npti,1:jpl), sv_i(:,:,:) ) 
     321         CALL tab_2d_3d( npti, nptidx(1:npti), oa_i_2d(1:npti,1:jpl), oa_i(:,:,:) ) 
    324322         IF ( nn_pnd_scheme > 0 ) THEN 
    325             CALL tab_2d_3d( nidx, idxice(1:nidx), a_ip_2d(1:nidx,1:jpl), a_ip(:,:,:) ) 
    326             CALL tab_2d_3d( nidx, idxice(1:nidx), v_ip_2d(1:nidx,1:jpl), v_ip(:,:,:) ) 
     323            CALL tab_2d_3d( npti, nptidx(1:npti), a_ip_2d(1:npti,1:jpl), a_ip(:,:,:) ) 
     324            CALL tab_2d_3d( npti, nptidx(1:npti), v_ip_2d(1:npti,1:jpl), v_ip(:,:,:) ) 
    327325         ENDIF 
    328326         DO jl = 1, jpl 
    329327            DO jk = 1, nlay_s 
    330                CALL tab_1d_2d( nidx, idxice(1:nidx), ze_s_2d(1:nidx,jk,jl), e_s(:,:,jk,jl) ) 
     328               CALL tab_1d_2d( npti, nptidx(1:npti), ze_s_2d(1:npti,jk,jl), e_s(:,:,jk,jl) ) 
    331329            END DO 
    332330            DO jk = 1, nlay_i 
    333                CALL tab_1d_2d( nidx, idxice(1:nidx), ze_i_2d(1:nidx,jk,jl), e_i(:,:,jk,jl) ) 
    334             END DO 
    335          END DO 
    336          CALL tab_1d_2d( nidx, idxice(1:nidx), sfx_dyn_1d    (1:nidx), sfx_dyn    (:,:) ) 
    337          CALL tab_1d_2d( nidx, idxice(1:nidx), sfx_bri_1d    (1:nidx), sfx_bri    (:,:) ) 
    338          CALL tab_1d_2d( nidx, idxice(1:nidx), wfx_dyn_1d    (1:nidx), wfx_dyn    (:,:) ) 
    339          CALL tab_1d_2d( nidx, idxice(1:nidx), hfx_dyn_1d    (1:nidx), hfx_dyn    (:,:) ) 
    340          CALL tab_1d_2d( nidx, idxice(1:nidx), wfx_snw_dyn_1d(1:nidx), wfx_snw_dyn(:,:) ) 
     331               CALL tab_1d_2d( npti, nptidx(1:npti), ze_i_2d(1:npti,jk,jl), e_i(:,:,jk,jl) ) 
     332            END DO 
     333         END DO 
     334         CALL tab_1d_2d( npti, nptidx(1:npti), sfx_dyn_1d    (1:npti), sfx_dyn    (:,:) ) 
     335         CALL tab_1d_2d( npti, nptidx(1:npti), sfx_bri_1d    (1:npti), sfx_bri    (:,:) ) 
     336         CALL tab_1d_2d( npti, nptidx(1:npti), wfx_dyn_1d    (1:npti), wfx_dyn    (:,:) ) 
     337         CALL tab_1d_2d( npti, nptidx(1:npti), hfx_dyn_1d    (1:npti), hfx_dyn    (:,:) ) 
     338         CALL tab_1d_2d( npti, nptidx(1:npti), wfx_snw_dyn_1d(1:npti), wfx_snw_dyn(:,:) ) 
    341339         IF ( nn_pnd_scheme > 0 ) THEN 
    342             CALL tab_1d_2d( nidx, idxice(1:nidx), wfx_pnd_1d(1:nidx), wfx_pnd(:,:) ) 
     340            CALL tab_1d_2d( npti, nptidx(1:npti), wfx_pnd_1d(1:npti), wfx_pnd(:,:) ) 
    343341         ENDIF 
    344342 
    345       ENDIF ! nidx > 0 
     343      ENDIF ! npti > 0 
    346344    
    347345      CALL ice_var_agg( 1 )  
     
    378376 
    379377      !                       ! Ice thickness needed for rafting 
    380       WHERE( pa_i(1:nidx,:) > 0._wp )   ;   zhi(1:nidx,:) = pv_i(1:nidx,:) / pa_i(1:nidx,:) 
    381       ELSEWHERE                         ;   zhi(1:nidx,:) = 0._wp 
     378      WHERE( pa_i(1:npti,:) > 0._wp )   ;   zhi(1:npti,:) = pv_i(1:npti,:) / pa_i(1:npti,:) 
     379      ELSEWHERE                         ;   zhi(1:npti,:) = 0._wp 
    382380      END WHERE 
    383381 
     
    398396      ! Compute total area of ice plus open water. 
    399397      ! This is in general not equal to one because of divergence during transport 
    400       zasum(1:nidx) = pato_i(1:nidx) + SUM( pa_i(1:nidx,:), dim=2 ) 
    401       ! 
    402       WHERE( zasum(1:nidx) > 0._wp )   ;   z1_asum(1:nidx) = 1._wp / zasum(1:nidx) 
    403       ELSEWHERE                        ;   z1_asum(1:nidx) = 0._wp 
     398      zasum(1:npti) = pato_i(1:npti) + SUM( pa_i(1:npti,:), dim=2 ) 
     399      ! 
     400      WHERE( zasum(1:npti) > 0._wp )   ;   z1_asum(1:npti) = 1._wp / zasum(1:npti) 
     401      ELSEWHERE                        ;   z1_asum(1:npti) = 0._wp 
    404402      END WHERE 
    405403      ! Compute cumulative thickness distribution function 
     
    407405      ! where zGsum(n) is the fractional area in categories 0 to n. 
    408406      ! initial value (in h = 0) equals open water area 
    409       zGsum(1:nidx,-1) = 0._wp 
    410       zGsum(1:nidx,0 ) = pato_i(1:nidx) * z1_asum(1:nidx) 
     407      zGsum(1:npti,-1) = 0._wp 
     408      zGsum(1:npti,0 ) = pato_i(1:npti) * z1_asum(1:npti) 
    411409      DO jl = 1, jpl 
    412          zGsum(1:nidx,jl) = ( pato_i(1:nidx) + SUM( pa_i(1:nidx,1:jl), dim=2 ) ) * z1_asum(1:nidx)  ! sum(1:jl) is ok (and not jpl) 
     410         zGsum(1:npti,jl) = ( pato_i(1:npti) + SUM( pa_i(1:npti,1:jl), dim=2 ) ) * z1_asum(1:npti)  ! sum(1:jl) is ok (and not jpl) 
    413411      END DO 
    414412      ! 
    415413      IF( ln_partf_lin ) THEN          !--- Linear formulation (Thorndike et al., 1975) 
    416414         DO jl = 0, jpl     
    417             DO ji = 1, nidx 
     415            DO ji = 1, npti 
    418416               IF    ( zGsum(ji,jl)   < rn_gstar ) THEN 
    419417                  apartf(ji,jl) = z1_gstar * ( zGsum(ji,jl) - zGsum(ji,jl-1) ) * & 
     
    432430         zfac = 1._wp / ( 1._wp - EXP(-z1_astar) ) 
    433431         DO jl = -1, jpl 
    434             DO ji = 1, nidx 
     432            DO ji = 1, npti 
    435433               zGsum(ji,jl) = EXP( -zGsum(ji,jl) * z1_astar ) * zfac 
    436434            END DO 
    437435         END DO 
    438436         DO jl = 0, jpl 
    439             DO ji = 1, nidx 
     437            DO ji = 1, npti 
    440438               apartf(ji,jl) = zGsum(ji,jl-1) - zGsum(ji,jl) 
    441439            END DO 
     
    447445      IF( ln_rafting .AND. ln_ridging ) THEN             !- ridging & rafting 
    448446         DO jl = 1, jpl 
    449             DO ji = 1, nidx 
     447            DO ji = 1, npti 
    450448               aridge(ji,jl) = ( 1._wp + TANH ( rn_craft * ( zhi(ji,jl) - rn_hraft ) ) ) * 0.5_wp * apartf(ji,jl) 
    451449               araft (ji,jl) = apartf(ji,jl) - aridge(ji,jl) 
     
    454452      ELSEIF( ln_ridging .AND. .NOT. ln_rafting ) THEN   !- ridging alone 
    455453         DO jl = 1, jpl 
    456             DO ji = 1, nidx 
     454            DO ji = 1, npti 
    457455               aridge(ji,jl) = apartf(ji,jl) 
    458456               araft (ji,jl) = 0._wp 
     
    461459      ELSEIF( ln_rafting .AND. .NOT. ln_ridging ) THEN   !- rafting alone    
    462460         DO jl = 1, jpl 
    463             DO ji = 1, nidx 
     461            DO ji = 1, npti 
    464462               aridge(ji,jl) = 0._wp 
    465463               araft (ji,jl) = apartf(ji,jl) 
     
    468466      ELSE                                               !- no ridging & no rafting 
    469467         DO jl = 1, jpl 
    470             DO ji = 1, nidx 
     468            DO ji = 1, npti 
    471469               aridge(ji,jl) = 0._wp 
    472470               araft (ji,jl) = 0._wp          
     
    502500 
    503501      zfac = 1._wp / hi_hrft 
    504       zaksum(1:nidx) = apartf(1:nidx,0) 
     502      zaksum(1:npti) = apartf(1:npti,0) 
    505503      ! Transfer function 
    506504      DO jl = 1, jpl !all categories have a specific transfer function 
    507          DO ji = 1, nidx 
     505         DO ji = 1, npti 
    508506            IF ( apartf(ji,jl) > 0._wp ) THEN 
    509507               zhmean         = MAX( SQRT( rn_hstar * zhi(ji,jl) ), zhi(ji,jl) * hrdg_hi_min ) 
     
    530528      !  closing rate to a gross closing rate.   
    531529      ! NOTE: 0 < aksum <= 1 
    532       WHERE( zaksum(1:nidx) > 0._wp )   ;   closing_gross(1:nidx) = closing_net(1:nidx) / zaksum(1:nidx) 
    533       ELSEWHERE                         ;   closing_gross(1:nidx) = 0._wp 
     530      WHERE( zaksum(1:npti) > 0._wp )   ;   closing_gross(1:npti) = closing_net(1:npti) / zaksum(1:npti) 
     531      ELSEWHERE                         ;   closing_gross(1:npti) = 0._wp 
    534532      END WHERE 
    535533       
    536       DO ji = 1, nidx   
     534      DO ji = 1, npti   
    537535         ! correction to closing rate and opening if closing rate is excessive 
    538536         !--------------------------------------------------------------------- 
     
    552550      ! would be removed.  Reduce the opening rate proportionately. 
    553551      DO jl = 1, jpl 
    554          DO ji = 1, nidx 
     552         DO ji = 1, npti 
    555553            zfac = apartf(ji,jl) * closing_gross(ji) * rdt_ice 
    556554!!            IF( zfac > pa_i(ji,jl) .AND. zfac > 0._wp ) THEN 
     
    594592      ! 1) Compute change in open water area due to closing and opening. 
    595593      !------------------------------------------------------------------------------- 
    596       DO ji = 1, nidx 
     594      DO ji = 1, npti 
    597595         ato_i_1d(ji) = MAX( 0._wp, ato_i_1d(ji) + ( opning(ji) - apartf(ji,0) * closing_gross(ji) ) * rdt_ice ) 
    598596      END DO 
     
    603601      DO jl1 = 1, jpl 
    604602 
    605          CALL tab_2d_1d( nidx, idxice(1:nidx), s_i_1d(1:nidx), s_i(:,:,jl1) ) 
    606  
    607          DO ji = 1, nidx 
     603         CALL tab_2d_1d( npti, nptidx(1:npti), s_i_1d(1:npti), s_i(:,:,jl1) ) 
     604 
     605         DO ji = 1, npti 
    608606 
    609607            !------------------------------------------------ 
     
    716714         ! special loop for e_i because of layers jk 
    717715         DO jk = 1, nlay_i 
    718             DO ji = 1, nidx 
     716            DO ji = 1, npti 
    719717               IF( apartf(ji,jl1) > 0._wp .AND. closing_gross(ji) > 0._wp ) THEN 
    720718                  ! Compute ridging /rafting fractions 
     
    736734         DO jl2  = 1, jpl  
    737735            ! 
    738             DO ji = 1, nidx 
     736            DO ji = 1, npti 
    739737 
    740738               IF( apartf(ji,jl1) > 0._wp .AND. closing_gross(ji) > 0._wp ) THEN 
     
    783781 
    784782            DO jk = 1, nlay_i 
    785                DO ji = 1, nidx 
     783               DO ji = 1, npti 
    786784                  IF( apartf(ji,jl1) > 0._wp .AND. closing_gross(ji) > 0._wp )   & 
    787785                     &   ze_i_2d(ji,jk,jl2) = ze_i_2d(ji,jk,jl2) + eirdg(ji,jk) * fvol(ji) + eirft(ji,jk) * zswitch(ji)                   
     
    794792      ! 
    795793      ! In case ridging/rafting lead to very small negative values (sometimes it happens) 
    796       WHERE( a_i_2d(1:nidx,:) < 0._wp )   a_i_2d(1:nidx,:) = 0._wp 
    797       WHERE( v_i_2d(1:nidx,:) < 0._wp )   v_i_2d(1:nidx,:) = 0._wp 
     794      WHERE( a_i_2d(1:npti,:) < 0._wp )   a_i_2d(1:npti,:) = 0._wp 
     795      WHERE( v_i_2d(1:npti,:) < 0._wp )   v_i_2d(1:npti,:) = 0._wp 
    798796      ! 
    799797   END SUBROUTINE rdgrft_shift 
     
    820818      !!---------------------------------------------------------------------- 
    821819      !                              !--------------------------------------------------! 
    822       IF( ln_str_R75 ) THEN          ! Ice strength => Rothrock (1975) method           ! 
    823       !                              !--------------------------------------------------! 
    824       !                              !--------------------------------------------------! 
    825       ELSEIF( ln_str_H79 ) THEN      ! Ice strength => Hibler (1979) method             ! 
     820      IF( ln_str_H79 ) THEN          ! Ice strength => Hibler (1979) method             ! 
    826821      !                              !--------------------------------------------------! 
    827822         strength(:,:) = rn_pstar * SUM( v_i(:,:,:), dim=3 ) * EXP( -rn_crhg * ( 1._wp - SUM( a_i(:,:,:), dim=3 ) ) ) 
    828          ! 
    829823         ismooth = 1 
    830          ! 
     824         !                           !--------------------------------------------------! 
     825      ELSE                           ! Zero strength                                    ! 
     826         !                           !--------------------------------------------------! 
     827         strength(:,:) = 0._wp 
     828         ismooth = 0 
    831829      ENDIF 
    832830      !                              !--------------------------------------------------! 
     
    896894      !! 
    897895      NAMELIST/namdyn_rdgrft/ ln_str_H79, rn_pstar, rn_crhg, & 
    898          &                    ln_str_R75, rn_perdg,          & 
    899896         &                    rn_csrdg  ,                    & 
    900897         &                    ln_partf_lin, rn_gstar,        & 
     
    921918         WRITE(numout,*) '            1st bulk-rheology parameter                        rn_pstar     = ', rn_pstar 
    922919         WRITE(numout,*) '            2nd bulk-rhelogy parameter                         rn_crhg      = ', rn_crhg 
    923          WRITE(numout,*) '      ice strength parameterization Rothrock (1975)            ln_str_R75   = ', ln_str_R75  
    924          WRITE(numout,*) '            Ratio of ridging work to PotEner change in ridging rn_perdg     = ', rn_perdg  
    925920         WRITE(numout,*) '      Fraction of shear energy contributing to ridging         rn_csrdg     = ', rn_csrdg  
    926921         WRITE(numout,*) '      linear ridging participation function                    ln_partf_lin = ', ln_partf_lin 
     
    940935      ENDIF 
    941936      ! 
    942       IF ( ( ln_str_H79 .AND. ln_str_R75 ) .OR. ( .NOT.ln_str_H79 .AND. .NOT.ln_str_R75 ) ) THEN 
    943          CALL ctl_stop( 'ice_dyn_rdgrft_init: choose one and only one formulation for ice strength (ln_str_H79 or ln_str_R75)' ) 
    944       ENDIF 
    945       ! 
    946937      IF ( ( ln_partf_lin .AND. ln_partf_exp ) .OR. ( .NOT.ln_partf_lin .AND. .NOT.ln_partf_exp ) ) THEN 
    947938         CALL ctl_stop( 'ice_dyn_rdgrft_init: choose one and only one participation function (ln_partf_lin or ln_partf_exp)' ) 
Note: See TracChangeset for help on using the changeset viewer.