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