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.
diahsb.F90 in branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DIA – NEMO

source: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/DIA/diahsb.F90 @ 9124

Last change on this file since 9124 was 9124, checked in by gm, 6 years ago

dev_merge_2017: ln_timing instead of nn_timing + restricted timing to nemo_init and routine called by step in OPA_SRC

  • Property svn:keywords set to Id
File size: 19.8 KB
Line 
1MODULE diahsb
2   !!======================================================================
3   !!                       ***  MODULE  diahsb  ***
4   !! Ocean diagnostics: Heat, salt and volume budgets
5   !!======================================================================
6   !! History :  3.3  ! 2010-09  (M. Leclair)  Original code
7   !!                 ! 2012-10  (C. Rousset)  add iom_put
8   !!----------------------------------------------------------------------
9
10   !!----------------------------------------------------------------------
11   !!   dia_hsb       : Diagnose the conservation of ocean heat and salt contents, and volume
12   !!   dia_hsb_rst   : Read or write DIA file in restart file
13   !!   dia_hsb_init  : Initialization of the conservation diagnostic
14   !!----------------------------------------------------------------------
15   USE oce             ! ocean dynamics and tracers
16   USE dom_oce         ! ocean space and time domain
17   USE phycst          ! physical constants
18   USE sbc_oce         ! surface thermohaline fluxes
19   USE sbcrnf          ! river runoff
20   USE sbcisf          ! ice shelves
21   USE domvvl          ! vertical scale factors
22   USE traqsr          ! penetrative solar radiation
23   USE trabbc          ! bottom boundary condition
24   USE trabbc          ! bottom boundary condition
25   USE restart         ! ocean restart
26   USE bdy_oce   , ONLY: ln_bdy
27   !
28   USE iom             ! I/O manager
29   USE in_out_manager  ! I/O manager
30   USE lib_fortran     ! glob_sum
31   USE lib_mpp         ! distributed memory computing library
32   USE timing          ! preformance summary
33
34   IMPLICIT NONE
35   PRIVATE
36
37   PUBLIC   dia_hsb        ! routine called by step.F90
38   PUBLIC   dia_hsb_init   ! routine called by nemogcm.F90
39
40   LOGICAL, PUBLIC ::   ln_diahsb   !: check the heat and salt budgets
41
42   REAL(wp) ::   surf_tot              ! ocean surface
43   REAL(wp) ::   frc_t, frc_s, frc_v   ! global forcing trends
44   REAL(wp) ::   frc_wn_t, frc_wn_s    ! global forcing trends
45   !
46   REAL(wp), DIMENSION(:,:)  , ALLOCATABLE ::   surf 
47   REAL(wp), DIMENSION(:,:)  , ALLOCATABLE ::   surf_ini      , ssh_ini          !
48   REAL(wp), DIMENSION(:,:)  , ALLOCATABLE ::   ssh_hc_loc_ini, ssh_sc_loc_ini   !
49   REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::   hc_loc_ini, sc_loc_ini, e3t_ini  !
50
51   !! * Substitutions
52#  include "vectopt_loop_substitute.h90"
53   !!----------------------------------------------------------------------
54   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
55   !! $Id$
56   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
57   !!----------------------------------------------------------------------
58CONTAINS
59
60   SUBROUTINE dia_hsb( kt )
61      !!---------------------------------------------------------------------------
62      !!                  ***  ROUTINE dia_hsb  ***
63      !!     
64      !! ** Purpose: Compute the ocean global heat content, salt content and volume conservation
65      !!
66      !! ** Method : - Compute the deviation of heat content, salt content and volume
67      !!             at the current time step from their values at nit000
68      !!             - Compute the contribution of forcing and remove it from these deviations
69      !!
70      !!---------------------------------------------------------------------------
71      INTEGER, INTENT(in) ::   kt   ! ocean time-step index
72      !
73      INTEGER    ::   ji, jj, jk                  ! dummy loop indice
74      REAL(wp)   ::   zdiff_hc    , zdiff_sc      ! heat and salt content variations
75      REAL(wp)   ::   zdiff_hc1   , zdiff_sc1     !  -         -     -        -
76      REAL(wp)   ::   zdiff_v1    , zdiff_v2      ! volume variation
77      REAL(wp)   ::   zerr_hc1    , zerr_sc1      ! heat and salt content misfit
78      REAL(wp)   ::   zvol_tot                    ! volume
79      REAL(wp)   ::   z_frc_trd_t , z_frc_trd_s   !    -     -
80      REAL(wp)   ::   z_frc_trd_v                 !    -     -
81      REAL(wp)   ::   z_wn_trd_t , z_wn_trd_s     !    -     -
82      REAL(wp)   ::   z_ssh_hc , z_ssh_sc         !    -     -
83      REAL(wp), DIMENSION(jpi,jpj) ::   z2d0, z2d1   ! 2D workspace
84      !!---------------------------------------------------------------------------
85      IF( ln_timing )   CALL timing_start('dia_hsb')     
86      !
87      tsn(:,:,:,1) = tsn(:,:,:,1) * tmask(:,:,:) ; tsb(:,:,:,1) = tsb(:,:,:,1) * tmask(:,:,:) ;
88      tsn(:,:,:,2) = tsn(:,:,:,2) * tmask(:,:,:) ; tsb(:,:,:,2) = tsb(:,:,:,2) * tmask(:,:,:) ;
89      ! ------------------------- !
90      ! 1 - Trends due to forcing !
91      ! ------------------------- !
92      z_frc_trd_v = r1_rau0 * glob_sum( - ( emp(:,:) - rnf(:,:) + fwfisf(:,:) ) * surf(:,:) ) ! volume fluxes
93      z_frc_trd_t =           glob_sum( sbc_tsc(:,:,jp_tem) * surf(:,:) )                               ! heat fluxes
94      z_frc_trd_s =           glob_sum( sbc_tsc(:,:,jp_sal) * surf(:,:) )                               ! salt fluxes
95      ! Add runoff    heat & salt input
96      IF( ln_rnf    )   z_frc_trd_t = z_frc_trd_t + glob_sum( rnf_tsc(:,:,jp_tem) * surf(:,:) )
97      IF( ln_rnf_sal)   z_frc_trd_s = z_frc_trd_s + glob_sum( rnf_tsc(:,:,jp_sal) * surf(:,:) )
98      ! Add ice shelf heat & salt input
99      IF( ln_isf    ) z_frc_trd_t = z_frc_trd_t + glob_sum( risf_tsc(:,:,jp_tem) * surf(:,:) )
100      ! Add penetrative solar radiation
101      IF( ln_traqsr )   z_frc_trd_t = z_frc_trd_t + r1_rau0_rcp * glob_sum( qsr     (:,:) * surf(:,:) )
102      ! Add geothermal heat flux
103      IF( ln_trabbc )   z_frc_trd_t = z_frc_trd_t +               glob_sum( qgh_trd0(:,:) * surf(:,:) )
104      !
105      IF( ln_linssh ) THEN
106         IF( ln_isfcav ) THEN
107            DO ji=1,jpi
108               DO jj=1,jpj
109                  z2d0(ji,jj) = surf(ji,jj) * wn(ji,jj,mikt(ji,jj)) * tsb(ji,jj,mikt(ji,jj),jp_tem)
110                  z2d1(ji,jj) = surf(ji,jj) * wn(ji,jj,mikt(ji,jj)) * tsb(ji,jj,mikt(ji,jj),jp_sal)
111               END DO
112            END DO
113         ELSE
114            z2d0(:,:) = surf(:,:) * wn(:,:,1) * tsb(:,:,1,jp_tem)
115            z2d1(:,:) = surf(:,:) * wn(:,:,1) * tsb(:,:,1,jp_sal)
116         END IF
117         z_wn_trd_t = - glob_sum( z2d0 ) 
118         z_wn_trd_s = - glob_sum( z2d1 )
119      ENDIF
120
121      frc_v = frc_v + z_frc_trd_v * rdt
122      frc_t = frc_t + z_frc_trd_t * rdt
123      frc_s = frc_s + z_frc_trd_s * rdt
124      !                                          ! Advection flux through fixed surface (z=0)
125      IF( ln_linssh ) THEN
126         frc_wn_t = frc_wn_t + z_wn_trd_t * rdt
127         frc_wn_s = frc_wn_s + z_wn_trd_s * rdt
128      ENDIF
129
130      ! ------------------------ !
131      ! 2 -  Content variations !
132      ! ------------------------ !
133      ! glob_sum_full is needed because you keep the full interior domain to compute the sum (iscpl)
134      zdiff_v2 = 0._wp
135      zdiff_hc = 0._wp
136      zdiff_sc = 0._wp
137
138      ! volume variation (calculated with ssh)
139      zdiff_v1 = glob_sum_full( surf(:,:) * sshn(:,:) - surf_ini(:,:) * ssh_ini(:,:) )
140
141      ! heat & salt content variation (associated with ssh)
142      IF( ln_linssh ) THEN
143         IF( ln_isfcav ) THEN
144            DO ji = 1, jpi
145               DO jj = 1, jpj
146                  z2d0(ji,jj) = surf(ji,jj) * ( tsn(ji,jj,mikt(ji,jj),jp_tem) * sshn(ji,jj) - ssh_hc_loc_ini(ji,jj) ) 
147                  z2d1(ji,jj) = surf(ji,jj) * ( tsn(ji,jj,mikt(ji,jj),jp_sal) * sshn(ji,jj) - ssh_sc_loc_ini(ji,jj) ) 
148               END DO
149            END DO
150         ELSE
151            z2d0(:,:) = surf(:,:) * ( tsn(:,:,1,jp_tem) * sshn(:,:) - ssh_hc_loc_ini(:,:) ) 
152            z2d1(:,:) = surf(:,:) * ( tsn(:,:,1,jp_sal) * sshn(:,:) - ssh_sc_loc_ini(:,:) ) 
153         END IF
154         z_ssh_hc = glob_sum_full( z2d0 ) 
155         z_ssh_sc = glob_sum_full( z2d1 ) 
156      ENDIF
157
158      DO jk = 1, jpkm1
159         ! volume variation (calculated with scale factors)
160         zdiff_v2 = zdiff_v2 + glob_sum_full( surf(:,:) * tmask(:,:,jk)            &
161            &                           * e3t_n(:,:,jk) - surf_ini(:,:) * e3t_ini(:,:,jk) )
162         ! heat content variation
163         zdiff_hc = zdiff_hc + glob_sum_full(  surf(:,:) * tmask(:,:,jk)                                   & 
164            &                           * e3t_n(:,:,jk) * tsn(:,:,jk,jp_tem) - surf_ini(:,:) * hc_loc_ini(:,:,jk) ) 
165         ! salt content variation
166         zdiff_sc = zdiff_sc + glob_sum_full( surf    (:,:) * tmask(:,:,jk)                           &
167                                        * e3t_n(:,:,jk) * tsn(:,:,jk,jp_sal) - surf_ini(:,:) * sc_loc_ini(:,:,jk) )
168      ENDDO
169
170      ! ------------------------ !
171      ! 3 -  Drifts              !
172      ! ------------------------ !
173      zdiff_v1 = zdiff_v1 - frc_v
174      IF( .NOT.ln_linssh )   zdiff_v2 = zdiff_v2 - frc_v
175      zdiff_hc = zdiff_hc - frc_t
176      zdiff_sc = zdiff_sc - frc_s
177      IF( ln_linssh ) THEN
178         zdiff_hc1 = zdiff_hc + z_ssh_hc 
179         zdiff_sc1 = zdiff_sc + z_ssh_sc
180         zerr_hc1  = z_ssh_hc - frc_wn_t
181         zerr_sc1  = z_ssh_sc - frc_wn_s
182      ENDIF
183
184      ! ----------------------- !
185      ! 4 - Diagnostics writing !
186      ! ----------------------- !
187      zvol_tot = 0._wp                    ! total ocean volume (calculated with scale factors)
188      DO jk = 1, jpkm1
189         zvol_tot  = zvol_tot + glob_sum_full( surf(:,:) * tmask(:,:,jk) * e3t_n(:,:,jk) )
190      END DO
191
192!!gm to be added ?
193!      IF( ln_linssh ) THEN            ! fixed volume, add the ssh contribution
194!        zvol_tot = zvol_tot + glob_sum( surf(:,:) * sshn(:,:) )
195!      ENDIF
196!!gm end
197
198      CALL iom_put(   'bgfrcvol' , frc_v    * 1.e-9    )              ! vol - surface forcing (km3)
199      CALL iom_put(   'bgfrctem' , frc_t    * rau0 * rcp * 1.e-20 )   ! hc  - surface forcing (1.e20 J)
200      CALL iom_put(   'bgfrchfx' , frc_t    * rau0 * rcp /  &         ! hc  - surface forcing (W/m2)
201         &                       ( surf_tot * kt * rdt )        )
202      CALL iom_put(   'bgfrcsal' , frc_s    * 1.e-9    )              ! sc  - surface forcing (psu*km3)
203
204      IF( .NOT. ln_linssh ) THEN
205        CALL iom_put( 'bgtemper' , zdiff_hc / zvol_tot )              ! Temperature drift     (C)
206        CALL iom_put( 'bgsaline' , zdiff_sc / zvol_tot )              ! Salinity    drift     (pss)
207        CALL iom_put( 'bgheatco' , zdiff_hc * 1.e-20 * rau0 * rcp )   ! Heat content drift    (1.e20 J)
208        CALL iom_put( 'bgheatfx' , zdiff_hc * rau0 * rcp /  &         ! Heat flux drift       (W/m2)
209           &                       ( surf_tot * kt * rdt )        )
210        CALL iom_put( 'bgsaltco' , zdiff_sc * 1.e-9    )              ! Salt content drift    (psu*km3)
211        CALL iom_put( 'bgvolssh' , zdiff_v1 * 1.e-9    )              ! volume ssh drift      (km3) 
212        CALL iom_put( 'bgvole3t' , zdiff_v2 * 1.e-9    )              ! volume e3t drift      (km3) 
213      ELSE
214        CALL iom_put( 'bgtemper' , zdiff_hc1 / zvol_tot)              ! Heat content drift    (C)
215        CALL iom_put( 'bgsaline' , zdiff_sc1 / zvol_tot)              ! Salt content drift    (pss)
216        CALL iom_put( 'bgheatco' , zdiff_hc1 * 1.e-20 * rau0 * rcp )  ! Heat content drift    (1.e20 J)
217        CALL iom_put( 'bgheatfx' , zdiff_hc1 * rau0 * rcp /  &        ! Heat flux drift       (W/m2)
218           &                       ( surf_tot * kt * rdt )         )
219        CALL iom_put( 'bgsaltco' , zdiff_sc1 * 1.e-9    )             ! Salt content drift    (psu*km3)
220        CALL iom_put( 'bgvolssh' , zdiff_v1 * 1.e-9    )              ! volume ssh drift      (km3) 
221        CALL iom_put( 'bgmistem' , zerr_hc1 / zvol_tot )              ! hc  - error due to free surface (C)
222        CALL iom_put( 'bgmissal' , zerr_sc1 / zvol_tot )              ! sc  - error due to free surface (psu)
223      ENDIF
224      !
225      IF( lrst_oce )   CALL dia_hsb_rst( kt, 'WRITE' )
226      !
227      IF( ln_timing )   CALL timing_stop('dia_hsb')
228      !
229   END SUBROUTINE dia_hsb
230
231
232   SUBROUTINE dia_hsb_rst( kt, cdrw )
233     !!---------------------------------------------------------------------
234     !!                   ***  ROUTINE dia_hsb_rst  ***
235     !!                     
236     !! ** Purpose :   Read or write DIA file in restart file
237     !!
238     !! ** Method  :   use of IOM library
239     !!----------------------------------------------------------------------
240     INTEGER         , INTENT(in) ::   kt     ! ocean time-step
241     CHARACTER(len=*), INTENT(in) ::   cdrw   ! "READ"/"WRITE" flag
242     !
243     INTEGER ::   ji, jj, jk   ! dummy loop indices
244     !!----------------------------------------------------------------------
245     !
246     IF( TRIM(cdrw) == 'READ' ) THEN        ! Read/initialise
247        IF( ln_rstart ) THEN                   !* Read the restart file
248           !
249           IF(lwp) WRITE(numout,*) '~~~~~~~'
250           IF(lwp) WRITE(numout,*) ' dia_hsb_rst at it= ', kt,' date= ', ndastp
251           IF(lwp) WRITE(numout,*) '~~~~~~~'
252           CALL iom_get( numror, 'frc_v', frc_v )
253           CALL iom_get( numror, 'frc_t', frc_t )
254           CALL iom_get( numror, 'frc_s', frc_s )
255           IF( ln_linssh ) THEN
256              CALL iom_get( numror, 'frc_wn_t', frc_wn_t )
257              CALL iom_get( numror, 'frc_wn_s', frc_wn_s )
258           ENDIF
259           CALL iom_get( numror, jpdom_autoglo, 'surf_ini', surf_ini ) ! ice sheet coupling
260           CALL iom_get( numror, jpdom_autoglo, 'ssh_ini', ssh_ini(:,:) )
261           CALL iom_get( numror, jpdom_autoglo, 'e3t_ini', e3t_ini(:,:,:) )
262           CALL iom_get( numror, jpdom_autoglo, 'hc_loc_ini', hc_loc_ini(:,:,:) )
263           CALL iom_get( numror, jpdom_autoglo, 'sc_loc_ini', sc_loc_ini(:,:,:) )
264           IF( ln_linssh ) THEN
265              CALL iom_get( numror, jpdom_autoglo, 'ssh_hc_loc_ini', ssh_hc_loc_ini(:,:) )
266              CALL iom_get( numror, jpdom_autoglo, 'ssh_sc_loc_ini', ssh_sc_loc_ini(:,:) )
267           ENDIF
268       ELSE
269          IF(lwp) WRITE(numout,*) '~~~~~~~'
270          IF(lwp) WRITE(numout,*) ' dia_hsb at initial state '
271          IF(lwp) WRITE(numout,*) '~~~~~~~'
272          surf_ini(:,:) = e1e2t(:,:) * tmask_i(:,:)         ! initial ocean surface
273          ssh_ini(:,:) = sshn(:,:)                          ! initial ssh
274          DO jk = 1, jpk
275             ! if ice sheet/oceqn coupling, need to mask ini variables here (mask could change at the next NEMO instance).
276             e3t_ini   (:,:,jk) = e3t_n(:,:,jk)                      * tmask(:,:,jk)  ! initial vertical scale factors
277             hc_loc_ini(:,:,jk) = tsn(:,:,jk,jp_tem) * e3t_n(:,:,jk) * tmask(:,:,jk)  ! initial heat content
278             sc_loc_ini(:,:,jk) = tsn(:,:,jk,jp_sal) * e3t_n(:,:,jk) * tmask(:,:,jk)  ! initial salt content
279          END DO
280          frc_v = 0._wp                                           ! volume       trend due to forcing
281          frc_t = 0._wp                                           ! heat content   -    -   -    -   
282          frc_s = 0._wp                                           ! salt content   -    -   -    -       
283          IF( ln_linssh ) THEN
284             IF ( ln_isfcav ) THEN
285                DO ji=1,jpi
286                   DO jj=1,jpj
287                      ssh_hc_loc_ini(ji,jj) = tsn(ji,jj,mikt(ji,jj),jp_tem) * sshn(ji,jj)   ! initial heat content in ssh
288                      ssh_sc_loc_ini(ji,jj) = tsn(ji,jj,mikt(ji,jj),jp_sal) * sshn(ji,jj)   ! initial salt content in ssh
289                   ENDDO
290                ENDDO
291             ELSE
292                ssh_hc_loc_ini(:,:) = tsn(:,:,1,jp_tem) * sshn(:,:)   ! initial heat content in ssh
293                ssh_sc_loc_ini(:,:) = tsn(:,:,1,jp_sal) * sshn(:,:)   ! initial salt content in ssh
294             END IF
295             frc_wn_t = 0._wp                                       ! initial heat content misfit due to free surface
296             frc_wn_s = 0._wp                                       ! initial salt content misfit due to free surface
297          ENDIF
298       ENDIF
299
300     ELSEIF( TRIM(cdrw) == 'WRITE' ) THEN   ! Create restart file
301        !                                   ! -------------------
302        IF(lwp) WRITE(numout,*) '~~~~~~~'
303        IF(lwp) WRITE(numout,*) ' dia_hsb_rst at it= ', kt,' date= ', ndastp
304        IF(lwp) WRITE(numout,*) '~~~~~~~'
305
306        CALL iom_rstput( kt, nitrst, numrow, 'frc_v'   , frc_v     )
307        CALL iom_rstput( kt, nitrst, numrow, 'frc_t'   , frc_t     )
308        CALL iom_rstput( kt, nitrst, numrow, 'frc_s'   , frc_s     )
309        IF( ln_linssh ) THEN
310           CALL iom_rstput( kt, nitrst, numrow, 'frc_wn_t', frc_wn_t )
311           CALL iom_rstput( kt, nitrst, numrow, 'frc_wn_s', frc_wn_s )
312        ENDIF
313        CALL iom_rstput( kt, nitrst, numrow, 'surf_ini', surf_ini )      ! ice sheet coupling
314        CALL iom_rstput( kt, nitrst, numrow, 'ssh_ini', ssh_ini(:,:) )
315        CALL iom_rstput( kt, nitrst, numrow, 'e3t_ini', e3t_ini(:,:,:) )
316        CALL iom_rstput( kt, nitrst, numrow, 'hc_loc_ini', hc_loc_ini(:,:,:) )
317        CALL iom_rstput( kt, nitrst, numrow, 'sc_loc_ini', sc_loc_ini(:,:,:) )
318        IF( ln_linssh ) THEN
319           CALL iom_rstput( kt, nitrst, numrow, 'ssh_hc_loc_ini', ssh_hc_loc_ini(:,:) )
320           CALL iom_rstput( kt, nitrst, numrow, 'ssh_sc_loc_ini', ssh_sc_loc_ini(:,:) )
321        ENDIF
322        !
323     ENDIF
324     !
325   END SUBROUTINE dia_hsb_rst
326
327
328   SUBROUTINE dia_hsb_init
329      !!---------------------------------------------------------------------------
330      !!                  ***  ROUTINE dia_hsb  ***
331      !!     
332      !! ** Purpose: Initialization for the heat salt volume budgets
333      !!
334      !! ** Method : Compute initial heat content, salt content and volume
335      !!
336      !! ** Action : - Compute initial heat content, salt content and volume
337      !!             - Initialize forcing trends
338      !!             - Compute coefficients for conversion
339      !!---------------------------------------------------------------------------
340      INTEGER ::   ierror   ! local integer
341      INTEGER ::   ios
342      !!
343      NAMELIST/namhsb/ ln_diahsb
344      !!----------------------------------------------------------------------
345      !
346      REWIND( numnam_ref )              ! Namelist namhsb in reference namelist
347      READ  ( numnam_ref, namhsb, IOSTAT = ios, ERR = 901)
348901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namhsb in reference namelist', lwp )
349
350      REWIND( numnam_cfg )              ! Namelist namhsb in configuration namelist
351      READ  ( numnam_cfg, namhsb, IOSTAT = ios, ERR = 902 )
352902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namhsb in configuration namelist', lwp )
353      IF(lwm) WRITE ( numond, namhsb )
354
355      IF(lwp) THEN
356         WRITE(numout,*)
357         WRITE(numout,*) 'dia_hsb_init'
358         WRITE(numout,*) '~~~~~~~~ '
359         WRITE(numout,*) '  check the heat and salt budgets (T) or not (F)       ln_diahsb = ', ln_diahsb
360      ENDIF
361      !
362      IF( .NOT. ln_diahsb )   RETURN
363
364      ! ------------------- !
365      ! 1 - Allocate memory !
366      ! ------------------- !
367      ALLOCATE( hc_loc_ini(jpi,jpj,jpk), sc_loc_ini(jpi,jpj,jpk), surf_ini(jpi,jpj), &
368         &      e3t_ini(jpi,jpj,jpk), surf(jpi,jpj),  ssh_ini(jpi,jpj), STAT=ierror  )
369      IF( ierror > 0 ) THEN
370         CALL ctl_stop( 'dia_hsb_init: unable to allocate hc_loc_ini' )   ;   RETURN
371      ENDIF
372
373      IF( ln_linssh )   ALLOCATE( ssh_hc_loc_ini(jpi,jpj), ssh_sc_loc_ini(jpi,jpj),STAT=ierror )
374      IF( ierror > 0 ) THEN
375         CALL ctl_stop( 'dia_hsb: unable to allocate ssh_hc_loc_ini' )   ;   RETURN
376      ENDIF
377
378      ! ----------------------------------------------- !
379      ! 2 - Time independant variables and file opening !
380      ! ----------------------------------------------- !
381      surf(:,:) = e1t(:,:) * e2t(:,:) * tmask_i(:,:)      ! masked surface grid cell area
382      surf_tot  = glob_sum( surf(:,:) )                   ! total ocean surface area
383
384      IF( ln_bdy ) CALL ctl_warn( 'dia_hsb_init: heat/salt budget does not consider open boundary fluxes' )         
385      !
386      ! ---------------------------------- !
387      ! 4 - initial conservation variables !
388      ! ---------------------------------- !
389      CALL dia_hsb_rst( nit000, 'READ' )  !* read or initialize all required files
390      !
391   END SUBROUTINE dia_hsb_init
392
393   !!======================================================================
394END MODULE diahsb
Note: See TracBrowser for help on using the repository browser.