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/2015/dev_r5836_NOC3_vvl_by_default/NEMOGCM/NEMO/OPA_SRC/DIA – NEMO

source: branches/2015/dev_r5836_NOC3_vvl_by_default/NEMOGCM/NEMO/OPA_SRC/DIA/diahsb.F90 @ 5866

Last change on this file since 5866 was 5866, checked in by gm, 8 years ago

#1613: vvl by default: add ln_linssh and remove key_vvl

  • Property svn:keywords set to Id
File size: 19.9 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   PUBLIC   dia_hsb_rst    ! routine called by step.F90
41
42   LOGICAL, PUBLIC ::   ln_diahsb   !: check the heat and salt budgets
43
44   REAL(wp) ::   surf_tot              ! ocean surface
45   REAL(wp) ::   frc_t, frc_s, frc_v   ! global forcing trends
46   REAL(wp) ::   frc_wn_t, frc_wn_s    ! global forcing trends
47   !
48   REAL(wp), DIMENSION(:,:)  , ALLOCATABLE ::   surf          , ssh_ini          !
49   REAL(wp), DIMENSION(:,:)  , ALLOCATABLE ::   ssh_hc_loc_ini, ssh_sc_loc_ini   !
50   REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::   hc_loc_ini, sc_loc_ini, e3t_ini  !
51
52   !! * Substitutions
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      CALL wrk_alloc( jpi,jpj,   z2d0, z2d1 )
88      !
89      tsn(:,:,:,1) = tsn(:,:,:,1) * tmask(:,:,:) ; tsb(:,:,:,1) = tsb(:,:,:,1) * tmask(:,:,:) ;
90      tsn(:,:,:,2) = tsn(:,:,:,2) * tmask(:,:,:) ; tsb(:,:,:,2) = tsb(:,:,:,2) * tmask(:,:,:) ;
91      ! ------------------------- !
92      ! 1 - Trends due to forcing !
93      ! ------------------------- !
94      z_frc_trd_v = r1_rau0 * glob_sum( - ( emp(:,:) - rnf(:,:) + fwfisf(:,:) ) * surf(:,:) ) ! volume fluxes
95      z_frc_trd_t =           glob_sum( sbc_tsc(:,:,jp_tem) * surf(:,:) )                               ! heat fluxes
96      z_frc_trd_s =           glob_sum( sbc_tsc(:,:,jp_sal) * surf(:,:) )                               ! salt fluxes
97      ! Add runoff    heat & salt input
98      IF( ln_rnf    )   z_frc_trd_t = z_frc_trd_t + glob_sum( rnf_tsc(:,:,jp_tem) * surf(:,:) )
99      IF( ln_rnf_sal)   z_frc_trd_s = z_frc_trd_s + glob_sum( rnf_tsc(:,:,jp_sal) * surf(:,:) )
100      ! Add ice shelf heat & salt input
101      IF( nn_isf .GE. 1 )  THEN
102          z_frc_trd_t = z_frc_trd_t + glob_sum( risf_tsc(:,:,jp_tem) * surf(:,:) )
103          z_frc_trd_s = z_frc_trd_s + glob_sum( risf_tsc(:,:,jp_sal) * surf(:,:) )
104      ENDIF
105
106      ! Add penetrative solar radiation
107      IF( ln_traqsr )   z_frc_trd_t = z_frc_trd_t + r1_rau0_rcp * glob_sum( qsr     (:,:) * surf(:,:) )
108      ! Add geothermal heat flux
109      IF( ln_trabbc )   z_frc_trd_t = z_frc_trd_t +               glob_sum( qgh_trd0(:,:) * surf(:,:) )
110      !
111      IF( ln_linssh ) THEN
112         IF ( ln_isfcav ) THEN
113            DO ji=1,jpi
114               DO jj=1,jpj
115                  z2d0(ji,jj) = surf(ji,jj) * wn(ji,jj,mikt(ji,jj)) * tsb(ji,jj,mikt(ji,jj),jp_tem)
116                  z2d1(ji,jj) = surf(ji,jj) * wn(ji,jj,mikt(ji,jj)) * tsb(ji,jj,mikt(ji,jj),jp_sal)
117               ENDDO
118            ENDDO
119         ELSE
120            z2d0(:,:) = surf(:,:) * wn(:,:,1) * tsb(:,:,1,jp_tem)
121            z2d1(:,:) = surf(:,:) * wn(:,:,1) * tsb(:,:,1,jp_sal)
122         END IF
123         z_wn_trd_t = - glob_sum( z2d0 ) 
124         z_wn_trd_s = - glob_sum( z2d1 )
125      ENDIF
126
127      frc_v = frc_v + z_frc_trd_v * rdt
128      frc_t = frc_t + z_frc_trd_t * rdt
129      frc_s = frc_s + z_frc_trd_s * rdt
130      !                                          ! Advection flux through fixed surface (z=0)
131      IF( ln_linssh ) THEN
132         frc_wn_t = frc_wn_t + z_wn_trd_t * rdt
133         frc_wn_s = frc_wn_s + z_wn_trd_s * rdt
134      ENDIF
135
136      ! ------------------------ !
137      ! 2 -  Content variations !
138      ! ------------------------ !
139      zdiff_v2 = 0._wp
140      zdiff_hc = 0._wp
141      zdiff_sc = 0._wp
142
143      ! volume variation (calculated with ssh)
144      zdiff_v1 = glob_sum( surf(:,:) * ( sshn(:,:) - ssh_ini(:,:) ) )
145
146      ! heat & salt content variation (associated with ssh)
147      IF( ln_linssh ) THEN
148         IF ( ln_isfcav ) THEN
149            DO ji = 1, jpi
150               DO jj = 1, jpj
151                  z2d0(ji,jj) = surf(ji,jj) * ( tsn(ji,jj,mikt(ji,jj),jp_tem) * sshn(ji,jj) - ssh_hc_loc_ini(ji,jj) ) 
152                  z2d1(ji,jj) = surf(ji,jj) * ( tsn(ji,jj,mikt(ji,jj),jp_sal) * sshn(ji,jj) - ssh_sc_loc_ini(ji,jj) ) 
153               END DO
154            END DO
155         ELSE
156            z2d0(:,:) = surf(:,:) * ( tsn(:,:,1,jp_tem) * sshn(:,:) - ssh_hc_loc_ini(:,:) ) 
157            z2d1(:,:) = surf(:,:) * ( tsn(:,:,1,jp_sal) * sshn(:,:) - ssh_sc_loc_ini(:,:) ) 
158         END IF
159         z_ssh_hc = glob_sum( z2d0 ) 
160         z_ssh_sc = glob_sum( z2d1 ) 
161      ENDIF
162
163      DO jk = 1, jpkm1
164         ! volume variation (calculated with scale factors)
165         zdiff_v2 = zdiff_v2 + glob_sum( surf(:,:) * tmask(:,:,jk) &
166            &                           * ( e3t_n(:,:,jk) - e3t_ini(:,:,jk) ) )
167         ! heat content variation
168         zdiff_hc = zdiff_hc + glob_sum(  surf(:,:) * tmask(:,:,jk) & 
169            &                           * ( e3t_n(:,:,jk) * tsn(:,:,jk,jp_tem) - hc_loc_ini(:,:,jk) ) )
170         ! salt content variation
171         zdiff_sc = zdiff_sc + glob_sum(  surf(:,:) * tmask(:,:,jk)   &
172            &                           * ( e3t_n(:,:,jk) * tsn(:,:,jk,jp_sal) - sc_loc_ini(:,:,jk) ) )
173      ENDDO
174
175      ! Substract forcing from heat content, salt content and volume variations
176      zdiff_v1 = zdiff_v1 - frc_v
177      IF( .NOT.ln_linssh )   zdiff_v2 = zdiff_v2 - frc_v
178      zdiff_hc = zdiff_hc - frc_t
179      zdiff_sc = zdiff_sc - frc_s
180      IF( ln_linssh ) THEN
181         zdiff_hc1 = zdiff_hc + z_ssh_hc 
182         zdiff_sc1 = zdiff_sc + z_ssh_sc
183         zerr_hc1  = z_ssh_hc - frc_wn_t
184         zerr_sc1  = z_ssh_sc - frc_wn_s
185      ENDIF
186
187      ! ----------------------- !
188      ! 3 - Diagnostics writing !
189      ! ----------------------- !
190      zvol_tot = 0._wp                    ! total ocean volume (calculated with scale factors)
191      DO jk = 1, jpkm1
192         zvol_tot  = zvol_tot + glob_sum( surf(:,:) * tmask(:,:,jk) * e3t_n(:,:,jk) )
193      END DO
194
195!!gm to be added ?
196!      IF( ln_linssh ) THEN            ! fixed volume, add the ssh contribution
197!        zvol_tot = zvol_tot + glob_sum( surf(:,:) * sshn(:,:) )
198!      ENDIF
199!!gm end
200
201      IF( .NOT.ln_linssh ) THEN
202        CALL iom_put( 'bgtemper' , zdiff_hc / zvol_tot )              ! Temperature variation (C)
203        CALL iom_put( 'bgsaline' , zdiff_sc / zvol_tot )              ! Salinity    variation (psu)
204        CALL iom_put( 'bgheatco' , zdiff_hc * 1.e-20 * rau0 * rcp )   ! Heat content variation (1.e20 J)
205        CALL iom_put( 'bgsaltco' , zdiff_sc * 1.e-9    )              ! Salt content variation (psu*km3)
206        CALL iom_put( 'bgvolssh' , zdiff_v1 * 1.e-9    )              ! volume ssh variation (km3) 
207        CALL iom_put( 'bgvole3t' , zdiff_v2 * 1.e-9    )              ! volume e3t variation (km3) 
208        CALL iom_put( 'bgfrcvol' , frc_v    * 1.e-9    )              ! vol - surface forcing (km3)
209        CALL iom_put( 'bgfrctem' , frc_t / zvol_tot    )              ! hc  - surface forcing (C)
210        CALL iom_put( 'bgfrcsal' , frc_s / zvol_tot    )              ! sc  - surface forcing (psu)
211      ELSE
212        CALL iom_put( 'bgtemper' , zdiff_hc1 / zvol_tot)              ! Heat content variation (C)
213        CALL iom_put( 'bgsaline' , zdiff_sc1 / zvol_tot)              ! Salt content variation (psu)
214        CALL iom_put( 'bgheatco' , zdiff_hc1 * 1.e-20 * rau0 * rcp )  ! Heat content variation (1.e20 J)
215        CALL iom_put( 'bgsaltco' , zdiff_sc1 * 1.e-9    )             ! Salt content variation (psu*km3)
216        CALL iom_put( 'bgvolssh' , zdiff_v1 * 1.e-9    )              ! volume ssh variation (km3) 
217        CALL iom_put( 'bgfrcvol' , frc_v    * 1.e-9    )              ! vol - surface forcing (km3)
218        CALL iom_put( 'bgfrctem' , frc_t / zvol_tot    )              ! hc  - surface forcing (C)
219        CALL iom_put( 'bgfrcsal' , frc_s / zvol_tot    )              ! sc  - surface forcing (psu)
220        CALL iom_put( 'bgmistem' , zerr_hc1 / zvol_tot )              ! hc  - error due to free surface (C)
221        CALL iom_put( 'bgmissal' , zerr_sc1 / zvol_tot )              ! sc  - error due to free surface (psu)
222      ENDIF
223      !
224      IF( lrst_oce )   CALL dia_hsb_rst( kt, 'WRITE' )
225
226      CALL wrk_dealloc( jpi,jpj,   z2d0, z2d1 )
227
228      IF( nn_timing == 1 )   CALL timing_stop('dia_hsb')
229      !
230   END SUBROUTINE dia_hsb
231
232
233   SUBROUTINE dia_hsb_rst( kt, cdrw )
234     !!---------------------------------------------------------------------
235     !!                   ***  ROUTINE limdia_rst  ***
236     !!                     
237     !! ** Purpose :   Read or write DIA file in restart file
238     !!
239     !! ** Method  :   use of IOM library
240     !!----------------------------------------------------------------------
241     INTEGER         , INTENT(in) ::   kt     ! ocean time-step
242     CHARACTER(len=*), INTENT(in) ::   cdrw   ! "READ"/"WRITE" flag
243     !
244     INTEGER ::   ji, jj, jk   ! dummy loop indices
245     INTEGER ::   id1          ! local integers
246     !!----------------------------------------------------------------------
247     !
248     IF( TRIM(cdrw) == 'READ' ) THEN        ! Read/initialise
249        IF( ln_rstart ) THEN                   !* Read the restart file
250           !id1 = iom_varid( numror, 'frc_vol'  , ldstop = .FALSE. )
251           !
252           IF(lwp) WRITE(numout,*) '~~~~~~~'
253           IF(lwp) WRITE(numout,*) ' dia_hsb_rst at it= ', kt,' date= ', ndastp
254           IF(lwp) WRITE(numout,*) '~~~~~~~'
255           CALL iom_get( numror, 'frc_v', frc_v )
256           CALL iom_get( numror, 'frc_t', frc_t )
257           CALL iom_get( numror, 'frc_s', frc_s )
258           IF( ln_linssh ) THEN
259              CALL iom_get( numror, 'frc_wn_t', frc_wn_t )
260              CALL iom_get( numror, 'frc_wn_s', frc_wn_s )
261           ENDIF
262           CALL iom_get( numror, jpdom_autoglo, 'ssh_ini', ssh_ini )
263           CALL iom_get( numror, jpdom_autoglo, 'e3t_ini', e3t_ini )
264           CALL iom_get( numror, jpdom_autoglo, 'hc_loc_ini', hc_loc_ini )
265           CALL iom_get( numror, jpdom_autoglo, 'sc_loc_ini', sc_loc_ini )
266           IF( ln_linssh ) THEN
267              CALL iom_get( numror, jpdom_autoglo, 'ssh_hc_loc_ini', ssh_hc_loc_ini )
268              CALL iom_get( numror, jpdom_autoglo, 'ssh_sc_loc_ini', ssh_sc_loc_ini )
269           ENDIF
270       ELSE
271          IF(lwp) WRITE(numout,*) '~~~~~~~'
272          IF(lwp) WRITE(numout,*) ' dia_hsb at initial state '
273          IF(lwp) WRITE(numout,*) '~~~~~~~'
274          ssh_ini(:,:) = sshn(:,:)                                       ! initial ssh
275          DO jk = 1, jpk
276             e3t_ini   (:,:,jk) = e3t_n(:,:,jk)                        ! initial vertical scale factors
277             hc_loc_ini(:,:,jk) = tsn(:,:,jk,jp_tem) * e3t_n(:,:,jk)   ! initial heat content
278             sc_loc_ini(:,:,jk) = tsn(:,:,jk,jp_sal) * e3t_n(:,:,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, 'ssh_ini', ssh_ini )
314        CALL iom_rstput( kt, nitrst, numrow, 'e3t_ini', e3t_ini )
315        CALL iom_rstput( kt, nitrst, numrow, 'hc_loc_ini', hc_loc_ini )
316        CALL iom_rstput( kt, nitrst, numrow, 'sc_loc_ini', sc_loc_ini )
317        IF( ln_linssh ) THEN
318           CALL iom_rstput( kt, nitrst, numrow, 'ssh_hc_loc_ini', ssh_hc_loc_ini )
319           CALL iom_rstput( kt, nitrst, numrow, 'ssh_sc_loc_ini', ssh_sc_loc_ini )
320        ENDIF
321        !
322     ENDIF
323     !
324   END SUBROUTINE dia_hsb_rst
325
326
327   SUBROUTINE dia_hsb_init
328      !!---------------------------------------------------------------------------
329      !!                  ***  ROUTINE dia_hsb  ***
330      !!     
331      !! ** Purpose: Initialization for the heat salt volume budgets
332      !!
333      !! ** Method : Compute initial heat content, salt content and volume
334      !!
335      !! ** Action : - Compute initial heat content, salt content and volume
336      !!             - Initialize forcing trends
337      !!             - Compute coefficients for conversion
338      !!---------------------------------------------------------------------------
339      INTEGER ::   jk       ! dummy loop indice
340      INTEGER ::   ierror   ! local integer
341      INTEGER ::   ios
342      !
343      NAMELIST/namhsb/ ln_diahsb
344      !!----------------------------------------------------------------------
345
346      IF(lwp) THEN
347         WRITE(numout,*)
348         WRITE(numout,*) 'dia_hsb_init : check the heat and salt budgets'
349         WRITE(numout,*) '~~~~~~~~ '
350      ENDIF
351
352      REWIND( numnam_ref )              ! Namelist namhsb in reference namelist
353      READ  ( numnam_ref, namhsb, IOSTAT = ios, ERR = 901)
354901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namhsb in reference namelist', lwp )
355
356      REWIND( numnam_cfg )              ! Namelist namhsb in configuration namelist
357      READ  ( numnam_cfg, namhsb, IOSTAT = ios, ERR = 902 )
358902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namhsb in configuration namelist', lwp )
359      IF(lwm) WRITE ( numond, namhsb )
360
361      !
362      IF(lwp) THEN                   ! Control print
363         WRITE(numout,*)
364         WRITE(numout,*) 'dia_hsb_init : check the heat and salt budgets'
365         WRITE(numout,*) '~~~~~~~~~~~~'
366         WRITE(numout,*) '   Namelist namhsb : set hsb parameters'
367         WRITE(numout,*) '      Switch for hsb diagnostic (T) or not (F)  ln_diahsb  = ', ln_diahsb
368         WRITE(numout,*)
369      ENDIF
370
371      IF( .NOT. ln_diahsb )   RETURN
372         !      IF( .NOT. lk_mpp_rep ) &
373         !        CALL ctl_stop (' Your global mpp_sum if performed in single precision - 64 bits -', &
374         !             &         ' whereas the global sum to be precise must be done in double precision ',&
375         !             &         ' please add key_mpp_rep')
376
377      ! ------------------- !
378      ! 1 - Allocate memory !
379      ! ------------------- !
380      ALLOCATE( hc_loc_ini(jpi,jpj,jpk), sc_loc_ini(jpi,jpj,jpk), &
381         &      e3t_ini(jpi,jpj,jpk), surf(jpi,jpj),  ssh_ini(jpi,jpj), STAT=ierror )
382      IF( ierror > 0 ) THEN
383         CALL ctl_stop( 'dia_hsb: unable to allocate hc_loc_ini' )   ;   RETURN
384      ENDIF
385
386      IF( ln_linssh )   ALLOCATE( ssh_hc_loc_ini(jpi,jpj), ssh_sc_loc_ini(jpi,jpj),STAT=ierror )
387      IF( ierror > 0 ) THEN
388         CALL ctl_stop( 'dia_hsb: unable to allocate hc_loc_ini' )   ;   RETURN
389      ENDIF
390
391      ! ----------------------------------------------- !
392      ! 2 - Time independant variables and file opening !
393      ! ----------------------------------------------- !
394      IF(lwp) WRITE(numout,*) "dia_hsb: heat salt volume budgets activated"
395      IF(lwp) WRITE(numout,*) '~~~~~~~'
396      surf(:,:) = e1t(:,:) * e2t(:,:) * tmask_i(:,:)      ! masked surface grid cell area
397      surf_tot  = glob_sum( surf(:,:) )                                       ! total ocean surface area
398
399      IF( lk_bdy ) CALL ctl_warn( 'dia_hsb does not take open boundary fluxes into account' )         
400      !
401      ! ---------------------------------- !
402      ! 4 - initial conservation variables !
403      ! ---------------------------------- !
404      CALL dia_hsb_rst( nit000, 'READ' )  !* read or initialize all required files
405      !
406   END SUBROUTINE dia_hsb_init
407
408   !!======================================================================
409END MODULE diahsb
Note: See TracBrowser for help on using the repository browser.