Skip to content
Snippets Groups Projects
icedyn_rhg_vp.F90 87.8 KiB
Newer Older
Guillaume Samson's avatar
Guillaume Samson committed
MODULE icedyn_rhg_vp
   !!======================================================================
   !!                     ***  MODULE  icedyn_rhg_vp  ***
   !!   Sea-Ice dynamics : Viscous-plastic rheology with LSR technique
   !!======================================================================
   !!
   !! History :   -   !  1997-20  (J. Zhang, M. Losch) Original code, implementation into mitGCM
   !!            4.0  !  2020-09  (M. Vancoppenolle) Adaptation to SI3
   !!
   !!----------------------------------------------------------------------
#if defined key_si3
   !!----------------------------------------------------------------------
   !!   'key_si3'                                       SI3 sea-ice model
   !!----------------------------------------------------------------------
   !!   ice_dyn_rhg_vp : computes ice velocities from VP rheolog with LSR solvery
   !!----------------------------------------------------------------------
   USE phycst         ! Physical constants
   USE dom_oce        ! Ocean domain
   USE sbc_oce , ONLY : ln_ice_embd, nn_fsbc, ssh_m
   USE sbc_ice , ONLY : utau_ice, vtau_ice, snwice_mass, snwice_mass_b
   USE ice            ! sea-ice: ice variables
   USE icevar         ! ice_var_sshdyn
   USE icedyn_rdgrft  ! sea-ice: ice strength
   USE bdy_oce , ONLY : ln_bdy 
   USE bdyice 
#if defined key_agrif
   USE agrif_ice_interp
#endif
   !
   USE in_out_manager ! I/O manager
   USE iom            ! I/O manager library
   USE lib_mpp        ! MPP library
   USE lib_fortran    ! fortran utilities (glob_sum + no signed zero)
   USE lbclnk         ! lateral boundary conditions (or mpp links)
   USE prtctl         ! Print control

   USE netcdf         ! NetCDF library for convergence test
   IMPLICIT NONE
   PRIVATE

   PUBLIC   ice_dyn_rhg_vp   ! called by icedyn_rhg.F90

   INTEGER  ::   nn_nvp              ! total number of VP iterations (n_out_vp*n_inn_vp)
   LOGICAL  ::   lp_zebra_vp =.TRUE. ! activate zebra (solve the linear system problem every odd j-band, then one every even one)
   REAL(wp) ::   zrelaxu_vp=0.95     ! U-relaxation factor (MV: can probably be merged with V-factor once ok)
   REAL(wp) ::   zrelaxv_vp=0.95     ! V-relaxation factor 
   REAL(wp) ::   zuerr_max_vp=0.80   ! maximum velocity error, above which a forcing error is considered and solver is stopped
   REAL(wp) ::   zuerr_min_vp=1.e-06 ! minimum velocity error, beyond which convergence is assumed
Guillaume Samson's avatar
Guillaume Samson committed

   !! for convergence tests
   INTEGER ::   ncvgid        ! netcdf file id
   INTEGER ::   nvarid_ures, nvarid_vres, nvarid_velres
   INTEGER ::   nvarid_uerr_max, nvarid_verr_max, nvarid_velerr_max
   INTEGER ::   nvarid_umad, nvarid_vmad, nvarid_velmad
   INTEGER ::   nvarid_umad_outer, nvarid_vmad_outer, nvarid_velmad_outer
   INTEGER ::   nvarid_mke

   REAL(wp), DIMENSION(:,:), ALLOCATABLE ::   fimask   ! mask at F points for the ice
   
   !! * Substitutions
#  include "do_loop_substitute.h90"
   !!----------------------------------------------------------------------
   !! NEMO/ICE 4.0 , NEMO Consortium (2018)
   !! $Id: icedyn_rhg_vp.F90 13279 2020-07-09 10:39:43Z clem $
   !! Software governed by the CeCILL license (see ./LICENSE)
   !!----------------------------------------------------------------------
   
CONTAINS

   SUBROUTINE ice_dyn_rhg_vp( kt, pshear_i, pdivu_i, pdelta_i )
      !!-------------------------------------------------------------------
      !!
      !!                 ***  SUBROUTINE ice_dyn_rhg_vp  ***
      !!                             VP-LSR-C-grid
      !!
      !! ** Purpose : determines sea ice drift from wind stress, ice-ocean
      !!  stress and sea-surface slope. Internal forces assume viscous-plastic rheology (Hibler, 1979)
      !! 
      !! ** Method
      !!  
      !!  The resolution algorithm  follows from Zhang and Hibler (1997) and Losch (2010)
      !!  with elements from Lemieux and Tremblay (2008) and Lemieux and Tremblay (2009)
      !!  
      !!  The components of the momentum equations are arranged following the ideas of Zhang and Hibler (1997)
      !!
      !!  f1(u) = g1(v)
      !!  f2(v) = g2(u)
      !!
      !!  The right-hand side (RHS) is explicit
      !!  The left-hand side (LHS) is implicit
      !!  Coriolis is part of explicit terms, whereas ice-ocean drag is implicit
      !!
      !!  Two iteration levels (outer and inner loops) are used to solve the equations
      !!
      !!  The outer loop (OL, typically 10 iterations) is there to deal with the (strong) non-linearities in the equation
      !!
      !!  The inner loop (IL, typically 1500 iterations) is there to solve the linear problem with a line-successive-relaxation algorithm
      !!
      !!  The velocity used in the non-linear terms uses a "modified euler time step" (not sure its the correct term), 
      !!! with uk = ( uk-1 + uk-2 ) / 2.
      !!  
      !!  * Spatial discretization 
      !!
      !!  Assumes a C-grid
      !!
      !!  The points in the C-grid look like this, my darling
      !!
      !!                              (ji,jj)
      !!                                 |
      !!                                 |
      !!                      (ji-1,jj)  |  (ji,jj)
      !!                             ---------   
      !!                            |         |
      !!                            | (ji,jj) |------(ji,jj)
      !!                            |         |
      !!                             ---------   
      !!                     (ji-1,jj-1)     (ji,jj-1)
      !!
      !! ** Inputs  : - wind forcing (stress), oceanic currents
      !!                ice total volume (vt_i) per unit area
      !!                snow total volume (vt_s) per unit area
      !!
      !! ** Action  : 
      !!             
      !! ** Steps   :
      !!            
      !! ** Notes   : 
      !!             
      !! References : Zhang and Hibler, JGR 1997; Losch et al., OM 2010., Lemieux et al., 2008, 2009, ...  
      !!             
      !!             
      !!-------------------------------------------------------------------
      !!
      INTEGER                 , INTENT(in   ) ::   kt                                    ! time step
      REAL(wp), DIMENSION(:,:), INTENT(  out) ::   pshear_i  , pdivu_i   , pdelta_i      !
      !!
      LOGICAL ::   ll_u_iterate, ll_v_iterate   ! continue iteration or not
      !
      INTEGER ::   ji, ji2, jj, jj2, jn          ! dummy loop indices
      INTEGER ::   i_out, i_inn, i_inn_tot  ! 
      INTEGER ::   ji_min, jj_min      !
      INTEGER ::   nn_zebra_vp         ! number of zebra steps

      !
      REAL(wp) ::   zrhoco                                              ! rho0 * rn_cio
      REAL(wp) ::   ecc2, z1_ecc2                                       ! square of yield ellipse eccenticity
      REAL(wp) ::   zglob_area                                          ! global ice area for diagnostics
      REAL(wp) ::   zkt                                                 ! isotropic tensile strength for landfast ice
      REAL(wp) ::   zm1, zm2, zm3, zmassU, zmassV                       ! ice/snow mass and volume
      REAL(wp) ::   zds2, zdt, zdt2, zdiv, zdiv2                        ! temporary scalars
      REAL(wp) ::   zvisc_f                                        ! 
Guillaume Samson's avatar
Guillaume Samson committed
      REAL(wp) ::   zu_cV, zv_cU                                        ! 
      REAL(wp) ::   zfac, zfac1, zfac2, zfac3
      REAL(wp) ::   zt12U, zt11U, zt22U, zt21U, zt122U, zt121U
      REAL(wp) ::   zt12V, zt11V, zt22V, zt21V, zt122V, zt121V
      REAL(wp) ::   zAA3, zw, ztau, zuerr_max, zverr_max
      !
      REAL(wp), DIMENSION(jpi,jpj) ::   za_iU  , za_iV                  ! ice fraction on U/V points
Guillaume Samson's avatar
Guillaume Samson committed
      REAL(wp), DIMENSION(jpi,jpj) ::   zmU_t, zmV_t                    ! Acceleration term contribution to RHS
      REAL(wp), DIMENSION(jpi,jpj) ::   zmassU_t, zmassV_t              ! Mass per unit area divided by time step
      !
      REAL(wp), DIMENSION(jpi,jpj) ::   zdelta                          ! Delta at T-points      (now value)
      REAL(wp), DIMENSION(jpi,jpj) ::   zten_i, zshear                  ! Tension, shear
      REAL(wp), DIMENSION(jpi,jpj) ::   zvisc_t                         ! Bulk viscosity (P/delta*) at T points
      REAL(wp), DIMENSION(jpi,jpj) ::   zvisc_t_prev                    ! Bulk viscosity (next to last iterate) - for yield curve diag
Guillaume Samson's avatar
Guillaume Samson committed
      REAL(wp), DIMENSION(jpi,jpj) ::   zzt, zet                        ! Viscosity pre-factors at T points
      REAL(wp), DIMENSION(jpi,jpj) ::   zef                             ! Viscosity pre-factor at F point
      !
      REAL(wp), DIMENSION(jpi,jpj) ::   zmt                             ! Mass per unit area at t-point
      REAL(wp), DIMENSION(jpi,jpj) ::   zmf                             ! Coriolis factor (m*f) at t-point 
      REAL(wp), DIMENSION(jpi,jpj) ::   v_oceU, u_oceV, v_iceU, u_iceV  ! ocean/ice u/v component on V/U points
      REAL(wp), DIMENSION(jpi,jpj) ::   zu_c, zv_c                      ! "current" ice velocity (m/s), average of previous two OL iterates
      REAL(wp), DIMENSION(jpi,jpj) ::   zu_b, zv_b                      ! velocity at previous sub-iterate
      REAL(wp), DIMENSION(jpi,jpj) ::   zuerr, zverr                    ! absolute U/Vvelocity difference between current and previous sub-iterates
      REAL(wp), DIMENSION(jpi,jpj) ::   zvel_res                        ! Residual of the linear system at last iteration
      REAL(wp), DIMENSION(jpi,jpj) ::   zvel_diff                       ! Absolute velocity difference @last outer iteration
Guillaume Samson's avatar
Guillaume Samson committed
      !
      REAL(wp), DIMENSION(jpi,jpj) ::   zds                             ! shear
      REAL(wp), DIMENSION(jpi,jpj) ::   zsshdyn                         ! array used for the calculation of ice surface slope:
      !                                                                 !    ocean surface (ssh_m) if ice is not embedded
      !                                                                 !    ice bottom surface if ice is embedded   
      REAL(wp), DIMENSION(jpi,jpj) ::   zCwU, zCwV                      ! ice-ocean drag pre-factor (rho*c*module(u))
      REAL(wp), DIMENSION(jpi,jpj) ::   zspgU, zspgV                    ! surface pressure gradient at U/V points
      REAL(wp), DIMENSION(jpi,jpj) ::   zCorU, zCorV                    ! Coriolis stress array
      REAL(wp), DIMENSION(jpi,jpj) ::   ztaux_ai, ztauy_ai              ! ice-atm. stress at U-V points
      REAL(wp), DIMENSION(jpi,jpj) ::   ztaux_oi_rhsu, ztauy_oi_rhsv    ! ice-ocean stress RHS contribution at U-V points
      REAL(wp), DIMENSION(jpi,jpj) ::   zs1_rhsu, zs2_rhsu, zs12_rhsu   ! internal stress contributions to RHSU
      REAL(wp), DIMENSION(jpi,jpj) ::   zs1_rhsv, zs2_rhsv, zs12_rhsv   ! internal stress contributions to RHSV
      REAL(wp), DIMENSION(jpi,jpj) ::   zf_rhsu, zf_rhsv                ! U- and V- components of internal force RHS contributions
      REAL(wp), DIMENSION(jpi,jpj) ::   zrhsu, zrhsv                    ! U and V RHS 
      REAL(wp), DIMENSION(jpi,jpj) ::   zAU, zBU, zCU, zDU, zEU         ! Linear system coefficients, U equation
      REAL(wp), DIMENSION(jpi,jpj) ::   zAV, zBV, zCV, zDV, zEV         ! Linear system coefficients, V equation
      REAL(wp), DIMENSION(jpi,jpj) ::   zFU, zFU_prime, zBU_prime       ! Rearranged linear system coefficients, U equation
      REAL(wp), DIMENSION(jpi,jpj) ::   zFV, zFV_prime, zBV_prime       ! Rearranged linear system coefficients, V equation
!!!      REAL(wp), DIMENSION(jpi,jpj) ::   ztaux_bi, ztauy_bi              ! ice-OceanBottom stress at U-V points (landfast)
!!!      REAL(wp), DIMENSION(jpi,jpj) ::   ztaux_base, ztauy_base          ! ice-bottom stress at U-V points (landfast)
     !
      REAL(wp), DIMENSION(jpi,jpj) ::   zmsk, zmsk00
Guillaume Samson's avatar
Guillaume Samson committed
      REAL(wp), DIMENSION(jpi,jpj) ::   zmsk01x, zmsk01y                ! mask for lots of ice (1), little ice (0)
      REAL(wp), DIMENSION(jpi,jpj) ::   zmsk00x, zmsk00y                ! mask for ice presence (1), no ice (0)
Loading
Loading full blame...