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/2016/dev_v3_6_STABLE_r6506_AGRIF_LIM3/NEMOGCM/NEMO/OPA_SRC/DIA – NEMO

source: branches/2016/dev_v3_6_STABLE_r6506_AGRIF_LIM3/NEMOGCM/NEMO/OPA_SRC/DIA/diahsb.F90 @ 6970

Last change on this file since 6970 was 6970, checked in by clem, 8 years ago

update from 3.6 stable, ticket #1777

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