SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
modi_glt_updbud_r.F90
Go to the documentation of this file.
1 !SFX_LIC Copyright 1994-2014 CNRS, Meteo-France and Universite Paul Sabatier
2 !SFX_LIC This is part of the SURFEX software governed by the CeCILL-C licence
3 !SFX_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
4 !SFX_LIC for details. version 1.
5 !GLT_LIC The GELATO model is a seaice model used in stand-alone or embedded mode.
6 !GLT_LIC It has been developed by Meteo-France. The holder of GELATO is Meteo-France.
7 !GLT_LIC
8 !GLT_LIC This software is governed by the CeCILL-C license under French law and biding
9 !GLT_LIC by the rules of distribution of free software. See the CeCILL-C_V1-en.txt
10 !GLT_LIC (English) and CeCILL-C_V1-fr.txt (French) for details. The CeCILL is a free
11 !GLT_LIC software license, explicitly compatible with the GNU GPL
12 !GLT_LIC (see http://www.gnu.org/licenses/license-list.en.html#CeCILL)
13 !GLT_LIC
14 !GLT_LIC The CeCILL-C licence agreement grants users the right to modify and re-use the
15 !GLT_LIC software governed by this free software license. The exercising of this right
16 !GLT_LIC is conditional upon the obligation to make available to the community the
17 !GLT_LIC modifications made to the source code of the software so as to contribute to
18 !GLT_LIC its evolution.
19 !GLT_LIC
20 !GLT_LIC In consideration of access to the source code and the rights to copy, modify
21 !GLT_LIC and redistribute granted by the license, users are provided only with a limited
22 !GLT_LIC warranty and the software's author, the holder of the economic rights, and the
23 !GLT_LIC successive licensors only have limited liability. In this respect, the risks
24 !GLT_LIC associated with loading, using, modifying and/or developing or reproducing the
25 !GLT_LIC software by the user are brought to the user's attention, given its Free
26 !GLT_LIC Software status, which may make it complicated to use, with the result that its
27 !GLT_LIC use is reserved for developers and experienced professionals having in-depth
28 !GLT_LIC computer knowledge. Users are therefore encouraged to load and test the
29 !GLT_LIC suitability of the software as regards their requirements in conditions enabling
30 !GLT_LIC the security of their systems and/or data to be ensured and, more generally, to
31 !GLT_LIC use and operate it in the same conditions of security.
32 !GLT_LIC
33 !GLT_LIC The GELATO sofware is cureently distibuted with the SURFEX software, available at
34 !GLT_LIC http://www.cnrm.meteo.fr/surfex. The fact that you download the software deemed that
35 !GLT_LIC you had knowledge of the CeCILL-C license and that you accept its terms.
36 !GLT_LIC Attempts to use this software in a way not complying with CeCILL-C license
37 !GLT_LIC may lead to prosecution.
38 !GLT_LIC
39 ! =======================================================================
40 ! ======================= MODULE modi_glt_updbud_r ======================
41 ! =======================================================================
42 !
43 ! Goal:
44 ! -----
45 ! This module contains a subroutine that manages the energy budget
46 ! variable on the thermodynamics, reduced grid:
47 ! - total sea ice gltools_enthalpy (reference temperature is the melting
48 ! temperature of snow and ice)
49 ! - total sea ice latent heat (i.e. the latent heat needed to
50 ! melt sea ice and snow covers on the whole ocean domain). Note
51 ! sea ice stored heat is included in that.
52 ! - total stored heat in sea ice.
53 ! - input and glt_output heat concerning leads and sea ice.
54 ! All these quantities are given in J. The energy budget is also
55 ! printed (total values on the whole mesh).
56 !
57 ! Created : 2009/06 (D. Salas y Melia)
58 ! Modified: 2009/12 (D. Salas y Melia) Enthalpy replaces temperature
59 ! as a state variable
60 ! Modified: 2010/01 (D. Salas y Melia) Introduce fresh water budget
61 ! Modified: 2010/03 (D. Salas y Melia) Introduce salinity budget
62 !
63 ! --------------------- BEGIN MODULE modi_glt_updbud_r ----------------------
64 !
65 !THXS_SFX!MODULE modi_glt_updbud_r
66 !THXS_SFX!INTERFACE
67 !THXS_SFX!!
68 !THXS_SFX!SUBROUTINE glt_updbud_r &
69 !THXS_SFX! ( kinit,omsg,tpdom,tpmxl,tptfl,tpatm,tpblkw,tpblki,tpsit,tpsil,tpbud )
70 !THXS_SFX! USE modd_types_glt
71 !THXS_SFX! USE modd_glt_param
72 !THXS_SFX! INTEGER, INTENT(in) :: &
73 !THXS_SFX! kinit
74 !THXS_SFX! CHARACTER(*), INTENT(in) :: &
75 !THXS_SFX! omsg
76 !THXS_SFX! TYPE(t_dom), DIMENSION(np), INTENT(in) :: &
77 !THXS_SFX! tpdom
78 !THXS_SFX! TYPE(t_mxl), DIMENSION(np), INTENT(in) :: &
79 !THXS_SFX! tpmxl
80 !THXS_SFX! TYPE(t_tfl), DIMENSION(np), INTENT(in) :: &
81 !THXS_SFX! tptfl
82 !THXS_SFX! TYPE(t_atm), DIMENSION(np), INTENT(in) :: &
83 !THXS_SFX! tpatm
84 !THXS_SFX! TYPE(t_blk), DIMENSION(np), INTENT(in) :: &
85 !THXS_SFX! tpblkw
86 !THXS_SFX! TYPE(t_blk), DIMENSION(nt,np), INTENT(in) :: &
87 !THXS_SFX! tpblki
88 !THXS_SFX! TYPE(t_sit), DIMENSION(nt,np), INTENT(in) :: &
89 !THXS_SFX! tpsit
90 !THXS_SFX! TYPE(t_vtp), DIMENSION(nl,nt,np), INTENT(in) :: &
91 !THXS_SFX! tpsil
92 !THXS_SFX! TYPE(t_bud), DIMENSION(np), INTENT(inout) :: &
93 !THXS_SFX! tpbud
94 !THXS_SFX!END SUBROUTINE glt_updbud_r
95 !THXS_SFX!!
96 !THXS_SFX!END INTERFACE
97 !THXS_SFX!END MODULE modi_glt_updbud_r
98 !
99 ! ---------------------- END MODULE modi_glt_updbud_r -----------------------
100 !
101 !
102 !
103 ! -----------------------------------------------------------------------
104 ! ------------------------ SUBROUTINE glt_updbud_r --------------------------
105 !
106 ! .. Subroutine used to check global heat budget.
107 !
108 SUBROUTINE glt_updbud_r &
109  ( kinit,omsg,tpdom,tpmxl,tptfl,tpatm,tpblkw,tpblki,tpsit,tpsil,tpbud )
110 !
111  USE modd_types_glt
112  USE modd_glt_param
114  USE mode_glt_stats_r
115  USE mode_glt_info_r
116 !
117  IMPLICIT NONE
118 !
119  INTEGER, INTENT(in) :: &
120  kinit
121  CHARACTER(*), INTENT(in) :: &
122  omsg
123  TYPE(t_dom), DIMENSION(np), INTENT(in) :: &
124  tpdom
125  TYPE(t_mxl), DIMENSION(np), INTENT(in) :: &
126  tpmxl
127  TYPE(t_tfl), DIMENSION(np), INTENT(in) :: &
128  tptfl
129  TYPE(t_atm), DIMENSION(np), INTENT(in) :: &
130  tpatm
131  TYPE(t_blk), DIMENSION(np), INTENT(in) :: &
132  tpblkw
133  TYPE(t_blk), DIMENSION(nt,np), INTENT(in) :: &
134  tpblki
135  TYPE(t_sit), DIMENSION(nt,np), INTENT(in) :: &
136  tpsit
137  TYPE(t_vtp), DIMENSION(nl,nt,np), INTENT(in) :: &
138  tpsil
139  TYPE(t_bud), DIMENSION(np), INTENT(inout) :: &
140  tpbud
141 !
142  INTEGER :: &
143  jl
144  REAL :: &
145  zenthalpy0,zhiit0,zbiit0,zhii0,zhio0, &
146  zhli0,zhlo0,zwio0,zwlo0,zwii0,zwli0,zcio0,zclo0, &
147  zwater0,zsalt0
148  REAL, DIMENSION(np) :: &
149  zfsit
150  REAL, DIMENSION(np) :: &
151  zenthalpy2,zhiit2,zbiit2, &
152  znli2,zniit2,zhli2,zhlo2,zwii2,zwli2,zwater2,zsalt2
153  REAL, DIMENSION(nt,np) :: &
154  zenthalpys,zenthalpyi,zmsi,zmsn
155 !
156 !
157 !
158 ! 1. Initializations
159 ! ==================
160 !
161  IF (lp1) THEN
162  WRITE(noutlu,*) ' '
163  WRITE(noutlu,*) ' **** glt_updbud_r ****'
164  WRITE(noutlu,*) omsg, ' (energy fluxes in W.m-2)'
165  WRITE(noutlu,*) omsg, ' (water and salt fluxes in kg.m-2.day-1)'
166  ENDIF
167 !
168 !
169 ! 1.1. Initialize arrays
170 ! -----------------------
171 !
172  zfsit(:) = sum( tpsit(:,:)%fsi,dim=1 )
173  zmsi(:,:) = rhoice * tpsit(:,:)%fsi * tpsit(:,:)%hsi
174  zmsn(:,:) = tpsit(:,:)%rsn * tpsit(:,:)%fsi * tpsit(:,:)%hsn
175 !
176 !
177 ! 1.2. Print information
178 ! -----------------------
179 !
180  CALL glt_info_si_r( omsg,tpsit=tpsit )
181 !
182 !
183 !
184 ! 2. Incoming fluxes
185 ! ===================
186 !
187 ! 2.1. Incoming fluxes on sea ice (top+bottom of the slab)
188 ! ---------------------------------------------------------
189 !
190 ! .. Note that the incoming energy at the top represents on the one
191 ! hand the sum of solar and non solar fluxes, the snow layer latent
192 ! heat change due to new snowfalls, and the related snow layer gltools_enthalpy
193 ! variation.
194 ! (note that tpatm%sop is in kg.m-2.s-1)
195 !
196  IF ( kinit==1 ) THEN
197 !
198 ! Energy
199  zniit2(:) = tpatm(:)%sop * &
200  sum( tpsit(:,:)%fsi*tpsil(nl,:,:)%ent, dim=1 )
201 ! ( -xmhofusn0*zfsit(:) + &
202 ! SUM( tpsit(:,:)%fsi * &
203 ! ( cpice0*tpsit(:,:)%tsf ),DIM=1 ) ) ! + &
204 ! tpatm(:)%lip* &
205 ! xmhofusn0*zfsit(:)
206 ! atm -> ice energy
207  zhiit2(:) = &
208  sum( tpsit(:,:)%fsi* &
209  ( tpblki(:,:)%nsf+tpblki(:,:)%swa ), dim=1 )
210 ! oce -> ice energy ( qoc can only be determined a posteriori, in glt_updhsi_r )
211  zbiit2(:) = &
212  tpmxl(:)%qml*zfsit(:) ! + tpmxl(:)%qoc
213 !
214  tpbud(:)%nii = zniit2(:)
215  tpbud(:)%hii = zhiit2(:)+zniit2(:)
216  tpbud(:)%bii = zbiit2(:)
217 !
218 ! Water
219  zwii2(:) = zfsit(:)*( tpatm(:)%sop + tpatm(:)%lip ) + &
220  sum( tpsit(:,:)%fsi*tpblki(:,:)%eva, dim=1 )
221  tpbud(:)%wii = zwii2(:)*xday2sec
222  ENDIF
223 !
224  IF ( nprinto>=1 ) THEN
225 !
226 ! Energy
227  zhiit0 = glt_avg_r( tpdom,tpbud(:)%hii,0 )
228  zbiit0 = glt_avg_r( tpdom,tpbud(:)%bii,0 )
229  zhii0 = zhiit0 + zbiit0
230 !
231 ! Water
232  zwii0 = glt_avg_r( tpdom,tpbud(:)%wii,0 )
233 !
234  IF (lwg) THEN
235  WRITE(noutlu,*) &
236  '--------------------------------------------------------------------'
237  WRITE(noutlu,*) ' Incoming ENERGY under sea ice :', &
238  zbiit0
239  WRITE(noutlu,*) ' Incoming ENERGY top of sea ice :', &
240  zhiit0
241  WRITE(noutlu,*) ' Total incoming ENERGY on sea ice :', &
242  zhii0
243  WRITE(noutlu,*) &
244  '--------------------------------------------------------------------'
245  WRITE(noutlu,*) ' Total incoming WATER on sea ice :', &
246  zwii0
247  WRITE(noutlu,*) &
248  '--------------------------------------------------------------------'
249  ENDIF
250  ENDIF
251 !
252 !
253 ! 2.2. Incoming fluxes on leads
254 ! ------------------------------
255 !
256  IF ( kinit==1 ) THEN
257 !
258 ! Energy
259  zhli2(:) = &
260  ( 1.-zfsit(:) )* &
261  ( tpmxl(:)%qml+tpblkw(:)%nsf+tpblkw(:)%swa )
262  IF ( nsnwrad==1 ) THEN
263  znli2(:) = ( 1.-zfsit(:) )* &
264 ! ( cpice0*tpmxl(:)%mlf-xmhofusn0 )*tpatm(:)%sop ! Not justified
265  ( -xmhofusn0 )*tpatm(:)%sop
266  ELSE
267  znli2(:) = 0.
268  ENDIF
269  tpbud(:)%nli = znli2(:)
270  tpbud(:)%hli = zhli2(:)+znli2(:)
271 !
272 ! Water
273  zwli2(:) = ( 1.-zfsit(:) )* &
274  ( tpatm(:)%sop + tpatm(:)%lip + tpblkw(:)%eva )*xday2sec
275  tpbud(:)%wli = zwli2(:)
276  ENDIF
277 !
278  IF ( nprinto>=1 ) THEN
279 !
280 ! Energy
281  zhli0 = glt_avg_r( tpdom,tpbud(:)%hli,0 )
282  IF (lwg) THEN
283  WRITE(noutlu,*) ' Total incoming ENERGY (on leads) :', &
284  zhli0
285  WRITE(noutlu,*) &
286  '--------------------------------------------------------------------'
287  ENDIF
288 !
289 ! Water
290  zwli0 = glt_avg_r( tpdom,tpbud(:)%wli,0 )
291  IF (lwg) THEN
292  WRITE(noutlu,*) ' Total incoming WATER (on leads) :', &
293  zwli0
294  WRITE(noutlu,*) &
295  '--------------------------------------------------------------------'
296  ENDIF
297  ENDIF
298 !
299 !
300 !
301 ! 3. Outgoing fluxes
302 ! ===================
303 !
304 ! 3.1. Outgoing fluxes at the bottom of the sea ice slab
305 ! -------------------------------------------------------
306 !
307 ! Energy
308  tpbud(:)%hio = tptfl(:)%lio+tptfl(:)%tio
309 !
310  IF ( nprinto>=1 ) THEN
311  zhio0 = glt_avg_r( tpdom,tpbud(:)%hio,0 )
312  IF (lwg) THEN
313  WRITE(noutlu,*) ' Total outgoing ENERGY (under sea ice) :', &
314  zhio0
315  WRITE(noutlu,*) &
316  '--------------------------------------------------------------------'
317  ENDIF
318 !
319 ! Water
320 ! This flux is just described by tptfl%wio
321 !
322  zwio0 = glt_avg_r( tpdom,tptfl(:)%wio,0 )*xday2sec
323  IF (lwg) THEN
324  WRITE(noutlu,*) ' Total outgoing WATER (under sea ice) :', &
325  zwio0
326  WRITE(noutlu,*) &
327  '--------------------------------------------------------------------'
328  ENDIF
329 !
330 ! Salt
331 ! A conversion is necessary to convert the concentration/dilution flux to
332 ! salt mass changes ( in kg.m-2 ):
333 ! D S = sml * cio
334 !
335  zsalt2(:) = tptfl(:)%sio
336  zcio0 = glt_avg_r( tpdom,zsalt2,0 )*xday2sec
337  IF (lwg) THEN
338  WRITE(noutlu,*) ' Total outgoing SALT (under sea ice) :', &
339  zcio0
340  WRITE(noutlu,*) &
341  '--------------------------------------------------------------------'
342  ENDIF
343  ENDIF
344 !
345 !
346 ! 3.2. Outgoing fluxes through the water surface
347 ! -----------------------------------------------
348 !
349 ! Energy
350  zhlo2(:) = tptfl(:)%llo+tptfl(:)%tlo
351 !
352  tpbud(:)%hlo = zhlo2(:)
353 !
354  IF ( nprinto>=1 ) THEN
355  zhlo0 = glt_avg_r( tpdom,tpbud(:)%hlo,0 )
356  IF (lwg) THEN
357  WRITE(noutlu,*) ' Total outgoing ENERGY (under leads) :', &
358  zhlo0
359  WRITE(noutlu,*) &
360  '--------------------------------------------------------------------'
361  ENDIF
362 !
363 ! Water
364  zwlo0 = glt_avg_r( tpdom,tptfl%wlo,0 )*xday2sec
365  IF (lwg) THEN
366  WRITE(noutlu,*) ' Total outgoing WATER (under leads) :', &
367  zwlo0
368  WRITE(noutlu,*) &
369  '--------------------------------------------------------------------'
370  ENDIF
371 !
372 ! Salt
373 ! A conversion is necessary to convert the concentration/dilution flux to
374 ! salt mass changes ( in kg.m-2 ):
375 ! D S = sml * wlo
376 !
377 ! zsalt2(:) = 1.e-3 * tpmxl(:)%sml * tptfl(:)%wlo
378 ! zclo0 = glt_avg_r( tpdom,zsalt2,0 )*xday2sec
379 ! WRITE(noutlu,*) ' Total outgoing SALT (under leads) :', &
380 ! zclo0
381 ! WRITE(noutlu,*) &
382 ! '--------------------------------------------------------------------'
383  ENDIF
384 !
385 !
386 !
387 ! 4. Energy/water/salt retained by sea ice/snow per square meter
388 ! ===============================================================
389 !
390 ! 4.1. Enthalpy in sea ice/snow per square meter
391 ! ----------------------------------------------
392 !
393  zenthalpyi(:,:) = 0.
394  DO jl=1,nilay
395  zenthalpyi(:,:) = zenthalpyi(:,:) + &
396  sf3tinv(jl) * zmsi(:,:) * tpsil(jl,:,:)%ent
397  END DO
398 !
399  zenthalpys(:,:) = &
400  zmsn(:,:) * sum( tpsil(nilay+1:nl,:,:)%ent,dim=1 )/float(nslay)
401 !
402  zenthalpy2(:) = sum( zenthalpys(:,:)+zenthalpyi(:,:), dim=1 )
403 !
404 ! .. Initial gltools_enthalpy is set to computed gltools_enthalpy if kinit flag is on.
405 ! Else initial gltools_enthalpy is kept as such.
406 !
407  IF ( kinit==1 ) THEN
408  tpbud(:)%eni = zenthalpy2(:)
409  tpbud(:)%enn = zenthalpy2(:)
410  ELSE
411  tpbud(:)%enn = zenthalpy2(:)
412  ENDIF
413 !
414  IF ( nprinto>=1 ) THEN
415  zenthalpy0 = glt_avg_r( tpdom, tpbud(:)%enn-tpbud(:)%eni,0 ) / dtt
416  IF (lwg) THEN
417  WRITE(noutlu,*) &
418  ' D(enthalpy) from beg. of time step :', &
419  zenthalpy0
420  WRITE(noutlu,*) &
421  '--------------------------------------------------------------------'
422  ENDIF
423  ENDIF
424 !
425 !
426 ! 4.2. Water stored by sea ice and snow
427 ! --------------------------------------
428 !
429 ! .. Note that we exclude salt (only fresh water is taken into account)
430 !
431 ! Sea ice + snow fresh water content
432  zwater2(:) = xday2sec*( &
433  sum( zmsi(:,:)*( 1.-1.e-3*tpsit(:,:)%ssi ), dim=1 ) + &
434  sum( zmsn(:,:), dim=1 ) )
435 !
436 ! .. Initial fresh water content of sea ice + snow cover is initialised if
437 ! kinit flag is on.
438 !
439  IF ( kinit==1 ) THEN
440  tpbud(:)%fwi = zwater2(:)
441  ENDIF
442  tpbud(:)%fwn = zwater2(:)
443 !
444  IF ( nprinto>=1 ) THEN
445  zwater0 = glt_avg_r( tpdom,tpbud(:)%fwn-tpbud(:)%fwi,0 ) / dtt
446  IF (lwg) THEN
447  WRITE(noutlu,*) ' D(water) from beg. of time step :', &
448  zwater0
449  WRITE(noutlu,*) &
450  '--------------------------------------------------------------------'
451  ENDIF
452  ENDIF
453 !
454 !
455 ! 4.3. Salt stored by sea ice
456 ! ----------------------------
457 !
458 ! Sea ice salt content
459  zsalt2(:) = xday2sec* &
460  sum( zmsi(:,:)*1.e-3*tpsit(:,:)%ssi, dim=1 )
461 !
462 ! .. Initial salt content of sea ice is initialised if kinit flag is on.
463 !
464  IF ( kinit==1 ) THEN
465  tpbud(:)%isi = zsalt2(:)
466  ENDIF
467  tpbud(:)%isn = zsalt2(:)
468 !
469  IF ( nprinto>=1 ) THEN
470  zsalt0 = glt_avg_r( tpdom,tpbud(:)%isn-tpbud(:)%isi,0 ) / dtt
471  IF (lwg) THEN
472  WRITE(noutlu,*) ' D(salt) from beg. of time step :', &
473  zsalt0
474  WRITE(noutlu,*) &
475  '--------------------------------------------------------------------'
476  ENDIF
477  ENDIF
478 !
479 !
480 ! 5. Final prints: general budget
481 ! ===============================
482 !
483 ! .. At the end of the time step, the sum of incoming energy on leads
484 ! and on sea ice should be equal to the sum of the total variation of
485 ! gltools_enthalpy in sea ice+snow and of the total outgoing energy.
486 ! A print of these two quantities is done here.
487 !
488  IF (lp1) THEN
489  WRITE(noutlu,*) ' Total incoming energy (leads+ice) :', &
490  zhii0+zhli0
491  WRITE(noutlu,*) ' D(enthalpy) + outg. ENERGY :', &
492  zenthalpy0+zhio0+zhlo0
493  WRITE(noutlu,*) ' ENERGY BALANCE :', &
494  zenthalpy0+zhio0+zhlo0-(zhii0+zhli0)
495  WRITE(noutlu,*) &
496  '--------------------------------------------------------------------'
497  WRITE(noutlu,*) ' Total incoming + outgoing water (leads+ice) :', &
498  zwii0+zwli0-zwio0-zwlo0
499  WRITE(noutlu,*) ' WATER BALANCE :', &
500  zwii0+zwli0-zwio0-zwlo0-zwater0
501  WRITE(noutlu,*) &
502  '--------------------------------------------------------------------'
503  WRITE(noutlu,*) ' SALT BALANCE :', &
504  -zcio0-zsalt0
505  WRITE(noutlu,*) &
506  '--------------------------------------------------------------------'
507  ENDIF
508 !
509 END SUBROUTINE glt_updbud_r
510 
511 ! ---------------------- END SUBROUTINE glt_updbud_r ------------------------
512 ! -----------------------------------------------------------------------
subroutine glt_updbud_r(kinit, omsg, tpdom, tpmxl, tptfl, tpatm, tpblkw, tpblki, tpsit, tpsil, tpbud)