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.
sbcice_lim.F90 in trunk/NEMO/OPA_SRC/SBC – NEMO

source: trunk/NEMO/OPA_SRC/SBC/sbcice_lim.F90 @ 921

Last change on this file since 921 was 921, checked in by rblod, 16 years ago

Correct indentation and print for debug in LIM3, see ticket #134, step I

File size: 34.9 KB
Line 
1MODULE sbcice_lim
2   !!======================================================================
3   !!                       ***  MODULE  sbcice_lim  ***
4   !! Surface module :  update the ocean surface boundary condition over ice
5   !!       &           covered area using LIM sea-ice model
6   !! Sea-Ice model  :  LIM 3.0 Sea ice model time-stepping
7   !!======================================================================
8   !! History :  2.0   !  2006-12  (M. Vancoppenolle) Original code
9   !!            3.0   !  2008-02  (C. Talandier)  Surface module from icestp.F90
10   !!            9.0   !  2008-04  (G. Madec)  sltyle and lim_ctl routine
11   !!----------------------------------------------------------------------
12#if defined key_lim3
13   !!----------------------------------------------------------------------
14   !!   'key_lim3' :                                  LIM 3.0 sea-ice model
15   !!----------------------------------------------------------------------
16   !!   sbc_ice_lim  : sea-ice model time-stepping and update ocean sbc over ice-covered area
17   !!   lim_ctl       : alerts in case of ice model crash
18   !!   lim_prt_state : ice control print at a given grid point
19   !!----------------------------------------------------------------------
20   USE oce             ! ocean dynamics and tracers
21   USE c1d             ! 1d configuration
22   USE dom_oce         ! ocean space and time domain
23   USE par_ice         ! sea-ice parameters
24   USE ice
25   USE iceini
26   USE ice_oce         ! ice variables
27   USE dom_ice
28   USE cpl_oce
29
30   USE sbc_oce         ! Surface boundary condition: ocean fields
31   USE sbc_ice         ! Surface boundary condition: ice   fields
32   USE sbcblk_core     ! Surface boundary condition: CORE bulk
33   USE sbcblk_clio     ! Surface boundary condition: CLIO bulk
34   USE albedo
35
36   USE daymod          ! day calendar
37   USE phycst          ! Define parameters for the routines
38   USE eosbn2          ! equation of state
39   USE limdyn          ! Ice dynamics
40   USE limtrp          ! Ice transport
41   USE limthd          ! Ice thermodynamics
42   USE limitd_th       ! Thermodynamics on ice thickness distribution
43   USE limitd_me       ! Mechanics on ice thickness distribution
44   USE limsbc          ! sea surface boundary condition
45   USE limdia          ! Ice diagnostics
46   USE limwri          ! Ice outputs
47   USE limrst          ! Ice restarts
48   USE limupdate       ! update of global variables
49   USE limvar          ! Ice variables switch
50
51   USE lbclnk
52   USE iom             ! I/O manager library
53   USE in_out_manager  ! I/O manager
54   USE prtctl          ! Print control
55
56   IMPLICIT NONE
57   PRIVATE
58
59   PUBLIC sbc_ice_lim  ! routine called by sbcmod.F90
60   
61   CHARACTER(len=1) ::   cl_grid = 'C'     ! type of grid used in ice dynamics
62
63   INTEGER          ::   nn_ico_cpl = 0    ! ice-ocean coupling indicator:         !!gm   ===>> to be put in namelist
64   !                                       !  = 0   LIM-3 old case
65   !                                       !  = 1   stresses computed using now ocean velocity
66   !                                       !  = 2   combination of 0 and 1 cases
67
68
69   !! * Substitutions
70#  include "domzgr_substitute.h90"
71#  include "vectopt_loop_substitute.h90"
72   !!----------------------------------------------------------------------
73   !! NEMO/LIM 3.0 , UCL-LOCEAN-IPSL  (2008)
74   !! $Id: $
75   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
76   !!----------------------------------------------------------------------
77
78CONTAINS
79
80   SUBROUTINE sbc_ice_lim( kt, kblk, kico )
81      !!---------------------------------------------------------------------
82      !!                  ***  ROUTINE sbc_ice_lim  ***
83      !!                   
84      !! ** Purpose :   update the ocean surface boundary condition via the
85      !!                Louvain la Neuve Sea Ice Model time stepping
86      !!
87      !! ** Method  :   ice model time stepping
88      !!              - call the ice dynamics routine
89      !!              - call the ice advection/diffusion routine
90      !!              - call the ice thermodynamics routine
91      !!              - call the routine that computes mass and
92      !!                heat fluxes at the ice/ocean interface
93      !!              - save the outputs
94      !!              - save the outputs for restart when necessary
95      !!
96      !! ** Action  : - time evolution of the LIM sea-ice model
97      !!              - update all sbc variables below sea-ice:
98      !!                utau, vtau, qns , qsr, emp , emps
99      !!---------------------------------------------------------------------
100      INTEGER, INTENT(in) ::   kt      ! ocean time step
101      INTEGER, INTENT(in) ::   kblk    ! type of bulk (=3 CLIO, =4 CORE)
102      INTEGER, INTENT(in) ::   kico    ! ice-ocean stress treatment
103      !!
104      REAL(wp) ::   zcoef              ! temporary scalar
105      REAL(wp), DIMENSION(jpi,jpj,jpl) ::   alb_ice_os   ! albedo of the ice under overcast sky
106      REAL(wp), DIMENSION(jpi,jpj,jpl) ::   alb_ice_cs   ! albedo of ice under clear sky
107      !!----------------------------------------------------------------------
108
109      IF( kt == nit000 ) THEN
110         IF(lwp) WRITE(numout,*)
111         IF(lwp) WRITE(numout,*) 'sbc_ice_lim : update ocean surface boudary condition' 
112         IF(lwp) WRITE(numout,*) '~~~~~~~~~~~   via Louvain la Neuve Ice Model (LIM-3) time stepping'
113         !
114         CALL ice_init
115         !
116         IF( ln_nicep ) THEN      ! control print at a given point
117            jiindx = 44   ;   jjindx = 140
118            WRITE(numout,*) ' The debugging point is : jiindx : ',jiindx, ' jjindx : ',jjindx
119         ENDIF
120      ENDIF
121
122      !                                        !----------------------!
123      IF( MOD( kt-1, nn_fsbc ) == 0 ) THEN     !  Ice time-step only  !
124         !                                     !----------------------!
125         !                                           !  Bulk Formulea !
126         !                                           !----------------!
127         !
128         u_oce(:,:) = ssu_m(:,:)                     ! mean surface ocean current at ice velocity point
129         v_oce(:,:) = ssv_m(:,:)                     ! (C-grid dynamics :  U- & V-points as the ocean)
130         !
131         t_bo(:,:) = tfreez( sss_m ) +  rt0          ! masked sea surface freezing temperature [Kelvin]
132         !                                           ! (set to rt0 over land)
133         CALL albedo_ice( t_su, ht_i, ht_s, alb_ice_cs, alb_ice_os )  ! ... ice albedo
134
135                                                     ! Bulk formulea - provides the following fields:
136         ! utaui_ice, vtaui_ice : surface ice stress                     (U- & V-points)   [N/m2]
137         ! qsr_ice  , qns_ice   : solar & non solar heat flux over ice   (T-point)         [W/m2]
138         ! qla_ice              : latent heat flux over ice              (T-point)         [W/m2]
139         ! dqns_ice , dqla_ice  : non solar & latent heat sensistivity   (T-point)         [W/m2]
140         ! tprecip  , sprecip   : total & solid precipitation            (T-point)         [Kg/m2/s]
141         ! fr1_i0   , fr2_i0    : 1sr & 2nd fraction of qsr penetration in ice             [%]
142         !
143         SELECT CASE( kblk )
144         CASE( 3 )                                       ! CLIO bulk formulation
145            CALL blk_ice_clio( t_su , u_ice    , v_ice     , alb_ice_cs, alb_ice_os,   &
146               &                      utaui_ice, vtaui_ice , qns_ice   , qsr_ice   ,   &
147               &                      qla_ice  , dqns_ice  , dqla_ice  ,               &
148               &                      tprecip  , sprecip   ,                           &
149               &                      fr1_i0   , fr2_i0    , cl_grid  )
150            !         
151         CASE( 4 )                                       ! CORE bulk formulation
152            CALL blk_ice_core( t_su , u_ice    , v_ice     , alb_ice_cs,               &
153               &                      utaui_ice, vtaui_ice , qns_ice   , qsr_ice   ,   &
154               &                      qla_ice  , dqns_ice  , dqla_ice  ,               &
155               &                      tprecip  , sprecip   ,                           &
156               &                      fr1_i0   , fr2_i0    , cl_grid  )
157         END SELECT
158
159         !                                           !----------------------!
160         !                                           ! LIM-3  time-stepping !
161         !                                           !----------------------!
162         !
163         numit = numit + nn_fsbc                     ! Ice model time step
164         !
165         !                                           ! Store previous ice values
166!!gm : remark   old_...   should becomes ...b  as tn versus tb 
167         old_a_i(:,:,:)   = a_i(:,:,:)     ! ice area
168         old_e_i(:,:,:,:) = e_i(:,:,:,:)   ! ice thermal energy
169         old_v_i(:,:,:)   = v_i(:,:,:)     ! ice volume
170         old_v_s(:,:,:)   = v_s(:,:,:)     ! snow volume
171         old_e_s(:,:,:,:) = e_s(:,:,:,:)   ! snow thermal energy
172         old_smv_i(:,:,:) = smv_i(:,:,:)   ! salt content
173         old_oa_i(:,:,:)  = oa_i(:,:,:)    ! areal age content
174
175         !                                           ! intialisation to zero    !!gm is it truly necessary ???
176         d_a_i_thd(:,:,:)   = 0.e0 ; d_a_i_trp(:,:,:)   = 0.e0
177         d_v_i_thd(:,:,:)   = 0.e0 ; d_v_i_trp(:,:,:)   = 0.e0
178         d_e_i_thd(:,:,:,:) = 0.e0 ; d_e_i_trp(:,:,:,:) = 0.e0
179         d_v_s_thd(:,:,:)   = 0.e0 ; d_v_s_trp(:,:,:)   = 0.e0
180         d_e_s_thd(:,:,:,:) = 0.e0 ; d_e_s_trp(:,:,:,:) = 0.e0
181         d_smv_i_thd(:,:,:) = 0.e0 ; d_smv_i_trp(:,:,:) = 0.e0
182         d_oa_i_thd(:,:,:)  = 0.e0 ; d_oa_i_trp(:,:,:)  = 0.e0
183         !
184         fseqv(:,:)     = 0.e0
185         fsbri(:,:)     = 0.e0     ; fsalt_res(:,:) = 0.e0
186         fsalt_rpo(:,:) = 0.e0
187         fhmec(:,:)     = 0.e0     ; fhbri(:,:)     = 0.e0
188         fmmec(:,:)     = 0.e0     ; fheat_res(:,:) = 0.e0
189         fheat_rpo(:,:) = 0.e0     ; focea2D(:,:)   = 0.e0
190         fsup2D(:,:)    = 0.e0
191         !
192         diag_sni_gr(:,:) = 0.e0   ; diag_lat_gr(:,:) = 0.e0
193         diag_bot_gr(:,:) = 0.e0   ; diag_dyn_gr(:,:) = 0.e0
194         diag_bot_me(:,:) = 0.e0   ; diag_sur_me(:,:) = 0.e0
195         ! dynamical invariants
196         delta_i(:,:) = 0.e0       ; divu_i (:,:) = 0.e0       ;    shear_i(:,:) = 0.e0
197
198                          CALL lim_rst_opn( kt )     ! Open Ice restart file
199         !
200         IF( ln_nicep )   CALL lim_prt_state( jiindx, jjindx, 1, ' - Beginning the time step - ' )   ! control print
201         !
202         IF( .NOT. lk_c1d ) THEN                     ! Ice dynamics & transport (not in 1D case)
203                          CALL lim_dyn( kt )              ! Ice dynamics    ( rheology/dynamics )
204                          CALL lim_trp( kt )              ! Ice transport   ( Advection/diffusion )
205                          CALL lim_var_agg(1)             ! aggregate categories, requested
206                          CALL lim_var_glo2eqv            ! equivalent variables, requested for rafting
207         IF( ln_nicep )   CALL lim_prt_state( jiindx, jjindx,-1, ' - ice dyn & trp - ' )   ! control print
208                          CALL lim_itd_me                 ! Mechanical redistribution ! (ridging/rafting)
209         ENDIF
210         !
211         !                                           ! Ice thermodynamics
212                          CALL lim_var_glo2eqv            ! equivalent variables
213                          CALL lim_var_agg(1)             ! aggregate ice categories
214                          CALL lim_var_bv                 ! bulk brine volume (diag)
215                          CALL lim_thd( kt )              ! Ice thermodynamics
216                          zcoef = rdt_ice / 86400.e0      !  Ice natural aging
217                          oa_i(:,:,:) = oa_i(:,:,:) + a_i(:,:,:) * zcoef
218                          CALL lim_var_glo2eqv            ! this CALL is maybe not necessary (Martin)
219         IF( ln_nicep )   CALL lim_prt_state( jiindx, jjindx, 1, ' - ice thermodyn. - ' )   ! control print
220                          CALL lim_itd_th( kt )           !  Remap ice categories, lateral accretion  !
221         !
222         !                                           ! Global variables update |
223                          CALL lim_var_agg( 1 )           ! requested by limupdate
224                          CALL lim_update                 ! Global variables update
225                          CALL lim_var_glo2eqv            ! equivalent variables (outputs)
226                          CALL lim_var_agg(2)             ! aggregate ice thickness categories
227         IF( ln_nicep )   CALL lim_prt_state( jiindx, jjindx, 2, ' - Final state - ' )   ! control print
228         !
229         !                                           ! Fluxes of mass and heat to the ocean |
230                         CALL lim_sbc_flx( kt )           ! Ice/Ocean heat freshwater/salt fluxes
231         IF( ln_limdyn .AND. kico == 0 )   &              ! Ice/Ocean stresses (only in ice-dynamic case)
232            &            CALL lim_sbc_tau( kt, kico )     ! otherwise the atm.-ocean stresses are used everywhere
233         !
234         IF( ln_nicep )   CALL lim_prt_state( jiindx, jjindx, 3, ' - Final state lim_sbc - ' )   ! control print
235         !
236         !                                           ! Diagnostics and outputs
237                          !                               ! Ice Diagnostics
238         IF( MOD( kt+nn_fsbc-1, ninfo ) == 0 .OR. ntmoy == 1 )   CALL lim_dia 
239                          CALL lim_wri( 1  )              ! Ice outputs
240         IF( lrst_ice )   CALL lim_rst_write( kt )        ! Ice restart file
241                          CALL lim_var_glo2eqv            ! ???
242         !
243         IF( ln_nicep )   CALL lim_ctl               ! alerts in case of model crash
244         !
245      ENDIF                                          ! End sea-ice time step only
246
247      !                                              !--------------------------!
248      ! Ice/Ocean stresses (nn_ico_cpl=1 or 2 cases) !  at all ocean time step  !
249      !                                              !--------------------------!
250      IF( ln_limdyn .AND. nn_ico_cpl /= 0 )   &
251         &                CALL lim_sbc_tau( kt, nn_ico_cpl ) 
252!!gm   remark, in this case the ocean-ice stress is not saved in diag call above .....  find a solution!!!
253      !
254   END SUBROUTINE sbc_ice_lim
255
256
257   SUBROUTINE lim_ctl
258      !!-----------------------------------------------------------------------
259      !!                   ***  ROUTINE lim_ctl ***
260      !!                 
261      !! ** Purpose :   Alerts in case of model crash
262      !!-------------------------------------------------------------------
263      INTEGER  ::   ji, jj, jk,  jl   ! dummy loop indices
264      INTEGER  ::   inb_altests       ! number of alert tests (max 20)
265      INTEGER  ::   ialert_id         ! number of the current alert
266      REAL(wp) ::   ztmelts           ! ice layer melting point
267      CHARACTER (len=30), DIMENSION(20)      ::   cl_alname   ! name of alert
268      INTEGER           , DIMENSION(20)      ::   inb_alp     ! number of alerts positive
269      !!-------------------------------------------------------------------
270
271      inb_altests = 10
272      inb_alp(:) = 0
273
274      ! Alert if incompatible volume and concentration
275      ialert_id = 2 ! reference number of this alert
276      cl_alname(ialert_id) = ' Incompat vol and con         '    ! name of the alert
277
278      DO jl = 1, jpl
279         DO jj = 1, jpj
280            DO ji = 1, jpi
281               IF(  v_i(ji,jj,jl) /= 0.e0   .AND.   a_i(ji,jj,jl) == 0.e0   ) THEN
282                  WRITE(numout,*) ' ALERTE 2 :   Incompatible volume and concentration '
283                  WRITE(numout,*) ' at_i     ', at_i(ji,jj)
284                  WRITE(numout,*) ' Point - category', ji, jj, jl
285                  WRITE(numout,*) ' a_i *** a_i_old ', a_i      (ji,jj,jl), old_a_i  (ji,jj,jl)
286                  WRITE(numout,*) ' v_i *** v_i_old ', v_i      (ji,jj,jl), old_v_i  (ji,jj,jl)
287                  WRITE(numout,*) ' d_a_i_thd/trp   ', d_a_i_thd(ji,jj,jl), d_a_i_trp(ji,jj,jl)
288                  WRITE(numout,*) ' d_v_i_thd/trp   ', d_v_i_thd(ji,jj,jl), d_v_i_trp(ji,jj,jl)
289                  inb_alp(ialert_id) = inb_alp(ialert_id) + 1
290               ENDIF
291            END DO
292         END DO
293      END DO
294
295      ! Alerte if very thick ice
296      ialert_id = 3 ! reference number of this alert
297      cl_alname(ialert_id) = ' Very thick ice               ' ! name of the alert
298      jl = jpl 
299      DO jj = 1, jpj
300         DO ji = 1, jpi
301            IF(   ht_i(ji,jj,jl) .GT. 50.0   ) THEN
302               CALL lim_prt_state( ji, jj, 2, ' ALERTE 3 :   Very thick ice ' )
303               inb_alp(ialert_id) = inb_alp(ialert_id) + 1
304            ENDIF
305         END DO
306      END DO
307
308      ! Alert if very fast ice
309      ialert_id = 4 ! reference number of this alert
310      cl_alname(ialert_id) = ' Very fast ice               ' ! name of the alert
311      DO jj = 1, jpj
312         DO ji = 1, jpi
313            IF(   MAX( ABS( u_ice(ji,jj) ), ABS( v_ice(ji,jj) ) ) .GT. 0.5  .AND.  &
314               &  at_i(ji,jj) .GT. 0.e0   ) THEN
315               CALL lim_prt_state( ji, jj, 1, ' ALERTE 4 :   Very fast ice ' )
316               WRITE(numout,*) ' ice strength             : ', strength(ji,jj)
317               WRITE(numout,*) ' oceanic stress utau      : ', utau(ji,jj) 
318               WRITE(numout,*) ' oceanic stress vtau      : ', vtau(ji,jj)
319               WRITE(numout,*) ' sea-ice stress utaui_ice : ', utaui_ice(ji,jj) 
320               WRITE(numout,*) ' sea-ice stress vtaui_ice : ', vtaui_ice(ji,jj)
321               WRITE(numout,*) ' oceanic speed u          : ', u_oce(ji,jj)
322               WRITE(numout,*) ' oceanic speed v          : ', v_oce(ji,jj)
323               WRITE(numout,*) ' sst                      : ', sst_m(ji,jj)
324               WRITE(numout,*) ' sss                      : ', sss_m(ji,jj)
325               WRITE(numout,*) 
326               inb_alp(ialert_id) = inb_alp(ialert_id) + 1
327            ENDIF
328         END DO
329      END DO
330
331      ! Alert if there is ice on continents
332      ialert_id = 6 ! reference number of this alert
333      cl_alname(ialert_id) = ' Ice on continents           ' ! name of the alert
334      DO jj = 1, jpj
335         DO ji = 1, jpi
336            IF(   tms(ji,jj) .LE. 0.0   .AND.   at_i(ji,jj) .GT. 0.e0   ) THEN
337               CALL lim_prt_state( ji, jj, 1, ' ALERTE 6 :   Ice on continents ' )
338               WRITE(numout,*) ' masks s, u, v        : ', tms(ji,jj), tmu(ji,jj), tmv(ji,jj) 
339               WRITE(numout,*) ' sst                  : ', sst_m(ji,jj)
340               WRITE(numout,*) ' sss                  : ', sss_m(ji,jj)
341               WRITE(numout,*) ' at_i(ji,jj)          : ', at_i(ji,jj)
342               WRITE(numout,*) ' v_ice(ji,jj)         : ', v_ice(ji,jj)
343               WRITE(numout,*) ' v_ice(ji,jj-1)       : ', v_ice(ji,jj-1)
344               WRITE(numout,*) ' u_ice(ji-1,jj)       : ', u_ice(ji-1,jj)
345               WRITE(numout,*) ' u_ice(ji,jj)         : ', v_ice(ji,jj)
346               !
347               inb_alp(ialert_id) = inb_alp(ialert_id) + 1
348            ENDIF
349         END DO
350      END DO
351
352!
353!     ! Alert if very fresh ice
354      ialert_id = 7 ! reference number of this alert
355      cl_alname(ialert_id) = ' Very fresh ice               ' ! name of the alert
356      DO jl = 1, jpl
357         DO jj = 1, jpj
358            DO ji = 1, jpi
359!!gm  test twice sm_i ...  ????  bug?
360               IF( ( ( ABS( sm_i(ji,jj,jl) ) .LT. 0.50) .OR. &
361                     ( ABS( sm_i(ji,jj,jl) ) .LT. 0.50) ) .AND. &
362                             ( a_i(ji,jj,jl) .GT. 0.e0 ) ) THEN
363!                 CALL lim_prt_state(ji,jj,1, ' ALERTE 7 :   Very fresh ice ' )
364!                 WRITE(numout,*) ' sst                  : ', sst_m(ji,jj)
365!                 WRITE(numout,*) ' sss                  : ', sss_m(ji,jj)
366!                 WRITE(numout,*) ' s_i_newice           : ', s_i_newice(ji,jj,1:jpl)
367!                 WRITE(numout,*)
368                  inb_alp(ialert_id) = inb_alp(ialert_id) + 1
369               ENDIF
370            END DO
371         END DO
372      END DO
373!
374
375!     ! Alert if too old ice
376      ialert_id = 9 ! reference number of this alert
377      cl_alname(ialert_id) = ' Very old   ice               ' ! name of the alert
378      DO jl = 1, jpl
379         DO jj = 1, jpj
380            DO ji = 1, jpi
381               IF ( ( ( ABS( o_i(ji,jj,jl) ) .GT. rdt_ice ) .OR. &
382                      ( ABS( o_i(ji,jj,jl) ) .LT. 0.00) ) .AND. &
383                             ( a_i(ji,jj,jl) .GT. 0.0 ) ) THEN
384                  CALL lim_prt_state( ji, jj, 1, ' ALERTE 9 :   Wrong ice age ')
385                  inb_alp(ialert_id) = inb_alp(ialert_id) + 1
386               ENDIF
387            END DO
388         END DO
389      END DO
390 
391      ! Alert on salt flux
392      ialert_id = 5 ! reference number of this alert
393      cl_alname(ialert_id) = ' High salt flux               ' ! name of the alert
394      DO jj = 1, jpj
395         DO ji = 1, jpi
396            IF( ABS( emps(ji,jj) ) .GT. 1.0e-2 ) THEN
397               CALL lim_prt_state( ji, jj, 3, ' ALERTE 5 :   High salt flux ' )
398               DO jl = 1, jpl
399                  WRITE(numout,*) ' Category no: ', jl
400                  WRITE(numout,*) ' a_i        : ', a_i      (ji,jj,jl) , ' old_a_i    : ', old_a_i  (ji,jj,jl)   
401                  WRITE(numout,*) ' d_a_i_trp  : ', d_a_i_trp(ji,jj,jl) , ' d_a_i_thd  : ', d_a_i_thd(ji,jj,jl) 
402                  WRITE(numout,*) ' v_i        : ', v_i      (ji,jj,jl) , ' old_v_i    : ', old_v_i  (ji,jj,jl)   
403                  WRITE(numout,*) ' d_v_i_trp  : ', d_v_i_trp(ji,jj,jl) , ' d_v_i_thd  : ', d_v_i_thd(ji,jj,jl) 
404                  WRITE(numout,*) ' '
405               END DO
406               inb_alp(ialert_id) = inb_alp(ialert_id) + 1
407            ENDIF
408         END DO
409      END DO
410
411      ! Alert if qns very big
412      ialert_id = 8 ! reference number of this alert
413      cl_alname(ialert_id) = ' fnsolar very big             ' ! name of the alert
414      DO jj = 1, jpj
415         DO ji = 1, jpi
416            IF(   ABS( qns(ji,jj) ) .GT. 1500.0   .AND.  ( at_i(ji,jj) .GT. 0.0 ) )  THEN
417               !
418               WRITE(numout,*) ' ALERTE 8 :   Very high non-solar heat flux'
419               WRITE(numout,*) ' ji, jj    : ', ji, jj
420               WRITE(numout,*) ' qns       : ', qns(ji,jj)
421               WRITE(numout,*) ' sst       : ', sst_m(ji,jj)
422               WRITE(numout,*) ' sss       : ', sss_m(ji,jj)
423               WRITE(numout,*) ' qcmif     : ', qcmif(ji,jj)
424               WRITE(numout,*) ' qldif     : ', qldif(ji,jj)
425               WRITE(numout,*) ' qcmif     : ', qcmif(ji,jj) / rdt_ice
426               WRITE(numout,*) ' qldif     : ', qldif(ji,jj) / rdt_ice
427               WRITE(numout,*) ' qfvbq     : ', qfvbq(ji,jj)
428               WRITE(numout,*) ' qdtcn     : ', qdtcn(ji,jj)
429               WRITE(numout,*) ' qfvbq / dt: ', qfvbq(ji,jj) / rdt_ice
430               WRITE(numout,*) ' qdtcn / dt: ', qdtcn(ji,jj) / rdt_ice
431               WRITE(numout,*) ' fdtcn     : ', fdtcn(ji,jj) 
432               WRITE(numout,*) ' fhmec     : ', fhmec(ji,jj) 
433               WRITE(numout,*) ' fheat_rpo : ', fheat_rpo(ji,jj) 
434               WRITE(numout,*) ' fheat_res : ', fheat_res(ji,jj) 
435               WRITE(numout,*) ' fhbri     : ', fhbri(ji,jj) 
436               !
437               CALL lim_prt_state( ji, jj, 2, '   ')
438               inb_alp(ialert_id) = inb_alp(ialert_id) + 1
439               !
440            ENDIF
441         END DO
442      END DO
443      !+++++
444 
445      ! Alert if very warm ice
446      ialert_id = 10 ! reference number of this alert
447      cl_alname(ialert_id) = ' Very warm ice                ' ! name of the alert
448      inb_alp(ialert_id) = 0
449      DO jl = 1, jpl
450         DO jk = 1, nlay_i
451            DO jj = 1, jpj
452               DO ji = 1, jpi
453                  ztmelts    =  -tmut * s_i(ji,jj,jk,jl) + rtt
454                  IF( t_i(ji,jj,jk,jl) .GE. ztmelts  .AND.  v_i(ji,jj,jl) .GT. 1.e-6   &
455                     &                               .AND.  a_i(ji,jj,jl) .GT. 0.e0    ) THEN
456                     WRITE(numout,*) ' ALERTE 10 :   Very warm ice'
457                     WRITE(numout,*) ' ji, jj, jk, jl : ', ji, jj, jk, jl
458                     WRITE(numout,*) ' t_i : ', t_i(ji,jj,jk,jl)
459                     WRITE(numout,*) ' e_i : ', e_i(ji,jj,jk,jl)
460                     WRITE(numout,*) ' s_i : ', s_i(ji,jj,jk,jl)
461                     WRITE(numout,*) ' ztmelts : ', ztmelts
462                     inb_alp(ialert_id) = inb_alp(ialert_id) + 1
463                  ENDIF
464               END DO
465            END DO
466         END DO
467      END DO
468
469      ialert_id = 1                                 ! reference number of this alert
470      cl_alname(ialert_id) = ' NO alerte 1      '   ! name of the alert
471      WRITE(numout,*)
472      WRITE(numout,*) ' All alerts at the end of ice model '
473      DO ialert_id = 1, inb_altests
474         WRITE(numout,*) ialert_id, cl_alname(ialert_id)//' : ', inb_alp(ialert_id), ' times ! '
475      END DO
476      !
477   END SUBROUTINE lim_ctl
478 
479   
480   SUBROUTINE lim_prt_state( ki, kj, kn, cd1 )
481      !!-----------------------------------------------------------------------
482      !!                   ***  ROUTINE lim_prt_state ***
483      !!                 
484      !! ** Purpose :   Writes global ice state on the (i,j) point
485      !!                in ocean.ouput
486      !!                3 possibilities exist
487      !!                n = 1/-1 -> simple ice state (plus Mechanical Check if -1)
488      !!                n = 2    -> exhaustive state
489      !!                n = 3    -> ice/ocean salt fluxes
490      !!
491      !! ** input   :   point coordinates (i,j)
492      !!                n : number of the option
493      !!-------------------------------------------------------------------
494      INTEGER         , INTENT(in) ::   ki, kj, kn    ! ocean gridpoint indices
495      CHARACTER(len=*), INTENT(in) ::   cd1           !
496      !!
497      INTEGER :: jl
498      !!-------------------------------------------------------------------
499
500      WRITE(numout,*) cd1             ! print title
501
502      !----------------
503      !  Simple state
504      !----------------
505
506      IF ( kn == 1 .OR. kn == -1 ) THEN
507         WRITE(numout,*) ' lim_prt_state - Point : ',ki,kj
508         WRITE(numout,*) ' ~~~~~~~~~~~~~~ '
509         WRITE(numout,*) ' Simple state '
510         WRITE(numout,*) ' masks s,u,v   : ', tms(ki,kj), tmu(ki,kj), tmv(ki,kj)
511         WRITE(numout,*) ' lat - long    : ', gphit(ki,kj), glamt(ki,kj)
512         WRITE(numout,*) ' Time step     : ', numit
513         WRITE(numout,*) ' - Ice drift   '
514         WRITE(numout,*) '   ~~~~~~~~~~~ '
515         WRITE(numout,*) ' u_ice(i-1,j)  : ', u_ice(ki-1,kj)
516         WRITE(numout,*) ' u_ice(i  ,j)  : ', u_ice(ki,kj)
517         WRITE(numout,*) ' v_ice(i  ,j-1): ', v_ice(ki,kj-1)
518         WRITE(numout,*) ' v_ice(i  ,j)  : ', v_ice(ki,kj)
519         WRITE(numout,*) ' strength      : ', strength(ki,kj)
520         WRITE(numout,*)
521         WRITE(numout,*) ' - Cell values '
522         WRITE(numout,*) '   ~~~~~~~~~~~ '
523         WRITE(numout,*) ' cell area     : ', area(ki,kj)
524         WRITE(numout,*) ' at_i          : ', at_i(ki,kj)       
525         WRITE(numout,*) ' vt_i          : ', vt_i(ki,kj)       
526         WRITE(numout,*) ' vt_s          : ', vt_s(ki,kj)       
527         DO jl = 1, jpl
528            WRITE(numout,*) ' - Category (', jl,')'
529            WRITE(numout,*) ' a_i           : ', a_i(ki,kj,jl)
530            WRITE(numout,*) ' ht_i          : ', ht_i(ki,kj,jl)
531            WRITE(numout,*) ' ht_s          : ', ht_s(ki,kj,jl)
532            WRITE(numout,*) ' v_i           : ', v_i(ki,kj,jl)
533            WRITE(numout,*) ' v_s           : ', v_s(ki,kj,jl)
534            WRITE(numout,*) ' e_s           : ', e_s(ki,kj,1,jl)/1.0e9
535            WRITE(numout,*) ' e_i           : ', e_i(ki,kj,1:nlay_i,jl)/1.0e9
536            WRITE(numout,*) ' t_su          : ', t_su(ki,kj,jl)
537            WRITE(numout,*) ' t_snow        : ', t_s(ki,kj,1,jl)
538            WRITE(numout,*) ' t_i           : ', t_i(ki,kj,1:nlay_i,jl)
539            WRITE(numout,*) ' sm_i          : ', sm_i(ki,kj,jl)
540            WRITE(numout,*) ' smv_i         : ', smv_i(ki,kj,jl)
541            WRITE(numout,*)
542            WRITE(numout,*) ' Pathological case : ', patho_case(ki,kj,jl)
543         END DO
544      ENDIF
545      IF( kn == -1 ) THEN
546         WRITE(numout,*) ' Mechanical Check ************** '
547         WRITE(numout,*) ' Check what means ice divergence '
548         WRITE(numout,*) ' Total ice concentration ', at_i (ki,kj)
549         WRITE(numout,*) ' Total lead fraction     ', ato_i(ki,kj)
550         WRITE(numout,*) ' Sum of both             ', ato_i(ki,kj) + at_i(ki,kj)
551         WRITE(numout,*) ' Sum of both minus 1     ', ato_i(ki,kj) + at_i(ki,kj) - 1.00
552      ENDIF
553
554
555      !--------------------
556      !  Exhaustive state
557      !--------------------
558
559      IF ( kn .EQ. 2 ) THEN
560         WRITE(numout,*) ' lim_prt_state - Point : ',ki,kj
561         WRITE(numout,*) ' ~~~~~~~~~~~~~~ '
562         WRITE(numout,*) ' Exhaustive state '
563         WRITE(numout,*) ' lat - long ', gphit(ki,kj), glamt(ki,kj)
564         WRITE(numout,*) ' Time step ', numit
565         WRITE(numout,*) 
566         WRITE(numout,*) ' - Cell values '
567         WRITE(numout,*) '   ~~~~~~~~~~~ '
568         WRITE(numout,*) ' cell area     : ', area(ki,kj)
569         WRITE(numout,*) ' at_i          : ', at_i(ki,kj)       
570         WRITE(numout,*) ' vt_i          : ', vt_i(ki,kj)       
571         WRITE(numout,*) ' vt_s          : ', vt_s(ki,kj)       
572         WRITE(numout,*) ' u_ice(i-1,j)  : ', u_ice(ki-1,kj)
573         WRITE(numout,*) ' u_ice(i  ,j)  : ', u_ice(ki,kj)
574         WRITE(numout,*) ' v_ice(i  ,j-1): ', v_ice(ki,kj-1)
575         WRITE(numout,*) ' v_ice(i  ,j)  : ', v_ice(ki,kj)
576         WRITE(numout,*) ' strength      : ', strength(ki,kj)
577         WRITE(numout,*) ' d_u_ice_dyn   : ', d_u_ice_dyn(ki,kj), ' d_v_ice_dyn   : ', d_v_ice_dyn(ki,kj)
578         WRITE(numout,*) ' old_u_ice     : ', old_u_ice(ki,kj)  , ' old_v_ice     : ', old_v_ice(ki,kj) 
579         WRITE(numout,*)
580
581         DO jl = 1, jpl
582              WRITE(numout,*) ' - Category (',jl,')'
583              WRITE(numout,*) '   ~~~~~~~~         ' 
584              WRITE(numout,*) ' ht_i       : ', ht_i(ki,kj,jl)             , ' ht_s       : ', ht_s(ki,kj,jl)
585              WRITE(numout,*) ' t_i        : ', t_i(ki,kj,1:nlay_i,jl)
586              WRITE(numout,*) ' t_su       : ', t_su(ki,kj,jl)             , ' t_s        : ', t_s(ki,kj,1,jl)
587              WRITE(numout,*) ' sm_i       : ', sm_i(ki,kj,jl)             , ' o_i        : ', o_i(ki,kj,jl)
588              WRITE(numout,*) ' a_i        : ', a_i(ki,kj,jl)              , ' old_a_i    : ', old_a_i(ki,kj,jl)   
589              WRITE(numout,*) ' d_a_i_trp  : ', d_a_i_trp(ki,kj,jl)        , ' d_a_i_thd  : ', d_a_i_thd(ki,kj,jl) 
590              WRITE(numout,*) ' v_i        : ', v_i(ki,kj,jl)              , ' old_v_i    : ', old_v_i(ki,kj,jl)   
591              WRITE(numout,*) ' d_v_i_trp  : ', d_v_i_trp(ki,kj,jl)        , ' d_v_i_thd  : ', d_v_i_thd(ki,kj,jl) 
592              WRITE(numout,*) ' v_s        : ', v_s(ki,kj,jl)              , ' old_v_s    : ', old_v_s(ki,kj,jl) 
593              WRITE(numout,*) ' d_v_s_trp  : ', d_v_s_trp(ki,kj,jl)        , ' d_v_s_thd  : ', d_v_s_thd(ki,kj,jl)
594              WRITE(numout,*) ' e_i1       : ', e_i(ki,kj,1,jl)/1.0e9      , ' old_ei1    : ', old_e_i(ki,kj,1,jl)/1.0e9 
595              WRITE(numout,*) ' de_i1_trp  : ', d_e_i_trp(ki,kj,1,jl)/1.0e9, ' de_i1_thd  : ', d_e_i_thd(ki,kj,1,jl)/1.0e9
596              WRITE(numout,*) ' e_i2       : ', e_i(ki,kj,2,jl)/1.0e9      , ' old_ei2    : ', old_e_i(ki,kj,2,jl)/1.0e9 
597              WRITE(numout,*) ' de_i2_trp  : ', d_e_i_trp(ki,kj,2,jl)/1.0e9, ' de_i2_thd  : ', d_e_i_thd(ki,kj,2,jl)/1.0e9
598              WRITE(numout,*) ' e_snow     : ', e_s(ki,kj,1,jl)            , ' old_e_snow : ', old_e_s(ki,kj,1,jl) 
599              WRITE(numout,*) ' d_e_s_trp  : ', d_e_s_trp(ki,kj,1,jl)      , ' d_e_s_thd  : ', d_e_s_thd(ki,kj,1,jl)
600              WRITE(numout,*) ' smv_i      : ', smv_i(ki,kj,jl)            , ' old_smv_i  : ', old_smv_i(ki,kj,jl)   
601              WRITE(numout,*) ' d_smv_i_trp: ', d_smv_i_trp(ki,kj,jl)      , ' d_smv_i_thd: ', d_smv_i_thd(ki,kj,jl) 
602              WRITE(numout,*) ' oa_i       : ', oa_i(ki,kj,jl)             , ' old_oa_i   : ', old_oa_i(ki,kj,jl)
603              WRITE(numout,*) ' d_oa_i_trp : ', d_oa_i_trp(ki,kj,jl)       , ' d_oa_i_thd : ', d_oa_i_thd(ki,kj,jl)
604              WRITE(numout,*) ' Path. case : ', patho_case(ki,kj,jl)
605        END DO !jl
606
607        WRITE(numout,*)
608        WRITE(numout,*) ' - Heat / FW fluxes '
609        WRITE(numout,*) '   ~~~~~~~~~~~~~~~~ '
610!       WRITE(numout,*) ' fsbri      : ', fsbri(ki,kj)
611!       WRITE(numout,*) ' fseqv      : ', fseqv(ki,kj)
612!       WRITE(numout,*) ' fsalt_res  : ', fsalt_res(ki,kj)
613        WRITE(numout,*) ' fmmec      : ', fmmec(ki,kj)
614        WRITE(numout,*) ' fhmec      : ', fhmec(ki,kj)
615        WRITE(numout,*) ' fhbri      : ', fhbri(ki,kj)
616        WRITE(numout,*) ' fheat_rpo  : ', fheat_rpo(ki,kj)
617        WRITE(numout,*) 
618        WRITE(numout,*) ' sst        : ', sst_m(ki,kj) 
619        WRITE(numout,*) ' sss        : ', sss_m(ki,kj) 
620        WRITE(numout,*) 
621        WRITE(numout,*) ' - Stresses '
622        WRITE(numout,*) '   ~~~~~~~~ '
623        WRITE(numout,*) ' utaui_ice  : ', utaui_ice(ki,kj) 
624        WRITE(numout,*) ' vtaui_ice  : ', vtaui_ice(ki,kj)
625        WRITE(numout,*) ' utau       : ', utau(ki,kj) 
626        WRITE(numout,*) ' vtau       : ', vtau(ki,kj)
627        WRITE(numout,*) ' oc. vel. u : ', u_oce(ki,kj)
628        WRITE(numout,*) ' oc. vel. v : ', v_oce(ki,kj)
629     ENDIF
630
631     !---------------------
632     ! Salt / heat fluxes
633     !---------------------
634
635     IF ( kn .EQ. 3 ) THEN
636        WRITE(numout,*) ' lim_prt_state - Point : ',ki,kj
637        WRITE(numout,*) ' ~~~~~~~~~~~~~~ '
638        WRITE(numout,*) ' - Salt / Heat Fluxes '
639        WRITE(numout,*) '   ~~~~~~~~~~~~~~~~ '
640        WRITE(numout,*) ' lat - long ', gphit(ki,kj), glamt(ki,kj)
641        WRITE(numout,*) ' Time step ', numit
642        WRITE(numout,*)
643        WRITE(numout,*) ' - Heat fluxes at bottom interface ***'
644        WRITE(numout,*) ' qsr        : ', qsr(ki,kj)
645        WRITE(numout,*) ' qns        : ', qns(ki,kj)
646        WRITE(numout,*)
647        WRITE(numout,*) ' - Salt fluxes at bottom interface ***'
648        WRITE(numout,*) ' emps       : ', emps(ki,kj)
649        WRITE(numout,*) ' emp        : ', emp(ki,kj)
650        WRITE(numout,*) ' fsbri      : ', fsbri(ki,kj)
651        WRITE(numout,*) ' fseqv      : ', fseqv(ki,kj)
652        WRITE(numout,*) ' fsalt_res  : ', fsalt_res(ki,kj)
653        WRITE(numout,*) ' fsalt_rpo  : ', fsalt_rpo(ki,kj)
654        WRITE(numout,*) ' - Heat fluxes at bottom interface ***'
655        WRITE(numout,*) ' fheat_res  : ', fheat_res(ki,kj)
656        WRITE(numout,*)
657        WRITE(numout,*) ' - Momentum fluxes '
658        WRITE(numout,*) ' utau      : ', utau(ki,kj) 
659        WRITE(numout,*) ' vtau      : ', vtau(ki,kj)
660      ENDIF
661      WRITE(numout,*) ' '
662      !
663   END SUBROUTINE lim_prt_state
664
665#else
666   !!----------------------------------------------------------------------
667   !!   Default option           Dummy module      NO LIM 3.0 sea-ice model
668   !!----------------------------------------------------------------------
669CONTAINS
670   SUBROUTINE sbc_ice_lim ( kt, kblk )     ! Dummy routine
671      WRITE(*,*) 'sbc_ice_lim: You should not have seen this print! error?', kt, kblk
672   END SUBROUTINE sbc_ice_lim
673#endif
674
675   !!======================================================================
676END MODULE sbcice_lim
Note: See TracBrowser for help on using the repository browser.