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.
limthd_ent.F90 in branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/NEMO/LIM_SRC_3 – NEMO

source: branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/NEMO/LIM_SRC_3/limthd_ent.F90 @ 4635

Last change on this file since 4635 was 4634, checked in by clem, 10 years ago

major changes in heat budget

  • Property svn:keywords set to Id
File size: 7.7 KB
RevLine 
[825]1MODULE limthd_ent
2   !!======================================================================
3   !!                       ***  MODULE limthd_ent   ***
4   !!                  Redistribution of Enthalpy in the ice
5   !!                        on the new vertical grid
6   !!                       after vertical growth/decay
7   !!======================================================================
[2715]8   !! History :  LIM  ! 2003-05 (M. Vancoppenolle) Original code in 1D
9   !!                 ! 2005-07 (M. Vancoppenolle) 3D version
10   !!                 ! 2006-11 (X. Fettweis) Vectorized
11   !!            3.0  ! 2008-03 (M. Vancoppenolle) Energy conservation and clean code
[4634]12   !!            3.4  ! 2011-02 (G. Madec) dynamical allocation
13   !!             -   ! 2014-05 (C. Rousset) complete rewriting
[2715]14   !!----------------------------------------------------------------------
[2528]15#if defined key_lim3
16   !!----------------------------------------------------------------------
17   !!   'key_lim3'                                      LIM3 sea-ice model
18   !!----------------------------------------------------------------------
[3625]19   !!   lim_thd_ent   : ice redistribution of enthalpy
[2528]20   !!----------------------------------------------------------------------
[3625]21   USE par_oce        ! ocean parameters
22   USE dom_oce        ! domain variables
23   USE domain         !
24   USE phycst         ! physical constants
[4634]25   USE sbc_oce        ! Surface boundary condition: ocean fields
[3625]26   USE ice            ! LIM variables
27   USE par_ice        ! LIM parameters
28   USE thd_ice        ! LIM thermodynamics
29   USE limvar         ! LIM variables
30   USE in_out_manager ! I/O manager
31   USE lib_mpp        ! MPP library
32   USE wrk_nemo       ! work arrays
33   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined) 
[825]34
35   IMPLICIT NONE
36   PRIVATE
37
[3294]38   PUBLIC   lim_thd_ent         ! called by lim_thd
[825]39
[4634]40   REAL(wp) :: epsi20 = 1.e-20   ! constant values
41   REAL(wp) :: epsi10 = 1.e-10   ! constant values
[2715]42
[825]43   !!----------------------------------------------------------------------
[4045]44   !! NEMO/LIM3 4.0 , UCL - NEMO Consortium (2011)
[1156]45   !! $Id$
[2528]46   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
[825]47   !!----------------------------------------------------------------------
48CONTAINS
[3294]49 
[2715]50   SUBROUTINE lim_thd_ent( kideb, kiut, jl )
[825]51      !!-------------------------------------------------------------------
52      !!               ***   ROUTINE lim_thd_ent  ***
53      !!
54      !! ** Purpose :
[4634]55      !!           This routine computes new vertical grids in the ice,
56      !!           and consistently redistributes temperatures.
[825]57      !!           Redistribution is made so as to ensure to energy conservation
58      !!
59      !!
60      !! ** Method  : linear conservative remapping
61      !!           
[4634]62      !! ** Steps : 1) cumulative integrals of old enthalpies/thicknesses
63      !!            2) linear remapping on the new layers
64      !!            3) Ice salinity update + recover temperature from enthalpies
[825]65      !!
[2715]66      !! References : Bitz & Lipscomb, JGR 99; Vancoppenolle et al., GRL, 2005
67      !!-------------------------------------------------------------------
68      INTEGER , INTENT(in) ::   kideb, kiut   ! Start/End point on which the  the computation is applied
69      INTEGER , INTENT(in) ::   jl            ! Thickness cateogry number
[825]70
[4634]71      INTEGER  :: ji,ii,ij   !  dummy loop indices
72      INTEGER  :: jk0, jk1   !  old/new layer indices
73      REAL(wp) :: ztmelts    ! temperature of melting
74      REAL(wp) :: zswitch, zaaa, zbbb, zccc, zdiscrim ! converting enthalpy to temperature
[2715]75      !
[4634]76      REAL(wp), POINTER, DIMENSION(:,:) :: zqh_cum0, zh_cum0   ! old cumulative enthlapies and layers interfaces
77      REAL(wp), POINTER, DIMENSION(:,:) :: zqh_cum1, zh_cum1   ! new cumulative enthlapies and layers interfaces
[2715]78      !!-------------------------------------------------------------------
[825]79
[4634]80      CALL wrk_alloc( jpij, nlay_i+3, zqh_cum0, zh_cum0, kjstart = 0 )
81      CALL wrk_alloc( jpij, nlay_i+1, zqh_cum1, zh_cum1, kjstart = 0 )
[825]82
[4634]83      !--------------------------------------------------------------------------
84      !  1) Cumulative integral of old enthalpy * thicnkess and layers interfaces
85      !--------------------------------------------------------------------------
86      zqh_cum0(:,0:nlay_i+2) = 0._wp 
87      zh_cum0 (:,0:nlay_i+2) = 0._wp
88      DO jk0 = 1, nlay_i+2
[921]89         DO ji = kideb, kiut
[4634]90            zqh_cum0(ji,jk0) = zqh_cum0(ji,jk0-1) + qh_i_old(ji,jk0-1)
91            zh_cum0 (ji,jk0) = zh_cum0 (ji,jk0-1) + h_i_old (ji,jk0-1)
92         ENDDO
[825]93      ENDDO
94
[4634]95      !------------------------------------
96      !  2) Interpolation on the new layers
97      !------------------------------------
98      ! new layers interfaces
99      zh_cum1(:,0:nlay_i) = 0._wp
100      DO jk1 = 1, nlay_i
[921]101         DO ji = kideb, kiut
[4634]102            zh_cum1(ji,jk1) = zh_cum1(ji,jk1-1) + ht_i_b(ji) / REAL( nlay_i )
103         ENDDO
[825]104      ENDDO
105
[4634]106      zqh_cum1(:,0:nlay_i) = 0._wp 
107      ! new cumulative q*h => linear interpolation
108      DO jk0 = 1, nlay_i+1
109         DO jk1 = 1, nlay_i-1
110            DO ji = kideb, kiut
111               IF( zh_cum1(ji,jk1) <= zh_cum0(ji,jk0) .AND. zh_cum1(ji,jk1) > zh_cum0(ji,jk0-1) ) THEN
112                  zqh_cum1(ji,jk1) = ( zqh_cum0(ji,jk0-1) * ( zh_cum0(ji,jk0) - zh_cum1(ji,jk1  ) ) +  &
113                     &                 zqh_cum0(ji,jk0  ) * ( zh_cum1(ji,jk1) - zh_cum0(ji,jk0-1) ) )  &
114                     &             / ( zh_cum0(ji,jk0) - zh_cum0(ji,jk0-1) )
115               ENDIF
116            ENDDO
117         ENDDO
[825]118      ENDDO
[4634]119      ! to ensure that total heat content is strictly conserved, set:
120      zqh_cum1(:,nlay_i) = zqh_cum0(:,nlay_i+2) 
[825]121
[4634]122      ! new enthalpies
123      DO jk1 = 1, nlay_i
[921]124         DO ji = kideb, kiut
[4634]125            zswitch       =  1._wp - MAX( 0._wp , SIGN( 1._wp , - ht_i_b(ji) + epsi20 ) ) 
126            q_i_b(ji,jk1) = zswitch * ( zqh_cum1(ji,jk1) - zqh_cum1(ji,jk1-1) ) * REAL( nlay_i ) / MAX( ht_i_b(ji), epsi20 )
127         ENDDO
[825]128      ENDDO
129
[4634]130      !---------------------------------------------------------
131      !  3) Update ice salinity and recover ice temperature
132      !---------------------------------------------------------
[834]133      ! Update salinity (basal entrapment, snow ice formation)
[825]134      DO ji = kideb, kiut
[2715]135         sm_i_b(ji) = sm_i_b(ji) + dsm_i_se_1d(ji) + dsm_i_si_1d(ji)
[825]136      END DO !ji
137
[4634]138      ! Recover ice temperature
139      DO jk1 = 1, nlay_i
[825]140         DO ji = kideb, kiut
[4634]141            ztmelts       =  -tmut * s_i_b(ji,jk1) + rtt
142            ! Conversion q(S,T) -> T (second order equation)
143            zaaa          =  cpic
144            zbbb          =  ( rcp - cpic ) * ( ztmelts - rtt ) + q_i_b(ji,jk1) / rhoic - lfus
145            zccc          =  lfus * ( ztmelts - rtt )
146            zdiscrim      =  SQRT( MAX( zbbb * zbbb - 4._wp * zaaa * zccc, 0._wp ) )
147            t_i_b(ji,jk1) =  rtt - ( zbbb + zdiscrim ) / ( 2._wp * zaaa )
148           
149            ! mask temperature
150            zswitch       =  1._wp - MAX( 0._wp , SIGN( 1._wp , - ht_i_b(ji) ) ) 
151            t_i_b(ji,jk1) =  zswitch * t_i_b(ji,jk1) + ( 1._wp - zswitch ) * rtt
152         END DO
153      END DO 
[825]154
[2715]155      !
[4634]156      CALL wrk_dealloc( jpij, nlay_i+3, zqh_cum0, zh_cum0, kjstart = 0 )
157      CALL wrk_dealloc( jpij, nlay_i+1, zqh_cum1, zh_cum1, kjstart = 0 )
[2715]158      !
[921]159   END SUBROUTINE lim_thd_ent
[825]160
161#else
[2715]162   !!----------------------------------------------------------------------
163   !!   Default option                               NO  LIM3 sea-ice model
164   !!----------------------------------------------------------------------
[825]165CONTAINS
166   SUBROUTINE lim_thd_ent          ! Empty routine
167   END SUBROUTINE lim_thd_ent
168#endif
[2715]169
170   !!======================================================================
[921]171END MODULE limthd_ent
Note: See TracBrowser for help on using the repository browser.