limdiahsb.F90 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. MODULE limdiahsb
  2. !!======================================================================
  3. !! *** MODULE limdia_hsb ***
  4. !! LIM-3 sea ice model : diagnostics of ice model
  5. !!======================================================================
  6. !! History : 3.4 ! 2012-10 (C. Rousset) original code
  7. !!----------------------------------------------------------------------
  8. #if defined key_lim3
  9. !!----------------------------------------------------------------------
  10. !! 'key_lim3' LIM3 sea-ice model
  11. !!----------------------------------------------------------------------
  12. !! lim_dia_hsb : computation and output of the time evolution of keys variables
  13. !! lim_dia_hsb_init : initialization and namelist read
  14. !!----------------------------------------------------------------------
  15. USE ice ! LIM-3: sea-ice variable
  16. USE dom_ice ! LIM-3: sea-ice domain
  17. USE dom_oce ! ocean domain
  18. USE sbc_oce ! surface boundary condition: ocean fields
  19. USE sbc_ice ! Surface boundary condition: sea-ice fields
  20. USE daymod ! model calendar
  21. USE phycst ! physical constant
  22. USE in_out_manager ! I/O manager
  23. USE lib_mpp ! MPP library
  24. USE timing ! preformance summary
  25. USE iom ! I/O manager
  26. USE lib_fortran ! glob_sum
  27. USE limrst ! ice restart
  28. IMPLICIT NONE
  29. PRIVATE
  30. PUBLIC lim_diahsb ! routine called by ice_step.F90
  31. PUBLIC lim_diahsb_init ! routine called in sbcice_lim.F90
  32. REAL(wp), DIMENSION(:,:), ALLOCATABLE :: vol_loc_ini, sal_loc_ini, tem_loc_ini ! initial volume, salt and heat contents
  33. REAL(wp) :: frc_sal, frc_voltop, frc_volbot, frc_temtop, frc_tembot ! global forcing trends
  34. !! * Substitutions
  35. # include "vectopt_loop_substitute.h90"
  36. !!----------------------------------------------------------------------
  37. !! NEMO/OPA 3.4 , NEMO Consortium (2012)
  38. !! $Id: limdiahsb.F90 3977 2017-02-20 14:03:23Z ufla $
  39. !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
  40. !!----------------------------------------------------------------------
  41. CONTAINS
  42. SUBROUTINE lim_diahsb( kt )
  43. !!---------------------------------------------------------------------------
  44. !! *** ROUTINE lim_diahsb ***
  45. !!
  46. !! ** Purpose: Compute the ice global heat content, salt content and volume conservation
  47. !!
  48. !!---------------------------------------------------------------------------
  49. INTEGER, INTENT(in) :: kt ! number of iteration
  50. !!
  51. real(wp) :: zbg_ivol, zbg_svol, zbg_area, zbg_isal, zbg_item ,zbg_stem
  52. REAL(wp) :: z_frc_voltop, z_frc_volbot, z_frc_sal, z_frc_temtop, z_frc_tembot
  53. REAL(wp) :: zdiff_vol, zdiff_sal, zdiff_tem
  54. !!---------------------------------------------------------------------------
  55. IF( nn_timing == 1 ) CALL timing_start('lim_diahsb')
  56. ! ----------------------- !
  57. ! 1 - Contents !
  58. ! ----------------------- !
  59. zbg_ivol = glob_sum( vt_i(:,:) * e12t(:,:) * tmask(:,:,1) * 1.e-9 ) ! ice volume (km3)
  60. zbg_svol = glob_sum( vt_s(:,:) * e12t(:,:) * tmask(:,:,1) * 1.e-9 ) ! snow volume (km3)
  61. zbg_area = glob_sum( at_i(:,:) * e12t(:,:) * tmask(:,:,1) * 1.e-6 ) ! area (km2)
  62. zbg_isal = glob_sum( SUM( smv_i(:,:,:), dim=3 ) * e12t(:,:) * tmask(:,:,1) * 1.e-9 ) ! salt content (pss*km3)
  63. zbg_item = glob_sum( et_i * e12t(:,:) * tmask(:,:,1) * 1.e-20 ) ! heat content (1.e20 J)
  64. zbg_stem = glob_sum( et_s * e12t(:,:) * tmask(:,:,1) * 1.e-20 ) ! heat content (1.e20 J)
  65. ! ---------------------------!
  66. ! 2 - Trends due to forcing !
  67. ! ---------------------------!
  68. z_frc_volbot = r1_rau0 * glob_sum( - ( wfx_ice(:,:) + wfx_snw(:,:) + wfx_err_sub(:,:) ) * e12t(:,:) * tmask(:,:,1) * 1.e-9 ) ! freshwater flux ice/snow-ocean
  69. z_frc_voltop = r1_rau0 * glob_sum( - ( wfx_sub(:,:) + wfx_spr(:,:) ) * e12t(:,:) * tmask(:,:,1) * 1.e-9 ) ! freshwater flux ice/snow-atm
  70. z_frc_sal = r1_rau0 * glob_sum( - sfx(:,:) * e12t(:,:) * tmask(:,:,1) * 1.e-9 ) ! salt fluxes ice/snow-ocean
  71. z_frc_tembot = glob_sum( hfx_out(:,:) * e12t(:,:) * tmask(:,:,1) * 1.e-20 ) ! heat on top of ocean (and below ice)
  72. z_frc_temtop = glob_sum( hfx_in (:,:) * e12t(:,:) * tmask(:,:,1) * 1.e-20 ) ! heat on top of ice-coean
  73. !
  74. frc_voltop = frc_voltop + z_frc_voltop * rdt_ice ! km3
  75. frc_volbot = frc_volbot + z_frc_volbot * rdt_ice ! km3
  76. frc_sal = frc_sal + z_frc_sal * rdt_ice ! km3*pss
  77. frc_temtop = frc_temtop + z_frc_temtop * rdt_ice ! 1.e20 J
  78. frc_tembot = frc_tembot + z_frc_tembot * rdt_ice ! 1.e20 J
  79. ! ----------------------- !
  80. ! 3 - Content variations !
  81. ! ----------------------- !
  82. zdiff_vol = r1_rau0 * glob_sum( ( rhoic * vt_i(:,:) + rhosn * vt_s(:,:) - vol_loc_ini(:,:) & ! freshwater trend (km3)
  83. & ) * e12t(:,:) * tmask(:,:,1) * 1.e-9 )
  84. zdiff_sal = r1_rau0 * glob_sum( ( rhoic * SUM( smv_i(:,:,:), dim=3 ) - sal_loc_ini(:,:) & ! salt content trend (km3*pss)
  85. & ) * e12t(:,:) * tmask(:,:,1) * 1.e-9 )
  86. zdiff_tem = glob_sum( ( et_i(:,:) + et_s(:,:) - tem_loc_ini(:,:) & ! heat content trend (1.e20 J)
  87. ! & + SUM( qevap_ice * a_i_b, dim=3 ) & !! clem: I think this line should be commented (but needs a check)
  88. & ) * e12t(:,:) * tmask(:,:,1) * 1.e-20 )
  89. ! ----------------------- !
  90. ! 4 - Drifts !
  91. ! ----------------------- !
  92. zdiff_vol = zdiff_vol - ( frc_voltop + frc_volbot )
  93. zdiff_sal = zdiff_sal - frc_sal
  94. zdiff_tem = zdiff_tem - ( frc_tembot - frc_temtop )
  95. ! ----------------------- !
  96. ! 5 - Diagnostics writing !
  97. ! ----------------------- !
  98. !
  99. IF( iom_use('ibgvolume') ) CALL iom_put( 'ibgvolume' , zdiff_vol ) ! ice/snow volume drift (km3 equivalent ocean water)
  100. IF( iom_use('ibgsaltco') ) CALL iom_put( 'ibgsaltco' , zdiff_sal ) ! ice salt content drift (psu*km3 equivalent ocean water)
  101. IF( iom_use('ibgheatco') ) CALL iom_put( 'ibgheatco' , zdiff_tem ) ! ice/snow heat content drift (1.e20 J)
  102. IF( iom_use('ibgheatfx') ) CALL iom_put( 'ibgheatfx' , zdiff_tem / & ! ice/snow heat flux drift (W/m2)
  103. & glob_sum( e12t(:,:) * tmask(:,:,1) * 1.e-20 * kt*rdt ) )
  104. IF( iom_use('ibgfrcvoltop') ) CALL iom_put( 'ibgfrcvoltop' , frc_voltop ) ! vol forcing ice/snw-atm (km3 equivalent ocean water)
  105. IF( iom_use('ibgfrcvolbot') ) CALL iom_put( 'ibgfrcvolbot' , frc_volbot ) ! vol forcing ice/snw-ocean (km3 equivalent ocean water)
  106. IF( iom_use('ibgfrcsal') ) CALL iom_put( 'ibgfrcsal' , frc_sal ) ! sal - forcing (psu*km3 equivalent ocean water)
  107. IF( iom_use('ibgfrctemtop') ) CALL iom_put( 'ibgfrctemtop' , frc_temtop ) ! heat on top of ice/snw/ocean (1.e20 J)
  108. IF( iom_use('ibgfrctembot') ) CALL iom_put( 'ibgfrctembot' , frc_tembot ) ! heat on top of ocean(below ice) (1.e20 J)
  109. IF( iom_use('ibgfrchfxtop') ) CALL iom_put( 'ibgfrchfxtop' , frc_temtop / & ! heat on top of ice/snw/ocean (W/m2)
  110. & glob_sum( e12t(:,:) * tmask(:,:,1) * 1.e-20 * kt*rdt ) )
  111. IF( iom_use('ibgfrchfxbot') ) CALL iom_put( 'ibgfrchfxbot' , frc_tembot / & ! heat on top of ocean(below ice) (W/m2)
  112. & glob_sum( e12t(:,:) * tmask(:,:,1) * 1.e-20 * kt*rdt ) )
  113. IF( iom_use('ibgvol_tot' ) ) CALL iom_put( 'ibgvol_tot' , zbg_ivol ) ! ice volume (km3)
  114. IF( iom_use('sbgvol_tot' ) ) CALL iom_put( 'sbgvol_tot' , zbg_svol ) ! snow volume (km3)
  115. IF( iom_use('ibgarea_tot') ) CALL iom_put( 'ibgarea_tot' , zbg_area ) ! ice area (km2)
  116. IF( iom_use('ibgsalt_tot') ) CALL iom_put( 'ibgsalt_tot' , zbg_isal ) ! ice salinity content (pss*km3)
  117. IF( iom_use('ibgheat_tot') ) CALL iom_put( 'ibgheat_tot' , zbg_item ) ! ice heat content (1.e20 J)
  118. IF( iom_use('sbgheat_tot') ) CALL iom_put( 'sbgheat_tot' , zbg_stem ) ! snow heat content (1.e20 J)
  119. !
  120. IF( lrst_ice ) CALL lim_diahsb_rst( numit, 'WRITE' )
  121. !
  122. IF( nn_timing == 1 ) CALL timing_stop('lim_diahsb')
  123. !
  124. END SUBROUTINE lim_diahsb
  125. SUBROUTINE lim_diahsb_init
  126. !!---------------------------------------------------------------------------
  127. !! *** ROUTINE lim_diahsb_init ***
  128. !!
  129. !! ** Purpose: Initialization for the heat salt volume budgets
  130. !!
  131. !! ** Method : Compute initial heat content, salt content and volume
  132. !!
  133. !! ** Action : - Compute initial heat content, salt content and volume
  134. !! - Initialize forcing trends
  135. !! - Compute coefficients for conversion
  136. !!---------------------------------------------------------------------------
  137. INTEGER :: ierror ! local integer
  138. !!
  139. !!NAMELIST/namicehsb/ blabla
  140. !!----------------------------------------------------------------------
  141. !
  142. !!REWIND ( numnam_ice ) ! Read Namelist namicehsb
  143. !!READ ( numnam_ice, namicehsb )
  144. !
  145. IF(lwp) THEN ! Control print
  146. WRITE(numout,*)
  147. WRITE(numout,*) 'lim_diahsb_init : check the heat and salt budgets'
  148. WRITE(numout,*) '~~~~~~~~~~~~'
  149. ENDIF
  150. !
  151. ALLOCATE( vol_loc_ini(jpi,jpj), sal_loc_ini(jpi,jpj), tem_loc_ini(jpi,jpj), STAT=ierror )
  152. IF( ierror > 0 ) THEN
  153. CALL ctl_stop( 'lim_diahsb: unable to allocate vol_loc_ini' )
  154. RETURN
  155. ENDIF
  156. CALL lim_diahsb_rst( nstart, 'READ' ) !* read or initialize all required files
  157. !
  158. END SUBROUTINE lim_diahsb_init
  159. SUBROUTINE lim_diahsb_rst( kt, cdrw )
  160. !!---------------------------------------------------------------------
  161. !! *** ROUTINE limdia_rst ***
  162. !!
  163. !! ** Purpose : Read or write DIA file in restart file
  164. !!
  165. !! ** Method : use of IOM library
  166. !!----------------------------------------------------------------------
  167. INTEGER , INTENT(in) :: kt ! ice time-step
  168. CHARACTER(len=*), INTENT(in) :: cdrw ! "READ"/"WRITE" flag
  169. !
  170. !!----------------------------------------------------------------------
  171. !
  172. IF( TRIM(cdrw) == 'READ' ) THEN ! Read/initialise
  173. IF( ln_rstart ) THEN !* Read the restart file
  174. !
  175. IF(lwp) WRITE(numout,*) '~~~~~~~'
  176. IF(lwp) WRITE(numout,*) ' lim_diahsb_rst read at it= ', kt,' date= ', ndastp
  177. IF(lwp) WRITE(numout,*) '~~~~~~~'
  178. CALL iom_get( numrir, 'frc_voltop' , frc_voltop )
  179. CALL iom_get( numrir, 'frc_volbot' , frc_volbot )
  180. CALL iom_get( numrir, 'frc_temtop' , frc_temtop )
  181. CALL iom_get( numrir, 'frc_tembot' , frc_tembot )
  182. CALL iom_get( numrir, 'frc_sal' , frc_sal )
  183. CALL iom_get( numrir, jpdom_autoglo, 'vol_loc_ini', vol_loc_ini )
  184. CALL iom_get( numrir, jpdom_autoglo, 'tem_loc_ini', tem_loc_ini )
  185. CALL iom_get( numrir, jpdom_autoglo, 'sal_loc_ini', sal_loc_ini )
  186. ELSE
  187. IF(lwp) WRITE(numout,*) '~~~~~~~'
  188. IF(lwp) WRITE(numout,*) ' lim_diahsb at initial state '
  189. IF(lwp) WRITE(numout,*) '~~~~~~~'
  190. ! set trends to 0
  191. frc_voltop = 0._wp
  192. frc_volbot = 0._wp
  193. frc_temtop = 0._wp
  194. frc_tembot = 0._wp
  195. frc_sal = 0._wp
  196. ! record initial ice volume, salt and temp
  197. vol_loc_ini(:,:) = rhoic * vt_i(:,:) + rhosn * vt_s(:,:) ! ice/snow volume (kg/m2)
  198. tem_loc_ini(:,:) = et_i(:,:) + et_s(:,:) ! ice/snow heat content (J)
  199. sal_loc_ini(:,:) = rhoic * SUM( smv_i(:,:,:), dim=3 ) ! ice salt content (pss*kg/m2)
  200. ENDIF
  201. ELSEIF( TRIM(cdrw) == 'WRITE' ) THEN ! Create restart file
  202. ! ! -------------------
  203. IF(lwp) WRITE(numout,*) '~~~~~~~'
  204. IF(lwp) WRITE(numout,*) ' lim_diahsb_rst write at it= ', kt,' date= ', ndastp
  205. IF(lwp) WRITE(numout,*) '~~~~~~~'
  206. CALL iom_rstput( kt, nitrst, numriw, 'frc_voltop' , frc_voltop )
  207. CALL iom_rstput( kt, nitrst, numriw, 'frc_volbot' , frc_volbot )
  208. CALL iom_rstput( kt, nitrst, numriw, 'frc_temtop' , frc_temtop )
  209. CALL iom_rstput( kt, nitrst, numriw, 'frc_tembot' , frc_tembot )
  210. CALL iom_rstput( kt, nitrst, numriw, 'frc_sal' , frc_sal )
  211. CALL iom_rstput( kt, nitrst, numriw, 'vol_loc_ini', vol_loc_ini )
  212. CALL iom_rstput( kt, nitrst, numriw, 'tem_loc_ini', tem_loc_ini )
  213. CALL iom_rstput( kt, nitrst, numriw, 'sal_loc_ini', sal_loc_ini )
  214. !
  215. ENDIF
  216. !
  217. END SUBROUTINE lim_diahsb_rst
  218. #else
  219. !!----------------------------------------------------------------------
  220. !! Default option : Empty module NO LIM sea-ice model
  221. !!----------------------------------------------------------------------
  222. CONTAINS
  223. SUBROUTINE lim_diahsb ! Empty routine
  224. END SUBROUTINE lim_diahsb
  225. #endif
  226. !!======================================================================
  227. END MODULE limdiahsb