ice.F90 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927
  1. MODULE ice
  2. !!======================================================================
  3. !! *** MODULE ice ***
  4. !! LIM-3 Sea Ice physics: diagnostics variables of ice defined in memory
  5. !!=====================================================================
  6. !! History : 3.0 ! 2008-03 (M. Vancoppenolle) original code LIM-3
  7. !! 4.0 ! 2011-02 (G. Madec) dynamical allocation
  8. !!----------------------------------------------------------------------
  9. #if defined key_lim3
  10. !!----------------------------------------------------------------------
  11. !! 'key_lim3' LIM-3 sea-ice model
  12. !!----------------------------------------------------------------------
  13. USE in_out_manager ! I/O manager
  14. USE lib_mpp ! MPP library
  15. IMPLICIT NONE
  16. PRIVATE
  17. PUBLIC ice_alloc ! Called in sbc_lim_init
  18. !!======================================================================
  19. !! LIM3 by the use of sweat, agile fingers and sometimes brain juice,
  20. !! was developed in Louvain-la-Neuve by :
  21. !! * Martin Vancoppenolle (UCL-ASTR, Belgium)
  22. !! * Sylvain Bouillon (UCL-ASTR, Belgium)
  23. !! * Miguel Angel Morales Maqueda (NOC-L, UK)
  24. !!
  25. !! Based on extremely valuable earlier work by
  26. !! * Thierry Fichefet
  27. !! * Hugues Goosse
  28. !!
  29. !! The following persons also contributed to the code in various ways
  30. !! * Gurvan Madec, Claude Talandier, Christian Ethe (LOCEAN, France)
  31. !! * Xavier Fettweis (UCL-ASTR), Ralph Timmermann (AWI, Germany)
  32. !! * Bill Lipscomb (LANL), Cecilia Bitz (UWa)
  33. !! and Elisabeth Hunke (LANL), USA.
  34. !!
  35. !! For more info, the interested user is kindly invited to consult the following references
  36. !! For model description and validation :
  37. !! * Vancoppenolle et al., Ocean Modelling, 2008a.
  38. !! * Vancoppenolle et al., Ocean Modelling, 2008b.
  39. !! For a specific description of EVP :
  40. !! * Bouillon et al., Ocean Modelling 2009.
  41. !!
  42. !! Or the reference manual, that should be available by 2011
  43. !!======================================================================
  44. !! |
  45. !! I C E S T A T E V A R I A B L E S |
  46. !! |
  47. !! Introduction : |
  48. !! -------------- |
  49. !! Every ice-covered grid cell is characterized by a series of state |
  50. !! variables. To account for unresolved spatial variability in ice |
  51. !! thickness, the ice cover in divided in ice thickness categories. |
  52. !! |
  53. !! Sea ice state variables depend on the ice thickness category |
  54. !! |
  55. !! Those variables are divided into two groups |
  56. !! * Extensive (or global) variables. |
  57. !! These are the variables that are transported by all means |
  58. !! * Intensive (or equivalent) variables. |
  59. !! These are the variables that are either physically more |
  60. !! meaningful and/or used in ice thermodynamics |
  61. !! |
  62. !! Routines in limvar.F90 perform conversions |
  63. !! - lim_var_glo2eqv : from global to equivalent variables |
  64. !! - lim_var_eqv2glo : from equivalent to global variables |
  65. !! |
  66. !! For various purposes, the sea ice state variables have sometimes |
  67. !! to be aggregated over all ice thickness categories. This operation |
  68. !! is done in : |
  69. !! - lim_var_agg |
  70. !! |
  71. !! in icestp.F90, the routines that compute the changes in the ice |
  72. !! state variables are called |
  73. !! - lim_dyn : ice dynamics |
  74. !! - lim_trp : ice transport |
  75. !! - lim_itd_me : mechanical redistribution (ridging and rafting) |
  76. !! - lim_thd : ice halo-thermodynamics |
  77. !! - lim_itd_th : thermodynamic changes in ice thickness distribution |
  78. !! and creation of new ice |
  79. !! |
  80. !! See the associated routines for more information |
  81. !! |
  82. !! List of ice state variables : |
  83. !! ----------------------------- |
  84. !! |
  85. !!-------------|-------------|---------------------------------|-------|
  86. !! name in | name in | meaning | units |
  87. !! 2D routines | 1D routines | | |
  88. !!-------------|-------------|---------------------------------|-------|
  89. !! |
  90. !! ******************************************************************* |
  91. !! *** Dynamical variables (prognostic) *** |
  92. !! ******************************************************************* |
  93. !! |
  94. !! u_ice | - | Comp. U of the ice velocity | m/s |
  95. !! v_ice | - | Comp. V of the ice velocity | m/s |
  96. !! |
  97. !! ******************************************************************* |
  98. !! *** Category dependent state variables (prognostic) *** |
  99. !! ******************************************************************* |
  100. !! |
  101. !! ** Global variables |
  102. !!-------------|-------------|---------------------------------|-------|
  103. !! a_i | a_i_1d | Ice concentration | |
  104. !! v_i | - | Ice volume per unit area | m |
  105. !! v_s | - | Snow volume per unit area | m |
  106. !! smv_i | - | Sea ice salt content | ppt.m |
  107. !! oa_i ! - ! Sea ice areal age content | day |
  108. !! e_i ! - ! Ice enthalpy | J/m2 |
  109. !! - ! q_i_1d ! Ice enthalpy per unit vol. | J/m3 |
  110. !! e_s ! - ! Snow enthalpy | J/m2 |
  111. !! - ! q_s_1d ! Snow enthalpy per unit vol. | J/m3 |
  112. !! |
  113. !!-------------|-------------|---------------------------------|-------|
  114. !! |
  115. !! ** Equivalent variables |
  116. !!-------------|-------------|---------------------------------|-------|
  117. !! |
  118. !! ht_i | ht_i_1d | Ice thickness | m |
  119. !! ht_s ! ht_s_1d | Snow depth | m |
  120. !! sm_i ! sm_i_1d | Sea ice bulk salinity ! ppt |
  121. !! s_i ! s_i_1d | Sea ice salinity profile ! ppt |
  122. !! o_i ! - | Sea ice Age ! days |
  123. !! t_i ! t_i_1d | Sea ice temperature ! K |
  124. !! t_s ! t_s_1d | Snow temperature ! K |
  125. !! t_su ! t_su_1d | Sea ice surface temperature ! K |
  126. !! |
  127. !! notes: the ice model only sees a bulk (i.e., vertically averaged) |
  128. !! salinity, except in thermodynamic computations, for which |
  129. !! the salinity profile is computed as a function of bulk |
  130. !! salinity |
  131. !! |
  132. !! the sea ice surface temperature is not associated to any |
  133. !! heat content. Therefore, it is not a state variable and |
  134. !! does not have to be advected. Nevertheless, it has to be |
  135. !! computed to determine whether the ice is melting or not |
  136. !! |
  137. !! ******************************************************************* |
  138. !! *** Category-summed state variables (diagnostic) *** |
  139. !! ******************************************************************* |
  140. !! at_i | at_i_1d | Total ice concentration | |
  141. !! vt_i | - | Total ice vol. per unit area | m |
  142. !! vt_s | - | Total snow vol. per unit ar. | m |
  143. !! smt_i | - | Mean sea ice salinity | ppt |
  144. !! tm_i | - | Mean sea ice temperature | K |
  145. !! ot_i ! - ! Sea ice areal age content | day |
  146. !! et_i ! - ! Total ice enthalpy | J/m2 |
  147. !! et_s ! - ! Total snow enthalpy | J/m2 |
  148. !! bv_i ! - ! Mean relative brine volume | ??? |
  149. !!=====================================================================
  150. LOGICAL, PUBLIC :: con_i = .false. ! switch for conservation test
  151. !!--------------------------------------------------------------------------
  152. !! * Share Module variables
  153. !!--------------------------------------------------------------------------
  154. INTEGER , PUBLIC :: nstart !: iteration number of the begining of the run
  155. INTEGER , PUBLIC :: nlast !: iteration number of the end of the run
  156. INTEGER , PUBLIC :: nitrun !: number of iteration
  157. INTEGER , PUBLIC :: numit !: iteration number
  158. REAL(wp), PUBLIC :: rdt_ice !: ice time step
  159. REAL(wp), PUBLIC :: r1_rdtice !: = 1. / rdt_ice
  160. ! !!** ice-thickness distribution namelist (namiceitd) **
  161. INTEGER , PUBLIC :: nn_catbnd !: categories distribution following: tanh function (1), or h^(-alpha) function (2)
  162. REAL(wp), PUBLIC :: rn_himean !: mean thickness of the domain (used to compute the distribution, nn_itdshp = 2 only)
  163. ! !!** ice-dynamics namelist (namicedyn) **
  164. LOGICAL , PUBLIC :: ln_icestr_bvf !: use brine volume to diminish ice strength
  165. INTEGER , PUBLIC :: nn_icestr !: ice strength parameterization (0=Hibler79 1=Rothrock75)
  166. INTEGER , PUBLIC :: nn_nevp !: number of iterations for subcycling
  167. INTEGER , PUBLIC :: nn_ahi0 !: sea-ice hor. eddy diffusivity coeff. (3 ways of calculation)
  168. REAL(wp), PUBLIC :: rn_pe_rdg !: ridging work divided by pot. energy change in ridging, nn_icestr = 1
  169. REAL(wp), PUBLIC :: rn_cio !: drag coefficient for oceanic stress
  170. REAL(wp), PUBLIC :: rn_pstar !: determines ice strength (N/M), Hibler JPO79
  171. REAL(wp), PUBLIC :: rn_crhg !: determines changes in ice strength
  172. REAL(wp), PUBLIC :: rn_creepl !: creep limit : has to be under 1.0e-9
  173. REAL(wp), PUBLIC :: rn_ecc !: eccentricity of the elliptical yield curve
  174. REAL(wp), PUBLIC :: rn_ahi0_ref !: sea-ice hor. eddy diffusivity coeff. (m2/s)
  175. REAL(wp), PUBLIC :: rn_relast !: ratio => telast/rdt_ice (1/3 or 1/9 depending on nb of subcycling nevp)
  176. ! !!** ice-salinity namelist (namicesal) **
  177. REAL(wp), PUBLIC :: rn_simax !: maximum ice salinity [PSU]
  178. REAL(wp), PUBLIC :: rn_simin !: minimum ice salinity [PSU]
  179. REAL(wp), PUBLIC :: rn_sal_gd !: restoring salinity for gravity drainage [PSU]
  180. REAL(wp), PUBLIC :: rn_sal_fl !: restoring salinity for flushing [PSU]
  181. REAL(wp), PUBLIC :: rn_time_gd !: restoring time constant for gravity drainage (= 20 days) [s]
  182. REAL(wp), PUBLIC :: rn_time_fl !: restoring time constant for gravity drainage (= 10 days) [s]
  183. REAL(wp), PUBLIC :: rn_icesal !: bulk salinity (ppt) in case of constant salinity
  184. ! !!** ice-salinity namelist (namicesal) **
  185. INTEGER , PUBLIC :: nn_icesal !: salinity configuration used in the model
  186. ! ! 1 - constant salinity in both space and time
  187. ! ! 2 - prognostic salinity (s(z,t))
  188. ! ! 3 - salinity profile, constant in time
  189. INTEGER , PUBLIC :: nn_ice_thcon !: thermal conductivity: =0 Untersteiner (1964) ; =1 Pringle et al (2007)
  190. INTEGER , PUBLIC :: nn_monocat !: virtual ITD mono-category parameterizations (1) or not (0)
  191. LOGICAL , PUBLIC :: ln_it_qnsice !: iterate surface flux with changing surface temperature or not (F)
  192. ! !!** ice-mechanical redistribution namelist (namiceitdme)
  193. REAL(wp), PUBLIC :: rn_cs !: fraction of shearing energy contributing to ridging
  194. REAL(wp), PUBLIC :: rn_fsnowrdg !: fractional snow loss to the ocean during ridging
  195. REAL(wp), PUBLIC :: rn_fsnowrft !: fractional snow loss to the ocean during ridging
  196. REAL(wp), PUBLIC :: rn_gstar !: fractional area of young ice contributing to ridging
  197. REAL(wp), PUBLIC :: rn_astar !: equivalent of G* for an exponential participation function
  198. REAL(wp), PUBLIC :: rn_hstar !: thickness that determines the maximal thickness of ridged ice
  199. REAL(wp), PUBLIC :: rn_hraft !: threshold thickness (m) for rafting / ridging
  200. REAL(wp), PUBLIC :: rn_craft !: coefficient for smoothness of the hyperbolic tangent in rafting
  201. REAL(wp), PUBLIC :: rn_por_rdg !: initial porosity of ridges (0.3 regular value)
  202. REAL(wp), PUBLIC :: rn_betas !: coef. for partitioning of snowfall between leads and sea ice
  203. REAL(wp), PUBLIC :: rn_kappa_i !: coef. for the extinction of radiation Grenfell et al. (2006) [1/m]
  204. REAL(wp), PUBLIC :: rn_cdsn !: thermal conductivity of the snow [W/m/K]
  205. REAL(wp), PUBLIC :: nn_conv_dif !: maximal number of iterations for heat diffusion
  206. REAL(wp), PUBLIC :: rn_terr_dif !: maximal tolerated error (C) for heat diffusion
  207. ! !!** ice-mechanical redistribution namelist (namiceitdme)
  208. LOGICAL , PUBLIC :: ln_rafting !: rafting of ice or not
  209. INTEGER , PUBLIC :: nn_partfun !: participation function: =0 Thorndike et al. (1975), =1 Lipscomb et al. (2007)
  210. REAL(wp), PUBLIC :: usecc2 !: = 1.0 / ( rn_ecc * rn_ecc )
  211. REAL(wp), PUBLIC :: rhoco !: = rau0 * cio
  212. REAL(wp), PUBLIC :: r1_nlay_i !: 1 / nlay_i
  213. REAL(wp), PUBLIC :: r1_nlay_s !: 1 / nlay_s
  214. !
  215. ! !!** switch for presence of ice or not
  216. REAL(wp), PUBLIC :: rswitch
  217. !
  218. ! !!** define some parameters
  219. REAL(wp), PUBLIC, PARAMETER :: epsi06 = 1.e-06_wp !: small number
  220. REAL(wp), PUBLIC, PARAMETER :: epsi10 = 1.e-10_wp !: small number
  221. REAL(wp), PUBLIC, PARAMETER :: epsi20 = 1.e-20_wp !: small number
  222. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: u_oce, v_oce !: surface ocean velocity used in ice dynamics
  223. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: ahiu , ahiv !: hor. diffusivity coeff. at U- and V-points [m2/s]
  224. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: ust2s, hicol !: friction velocity, ice collection thickness accreted in leads
  225. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: strp1, strp2 !: strength at previous time steps
  226. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: strength !: ice strength
  227. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: stress1_i, stress2_i, stress12_i !: 1st, 2nd & diagonal stress tensor element
  228. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: delta_i !: ice rheology elta factor (Flato & Hibler 95) [s-1]
  229. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: divu_i !: Divergence of the velocity field [s-1]
  230. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: shear_i !: Shear of the velocity field [s-1]
  231. !
  232. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: sist !: Average Sea-Ice Surface Temperature [Kelvin]
  233. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: t_bo !: Sea-Ice bottom temperature [Kelvin]
  234. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: frld !: Leads fraction = 1 - ice fraction
  235. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: pfrld !: Leads fraction at previous time
  236. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: phicif !: Old ice thickness
  237. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: qlead !: heat balance of the lead (or of the open ocean)
  238. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: fhtur !: net downward heat flux from the ice to the ocean
  239. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: fhld !: heat flux from the lead used for bottom melting
  240. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: wfx_snw !: snow-ocean mass exchange [kg.m-2.s-1]
  241. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: wfx_spr !: snow precipitation on ice [kg.m-2.s-1]
  242. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: wfx_sub !: snow/ice sublimation [kg.m-2.s-1]
  243. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: wfx_ice !: ice-ocean mass exchange [kg.m-2.s-1]
  244. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: wfx_sni !: snow ice growth component of wfx_ice [kg.m-2.s-1]
  245. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: wfx_opw !: lateral ice growth component of wfx_ice [kg.m-2.s-1]
  246. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: wfx_bog !: bottom ice growth component of wfx_ice [kg.m-2.s-1]
  247. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: wfx_dyn !: dynamical ice growth component of wfx_ice [kg.m-2.s-1]
  248. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: wfx_bom !: bottom melt component of wfx_ice [kg.m-2.s-1]
  249. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: wfx_sum !: surface melt component of wfx_ice [kg.m-2.s-1]
  250. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: wfx_res !: residual component of wfx_ice [kg.m-2.s-1]
  251. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: afx_tot !: ice concentration tendency (total) [s-1]
  252. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: afx_thd !: ice concentration tendency (thermodynamics) [s-1]
  253. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: afx_dyn !: ice concentration tendency (dynamics) [s-1]
  254. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: sfx_bog !: salt flux due to ice growth/melt [PSU/m2/s]
  255. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: sfx_bom !: salt flux due to ice growth/melt [PSU/m2/s]
  256. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: sfx_sum !: salt flux due to ice growth/melt [PSU/m2/s]
  257. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: sfx_sni !: salt flux due to ice growth/melt [PSU/m2/s]
  258. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: sfx_opw !: salt flux due to ice growth/melt [PSU/m2/s]
  259. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: sfx_bri !: salt flux due to brine rejection [PSU/m2/s]
  260. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: sfx_dyn !: salt flux due to porous ridged ice formation [PSU/m2/s]
  261. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: sfx_res !: residual salt flux due to correction of ice thickness [PSU/m2/s]
  262. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: sfx_sub !: salt flux due to ice sublimation
  263. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: hfx_bog !: total heat flux causing bottom ice growth [W.m-2]
  264. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: hfx_bom !: total heat flux causing bottom ice melt [W.m-2]
  265. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: hfx_sum !: total heat flux causing surface ice melt [W.m-2]
  266. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: hfx_opw !: total heat flux causing open water ice formation [W.m-2]
  267. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: hfx_dif !: total heat flux causing Temp change in the ice [W.m-2]
  268. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: hfx_snw !: heat flux for snow melt [W.m-2]
  269. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: hfx_err !: heat flux error after heat diffusion [W.m-2]
  270. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: hfx_err_dif !: heat flux remaining due to change in non-solar flux [W.m-2]
  271. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: hfx_err_rem !: heat flux error after heat remapping [W.m-2]
  272. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: hfx_in !: heat flux available for thermo transformations [W.m-2]
  273. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: hfx_out !: heat flux remaining at the end of thermo transformations [W.m-2]
  274. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: wfx_err_sub !: mass flux error after sublimation [kg.m-2.s-1]
  275. ! heat flux associated with ice-atmosphere mass exchange
  276. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: hfx_sub !: heat flux for sublimation [W.m-2]
  277. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: hfx_spr !: heat flux of the snow precipitation [W.m-2]
  278. ! heat flux associated with ice-ocean mass exchange
  279. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: hfx_thd !: ice-ocean heat flux from thermo processes (limthd_dh) [W.m-2]
  280. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: hfx_dyn !: ice-ocean heat flux from mecanical processes (limitd_me) [W.m-2]
  281. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: hfx_res !: residual heat flux due to correction of ice thickness [W.m-2]
  282. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: ftr_ice !: transmitted solar radiation under ice
  283. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: pahu3D , pahv3D
  284. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: rn_amax_2d !: maximum ice concentration 2d array
  285. !!--------------------------------------------------------------------------
  286. !! * Ice global state variables
  287. !!--------------------------------------------------------------------------
  288. !! Variables defined for each ice category
  289. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: ht_i !: Ice thickness (m)
  290. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: a_i !: Ice fractional areas (concentration)
  291. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: v_i !: Ice volume per unit area (m)
  292. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: v_s !: Snow volume per unit area(m)
  293. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: ht_s !: Snow thickness (m)
  294. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: t_su !: Sea-Ice Surface Temperature (K)
  295. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: sm_i !: Sea-Ice Bulk salinity (ppt)
  296. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: smv_i !: Sea-Ice Bulk salinity times volume per area (ppt.m)
  297. ! ! this is an extensive variable that has to be transported
  298. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: o_i !: Sea-Ice Age (days)
  299. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: oa_i !: Sea-Ice Age times ice area (days)
  300. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: bv_i !: brine volume
  301. !! Variables summed over all categories, or associated to all the ice in a single grid cell
  302. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: u_ice, v_ice !: components of the ice velocity (m/s)
  303. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: vt_i , vt_s !: ice and snow total volume per unit area (m)
  304. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: at_i !: ice total fractional area (ice concentration)
  305. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: ato_i !: =1-at_i ; total open water fractional area
  306. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: et_i , et_s !: ice and snow total heat content
  307. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: tm_i !: mean ice temperature over all categories
  308. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: bvm_i !: brine volume averaged over all categories
  309. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: smt_i !: mean sea ice salinity averaged over all categories [PSU]
  310. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: tm_su !: mean surface temperature over all categories
  311. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: htm_i !: mean ice thickness over all categories
  312. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: htm_s !: mean snow thickness over all categories
  313. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: om_i !: mean ice age over all categories
  314. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) :: t_s !: Snow temperatures [K]
  315. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) :: e_s !: Snow ...
  316. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) :: t_i !: ice temperatures [K]
  317. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) :: e_i !: ice thermal contents [J/m2]
  318. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) :: s_i !: ice salinities [PSU]
  319. !!--------------------------------------------------------------------------
  320. !! * Moments for advection
  321. !!--------------------------------------------------------------------------
  322. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: sxopw, syopw, sxxopw, syyopw, sxyopw !: open water in sea ice
  323. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: sxice, syice, sxxice, syyice, sxyice !: ice thickness
  324. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: sxsn , sysn , sxxsn , syysn , sxysn !: snow thickness
  325. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: sxa , sya , sxxa , syya , sxya !: lead fraction
  326. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: sxc0 , syc0 , sxxc0 , syyc0 , sxyc0 !: snow thermal content
  327. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: sxsal, sysal, sxxsal, syysal, sxysal !: ice salinity
  328. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: sxage, syage, sxxage, syyage, sxyage !: ice age
  329. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) :: sxe , sye , sxxe , syye , sxye !: ice layers heat content
  330. !!--------------------------------------------------------------------------
  331. !! * Old values of global variables
  332. !!--------------------------------------------------------------------------
  333. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: v_s_b, v_i_b !: snow and ice volumes
  334. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: a_i_b, smv_i_b, oa_i_b !:
  335. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) :: e_s_b !: snow heat content
  336. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) :: e_i_b !: ice temperatures
  337. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: u_ice_b, v_ice_b !: ice velocity
  338. !!--------------------------------------------------------------------------
  339. !! * Ice thickness distribution variables
  340. !!--------------------------------------------------------------------------
  341. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) :: hi_max !: Boundary of ice thickness categories in thickness space
  342. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) :: hi_mean !: Mean ice thickness in catgories
  343. !!--------------------------------------------------------------------------
  344. !! * Ice Run
  345. !!--------------------------------------------------------------------------
  346. ! !!: ** Namelist namicerun read in sbc_lim_init **
  347. INTEGER , PUBLIC :: jpl !: number of ice categories
  348. INTEGER , PUBLIC :: nlay_i !: number of ice layers
  349. INTEGER , PUBLIC :: nlay_s !: number of snow layers
  350. CHARACTER(len=80), PUBLIC :: cn_icerst_in !: suffix of ice restart name (input)
  351. CHARACTER(len=256), PUBLIC :: cn_icerst_indir !: ice restart input directory
  352. CHARACTER(len=80), PUBLIC :: cn_icerst_out !: suffix of ice restart name (output)
  353. CHARACTER(len=256), PUBLIC :: cn_icerst_outdir!: ice restart output directory
  354. LOGICAL , PUBLIC :: ln_limdyn !: flag for ice dynamics (T) or not (F)
  355. LOGICAL , PUBLIC :: ln_icectl !: flag for sea-ice points output (T) or not (F)
  356. REAL(wp) , PUBLIC :: rn_amax_n !: maximum ice concentration Northern hemisphere
  357. REAL(wp) , PUBLIC :: rn_amax_s !: maximum ice concentration Southern hemisphere
  358. INTEGER , PUBLIC :: iiceprt !: debug i-point
  359. INTEGER , PUBLIC :: jiceprt !: debug j-point
  360. !
  361. !!--------------------------------------------------------------------------
  362. !! * Ice diagnostics
  363. !!--------------------------------------------------------------------------
  364. ! Increment of global variables
  365. ! thd refers to changes induced by thermodynamics
  366. ! trp '' '' '' advection (transport of ice)
  367. LOGICAL , PUBLIC :: ln_limdiahsb !: flag for ice diag (T) or not (F)
  368. LOGICAL , PUBLIC :: ln_limdiaout !: flag for ice diag (T) or not (F)
  369. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: diag_trp_vi !: transport of ice volume
  370. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: diag_trp_vs !: transport of snw volume
  371. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: diag_trp_ei !: transport of ice enthalpy (W/m2)
  372. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: diag_trp_es !: transport of snw enthalpy (W/m2)
  373. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: diag_trp_smv !: transport of salt content
  374. !
  375. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: diag_heat !: snw/ice heat content variation [W/m2]
  376. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: diag_smvi !: ice salt content variation []
  377. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: diag_vice !: ice volume variation [m/s]
  378. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: diag_vsnw !: snw volume variation [m/s]
  379. !
  380. !!----------------------------------------------------------------------
  381. !! NEMO/LIM3 4.0 , UCL - NEMO Consortium (2010)
  382. !! $Id: ice.F90 4990 2014-12-15 16:42:49Z timgraham $
  383. !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
  384. !!----------------------------------------------------------------------
  385. CONTAINS
  386. FUNCTION ice_alloc()
  387. !!-----------------------------------------------------------------
  388. !! *** Routine ice_alloc ***
  389. !!-----------------------------------------------------------------
  390. INTEGER :: ice_alloc
  391. !
  392. INTEGER :: ierr(17), ii
  393. !!-----------------------------------------------------------------
  394. ierr(:) = 0
  395. ! What could be one huge allocate statement is broken-up to try to
  396. ! stay within Fortran's max-line length limit.
  397. ii = 1
  398. ALLOCATE( u_oce (jpi,jpj) , v_oce (jpi,jpj) , &
  399. & ahiu (jpi,jpj) , ahiv (jpi,jpj) , &
  400. & ust2s (jpi,jpj) , hicol (jpi,jpj) , &
  401. & strp1 (jpi,jpj) , strp2 (jpi,jpj) , strength (jpi,jpj) , &
  402. & stress1_i(jpi,jpj) , stress2_i(jpi,jpj) , stress12_i(jpi,jpj) , &
  403. & delta_i (jpi,jpj) , divu_i (jpi,jpj) , shear_i (jpi,jpj) , STAT=ierr(ii) )
  404. #if defined key_init_alloc_zero
  405. IF (ierr(ii)==0) THEN
  406. u_oce = 0
  407. v_oce = 0
  408. ahiu = 0
  409. ahiv = 0
  410. ust2s = 0
  411. hicol = 0
  412. strp1 = 0
  413. strp2 = 0
  414. strength = 0
  415. stress1_i = 0
  416. stress2_i = 0
  417. stress12_i = 0
  418. delta_i = 0
  419. divu_i = 0
  420. shear_i = 0
  421. ENDIF
  422. #elif defined key_init_alloc_huge
  423. IF (ierr(ii)==0) THEN
  424. u_oce = HUGE(u_oce)
  425. v_oce = HUGE(v_oce)
  426. ahiu = HUGE(ahiu)
  427. ahiv = HUGE(ahiv)
  428. ust2s = HUGE(ust2s)
  429. hicol = HUGE(hicol)
  430. strp1 = HUGE(strp1)
  431. strp2 = HUGE(strp2)
  432. strength = HUGE(strength)
  433. stress1_i = HUGE(stress1_i)
  434. stress2_i = HUGE(stress2_i)
  435. stress12_i = HUGE(stress12_i)
  436. delta_i = HUGE(delta_i)
  437. divu_i = HUGE(divu_i)
  438. shear_i = HUGE(shear_i)
  439. ENDIF
  440. #endif
  441. ii = ii + 1
  442. ALLOCATE( sist (jpi,jpj) , t_bo (jpi,jpj) , &
  443. & frld (jpi,jpj) , pfrld (jpi,jpj) , phicif (jpi,jpj) , &
  444. & wfx_snw(jpi,jpj) , wfx_ice(jpi,jpj) , wfx_sub(jpi,jpj) , &
  445. & wfx_bog(jpi,jpj) , wfx_dyn(jpi,jpj) , wfx_bom(jpi,jpj) , wfx_sum(jpi,jpj) , &
  446. & wfx_res(jpi,jpj) , wfx_sni(jpi,jpj) , wfx_opw(jpi,jpj) , wfx_spr(jpi,jpj) , &
  447. & afx_tot(jpi,jpj) , afx_thd(jpi,jpj), afx_dyn(jpi,jpj) , &
  448. & fhtur (jpi,jpj) , ftr_ice(jpi,jpj,jpl), pahu3D(jpi,jpj,jpl+1), pahv3D(jpi,jpj,jpl+1), &
  449. & qlead (jpi,jpj) , rn_amax_2d(jpi,jpj), &
  450. & sfx_res(jpi,jpj) , sfx_bri(jpi,jpj) , sfx_dyn(jpi,jpj) , sfx_sub(jpi,jpj), &
  451. & sfx_bog(jpi,jpj) , sfx_bom(jpi,jpj) , sfx_sum(jpi,jpj) , sfx_sni(jpi,jpj) , sfx_opw(jpi,jpj) , &
  452. & hfx_res(jpi,jpj) , hfx_snw(jpi,jpj) , hfx_sub(jpi,jpj) , hfx_err(jpi,jpj) , &
  453. & hfx_err_dif(jpi,jpj) , hfx_err_rem(jpi,jpj) , wfx_err_sub(jpi,jpj) , &
  454. & hfx_in (jpi,jpj) , hfx_out(jpi,jpj) , fhld(jpi,jpj) , &
  455. & hfx_sum(jpi,jpj) , hfx_bom(jpi,jpj) , hfx_bog(jpi,jpj) , hfx_dif(jpi,jpj) , hfx_opw(jpi,jpj) , &
  456. & hfx_thd(jpi,jpj) , hfx_dyn(jpi,jpj) , hfx_spr(jpi,jpj) , STAT=ierr(ii) )
  457. #if defined key_init_alloc_zero
  458. IF (ierr(ii)==0) THEN
  459. sist = 0
  460. t_bo = 0
  461. frld = 0
  462. pfrld = 0
  463. phicif = 0
  464. wfx_snw = 0
  465. wfx_ice = 0
  466. wfx_sub = 0
  467. wfx_bog = 0
  468. wfx_dyn = 0
  469. wfx_bom = 0
  470. wfx_sum = 0
  471. wfx_res = 0
  472. wfx_sni = 0
  473. wfx_opw = 0
  474. wfx_spr = 0
  475. afx_tot = 0
  476. afx_thd = 0
  477. afx_dyn = 0
  478. fhtur = 0
  479. ftr_ice = 0
  480. pahu3D = 0
  481. pahv3D = 0
  482. qlead = 0
  483. rn_amax_2d = 0
  484. sfx_res = 0
  485. sfx_bri = 0
  486. sfx_dyn = 0
  487. sfx_sub = 0
  488. sfx_bog = 0
  489. sfx_bom = 0
  490. sfx_sum = 0
  491. sfx_sni = 0
  492. sfx_opw = 0
  493. hfx_res = 0
  494. hfx_snw = 0
  495. hfx_sub = 0
  496. hfx_err = 0
  497. hfx_err_dif = 0
  498. hfx_err_rem = 0
  499. wfx_err_sub = 0
  500. hfx_in = 0
  501. hfx_out = 0
  502. fhld = 0
  503. hfx_sum = 0
  504. hfx_bom = 0
  505. hfx_bog = 0
  506. hfx_dif = 0
  507. hfx_opw = 0
  508. hfx_thd = 0
  509. hfx_dyn = 0
  510. hfx_spr = 0
  511. ENDIF
  512. #elif defined key_init_alloc_huge
  513. IF (ierr(ii)==0) THEN
  514. sist = HUGE(sist)
  515. t_bo = HUGE(t_bo)
  516. frld = HUGE(frld)
  517. pfrld = HUGE(pfrld)
  518. phicif = HUGE(phicif)
  519. wfx_snw = HUGE(wfx_snw)
  520. wfx_ice = HUGE(wfx_ice)
  521. wfx_sub = HUGE(wfx_sub)
  522. wfx_bog = HUGE(wfx_bog)
  523. wfx_dyn = HUGE(wfx_dyn)
  524. wfx_bom = HUGE(wfx_bom)
  525. wfx_sum = HUGE(wfx_sum)
  526. wfx_res = HUGE(wfx_res)
  527. wfx_sni = HUGE(wfx_sni)
  528. wfx_opw = HUGE(wfx_opw)
  529. wfx_spr = HUGE(wfx_spr)
  530. afx_tot = HUGE(afx_tot)
  531. afx_thd = HUGE(afx_thd)
  532. afx_dyn = HUGE(afx_dyn)
  533. fhtur = HUGE(fhtur)
  534. ftr_ice = HUGE(ftr_ice)
  535. pahu3D = HUGE(pahu3D)
  536. pahv3D = HUGE(pahv3D)
  537. qlead = HUGE(qlead)
  538. rn_amax_2d = HUGE(rn_amax_2d)
  539. sfx_res = HUGE(sfx_res)
  540. sfx_bri = HUGE(sfx_bri)
  541. sfx_dyn = HUGE(sfx_dyn)
  542. sfx_sub = HUGE(sfx_sub)
  543. sfx_bog = HUGE(sfx_bog)
  544. sfx_bom = HUGE(sfx_bom)
  545. sfx_sum = HUGE(sfx_sum)
  546. sfx_sni = HUGE(sfx_sni)
  547. sfx_opw = HUGE(sfx_opw)
  548. hfx_res = HUGE(hfx_res)
  549. hfx_snw = HUGE(hfx_snw)
  550. hfx_sub = HUGE(hfx_sub)
  551. hfx_err = HUGE(hfx_err)
  552. hfx_err_dif = HUGE(hfx_err_dif)
  553. hfx_err_rem = HUGE(hfx_err_rem)
  554. wfx_err_sub = HUGE(wfx_err_sub)
  555. hfx_in = HUGE(hfx_in)
  556. hfx_out = HUGE(hfx_out)
  557. fhld = HUGE(fhld)
  558. hfx_sum = HUGE(hfx_sum)
  559. hfx_bom = HUGE(hfx_bom)
  560. hfx_bog = HUGE(hfx_bog)
  561. hfx_dif = HUGE(hfx_dif)
  562. hfx_opw = HUGE(hfx_opw)
  563. hfx_thd = HUGE(hfx_thd)
  564. hfx_dyn = HUGE(hfx_dyn)
  565. hfx_spr = HUGE(hfx_spr)
  566. ENDIF
  567. #endif
  568. ! * Ice global state variables
  569. ii = ii + 1
  570. ALLOCATE( ht_i (jpi,jpj,jpl) , a_i (jpi,jpj,jpl) , v_i (jpi,jpj,jpl) , &
  571. & v_s (jpi,jpj,jpl) , ht_s (jpi,jpj,jpl) , t_su (jpi,jpj,jpl) , &
  572. & sm_i (jpi,jpj,jpl) , smv_i(jpi,jpj,jpl) , o_i (jpi,jpj,jpl) , &
  573. & oa_i (jpi,jpj,jpl) , bv_i (jpi,jpj,jpl) , STAT=ierr(ii) )
  574. #if defined key_init_alloc_zero
  575. IF (ierr(ii)==0) THEN
  576. ht_i = 0
  577. a_i = 0
  578. v_i = 0
  579. v_s = 0
  580. ht_s = 0
  581. t_su = 0
  582. sm_i = 0
  583. smv_i = 0
  584. o_i = 0
  585. oa_i = 0
  586. bv_i = 0
  587. ENDIF
  588. #elif defined key_init_alloc_huge
  589. IF (ierr(ii)==0) THEN
  590. ht_i = HUGE(ht_i)
  591. a_i = HUGE(a_i)
  592. v_i = HUGE(v_i)
  593. v_s = HUGE(v_s)
  594. ht_s = HUGE(ht_s)
  595. t_su = HUGE(t_su)
  596. sm_i = HUGE(sm_i)
  597. smv_i = HUGE(smv_i)
  598. o_i = HUGE(o_i)
  599. oa_i = HUGE(oa_i)
  600. bv_i = HUGE(bv_i)
  601. ENDIF
  602. #endif
  603. ii = ii + 1
  604. ALLOCATE( u_ice(jpi,jpj) , v_ice(jpi,jpj) , &
  605. & vt_i (jpi,jpj) , vt_s (jpi,jpj) , at_i (jpi,jpj) , ato_i(jpi,jpj) , &
  606. & et_i (jpi,jpj) , et_s (jpi,jpj) , tm_i (jpi,jpj) , bvm_i(jpi,jpj) , &
  607. & smt_i(jpi,jpj) , tm_su(jpi,jpj) , htm_i(jpi,jpj) , htm_s(jpi,jpj) , &
  608. & om_i (jpi,jpj) , STAT=ierr(ii) )
  609. #if defined key_init_alloc_zero
  610. IF (ierr(ii)==0) THEN
  611. u_ice = 0
  612. v_ice = 0
  613. vt_i = 0
  614. vt_s = 0
  615. at_i = 0
  616. ato_i = 0
  617. et_i = 0
  618. et_s = 0
  619. tm_i = 0
  620. bvm_i = 0
  621. smt_i = 0
  622. tm_su = 0
  623. htm_i = 0
  624. htm_s = 0
  625. om_i = 0
  626. ENDIF
  627. #elif defined key_init_alloc_huge
  628. IF (ierr(ii)==0) THEN
  629. u_ice = HUGE(u_ice)
  630. v_ice = HUGE(v_ice)
  631. vt_i = HUGE(vt_i)
  632. vt_s = HUGE(vt_s)
  633. at_i = HUGE(at_i)
  634. ato_i = HUGE(ato_i)
  635. et_i = HUGE(et_i)
  636. et_s = HUGE(et_s)
  637. tm_i = HUGE(tm_i)
  638. bvm_i = HUGE(bvm_i)
  639. smt_i = HUGE(smt_i)
  640. tm_su = HUGE(tm_su)
  641. htm_i = HUGE(htm_i)
  642. htm_s = HUGE(htm_s)
  643. om_i = HUGE(om_i)
  644. ENDIF
  645. #endif
  646. ii = ii + 1
  647. ALLOCATE( t_s(jpi,jpj,nlay_s,jpl) , e_s(jpi,jpj,nlay_s,jpl) , STAT=ierr(ii) )
  648. #if defined key_init_alloc_zero
  649. IF (ierr(ii)==0) THEN
  650. t_s = 0
  651. e_s = 0
  652. ENDIF
  653. #elif defined key_init_alloc_huge
  654. IF (ierr(ii)==0) THEN
  655. t_s = HUGE(t_s)
  656. e_s = HUGE(e_s)
  657. ENDIF
  658. #endif
  659. ii = ii + 1
  660. ALLOCATE( t_i(jpi,jpj,nlay_i,jpl) , e_i(jpi,jpj,nlay_i,jpl) , s_i(jpi,jpj,nlay_i,jpl) , STAT=ierr(ii) )
  661. #if defined key_init_alloc_zero
  662. IF (ierr(ii)==0) THEN
  663. t_i = 0
  664. e_i = 0
  665. s_i = 0
  666. ENDIF
  667. #elif defined key_init_alloc_huge
  668. IF (ierr(ii)==0) THEN
  669. t_i = HUGE(t_i)
  670. e_i = HUGE(e_i)
  671. s_i = HUGE(s_i)
  672. ENDIF
  673. #endif
  674. ! * Moments for advection
  675. ii = ii + 1
  676. ALLOCATE( sxopw(jpi,jpj) , syopw(jpi,jpj) , sxxopw(jpi,jpj) , syyopw(jpi,jpj) , sxyopw(jpi,jpj) , STAT=ierr(ii) )
  677. #if defined key_init_alloc_zero
  678. IF (ierr(ii)==0) THEN
  679. sxopw = 0
  680. syopw = 0
  681. sxxopw = 0
  682. syyopw = 0
  683. sxyopw = 0
  684. ENDIF
  685. #elif defined key_init_alloc_huge
  686. IF (ierr(ii)==0) THEN
  687. sxopw = HUGE(sxopw)
  688. syopw = HUGE(syopw)
  689. sxxopw = HUGE(sxxopw)
  690. syyopw = HUGE(syyopw)
  691. sxyopw = HUGE(sxyopw)
  692. ENDIF
  693. #endif
  694. ii = ii + 1
  695. ALLOCATE( sxice(jpi,jpj,jpl) , syice(jpi,jpj,jpl) , sxxice(jpi,jpj,jpl) , syyice(jpi,jpj,jpl) , sxyice(jpi,jpj,jpl) , &
  696. & sxsn (jpi,jpj,jpl) , sysn (jpi,jpj,jpl) , sxxsn (jpi,jpj,jpl) , syysn (jpi,jpj,jpl) , sxysn (jpi,jpj,jpl) , &
  697. & STAT=ierr(ii) )
  698. #if defined key_init_alloc_zero
  699. IF (ierr(ii)==0) THEN
  700. sxice = 0
  701. syice = 0
  702. sxxice = 0
  703. syyice = 0
  704. sxyice = 0
  705. sxsn = 0
  706. sysn = 0
  707. sxxsn = 0
  708. syysn = 0
  709. sxysn = 0
  710. ENDIF
  711. #elif defined key_init_alloc_huge
  712. IF (ierr(ii)==0) THEN
  713. sxice = HUGE(sxice)
  714. syice = HUGE(syice)
  715. sxxice = HUGE(sxxice)
  716. syyice = HUGE(syyice)
  717. sxyice = HUGE(sxyice)
  718. sxsn = HUGE(sxsn)
  719. sysn = HUGE(sysn)
  720. sxxsn = HUGE(sxxsn)
  721. syysn = HUGE(syysn)
  722. sxysn = HUGE(sxysn)
  723. ENDIF
  724. #endif
  725. ii = ii + 1
  726. ALLOCATE( sxa (jpi,jpj,jpl) , sya (jpi,jpj,jpl) , sxxa (jpi,jpj,jpl) , syya (jpi,jpj,jpl) , sxya (jpi,jpj,jpl) , &
  727. & sxc0 (jpi,jpj,jpl) , syc0 (jpi,jpj,jpl) , sxxc0 (jpi,jpj,jpl) , syyc0 (jpi,jpj,jpl) , sxyc0 (jpi,jpj,jpl) , &
  728. & sxsal(jpi,jpj,jpl) , sysal(jpi,jpj,jpl) , sxxsal(jpi,jpj,jpl) , syysal(jpi,jpj,jpl) , sxysal(jpi,jpj,jpl) , &
  729. & sxage(jpi,jpj,jpl) , syage(jpi,jpj,jpl) , sxxage(jpi,jpj,jpl) , syyage(jpi,jpj,jpl) , sxyage(jpi,jpj,jpl) , &
  730. & STAT=ierr(ii) )
  731. #if defined key_init_alloc_zero
  732. IF (ierr(ii)==0) THEN
  733. sxa = 0
  734. sya = 0
  735. sxxa = 0
  736. syya = 0
  737. sxya = 0
  738. sxc0 = 0
  739. syc0 = 0
  740. sxxc0 = 0
  741. syyc0 = 0
  742. sxyc0 = 0
  743. sxsal = 0
  744. sysal = 0
  745. sxxsal = 0
  746. syysal = 0
  747. sxysal = 0
  748. sxage = 0
  749. syage = 0
  750. sxxage = 0
  751. syyage = 0
  752. sxyage = 0
  753. ENDIF
  754. #elif defined key_init_alloc_huge
  755. IF (ierr(ii)==0) THEN
  756. sxa = HUGE(sxa)
  757. sya = HUGE(sya)
  758. sxxa = HUGE(sxxa)
  759. syya = HUGE(syya)
  760. sxya = HUGE(sxya)
  761. sxc0 = HUGE(sxc0)
  762. syc0 = HUGE(syc0)
  763. sxxc0 = HUGE(sxxc0)
  764. syyc0 = HUGE(syyc0)
  765. sxyc0 = HUGE(sxyc0)
  766. sxsal = HUGE(sxsal)
  767. sysal = HUGE(sysal)
  768. sxxsal = HUGE(sxxsal)
  769. syysal = HUGE(syysal)
  770. sxysal = HUGE(sxysal)
  771. sxage = HUGE(sxage)
  772. syage = HUGE(syage)
  773. sxxage = HUGE(sxxage)
  774. syyage = HUGE(syyage)
  775. sxyage = HUGE(sxyage)
  776. ENDIF
  777. #endif
  778. ii = ii + 1
  779. ALLOCATE( sxe (jpi,jpj,nlay_i,jpl) , sye (jpi,jpj,nlay_i,jpl) , sxxe(jpi,jpj,nlay_i,jpl) , &
  780. & syye(jpi,jpj,nlay_i,jpl) , sxye(jpi,jpj,nlay_i,jpl) , STAT=ierr(ii) )
  781. #if defined key_init_alloc_zero
  782. IF (ierr(ii)==0) THEN
  783. sxe = 0
  784. sye = 0
  785. sxxe = 0
  786. syye = 0
  787. sxye = 0
  788. ENDIF
  789. #elif defined key_init_alloc_huge
  790. IF (ierr(ii)==0) THEN
  791. sxe = HUGE(sxe)
  792. sye = HUGE(sye)
  793. sxxe = HUGE(sxxe)
  794. syye = HUGE(syye)
  795. sxye = HUGE(sxye)
  796. ENDIF
  797. #endif
  798. ! * Old values of global variables
  799. ii = ii + 1
  800. ALLOCATE( v_s_b (jpi,jpj,jpl) , v_i_b (jpi,jpj,jpl) , e_s_b(jpi,jpj,nlay_s,jpl) , &
  801. & a_i_b (jpi,jpj,jpl) , smv_i_b(jpi,jpj,jpl) , e_i_b(jpi,jpj,nlay_i,jpl) , &
  802. & oa_i_b (jpi,jpj,jpl) , u_ice_b(jpi,jpj) , v_ice_b(jpi,jpj) , STAT=ierr(ii) )
  803. #if defined key_init_alloc_zero
  804. IF (ierr(ii)==0) THEN
  805. v_s_b = 0
  806. v_i_b = 0
  807. e_s_b = 0
  808. a_i_b = 0
  809. smv_i_b = 0
  810. e_i_b = 0
  811. oa_i_b = 0
  812. u_ice_b = 0
  813. v_ice_b = 0
  814. ENDIF
  815. #elif defined key_init_alloc_huge
  816. IF (ierr(ii)==0) THEN
  817. v_s_b = HUGE(v_s_b)
  818. v_i_b = HUGE(v_i_b)
  819. e_s_b = HUGE(e_s_b)
  820. a_i_b = HUGE(a_i_b)
  821. smv_i_b = HUGE(smv_i_b)
  822. e_i_b = HUGE(e_i_b)
  823. oa_i_b = HUGE(oa_i_b)
  824. u_ice_b = HUGE(u_ice_b)
  825. v_ice_b = HUGE(v_ice_b)
  826. ENDIF
  827. #endif
  828. ! * Ice thickness distribution variables
  829. ii = ii + 1
  830. ALLOCATE( hi_max(0:jpl), hi_mean(jpl), STAT=ierr(ii) )
  831. #if defined key_init_alloc_zero
  832. IF (ierr(ii)==0) THEN
  833. hi_max = 0
  834. hi_mean = 0
  835. ENDIF
  836. #elif defined key_init_alloc_huge
  837. IF (ierr(ii)==0) THEN
  838. hi_max = HUGE(hi_max)
  839. hi_mean = HUGE(hi_mean)
  840. ENDIF
  841. #endif
  842. ! * Ice diagnostics
  843. ii = ii + 1
  844. ALLOCATE( diag_trp_vi(jpi,jpj), diag_trp_vs (jpi,jpj), diag_trp_ei(jpi,jpj), &
  845. & diag_trp_es(jpi,jpj), diag_trp_smv(jpi,jpj), diag_heat (jpi,jpj), &
  846. & diag_smvi (jpi,jpj), diag_vice (jpi,jpj), diag_vsnw (jpi,jpj), STAT=ierr(ii) )
  847. #if defined key_init_alloc_zero
  848. IF (ierr(ii)==0) THEN
  849. diag_trp_vi = 0
  850. diag_trp_vs = 0
  851. diag_trp_ei = 0
  852. diag_trp_es = 0
  853. diag_trp_smv = 0
  854. diag_heat = 0
  855. diag_smvi = 0
  856. diag_vice = 0
  857. diag_vsnw = 0
  858. ENDIF
  859. #elif defined key_init_alloc_huge
  860. IF (ierr(ii)==0) THEN
  861. diag_trp_vi = HUGE(diag_trp_vi)
  862. diag_trp_vs = HUGE(diag_trp_vs)
  863. diag_trp_ei = HUGE(diag_trp_ei)
  864. diag_trp_es = HUGE(diag_trp_es)
  865. diag_trp_smv = HUGE(diag_trp_smv)
  866. diag_heat = HUGE(diag_heat)
  867. diag_smvi = HUGE(diag_smvi)
  868. diag_vice = HUGE(diag_vice)
  869. diag_vsnw = HUGE(diag_vsnw)
  870. ENDIF
  871. #endif
  872. ice_alloc = MAXVAL( ierr(:) )
  873. IF( ice_alloc /= 0 ) CALL ctl_warn('ice_alloc: failed to allocate arrays.')
  874. !
  875. END FUNCTION ice_alloc
  876. #else
  877. !!----------------------------------------------------------------------
  878. !! Default option Empty module NO LIM sea-ice model
  879. !!----------------------------------------------------------------------
  880. #endif
  881. !!======================================================================
  882. END MODULE ice