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

source: branches/2015/dev_r5151_UKMO_ISF/NEMOGCM/NEMO/OPA_SRC/DIA/diahsb.F90 @ 5624

Last change on this file since 5624 was 5624, checked in by mathiot, 9 years ago

UKMO_ISF : fix conservation issue based on the work of Jerome on runoff, simplification of trasbc (isf part only) and remove option to apply isf melting as volume flux or not

  • Property svn:keywords set to Id
File size: 19.9 KB
RevLine 
[2148]1MODULE diahsb
2   !!======================================================================
3   !!                       ***  MODULE  diahsb  ***
[2334]4   !! Ocean diagnostics: Heat, salt and volume budgets
[2148]5   !!======================================================================
[2334]6   !! History :  3.3  ! 2010-09  (M. Leclair)  Original code
[4161]7   !!                 ! 2012-10  (C. Rousset)  add iom_put
[2148]8   !!----------------------------------------------------------------------
[2334]9
10   !!----------------------------------------------------------------------
[4990]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   !!----------------------------------------------------------------------
[2148]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
[4990]19   USE sbcrnf          ! river runoff
20   USE sbcisf          ! ice shelves
[2148]21   USE domvvl          ! vertical scale factors
22   USE traqsr          ! penetrative solar radiation
[2337]23   USE trabbc          ! bottom boundary condition
[2148]24   USE trabbc          ! bottom boundary condition
25   USE bdy_par         ! (for lk_bdy)
[4990]26   USE restart         ! ocean restart
27   !
[4161]28   USE iom             ! I/O manager
[4990]29   USE in_out_manager  ! I/O manager
[4161]30   USE lib_fortran     ! glob_sum
[4990]31   USE lib_mpp         ! distributed memory computing library
32   USE timing          ! preformance summary
33   USE wrk_nemo        ! work arrays
[2148]34
35   IMPLICIT NONE
36   PRIVATE
37
[2334]38   PUBLIC   dia_hsb        ! routine called by step.F90
[4161]39   PUBLIC   dia_hsb_init   ! routine called by nemogcm.F90
40   PUBLIC   dia_hsb_rst    ! routine called by step.F90
[2148]41
[4147]42   LOGICAL, PUBLIC ::   ln_diahsb   !: check the heat and salt budgets
[2148]43
[4990]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  !
[2148]51
52   !! * Substitutions
53#  include "domzgr_substitute.h90"
54#  include "vectopt_loop_substitute.h90"
55   !!----------------------------------------------------------------------
[2287]56   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
[2281]57   !! $Id$
[2334]58   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
[2148]59   !!----------------------------------------------------------------------
60CONTAINS
61
62   SUBROUTINE dia_hsb( kt )
63      !!---------------------------------------------------------------------------
64      !!                  ***  ROUTINE dia_hsb  ***
65      !!     
[2334]66      !! ** Purpose: Compute the ocean global heat content, salt content and volume conservation
[2148]67      !!
68      !! ** Method : - Compute the deviation of heat content, salt content and volume
[2334]69      !!             at the current time step from their values at nit000
70      !!             - Compute the contribution of forcing and remove it from these deviations
71      !!
[2148]72      !!---------------------------------------------------------------------------
73      INTEGER, INTENT(in) ::   kt   ! ocean time-step index
[4990]74      !
75      INTEGER    ::   ji, jj, jk                  ! dummy loop indice
76      REAL(wp)   ::   zdiff_hc    , zdiff_sc      ! heat and salt content variations
77      REAL(wp)   ::   zdiff_hc1   , zdiff_sc1     !  -         -     -        -
78      REAL(wp)   ::   zdiff_v1    , zdiff_v2      ! volume variation
79      REAL(wp)   ::   zerr_hc1    , zerr_sc1      ! heat and salt content misfit
80      REAL(wp)   ::   zvol_tot                    ! volume
81      REAL(wp)   ::   z_frc_trd_t , z_frc_trd_s   !    -     -
82      REAL(wp)   ::   z_frc_trd_v                 !    -     -
83      REAL(wp)   ::   z_wn_trd_t , z_wn_trd_s     !    -     -
84      REAL(wp)   ::   z_ssh_hc , z_ssh_sc         !    -     -
85      REAL(wp), DIMENSION(:,:), POINTER ::   z2d0, z2d1
[2148]86      !!---------------------------------------------------------------------------
[4161]87      IF( nn_timing == 1 )   CALL timing_start('dia_hsb')     
[4990]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(:,:,:) ;
[2148]92      ! ------------------------- !
93      ! 1 - Trends due to forcing !
94      ! ------------------------- !
[5624]95      z_frc_trd_v = r1_rau0 * glob_sum( - ( emp(:,:) - rnf(:,:) + fwfisf(:,:) ) * surf(:,:) ) ! volume fluxes
[4990]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
[5120]98      ! Add runoff    heat & salt input
[4558]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(:,:) )
[5120]101      ! Add ice shelf heat & salt input
[5624]102      IF( ln_isf    ) z_frc_trd_t = z_frc_trd_t + glob_sum( risf_tsc(:,:,jp_tem) * surf(:,:) )
[4162]103
[2148]104      ! Add penetrative solar radiation
[4558]105      IF( ln_traqsr )   z_frc_trd_t = z_frc_trd_t + r1_rau0_rcp * glob_sum( qsr     (:,:) * surf(:,:) )
[2148]106      ! Add geothermal heat flux
[4558]107      IF( ln_trabbc )   z_frc_trd_t = z_frc_trd_t +               glob_sum( qgh_trd0(:,:) * surf(:,:) )
[4161]108      !
[4558]109      IF( .NOT. lk_vvl ) THEN
[5120]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
[4990]116            ENDDO
[5120]117         ELSE
118            z2d0(:,:) = surf(:,:) * wn(:,:,1) * tsb(:,:,1,jp_tem)
119            z2d1(:,:) = surf(:,:) * wn(:,:,1) * tsb(:,:,1,jp_sal)
120         END IF
[4990]121         z_wn_trd_t = - glob_sum( z2d0 ) 
122         z_wn_trd_s = - glob_sum( z2d1 )
[4558]123      ENDIF
124
[2148]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
[4558]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
[2148]133
[4161]134      ! ------------------------ !
[4558]135      ! 2 -  Content variations !
[4161]136      ! ------------------------ !
[4990]137      zdiff_v2 = 0._wp
138      zdiff_hc = 0._wp
139      zdiff_sc = 0._wp
[4558]140
[2148]141      ! volume variation (calculated with ssh)
[4558]142      zdiff_v1 = glob_sum( surf(:,:) * ( sshn(:,:) - ssh_ini(:,:) ) )
143
144      ! heat & salt content variation (associated with ssh)
145      IF( .NOT. lk_vvl ) THEN
[5120]146         IF ( ln_isfcav ) THEN
147            DO ji = 1, jpi
148               DO jj = 1, jpj
149                  z2d0(ji,jj) = surf(ji,jj) * ( tsn(ji,jj,mikt(ji,jj),jp_tem) * sshn(ji,jj) - ssh_hc_loc_ini(ji,jj) ) 
150                  z2d1(ji,jj) = surf(ji,jj) * ( tsn(ji,jj,mikt(ji,jj),jp_sal) * sshn(ji,jj) - ssh_sc_loc_ini(ji,jj) ) 
151               END DO
[4990]152            END DO
[5120]153         ELSE
154            z2d0(:,:) = surf(:,:) * ( tsn(:,:,1,jp_tem) * sshn(:,:) - ssh_hc_loc_ini(:,:) ) 
155            z2d1(:,:) = surf(:,:) * ( tsn(:,:,1,jp_sal) * sshn(:,:) - ssh_sc_loc_ini(:,:) ) 
156         END IF
[4990]157         z_ssh_hc = glob_sum( z2d0 ) 
158         z_ssh_sc = glob_sum( z2d1 ) 
[4558]159      ENDIF
160
[2148]161      DO jk = 1, jpkm1
[4161]162         ! volume variation (calculated with scale factors)
[4558]163         zdiff_v2 = zdiff_v2 + glob_sum( surf(:,:) * tmask(:,:,jk) &
164            &                           * ( fse3t_n(:,:,jk) - e3t_ini(:,:,jk) ) )
[2148]165         ! heat content variation
[4558]166         zdiff_hc = zdiff_hc + glob_sum(  surf(:,:) * tmask(:,:,jk) & 
167            &                           * ( fse3t_n(:,:,jk) * tsn(:,:,jk,jp_tem) - hc_loc_ini(:,:,jk) ) )
[2148]168         ! salt content variation
[4558]169         zdiff_sc = zdiff_sc + glob_sum(  surf(:,:) * tmask(:,:,jk)   &
170            &                           * ( fse3t_n(:,:,jk) * tsn(:,:,jk,jp_sal) - sc_loc_ini(:,:,jk) ) )
[2148]171      ENDDO
172
173      ! Substract forcing from heat content, salt content and volume variations
[4558]174      zdiff_v1 = zdiff_v1 - frc_v
175      IF( lk_vvl )   zdiff_v2 = zdiff_v2 - frc_v
176      zdiff_hc = zdiff_hc - frc_t
177      zdiff_sc = zdiff_sc - frc_s
[4162]178      IF( .NOT. lk_vvl ) THEN
[4558]179         zdiff_hc1 = zdiff_hc + z_ssh_hc 
180         zdiff_sc1 = zdiff_sc + z_ssh_sc
181         zerr_hc1  = z_ssh_hc - frc_wn_t
182         zerr_sc1  = z_ssh_sc - frc_wn_s
[4162]183      ENDIF
[4558]184
[2148]185      ! ----------------------- !
[4558]186      ! 3 - Diagnostics writing !
[4161]187      ! ----------------------- !
[4990]188      zvol_tot = 0._wp                    ! total ocean volume (calculated with scale factors)
[4161]189      DO jk = 1, jpkm1
[4558]190         zvol_tot  = zvol_tot + glob_sum( surf(:,:) * tmask(:,:,jk) * fse3t_n(:,:,jk) )
191      END DO
192
[4990]193!!gm to be added ?
194!      IF( .NOT. lk_vvl ) THEN            ! fixed volume, add the ssh contribution
195!        zvol_tot = zvol_tot + glob_sum( surf(:,:) * sshn(:,:) )
196!      ENDIF
197!!gm end
198
[4558]199      IF( lk_vvl ) THEN
200        CALL iom_put( 'bgtemper' , zdiff_hc / zvol_tot )              ! Temperature variation (C)
201        CALL iom_put( 'bgsaline' , zdiff_sc / zvol_tot )              ! Salinity    variation (psu)
202        CALL iom_put( 'bgheatco' , zdiff_hc * 1.e-20 * rau0 * rcp )   ! Heat content variation (1.e20 J)
203        CALL iom_put( 'bgsaltco' , zdiff_sc * 1.e-9    )              ! Salt content variation (psu*km3)
204        CALL iom_put( 'bgvolssh' , zdiff_v1 * 1.e-9    )              ! volume ssh variation (km3) 
205        CALL iom_put( 'bgvole3t' , zdiff_v2 * 1.e-9    )              ! volume e3t variation (km3) 
206        CALL iom_put( 'bgfrcvol' , frc_v    * 1.e-9    )              ! vol - surface forcing (km3)
207        CALL iom_put( 'bgfrctem' , frc_t / zvol_tot    )              ! hc  - surface forcing (C)
208        CALL iom_put( 'bgfrcsal' , frc_s / zvol_tot    )              ! sc  - surface forcing (psu)
209      ELSE
210        CALL iom_put( 'bgtemper' , zdiff_hc1 / zvol_tot)              ! Heat content variation (C)
211        CALL iom_put( 'bgsaline' , zdiff_sc1 / zvol_tot)              ! Salt content variation (psu)
212        CALL iom_put( 'bgheatco' , zdiff_hc1 * 1.e-20 * rau0 * rcp )  ! Heat content variation (1.e20 J)
213        CALL iom_put( 'bgsaltco' , zdiff_sc1 * 1.e-9    )             ! Salt content variation (psu*km3)
214        CALL iom_put( 'bgvolssh' , zdiff_v1 * 1.e-9    )              ! volume ssh variation (km3) 
215        CALL iom_put( 'bgfrcvol' , frc_v    * 1.e-9    )              ! vol - surface forcing (km3)
216        CALL iom_put( 'bgfrctem' , frc_t / zvol_tot    )              ! hc  - surface forcing (C)
217        CALL iom_put( 'bgfrcsal' , frc_s / zvol_tot    )              ! sc  - surface forcing (psu)
218        CALL iom_put( 'bgmistem' , zerr_hc1 / zvol_tot )              ! hc  - error due to free surface (C)
219        CALL iom_put( 'bgmissal' , zerr_sc1 / zvol_tot )              ! sc  - error due to free surface (psu)
[4162]220      ENDIF
[4558]221      !
222      IF( lrst_oce )   CALL dia_hsb_rst( kt, 'WRITE' )
[4161]223
[4990]224      CALL wrk_dealloc( jpi,jpj,   z2d0, z2d1 )
225
[3294]226      IF( nn_timing == 1 )   CALL timing_stop('dia_hsb')
[4990]227      !
[2148]228   END SUBROUTINE dia_hsb
229
[2334]230
[4161]231   SUBROUTINE dia_hsb_rst( kt, cdrw )
232     !!---------------------------------------------------------------------
233     !!                   ***  ROUTINE limdia_rst  ***
234     !!                     
235     !! ** Purpose :   Read or write DIA file in restart file
236     !!
237     !! ** Method  :   use of IOM library
238     !!----------------------------------------------------------------------
239     INTEGER         , INTENT(in) ::   kt     ! ocean time-step
240     CHARACTER(len=*), INTENT(in) ::   cdrw   ! "READ"/"WRITE" flag
241     !
[4990]242     INTEGER ::   ji, jj, jk   ! dummy loop indices
243     INTEGER ::   id1          ! local integers
[4161]244     !!----------------------------------------------------------------------
245     !
246     IF( TRIM(cdrw) == 'READ' ) THEN        ! Read/initialise
247        IF( ln_rstart ) THEN                   !* Read the restart file
248           !id1 = iom_varid( numror, 'frc_vol'  , ldstop = .FALSE. )
249           !
[4558]250           IF(lwp) WRITE(numout,*) '~~~~~~~'
251           IF(lwp) WRITE(numout,*) ' dia_hsb_rst at it= ', kt,' date= ', ndastp
252           IF(lwp) WRITE(numout,*) '~~~~~~~'
[4161]253           CALL iom_get( numror, 'frc_v', frc_v )
254           CALL iom_get( numror, 'frc_t', frc_t )
255           CALL iom_get( numror, 'frc_s', frc_s )
[4558]256           IF( .NOT. lk_vvl ) THEN
257              CALL iom_get( numror, 'frc_wn_t', frc_wn_t )
258              CALL iom_get( numror, 'frc_wn_s', frc_wn_s )
259           ENDIF
[4161]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 )
[4558]264           IF( .NOT. lk_vvl ) 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
[4161]268       ELSE
[4558]269          IF(lwp) WRITE(numout,*) '~~~~~~~'
270          IF(lwp) WRITE(numout,*) ' dia_hsb at initial state '
271          IF(lwp) WRITE(numout,*) '~~~~~~~'
[4161]272          ssh_ini(:,:) = sshn(:,:)                                       ! initial ssh
273          DO jk = 1, jpk
274             e3t_ini   (:,:,jk) = fse3t_n(:,:,jk)                        ! initial vertical scale factors
275             hc_loc_ini(:,:,jk) = tsn(:,:,jk,jp_tem) * fse3t_n(:,:,jk)   ! initial heat content
276             sc_loc_ini(:,:,jk) = tsn(:,:,jk,jp_sal) * fse3t_n(:,:,jk)   ! initial salt content
277          END DO
[4990]278          frc_v = 0._wp                                           ! volume       trend due to forcing
279          frc_t = 0._wp                                           ! heat content   -    -   -    -   
280          frc_s = 0._wp                                           ! salt content   -    -   -    -       
[4558]281          IF( .NOT. lk_vvl ) THEN
[5120]282             IF ( ln_isfcav ) THEN
283                DO ji=1,jpi
284                   DO jj=1,jpj
285                      ssh_hc_loc_ini(ji,jj) = tsn(ji,jj,mikt(ji,jj),jp_tem) * sshn(ji,jj)   ! initial heat content in ssh
286                      ssh_sc_loc_ini(ji,jj) = tsn(ji,jj,mikt(ji,jj),jp_sal) * sshn(ji,jj)   ! initial salt content in ssh
287                   ENDDO
[4990]288                ENDDO
[5120]289             ELSE
290                ssh_hc_loc_ini(:,:) = tsn(:,:,1,jp_tem) * sshn(:,:)   ! initial heat content in ssh
291                ssh_sc_loc_ini(:,:) = tsn(:,:,1,jp_sal) * sshn(:,:)   ! initial salt content in ssh
292             END IF
[4990]293             frc_wn_t = 0._wp                                       ! initial heat content misfit due to free surface
294             frc_wn_s = 0._wp                                       ! initial salt content misfit due to free surface
[4558]295          ENDIF
[4161]296       ENDIF
[2148]297
[4161]298     ELSEIF( TRIM(cdrw) == 'WRITE' ) THEN   ! Create restart file
299        !                                   ! -------------------
[4558]300        IF(lwp) WRITE(numout,*) '~~~~~~~'
301        IF(lwp) WRITE(numout,*) ' dia_hsb_rst at it= ', kt,' date= ', ndastp
302        IF(lwp) WRITE(numout,*) '~~~~~~~'
303
[4161]304        CALL iom_rstput( kt, nitrst, numrow, 'frc_v'   , frc_v     )
305        CALL iom_rstput( kt, nitrst, numrow, 'frc_t'   , frc_t     )
306        CALL iom_rstput( kt, nitrst, numrow, 'frc_s'   , frc_s     )
[4558]307        IF( .NOT. lk_vvl ) THEN
308           CALL iom_rstput( kt, nitrst, numrow, 'frc_wn_t', frc_wn_t )
309           CALL iom_rstput( kt, nitrst, numrow, 'frc_wn_s', frc_wn_s )
310        ENDIF
[4161]311        CALL iom_rstput( kt, nitrst, numrow, 'ssh_ini', ssh_ini )
312        CALL iom_rstput( kt, nitrst, numrow, 'e3t_ini', e3t_ini )
313        CALL iom_rstput( kt, nitrst, numrow, 'hc_loc_ini', hc_loc_ini )
314        CALL iom_rstput( kt, nitrst, numrow, 'sc_loc_ini', sc_loc_ini )
[4558]315        IF( .NOT. lk_vvl ) THEN
316           CALL iom_rstput( kt, nitrst, numrow, 'ssh_hc_loc_ini', ssh_hc_loc_ini )
317           CALL iom_rstput( kt, nitrst, numrow, 'ssh_sc_loc_ini', ssh_sc_loc_ini )
318        ENDIF
[4161]319        !
320     ENDIF
321     !
322   END SUBROUTINE dia_hsb_rst
[2148]323
[4990]324
325   SUBROUTINE dia_hsb_init
326      !!---------------------------------------------------------------------------
327      !!                  ***  ROUTINE dia_hsb  ***
328      !!     
329      !! ** Purpose: Initialization for the heat salt volume budgets
330      !!
331      !! ** Method : Compute initial heat content, salt content and volume
332      !!
333      !! ** Action : - Compute initial heat content, salt content and volume
334      !!             - Initialize forcing trends
335      !!             - Compute coefficients for conversion
336      !!---------------------------------------------------------------------------
337      INTEGER ::   jk       ! dummy loop indice
338      INTEGER ::   ierror   ! local integer
339      INTEGER ::   ios
340      !
341      NAMELIST/namhsb/ ln_diahsb
342      !!----------------------------------------------------------------------
343
344      IF(lwp) THEN
345         WRITE(numout,*)
346         WRITE(numout,*) 'dia_hsb_init : check the heat and salt budgets'
347         WRITE(numout,*) '~~~~~~~~ '
348      ENDIF
349
350      REWIND( numnam_ref )              ! Namelist namhsb in reference namelist
351      READ  ( numnam_ref, namhsb, IOSTAT = ios, ERR = 901)
352901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namhsb in reference namelist', lwp )
353
354      REWIND( numnam_cfg )              ! Namelist namhsb in configuration namelist
355      READ  ( numnam_cfg, namhsb, IOSTAT = ios, ERR = 902 )
356902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namhsb in configuration namelist', lwp )
357      IF(lwm) WRITE ( numond, namhsb )
358
359      !
360      IF(lwp) THEN                   ! Control print
361         WRITE(numout,*)
362         WRITE(numout,*) 'dia_hsb_init : check the heat and salt budgets'
363         WRITE(numout,*) '~~~~~~~~~~~~'
364         WRITE(numout,*) '   Namelist namhsb : set hsb parameters'
365         WRITE(numout,*) '      Switch for hsb diagnostic (T) or not (F)  ln_diahsb  = ', ln_diahsb
366         WRITE(numout,*)
367      ENDIF
368
369      IF( .NOT. ln_diahsb )   RETURN
370         !      IF( .NOT. lk_mpp_rep ) &
371         !        CALL ctl_stop (' Your global mpp_sum if performed in single precision - 64 bits -', &
372         !             &         ' whereas the global sum to be precise must be done in double precision ',&
373         !             &         ' please add key_mpp_rep')
374
375      ! ------------------- !
376      ! 1 - Allocate memory !
377      ! ------------------- !
378      ALLOCATE( hc_loc_ini(jpi,jpj,jpk), sc_loc_ini(jpi,jpj,jpk), &
379         &      e3t_ini(jpi,jpj,jpk), surf(jpi,jpj),  ssh_ini(jpi,jpj), STAT=ierror )
380      IF( ierror > 0 ) THEN
381         CALL ctl_stop( 'dia_hsb: unable to allocate hc_loc_ini' )   ;   RETURN
382      ENDIF
383
384      IF(.NOT. lk_vvl ) 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' )   ;   RETURN
387      ENDIF
388
389      ! ----------------------------------------------- !
390      ! 2 - Time independant variables and file opening !
391      ! ----------------------------------------------- !
392      IF(lwp) WRITE(numout,*) "dia_hsb: heat salt volume budgets activated"
393      IF(lwp) WRITE(numout,*) '~~~~~~~'
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
[2148]406   !!======================================================================
407END MODULE diahsb
Note: See TracBrowser for help on using the repository browser.