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

Ignore:
Timestamp:
2017-11-22T15:38:33+01:00 (6 years ago)
Author:
clem
Message:

for BDY purposes, add the possibility to have a number of categories at the lateral boundaries different than the number of categories in the regional domain

File:
1 edited

Legend:

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

    r8623 r8787  
    4444   !!   ice_var_salprof1d : salinity profile in the ice 1D 
    4545   !!   ice_var_zapsmall  : remove very small area and volume 
    46    !!   ice_var_itd       : convert 1-cat to multiple cat 
     46   !!   ice_var_itd       : convert 1-cat to jpl-cat 
     47   !!   ice_var_itd2      : convert N-cat to jpl-cat 
    4748   !!   ice_var_bv        : brine volume 
    4849   !!---------------------------------------------------------------------- 
     
    6768   PUBLIC   ice_var_zapsmall 
    6869   PUBLIC   ice_var_itd 
     70   PUBLIC   ice_var_itd2 
    6971   PUBLIC   ice_var_bv            
    7072 
     
    549551      !!------------------------------------------------------------------- 
    550552      INTEGER  :: ji, jk, jl             ! dummy loop indices 
    551       INTEGER  :: ijpij, i_fill, jl0   
     553      INTEGER  :: ndim, i_fill, jl0   
    552554      REAL(wp) :: zarg, zV, zconv, zdh, zdv 
    553555      REAL(wp), DIMENSION(:),   INTENT(in)    ::   zhti, zhts, zati    ! input ice/snow variables 
     
    562564      ! then we check whether the distribution fullfills 
    563565      ! volume and area conservation, positivity and ice categories bounds 
    564       ijpij = SIZE( zhti , 1 ) 
    565       zh_i(1:ijpij,1:jpl) = 0._wp 
    566       zh_s(1:ijpij,1:jpl) = 0._wp 
    567       za_i (1:ijpij,1:jpl) = 0._wp 
    568  
    569       DO ji = 1, ijpij 
     566      ndim = SIZE( zhti , 1 ) 
     567      zh_i(1:ndim,1:jpl) = 0._wp 
     568      zh_s(1:ndim,1:jpl) = 0._wp 
     569      za_i(1:ndim,1:jpl) = 0._wp 
     570 
     571      DO ji = 1, ndim 
    570572          
    571573         IF( zhti(ji) > 0._wp ) THEN 
     
    649651      ! Add Snow in each category where za_i is not 0 
    650652      DO jl = 1, jpl 
    651          DO ji = 1, ijpij 
     653         DO ji = 1, ndim 
    652654            IF( za_i(ji,jl) > 0._wp ) THEN 
    653655               zh_s(ji,jl) = zh_i(ji,jl) * ( zhts(ji) / zhti(ji) ) 
     
    662664      END DO 
    663665      ! 
    664     END SUBROUTINE ice_var_itd 
    665  
    666  
    667     SUBROUTINE ice_var_bv 
     666   END SUBROUTINE ice_var_itd 
     667 
     668   SUBROUTINE ice_var_itd2( zhti, zhts, zati, zh_i, zh_s, za_i ) 
     669      !!------------------------------------------------------------------- 
     670      !!                ***  ROUTINE ice_var_itd2   *** 
     671      !! 
     672      !! ** Purpose :  converting N-cat ice to jpl ice categories 
     673      !! 
     674      !!                  ice thickness distribution follows a gaussian law 
     675      !!               around the concentration of the most likely ice thickness 
     676      !!                           (similar as iceistate.F90) 
     677      !! 
     678      !! ** Method:   Iterative procedure 
     679      !!                 
     680      !!               1) Fill ice cat that correspond to input thicknesses 
     681      !!                  Find the lowest(jlmin) and highest(jlmax) cat that are filled 
     682      !! 
     683      !!               2) Expand the filling to the cat jlmin-1 and jlmax+1 
     684      !!                   by removing 25% ice area from jlmin and jlmax (resp.)  
     685      !!               
     686      !!               3) Expand the filling to the empty cat between jlmin and jlmax  
     687      !!                   by a) removing 25% ice area from the lower cat (ascendant loop jlmin=>jlmax) 
     688      !!                      b) removing 25% ice area from the higher cat (descendant loop jlmax=>jlmin) 
     689      !! 
     690      !! ** Arguments : zhti: N-cat ice thickness 
     691      !!                zhts: N-cat snow depth 
     692      !!                zati: N-cat ice concentration 
     693      !! 
     694      !! ** Output    : jpl-cat  
     695      !! 
     696      !!  (Example of application: BDY forcings when inputs have N-cat /= jpl)   
     697      !!------------------------------------------------------------------- 
     698      INTEGER  ::   ji, jl, jl1, jl2             ! dummy loop indices 
     699      INTEGER  ::   ndim, ncat   
     700      INTEGER, PARAMETER ::   ztrans = 0.25_wp 
     701      REAL(wp), DIMENSION(:,:), INTENT(in)    ::   zhti, zhts, zati    ! input ice/snow variables 
     702      REAL(wp), DIMENSION(:,:), INTENT(inout) ::   zh_i, zh_s, za_i    ! output ice/snow variables 
     703      INTEGER , DIMENSION(:,:), ALLOCATABLE   ::   jlfil, jlfil2 
     704      INTEGER , DIMENSION(:)  , ALLOCATABLE   ::   jlmax, jlmin 
     705      !!------------------------------------------------------------------- 
     706      ! 
     707      ndim = SIZE( zhti, 1 ) 
     708      ncat = SIZE( zhti, 2 ) 
     709 
     710      ! allocate arrays 
     711      ALLOCATE( jlfil(ndim,jpl), jlfil2(ndim,jpl) )  
     712      ALLOCATE( jlmin(ndim), jlmax(ndim) ) 
     713 
     714      ! --- initialize output fields to 0 --- ! 
     715      zh_i(1:ndim,1:jpl) = 0._wp 
     716      zh_s(1:ndim,1:jpl) = 0._wp 
     717      za_i(1:ndim,1:jpl) = 0._wp 
     718      ! 
     719      ! --- fill the categories --- ! 
     720      !     find where cat-input = cat-output and fill cat-output fields   
     721      jlmax(:) = 0 
     722      jlmin(:) = 999 
     723      jlfil(:,:) = 0 
     724      DO jl1 = 1, jpl 
     725         DO jl2 = 1, ncat 
     726            DO ji = 1, ndim 
     727               IF( hi_max(jl1-1) <= zhti(ji,jl2) .AND. hi_max(jl1) > zhti(ji,jl2) ) THEN 
     728                  ! fill the right category 
     729                  zh_i(ji,jl1) = zhti(ji,jl2) 
     730                  zh_s(ji,jl1) = zhts(ji,jl2) 
     731                  za_i(ji,jl1) = zati(ji,jl2) 
     732                  ! record categories that are filled 
     733                  jlmax(ji) = MAX( jlmax(ji), jl1 ) 
     734                  jlmin(ji) = MIN( jlmin(ji), jl1 ) 
     735                  jlfil(ji,jl1) = jl1 
     736               ENDIF 
     737            END DO 
     738         END DO 
     739      END DO 
     740      ! 
     741      ! --- fill the gaps between categories --- !   
     742      !     transfer from categories filled at the previous step to the empty ones in between 
     743      DO ji = 1, ndim 
     744         jl1 = jlmin(ji) 
     745         jl2 = jlmax(ji) 
     746         IF( jl1 > 1 ) THEN 
     747            ! fill the lower cat (jl1-1) 
     748            za_i(ji,jl1-1) = ztrans * za_i(ji,jl1) 
     749            zh_i(ji,jl1-1) = hi_mean(jl1-1) 
     750            ! remove from cat jl1 
     751            za_i(ji,jl1  ) = ( 1._wp - ztrans ) * za_i(ji,jl1) 
     752         ENDIF 
     753         IF( jl2 < jpl ) THEN 
     754            ! fill the upper cat (jl2+1) 
     755            za_i(ji,jl2+1) = ztrans * za_i(ji,jl2) 
     756            zh_i(ji,jl2+1) = hi_mean(jl2+1) 
     757            ! remove from cat jl2 
     758            za_i(ji,jl2  ) = ( 1._wp - ztrans ) * za_i(ji,jl2) 
     759         ENDIF 
     760      END DO 
     761      
     762      jlfil2(:,:) = jlfil(:,:)  
     763      ! fill categories from low to high 
     764      DO jl = 2, jpl-1 
     765         DO ji = 1, ndim 
     766            IF( jlfil(ji,jl-1) /= 0 .AND. jlfil(ji,jl) == 0 ) THEN 
     767               ! fill high 
     768               za_i(ji,jl) = ztrans * za_i(ji,jl-1) 
     769               zh_i(ji,jl) = hi_mean(jl) 
     770               jlfil(ji,jl) = jl 
     771               ! remove low 
     772               za_i(ji,jl-1) = ( 1._wp - ztrans ) * za_i(ji,jl-1) 
     773            ENDIF 
     774         END DO 
     775      END DO 
     776 
     777      ! fill categories from high to low 
     778      DO jl = jpl-1, 2, -1 
     779         DO ji = 1, ndim 
     780            IF( jlfil2(ji,jl+1) /= 0 .AND. jlfil2(ji,jl) == 0 ) THEN 
     781               ! fill low 
     782               za_i(ji,jl) = za_i(ji,jl) + ztrans * za_i(ji,jl+1) 
     783               zh_i(ji,jl) = hi_mean(jl)  
     784               jlfil2(ji,jl) = jl 
     785               ! remove high 
     786               za_i(ji,jl+1) = ( 1._wp - ztrans ) * za_i(ji,jl+1) 
     787            ENDIF 
     788         END DO 
     789      END DO 
     790       
     791      ! deallocate arrays 
     792      DEALLOCATE( jlfil, jlfil2 ) 
     793      DEALLOCATE( jlmin, jlmax ) 
     794 
     795   END SUBROUTINE ice_var_itd2 
     796 
     797 
     798   SUBROUTINE ice_var_bv 
    668799      !!------------------------------------------------------------------- 
    669800      !!                ***  ROUTINE ice_var_bv *** 
Note: See TracChangeset for help on using the changeset viewer.