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

Ignore:
Timestamp:
2017-07-13T11:29:29+02:00 (7 years ago)
Author:
clem
Message:

STEP4 (3): put all thermodynamics in 1D (limthd_da OK)

File:
1 edited

Legend:

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

    r8325 r8327  
    7171      !!------------------------------------------------------------------------ 
    7272      INTEGER  ::   ji,jj,jk,jl      ! dummy loop indices 
    73       INTEGER  ::   nbpac            ! local integers  
    74       INTEGER  ::   ii, ij, iter     !   -       - 
     73      INTEGER  ::   nidx            ! local integers  
     74      INTEGER  ::   iter     !   -       - 
    7575      REAL(wp) ::   ztmelts, zdv, zfrazb, zweight, zde                          ! local scalars 
    7676      REAL(wp) ::   zgamafr, zvfrx, zvgx, ztaux, ztwogp, zf                     !   -      - 
    7777      REAL(wp) ::   ztenagm, zvfry, zvgy, ztauy, zvrel2, zfp, zsqcd , zhicrit   !   -      - 
    78       CHARACTER (len = 15) :: fieldid 
    7978 
    8079      REAL(wp) ::   zQm          ! enthalpy exchanged with the ocean (J/m2, >0 towards ocean) 
     
    122121      CALL lim_var_agg(1) 
    123122      CALL lim_var_glo2eqv 
    124       !------------------------------------------------------------------------------| 
    125       ! 2) Convert units for ice internal energy 
    126       !------------------------------------------------------------------------------| 
    127       DO jl = 1, jpl 
    128          DO jk = 1, nlay_i 
    129             DO jj = 1, jpj 
    130                DO ji = 1, jpi 
    131                   !Energy of melting q(S,T) [J.m-3] 
    132                   rswitch          = MAX(  0._wp , SIGN( 1._wp , v_i(ji,jj,jl) - epsi20 )  )   !0 if no ice 
    133                   e_i(ji,jj,jk,jl) = rswitch * e_i(ji,jj,jk,jl) / MAX( v_i(ji,jj,jl), epsi20 ) * REAL( nlay_i, wp ) 
    134                END DO 
    135             END DO 
    136          END DO 
    137       END DO 
    138123 
    139124      !------------------------------------------------------------------------------! 
     
    240225      !------------------------------------- 
    241226      ! This occurs if open water energy budget is negative (cooling) and there is no landfast ice 
    242       nbpac = 0 
    243       npac(:) = 0 
    244       ! 
    245       DO jj = 1, jpj 
    246          DO ji = 1, jpi 
     227      nidx = 0 ; idxice(:) = 0 
     228      DO jj = 2, jpjm1 
     229         DO ji = 2, jpim1 
    247230            IF ( qlead(ji,jj)  <  0._wp .AND. tau_icebfr(ji,jj) == 0._wp ) THEN 
    248                nbpac = nbpac + 1 
    249                npac( nbpac ) = (jj - 1) * jpi + ji 
     231               nidx = nidx + 1 
     232               idxice( nidx ) = (jj - 1) * jpi + ji 
    250233            ENDIF 
    251234         END DO 
     
    264247      ENDIF 
    265248    
    266       IF( ln_limctl ) WRITE(numout,*) 'lim_thd_lac : nbpac = ', nbpac 
     249      IF( ln_limctl ) WRITE(numout,*) 'lim_thd_lac : nidx = ', nidx 
    267250 
    268251      !------------------------------ 
     
    271254      ! If ocean gains heat do nothing. Otherwise compute new ice formation 
    272255 
    273       IF ( nbpac > 0 ) THEN 
    274  
    275          CALL tab_2d_1d( nbpac, zat_i_1d  (1:nbpac)     , at_i         , jpi, jpj, npac(1:nbpac) ) 
    276          DO jl = 1, jpl 
    277             CALL tab_2d_1d( nbpac, za_i_1d  (1:nbpac,jl), a_i  (:,:,jl), jpi, jpj, npac(1:nbpac) ) 
    278             CALL tab_2d_1d( nbpac, zv_i_1d  (1:nbpac,jl), v_i  (:,:,jl), jpi, jpj, npac(1:nbpac) ) 
    279             CALL tab_2d_1d( nbpac, zsmv_i_1d(1:nbpac,jl), smv_i(:,:,jl), jpi, jpj, npac(1:nbpac) ) 
     256      IF ( nidx > 0 ) THEN 
     257 
     258         CALL tab_2d_1d( nidx, zat_i_1d  (1:nidx)     , at_i         , jpi, jpj, idxice(1:nidx) ) 
     259         DO jl = 1, jpl 
     260            CALL tab_2d_1d( nidx, za_i_1d  (1:nidx,jl), a_i  (:,:,jl), jpi, jpj, idxice(1:nidx) ) 
     261            CALL tab_2d_1d( nidx, zv_i_1d  (1:nidx,jl), v_i  (:,:,jl), jpi, jpj, idxice(1:nidx) ) 
     262            CALL tab_2d_1d( nidx, zsmv_i_1d(1:nidx,jl), smv_i(:,:,jl), jpi, jpj, idxice(1:nidx) ) 
    280263            DO jk = 1, nlay_i 
    281                CALL tab_2d_1d( nbpac, ze_i_1d(1:nbpac,jk,jl), e_i(:,:,jk,jl) , jpi, jpj, npac(1:nbpac) ) 
    282             END DO 
    283          END DO 
    284  
    285          CALL tab_2d_1d( nbpac, qlead_1d  (1:nbpac)     , qlead     , jpi, jpj, npac(1:nbpac) ) 
    286          CALL tab_2d_1d( nbpac, t_bo_1d   (1:nbpac)     , t_bo      , jpi, jpj, npac(1:nbpac) ) 
    287          CALL tab_2d_1d( nbpac, sfx_opw_1d(1:nbpac)     , sfx_opw   , jpi, jpj, npac(1:nbpac) ) 
    288          CALL tab_2d_1d( nbpac, wfx_opw_1d(1:nbpac)     , wfx_opw   , jpi, jpj, npac(1:nbpac) ) 
    289          CALL tab_2d_1d( nbpac, hicol_1d  (1:nbpac)     , hicol     , jpi, jpj, npac(1:nbpac) ) 
    290          CALL tab_2d_1d( nbpac, zvrel_1d  (1:nbpac)     , zvrel     , jpi, jpj, npac(1:nbpac) ) 
    291  
    292          CALL tab_2d_1d( nbpac, hfx_thd_1d(1:nbpac)     , hfx_thd   , jpi, jpj, npac(1:nbpac) ) 
    293          CALL tab_2d_1d( nbpac, hfx_opw_1d(1:nbpac)     , hfx_opw   , jpi, jpj, npac(1:nbpac) ) 
    294          CALL tab_2d_1d( nbpac, rn_amax_1d(1:nbpac)     , rn_amax_2d, jpi, jpj, npac(1:nbpac) ) 
    295  
     264               CALL tab_2d_1d( nidx, ze_i_1d(1:nidx,jk,jl), e_i(:,:,jk,jl) , jpi, jpj, idxice(1:nidx) ) 
     265            END DO 
     266         END DO 
     267 
     268         CALL tab_2d_1d( nidx, qlead_1d  (1:nidx)     , qlead     , jpi, jpj, idxice(1:nidx) ) 
     269         CALL tab_2d_1d( nidx, t_bo_1d   (1:nidx)     , t_bo      , jpi, jpj, idxice(1:nidx) ) 
     270         CALL tab_2d_1d( nidx, sfx_opw_1d(1:nidx)     , sfx_opw   , jpi, jpj, idxice(1:nidx) ) 
     271         CALL tab_2d_1d( nidx, wfx_opw_1d(1:nidx)     , wfx_opw   , jpi, jpj, idxice(1:nidx) ) 
     272         CALL tab_2d_1d( nidx, hicol_1d  (1:nidx)     , hicol     , jpi, jpj, idxice(1:nidx) ) 
     273         CALL tab_2d_1d( nidx, zvrel_1d  (1:nidx)     , zvrel     , jpi, jpj, idxice(1:nidx) ) 
     274 
     275         CALL tab_2d_1d( nidx, hfx_thd_1d(1:nidx)     , hfx_thd   , jpi, jpj, idxice(1:nidx) ) 
     276         CALL tab_2d_1d( nidx, hfx_opw_1d(1:nidx)     , hfx_opw   , jpi, jpj, idxice(1:nidx) ) 
     277         CALL tab_2d_1d( nidx, rn_amax_1d(1:nidx)     , rn_amax_2d, jpi, jpj, idxice(1:nidx) ) 
     278         CALL tab_2d_1d( nidx, sss_1d    (1:nidx)     , sss_m     , jpi, jpj, idxice(1:nidx) ) 
     279 
     280         !------------------------------------------------------------------------------| 
     281         ! 2) Convert units for ice internal energy 
     282         !------------------------------------------------------------------------------| 
     283         DO jl = 1, jpl 
     284            DO jk = 1, nlay_i 
     285               DO ji = 1, nidx 
     286                  IF( zv_i_1d(ji,jl) > 0._wp )   ze_i_1d(ji,jk,jl) = ze_i_1d(ji,jk,jl) / zv_i_1d(ji,jl) * REAL( nlay_i ) 
     287               END DO 
     288            END DO 
     289         END DO 
    296290         !------------------------------------------------------------------------------! 
    297291         ! 5) Compute thickness, salinity, enthalpy, age, area and volume of new ice 
     
    301295         ! Keep old ice areas and volume in memory 
    302296         !----------------------------------------- 
    303          zv_b(1:nbpac,:) = zv_i_1d(1:nbpac,:)  
    304          za_b(1:nbpac,:) = za_i_1d(1:nbpac,:) 
     297         zv_b(1:nidx,:) = zv_i_1d(1:nidx,:)  
     298         za_b(1:nidx,:) = za_i_1d(1:nidx,:) 
    305299 
    306300         !---------------------- 
    307301         ! Thickness of new ice 
    308302         !---------------------- 
    309          zh_newice(1:nbpac) = hicol_1d(1:nbpac) 
     303         zh_newice(1:nidx) = hicol_1d(1:nidx) 
    310304 
    311305         !---------------------- 
     
    314308         SELECT CASE ( nn_icesal ) 
    315309         CASE ( 1 )                    ! Sice = constant  
    316             zs_newice(1:nbpac) = rn_icesal 
     310            zs_newice(1:nidx) = rn_icesal 
    317311         CASE ( 2 )                    ! Sice = F(z,t) [Vancoppenolle et al (2005)] 
    318             DO ji = 1, nbpac 
    319                ii =   MOD( npac(ji) - 1 , jpi ) + 1 
    320                ij =      ( npac(ji) - 1 ) / jpi + 1 
    321                zs_newice(ji) = MIN(  4.606 + 0.91 / zh_newice(ji) , rn_simax , 0.5 * sss_m(ii,ij)  ) 
     312            DO ji = 1, nidx 
     313               zs_newice(ji) = MIN(  4.606 + 0.91 / zh_newice(ji) , rn_simax , 0.5 * sss_1d(ji) ) 
    322314            END DO 
    323315         CASE ( 3 )                    ! Sice = F(z) [multiyear ice] 
    324             zs_newice(1:nbpac) =   2.3 
     316            zs_newice(1:nidx) =   2.3 
    325317         END SELECT 
    326318 
     
    329321         !------------------------- 
    330322         ! We assume that new ice is formed at the seawater freezing point 
    331          DO ji = 1, nbpac 
     323         DO ji = 1, nidx 
    332324            ztmelts       = - tmut * zs_newice(ji) + rt0                  ! Melting point (K) 
    333325            ze_newice(ji) =   rhoic * (  cpic * ( ztmelts - t_bo_1d(ji) )                                         & 
     
    339331         ! Age of new ice 
    340332         !---------------- 
    341          DO ji = 1, nbpac 
     333         DO ji = 1, nidx 
    342334            zo_newice(ji) = 0._wp 
    343335         END DO 
     
    346338         ! Volume of new ice 
    347339         !------------------- 
    348          DO ji = 1, nbpac 
     340         DO ji = 1, nidx 
    349341 
    350342            zEi           = - ze_newice(ji) * r1_rhoic             ! specific enthalpy of forming ice [J/kg] 
     
    374366         IF( ln_frazil ) THEN 
    375367            ! A fraction zfrazb of frazil ice is accreted at the ice bottom 
    376             DO ji = 1, nbpac 
     368            DO ji = 1, nidx 
    377369               rswitch       = 1._wp - MAX( 0._wp, SIGN( 1._wp , - zat_i_1d(ji) ) ) 
    378370               zfrazb        = rswitch * ( TANH( rn_Cfrazb * ( zvrel_1d(ji) - rn_vfrazb ) ) + 1.0 ) * 0.5 * rn_maxfrazb 
     
    385377         ! Area of new ice 
    386378         !----------------- 
    387          DO ji = 1, nbpac 
     379         DO ji = 1, nidx 
    388380            za_newice(ji) = zv_newice(ji) / zh_newice(ji) 
    389381         END DO 
     
    398390         ! If lateral ice growth gives an ice concentration gt 1, then 
    399391         ! we keep the excessive volume in memory and attribute it later to bottom accretion 
    400          DO ji = 1, nbpac 
     392         DO ji = 1, nidx 
    401393            IF ( za_newice(ji) >  ( rn_amax_1d(ji) - zat_i_1d(ji) ) ) THEN 
    402394               zda_res(ji)   = za_newice(ji) - ( rn_amax_1d(ji) - zat_i_1d(ji) ) 
     
    413405         zat_i_1d(:) = 0._wp 
    414406         DO jl = 1, jpl 
    415             DO ji = 1, nbpac 
     407            DO ji = 1, nidx 
    416408               IF( zh_newice(ji) > hi_max(jl-1) .AND. zh_newice(ji) <= hi_max(jl) ) THEN 
    417409                  za_i_1d (ji,jl) = za_i_1d (ji,jl) + za_newice(ji) 
     
    424416 
    425417         ! Heat content 
    426          DO ji = 1, nbpac 
     418         DO ji = 1, nidx 
    427419            jl = jcat(ji)                                                    ! categroy in which new ice is put 
    428420            zswinew  (ji) = MAX( 0._wp , SIGN( 1._wp , - za_b(ji,jl) ) )   ! 0 if old ice 
     
    430422 
    431423         DO jk = 1, nlay_i 
    432             DO ji = 1, nbpac 
     424            DO ji = 1, nidx 
    433425               jl = jcat(ji) 
    434426               rswitch = MAX( 0._wp, SIGN( 1._wp , zv_i_1d(ji,jl) - epsi20 ) ) 
     
    445437 
    446438            ! for remapping 
    447             h_i_old (1:nbpac,0:nlay_i+1) = 0._wp 
    448             eh_i_old(1:nbpac,0:nlay_i+1) = 0._wp 
     439            h_i_old (1:nidx,0:nlay_i+1) = 0._wp 
     440            eh_i_old(1:nidx,0:nlay_i+1) = 0._wp 
    449441            DO jk = 1, nlay_i 
    450                DO ji = 1, nbpac 
     442               DO ji = 1, nidx 
    451443                  h_i_old (ji,jk) = zv_i_1d(ji,jl) * r1_nlay_i 
    452444                  eh_i_old(ji,jk) = ze_i_1d(ji,jk,jl) * h_i_old(ji,jk) 
     
    455447 
    456448            ! new volumes including lateral/bottom accretion + residual 
    457             DO ji = 1, nbpac 
     449            DO ji = 1, nidx 
    458450               rswitch        = MAX( 0._wp, SIGN( 1._wp , zat_i_1d(ji) - epsi20 ) ) 
    459451               zv_newfra      = rswitch * ( zdv_res(ji) + zv_frazb(ji) ) * za_i_1d(ji,jl) / MAX( zat_i_1d(ji) , epsi20 ) 
     
    465457            ENDDO 
    466458            ! --- Ice enthalpy remapping --- ! 
    467             CALL lim_thd_ent( 1, nbpac, ze_i_1d(1:nbpac,:,jl) )  
     459            CALL lim_thd_ent( 1, nidx, ze_i_1d(1:nidx,:,jl) )  
    468460         ENDDO 
    469461 
     
    472464         !----------------- 
    473465         DO jl = 1, jpl 
    474             DO ji = 1, nbpac 
     466            DO ji = 1, nidx 
    475467               zdv   = zv_i_1d(ji,jl) - zv_b(ji,jl) 
    476468               zsmv_i_1d(ji,jl) = zsmv_i_1d(ji,jl) + zdv * zs_newice(ji) 
     
    479471 
    480472         !------------------------------------------------------------------------------! 
     473         ! 8) Change units for e_i 
     474         !------------------------------------------------------------------------------!     
     475         DO jl = 1, jpl 
     476            DO jk = 1, nlay_i 
     477               DO ji = 1, nidx 
     478                  ze_i_1d(ji,jk,jl) = ze_i_1d(ji,jk,jl) * zv_i_1d(ji,jl) * r1_nlay_i  
     479               END DO 
     480            END DO 
     481         END DO 
     482         !------------------------------------------------------------------------------! 
    481483         ! 7) Change 2D vectors to 1D vectors  
    482484         !------------------------------------------------------------------------------! 
    483485         DO jl = 1, jpl 
    484             CALL tab_1d_2d( nbpac, a_i (:,:,jl), npac(1:nbpac), za_i_1d (1:nbpac,jl), jpi, jpj ) 
    485             CALL tab_1d_2d( nbpac, v_i (:,:,jl), npac(1:nbpac), zv_i_1d (1:nbpac,jl), jpi, jpj ) 
    486             CALL tab_1d_2d( nbpac, smv_i (:,:,jl), npac(1:nbpac), zsmv_i_1d(1:nbpac,jl) , jpi, jpj ) 
     486            CALL tab_1d_2d( nidx, a_i (:,:,jl), idxice(1:nidx), za_i_1d (1:nidx,jl), jpi, jpj ) 
     487            CALL tab_1d_2d( nidx, v_i (:,:,jl), idxice(1:nidx), zv_i_1d (1:nidx,jl), jpi, jpj ) 
     488            CALL tab_1d_2d( nidx, smv_i (:,:,jl), idxice(1:nidx), zsmv_i_1d(1:nidx,jl) , jpi, jpj ) 
    487489            DO jk = 1, nlay_i 
    488                CALL tab_1d_2d( nbpac, e_i(:,:,jk,jl), npac(1:nbpac), ze_i_1d(1:nbpac,jk,jl), jpi, jpj ) 
    489             END DO 
    490          END DO 
    491          CALL tab_1d_2d( nbpac, sfx_opw, npac(1:nbpac), sfx_opw_1d(1:nbpac), jpi, jpj ) 
    492          CALL tab_1d_2d( nbpac, wfx_opw, npac(1:nbpac), wfx_opw_1d(1:nbpac), jpi, jpj ) 
    493  
    494          CALL tab_1d_2d( nbpac, hfx_thd, npac(1:nbpac), hfx_thd_1d(1:nbpac), jpi, jpj ) 
    495          CALL tab_1d_2d( nbpac, hfx_opw, npac(1:nbpac), hfx_opw_1d(1:nbpac), jpi, jpj ) 
     490               CALL tab_1d_2d( nidx, e_i(:,:,jk,jl), idxice(1:nidx), ze_i_1d(1:nidx,jk,jl), jpi, jpj ) 
     491            END DO 
     492         END DO 
     493         CALL tab_1d_2d( nidx, sfx_opw, idxice(1:nidx), sfx_opw_1d(1:nidx), jpi, jpj ) 
     494         CALL tab_1d_2d( nidx, wfx_opw, idxice(1:nidx), wfx_opw_1d(1:nidx), jpi, jpj ) 
     495         CALL tab_1d_2d( nidx, hfx_thd, idxice(1:nidx), hfx_thd_1d(1:nidx), jpi, jpj ) 
     496         CALL tab_1d_2d( nidx, hfx_opw, idxice(1:nidx), hfx_opw_1d(1:nidx), jpi, jpj ) 
    496497         ! 
    497       ENDIF ! nbpac > 0 
    498  
    499       !------------------------------------------------------------------------------! 
    500       ! 8) Change units for e_i 
    501       !------------------------------------------------------------------------------!     
    502       DO jl = 1, jpl 
    503          DO jk = 1, nlay_i 
    504             DO jj = 1, jpj 
    505                DO ji = 1, jpi 
    506                   ! heat content in J/m2 
    507                   e_i(ji,jj,jk,jl) = e_i(ji,jj,jk,jl) * v_i(ji,jj,jl) * r1_nlay_i  
    508                END DO 
    509             END DO 
    510          END DO 
    511       END DO 
    512  
     498      ENDIF ! nidx > 0 
    513499      ! 
    514500      CALL wrk_dealloc( jpij, jcat )   ! integer 
Note: See TracChangeset for help on using the changeset viewer.