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.
icecor.F90 in NEMO/trunk/src/ICE – NEMO

source: NEMO/trunk/src/ICE/icecor.F90 @ 14433

Last change on this file since 14433 was 14433, checked in by smasson, 3 years ago

trunk: merge dev_r14312_MPI_Interface into the trunk, #2598

  • Property svn:keywords set to Id
File size: 7.7 KB
RevLine 
[8586]1MODULE icecor
2   !!======================================================================
3   !!                     ***  MODULE  icecor  ***
[9604]4   !!   sea-ice: Corrections on sea-ice variables at the end of the time step
[8586]5   !!======================================================================
6   !! History :  3.0  !  2006-04  (M. Vancoppenolle) Original code
7   !!            3.5  !  2014-06  (C. Rousset)       Complete rewriting/cleaning
[9604]8   !!            4.0  !  2018     (many people)      SI3 [aka Sea Ice cube]
[8586]9   !!----------------------------------------------------------------------
[9570]10#if defined key_si3
[8586]11   !!----------------------------------------------------------------------
[9570]12   !!   'key_si3'                                       SI3 sea-ice model
[8586]13   !!----------------------------------------------------------------------
14   !!    ice_cor      : corrections on sea-ice variables
15   !!----------------------------------------------------------------------
16   USE dom_oce        ! ocean domain
17   USE phycst         ! physical constants
18   USE ice            ! sea-ice: variable
[11536]19   USE ice1D          ! sea-ice: thermodynamic variables
[8586]20   USE iceitd         ! sea-ice: rebining
21   USE icevar         ! sea-ice: operations
22   USE icectl         ! sea-ice: control prints
23   !
24   USE in_out_manager ! I/O manager
25   USE iom            ! I/O manager library
26   USE lib_mpp        ! MPP library
27   USE lib_fortran    ! fortran utilities (glob_sum + no signed zero)
28   USE lbclnk         ! lateral boundary conditions (or mpp links)
29   USE timing         ! Timing
30
31   IMPLICIT NONE
32   PRIVATE
33
34   PUBLIC   ice_cor   ! called by icestp.F90
35
36   !! * Substitutions
[12377]37#  include "do_loop_substitute.h90"
[8586]38   !!----------------------------------------------------------------------
[9598]39   !! NEMO/ICE 4.0 , NEMO Consortium (2018)
[10069]40   !! $Id$
[10068]41   !! Software governed by the CeCILL license (see ./LICENSE)
[8586]42   !!----------------------------------------------------------------------
43CONTAINS
44
45   SUBROUTINE ice_cor( kt, kn )
46      !!----------------------------------------------------------------------
47      !!               ***  ROUTINE ice_cor  ***
48      !!               
49      !! ** Purpose :   Computes corrections on sea-ice global variables at
50      !!              the end of the dynamics (kn=1) and thermodynamics (kn=2)
51      !!----------------------------------------------------------------------
52      INTEGER, INTENT(in) ::   kt    ! number of iteration
53      INTEGER, INTENT(in) ::   kn    ! 1 = after dyn ; 2 = after thermo
54      !
55      INTEGER  ::   ji, jj, jk, jl   ! dummy loop indices
56      REAL(wp) ::   zsal, zzc
57      !!----------------------------------------------------------------------
58      ! controls
[9124]59      IF( ln_timing    )   CALL timing_start('icecor')                                                             ! timing
60      IF( ln_icediachk )   CALL ice_cons_hsm(0, 'icecor', rdiag_v, rdiag_s, rdiag_t, rdiag_fv, rdiag_fs, rdiag_ft) ! conservation
[11536]61      IF( ln_icediachk )   CALL ice_cons2D  (0, 'icecor',  diag_v,  diag_s,  diag_t,  diag_fv,  diag_fs,  diag_ft) ! conservation
[8586]62      !
63      IF( kt == nit000 .AND. lwp .AND. kn == 2 ) THEN
64         WRITE(numout,*)
65         WRITE(numout,*) 'ice_cor:  correct sea ice variables if out of bounds ' 
66         WRITE(numout,*) '~~~~~~~'
67      ENDIF
68      !                             !-----------------------------------------------------
[10994]69      !                             !  ice thickness must exceed himin (for temp. diff.) !
[9415]70      !                             !-----------------------------------------------------
71      WHERE( a_i(:,:,:) >= epsi20 )   ;   h_i(:,:,:) = v_i(:,:,:) / a_i(:,:,:)
72      ELSEWHERE                       ;   h_i(:,:,:) = 0._wp
73      END WHERE
74      WHERE( h_i(:,:,:) < rn_himin )      a_i(:,:,:) = a_i(:,:,:) * h_i(:,:,:) / rn_himin
75      !
76      !                             !-----------------------------------------------------
[8586]77      !                             !  ice concentration should not exceed amax          !
78      !                             !-----------------------------------------------------
79      at_i(:,:) = SUM( a_i(:,:,:), dim=3 )
[11536]80      DO jl = 1, jpl
[8586]81         WHERE( at_i(:,:) > rn_amax_2d(:,:) )   a_i(:,:,jl) = a_i(:,:,jl) * rn_amax_2d(:,:) / at_i(:,:)
[13472]82      END DO   
[8586]83      !                             !-----------------------------------------------------
[13472]84      !                             !  Rebin categories with thickness out of bounds     !
85      !                             !-----------------------------------------------------
86      IF ( jpl > 1 )   CALL ice_itd_reb( kt )
87      !
88      !                             !-----------------------------------------------------
[8586]89      IF ( nn_icesal == 2 ) THEN    !  salinity must stay in bounds [Simin,Simax]        !
[11536]90         !                          !-----------------------------------------------------
[12489]91         zzc = rhoi * r1_Dt_ice
[8586]92         DO jl = 1, jpl
[13295]93            DO_2D( 1, 1, 1, 1 )
[12377]94               zsal = sv_i(ji,jj,jl)
95               sv_i(ji,jj,jl) = MIN(  MAX( rn_simin*v_i(ji,jj,jl) , sv_i(ji,jj,jl) ) , rn_simax*v_i(ji,jj,jl)  )
[13601]96               IF( kn /= 0 ) & ! no ice-ocean exchanges if kn=0 (for bdy for instance) otherwise conservation diags will fail
97                  &   sfx_res(ji,jj) = sfx_res(ji,jj) - ( sv_i(ji,jj,jl) - zsal ) * zzc   ! associated salt flux
[12377]98            END_2D
[8586]99         END DO
100      ENDIF
101
[13601]102      IF( kn /= 0 ) THEN   ! no zapsmall if kn=0 (for bdy for instance) because we do not want ice-ocean exchanges (wfx,sfx,hfx)
103         !                                                              otherwise conservation diags will fail
104         !                          !-----------------------------------------------------
105         CALL ice_var_zapsmall      !  Zap small values                                  !
106         !                          !-----------------------------------------------------
107      ENDIF
[8586]108      !                             !-----------------------------------------------------
109      IF( kn == 2 ) THEN            !  Ice drift case: Corrections to avoid wrong values !
[13497]110         DO_2D( 0, 0, 0, 0 )        !-----------------------------------------------------
[12377]111            IF ( at_i(ji,jj) == 0._wp ) THEN    ! what to do if there is no ice
112               IF ( at_i(ji+1,jj) == 0._wp )   u_ice(ji  ,jj) = 0._wp   ! right side
113               IF ( at_i(ji-1,jj) == 0._wp )   u_ice(ji-1,jj) = 0._wp   ! left side
114               IF ( at_i(ji,jj+1) == 0._wp )   v_ice(ji,jj  ) = 0._wp   ! upper side
115               IF ( at_i(ji,jj-1) == 0._wp )   v_ice(ji,jj-1) = 0._wp   ! bottom side
116            ENDIF
117         END_2D
[14433]118         CALL lbc_lnk( 'icecor', u_ice, 'U', -1.0_wp, v_ice, 'V', -1.0_wp )
[8586]119      ENDIF
120      !
121      ! controls
[12377]122      IF( sn_cfctl%l_prtctl ) &
123         &                 CALL ice_prt3D   ('icecor')                                                             ! prints
[11536]124      IF( ln_icectl .AND. kn == 2 ) &
125         &                 CALL ice_prt     ( kt, iiceprt, jiceprt, 2, ' - Final state - ' )                       ! prints
126      IF( ln_icediachk )   CALL ice_cons_hsm(1, 'icecor', rdiag_v, rdiag_s, rdiag_t, rdiag_fv, rdiag_fs, rdiag_ft) ! conservation
127      IF( ln_icediachk )   CALL ice_cons2D  (1, 'icecor',  diag_v,  diag_s,  diag_t,  diag_fv,  diag_fs,  diag_ft) ! conservation
128      IF( ln_timing    )   CALL timing_stop ('icecor')                                                             ! timing
[8586]129      !
130   END SUBROUTINE ice_cor
131
132#else
133   !!----------------------------------------------------------------------
[9570]134   !!   Default option           Dummy module         NO SI3 sea-ice model
[8586]135   !!----------------------------------------------------------------------
136#endif
137
138   !!======================================================================
139END MODULE icecor
Note: See TracBrowser for help on using the repository browser.