New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
limdiahsb.F90 in branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/NEMO/LIM_SRC_3 – NEMO

source: branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/NEMO/LIM_SRC_3/limdiahsb.F90 @ 4649

Last change on this file since 4649 was 4649, checked in by clem, 10 years ago

finalizing LIM3 heat budget conservation + multiple minor bugs corrections

File size: 18.0 KB
Line 
1MODULE 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 par_ice         ! LIM-3: ice parameters
17   USE dom_ice         ! LIM-3: sea-ice domain
18   USE dom_oce         ! ocean domain
19   USE sbc_oce         ! surface boundary condition: ocean fields
20   USE sbc_ice         ! Surface boundary condition: sea-ice fields
21   USE daymod          ! model calendar
22   USE phycst          ! physical constant
23   USE in_out_manager  ! I/O manager
24   USE lib_mpp         ! MPP library
25   USE timing          ! preformance summary
26   USE iom             ! I/O manager
27   USE lib_fortran     ! glob_sum
28   USE limrst          ! ice restart
29
30   IMPLICIT NONE
31   PRIVATE
32
33   PUBLIC   lim_diahsb        ! routine called by ice_step.F90
34   !!PUBLIC   lim_diahsb_init   ! routine called by ice_init.F90
35   !!PUBLIC   lim_diahsb_rst   ! routine called by ice_init.F90
36
37   REAL(dp) ::   frc_sal, frc_vol   ! global forcing trends
38   REAL(dp) ::   bg_grme            ! global ice growth+melt trends
39   REAL(wp) ::   epsi06 = 1.e-6_wp  ! small number
40
41   !! * Substitutions
42#  include "vectopt_loop_substitute.h90"
43
44   !!----------------------------------------------------------------------
45   !! NEMO/OPA 3.4 , NEMO Consortium (2012)
46   !! $Id: limdiahsb.F90 3294 2012-10-18 16:44:18Z rblod $
47   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
48   !!----------------------------------------------------------------------
49
50CONTAINS
51
52   SUBROUTINE lim_diahsb
53      !!---------------------------------------------------------------------------
54      !!                  ***  ROUTINE lim_diahsb  ***
55      !!     
56      !! ** Purpose: Compute the ice global heat content, salt content and volume conservation
57      !!
58      !!---------------------------------------------------------------------------
59      !!
60      REAL(dp)   ::   zbg_ivo, zbg_svo, zbg_are, zbg_sal ,zbg_tem ,zbg_ihc ,zbg_shc
61      REAL(dp)   ::   zbg_sfx, zbg_sfx_bri, zbg_sfx_bog, zbg_sfx_bom, zbg_sfx_sum, zbg_sfx_sni, zbg_sfx_opw, zbg_sfx_res, zbg_sfx_dyn 
62      REAL(dp)   ::   zbg_vfx, zbg_vfx_bog, zbg_vfx_opw, zbg_vfx_sni, zbg_vfx_dyn
63      REAL(dp)   ::   zbg_vfx_bom, zbg_vfx_sum, zbg_vfx_res, zbg_vfx_spr, zbg_vfx_snw, zbg_vfx_sub 
64      REAL(dp)   ::   zbg_hfx_dhc, zbg_hfx_spr
65      REAL(dp)   ::   zbg_hfx_res, zbg_hfx_sub, zbg_hfx_dyn, zbg_hfx_thd, zbg_hfx_snw, zbg_hfx_out, zbg_hfx_in   
66      REAL(dp)   ::   zbg_hfx_sum, zbg_hfx_bom, zbg_hfx_bog, zbg_hfx_dif, zbg_hfx_opw
67      REAL(dp)   ::   z_frc_vol, z_frc_sal, z_bg_grme 
68      REAL(dp)   ::   z1_area                     !    -     -
69      REAL(dp)   ::   zinda, zindb
70      !!---------------------------------------------------------------------------
71      IF( nn_timing == 1 )   CALL timing_start('lim_diahsb')
72
73      IF( numit == nstart ) CALL lim_diahsb_init 
74
75      ! 1/area
76      z1_area = 1.d0 / MAX( glob_sum( area(:,:) * tms(:,:) ), epsi06 )
77
78      zinda = MAX( 0.d0 , SIGN( 1.d0 , glob_sum( area(:,:) * tms(:,:) ) - epsi06 ) )
79      ! ----------------------- !
80      ! 1 -  Content variations !
81      ! ----------------------- !
82      zbg_ivo = glob_sum( vt_i(:,:) * area(:,:) * tms(:,:) ) ! volume ice
83      zbg_svo = glob_sum( vt_s(:,:) * area(:,:) * tms(:,:) ) ! volume snow
84      zbg_are = glob_sum( at_i(:,:) * area(:,:) * tms(:,:) ) ! area
85      zbg_sal = glob_sum( SUM( smv_i(:,:,:), dim=3 ) * area(:,:) * tms(:,:) )       ! mean salt content
86      zbg_tem = glob_sum( ( tm_i(:,:) - rtt ) * vt_i(:,:) * area(:,:) * tms(:,:) )  ! mean temp content
87
88      !zbg_ihc = glob_sum( et_i(:,:) * area(:,:) * tms(:,:) ) / MAX( zbg_ivo,epsi06 ) ! ice heat content
89      !zbg_shc = glob_sum( et_s(:,:) * area(:,:) * tms(:,:) ) / MAX( zbg_svo,epsi06 ) ! snow heat content
90
91      ! Volume
92      zbg_vfx     = zinda * glob_sum(      emp(:,:) * area(:,:) * tms(:,:) ) * z1_area * r1_rau0 * rday
93      zbg_vfx_bog = zinda * glob_sum( wfx_bog(:,:) * area(:,:) * tms(:,:) ) * z1_area * r1_rau0 * rday
94      zbg_vfx_opw = zinda * glob_sum( wfx_opw(:,:) * area(:,:) * tms(:,:) ) * z1_area * r1_rau0 * rday
95      zbg_vfx_sni = zinda * glob_sum( wfx_sni(:,:) * area(:,:) * tms(:,:) ) * z1_area * r1_rau0 * rday
96      zbg_vfx_dyn = zinda * glob_sum( wfx_dyn(:,:) * area(:,:) * tms(:,:) ) * z1_area * r1_rau0 * rday
97      zbg_vfx_bom = zinda * glob_sum( wfx_bom(:,:) * area(:,:) * tms(:,:) ) * z1_area * r1_rau0 * rday
98      zbg_vfx_sum = zinda * glob_sum( wfx_sum(:,:) * area(:,:) * tms(:,:) ) * z1_area * r1_rau0 * rday
99      zbg_vfx_res = zinda * glob_sum( wfx_res(:,:) * area(:,:) * tms(:,:) ) * z1_area * r1_rau0 * rday
100      zbg_vfx_spr = zinda * glob_sum( wfx_spr(:,:) * area(:,:) * tms(:,:) ) * z1_area * r1_rau0 * rday
101      zbg_vfx_snw = zinda * glob_sum( wfx_snw(:,:) * area(:,:) * tms(:,:) ) * z1_area * r1_rau0 * rday
102      zbg_vfx_sub = zinda * glob_sum( wfx_sub(:,:) * area(:,:) * tms(:,:) ) * z1_area * r1_rau0 * rday
103
104      ! Salt
105      zbg_sfx     = zinda * glob_sum(     sfx(:,:) * area(:,:) * tms(:,:) ) * z1_area * r1_rau0 * rday
106      zbg_sfx_bri = zinda * glob_sum( sfx_bri(:,:) * area(:,:) * tms(:,:) ) * z1_area * r1_rau0 * rday
107      zbg_sfx_res = zinda * glob_sum( sfx_res(:,:) * area(:,:) * tms(:,:) ) * z1_area * r1_rau0 * rday
108      zbg_sfx_dyn = zinda * glob_sum( sfx_dyn(:,:) * area(:,:) * tms(:,:) ) * z1_area * r1_rau0 * rday
109
110      zbg_sfx_bog = zinda * glob_sum( sfx_bog(:,:) * area(:,:) * tms(:,:) ) * z1_area * r1_rau0 * rday
111      zbg_sfx_opw = zinda * glob_sum( sfx_opw(:,:) * area(:,:) * tms(:,:) ) * z1_area * r1_rau0 * rday
112      zbg_sfx_sni = zinda * glob_sum( sfx_sni(:,:) * area(:,:) * tms(:,:) ) * z1_area * r1_rau0 * rday
113      zbg_sfx_bom = zinda * glob_sum( sfx_bom(:,:) * area(:,:) * tms(:,:) ) * z1_area * r1_rau0 * rday
114      zbg_sfx_sum = zinda * glob_sum( sfx_sum(:,:) * area(:,:) * tms(:,:) ) * z1_area * r1_rau0 * rday
115
116      ! Heat budget
117      zbg_ihc      = glob_sum( et_i(:,:) * 1.e-20 ) ! ice heat content  [1.e-20 J]
118      zbg_shc      = glob_sum( et_s(:,:) * 1.e-20 ) ! snow heat content [1.e-20 J]
119      zbg_hfx_dhc  = glob_sum( diag_heat_dhc(:,:) * area(:,:) * tms(:,:) ) ! [in W]
120      zbg_hfx_spr  = glob_sum( hfx_spr(:,:) * area(:,:) * tms(:,:) ) ! [in W]
121
122      zbg_hfx_thd  = glob_sum( hfx_thd(:,:) * area(:,:) * tms(:,:) ) ! [in W]
123      zbg_hfx_dyn  = glob_sum( hfx_dyn(:,:) * area(:,:) * tms(:,:) ) ! [in W]
124      zbg_hfx_res  = glob_sum( hfx_res(:,:) * area(:,:) * tms(:,:) ) ! [in W]
125      zbg_hfx_sub  = glob_sum( hfx_sub(:,:) * area(:,:) * tms(:,:) ) ! [in W]
126      zbg_hfx_snw  = glob_sum( hfx_snw(:,:) * area(:,:) * tms(:,:) ) ! [in W]
127      zbg_hfx_sum  = glob_sum( hfx_sum(:,:) * area(:,:) * tms(:,:) ) ! [in W]
128      zbg_hfx_bom  = glob_sum( hfx_bom(:,:) * area(:,:) * tms(:,:) ) ! [in W]
129      zbg_hfx_bog  = glob_sum( hfx_bog(:,:) * area(:,:) * tms(:,:) ) ! [in W]
130      zbg_hfx_dif  = glob_sum( hfx_dif(:,:) * area(:,:) * tms(:,:) ) ! [in W]
131      zbg_hfx_opw  = glob_sum( hfx_opw(:,:) * area(:,:) * tms(:,:) ) ! [in W]
132      zbg_hfx_out  = glob_sum( hfx_out(:,:) * area(:,:) * tms(:,:) ) ! [in W]
133      zbg_hfx_in   = glob_sum(  hfx_in(:,:) * area(:,:) * tms(:,:) ) ! [in W]
134   
135      ! --------------------------------------------- !
136      ! 2 - Trends due to forcing and ice growth/melt !
137      ! --------------------------------------------- !
138      z_frc_vol = r1_rau0 * glob_sum( - emp(:,:) * area(:,:) * tms(:,:) ) ! volume fluxes
139      z_frc_sal = r1_rau0 * glob_sum(   sfx(:,:) * area(:,:) * tms(:,:) ) ! salt fluxes
140      z_bg_grme = glob_sum( - ( wfx_bog(:,:) + wfx_opw(:,:) + wfx_sni(:,:) + wfx_dyn(:,:) + &
141                          &     wfx_bom(:,:) + wfx_sum(:,:) + wfx_res(:,:) + wfx_snw(:,:) + wfx_sub(:,:) ) * area(:,:) * tms(:,:) ) ! volume fluxes
142      !
143      frc_vol  = frc_vol  + z_frc_vol  * rdt_ice
144      frc_sal  = frc_sal  + z_frc_sal  * rdt_ice
145      bg_grme  = bg_grme  + z_bg_grme  * rdt_ice
146     
147      ! difference
148      !frc_vol = zbg_ivo - frc_vol
149      !frc_sal = zbg_sal - frc_sal
150     
151      ! ----------------------- !
152      ! 3 - Diagnostics writing !
153      ! ----------------------- !
154      zindb = MAX( 0.d0 , SIGN( 1.d0 , zbg_ivo - epsi06 ) )
155      !
156      CALL iom_put( 'ibgvoltot' , zbg_ivo * rhoic * r1_rau0 * 1.e-9        )   ! ice volume (km3 equivalent liquid)         
157      CALL iom_put( 'sbgvoltot' , zbg_svo * rhosn * r1_rau0 * 1.e-9        )   ! snw volume (km3 equivalent liquid)       
158      CALL iom_put( 'ibgarea'   , zbg_are * 1.e-6                          )   ! ice area   (km2)
159      CALL iom_put( 'ibgsaline' , zindb * zbg_sal / MAX( zbg_ivo, epsi06 ) )   ! ice saline (psu)
160      CALL iom_put( 'ibgtemper' , zindb * zbg_tem / MAX( zbg_ivo, epsi06 ) )   ! ice temper (C)
161      CALL iom_put( 'ibgheatco' , zbg_ihc                                  )   ! ice heat content (1.e20 J)       
162      CALL iom_put( 'sbgheatco' , zbg_shc                                  )   ! snw heat content (1.e20 J)
163      CALL iom_put( 'ibgsaltco' , zbg_sal * rhoic * r1_rau0 * 1.e-9        )   ! ice salt content (psu*km3 equivalent liquid)       
164
165      CALL iom_put( 'ibgvfx'    , zbg_vfx                                  )   ! volume flux emp (m/day liquid)
166      CALL iom_put( 'ibgvfxbog' , zbg_vfx_bog                              )   ! volume flux bottom growth     -(m/day equivalent liquid)
167      CALL iom_put( 'ibgvfxopw' , zbg_vfx_opw                              )   ! volume flux open water growth -
168      CALL iom_put( 'ibgvfxsni' , zbg_vfx_sni                              )   ! volume flux snow ice growth   -
169      CALL iom_put( 'ibgvfxdyn' , zbg_vfx_dyn                              )   ! volume flux dynamic growth    -
170      CALL iom_put( 'ibgvfxbom' , zbg_vfx_bom                              )   ! volume flux bottom melt       -
171      CALL iom_put( 'ibgvfxsum' , zbg_vfx_sum                              )   ! volume flux surface melt      -
172      CALL iom_put( 'ibgvfxres' , zbg_vfx_res                              )   ! volume flux resultant         -
173      CALL iom_put( 'ibgvfxspr' , zbg_vfx_spr                              )   ! volume flux from snow precip         -
174      CALL iom_put( 'ibgvfxsnw' , zbg_vfx_snw                              )   ! volume flux from snow melt         -
175      CALL iom_put( 'ibgvfxsub' , zbg_vfx_sub                              )   ! volume flux from sublimation         -
176         
177      CALL iom_put( 'ibgsfx'    , zbg_sfx                                  )   ! salt flux         -(psu*m/day equivalent liquid)       
178      CALL iom_put( 'ibgsfxbri' , zbg_sfx_bri                              )   ! salt flux brines  -     
179      CALL iom_put( 'ibgsfxdyn' , zbg_sfx_dyn                              )   ! salt flux dynamic -   
180      CALL iom_put( 'ibgsfxres' , zbg_sfx_res                              )   ! salt flux result  -   
181      CALL iom_put( 'ibgsfxbog' , zbg_sfx_bog                              )   ! salt flux bottom growth   
182      CALL iom_put( 'ibgsfxopw' , zbg_sfx_opw                              )   ! salt flux open water growth -
183      CALL iom_put( 'ibgsfxsni' , zbg_sfx_sni                              )   ! salt flux snow ice growth   -
184      CALL iom_put( 'ibgsfxbom' , zbg_sfx_bom                              )   ! salt flux bottom melt       -
185      CALL iom_put( 'ibgsfxsum' , zbg_sfx_sum                              )   ! salt flux surface melt      -
186
187      CALL iom_put( 'ibghfxdhc' , zbg_hfx_dhc                              )   ! Heat content variation in snow and ice [W]
188      CALL iom_put( 'ibghfxspr' , zbg_hfx_spr                              )   ! Heat content of snow precip [W]
189
190      CALL iom_put( 'ibghfxres' , zbg_hfx_res                              )   !
191      CALL iom_put( 'ibghfxsub' , zbg_hfx_sub                              )   !
192      CALL iom_put( 'ibghfxdyn' , zbg_hfx_dyn                              )   !
193      CALL iom_put( 'ibghfxthd' , zbg_hfx_thd                              )   !
194      CALL iom_put( 'ibghfxsnw' , zbg_hfx_snw                              )   !
195      CALL iom_put( 'ibghfxsum' , zbg_hfx_sum                              )   !
196      CALL iom_put( 'ibghfxbom' , zbg_hfx_bom                              )   !
197      CALL iom_put( 'ibghfxbog' , zbg_hfx_bog                              )   !
198      CALL iom_put( 'ibghfxdif' , zbg_hfx_dif                              )   !
199      CALL iom_put( 'ibghfxopw' , zbg_hfx_opw                              )   !
200      CALL iom_put( 'ibghfxout' , zbg_hfx_out                              )   !
201      CALL iom_put( 'ibghfxin'  , zbg_hfx_in                               )   !
202
203      CALL iom_put( 'ibgfrcvol' , frc_vol * 1.e-9                          )   ! vol - forcing     (km3 equivalent liquid)
204      CALL iom_put( 'ibgfrcsfx' , frc_sal * 1.e-9                          )   ! sal - forcing     (psu*km3 equivalent liquid)   
205      CALL iom_put( 'ibgvolgrm' , bg_grme * r1_rau0 * 1.e-9                )   ! vol growth + melt (km3 equivalent liquid)         
206
207      !
208      IF( lrst_ice )   CALL lim_diahsb_rst( numit, 'WRITE' )
209      !
210      IF( nn_timing == 1 )   CALL timing_stop('lim_diahsb')
211!
212   END SUBROUTINE lim_diahsb
213
214
215   SUBROUTINE lim_diahsb_init
216      !!---------------------------------------------------------------------------
217      !!                  ***  ROUTINE lim_diahsb_init  ***
218      !!     
219      !! ** Purpose: Initialization for the heat salt volume budgets
220      !!
221      !! ** Method : Compute initial heat content, salt content and volume
222      !!
223      !! ** Action : - Compute initial heat content, salt content and volume
224      !!             - Initialize forcing trends
225      !!             - Compute coefficients for conversion
226      !!---------------------------------------------------------------------------
227      INTEGER            ::   jk       ! dummy loop indice
228      INTEGER            ::   ierror   ! local integer
229      !!
230      !!NAMELIST/namicehsb/ blabla
231      !!----------------------------------------------------------------------
232      !
233      !!REWIND ( numnam_ice )              ! Read Namelist namicehsb
234      !!READ   ( numnam_ice, namicehsb )
235      !
236      IF(lwp) THEN                   ! Control print
237         WRITE(numout,*)
238         WRITE(numout,*) 'lim_diahsb_init : check the heat and salt budgets'
239         WRITE(numout,*) '~~~~~~~~~~~~'
240      ENDIF
241
242      ! ---------------------------------- !
243      ! 2 - initial conservation variables !
244      ! ---------------------------------- !
245      !frc_vol = 0.d0                                           ! volume       trend due to forcing
246      !frc_sal = 0.d0                                           ! salt content   -    -   -    -         
247      !bg_grme = 0.d0                                           ! ice growth + melt volume trend
248      !
249      CALL lim_diahsb_rst( nstart, 'READ' )  !* read or initialize all required files
250      !
251   END SUBROUTINE lim_diahsb_init
252
253   SUBROUTINE lim_diahsb_rst( kt, cdrw )
254     !!---------------------------------------------------------------------
255     !!                   ***  ROUTINE limdia_rst  ***
256     !!                     
257     !! ** Purpose :   Read or write DIA file in restart file
258     !!
259     !! ** Method  :   use of IOM library
260     !!----------------------------------------------------------------------
261     INTEGER         , INTENT(in) ::   kt     ! ice time-step
262     CHARACTER(len=*), INTENT(in) ::   cdrw   ! "READ"/"WRITE" flag
263     !
264     INTEGER ::   id1, id2, id3   ! local integers
265     !!----------------------------------------------------------------------
266     !
267     IF( TRIM(cdrw) == 'READ' ) THEN        ! Read/initialise
268        IF( ln_rstart ) THEN                   !* Read the restart file
269           !id1 = iom_varid( numrir, 'frc_vol'  , ldstop = .TRUE. )
270           !
271           IF(lwp) WRITE(numout,*) '~~~~~~~'
272           IF(lwp) WRITE(numout,*) ' lim_diahsb_rst at it= ', kt,' date= ', ndastp
273           IF(lwp) WRITE(numout,*) '~~~~~~~'
274           CALL iom_get( numrir, 'frc_vol', frc_vol )
275           CALL iom_get( numrir, 'frc_sal', frc_sal )
276           CALL iom_get( numrir, 'bg_grme', bg_grme )
277        ELSE
278           IF(lwp) WRITE(numout,*) '~~~~~~~'
279           IF(lwp) WRITE(numout,*) ' lim_diahsb at initial state '
280           IF(lwp) WRITE(numout,*) '~~~~~~~'
281           frc_vol  = 0.d0                                           
282           frc_sal  = 0.d0                                                 
283           bg_grme  = 0.d0                                       
284       ENDIF   
285
286     ELSEIF( TRIM(cdrw) == 'WRITE' ) THEN   ! Create restart file
287        !                                   ! -------------------
288        IF(lwp) WRITE(numout,*) '~~~~~~~'
289        IF(lwp) WRITE(numout,*) ' lim_diahsb_rst at it= ', kt,' date= ', ndastp
290        IF(lwp) WRITE(numout,*) '~~~~~~~'
291        CALL iom_rstput( kt, nitrst, numriw, 'frc_vol'   , frc_vol     )
292        CALL iom_rstput( kt, nitrst, numriw, 'frc_sal'   , frc_sal     )
293        CALL iom_rstput( kt, nitrst, numriw, 'bg_grme'   , bg_grme     )
294        !
295     ENDIF
296     !
297   END SUBROUTINE lim_diahsb_rst
298 
299#else
300   !!----------------------------------------------------------------------
301   !!   Default option :         Empty module          NO LIM sea-ice model
302   !!----------------------------------------------------------------------
303CONTAINS
304   SUBROUTINE lim_diahsb          ! Empty routine
305   END SUBROUTINE lim_diahsb
306#endif
307   !!======================================================================
308END MODULE limdiahsb
Note: See TracBrowser for help on using the repository browser.