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

source: branches/2015/dev_MetOffice_merge_2015/NEMOGCM/NEMO/OPA_SRC/DIA/diahsb.F90 @ 6012

Last change on this file since 6012 was 6012, checked in by mathiot, 8 years ago

merge MetO branch with dev_r5151_UKMO_ISF

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