ice.F90 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977
  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 | s |
  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 ! s |
  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 !: sublimation of snow/ice [kg.m-2.s-1]
  243. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: wfx_snw_sub !: snow sublimation [kg.m-2.s-1]
  244. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: wfx_ice_sub !: ice sublimation [kg.m-2.s-1]
  245. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: wfx_snw_dyn !: dynamical component of wfx_snw [kg.m-2.s-1]
  246. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: wfx_snw_sum !: surface melt component of wfx_snw [kg.m-2.s-1]
  247. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: wfx_ice !: ice-ocean mass exchange [kg.m-2.s-1]
  248. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: wfx_sni !: snow ice growth component of wfx_ice [kg.m-2.s-1]
  249. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: wfx_opw !: lateral ice growth component of wfx_ice [kg.m-2.s-1]
  250. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: wfx_bog !: bottom ice growth component of wfx_ice [kg.m-2.s-1]
  251. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: wfx_dyn !: dynamical ice growth component of wfx_ice [kg.m-2.s-1]
  252. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: wfx_bom !: bottom melt component of wfx_ice [kg.m-2.s-1]
  253. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: wfx_sum !: surface melt component of wfx_ice [kg.m-2.s-1]
  254. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: wfx_res !: residual component of wfx_ice [kg.m-2.s-1]
  255. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: afx_tot !: ice concentration tendency (total) [s-1]
  256. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: afx_thd !: ice concentration tendency (thermodynamics) [s-1]
  257. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: afx_dyn !: ice concentration tendency (dynamics) [s-1]
  258. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: sfx_bog !: salt flux due to ice growth/melt [PSU/m2/s]
  259. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: sfx_bom !: salt flux due to ice growth/melt [PSU/m2/s]
  260. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: sfx_sum !: salt flux due to ice growth/melt [PSU/m2/s]
  261. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: sfx_sni !: salt flux due to ice growth/melt [PSU/m2/s]
  262. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: sfx_opw !: salt flux due to ice growth/melt [PSU/m2/s]
  263. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: sfx_bri !: salt flux due to brine rejection [PSU/m2/s]
  264. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: sfx_dyn !: salt flux due to porous ridged ice formation [PSU/m2/s]
  265. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: sfx_res !: residual salt flux due to correction of ice thickness [PSU/m2/s]
  266. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: sfx_sub !: salt flux due to ice sublimation
  267. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: hfx_bog !: total heat flux causing bottom ice growth [W.m-2]
  268. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: hfx_bom !: total heat flux causing bottom ice melt [W.m-2]
  269. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: hfx_sum !: total heat flux causing surface ice melt [W.m-2]
  270. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: hfx_opw !: total heat flux causing open water ice formation [W.m-2]
  271. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: hfx_dif !: total heat flux causing Temp change in the ice [W.m-2]
  272. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: hfx_snw !: heat flux for snow melt [W.m-2]
  273. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: hfx_err !: heat flux error after heat diffusion [W.m-2]
  274. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: hfx_err_dif !: heat flux remaining due to change in non-solar flux [W.m-2]
  275. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: hfx_err_rem !: heat flux error after heat remapping [W.m-2]
  276. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: hfx_in !: heat flux available for thermo transformations [W.m-2]
  277. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: hfx_out !: heat flux remaining at the end of thermo transformations [W.m-2]
  278. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: wfx_err_sub !: mass flux error after sublimation [kg.m-2.s-1]
  279. ! heat flux associated with ice-atmosphere mass exchange
  280. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: hfx_sub !: heat flux for sublimation [W.m-2]
  281. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: hfx_spr !: heat flux of the snow precipitation [W.m-2]
  282. ! heat flux associated with ice-ocean mass exchange
  283. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: hfx_thd !: ice-ocean heat flux from thermo processes (limthd_dh) [W.m-2]
  284. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: hfx_dyn !: ice-ocean heat flux from mecanical processes (limitd_me) [W.m-2]
  285. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: hfx_res !: residual heat flux due to correction of ice thickness [W.m-2]
  286. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: ftr_ice !: transmitted solar radiation under ice
  287. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: pahu3D , pahv3D
  288. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: rn_amax_2d !: maximum ice concentration 2d array
  289. !!--------------------------------------------------------------------------
  290. !! * Ice global state variables
  291. !!--------------------------------------------------------------------------
  292. !! Variables defined for each ice category
  293. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: ht_i !: Ice thickness (m)
  294. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: a_i !: Ice fractional areas (concentration)
  295. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: v_i !: Ice volume per unit area (m)
  296. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: v_s !: Snow volume per unit area(m)
  297. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: ht_s !: Snow thickness (m)
  298. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: t_su !: Sea-Ice Surface Temperature (K)
  299. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: sm_i !: Sea-Ice Bulk salinity (ppt)
  300. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: smv_i !: Sea-Ice Bulk salinity times volume per area (ppt.m)
  301. ! ! this is an extensive variable that has to be transported
  302. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: o_i !: Sea-Ice Age (s)
  303. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: oa_i !: Sea-Ice Age times ice area (s)
  304. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: bv_i !: brine volume
  305. !! Variables summed over all categories, or associated to all the ice in a single grid cell
  306. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: u_ice, v_ice !: components of the ice velocity (m/s)
  307. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: vt_i , vt_s !: ice and snow total volume per unit area (m)
  308. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: at_i !: ice total fractional area (ice concentration)
  309. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: ato_i !: =1-at_i ; total open water fractional area
  310. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: et_i , et_s !: ice and snow total heat content
  311. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: tm_i !: mean ice temperature over all categories
  312. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: bvm_i !: brine volume averaged over all categories
  313. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: smt_i !: mean sea ice salinity averaged over all categories [PSU]
  314. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: tm_su !: mean surface temperature over all categories
  315. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: htm_i !: mean ice thickness over all categories
  316. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: htm_s !: mean snow thickness over all categories
  317. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: om_i !: mean ice age over all categories
  318. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) :: t_s !: Snow temperatures [K]
  319. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) :: e_s !: Snow ...
  320. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) :: t_i !: ice temperatures [K]
  321. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) :: e_i !: ice thermal contents [J/m2]
  322. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) :: s_i !: ice salinities [PSU]
  323. !!--------------------------------------------------------------------------
  324. !! * Moments for advection
  325. !!--------------------------------------------------------------------------
  326. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: sxopw, syopw, sxxopw, syyopw, sxyopw !: open water in sea ice
  327. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: sxice, syice, sxxice, syyice, sxyice !: ice thickness
  328. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: sxsn , sysn , sxxsn , syysn , sxysn !: snow thickness
  329. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: sxa , sya , sxxa , syya , sxya !: lead fraction
  330. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: sxc0 , syc0 , sxxc0 , syyc0 , sxyc0 !: snow thermal content
  331. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: sxsal, sysal, sxxsal, syysal, sxysal !: ice salinity
  332. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: sxage, syage, sxxage, syyage, sxyage !: ice age
  333. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) :: sxe , sye , sxxe , syye , sxye !: ice layers heat content
  334. !!--------------------------------------------------------------------------
  335. !! * Old values of global variables
  336. !!--------------------------------------------------------------------------
  337. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: v_s_b, v_i_b !: snow and ice volumes
  338. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: a_i_b, smv_i_b, oa_i_b !:
  339. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) :: e_s_b !: snow heat content
  340. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) :: e_i_b !: ice temperatures
  341. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: u_ice_b, v_ice_b !: ice velocity
  342. !!--------------------------------------------------------------------------
  343. !! * Ice thickness distribution variables
  344. !!--------------------------------------------------------------------------
  345. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) :: hi_max !: Boundary of ice thickness categories in thickness space
  346. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) :: hi_mean !: Mean ice thickness in catgories
  347. !!--------------------------------------------------------------------------
  348. !! * Ice Run
  349. !!--------------------------------------------------------------------------
  350. ! !!: ** Namelist namicerun read in sbc_lim_init **
  351. INTEGER , PUBLIC :: jpl !: number of ice categories
  352. INTEGER , PUBLIC :: nlay_i !: number of ice layers
  353. INTEGER , PUBLIC :: nlay_s !: number of snow layers
  354. CHARACTER(len=80), PUBLIC :: cn_icerst_in !: suffix of ice restart name (input)
  355. CHARACTER(len=256), PUBLIC :: cn_icerst_indir !: ice restart input directory
  356. CHARACTER(len=80), PUBLIC :: cn_icerst_out !: suffix of ice restart name (output)
  357. CHARACTER(len=256), PUBLIC :: cn_icerst_outdir!: ice restart output directory
  358. LOGICAL , PUBLIC :: ln_limdyn !: flag for ice dynamics (T) or not (F)
  359. LOGICAL , PUBLIC :: ln_icectl !: flag for sea-ice points output (T) or not (F)
  360. REAL(wp) , PUBLIC :: rn_amax_n !: maximum ice concentration Northern hemisphere
  361. REAL(wp) , PUBLIC :: rn_amax_s !: maximum ice concentration Southern hemisphere
  362. INTEGER , PUBLIC :: iiceprt !: debug i-point
  363. INTEGER , PUBLIC :: jiceprt !: debug j-point
  364. !
  365. !!--------------------------------------------------------------------------
  366. !! * Ice diagnostics
  367. !!--------------------------------------------------------------------------
  368. ! Increment of global variables
  369. ! thd refers to changes induced by thermodynamics
  370. ! trp '' '' '' advection (transport of ice)
  371. LOGICAL , PUBLIC :: ln_limdiahsb !: flag for ice diag (T) or not (F)
  372. LOGICAL , PUBLIC :: ln_limdiaout !: flag for ice diag (T) or not (F)
  373. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: diag_trp_vi !: transport of ice volume
  374. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: diag_trp_vs !: transport of snw volume
  375. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: diag_trp_ei !: transport of ice enthalpy (W/m2)
  376. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: diag_trp_es !: transport of snw enthalpy (W/m2)
  377. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: diag_trp_smv !: transport of salt content
  378. !
  379. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: diag_heat !: snw/ice heat content variation [W/m2]
  380. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: diag_smvi !: ice salt content variation []
  381. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: diag_vice !: ice volume variation [m/s]
  382. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: diag_vsnw !: snw volume variation [m/s]
  383. !
  384. !!--------------------------------------------------------------------------
  385. !! * SIMIP extra diagnostics
  386. !!--------------------------------------------------------------------------
  387. ! Extra sea ice diagnostics to address the data request
  388. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: t_si !: Temperature at Snow-ice interface (K)
  389. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: tm_si !: mean temperature at the snow-ice interface (K)
  390. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: diag_dmi_dyn !: Change in ice mass due to ice dynamics (kg/m2/s)
  391. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: diag_dms_dyn !: Change in snow mass due to ice dynamics (kg/m2/s)
  392. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: diag_fc_bo !: Bottom conduction flux (W/m2)
  393. REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: diag_fc_su !: Surface conduction flux (W/m2)
  394. !
  395. !!----------------------------------------------------------------------
  396. !! NEMO/LIM3 4.0 , UCL - NEMO Consortium (2010)
  397. !! $Id: ice.F90 8285 2017-07-06 06:40:51Z vancop $
  398. !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
  399. !!----------------------------------------------------------------------
  400. CONTAINS
  401. FUNCTION ice_alloc()
  402. !!-----------------------------------------------------------------
  403. !! *** Routine ice_alloc ***
  404. !!-----------------------------------------------------------------
  405. INTEGER :: ice_alloc
  406. !
  407. INTEGER :: ierr(18), ii
  408. !!-----------------------------------------------------------------
  409. ierr(:) = 0
  410. ! What could be one huge allocate statement is broken-up to try to
  411. ! stay within Fortran's max-line length limit.
  412. ii = 1
  413. ALLOCATE( u_oce (jpi,jpj) , v_oce (jpi,jpj) , &
  414. & ahiu (jpi,jpj) , ahiv (jpi,jpj) , &
  415. & ust2s (jpi,jpj) , hicol (jpi,jpj) , &
  416. & strp1 (jpi,jpj) , strp2 (jpi,jpj) , strength (jpi,jpj) , &
  417. & stress1_i(jpi,jpj) , stress2_i(jpi,jpj) , stress12_i(jpi,jpj) , &
  418. & delta_i (jpi,jpj) , divu_i (jpi,jpj) , shear_i (jpi,jpj) , STAT=ierr(ii) )
  419. #if defined key_init_alloc_zero
  420. IF (ierr(ii)==0) THEN
  421. u_oce = 0
  422. v_oce = 0
  423. ahiu = 0
  424. ahiv = 0
  425. ust2s = 0
  426. hicol = 0
  427. strp1 = 0
  428. strp2 = 0
  429. strength = 0
  430. stress1_i = 0
  431. stress2_i = 0
  432. stress12_i = 0
  433. delta_i = 0
  434. divu_i = 0
  435. shear_i = 0
  436. ENDIF
  437. #elif defined key_init_alloc_huge
  438. IF (ierr(ii)==0) THEN
  439. u_oce = HUGE(u_oce)
  440. v_oce = HUGE(v_oce)
  441. ahiu = HUGE(ahiu)
  442. ahiv = HUGE(ahiv)
  443. ust2s = HUGE(ust2s)
  444. hicol = HUGE(hicol)
  445. strp1 = HUGE(strp1)
  446. strp2 = HUGE(strp2)
  447. strength = HUGE(strength)
  448. stress1_i = HUGE(stress1_i)
  449. stress2_i = HUGE(stress2_i)
  450. stress12_i = HUGE(stress12_i)
  451. delta_i = HUGE(delta_i)
  452. divu_i = HUGE(divu_i)
  453. shear_i = HUGE(shear_i)
  454. ENDIF
  455. #endif
  456. ii = ii + 1
  457. ALLOCATE( sist (jpi,jpj) , t_bo (jpi,jpj) , &
  458. & frld (jpi,jpj) , pfrld (jpi,jpj) , phicif (jpi,jpj) , &
  459. & wfx_snw(jpi,jpj) , wfx_snw_dyn(jpi,jpj), wfx_snw_sum(jpi,jpj) , &
  460. & wfx_ice(jpi,jpj) , wfx_sub(jpi,jpj) , wfx_snw_sub(jpi,jpj) , wfx_ice_sub(jpi,jpj) , &
  461. & wfx_bog(jpi,jpj) , wfx_dyn(jpi,jpj) , wfx_bom(jpi,jpj) , wfx_sum(jpi,jpj) , &
  462. & wfx_res(jpi,jpj) , wfx_sni(jpi,jpj) , wfx_opw(jpi,jpj) , wfx_spr(jpi,jpj) , &
  463. & afx_tot(jpi,jpj) , afx_thd(jpi,jpj), afx_dyn(jpi,jpj) , &
  464. & fhtur (jpi,jpj) , ftr_ice(jpi,jpj,jpl), pahu3D(jpi,jpj,jpl+1), pahv3D(jpi,jpj,jpl+1), &
  465. & qlead (jpi,jpj) , rn_amax_2d(jpi,jpj), &
  466. & sfx_res(jpi,jpj) , sfx_bri(jpi,jpj) , sfx_dyn(jpi,jpj) , sfx_sub(jpi,jpj), &
  467. & sfx_bog(jpi,jpj) , sfx_bom(jpi,jpj) , sfx_sum(jpi,jpj) , sfx_sni(jpi,jpj) , sfx_opw(jpi,jpj) , &
  468. & hfx_res(jpi,jpj) , hfx_snw(jpi,jpj) , hfx_sub(jpi,jpj) , hfx_err(jpi,jpj) , &
  469. & hfx_err_dif(jpi,jpj) , hfx_err_rem(jpi,jpj) , wfx_err_sub(jpi,jpj) , &
  470. & hfx_in (jpi,jpj) , hfx_out(jpi,jpj) , fhld(jpi,jpj) , &
  471. & hfx_sum(jpi,jpj) , hfx_bom(jpi,jpj) , hfx_bog(jpi,jpj) , hfx_dif(jpi,jpj) , hfx_opw(jpi,jpj) , &
  472. & hfx_thd(jpi,jpj) , hfx_dyn(jpi,jpj) , hfx_spr(jpi,jpj) , STAT=ierr(ii) )
  473. #if defined key_init_alloc_zero
  474. IF (ierr(ii)==0) THEN
  475. sist = 0
  476. t_bo = 0
  477. frld = 0
  478. pfrld = 0
  479. phicif = 0
  480. wfx_snw = 0
  481. wfx_snw_dyn = 0
  482. wfx_snw_sum = 0
  483. wfx_ice = 0
  484. wfx_sub = 0
  485. wfx_snw_sub = 0
  486. wfx_ice_sub = 0
  487. wfx_bog = 0
  488. wfx_dyn = 0
  489. wfx_bom = 0
  490. wfx_sum = 0
  491. wfx_res = 0
  492. wfx_sni = 0
  493. wfx_opw = 0
  494. wfx_spr = 0
  495. afx_tot = 0
  496. afx_thd = 0
  497. afx_dyn = 0
  498. fhtur = 0
  499. ftr_ice = 0
  500. pahu3D = 0
  501. pahv3D = 0
  502. qlead = 0
  503. rn_amax_2d = 0
  504. sfx_res = 0
  505. sfx_bri = 0
  506. sfx_dyn = 0
  507. sfx_sub = 0
  508. sfx_bog = 0
  509. sfx_bom = 0
  510. sfx_sum = 0
  511. sfx_sni = 0
  512. sfx_opw = 0
  513. hfx_res = 0
  514. hfx_snw = 0
  515. hfx_sub = 0
  516. hfx_err = 0
  517. hfx_err_dif = 0
  518. hfx_err_rem = 0
  519. wfx_err_sub = 0
  520. hfx_in = 0
  521. hfx_out = 0
  522. fhld = 0
  523. hfx_sum = 0
  524. hfx_bom = 0
  525. hfx_bog = 0
  526. hfx_dif = 0
  527. hfx_opw = 0
  528. hfx_thd = 0
  529. hfx_dyn = 0
  530. hfx_spr = 0
  531. ENDIF
  532. #elif defined key_init_alloc_huge
  533. IF (ierr(ii)==0) THEN
  534. sist = HUGE(sist)
  535. t_bo = HUGE(t_bo)
  536. frld = HUGE(frld)
  537. pfrld = HUGE(pfrld)
  538. phicif = HUGE(phicif)
  539. wfx_snw = HUGE(wfx_snw)
  540. wfx_snw_dyn = HUGE(wfx_snw_dyn)
  541. wfx_snw_sum = HUGE(wfx_snw_sum)
  542. wfx_ice = HUGE(wfx_ice)
  543. wfx_sub = HUGE(wfx_sub)
  544. wfx_snw_sub = HUGE(wfx_snw_sub)
  545. wfx_ice_sub = HUGE(wfx_ice_sub)
  546. wfx_bog = HUGE(wfx_bog)
  547. wfx_dyn = HUGE(wfx_dyn)
  548. wfx_bom = HUGE(wfx_bom)
  549. wfx_sum = HUGE(wfx_sum)
  550. wfx_res = HUGE(wfx_res)
  551. wfx_sni = HUGE(wfx_sni)
  552. wfx_opw = HUGE(wfx_opw)
  553. wfx_spr = HUGE(wfx_spr)
  554. afx_tot = HUGE(afx_tot)
  555. afx_thd = HUGE(afx_thd)
  556. afx_dyn = HUGE(afx_dyn)
  557. fhtur = HUGE(fhtur)
  558. ftr_ice = HUGE(ftr_ice)
  559. pahu3D = HUGE(pahu3D)
  560. pahv3D = HUGE(pahv3D)
  561. qlead = HUGE(qlead)
  562. rn_amax_2d = HUGE(rn_amax_2d)
  563. sfx_res = HUGE(sfx_res)
  564. sfx_bri = HUGE(sfx_bri)
  565. sfx_dyn = HUGE(sfx_dyn)
  566. sfx_sub = HUGE(sfx_sub)
  567. sfx_bog = HUGE(sfx_bog)
  568. sfx_bom = HUGE(sfx_bom)
  569. sfx_sum = HUGE(sfx_sum)
  570. sfx_sni = HUGE(sfx_sni)
  571. sfx_opw = HUGE(sfx_opw)
  572. hfx_res = HUGE(hfx_res)
  573. hfx_snw = HUGE(hfx_snw)
  574. hfx_sub = HUGE(hfx_sub)
  575. hfx_err = HUGE(hfx_err)
  576. hfx_err_dif = HUGE(hfx_err_dif)
  577. hfx_err_rem = HUGE(hfx_err_rem)
  578. wfx_err_sub = HUGE(wfx_err_sub)
  579. hfx_in = HUGE(hfx_in)
  580. hfx_out = HUGE(hfx_out)
  581. fhld = HUGE(fhld)
  582. hfx_sum = HUGE(hfx_sum)
  583. hfx_bom = HUGE(hfx_bom)
  584. hfx_bog = HUGE(hfx_bog)
  585. hfx_dif = HUGE(hfx_dif)
  586. hfx_opw = HUGE(hfx_opw)
  587. hfx_thd = HUGE(hfx_thd)
  588. hfx_dyn = HUGE(hfx_dyn)
  589. hfx_spr = HUGE(hfx_spr)
  590. ENDIF
  591. #endif
  592. ! * Ice global state variables
  593. ii = ii + 1
  594. ALLOCATE( ht_i (jpi,jpj,jpl) , a_i (jpi,jpj,jpl) , v_i (jpi,jpj,jpl) , &
  595. & v_s (jpi,jpj,jpl) , ht_s (jpi,jpj,jpl) , t_su (jpi,jpj,jpl) , &
  596. & sm_i (jpi,jpj,jpl) , smv_i(jpi,jpj,jpl) , o_i (jpi,jpj,jpl) , &
  597. & oa_i (jpi,jpj,jpl) , bv_i (jpi,jpj,jpl) , STAT=ierr(ii) )
  598. #if defined key_init_alloc_zero
  599. IF (ierr(ii)==0) THEN
  600. ht_i = 0
  601. a_i = 0
  602. v_i = 0
  603. v_s = 0
  604. ht_s = 0
  605. t_su = 0
  606. sm_i = 0
  607. smv_i = 0
  608. o_i = 0
  609. oa_i = 0
  610. bv_i = 0
  611. ENDIF
  612. #elif defined key_init_alloc_huge
  613. IF (ierr(ii)==0) THEN
  614. ht_i = HUGE(ht_i)
  615. a_i = HUGE(a_i)
  616. v_i = HUGE(v_i)
  617. v_s = HUGE(v_s)
  618. ht_s = HUGE(ht_s)
  619. t_su = HUGE(t_su)
  620. sm_i = HUGE(sm_i)
  621. smv_i = HUGE(smv_i)
  622. o_i = HUGE(o_i)
  623. oa_i = HUGE(oa_i)
  624. bv_i = HUGE(bv_i)
  625. ENDIF
  626. #endif
  627. ii = ii + 1
  628. ALLOCATE( u_ice(jpi,jpj) , v_ice(jpi,jpj) , &
  629. & vt_i (jpi,jpj) , vt_s (jpi,jpj) , at_i (jpi,jpj) , ato_i(jpi,jpj) , &
  630. & et_i (jpi,jpj) , et_s (jpi,jpj) , tm_i (jpi,jpj) , bvm_i(jpi,jpj) , &
  631. & smt_i(jpi,jpj) , tm_su(jpi,jpj) , htm_i(jpi,jpj) , htm_s(jpi,jpj) , &
  632. & om_i (jpi,jpj) , STAT=ierr(ii) )
  633. #if defined key_init_alloc_zero
  634. IF (ierr(ii)==0) THEN
  635. u_ice = 0
  636. v_ice = 0
  637. vt_i = 0
  638. vt_s = 0
  639. at_i = 0
  640. ato_i = 0
  641. et_i = 0
  642. et_s = 0
  643. tm_i = 0
  644. bvm_i = 0
  645. smt_i = 0
  646. tm_su = 0
  647. htm_i = 0
  648. htm_s = 0
  649. om_i = 0
  650. ENDIF
  651. #elif defined key_init_alloc_huge
  652. IF (ierr(ii)==0) THEN
  653. u_ice = HUGE(u_ice)
  654. v_ice = HUGE(v_ice)
  655. vt_i = HUGE(vt_i)
  656. vt_s = HUGE(vt_s)
  657. at_i = HUGE(at_i)
  658. ato_i = HUGE(ato_i)
  659. et_i = HUGE(et_i)
  660. et_s = HUGE(et_s)
  661. tm_i = HUGE(tm_i)
  662. bvm_i = HUGE(bvm_i)
  663. smt_i = HUGE(smt_i)
  664. tm_su = HUGE(tm_su)
  665. htm_i = HUGE(htm_i)
  666. htm_s = HUGE(htm_s)
  667. om_i = HUGE(om_i)
  668. ENDIF
  669. #endif
  670. ii = ii + 1
  671. ALLOCATE( t_s(jpi,jpj,nlay_s,jpl) , e_s(jpi,jpj,nlay_s,jpl) , STAT=ierr(ii) )
  672. #if defined key_init_alloc_zero
  673. IF (ierr(ii)==0) THEN
  674. t_s = 0
  675. e_s = 0
  676. ENDIF
  677. #elif defined key_init_alloc_huge
  678. IF (ierr(ii)==0) THEN
  679. t_s = HUGE(t_s)
  680. e_s = HUGE(e_s)
  681. ENDIF
  682. #endif
  683. ii = ii + 1
  684. 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) )
  685. #if defined key_init_alloc_zero
  686. IF (ierr(ii)==0) THEN
  687. t_i = 0
  688. e_i = 0
  689. s_i = 0
  690. ENDIF
  691. #elif defined key_init_alloc_huge
  692. IF (ierr(ii)==0) THEN
  693. t_i = HUGE(t_i)
  694. e_i = HUGE(e_i)
  695. s_i = HUGE(s_i)
  696. ENDIF
  697. #endif
  698. ! * Moments for advection
  699. ii = ii + 1
  700. ALLOCATE( sxopw(jpi,jpj) , syopw(jpi,jpj) , sxxopw(jpi,jpj) , syyopw(jpi,jpj) , sxyopw(jpi,jpj) , STAT=ierr(ii) )
  701. #if defined key_init_alloc_zero
  702. IF (ierr(ii)==0) THEN
  703. sxopw = 0
  704. syopw = 0
  705. sxxopw = 0
  706. syyopw = 0
  707. sxyopw = 0
  708. ENDIF
  709. #elif defined key_init_alloc_huge
  710. IF (ierr(ii)==0) THEN
  711. sxopw = HUGE(sxopw)
  712. syopw = HUGE(syopw)
  713. sxxopw = HUGE(sxxopw)
  714. syyopw = HUGE(syyopw)
  715. sxyopw = HUGE(sxyopw)
  716. ENDIF
  717. #endif
  718. ii = ii + 1
  719. ALLOCATE( sxice(jpi,jpj,jpl) , syice(jpi,jpj,jpl) , sxxice(jpi,jpj,jpl) , syyice(jpi,jpj,jpl) , sxyice(jpi,jpj,jpl) , &
  720. & sxsn (jpi,jpj,jpl) , sysn (jpi,jpj,jpl) , sxxsn (jpi,jpj,jpl) , syysn (jpi,jpj,jpl) , sxysn (jpi,jpj,jpl) , &
  721. & STAT=ierr(ii) )
  722. #if defined key_init_alloc_zero
  723. IF (ierr(ii)==0) THEN
  724. sxice = 0
  725. syice = 0
  726. sxxice = 0
  727. syyice = 0
  728. sxyice = 0
  729. sxsn = 0
  730. sysn = 0
  731. sxxsn = 0
  732. syysn = 0
  733. sxysn = 0
  734. ENDIF
  735. #elif defined key_init_alloc_huge
  736. IF (ierr(ii)==0) THEN
  737. sxice = HUGE(sxice)
  738. syice = HUGE(syice)
  739. sxxice = HUGE(sxxice)
  740. syyice = HUGE(syyice)
  741. sxyice = HUGE(sxyice)
  742. sxsn = HUGE(sxsn)
  743. sysn = HUGE(sysn)
  744. sxxsn = HUGE(sxxsn)
  745. syysn = HUGE(syysn)
  746. sxysn = HUGE(sxysn)
  747. ENDIF
  748. #endif
  749. ii = ii + 1
  750. ALLOCATE( sxa (jpi,jpj,jpl) , sya (jpi,jpj,jpl) , sxxa (jpi,jpj,jpl) , syya (jpi,jpj,jpl) , sxya (jpi,jpj,jpl) , &
  751. & sxc0 (jpi,jpj,jpl) , syc0 (jpi,jpj,jpl) , sxxc0 (jpi,jpj,jpl) , syyc0 (jpi,jpj,jpl) , sxyc0 (jpi,jpj,jpl) , &
  752. & sxsal(jpi,jpj,jpl) , sysal(jpi,jpj,jpl) , sxxsal(jpi,jpj,jpl) , syysal(jpi,jpj,jpl) , sxysal(jpi,jpj,jpl) , &
  753. & sxage(jpi,jpj,jpl) , syage(jpi,jpj,jpl) , sxxage(jpi,jpj,jpl) , syyage(jpi,jpj,jpl) , sxyage(jpi,jpj,jpl) , &
  754. & STAT=ierr(ii) )
  755. #if defined key_init_alloc_zero
  756. IF (ierr(ii)==0) THEN
  757. sxa = 0
  758. sya = 0
  759. sxxa = 0
  760. syya = 0
  761. sxya = 0
  762. sxc0 = 0
  763. syc0 = 0
  764. sxxc0 = 0
  765. syyc0 = 0
  766. sxyc0 = 0
  767. sxsal = 0
  768. sysal = 0
  769. sxxsal = 0
  770. syysal = 0
  771. sxysal = 0
  772. sxage = 0
  773. syage = 0
  774. sxxage = 0
  775. syyage = 0
  776. sxyage = 0
  777. ENDIF
  778. #elif defined key_init_alloc_huge
  779. IF (ierr(ii)==0) THEN
  780. sxa = HUGE(sxa)
  781. sya = HUGE(sya)
  782. sxxa = HUGE(sxxa)
  783. syya = HUGE(syya)
  784. sxya = HUGE(sxya)
  785. sxc0 = HUGE(sxc0)
  786. syc0 = HUGE(syc0)
  787. sxxc0 = HUGE(sxxc0)
  788. syyc0 = HUGE(syyc0)
  789. sxyc0 = HUGE(sxyc0)
  790. sxsal = HUGE(sxsal)
  791. sysal = HUGE(sysal)
  792. sxxsal = HUGE(sxxsal)
  793. syysal = HUGE(syysal)
  794. sxysal = HUGE(sxysal)
  795. sxage = HUGE(sxage)
  796. syage = HUGE(syage)
  797. sxxage = HUGE(sxxage)
  798. syyage = HUGE(syyage)
  799. sxyage = HUGE(sxyage)
  800. ENDIF
  801. #endif
  802. ii = ii + 1
  803. ALLOCATE( sxe (jpi,jpj,nlay_i,jpl) , sye (jpi,jpj,nlay_i,jpl) , sxxe(jpi,jpj,nlay_i,jpl) , &
  804. & syye(jpi,jpj,nlay_i,jpl) , sxye(jpi,jpj,nlay_i,jpl) , STAT=ierr(ii) )
  805. #if defined key_init_alloc_zero
  806. IF (ierr(ii)==0) THEN
  807. sxe = 0
  808. sye = 0
  809. sxxe = 0
  810. syye = 0
  811. sxye = 0
  812. ENDIF
  813. #elif defined key_init_alloc_huge
  814. IF (ierr(ii)==0) THEN
  815. sxe = HUGE(sxe)
  816. sye = HUGE(sye)
  817. sxxe = HUGE(sxxe)
  818. syye = HUGE(syye)
  819. sxye = HUGE(sxye)
  820. ENDIF
  821. #endif
  822. ! * Old values of global variables
  823. ii = ii + 1
  824. ALLOCATE( v_s_b (jpi,jpj,jpl) , v_i_b (jpi,jpj,jpl) , e_s_b(jpi,jpj,nlay_s,jpl) , &
  825. & a_i_b (jpi,jpj,jpl) , smv_i_b(jpi,jpj,jpl) , e_i_b(jpi,jpj,nlay_i,jpl) , &
  826. & oa_i_b (jpi,jpj,jpl) , u_ice_b(jpi,jpj) , v_ice_b(jpi,jpj) , STAT=ierr(ii) )
  827. #if defined key_init_alloc_zero
  828. IF (ierr(ii)==0) THEN
  829. v_s_b = 0
  830. v_i_b = 0
  831. e_s_b = 0
  832. a_i_b = 0
  833. smv_i_b = 0
  834. e_i_b = 0
  835. oa_i_b = 0
  836. u_ice_b = 0
  837. v_ice_b = 0
  838. ENDIF
  839. #elif defined key_init_alloc_huge
  840. IF (ierr(ii)==0) THEN
  841. v_s_b = HUGE(v_s_b)
  842. v_i_b = HUGE(v_i_b)
  843. e_s_b = HUGE(e_s_b)
  844. a_i_b = HUGE(a_i_b)
  845. smv_i_b = HUGE(smv_i_b)
  846. e_i_b = HUGE(e_i_b)
  847. oa_i_b = HUGE(oa_i_b)
  848. u_ice_b = HUGE(u_ice_b)
  849. v_ice_b = HUGE(v_ice_b)
  850. ENDIF
  851. #endif
  852. ! * Ice thickness distribution variables
  853. ii = ii + 1
  854. ALLOCATE( hi_max(0:jpl), hi_mean(jpl), STAT=ierr(ii) )
  855. #if defined key_init_alloc_zero
  856. IF (ierr(ii)==0) THEN
  857. hi_max = 0
  858. hi_mean = 0
  859. ENDIF
  860. #elif defined key_init_alloc_huge
  861. IF (ierr(ii)==0) THEN
  862. hi_max = HUGE(hi_max)
  863. hi_mean = HUGE(hi_mean)
  864. ENDIF
  865. #endif
  866. ! * Ice diagnostics
  867. ii = ii + 1
  868. ALLOCATE( diag_trp_vi(jpi,jpj), diag_trp_vs (jpi,jpj), diag_trp_ei(jpi,jpj), &
  869. & diag_trp_es(jpi,jpj), diag_trp_smv(jpi,jpj), diag_heat (jpi,jpj), &
  870. & diag_smvi (jpi,jpj), diag_vice (jpi,jpj), diag_vsnw (jpi,jpj), STAT=ierr(ii) )
  871. #if defined key_init_alloc_zero
  872. IF (ierr(ii)==0) THEN
  873. diag_trp_vi = 0
  874. diag_trp_vs = 0
  875. diag_trp_ei = 0
  876. diag_trp_es = 0
  877. diag_trp_smv = 0
  878. diag_heat = 0
  879. diag_smvi = 0
  880. diag_vice = 0
  881. diag_vsnw = 0
  882. ENDIF
  883. #elif defined key_init_alloc_huge
  884. IF (ierr(ii)==0) THEN
  885. diag_trp_vi = HUGE(diag_trp_vi)
  886. diag_trp_vs = HUGE(diag_trp_vs)
  887. diag_trp_ei = HUGE(diag_trp_ei)
  888. diag_trp_es = HUGE(diag_trp_es)
  889. diag_trp_smv = HUGE(diag_trp_smv)
  890. diag_heat = HUGE(diag_heat)
  891. diag_smvi = HUGE(diag_smvi)
  892. diag_vice = HUGE(diag_vice)
  893. diag_vsnw = HUGE(diag_vsnw)
  894. ENDIF
  895. #endif
  896. ! * SIMIP diagnostics
  897. ii = ii + 1
  898. ALLOCATE( t_si (jpi,jpj,jpl) , tm_si(jpi,jpj) , &
  899. diag_dmi_dyn(jpi,jpj) , diag_dms_dyn(jpi,jpj) , &
  900. diag_fc_bo(jpi,jpj) , diag_fc_su(jpi,jpj) , &
  901. STAT = ierr(ii) )
  902. #if defined key_init_alloc_zero
  903. IF (ierr(ii)==0) THEN
  904. t_si = 0
  905. tm_si = 0
  906. diag_dmi_dyn = 0
  907. diag_dms_dyn = 0
  908. diag_fc_bo = 0
  909. diag_fc_su = 0
  910. ENDIF
  911. #elif defined key_init_alloc_huge
  912. IF (ierr(ii)==0) THEN
  913. t_si = HUGE(t_si)
  914. tm_si = HUGE(tm_si)
  915. diag_dmi_dyn = HUGE(diag_dmi_dyn)
  916. diag_dms_dyn = HUGE(diag_dms_dyn)
  917. diag_fc_bo = HUGE(diag_fc_bo)
  918. diag_fc_su = HUGE(diag_fc_su)
  919. ENDIF
  920. #endif
  921. ice_alloc = MAXVAL( ierr(:) )
  922. IF( ice_alloc /= 0 ) CALL ctl_warn('ice_alloc: failed to allocate arrays.')
  923. !
  924. END FUNCTION ice_alloc
  925. #else
  926. !!----------------------------------------------------------------------
  927. !! Default option Empty module NO LIM sea-ice model
  928. !!----------------------------------------------------------------------
  929. #endif
  930. !!======================================================================
  931. END MODULE ice