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.
Changeset 2715 for trunk/NEMOGCM/NEMO/LIM_SRC_3/ice.F90 – NEMO

Ignore:
Timestamp:
2011-03-30T17:58:35+02:00 (13 years ago)
Author:
rblod
Message:

First attempt to put dynamic allocation on the trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/NEMOGCM/NEMO/LIM_SRC_3/ice.F90

    r2528 r2715  
    44   !! LIM-3 Sea Ice physics:  diagnostics variables of ice defined in memory 
    55   !!===================================================================== 
    6    !! History :  3.0  ! 2008-03  (M. Vancoppenolle) : original code LIM-3 
     6   !! History :  3.0  ! 2008-03  (M. Vancoppenolle) original code LIM-3 
     7   !!            4.0  ! 2011-02  (G. Madec) dynamical allocation 
    78   !!---------------------------------------------------------------------- 
    89#if defined key_lim3 
     
    1112   !!---------------------------------------------------------------------- 
    1213   USE par_ice          ! LIM sea-ice parameters 
     14   USE in_out_manager   ! I/O manager 
     15   USE lib_mpp         ! MPP library 
    1316 
    1417   IMPLICIT NONE 
    1518   PRIVATE 
     19 
     20   PUBLIC    ice_alloc  !  Called in iceini.F90 
    1621 
    1722   !!====================================================================== 
    1823   !! LIM3 by the use of sweat, agile fingers and sometimes brain juice,  
    1924   !!  was developed in Louvain-la-Neuve by :  
    20    !! 
    2125   !!    * Martin Vancoppenolle (UCL-ASTR, Belgium) 
    2226   !!    * Sylvain Bouillon (UCL-ASTR, Belgium) 
    23    !!    * Miguel Angel Morales Maqueda (POL, UK) 
     27   !!    * Miguel Angel Morales Maqueda (NOC-L, UK) 
    2428   !!  
    2529   !! Based on extremely valuable earlier work by 
    26    !! 
    2730   !!    * Thierry Fichefet 
    2831   !!    * Hugues Goosse 
    2932   !! 
    3033   !! The following persons also contributed to the code in various ways 
    31    !! 
    32    !!    * Gurvan Madec, Claude Talandier, Christian Ethe  
    33    !! NEMO/LIM3 3.3 , UCL - NEMO Consortium (2010) 
     34   !!    * Gurvan Madec, Claude Talandier, Christian Ethe (LOCEAN, France) 
    3435   !!    * Xavier Fettweis (UCL-ASTR), Ralph Timmermann (AWI, Germany) 
    3536   !!    * Bill Lipscomb (LANL), Cecilia Bitz (UWa)  
    3637   !!      and Elisabeth Hunke (LANL), USA. 
    3738   !!  
    38    !! (c) UCL-ASTR, 2005-2008 
    39    !! 
    40    !! For more info, the interested user is kindly invited to consult the 
    41    !! following references 
     39   !! For more info, the interested user is kindly invited to consult the following references 
    4240   !!    For model description and validation : 
    4341   !!    * Vancoppenolle et al., Ocean Modelling, 2008a. 
    4442   !!    * Vancoppenolle et al., Ocean Modelling, 2008b. 
     43   !!    For a specific description of EVP : 
     44   !!    * Bouillon et al., Ocean Modelling 2009. 
    4545   !! 
    46    !!    For a specific description of EVP : 
    47    !!    * Bouillon et al., in prep for 2008. 
    48    !! 
    49    !!    Or the reference manual, that should be available by 2010 
     46   !!    Or the reference manual, that should be available by 2011 
    5047   !!====================================================================== 
    5148   !!                                                                     | 
     
    168165   REAL(wp), PUBLIC ::   rdt_ice   !: ice time step 
    169166 
    170    INTEGER , PUBLIC ::   &     !!: ** ice-dynamic namelist (namicedyn) ** 
    171       nbiter = 1      ,  &     !: number of sub-time steps for relaxation 
    172       nbitdr = 250    ,  &     !: maximum number of iterations for relaxation 
    173       nevp   = 400    ,  &     !: number of iterations for subcycling 
    174       nlay_i = 5               !: number of layers in the ice 
    175  
    176    REAL(wp), PUBLIC ::   &     !!: ** ice-dynamic namelist (namicedyn) ** 
    177       epsd   = 1.0e-20,  &     !: tolerance parameter for dynamic 
    178       alpha  = 0.5    ,  &     !: coefficient for semi-implicit coriolis 
    179       dm     = 0.6e+03,  &     !: diffusion constant for dynamics 
    180       om     = 0.5    ,  &     !: relaxation constant 
    181       resl   = 5.0e-05,  &     !: maximum value for the residual of relaxation 
    182       cw     = 5.0e-03,  &     !: drag coefficient for oceanic stress 
    183       angvg  = 0.0    ,  &     !: turning angle for oceanic stress 
    184       pstar  = 1.0e+04,  &     !: determines ice strength (N/M), Hibler JPO79 
    185       c_rhg  = 20.0   ,  &     !: determines changes in ice strength 
    186       etamn  = 0.0e+07,  &     !: minimun value for viscosity : has to be 0 
    187       creepl = 2.0e-08,  &     !: creep limit : has to be under 1.0e-9 
    188       ecc    = 2.0    ,  &  !: eccentricity of the elliptical yield curve 
    189       ahi0   = 350.e0 ,  &  !: sea-ice hor. eddy diffusivity coeff. (m2/s) 
    190       telast = 2880.0 ,  &  !: timescale for elastic waves (s) !SB 
    191       alphaevp = 1.0  ,  &  !: coeficient of the internal stresses !SB 
    192       unit_fac = 1.0e9      !: conversion factor for ice / snow enthalpy 
    193  
    194    REAL(wp), PUBLIC ::   & !!: ** ice-salinity namelist (namicesal) ** 
    195       s_i_max  = 20.0 ,  &  !: maximum ice salinity (ppt) 
    196       s_i_min  =  0.1 ,  &  !: minimum ice salinity (ppt) 
    197       s_i_0    =  3.5 ,  &  !: 1st sal. value for the computation of sal .prof. 
    198                                 !: (ppt) 
    199       s_i_1    =  4.5 ,  &  !: 2nd sal. value for the computation of sal .prof. 
    200                                 !: (ppt) 
    201       sal_G    = 5.00 ,  &  !: restoring salinity for gravity drainage 
    202                                 !: (ppt) 
    203       sal_F    = 2.50 ,  &  !: restoring salinity for flushing 
    204                                 !: (ppt) 
    205       time_G   = 1.728e+06,&!: restoring time constant for gravity drainage 
    206                                 !: (= 20 days, in s) 
    207       time_F   = 8.640e+05,&!: restoring time constant for gravity drainage  
    208                                 !: (= 10 days, in s) 
    209       bulk_sal = 4.0        !: bulk salinity (ppt) in case of constant salinity 
    210  
    211    INTEGER , PUBLIC ::   & !!: ** ice-salinity namelist (namicesal) ** 
    212       num_sal  = 1    ,  &  !: salinity configuration used in the model 
    213                                 !: 1 - s constant in space and time 
    214                                 !: 2 - prognostic salinity (s(z,t)) 
    215                                 !: 3 - salinity profile, constant in time 
    216                                 !: 4 - salinity variations affect only ice 
    217                                 !      thermodynamics 
    218       sal_prof = 1    ,  &  !: salinity profile or not  
    219       thcon_i_swi = 1       !: thermal conductivity of Untersteiner (1964) (1) or 
    220    !: Pringle et al (2007) (2) 
    221  
    222    REAL(wp), PUBLIC ::   & !!: ** ice-mechanical redistribution namelist (namiceitdme) 
    223       Cs = 0.25       ,  & !!: fraction of shearing energy contributing to ridging             
    224       Cf = 17.0       ,  & !!: ratio of ridging work to PE loss 
    225       fsnowrdg = 0.5  ,  & !!: fractional snow loss to the ocean during ridging 
    226       fsnowrft = 0.5  ,  & !!: fractional snow loss to the ocean during ridging 
    227       Gstar = 0.15    ,  & !!: fractional area of young ice contributing to ridging 
    228       astar = 0.05    ,  & !!: equivalent of G* for an exponential participation function 
    229       Hstar = 100.0   ,  & !!: thickness that determines the maximal thickness of ridged 
    230                                 !!: ice 
    231       hparmeter = 0.75,  & !!: threshold thickness (m) for rafting / ridging  
    232       Craft = 5.0     ,  & !!: coefficient for smoothness of the hyperbolic tangent in rafting 
    233       ridge_por = 0.0 ,  & !!: initial porosity of ridges (0.3 regular value) 
    234       sal_max_ridge = 15.0, & !!: maximum ridged ice salinity (ppt) 
    235       betas    = 1.0      , & !:: coef. for partitioning of snowfall between leads and sea ice 
    236       kappa_i  = 1.0      , & !!: coefficient for the extinction of radiation 
    237                                 !!: Grenfell et al. (2006) (m-1) 
    238       nconv_i_thd = 50    , & !!: maximal number of iterations for heat diffusion 
    239       maxer_i_thd = 1.0e-4    !!: maximal tolerated error (C) for heat diffusion 
    240  
    241    INTEGER , PUBLIC ::   & !!: ** ice-mechanical redistribution namelist (namiceitdme) 
    242       ridge_scheme_swi = 0, & !!: scheme used for ice ridging 
    243       raftswi          = 1, & !!: rafting of ice or not                         
    244       partfun_swi      = 1, & !!: participation function Thorndike et al. JGR75 (0)  
    245                                 !!: or Lipscomb et al. JGR07 (1)  
    246       transfun_swi     = 0, & !!: transfer function of Hibler, MWR80 (0)  
    247                                 !!: or Lipscomb et al., 2007 (1) 
    248       brinstren_swi    = 0    !!: use brine volume to diminish ice strength 
    249  
    250    REAL(wp), PUBLIC ::   &  !: 
    251       usecc2          ,  &  !:  = 1.0 / ( ecc * ecc ) 
    252       rhoco           ,  &  !: = rau0 * cw 
    253       sangvg, cangvg  ,  &  !: sin and cos of the turning angle for ocean stress 
    254       pstarh                !: pstar / 2.0 
    255  
    256    REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::  &  !: 
    257       u_oce, v_oce    ,  &  !: surface ocean velocity used in ice dynamics 
    258       ahiu , ahiv     ,  &  !: hor. diffusivity coeff. at ocean U- and V-points (m2/s) 
    259       pahu , pahv     ,  &  !: ice hor. eddy diffusivity coef. at ocean U- and V-points 
    260       ust2s, hicol    ,  &  !: friction velocity, ice collection thickness accreted in leads 
    261       strength        ,  &  !: ice strength 
    262       strp1, strp2    ,  &  !: strength at previous time steps 
    263       stress1_i       ,  &  !: first stress tensor element 
    264       stress2_i       ,  &  !: second stress tensor element 
    265       stress12_i      ,  &  !: diagonal stress tensor element 
    266       delta_i         ,  &  !: Delta factor for the ice rheology (see Flato and Hibler 95) [s-1] -> limrhg.F90 
    267       divu_i          ,  &  !: Divergence of the velocity field [s-1] -> limrhg.F90 
    268       shear_i               !: Shear of the velocity field [s-1] -> limrhg.F90 
    269  
    270    REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   &  !: 
    271       firic  ,   &  !: IR flux over the ice (only used for outputs) 
    272       fcsic  ,   &  !: Sensible heat flux over the ice (only used for outputs) 
    273       fleic  ,   &  !: Latent heat flux over the ice (only used for outputs) 
    274       qlatic ,   &  !: latent flux 
    275       rdvosif,   &  !: Variation of volume at surface (only used for outputs) 
    276       rdvobif,   &  !: Variation of ice volume at the bottom ice (only used for outputs) 
    277       fdvolif,   &  !: Total variation of ice volume (only used for outputs) 
    278       rdvonif,   &  !: Lateral Variation of ice volume (only used for outputs) 
    279       sist   ,   &  !: Average Sea-Ice Surface Temperature (Kelvin) 
    280       icethi ,   &  !: total ice thickness (for all categories) (only used for outputs) 
    281       t_bo   ,   &  !: Sea-Ice bottom temperature (Kelvin)       
    282       hicifp ,   &  !: Ice production/melting 
    283                                 !obsolete... can be removed 
    284       frld   ,   &  !: Leads fraction = 1-a/totalarea REFERS TO LEAD FRACTION everywhere 
    285                                 !: except in the OUTPUTS!!!! 
    286       pfrld  ,   &  !: Leads fraction at previous time   
    287       phicif ,   &  !: Old ice thickness 
    288       fbif   ,   &  !: Heat flux at the ice base 
    289       rdmsnif,   &  !: Variation of snow mass 
    290       rdmicif,   &  !: Variation of ice mass 
    291       qldif  ,   &  !: heat balance of the lead (or of the open ocean) 
    292       qcmif  ,   &  !: Energy needed to bring the ocean surface layer until its freezing  
    293       fdtcn  ,   &  !: net downward heat flux from the ice to the ocean 
    294       qdtcn  ,   &  !: energy from the ice to the ocean 
    295       fstric ,   &  !: transmitted solar radiation under ice 
    296       fscmbq ,   &  !: associated with lead chipotage with solar flux 
    297       ffltbif,   &  !: Array linked with the max heat contained in brine pockets (?) 
    298       fsbbq  ,   &  !: Also linked with the solar flux below the ice (?) 
    299       qfvbq  ,   &  !: Array used to store energy in case of toral lateral ablation (?) 
    300       dmgwi  ,   &  !: Variation of the mass of snow ice 
    301       fsalt_res, &  !: Residual salt flux due to correction of ice thickness 
    302       fsbri  ,   &  !: Salt flux due to brine rejection 
    303       fsalt_rpo, &  !: Salt flux associated with porous ridged ice formation 
    304       fheat_rpo, &  !: Heat flux associated with porous ridged ice formation 
    305       fhbri  ,   &  !: heat flux due to brine rejection 
    306       fmmec  ,   &  !: Mass flux due to snow loss during compression 
    307       fseqv  ,   &  !: Equivalent salt flux due to ice growth/melt 
    308       fheat_res, &  !: Residual heat flux due to correction of ice thickness 
    309       fhmec         !: Heat flux due to snow loss during compression 
     167   !                                          !!** ice-dynamic namelist (namicedyn) ** 
     168   INTEGER , PUBLIC ::   nbiter = 1            !: number of sub-time steps for relaxation 
     169   INTEGER , PUBLIC ::   nbitdr = 250          !: maximum number of iterations for relaxation 
     170   INTEGER , PUBLIC ::   nevp   = 400          !: number of iterations for subcycling 
     171   INTEGER , PUBLIC ::   nlay_i = 5            !: number of layers in the ice 
     172 
     173   !                                          !!** ice-dynamic namelist (namicedyn) ** 
     174   REAL(wp), PUBLIC ::   epsd   = 1.0e-20_wp   !: tolerance parameter for dynamic 
     175   REAL(wp), PUBLIC ::   alpha  = 0.5_wp       !: coefficient for semi-implicit coriolis 
     176   REAL(wp), PUBLIC ::   dm     = 0.6e+03_wp   !: diffusion constant for dynamics 
     177   REAL(wp), PUBLIC ::   om     = 0.5_wp       !: relaxation constant 
     178   REAL(wp), PUBLIC ::   resl   = 5.0e-05_wp   !: maximum value for the residual of relaxation 
     179   REAL(wp), PUBLIC ::   cw     = 5.0e-03_wp   !: drag coefficient for oceanic stress 
     180   REAL(wp), PUBLIC ::   angvg  = 0._wp        !: turning angle for oceanic stress 
     181   REAL(wp), PUBLIC ::   pstar  = 1.0e+04_wp   !: determines ice strength (N/M), Hibler JPO79 
     182   REAL(wp), PUBLIC ::   c_rhg  = 20._wp       !: determines changes in ice strength 
     183   REAL(wp), PUBLIC ::   etamn  = 0.0e+07_wp   !: minimun value for viscosity : has to be 0 
     184   REAL(wp), PUBLIC ::   creepl = 2.0e-08_wp   !: creep limit : has to be under 1.0e-9 
     185   REAL(wp), PUBLIC ::   ecc    = 2._wp        !: eccentricity of the elliptical yield curve 
     186   REAL(wp), PUBLIC ::   ahi0   = 350._wp      !: sea-ice hor. eddy diffusivity coeff. (m2/s) 
     187   REAL(wp), PUBLIC ::   telast = 2880._wp     !: timescale for elastic waves (s) !SB 
     188   REAL(wp), PUBLIC ::   alphaevp = 1._wp      !: coeficient of the internal stresses !SB 
     189   REAL(wp), PUBLIC ::   unit_fac = 1.e+09_wp  !: conversion factor for ice / snow enthalpy 
     190 
     191   !                                              !!** ice-salinity namelist (namicesal) ** 
     192   REAL(wp), PUBLIC ::   s_i_max  = 20.0_wp        !: maximum ice salinity [PSU] 
     193   REAL(wp), PUBLIC ::   s_i_min  =  0.1_wp        !: minimum ice salinity [PSU] 
     194   REAL(wp), PUBLIC ::   s_i_0    =  3.5_wp        !: 1st sal. value for the computation of sal .prof. [PSU] 
     195   REAL(wp), PUBLIC ::   s_i_1    =  4.5_wp        !: 2nd sal. value for the computation of sal .prof. [PSU] 
     196   REAL(wp), PUBLIC ::   sal_G    =  5.0_wp        !: restoring salinity for gravity drainage [PSU] 
     197   REAL(wp), PUBLIC ::   sal_F    =  2.5_wp        !: restoring salinity for flushing [PSU] 
     198   REAL(wp), PUBLIC ::   time_G   =  1.728e+06_wp  !: restoring time constant for gravity drainage (= 20 days) [s] 
     199   REAL(wp), PUBLIC ::   time_F   =  8.640e+05_wp  !: restoring time constant for gravity drainage (= 10 days) [s] 
     200   REAL(wp), PUBLIC ::   bulk_sal =  4.0_wp        !: bulk salinity (ppt) in case of constant salinity 
     201 
     202   !                                              !!** ice-salinity namelist (namicesal) ** 
     203   INTEGER , PUBLIC ::   num_sal     = 1           !: salinity configuration used in the model 
     204   !                                               ! 1 - s constant in space and time 
     205   !                                               ! 2 - prognostic salinity (s(z,t)) 
     206   !                                               ! 3 - salinity profile, constant in time 
     207   !                                               ! 4 - salinity variations affect only ice thermodynamics 
     208   INTEGER , PUBLIC ::   sal_prof    = 1           !: salinity profile or not  
     209   INTEGER , PUBLIC ::   thcon_i_swi = 1           !: thermal conductivity: =1 Untersteiner (1964) ; =2 Pringle et al (2007) 
     210 
     211   !                                              !!** ice-mechanical redistribution namelist (namiceitdme) 
     212   REAL(wp), PUBLIC ::   Cs        = 0.25_wp       !: fraction of shearing energy contributing to ridging             
     213   REAL(wp), PUBLIC ::   Cf        = 17.0_wp       !: ratio of ridging work to PE loss 
     214   REAL(wp), PUBLIC ::   fsnowrdg  = 0.5_wp        !: fractional snow loss to the ocean during ridging 
     215   REAL(wp), PUBLIC ::   fsnowrft  = 0.5_wp        !: fractional snow loss to the ocean during ridging 
     216   REAL(wp), PUBLIC ::   Gstar     = 0.15_wp       !: fractional area of young ice contributing to ridging 
     217   REAL(wp), PUBLIC ::   astar     = 0.05_wp       !: equivalent of G* for an exponential participation function 
     218   REAL(wp), PUBLIC ::   Hstar     = 100.0_wp      !: thickness that determines the maximal thickness of ridged ice 
     219   REAL(wp), PUBLIC ::   hparmeter = 0.75_wp       !: threshold thickness (m) for rafting / ridging  
     220   REAL(wp), PUBLIC ::   Craft     = 5.0_wp        !: coefficient for smoothness of the hyperbolic tangent in rafting 
     221   REAL(wp), PUBLIC ::   ridge_por = 0.0_wp        !: initial porosity of ridges (0.3 regular value) 
     222   REAL(wp), PUBLIC ::   sal_max_ridge = 15.0_wp   !: maximum ridged ice salinity (ppt) 
     223   REAL(wp), PUBLIC ::   betas    = 1.0_wp         !: coef. for partitioning of snowfall between leads and sea ice 
     224   REAL(wp), PUBLIC ::   kappa_i  = 1.0_wp         !: coef. for the extinction of radiation Grenfell et al. (2006) [1/m] 
     225   REAL(wp), PUBLIC ::   nconv_i_thd = 50_wp       !: maximal number of iterations for heat diffusion 
     226   REAL(wp), PUBLIC ::   maxer_i_thd = 1.0e-4_wp   !: maximal tolerated error (C) for heat diffusion 
     227 
     228   !                                              !!** ice-mechanical redistribution namelist (namiceitdme) 
     229   INTEGER , PUBLIC ::   ridge_scheme_swi = 0      !: scheme used for ice ridging 
     230   INTEGER , PUBLIC ::   raftswi          = 1      !: rafting of ice or not                         
     231   INTEGER , PUBLIC ::   partfun_swi      = 1      !: participation function: =0 Thorndike et al. (1975), =1 Lipscomb et al. (2007) 
     232   INTEGER , PUBLIC ::   transfun_swi     = 0      !: transfer function: =0 Hibler 1980, =1 Lipscomb et al. 2007 
     233   INTEGER , PUBLIC ::   brinstren_swi    = 0      !: use brine volume to diminish ice strength 
     234 
     235   REAL(wp), PUBLIC ::   usecc2           !:  = 1.0 / ( ecc * ecc ) 
     236   REAL(wp), PUBLIC ::   rhoco            !: = rau0 * cw 
     237   REAL(wp), PUBLIC ::   sangvg, cangvg   !: sin and cos of the turning angle for ocean stress 
     238   REAL(wp), PUBLIC ::   pstarh           !: pstar / 2.0 
     239 
     240   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   u_oce, v_oce   !: surface ocean velocity used in ice dynamics 
     241   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   ahiu , ahiv    !: hor. diffusivity coeff. at U- and V-points [m2/s] 
     242   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   pahu , pahv    !: ice hor. eddy diffusivity coef. at U- and V-points 
     243   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   ust2s, hicol   !: friction velocity, ice collection thickness accreted in leads 
     244   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   strp1, strp2   !: strength at previous time steps 
     245   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   strength       !: ice strength 
     246   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   stress1_i, stress2_i, stress12_i   !: 1st, 2nd & diagonal stress tensor element 
     247   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   delta_i        !: ice rheology elta factor (Flato & Hibler 95) [s-1] 
     248   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   divu_i         !: Divergence of the velocity field [s-1] 
     249   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   shear_i        !: Shear of the velocity field [s-1] 
     250   ! 
     251   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   firic       !: IR flux over the ice (diag only) 
     252   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   fcsic       !: Sensible heat flux over the ice (diag only) 
     253   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   fleic       !: Latent heat flux over the ice (diag only) 
     254   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   qlatic      !: latent flux 
     255   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   rdvosif     !: Variation of volume at surface (diag only) 
     256   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   rdvobif     !: Variation of ice volume at the bottom ice (diag only) 
     257   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   fdvolif     !: Total variation of ice volume (diag only) 
     258   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   rdvonif     !: Lateral Variation of ice volume (diag only) 
     259   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   sist        !: Average Sea-Ice Surface Temperature [Kelvin] 
     260   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   icethi      !: total ice thickness (for all categories) (diag only) 
     261   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   t_bo        !: Sea-Ice bottom temperature [Kelvin]      
     262   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hicifp      !: Ice production/melting==>!obsolete... can be removed 
     263   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   frld        !: Leads fraction = 1 - ice fraction 
     264   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   pfrld       !: Leads fraction at previous time   
     265   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   phicif      !: Old ice thickness 
     266   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   fbif        !: Heat flux at the ice base 
     267   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   rdmsnif     !: Variation of snow mass 
     268   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   rdmicif     !: Variation of ice mass 
     269   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   qldif       !: heat balance of the lead (or of the open ocean) 
     270   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   qcmif       !: Energy needed to bring the ocean to freezing  
     271   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   fdtcn       !: net downward heat flux from the ice to the ocean 
     272   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   qdtcn       !: energy from the ice to the ocean 
     273   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   fstric      !: transmitted solar radiation under ice 
     274   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   fscmbq      !: associated with lead chipotage with solar flux 
     275   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   ffltbif     !: related to max heat contained in brine pockets (?) 
     276   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   fsbbq       !: Also linked with the solar flux below the ice (?) 
     277   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   qfvbq       !: store energy in case of total lateral ablation (?) 
     278   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   dmgwi       !: Variation of the mass of snow ice 
     279   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   fsalt_res   !: Residual salt flux due to correction of ice thickness 
     280   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   fsbri       !: Salt flux due to brine rejection 
     281   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   fsalt_rpo   !: Salt flux associated with porous ridged ice formation 
     282   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   fheat_rpo   !: Heat flux associated with porous ridged ice formation 
     283   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   fhbri       !: heat flux due to brine rejection 
     284   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   fmmec       !: Mass flux due to snow loss during compression 
     285   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   fseqv       !: Equivalent salt flux due to ice growth/melt 
     286   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   fhmec       !: Heat flux due to snow loss during compression 
     287   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   fheat_res   !: Residual heat flux due to correction of ice thickness 
    310288 
    311289   ! temporary arrays for dummy version of the code 
    312    REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   &  !: 
    313       dh_i_surf2D, dh_i_bott2D, fstbif, fsup2D, focea2D, q_s 
    314  
    315    INTEGER, PUBLIC, DIMENSION(jpi, jpj, jpl) ::          &   !:: 
    316       patho_case ! number of the pathological case (if any, of course) 
     290   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   dh_i_surf2D, dh_i_bott2D, fstbif, fsup2D, focea2D, q_s 
     291 
     292   INTEGER , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   patho_case ! number of the pathological case (if any, of course) 
    317293 
    318294   !!-------------------------------------------------------------------------- 
     
    320296   !!-------------------------------------------------------------------------- 
    321297   !! Variables defined for each ice category 
    322    REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpl)        ::   &  !: 
    323       ht_i   ,   &  !: Ice thickness (m) 
    324       a_i    ,   &  !: Ice fractional areas (concentration) 
    325       v_i    ,   &  !: Ice volume per unit area (m) 
    326       v_s    ,   &  !: Snow volume per unit area(m) 
    327       ht_s   ,   &  !: Snow thickness (m) 
    328       t_su   ,   &  !: Sea-Ice Surface Temperature (K) 
    329       sm_i   ,   &  !: Sea-Ice Bulk salinity (ppt) 
    330       smv_i  ,   &  !: Sea-Ice Bulk salinity times volume per area (ppt.m) 
    331                                 !: this is an extensive variable that has to be transported 
    332       o_i    ,   &  !: Sea-Ice Age (days) 
    333       ov_i   ,   &  !: Sea-Ice Age times volume per area (days.m) 
    334       oa_i          !: Sea-Ice Age times ice area (days) 
    335  
    336    !! Variables summed over all categories, or associated to  
    337    !! all the ice in a single grid cell 
    338    REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   &  !: 
    339       u_ice, v_ice,   &  !: two components of the ice velocity (m/s) 
    340       tio_u, tio_v,   &  !: two components of the ice-ocean stress (N/m2) 
    341       vt_i        ,   &  !: ice total volume per unit area (m) 
    342       vt_s        ,   &  !: snow total volume per unit area (m) 
    343       at_i        ,   &  !: ice total fractional area (ice concentration) 
    344       ato_i       ,   &  !: total open water fractional area (1-at_i) 
    345       et_i        ,   &  !: total ice heat content 
    346       et_s        ,   &  !: total snow heat content 
    347       ot_i        ,   &  !: mean age over all categories 
    348       tm_i        ,   &  !: mean ice temperature over all categories 
    349       bv_i        ,   &  !: brine volume averaged over all categories 
    350       smt_i              !: mean sea ice salinity averaged over all categories 
    351  
    352    REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpm) ::   &  !: 
    353       at_i_typ    ,   &  !: total area contained in each ice type 
    354       vt_i_typ           !: total volume contained in each ice type 
    355  
    356    REAL(wp), PUBLIC, DIMENSION(jpi,jpj,nlay_s,jpl) :: & !: 
    357       t_s,            &  !: Snow temperatures (K) 
    358       e_s 
    359  
    360    REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpl) ::   &  !: ! go to trash 
    361       e_i_cat 
    362  
    363    REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jkmax,jpl) :: & !: 
    364       t_i,            &  !: Ice temperatures     [ Kelvins     ] 
    365       e_i,            &  !: Ice thermal contents [ Joules*10^9 ] 
    366       s_i                !: Ice salinities 
     298   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   ht_i    !: Ice thickness (m) 
     299   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   a_i     !: Ice fractional areas (concentration) 
     300   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   v_i     !: Ice volume per unit area (m) 
     301   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   v_s     !: Snow volume per unit area(m) 
     302   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   ht_s    !: Snow thickness (m) 
     303   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   t_su    !: Sea-Ice Surface Temperature (K) 
     304   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   sm_i    !: Sea-Ice Bulk salinity (ppt) 
     305   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   smv_i   !: Sea-Ice Bulk salinity times volume per area (ppt.m) 
     306   !                                                                  !  this is an extensive variable that has to be transported 
     307   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   o_i     !: Sea-Ice Age (days) 
     308   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   ov_i    !: Sea-Ice Age times volume per area (days.m) 
     309   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   oa_i    !: Sea-Ice Age times ice area (days) 
     310 
     311   !! Variables summed over all categories, or associated to all the ice in a single grid cell 
     312   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   u_ice, v_ice   !: components of the ice velocity (m/s) 
     313   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   tio_u, tio_v   !: components of the ice-ocean stress (N/m2) 
     314   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   vt_i , vt_s    !: ice and snow total volume per unit area (m) 
     315   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   at_i           !: ice total fractional area (ice concentration) 
     316   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   ato_i          !: =1-at_i ; total open water fractional area 
     317   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   et_i , et_s    !: ice and snow total heat content 
     318   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   ot_i           !: mean age over all categories 
     319   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   tm_i           !: mean ice temperature over all categories 
     320   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   bv_i           !: brine volume averaged over all categories 
     321   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   smt_i          !: mean sea ice salinity averaged over all categories [PSU] 
     322 
     323   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   at_i_typ     !: total area   contained in each ice type [m^2] 
     324   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   vt_i_typ     !: total volume contained in each ice type [m^3] 
     325 
     326   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::   t_s        !: Snow temperatures [K] 
     327   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::   e_s        !: Snow ...       
     328 
     329   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   ::   e_i_cat    !: ! go to trash 
     330       
     331   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::   t_i        !: ice temperatures          [K] 
     332   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::   e_i        !: ice thermal contents [Giga J] 
     333   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::   s_i        !: ice salinities          [PSU] 
    367334 
    368335   !!-------------------------------------------------------------------------- 
    369336   !! * Moments for advection 
    370337   !!-------------------------------------------------------------------------- 
    371    REAL(wp), PUBLIC, DIMENSION(jpi,jpj)     ::   &  !: 
    372       sxopw, syopw, sxxopw, syyopw, sxyopw          !: open water in sea ice 
    373  
    374    REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpl) ::   &  !: 
    375       sxice, syice, sxxice, syyice, sxyice,      &  !: ice thickness moments for advection 
    376       sxsn,  sysn,  sxxsn,  syysn,  sxysn,       &  !: snow thickness 
    377       sxa,   sya,   sxxa,   syya,   sxya,        &  !: lead fraction 
    378       sxc0,  syc0,  sxxc0,  syyc0,  sxyc0,       &  !: snow thermal content 
    379       sxsal, sysal, sxxsal, syysal, sxysal,      &  !: ice salinity 
    380       sxage, syage, sxxage, syyage, sxyage          !: ice age 
    381  
    382    REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jkmax,jpl) ::   &  !: 
    383       sxe ,  sye ,  sxxe ,  syye ,  sxye            !: ice layers heat content 
     338   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)     ::   sxopw, syopw, sxxopw, syyopw, sxyopw   !: open water in sea ice 
     339   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   ::   sxice, syice, sxxice, syyice, sxyice   !: ice thickness  
     340   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   ::   sxsn , sysn , sxxsn , syysn , sxysn    !: snow thickness 
     341   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   ::   sxa  , sya  , sxxa  , syya  , sxya     !: lead fraction 
     342   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   ::   sxc0 , syc0 , sxxc0 , syyc0 , sxyc0    !: snow thermal content 
     343   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   ::   sxsal, sysal, sxxsal, syysal, sxysal   !: ice salinity 
     344   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   ::   sxage, syage, sxxage, syyage, sxyage   !: ice age 
     345   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::   sxe  , sye  , sxxe  , syye  , sxye     !: ice layers heat content 
    384346 
    385347   !!-------------------------------------------------------------------------- 
    386348   !! * Old values of global variables 
    387349   !!-------------------------------------------------------------------------- 
    388    REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpl) ::   &  !:  
    389       old_v_s, old_v_i,                          &  !: snow and ice volumes 
    390       old_a_i, old_smv_i, old_oa_i 
    391    REAL(wp), PUBLIC, DIMENSION(jpi,jpj,nlay_s,jpl) ::   &  !: 
    392       old_e_s                                       !: snow heat content 
    393    REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jkmax,jpl) ::   &  !: 
    394       old_e_i                          !: ice temperatures 
    395    REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   &  !: ice velocity (gv6 and gv7) 
    396       old_u_ice, old_v_ice 
     350   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   ::   old_v_s, old_v_i               !: snow and ice volumes 
     351   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   ::   old_a_i, old_smv_i, old_oa_i   !: ??? 
     352   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::   old_e_s                        !: snow heat content 
     353   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::   old_e_i                        !: ice temperatures 
     354   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)     ::   old_u_ice, old_v_ice           !: ice velocity (gv6 and gv7) 
     355       
    397356 
    398357   !!-------------------------------------------------------------------------- 
     
    401360   ! thd refers to changes induced by thermodynamics 
    402361   ! trp   ''         ''     ''       advection (transport of ice) 
    403    REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpl) ::   &  !:  
    404       d_a_i_thd  , d_a_i_trp ,                   &  !: icefractions                   
    405       d_v_s_thd  , d_v_s_trp,                    &  !: snow volume 
    406       d_v_i_thd  , d_v_i_trp,                    &  !: ice  volume 
    407       d_smv_i_thd, d_smv_i_trp,                  &      
    408       d_sm_i_fl  , d_sm_i_gd ,                   & 
    409       d_sm_i_se  , d_sm_i_si , d_sm_i_la ,       & 
    410       d_oa_i_thd , d_oa_i_trp, s_i_newice 
    411  
    412    REAL(wp), PUBLIC, DIMENSION(jpi,jpj,nlay_s,jpl) ::  &  !: 
    413       d_e_s_thd, d_e_s_trp 
    414  
    415    REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jkmax,jpl) ::   &  !: 
    416       d_e_i_thd, d_e_i_trp 
    417  
    418    REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::       &  !: ice velocity  
    419       d_u_ice_dyn, d_v_ice_dyn 
    420  
     362   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   d_a_i_thd  , d_a_i_trp                 !: icefractions                   
     363   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   d_v_s_thd  , d_v_s_trp                 !: snow volume 
     364   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   d_v_i_thd  , d_v_i_trp                 !: ice  volume 
     365   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   d_smv_i_thd, d_smv_i_trp               !:      
     366   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   d_sm_i_fl  , d_sm_i_gd                 !: 
     367   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   d_sm_i_se  , d_sm_i_si  , d_sm_i_la    !: 
     368   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   d_oa_i_thd , d_oa_i_trp , s_i_newice   !: 
     369 
     370   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::   d_e_s_thd  , d_e_s_trp     !: 
     371   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::   d_e_i_thd  , d_e_i_trp     !: 
     372   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)     ::   d_u_ice_dyn, d_v_ice_dyn   !: ice velocity  
     373       
    421374   !!-------------------------------------------------------------------------- 
    422375   !! * Ice thickness distribution variables 
    423376   !!-------------------------------------------------------------------------- 
    424377   ! REMOVE 
    425    INTEGER, PUBLIC, DIMENSION(jpl)                ::   &  !: 
    426       ice_types      !: Vector making the connection between types and categories 
    427  
    428    INTEGER, PUBLIC, DIMENSION(jpm,2)              ::   &  !: 
    429       ice_cat_bounds !: Matrix containing the integer upper and  
    430    !: lower boundaries of ice thickness categories 
    431  
     378   INTEGER , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)   ::   ice_types      !: Vector connecting types and categories 
     379   INTEGER , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   ice_cat_bounds !: Matrix containing the integer upper and  
     380   !                                                                       !  lower boundaries of ice thickness categories 
    432381   ! REMOVE 
    433    INTEGER, PUBLIC, DIMENSION(jpm)                ::   &  !: 
    434       ice_ncat_types !: Vector containing the number of thickness categories in each ice type 
    435  
    436    REAL(wp), PUBLIC, DIMENSION(0:jpl)             ::   &  !: 
    437       hi_max          !: Boundary of ice thickness categories in thickness space 
    438  
    439    REAL(wp), PUBLIC, DIMENSION(jpl)               ::   &  !: 
    440       hi_mean         !: Mean ice thickness in catgories  
    441  
     382   INTEGER , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)   ::   ice_ncat_types !: nb of thickness categories in each ice type 
     383   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)   ::   hi_max         !: Boundary of ice thickness categories in thickness space 
     384   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)   ::   hi_mean        !: Mean ice thickness in catgories  
    442385   ! REMOVE 
    443    REAL(wp), PUBLIC, DIMENSION(0:jpl,jpm)         ::   &  !: 
    444       hi_max_typ     !: Boundary of ice thickness categories  
    445    !:in thickness space (same but specific for each ice type) 
     386   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hi_max_typ     !: Boundary of ice thickness categories in thickness space 
    446387 
    447388   !!-------------------------------------------------------------------------- 
    448389   !! * Ice Run 
    449390   !!-------------------------------------------------------------------------- 
    450    !! Namelist namicerun read in iceini 
     391   !                                                                     !!: ** Namelist namicerun read in iceini ** 
    451392   CHARACTER(len=32)     , PUBLIC ::   cn_icerst_in  = "restart_ice_in"   !: suffix of ice restart name (input) 
    452393   CHARACTER(len=32)     , PUBLIC ::   cn_icerst_out = "restart_ice"      !: suffix of ice restart name (output) 
     
    463404   !!-------------------------------------------------------------------------- 
    464405   !! Check if everything down here is necessary 
    465    REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   &  !: volume of ice formed in the leads 
    466       v_newice 
    467    REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpl) ::   &  !: thermodynamic growth rates  
    468       dv_dt_thd,  & 
    469       izero, fstroc, fhbricat 
    470    REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   &  
    471       diag_sni_gr,                           & ! snow ice growth  
    472       diag_lat_gr,                           & ! lateral ice growth  
    473       diag_bot_gr,                           & ! bottom ice growth  
    474       diag_dyn_gr,                           & ! dynamical ice growth  
    475       diag_bot_me,                           & ! vertical bottom melt  
    476       diag_sur_me                              ! vertical surface melt 
     406   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   v_newice   !: volume of ice formed in the leads 
     407   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   dv_dt_thd  !: thermodynamic growth rates  
     408   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   izero, fstroc, fhbricat 
     409   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   diag_sni_gr   ! snow ice growth  
     410   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   diag_lat_gr   ! lateral ice growth  
     411   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   diag_bot_gr   ! bottom ice growth  
     412   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   diag_dyn_gr   ! dynamical ice growth  
     413   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   diag_bot_me   ! vertical bottom melt  
     414   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   diag_sur_me   ! vertical surface melt 
    477415   INTEGER , PUBLIC ::   jiindx, jjindx        !: indexes of the debugging point 
     416 
     417   !!---------------------------------------------------------------------- 
     418   !! NEMO/LIM3 4.0 , UCL - NEMO Consortium (2010) 
     419   !! $Id$ 
     420   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
     421   !!---------------------------------------------------------------------- 
     422CONTAINS 
     423 
     424   FUNCTION ice_alloc() 
     425      !!----------------------------------------------------------------- 
     426      !!               *** Routine ice_alloc_2 *** 
     427      !!----------------------------------------------------------------- 
     428      INTEGER :: ice_alloc 
     429      ! 
     430      INTEGER :: ierr(20), ii 
     431      !!----------------------------------------------------------------- 
     432 
     433      ierr(:) = 0 
     434 
     435      ! What could be one huge allocate statement is broken-up to try to 
     436      ! stay within Fortran's max-line length limit. 
     437      ii = 1 
     438      ALLOCATE( u_oce    (jpi,jpj) , v_oce    (jpi,jpj) ,                           & 
     439         &      ahiu     (jpi,jpj) , ahiv     (jpi,jpj) ,                           & 
     440         &      pahu     (jpi,jpj) , pahv     (jpi,jpj) ,                           & 
     441         &      ust2s    (jpi,jpj) , hicol    (jpi,jpj) ,                           & 
     442         &      strp1    (jpi,jpj) , strp2    (jpi,jpj) , strength  (jpi,jpj) ,     & 
     443         &      stress1_i(jpi,jpj) , stress2_i(jpi,jpj) , stress12_i(jpi,jpj) ,     & 
     444         &      delta_i  (jpi,jpj) , divu_i   (jpi,jpj) , shear_i   (jpi,jpj) , STAT=ierr(ii) ) 
     445 
     446      ii = ii + 1 
     447      ALLOCATE( firic    (jpi,jpj) , fcsic  (jpi,jpj) , fleic    (jpi,jpj) , qlatic   (jpi,jpj) ,     & 
     448         &      rdvosif  (jpi,jpj) , rdvobif(jpi,jpj) , fdvolif  (jpi,jpj) , rdvonif  (jpi,jpj) ,     & 
     449         &      sist     (jpi,jpj) , icethi (jpi,jpj) , t_bo     (jpi,jpj) , hicifp   (jpi,jpj) ,     & 
     450         &      frld     (jpi,jpj) , pfrld  (jpi,jpj) , phicif   (jpi,jpj) , fbif     (jpi,jpj) ,     & 
     451         &      rdmsnif  (jpi,jpj) , rdmicif(jpi,jpj) , qldif    (jpi,jpj) , qcmif    (jpi,jpj) ,     & 
     452         &      fdtcn    (jpi,jpj) , qdtcn  (jpi,jpj) , fstric   (jpi,jpj) , fscmbq   (jpi,jpj) ,     & 
     453         &      ffltbif  (jpi,jpj) , fsbbq  (jpi,jpj) , qfvbq    (jpi,jpj) , dmgwi    (jpi,jpj) ,     & 
     454         &      fsalt_res(jpi,jpj) , fsbri  (jpi,jpj) , fsalt_rpo(jpi,jpj) , fheat_rpo(jpi,jpj) ,     & 
     455         &      fhbri    (jpi,jpj) , fmmec  (jpi,jpj) , fseqv    (jpi,jpj) , fhmec    (jpi,jpj) ,     & 
     456         &      fheat_res(jpi,jpj)                                                              , STAT=ierr(ii) ) 
     457 
     458      ii = ii + 1 
     459      ALLOCATE( dh_i_surf2D(jpi,jpj) , dh_i_bott2D(jpi,jpj) , fstbif(jpi,jpj) ,     & 
     460         &      fsup2D     (jpi,jpj) , focea2D    (jpi,jpj) , q_s   (jpi,jpj) , STAT=ierr(ii) ) 
     461 
     462      ii = ii + 1 
     463      ALLOCATE( patho_case(jpi, jpj, jpl)  , STAT=ierr(ii) ) 
     464 
     465      ! * Ice global state variables 
     466      ii = ii + 1 
     467      ALLOCATE( ht_i (jpi,jpj,jpl) , a_i  (jpi,jpj,jpl) , v_i  (jpi,jpj,jpl) ,     & 
     468         &      v_s  (jpi,jpj,jpl) , ht_s (jpi,jpj,jpl) , t_su (jpi,jpj,jpl) ,     & 
     469         &      sm_i (jpi,jpj,jpl) , smv_i(jpi,jpj,jpl) , o_i  (jpi,jpj,jpl) ,     & 
     470         &      ov_i (jpi,jpj,jpl) , oa_i (jpi,jpj,jpl)                      , STAT=ierr(ii) ) 
     471      ii = ii + 1 
     472      ALLOCATE( u_ice(jpi,jpj) , v_ice(jpi,jpj) , tio_u(jpi,jpj) , tio_v(jpi,jpj) ,     & 
     473         &      vt_i (jpi,jpj) , vt_s (jpi,jpj) , at_i (jpi,jpj) , ato_i(jpi,jpj) ,     & 
     474         &      et_i (jpi,jpj) , et_s (jpi,jpj) , ot_i (jpi,jpj) , tm_i (jpi,jpj) ,     & 
     475         &      bv_i (jpi,jpj) , smt_i(jpi,jpj)                                   , STAT=ierr(ii) ) 
     476      ii = ii + 1 
     477      ALLOCATE( t_s(jpi,jpj,nlay_s,jpl) , at_i_typ(jpi,jpj,jpm) ,                            & 
     478         &      e_s(jpi,jpj,nlay_s,jpl) , vt_i_typ(jpi,jpj,jpm) , e_i_cat(jpi,jpj,jpl) , STAT=ierr(ii) ) 
     479      ii = ii + 1 
     480      ALLOCATE( t_i(jpi,jpj,jkmax,jpl) , e_i(jpi,jpj,jkmax,jpl) , s_i(jpi,jpj,jkmax,jpl) , STAT=ierr(ii) ) 
     481 
     482      ! * Moments for advection 
     483      ii = ii + 1 
     484      ALLOCATE( sxopw(jpi,jpj) , syopw(jpi,jpj) , sxxopw(jpi,jpj) , syyopw(jpi,jpj) , sxyopw(jpi,jpj) , STAT=ierr(ii) ) 
     485      ii = ii + 1 
     486      ALLOCATE( sxice(jpi,jpj,jpl) , syice(jpi,jpj,jpl) , sxxice(jpi,jpj,jpl) , syyice(jpi,jpj,jpl) , sxyice(jpi,jpj,jpl) ,   & 
     487         &      sxsn (jpi,jpj,jpl) , sysn (jpi,jpj,jpl) , sxxsn (jpi,jpj,jpl) , syysn (jpi,jpj,jpl) , sxysn (jpi,jpj,jpl) ,   & 
     488         &      STAT=ierr(ii) ) 
     489      ii = ii + 1 
     490      ALLOCATE( sxa  (jpi,jpj,jpl) , sya  (jpi,jpj,jpl) , sxxa  (jpi,jpj,jpl) , syya  (jpi,jpj,jpl) , sxya  (jpi,jpj,jpl) ,   & 
     491         &      sxc0 (jpi,jpj,jpl) , syc0 (jpi,jpj,jpl) , sxxc0 (jpi,jpj,jpl) , syyc0 (jpi,jpj,jpl) , sxyc0 (jpi,jpj,jpl) ,   & 
     492         &      sxsal(jpi,jpj,jpl) , sysal(jpi,jpj,jpl) , sxxsal(jpi,jpj,jpl) , syysal(jpi,jpj,jpl) , sxysal(jpi,jpj,jpl) ,   & 
     493         &      sxage(jpi,jpj,jpl) , syage(jpi,jpj,jpl) , sxxage(jpi,jpj,jpl) , syyage(jpi,jpj,jpl) , sxyage(jpi,jpj,jpl) ,   & 
     494         &      STAT=ierr(ii) ) 
     495      ii = ii + 1 
     496      ALLOCATE( sxe (jpi,jpj,jkmax,jpl) , sye (jpi,jpj,jkmax,jpl) , sxxe(jpi,jpj,jkmax,jpl) ,     & 
     497         &      syye(jpi,jpj,jkmax,jpl) , sxye(jpi,jpj,jkmax,jpl)                           , STAT=ierr(ii) ) 
     498 
     499      ! * Old values of global variables 
     500      ii = ii + 1 
     501      ALLOCATE( old_v_s  (jpi,jpj,jpl) , old_v_i  (jpi,jpj,jpl) , old_e_s(jpi,jpj,nlay_s,jpl) ,     & 
     502         &      old_a_i  (jpi,jpj,jpl) , old_smv_i(jpi,jpj,jpl) , old_e_i(jpi,jpj,jkmax ,jpl) ,     & 
     503         &      old_oa_i (jpi,jpj,jpl)                                                        ,     & 
     504         &      old_u_ice(jpi,jpj)     , old_v_ice(jpi,jpj)                                   , STAT=ierr(ii) ) 
     505 
     506      ! * Increment of global variables 
     507      ii = ii + 1 
     508      ALLOCATE( d_a_i_thd(jpi,jpj,jpl) , d_a_i_trp (jpi,jpj,jpl) , d_v_s_thd  (jpi,jpj,jpl) , d_v_s_trp  (jpi,jpj,jpl) ,   & 
     509         &      d_v_i_thd(jpi,jpj,jpl) , d_v_i_trp (jpi,jpj,jpl) , d_smv_i_thd(jpi,jpj,jpl) , d_smv_i_trp(jpi,jpj,jpl) ,   &      
     510         &      d_sm_i_fl(jpi,jpj,jpl) , d_sm_i_gd (jpi,jpj,jpl) , d_sm_i_se  (jpi,jpj,jpl) , d_sm_i_si  (jpi,jpj,jpl) ,   & 
     511         &      d_sm_i_la(jpi,jpj,jpl) , d_oa_i_thd(jpi,jpj,jpl) , d_oa_i_trp (jpi,jpj,jpl) , s_i_newice (jpi,jpj,jpl) ,   & 
     512         &     STAT=ierr(ii) ) 
     513      ii = ii + 1 
     514      ALLOCATE( d_e_s_thd(jpi,jpj,nlay_s,jpl) , d_e_i_thd(jpi,jpj,jkmax,jpl) , d_u_ice_dyn(jpi,jpj) ,     & 
     515         &      d_e_s_trp(jpi,jpj,nlay_s,jpl) , d_e_i_trp(jpi,jpj,jkmax,jpl) , d_v_ice_dyn(jpi,jpj) , STAT=ierr(ii) ) 
     516       
     517      ! * Ice thickness distribution variables 
     518      ii = ii + 1 
     519      ALLOCATE( ice_types(jpl) , ice_cat_bounds(jpm,2) , ice_ncat_types  (jpm) ,     & 
     520         &      hi_max (0:jpl) , hi_mean(jpl)          , hi_max_typ(0:jpl,jpm) , STAT=ierr(ii) ) 
     521 
     522      ! * Ice diagnostics 
     523      ii = ii + 1 
     524      ALLOCATE( dv_dt_thd(jpi,jpj,jpl) , diag_sni_gr(jpi,jpj) , diag_lat_gr(jpi,jpj) ,     & 
     525         &      izero    (jpi,jpj,jpl) , diag_bot_gr(jpi,jpj) , diag_dyn_gr(jpi,jpj) ,     & 
     526         &      fstroc   (jpi,jpj,jpl) , diag_bot_me(jpi,jpj) , diag_sur_me(jpi,jpj) ,     & 
     527         &      fhbricat (jpi,jpj,jpl) , v_newice   (jpi,jpj)                        , STAT=ierr(ii) ) 
     528 
     529      ice_alloc = MAXVAL( ierr(:) ) 
     530      IF( ice_alloc /= 0 )   CALL ctl_warn('ice_alloc_2: failed to allocate arrays.') 
     531      ! 
     532   END FUNCTION ice_alloc 
    478533 
    479534#else 
Note: See TracChangeset for help on using the changeset viewer.