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_MERGE_2013/NEMOGCM/NEMO/LIM_SRC_3 – NEMO

source: branches/2013/dev_MERGE_2013/NEMOGCM/NEMO/LIM_SRC_3/limdiahsb.F90 @ 4291

Last change on this file since 4291 was 4161, checked in by cetlod, 10 years ago

dev_LOCEAN_2013 : merge in the 3rd dev branch dev_r4028_CNRS_LIM3, see ticket #1169

File size: 11.1 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 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
29   IMPLICIT NONE
30   PRIVATE
31
32   PUBLIC   lim_diahsb        ! routine called by ice_step.F90
33   !!PUBLIC   lim_diahsb_init   ! routine called by ice_init.F90
34   !!PUBLIC   lim_diahsb_rst   ! routine called by ice_init.F90
35
36   REAL(wp), SAVE   ::   frc_sal, frc_vol   ! global forcing trends
37   REAL(wp), SAVE   ::   bg_grpme           ! global ice growth+melt trends
38   REAL(wp) ::   epsi06 = 1.e-6_wp  ! small number
39   REAL(wp) ::   epsi03 = 1.e-3_wp  ! small number
40
41
42   !! * Substitutions
43#  include "vectopt_loop_substitute.h90"
44
45   !!----------------------------------------------------------------------
46   !! NEMO/OPA 3.4 , NEMO Consortium (2012)
47   !! $Id: limdiahsb.F90 3294 2012-10-18 16:44:18Z rblod $
48   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
49   !!----------------------------------------------------------------------
50
51CONTAINS
52
53   SUBROUTINE lim_diahsb
54      !!---------------------------------------------------------------------------
55      !!                  ***  ROUTINE lim_diahsb  ***
56      !!     
57      !! ** Purpose: Compute the ice global heat content, salt content and volume conservation
58      !!
59      !! ** Method : - Compute the deviation of heat content, salt content and volume
60      !!             at the current time step from their values at nit000
61      !!             - Compute the contribution of forcing and remove it from these deviations
62      !!
63      !!---------------------------------------------------------------------------
64      !!
65      REAL(wp)   ::   zbg_ivo, zbg_svo, zbg_are, zbg_sal ,zbg_tem ,zbg_ihc ,zbg_shc
66      REAL(wp)   ::   zbg_sfx, zbg_emp, zbg_sfx_bri, zbg_sfx_thd, zbg_sfx_res, zbg_sfx_mec 
67      REAL(wp)   ::   z_frc_vol, z_frc_sal, z_bg_grpme 
68      REAL(wp)   ::   zdeltat, z1_area                     !    -     -
69      !!---------------------------------------------------------------------------
70      IF( nn_timing == 1 )   CALL timing_start('lim_diahsb')
71
72      IF( numit == nstart ) CALL lim_diahsb_init 
73
74      ! 1/area
75      z1_area = 1.0 / MAX( glob_sum( area(:,:) * tms(:,:) ),epsi06 )
76      ! ----------------------- !
77      ! 1 -  Content variations !
78      ! ----------------------- !
79      zbg_ivo = glob_sum( vt_i(:,:) * area(:,:) * tms(:,:) ) ! volume ice
80      zbg_svo = glob_sum( vt_s(:,:) * area(:,:) * tms(:,:) ) ! volume snow
81      zbg_are = glob_sum( at_i(:,:) * area(:,:) * tms(:,:) ) ! area
82      zbg_sal = glob_sum( SUM(smv_i(:,:,:),dim=3) * area(:,:) * tms(:,:) ) ! mean salt content
83      zbg_tem = glob_sum( (tm_i(:,:)-rtt) * vt_i(:,:) * area(:,:) * tms(:,:) )  ! mean temp content
84
85      !zbg_ihc = glob_sum( et_i(:,:) * area(:,:) * tms(:,:) ) / MAX( zbg_ivo,epsi06 ) ! ice heat content
86      !zbg_shc = glob_sum( et_s(:,:) * area(:,:) * tms(:,:) ) / MAX( zbg_svo,epsi06 ) ! snow heat content
87
88      zbg_ihc = glob_sum( et_i(:,:) ) ! ice heat content  [10^9 J]
89      zbg_shc = glob_sum( et_s(:,:) ) ! snow heat content [10^9 J]
90
91      zbg_sfx      = glob_sum(      sfx(:,:) * area(:,:) * tms(:,:) ) * z1_area
92      zbg_emp       = glob_sum(       emp(:,:) * area(:,:) * tms(:,:) ) * z1_area
93      zbg_sfx_bri     = glob_sum(     sfx_bri(:,:) * area(:,:) * tms(:,:) ) * z1_area
94      zbg_sfx_thd     = glob_sum(     sfx_thd(:,:) * area(:,:) * tms(:,:) ) * z1_area
95      zbg_sfx_res = glob_sum( sfx_res(:,:) * area(:,:) * tms(:,:) ) * z1_area
96      zbg_sfx_mec = glob_sum( sfx_mec(:,:) * area(:,:) * tms(:,:) ) * z1_area
97     
98      ! --------------------------------------------- !
99      ! 2 - Trends due to forcing and ice growth/melt !
100      ! --------------------------------------------- !
101      z_frc_vol = ( 1.e0 / rau0 ) * glob_sum( - emp(:,:) * area(:,:) * tms(:,:) ) ! volume fluxes
102      z_frc_sal = ( 1.e0 / rau0 ) * glob_sum(  sfx(:,:) * area(:,:) * tms(:,:) ) ! salt fluxes
103      z_bg_grpme = glob_sum( ( diag_bot_gr(:,:) + diag_lat_gr(:,:) + diag_sni_gr(:,:) + diag_dyn_gr(:,:) + &
104                          &    diag_bot_me(:,:) + diag_sur_me(:,:) + diag_res_pr(:,:) ) * area(:,:) * tms(:,:) ) ! volume fluxes
105      !
106      frc_vol  = frc_vol  + z_frc_vol  * rdt_ice
107      frc_sal  = frc_sal  + z_frc_sal  * rdt_ice
108      bg_grpme = bg_grpme + z_bg_grpme * rdt_ice
109     
110      ! difference
111      !frc_vol = zbg_ivo - frc_vol
112      !frc_sal = zbg_sal - frc_sal
113     
114      ! ----------------------- !
115      ! 3 - Diagnostics writing !
116      ! ----------------------- !
117      !zdeltat  = 1.e0 / ( ( kt - nit000 + 1 ) * rdt_ice )
118      !
119      CALL iom_put( 'ibgvoltot',zbg_ivo * rhoic / rau0 * 1.e-9 ) ! m3 (equivalent liquid)         
120      CALL iom_put( 'sbgvoltot',zbg_svo * rhosn / rau0 * 1.e-9 )  ! m3 (equivalent liquid)       
121      CALL iom_put( 'ibgarea',zbg_are * 1.e-6 )         
122      CALL iom_put( 'ibgsaline',zbg_sal / MAX( zbg_ivo,epsi03 ) )         
123      CALL iom_put( 'ibgtemper',zbg_tem / MAX( zbg_ivo,epsi03 ) )         
124      CALL iom_put( 'ibgheatco',zbg_ihc )           ! 10^9 J       
125      CALL iom_put( 'ibgsaltco',zbg_sal * rhoic / rau0 * 1.e-9 ) ! psu*km3       
126      CALL iom_put( 'sbgheatco',zbg_shc )           ! 10^9 J
127      CALL iom_put( 'ibgfrcemp',frc_vol * 1.e-9 )           !vol - forcing : km3 (equivalent liquid)         
128      CALL iom_put( 'ibgfrcsfx',frc_sal * 1.e-9 )          !sal - forcing : psu*km3   
129      CALL iom_put( 'ibgsfx',zbg_sfx *rday)           
130      CALL iom_put( 'ibgemp',zbg_emp *rday)             
131      CALL iom_put( 'ibgsfxbri',zbg_sfx_bri *rday)         
132      CALL iom_put( 'ibgsfxthd',zbg_sfx_thd *rday)         
133      CALL iom_put( 'ibgsfxres',zbg_sfx_res *rday)         
134      CALL iom_put( 'ibgsfxmec',zbg_sfx_mec *rday)         
135      CALL iom_put( 'ibggrpme',bg_grpme * rhoic / rau0 * 1.e-9 ) ! km3 (equivalent liquid)         
136      !
137      IF( lrst_ice )   CALL lim_diahsb_rst( numit, 'WRITE' )
138      !
139      IF( nn_timing == 1 )   CALL timing_stop('lim_diahsb')
140!
141   END SUBROUTINE lim_diahsb
142
143
144   SUBROUTINE lim_diahsb_init
145      !!---------------------------------------------------------------------------
146      !!                  ***  ROUTINE lim_diahsb_init  ***
147      !!     
148      !! ** Purpose: Initialization for the heat salt volume budgets
149      !!
150      !! ** Method : Compute initial heat content, salt content and volume
151      !!
152      !! ** Action : - Compute initial heat content, salt content and volume
153      !!             - Initialize forcing trends
154      !!             - Compute coefficients for conversion
155      !!---------------------------------------------------------------------------
156      INTEGER            ::   jk       ! dummy loop indice
157      INTEGER            ::   ierror   ! local integer
158      !!
159      !!NAMELIST/namicehsb/ blabla
160      !!----------------------------------------------------------------------
161      !
162      !!REWIND ( numnam_ice )              ! Read Namelist namicehsb
163      !!READ   ( numnam_ice, namicehsb )
164      !
165      IF(lwp) THEN                   ! Control print
166         WRITE(numout,*)
167         WRITE(numout,*) 'lim_diahsb_init : check the heat and salt budgets'
168         WRITE(numout,*) '~~~~~~~~~~~~'
169      ENDIF
170
171      ! ---------------------------------- !
172      ! 2 - initial conservation variables !
173      ! ---------------------------------- !
174      !frc_vol = 0._wp                                           ! volume       trend due to forcing
175      !frc_sal = 0._wp                                           ! salt content   -    -   -    -         
176      !bg_grpme = 0._wp                                          ! ice growth + melt volume trend
177      !
178      CALL lim_diahsb_rst( nstart, 'READ' )  !* read or initialize all required files
179      !
180   END SUBROUTINE lim_diahsb_init
181
182   SUBROUTINE lim_diahsb_rst( kt, cdrw )
183     !!---------------------------------------------------------------------
184     !!                   ***  ROUTINE limdia_rst  ***
185     !!                     
186     !! ** Purpose :   Read or write DIA file in restart file
187     !!
188     !! ** Method  :   use of IOM library
189     !!----------------------------------------------------------------------
190     INTEGER         , INTENT(in) ::   kt     ! ice time-step
191     CHARACTER(len=*), INTENT(in) ::   cdrw   ! "READ"/"WRITE" flag
192     !
193     INTEGER ::   id1, id2, id3   ! local integers
194     !!----------------------------------------------------------------------
195     !
196     IF( TRIM(cdrw) == 'READ' ) THEN        ! Read/initialise
197        IF( ln_rstart ) THEN                   !* Read the restart file
198           id1 = iom_varid( numrir, 'frc_vol'  , ldstop = .TRUE. )
199           !
200           CALL iom_get( numrir, 'frc_vol', frc_vol )
201           CALL iom_get( numrir, 'frc_sal', frc_sal )
202           CALL iom_get( numrir, 'bg_grpme', bg_grpme )
203       ELSE
204            frc_vol = 0._wp                                           
205            frc_sal = 0._wp                                                 
206            bg_grpme = 0._wp                                       
207       ENDIF   
208
209     ELSEIF( TRIM(cdrw) == 'WRITE' ) THEN   ! Create restart file
210        !                                   ! -------------------
211        IF(lwp) WRITE(numout,*) '---- limdia-rst ----'
212        CALL iom_rstput( kt, nitrst, numriw, 'frc_vol'   , frc_vol     )
213        CALL iom_rstput( kt, nitrst, numriw, 'frc_sal'   , frc_sal     )
214        CALL iom_rstput( kt, nitrst, numriw, 'bg_grpme'  , bg_grpme     )
215        !
216     ENDIF
217     !
218   END SUBROUTINE lim_diahsb_rst
219 
220#else
221   !!----------------------------------------------------------------------
222   !!   Default option :         Empty module          NO LIM sea-ice model
223   !!----------------------------------------------------------------------
224CONTAINS
225   SUBROUTINE lim_diahsb          ! Empty routine
226   END SUBROUTINE lim_diahsb
227#endif
228   !!======================================================================
229END MODULE limdiahsb
Note: See TracBrowser for help on using the repository browser.