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.F90 in trunk/NEMOGCM/NEMO/LIM_SRC_3 – NEMO

source: trunk/NEMOGCM/NEMO/LIM_SRC_3/limthd.F90 @ 7698

Last change on this file since 7698 was 7698, checked in by mocavero, 7 years ago

update trunk with OpenMP parallelization

  • Property svn:keywords set to Id
File size: 36.2 KB
Line 
1MODULE limthd
2   !!======================================================================
3   !!                  ***  MODULE limthd   ***
4   !!  LIM-3 :   ice thermodynamic
5   !!======================================================================
6   !! History :  LIM  ! 2000-01 (M.A. Morales Maqueda, H. Goosse, T. Fichefet) LIM-1
7   !!            2.0  ! 2002-07 (C. Ethe, G. Madec)  LIM-2 (F90 rewriting)
8   !!            3.0  ! 2005-11 (M. Vancoppenolle)  LIM-3 : Multi-layer thermodynamics + salinity variations
9   !!             -   ! 2007-04 (M. Vancoppenolle) add lim_thd_glohec, lim_thd_con_dh and lim_thd_con_dif
10   !!            3.2  ! 2009-07 (M. Vancoppenolle, Y. Aksenov, G. Madec) bug correction in wfx_snw
11   !!            3.3  ! 2010-11 (G. Madec) corrected snow melting heat (due to factor betas)
12   !!            4.0  ! 2011-02 (G. Madec) dynamical allocation
13   !!             -   ! 2012-05 (C. Rousset) add penetration solar flux
14   !!----------------------------------------------------------------------
15#if defined key_lim3
16   !!----------------------------------------------------------------------
17   !!   'key_lim3'                                      LIM3 sea-ice model
18   !!----------------------------------------------------------------------
19   !!   lim_thd       : thermodynamic of sea ice
20   !!   lim_thd_init  : initialisation of sea-ice thermodynamic
21   !!----------------------------------------------------------------------
22   USE phycst         ! physical constants
23   USE dom_oce        ! ocean space and time domain variables
24   USE ice            ! sea-ice variables
25   USE sbc_oce        ! Surface boundary condition: ocean fields
26   USE sbc_ice        ! Surface boundary condition: ice fields
27   USE thd_ice        ! thermodynamic sea-ice variables
28   USE limthd_dif     ! vertical diffusion
29   USE limthd_dh      ! ice-snow growth and melt
30   USE limthd_da      ! lateral melting
31   USE limthd_sal     ! ice salinity
32   USE limthd_ent     ! ice enthalpy redistribution
33   USE limthd_lac     ! lateral accretion
34   USE limitd_th      ! remapping thickness distribution
35   USE limtab         ! 1D <==> 2D transformation
36   USE limvar         !
37   USE limcons        ! conservation tests
38   USE limctl         ! control print
39   !
40   USE in_out_manager ! I/O manager
41   USE lbclnk         ! lateral boundary condition - MPP links
42   USE lib_mpp        ! MPP library
43   USE wrk_nemo       ! work arrays
44   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined) 
45   USE timing         ! Timing
46
47   IMPLICIT NONE
48   PRIVATE
49
50   PUBLIC   lim_thd         ! called by limstp module
51   PUBLIC   lim_thd_init    ! called by sbc_lim_init
52
53   !! * Substitutions
54#  include "vectopt_loop_substitute.h90"
55   !!----------------------------------------------------------------------
56   !! NEMO/LIM3 3.3 , UCL - NEMO Consortium (2010)
57   !! $Id$
58   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
59   !!----------------------------------------------------------------------
60CONTAINS
61
62   SUBROUTINE lim_thd( kt )
63      !!-------------------------------------------------------------------
64      !!                ***  ROUTINE lim_thd  ***       
65      !! 
66      !! ** Purpose : This routine manages ice thermodynamics
67      !!         
68      !! ** Action : - Initialisation of some variables
69      !!             - Some preliminary computation (oceanic heat flux
70      !!               at the ice base, snow acc.,heat budget of the leads)
71      !!             - selection of the icy points and put them in an array
72      !!             - call lim_thd_dif  for vertical heat diffusion
73      !!             - call lim_thd_dh   for vertical ice growth and melt
74      !!             - call lim_thd_ent  for enthalpy remapping
75      !!             - call lim_thd_sal  for ice desalination
76      !!             - call lim_thd_temp to  retrieve temperature from ice enthalpy
77      !!             - back to the geographic grid
78      !!     
79      !! ** References :
80      !!---------------------------------------------------------------------
81      INTEGER, INTENT(in) :: kt    ! number of iteration
82      !
83      INTEGER  :: ji, jj, jk, jl   ! dummy loop indices
84      INTEGER  :: nbpb             ! nb of icy pts for vertical thermo calculations
85      REAL(wp) :: zfric_u, zqld, zqfr
86      REAL(wp) :: zvi_b, zsmv_b, zei_b, zfs_b, zfw_b, zft_b 
87      REAL(wp), PARAMETER :: zfric_umin = 0._wp           ! lower bound for the friction velocity (cice value=5.e-04)
88      REAL(wp), PARAMETER :: zch        = 0.0057_wp       ! heat transfer coefficient
89      REAL(wp), POINTER, DIMENSION(:,:) ::   zu_io, zv_io, zfric   ! ice-ocean velocity (m/s) and frictional velocity (m2/s2)
90      !
91      !!-------------------------------------------------------------------
92
93      IF( nn_timing == 1 )   CALL timing_start('limthd')
94
95      CALL wrk_alloc( jpi,jpj, zu_io, zv_io, zfric )
96
97      IF( kt == nit000 .AND. lwp ) THEN
98         WRITE(numout,*)'' 
99         WRITE(numout,*)' lim_thd '
100         WRITE(numout,*)' ~~~~~~~~'
101      ENDIF
102     
103      ! conservation test
104      IF( ln_limdiachk ) CALL lim_cons_hsm(0, 'limthd', zvi_b, zsmv_b, zei_b, zfw_b, zfs_b, zft_b)
105
106      CALL lim_var_glo2eqv
107
108      !---------------------------------------------!
109      ! computation of friction velocity at T points
110      !---------------------------------------------!
111      IF( ln_limdyn ) THEN
112!$OMP PARALLEL
113!$OMP DO schedule(static) private(jj,ji)
114         DO jj = 1, jpj
115            DO ji = 1, jpi
116               zu_io(ji,jj) = u_ice(ji,jj) - ssu_m(ji,jj)
117               zv_io(ji,jj) = v_ice(ji,jj) - ssv_m(ji,jj)
118            END DO
119         END DO
120!$OMP DO schedule(static) private(jj,ji)
121         DO jj = 2, jpjm1 
122            DO ji = fs_2, fs_jpim1
123               zfric(ji,jj) = rn_cio * ( 0.5_wp *  &
124                  &                    (  zu_io(ji,jj) * zu_io(ji,jj) + zu_io(ji-1,jj) * zu_io(ji-1,jj)   &
125                  &                     + zv_io(ji,jj) * zv_io(ji,jj) + zv_io(ji,jj-1) * zv_io(ji,jj-1) ) ) * tmask(ji,jj,1)
126            END DO
127         END DO
128!$OMP END PARALLEL
129      ELSE      !  if no ice dynamics => transmit directly the atmospheric stress to the ocean
130!$OMP PARALLEL DO schedule(static) private(jj,ji)
131         DO jj = 2, jpjm1
132            DO ji = fs_2, fs_jpim1
133               zfric(ji,jj) = r1_rau0 * SQRT( 0.5_wp *  &
134                  &                         (  utau(ji,jj) * utau(ji,jj) + utau(ji-1,jj) * utau(ji-1,jj)   &
135                  &                          + vtau(ji,jj) * vtau(ji,jj) + vtau(ji,jj-1) * vtau(ji,jj-1) ) ) * tmask(ji,jj,1)
136            END DO
137         END DO
138      ENDIF
139      CALL lbc_lnk( zfric, 'T',  1. )
140      !
141      !----------------------------------!
142      ! Initialization and units change
143      !----------------------------------!
144!$OMP PARALLEL
145      DO jl = 1, jpl
146!$OMP DO schedule(static) private(jj,ji)
147         DO jj = 1, jpj
148            DO ji = 1, jpi
149               ftr_ice(ji,jj,jl) = 0._wp  ! part of solar radiation transmitted through the ice
150            END DO
151         END DO
152      END DO
153
154      ! Change the units of heat content; from J/m2 to J/m3
155      DO jl = 1, jpl
156         DO jk = 1, nlay_i
157!$OMP DO schedule(static) private(jj,ji,rswitch)
158            DO jj = 1, jpj
159               DO ji = 1, jpi
160                  rswitch = MAX(  0._wp , SIGN( 1._wp , v_i(ji,jj,jl) - epsi20 )  )
161                  !Energy of melting q(S,T) [J.m-3]
162                  e_i(ji,jj,jk,jl) = rswitch * e_i(ji,jj,jk,jl) / MAX( v_i(ji,jj,jl) , epsi20 ) * REAL( nlay_i )
163               END DO
164            END DO
165         END DO
166         DO jk = 1, nlay_s
167!$OMP DO schedule(static) private(jj,ji,rswitch)
168            DO jj = 1, jpj
169               DO ji = 1, jpi
170                  rswitch = MAX(  0._wp , SIGN( 1._wp , v_s(ji,jj,jl) - epsi20 )  )
171                  !Energy of melting q(S,T) [J.m-3]
172                  e_s(ji,jj,jk,jl) = rswitch * e_s(ji,jj,jk,jl) / MAX( v_s(ji,jj,jl) , epsi20 ) * REAL( nlay_s )
173               END DO
174            END DO
175         END DO
176      END DO
177
178      !--------------------------------------------------------------------!
179      ! Partial computation of forcing for the thermodynamic sea ice model
180      !--------------------------------------------------------------------!
181!$OMP DO schedule(static) private(jj,ji,rswitch,zqld,zqfr,zfric_u)
182      DO jj = 1, jpj
183         DO ji = 1, jpi
184            rswitch  = tmask(ji,jj,1) * MAX( 0._wp , SIGN( 1._wp , at_i(ji,jj) - epsi10 ) ) ! 0 if no ice
185            !
186            !           !  solar irradiance transmission at the mixed layer bottom and used in the lead heat budget
187            !           !  practically no "direct lateral ablation"
188            !           
189            !           !  net downward heat flux from the ice to the ocean, expressed as a function of ocean
190            !           !  temperature and turbulent mixing (McPhee, 1992)
191            !
192            ! --- Energy received in the lead, zqld is defined everywhere (J.m-2) --- !
193            zqld =  tmask(ji,jj,1) * rdt_ice *  &
194               &    ( pfrld(ji,jj) * qsr_oce(ji,jj) * frq_m(ji,jj) + pfrld(ji,jj) * qns_oce(ji,jj) + qemp_oce(ji,jj) )
195
196            ! --- Energy needed to bring ocean surface layer until its freezing (<0, J.m-2) --- !
197            zqfr = tmask(ji,jj,1) * rau0 * rcp * e3t_m(ji,jj) * ( t_bo(ji,jj) - ( sst_m(ji,jj) + rt0 ) )
198
199            ! --- Energy from the turbulent oceanic heat flux (W/m2) --- !
200            zfric_u      = MAX( SQRT( zfric(ji,jj) ), zfric_umin ) 
201            fhtur(ji,jj) = MAX( 0._wp, rswitch * rau0 * rcp * zch  * zfric_u * ( ( sst_m(ji,jj) + rt0 ) - t_bo(ji,jj) ) ) ! W.m-2
202            fhtur(ji,jj) = rswitch * MIN( fhtur(ji,jj), - zqfr * r1_rdtice / MAX( at_i(ji,jj), epsi10 ) )
203            ! upper bound for fhtur: the heat retrieved from the ocean must be smaller than the heat necessary to reach
204            !                        the freezing point, so that we do not have SST < T_freeze
205            !                        This implies: - ( fhtur(ji,jj) * at_i(ji,jj) * rtdice ) - zqfr >= 0
206
207            !-- Energy Budget of the leads (J.m-2). Must be < 0 to form ice
208            qlead(ji,jj) = MIN( 0._wp , zqld - ( fhtur(ji,jj) * at_i(ji,jj) * rdt_ice ) - zqfr )
209
210            ! If there is ice and leads are warming, then transfer energy from the lead budget and use it for bottom melting
211            IF( zqld > 0._wp ) THEN
212               fhld (ji,jj) = rswitch * zqld * r1_rdtice / MAX( at_i(ji,jj), epsi10 ) ! divided by at_i since this is (re)multiplied by a_i in limthd_dh.F90
213               qlead(ji,jj) = 0._wp
214            ELSE
215               fhld (ji,jj) = 0._wp
216            ENDIF
217            !
218            ! Net heat flux on top of the ice-ocean [W.m-2]
219            ! ---------------------------------------------
220            hfx_in(ji,jj) = qns_tot(ji,jj) + qsr_tot(ji,jj) 
221         END DO
222      END DO
223!$OMP END PARALLEL
224     
225      ! In case we bypass open-water ice formation
226      IF( .NOT. ln_limdO ) THEN
227!$OMP PARALLEL DO schedule(static) private(jj,ji)
228         DO jj = 1, jpj
229            DO ji = 1, jpi
230               qlead(ji,jj) = 0._wp
231            END DO
232         END DO
233      END IF
234      ! In case we bypass growing/melting from top and bottom: we suppose ice is impermeable => ocean is isolated from atmosphere
235      IF( .NOT. ln_limdH ) THEN
236!$OMP PARALLEL DO schedule(static) private(jj,ji)
237         DO jj = 1, jpj
238            DO ji = 1, jpi
239               hfx_in(ji,jj) = pfrld(ji,jj) * ( qns_oce(ji,jj) + qsr_oce(ji,jj) ) + qemp_oce(ji,jj)
240               fhtur (ji,jj) = 0._wp
241            END DO
242         END DO
243      END IF
244!$OMP PARALLEL
245!$OMP DO schedule(static) private(jj,ji)
246      DO jj = 1, jpj
247         DO ji = 1, jpi
248            fhld (ji,jj) = 0._wp
249         END DO
250      END DO
251
252      ! ---------------------------------------------------------------------
253      ! Net heat flux on top of the ocean after ice thermo (1st step) [W.m-2]
254      ! ---------------------------------------------------------------------
255      !     First  step here              :  non solar + precip - qlead - qturb
256      !     Second step in limthd_dh      :  heat remaining if total melt (zq_rema)
257      !     Third  step in limsbc         :  heat from ice-ocean mass exchange (zf_mass) + solar
258!$OMP DO schedule(static) private(jj,ji)
259      DO jj = 1, jpj
260         DO ji = 1, jpi
261            hfx_out(ji,jj) =   pfrld(ji,jj) * qns_oce(ji,jj) + qemp_oce(ji,jj)  &  ! Non solar heat flux received by the ocean               
262               &             - qlead(ji,jj) * r1_rdtice                         &  ! heat flux taken from the ocean where there is open water ice formation
263               &             - at_i(ji,jj) * fhtur(ji,jj)                       &  ! heat flux taken by turbulence
264               &             - at_i(ji,jj) *  fhld(ji,jj)                          ! heat flux taken during bottom growth/melt
265                                                                                   !    (fhld should be 0 while bott growth)
266         END DO
267      END DO
268!$OMP END PARALLEL
269
270      !------------------------------------------------------------------------------!
271      ! Thermodynamic computation (only on grid points covered by ice)
272      !------------------------------------------------------------------------------!
273
274      DO jl = 1, jpl      !loop over ice categories
275
276         ! select ice covered grid points
277         nbpb = 0
278         DO jj = 1, jpj
279            DO ji = 1, jpi
280               IF ( a_i(ji,jj,jl) > epsi10 ) THEN     
281                  nbpb      = nbpb  + 1
282                  npb(nbpb) = (jj - 1) * jpi + ji
283               ENDIF
284            END DO
285         END DO
286
287         ! debug point to follow
288         jiindex_1d = 0
289         IF( ln_limctl ) THEN
290            DO ji = mi0(iiceprt), mi1(iiceprt)
291               DO jj = mj0(jiceprt), mj1(jiceprt)
292                  jiindex_1d = (jj - 1) * jpi + ji
293                  WRITE(numout,*) ' lim_thd : Category no : ', jl 
294               END DO
295            END DO
296         ENDIF
297
298         IF( lk_mpp )         CALL mpp_ini_ice( nbpb , numout )
299
300         IF( nbpb > 0 ) THEN  ! If there is no ice, do nothing.
301            !                                                               
302            s_i_new   (:) = 0._wp ; dh_s_tot (:) = 0._wp                     ! --- some init --- !
303            dh_i_surf (:) = 0._wp ; dh_i_bott(:) = 0._wp
304            dh_snowice(:) = 0._wp ; dh_i_sub (:) = 0._wp
305
306                              CALL lim_thd_1d2d( nbpb, jl, 1 )               ! --- Move to 1D arrays --- !
307            !
308            IF( ln_limdH )    CALL lim_thd_dif( 1, nbpb )                    ! --- Ice/Snow Temperature profile --- !
309            !
310            IF( ln_limdH )    CALL lim_thd_dh( 1, nbpb )                     ! --- Ice/Snow thickness --- !   
311            !
312            IF( ln_limdH )    CALL lim_thd_ent( 1, nbpb, q_i_1d(1:nbpb,:) )  ! --- Ice enthalpy remapping --- !
313            !
314                              CALL lim_thd_sal( 1, nbpb )                    ! --- Ice salinity --- !   
315            !
316                              CALL lim_thd_temp( 1, nbpb )                   ! --- temperature update --- !
317            !
318            IF( ln_limdH ) THEN
319               IF ( ( nn_monocat == 1 .OR. nn_monocat == 4 ) .AND. jpl == 1 ) THEN
320                              CALL lim_thd_lam( 1, nbpb )                    ! --- extra lateral melting if monocat --- !
321               END IF
322            END IF
323            !
324                              CALL lim_thd_1d2d( nbpb, jl, 2 )               ! --- Move to 2D arrays --- !
325            !
326            IF( lk_mpp )      CALL mpp_comm_free( ncomm_ice ) !RB necessary ??
327         ENDIF
328         !
329      END DO !jl
330
331      IF( ln_limdA)           CALL lim_thd_da                                ! --- lateral melting --- !
332
333      ! Enthalpies are global variables we have to readjust the units (heat content in J/m2)
334!$OMP PARALLEL
335      DO jl = 1, jpl
336         DO jk = 1, nlay_i
337!$OMP DO schedule(static) private(jj,ji)
338            DO jj = 1, jpj
339               DO ji = 1, jpi
340                  e_i(ji,jj,jk,jl) = e_i(ji,jj,jk,jl) * a_i(ji,jj,jl) * ht_i(ji,jj,jl) * r1_nlay_i
341               END DO
342            END DO
343         END DO
344         DO jk = 1, nlay_s
345!$OMP DO schedule(static) private(jj,ji)
346            DO jj = 1, jpj
347               DO ji = 1, jpi
348                  e_s(ji,jj,jk,jl) = e_s(ji,jj,jk,jl) * a_i(ji,jj,jl) * ht_s(ji,jj,jl) * r1_nlay_s
349               END DO
350            END DO
351         END DO
352      END DO
353
354! Change thickness to volume
355      DO jl = 1, jpl
356!$OMP DO schedule(static) private(jj,ji)
357         DO jj = 1, jpj
358            DO ji = 1, jpi
359               v_i(ji,jj,jl)   = ht_i(ji,jj,jl) * a_i(ji,jj,jl)
360               v_s(ji,jj,jl)   = ht_s(ji,jj,jl) * a_i(ji,jj,jl)
361               smv_i(ji,jj,jl) = sm_i(ji,jj,jl) * v_i(ji,jj,jl)
362            END DO
363         END DO
364      END DO
365
366      ! update ice age (in case a_i changed, i.e. becomes 0 or lateral melting in monocat)
367      DO jl  = 1, jpl
368!$OMP DO schedule(static) private(jj,ji,rswitch)
369         DO jj = 1, jpj
370            DO ji = 1, jpi
371               rswitch = MAX( 0._wp , SIGN( 1._wp, a_i_b(ji,jj,jl) - epsi10 ) )
372               oa_i(ji,jj,jl) = rswitch * oa_i(ji,jj,jl) * a_i(ji,jj,jl) / MAX( a_i_b(ji,jj,jl), epsi10 )
373            END DO
374         END DO
375      END DO
376!$OMP END PARALLEL
377
378      CALL lim_var_zapsmall
379
380      ! control checks
381      IF( ln_limctl )    CALL lim_prt( kt, iiceprt, jiceprt, 1, ' - ice thermodyn. - ' )   ! control print
382      !
383      IF( ln_limdiachk ) CALL lim_cons_hsm(1, 'limthd', zvi_b, zsmv_b, zei_b, zfw_b, zfs_b, zft_b)
384
385      !------------------------------------------------!
386      !  Transport ice between thickness categories
387      !------------------------------------------------!
388      ! Given thermodynamic growth rates, transport ice between thickness categories.
389      IF( ln_limdiachk ) CALL lim_cons_hsm(0, 'limitd_th_rem', zvi_b, zsmv_b, zei_b, zfw_b, zfs_b, zft_b)
390
391      IF( jpl > 1 )      CALL lim_itd_th_rem( 1, jpl, kt )
392
393      IF( ln_limdiachk ) CALL lim_cons_hsm(1, 'limitd_th_rem', zvi_b, zsmv_b, zei_b, zfw_b, zfs_b, zft_b)
394
395      !------------------------------------------------!
396      !  Add frazil ice growing in leads
397      !------------------------------------------------!
398      IF( ln_limdiachk ) CALL lim_cons_hsm(0, 'limthd_lac', zvi_b, zsmv_b, zei_b, zfw_b, zfs_b, zft_b)
399
400      IF( ln_limdO )     CALL lim_thd_lac
401     
402      ! conservation test
403      IF( ln_limdiachk ) CALL lim_cons_hsm(1, 'limthd_lac', zvi_b, zsmv_b, zei_b, zfw_b, zfs_b, zft_b)
404
405      ! Control print
406      IF( ln_ctl )       CALL lim_prt3D( 'limthd' )
407      !
408      CALL wrk_dealloc( jpi,jpj, zu_io, zv_io, zfric )
409      !
410      IF( nn_timing == 1 )  CALL timing_stop('limthd')
411
412   END SUBROUTINE lim_thd 
413
414 
415   SUBROUTINE lim_thd_temp( kideb, kiut )
416      !!-----------------------------------------------------------------------
417      !!                   ***  ROUTINE lim_thd_temp ***
418      !!                 
419      !! ** Purpose :   Computes sea ice temperature (Kelvin) from enthalpy
420      !!
421      !! ** Method  :   Formula (Bitz and Lipscomb, 1999)
422      !!-------------------------------------------------------------------
423      INTEGER, INTENT(in) ::   kideb, kiut   ! bounds for the spatial loop
424      !
425      INTEGER  ::   ji, jk   ! dummy loop indices
426      REAL(wp) ::   ztmelts, zaaa, zbbb, zccc, zdiscrim  ! local scalar
427      !!-------------------------------------------------------------------
428      ! Recover ice temperature
429      DO jk = 1, nlay_i
430         DO ji = kideb, kiut
431            ztmelts       =  -tmut * s_i_1d(ji,jk) + rt0
432            ! Conversion q(S,T) -> T (second order equation)
433            zaaa          =  cpic
434            zbbb          =  ( rcp - cpic ) * ( ztmelts - rt0 ) + q_i_1d(ji,jk) * r1_rhoic - lfus
435            zccc          =  lfus * ( ztmelts - rt0 )
436            zdiscrim      =  SQRT( MAX( zbbb * zbbb - 4._wp * zaaa * zccc, 0._wp ) )
437            t_i_1d(ji,jk) =  rt0 - ( zbbb + zdiscrim ) / ( 2._wp * zaaa )
438           
439            ! mask temperature
440            rswitch       =  1._wp - MAX( 0._wp , SIGN( 1._wp , - ht_i_1d(ji) ) ) 
441            t_i_1d(ji,jk) =  rswitch * t_i_1d(ji,jk) + ( 1._wp - rswitch ) * rt0
442         END DO
443      END DO 
444      !
445   END SUBROUTINE lim_thd_temp
446
447
448   SUBROUTINE lim_thd_lam( kideb, kiut )
449      !!-----------------------------------------------------------------------
450      !!                   ***  ROUTINE lim_thd_lam ***
451      !!                 
452      !! ** Purpose :   Lateral melting in case monocategory
453      !!                          ( dA = A/2h dh )
454      !!-----------------------------------------------------------------------
455      INTEGER, INTENT(in) ::   kideb, kiut        ! bounds for the spatial loop
456      !
457      INTEGER  ::   ji                 ! dummy loop indices
458      REAL(wp) ::   zhi_bef            ! ice thickness before thermo
459      REAL(wp) ::   zdh_mel, zda_mel   ! net melting
460      REAL(wp) ::   zvi, zvs           ! ice/snow volumes
461      !!-----------------------------------------------------------------------
462      !
463      DO ji = kideb, kiut
464         zdh_mel = MIN( 0._wp, dh_i_surf(ji) + dh_i_bott(ji) + dh_snowice(ji) + dh_i_sub(ji) )
465         IF( zdh_mel < 0._wp .AND. a_i_1d(ji) > 0._wp )  THEN
466            zvi          = a_i_1d(ji) * ht_i_1d(ji)
467            zvs          = a_i_1d(ji) * ht_s_1d(ji)
468            ! lateral melting = concentration change
469            zhi_bef     = ht_i_1d(ji) - zdh_mel
470            rswitch     = MAX( 0._wp , SIGN( 1._wp , zhi_bef - epsi20 ) )
471            zda_mel     = rswitch * a_i_1d(ji) * zdh_mel / ( 2._wp * MAX( zhi_bef, epsi20 ) )
472            a_i_1d(ji)  = MAX( epsi20, a_i_1d(ji) + zda_mel ) 
473            ! adjust thickness
474            ht_i_1d(ji) = zvi / a_i_1d(ji)           
475            ht_s_1d(ji) = zvs / a_i_1d(ji)           
476            ! retrieve total concentration
477            at_i_1d(ji) = a_i_1d(ji)
478         END IF
479      END DO
480      !
481   END SUBROUTINE lim_thd_lam
482
483
484   SUBROUTINE lim_thd_1d2d( nbpb, jl, kn )
485      !!-----------------------------------------------------------------------
486      !!                   ***  ROUTINE lim_thd_1d2d ***
487      !!                 
488      !! ** Purpose :   move arrays from 1d to 2d and the reverse
489      !!-----------------------------------------------------------------------
490      INTEGER, INTENT(in) ::   kn       ! 1= from 2D to 1D   ;   2= from 1D to 2D
491      INTEGER, INTENT(in) ::   nbpb     ! size of 1D arrays
492      INTEGER, INTENT(in) ::   jl       ! ice cat
493      !
494      INTEGER             ::   jk       ! dummy loop indices
495      !!-----------------------------------------------------------------------
496      !
497      SELECT CASE( kn )
498      !
499      CASE( 1 )            ! from 2D to 1D
500         !
501         CALL tab_2d_1d( nbpb, at_i_1d     (1:nbpb), at_i            , jpi, jpj, npb(1:nbpb) )
502         CALL tab_2d_1d( nbpb, a_i_1d      (1:nbpb), a_i(:,:,jl)     , jpi, jpj, npb(1:nbpb) )
503         CALL tab_2d_1d( nbpb, ht_i_1d     (1:nbpb), ht_i(:,:,jl)    , jpi, jpj, npb(1:nbpb) )
504         CALL tab_2d_1d( nbpb, ht_s_1d     (1:nbpb), ht_s(:,:,jl)    , jpi, jpj, npb(1:nbpb) )
505         !
506         CALL tab_2d_1d( nbpb, t_su_1d     (1:nbpb), t_su(:,:,jl)    , jpi, jpj, npb(1:nbpb) )
507         CALL tab_2d_1d( nbpb, sm_i_1d     (1:nbpb), sm_i(:,:,jl)    , jpi, jpj, npb(1:nbpb) )
508         DO jk = 1, nlay_s
509            CALL tab_2d_1d( nbpb, t_s_1d(1:nbpb,jk), t_s(:,:,jk,jl)  , jpi, jpj, npb(1:nbpb) )
510            CALL tab_2d_1d( nbpb, q_s_1d(1:nbpb,jk), e_s(:,:,jk,jl)  , jpi, jpj, npb(1:nbpb) )
511         END DO
512         DO jk = 1, nlay_i
513            CALL tab_2d_1d( nbpb, t_i_1d(1:nbpb,jk), t_i(:,:,jk,jl)  , jpi, jpj, npb(1:nbpb) )
514            CALL tab_2d_1d( nbpb, q_i_1d(1:nbpb,jk), e_i(:,:,jk,jl)  , jpi, jpj, npb(1:nbpb) )
515            CALL tab_2d_1d( nbpb, s_i_1d(1:nbpb,jk), s_i(:,:,jk,jl)  , jpi, jpj, npb(1:nbpb) )
516         END DO
517         !
518         CALL tab_2d_1d( nbpb, qprec_ice_1d(1:nbpb), qprec_ice(:,:) , jpi, jpj, npb(1:nbpb) )
519         CALL tab_2d_1d( nbpb, qevap_ice_1d(1:nbpb), qevap_ice(:,:,jl) , jpi, jpj, npb(1:nbpb) )
520         CALL tab_2d_1d( nbpb, qsr_ice_1d (1:nbpb), qsr_ice(:,:,jl) , jpi, jpj, npb(1:nbpb) )
521         CALL tab_2d_1d( nbpb, fr1_i0_1d  (1:nbpb), fr1_i0          , jpi, jpj, npb(1:nbpb) )
522         CALL tab_2d_1d( nbpb, fr2_i0_1d  (1:nbpb), fr2_i0          , jpi, jpj, npb(1:nbpb) )
523         CALL tab_2d_1d( nbpb, qns_ice_1d (1:nbpb), qns_ice(:,:,jl) , jpi, jpj, npb(1:nbpb) )
524         CALL tab_2d_1d( nbpb, ftr_ice_1d (1:nbpb), ftr_ice(:,:,jl) , jpi, jpj, npb(1:nbpb) )
525         CALL tab_2d_1d( nbpb, evap_ice_1d (1:nbpb), evap_ice(:,:,jl), jpi, jpj, npb(1:nbpb) )
526         CALL tab_2d_1d( nbpb, dqns_ice_1d(1:nbpb), dqns_ice(:,:,jl), jpi, jpj, npb(1:nbpb) )
527         CALL tab_2d_1d( nbpb, t_bo_1d     (1:nbpb), t_bo            , jpi, jpj, npb(1:nbpb) )
528         CALL tab_2d_1d( nbpb, sprecip_1d (1:nbpb), sprecip         , jpi, jpj, npb(1:nbpb) ) 
529         CALL tab_2d_1d( nbpb, fhtur_1d   (1:nbpb), fhtur           , jpi, jpj, npb(1:nbpb) )
530         CALL tab_2d_1d( nbpb, qlead_1d   (1:nbpb), qlead           , jpi, jpj, npb(1:nbpb) )
531         CALL tab_2d_1d( nbpb, fhld_1d    (1:nbpb), fhld            , jpi, jpj, npb(1:nbpb) )
532         !
533         CALL tab_2d_1d( nbpb, wfx_snw_1d (1:nbpb), wfx_snw         , jpi, jpj, npb(1:nbpb) )
534         CALL tab_2d_1d( nbpb, wfx_sub_1d (1:nbpb), wfx_sub         , jpi, jpj, npb(1:nbpb) )
535         !
536         CALL tab_2d_1d( nbpb, wfx_bog_1d (1:nbpb), wfx_bog         , jpi, jpj, npb(1:nbpb) )
537         CALL tab_2d_1d( nbpb, wfx_bom_1d (1:nbpb), wfx_bom         , jpi, jpj, npb(1:nbpb) )
538         CALL tab_2d_1d( nbpb, wfx_sum_1d (1:nbpb), wfx_sum         , jpi, jpj, npb(1:nbpb) )
539         CALL tab_2d_1d( nbpb, wfx_sni_1d (1:nbpb), wfx_sni         , jpi, jpj, npb(1:nbpb) )
540         CALL tab_2d_1d( nbpb, wfx_res_1d (1:nbpb), wfx_res         , jpi, jpj, npb(1:nbpb) )
541         CALL tab_2d_1d( nbpb, wfx_spr_1d (1:nbpb), wfx_spr         , jpi, jpj, npb(1:nbpb) )
542         !
543         CALL tab_2d_1d( nbpb, sfx_bog_1d (1:nbpb), sfx_bog         , jpi, jpj, npb(1:nbpb) )
544         CALL tab_2d_1d( nbpb, sfx_bom_1d (1:nbpb), sfx_bom         , jpi, jpj, npb(1:nbpb) )
545         CALL tab_2d_1d( nbpb, sfx_sum_1d (1:nbpb), sfx_sum         , jpi, jpj, npb(1:nbpb) )
546         CALL tab_2d_1d( nbpb, sfx_sni_1d (1:nbpb), sfx_sni         , jpi, jpj, npb(1:nbpb) )
547         CALL tab_2d_1d( nbpb, sfx_bri_1d (1:nbpb), sfx_bri         , jpi, jpj, npb(1:nbpb) )
548         CALL tab_2d_1d( nbpb, sfx_res_1d (1:nbpb), sfx_res         , jpi, jpj, npb(1:nbpb) )
549         CALL tab_2d_1d( nbpb, sfx_sub_1d (1:nbpb), sfx_sub         , jpi, jpj,npb(1:nbpb) )
550         !
551         CALL tab_2d_1d( nbpb, hfx_thd_1d (1:nbpb), hfx_thd         , jpi, jpj, npb(1:nbpb) )
552         CALL tab_2d_1d( nbpb, hfx_spr_1d (1:nbpb), hfx_spr         , jpi, jpj, npb(1:nbpb) )
553         CALL tab_2d_1d( nbpb, hfx_sum_1d (1:nbpb), hfx_sum         , jpi, jpj, npb(1:nbpb) )
554         CALL tab_2d_1d( nbpb, hfx_bom_1d (1:nbpb), hfx_bom         , jpi, jpj, npb(1:nbpb) )
555         CALL tab_2d_1d( nbpb, hfx_bog_1d (1:nbpb), hfx_bog         , jpi, jpj, npb(1:nbpb) )
556         CALL tab_2d_1d( nbpb, hfx_dif_1d (1:nbpb), hfx_dif         , jpi, jpj, npb(1:nbpb) )
557         CALL tab_2d_1d( nbpb, hfx_opw_1d (1:nbpb), hfx_opw         , jpi, jpj, npb(1:nbpb) )
558         CALL tab_2d_1d( nbpb, hfx_snw_1d (1:nbpb), hfx_snw         , jpi, jpj, npb(1:nbpb) )
559         CALL tab_2d_1d( nbpb, hfx_sub_1d (1:nbpb), hfx_sub         , jpi, jpj, npb(1:nbpb) )
560         CALL tab_2d_1d( nbpb, hfx_err_1d (1:nbpb), hfx_err         , jpi, jpj, npb(1:nbpb) )
561         CALL tab_2d_1d( nbpb, hfx_res_1d (1:nbpb), hfx_res         , jpi, jpj, npb(1:nbpb) )
562         CALL tab_2d_1d( nbpb, hfx_err_dif_1d (1:nbpb), hfx_err_dif , jpi, jpj, npb(1:nbpb) )
563         CALL tab_2d_1d( nbpb, hfx_err_rem_1d (1:nbpb), hfx_err_rem , jpi, jpj, npb(1:nbpb) )
564         !
565      CASE( 2 )            ! from 1D to 2D
566         !
567         CALL tab_1d_2d( nbpb, at_i          , npb, at_i_1d    (1:nbpb)   , jpi, jpj )
568         CALL tab_1d_2d( nbpb, ht_i(:,:,jl)  , npb, ht_i_1d    (1:nbpb)   , jpi, jpj )
569         CALL tab_1d_2d( nbpb, ht_s(:,:,jl)  , npb, ht_s_1d    (1:nbpb)   , jpi, jpj )
570         CALL tab_1d_2d( nbpb, a_i (:,:,jl)  , npb, a_i_1d     (1:nbpb)   , jpi, jpj )
571         CALL tab_1d_2d( nbpb, t_su(:,:,jl)  , npb, t_su_1d    (1:nbpb)   , jpi, jpj )
572         CALL tab_1d_2d( nbpb, sm_i(:,:,jl)  , npb, sm_i_1d    (1:nbpb)   , jpi, jpj )
573         DO jk = 1, nlay_s
574            CALL tab_1d_2d( nbpb, t_s(:,:,jk,jl), npb, t_s_1d     (1:nbpb,jk), jpi, jpj)
575            CALL tab_1d_2d( nbpb, e_s(:,:,jk,jl), npb, q_s_1d     (1:nbpb,jk), jpi, jpj)
576         END DO
577         DO jk = 1, nlay_i
578            CALL tab_1d_2d( nbpb, t_i(:,:,jk,jl), npb, t_i_1d     (1:nbpb,jk), jpi, jpj)
579            CALL tab_1d_2d( nbpb, e_i(:,:,jk,jl), npb, q_i_1d     (1:nbpb,jk), jpi, jpj)
580            CALL tab_1d_2d( nbpb, s_i(:,:,jk,jl), npb, s_i_1d     (1:nbpb,jk), jpi, jpj)
581         END DO
582         CALL tab_1d_2d( nbpb, qlead         , npb, qlead_1d  (1:nbpb)   , jpi, jpj )
583         !
584         CALL tab_1d_2d( nbpb, wfx_snw       , npb, wfx_snw_1d(1:nbpb)   , jpi, jpj )
585         CALL tab_1d_2d( nbpb, wfx_sub       , npb, wfx_sub_1d(1:nbpb)   , jpi, jpj )
586         !
587         CALL tab_1d_2d( nbpb, wfx_bog       , npb, wfx_bog_1d(1:nbpb)   , jpi, jpj )
588         CALL tab_1d_2d( nbpb, wfx_bom       , npb, wfx_bom_1d(1:nbpb)   , jpi, jpj )
589         CALL tab_1d_2d( nbpb, wfx_sum       , npb, wfx_sum_1d(1:nbpb)   , jpi, jpj )
590         CALL tab_1d_2d( nbpb, wfx_sni       , npb, wfx_sni_1d(1:nbpb)   , jpi, jpj )
591         CALL tab_1d_2d( nbpb, wfx_res       , npb, wfx_res_1d(1:nbpb)   , jpi, jpj )
592         CALL tab_1d_2d( nbpb, wfx_spr       , npb, wfx_spr_1d(1:nbpb)   , jpi, jpj )
593         !
594         CALL tab_1d_2d( nbpb, sfx_bog       , npb, sfx_bog_1d(1:nbpb)   , jpi, jpj )
595         CALL tab_1d_2d( nbpb, sfx_bom       , npb, sfx_bom_1d(1:nbpb)   , jpi, jpj )
596         CALL tab_1d_2d( nbpb, sfx_sum       , npb, sfx_sum_1d(1:nbpb)   , jpi, jpj )
597         CALL tab_1d_2d( nbpb, sfx_sni       , npb, sfx_sni_1d(1:nbpb)   , jpi, jpj )
598         CALL tab_1d_2d( nbpb, sfx_res       , npb, sfx_res_1d(1:nbpb)   , jpi, jpj )
599         CALL tab_1d_2d( nbpb, sfx_bri       , npb, sfx_bri_1d(1:nbpb)   , jpi, jpj )
600         CALL tab_1d_2d( nbpb, sfx_sub       , npb, sfx_sub_1d(1:nbpb)   , jpi, jpj )       
601         !
602         CALL tab_1d_2d( nbpb, hfx_thd       , npb, hfx_thd_1d(1:nbpb)   , jpi, jpj )
603         CALL tab_1d_2d( nbpb, hfx_spr       , npb, hfx_spr_1d(1:nbpb)   , jpi, jpj )
604         CALL tab_1d_2d( nbpb, hfx_sum       , npb, hfx_sum_1d(1:nbpb)   , jpi, jpj )
605         CALL tab_1d_2d( nbpb, hfx_bom       , npb, hfx_bom_1d(1:nbpb)   , jpi, jpj )
606         CALL tab_1d_2d( nbpb, hfx_bog       , npb, hfx_bog_1d(1:nbpb)   , jpi, jpj )
607         CALL tab_1d_2d( nbpb, hfx_dif       , npb, hfx_dif_1d(1:nbpb)   , jpi, jpj )
608         CALL tab_1d_2d( nbpb, hfx_opw       , npb, hfx_opw_1d(1:nbpb)   , jpi, jpj )
609         CALL tab_1d_2d( nbpb, hfx_snw       , npb, hfx_snw_1d(1:nbpb)   , jpi, jpj )
610         CALL tab_1d_2d( nbpb, hfx_sub       , npb, hfx_sub_1d(1:nbpb)   , jpi, jpj )
611         CALL tab_1d_2d( nbpb, hfx_err       , npb, hfx_err_1d(1:nbpb)   , jpi, jpj )
612         CALL tab_1d_2d( nbpb, hfx_res       , npb, hfx_res_1d(1:nbpb)   , jpi, jpj )
613         CALL tab_1d_2d( nbpb, hfx_err_rem   , npb, hfx_err_rem_1d(1:nbpb), jpi, jpj )
614         CALL tab_1d_2d( nbpb, hfx_err_dif   , npb, hfx_err_dif_1d(1:nbpb), jpi, jpj )
615         !
616         CALL tab_1d_2d( nbpb, qns_ice(:,:,jl), npb, qns_ice_1d(1:nbpb) , jpi, jpj)
617         CALL tab_1d_2d( nbpb, ftr_ice(:,:,jl), npb, ftr_ice_1d(1:nbpb) , jpi, jpj )
618         !         
619      END SELECT
620      !
621   END SUBROUTINE lim_thd_1d2d
622
623
624   SUBROUTINE lim_thd_init
625      !!-----------------------------------------------------------------------
626      !!                   ***  ROUTINE lim_thd_init ***
627      !!                 
628      !! ** Purpose :   Physical constants and parameters linked to the ice
629      !!              thermodynamics
630      !!
631      !! ** Method  :   Read the namicethd namelist and check the ice-thermo
632      !!              parameter values called at the first timestep (nit000)
633      !!
634      !! ** input   :   Namelist namicether
635      !!-------------------------------------------------------------------
636      INTEGER  ::   ios                 ! Local integer output status for namelist read
637      NAMELIST/namicethd/ rn_kappa_i, nn_conv_dif, rn_terr_dif, nn_ice_thcon,ln_it_qnsice,nn_monocat,  &
638         &                ln_limdH, rn_betas,                                                          &
639         &                ln_limdA, rn_beta, rn_dmin,                                                  &
640         &                ln_limdO, rn_hnewice, ln_frazil, rn_maxfrazb, rn_vfrazb, rn_Cfrazb, rn_himin
641      !!-------------------------------------------------------------------
642      !
643      REWIND( numnam_ice_ref )              ! Namelist namicethd in reference namelist : Ice thermodynamics
644      READ  ( numnam_ice_ref, namicethd, IOSTAT = ios, ERR = 901)
645901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namicethd in reference namelist', lwp )
646
647      REWIND( numnam_ice_cfg )              ! Namelist namicethd in configuration namelist : Ice thermodynamics
648      READ  ( numnam_ice_cfg, namicethd, IOSTAT = ios, ERR = 902 )
649902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namicethd in configuration namelist', lwp )
650      IF(lwm) WRITE ( numoni, namicethd )
651      !
652      IF(lwp) THEN                          ! control print
653         WRITE(numout,*) 'lim_thd_init : Ice Thermodynamics'
654         WRITE(numout,*) '~~~~~~~~~~~~~'
655         WRITE(numout,*)'   -- limthd_dif --'
656         WRITE(numout,*)'      extinction radiation parameter in sea ice               rn_kappa_i   = ', rn_kappa_i
657         WRITE(numout,*)'      maximal n. of iter. for heat diffusion computation      nn_conv_dif  = ', nn_conv_dif
658         WRITE(numout,*)'      maximal err. on T for heat diffusion computation        rn_terr_dif  = ', rn_terr_dif
659         WRITE(numout,*)'      switch for comp. of thermal conductivity in the ice     nn_ice_thcon = ', nn_ice_thcon
660         WRITE(numout,*)'      iterate the surface non-solar flux (T) or not (F)       ln_it_qnsice = ', ln_it_qnsice
661         WRITE(numout,*)'      virtual ITD mono-category parameterizations (1) or not  nn_monocat   = ', nn_monocat
662         WRITE(numout,*)'   -- limthd_dh --'
663         WRITE(numout,*)'      activate ice thick change from top/bot (T) or not (F)   ln_limdH     = ', ln_limdH
664         WRITE(numout,*)'      coefficient for ice-lead partition of snowfall          rn_betas     = ', rn_betas
665         WRITE(numout,*)'   -- limthd_da --'
666         WRITE(numout,*)'      activate lateral melting (T) or not (F)                 ln_limdA     = ', ln_limdA
667         WRITE(numout,*)'      Coef. beta for lateral melting param.                   rn_beta      = ', rn_beta
668         WRITE(numout,*)'      Minimum floe diameter for lateral melting param.        rn_dmin      = ', rn_dmin
669         WRITE(numout,*)'   -- limthd_lac --'
670         WRITE(numout,*)'      activate ice growth in open-water (T) or not (F)        ln_limdO     = ', ln_limdO
671         WRITE(numout,*)'      ice thick. for lateral accretion                        rn_hnewice   = ', rn_hnewice
672         WRITE(numout,*)'      Frazil ice thickness as a function of wind or not       ln_frazil    = ', ln_frazil
673         WRITE(numout,*)'      Maximum proportion of frazil ice collecting at bottom   rn_maxfrazb  = ', rn_maxfrazb
674         WRITE(numout,*)'      Thresold relative drift speed for collection of frazil  rn_vfrazb    = ', rn_vfrazb
675         WRITE(numout,*)'      Squeezing coefficient for collection of frazil          rn_Cfrazb    = ', rn_Cfrazb
676         WRITE(numout,*)'   -- limitd_th --'
677         WRITE(numout,*)'      minimum ice thickness                                   rn_himin     = ', rn_himin 
678         WRITE(numout,*)'      check heat conservation in the ice/snow                 con_i        = ', con_i
679      ENDIF
680      IF( jpl > 1 .AND. nn_monocat == 1 ) THEN
681         nn_monocat = 0
682         IF(lwp) WRITE(numout,*)
683         IF(lwp) WRITE(numout,*) '   nn_monocat forced to 0 as jpl>1, i.e. multi-category case is chosen'
684      ENDIF
685      !
686   END SUBROUTINE lim_thd_init
687
688#else
689   !!----------------------------------------------------------------------
690   !!   Default option         Dummy module          NO  LIM3 sea-ice model
691   !!----------------------------------------------------------------------
692#endif
693
694   !!======================================================================
695END MODULE limthd
Note: See TracBrowser for help on using the repository browser.