SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
mode_gltools_enthalpy.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 mode_gltools_enthalpy ======================
41 ! =======================================================================
42 !
43 ! Goal:
44 ! -----
45 ! This module contains two functions that allow to compute sea ice or
46 ! snow massic gltools_enthalpy (J.kg-1) from temperature (and salinity in the
47 ! case of sea ice).
48 ! - enthalpy3d:
49 ! In addition to temperature, salinity profile can also be passed
50 ! to the routine (optionally).
51 ! - enthalpy0d:
52 ! Computes gltools_enthalpy at only one point. As we are not dealing with a
53 ! vertical profile, we do not know a priori if we are dealing with snow
54 ! or ice. Hence for glt_enthalpy0d the salinity argument is compulsory. If
55 ! salinity is 0, we know that we are dealing with snow.
56 !
57 ! Created : 12/2009 (D. Salas y Melia)
58 ! Modified: 02/2010 (D. Salas y Melia)
59 ! Introduction of glt_enthalpy1d and glt_enthalpy2d (to avoid CALL glt_enthalpy0d
60 ! in loops)
61 !
62 ! ----------------- BEGIN MODULE mode_gltools_enthalpy --------------------
63 !
65 INTERFACE
66 !
67 SUBROUTINE glt_aventh(tpsit,tpsil,pentsi,pentsn)
68  USE modd_glt_param
69  USE modd_types_glt
70  TYPE(t_sit), DIMENSION(nt,np), INTENT(in) :: &
71  tpsit
72  TYPE(t_vtp), DIMENSION(nl,nt,np), INTENT(in) :: &
73  tpsil
74  REAL, DIMENSION(np), INTENT(out) :: &
75  pentsi,pentsn
76 END SUBROUTINE glt_aventh
77 !
78 FUNCTION glt_enthalpy0d(pt,ps)
79  REAL, INTENT(in) :: &
80  pt
81  REAL, INTENT(in) :: &
82  ps
83  REAL :: &
85 END FUNCTION glt_enthalpy0d
86 !
87 FUNCTION glt_enthalpy1d(gmsk,pt,ps)
88  USE modd_glt_param, only: np
89  LOGICAL, DIMENSION(np), INTENT(in) :: &
90  gmsk
91  REAL, DIMENSION(np), INTENT(in) :: &
92  pt
93  REAL, DIMENSION(np), INTENT(in) :: &
94  ps
95  REAL, DIMENSION(np) :: &
97 END FUNCTION glt_enthalpy1d
98 !
99 FUNCTION glt_enthalpy2d(pt,ps)
100  USE modd_glt_param, only: np,nt
101  REAL, DIMENSION(nt,np), INTENT(in) :: &
102  pt
103  REAL, DIMENSION(nt,np), INTENT(in) :: &
104  ps
105  REAL, DIMENSION(nt,np) :: &
107 END FUNCTION glt_enthalpy2d
108 !
109 FUNCTION glt_enthalpy3d(pvtp,pvsp)
110  USE modd_glt_param, only: nl,np,nt, nilay
111  REAL, DIMENSION(nl,nt,np), INTENT(in) :: &
112  pvtp
113  REAL, DIMENSION(nl,nt,np), OPTIONAL, INTENT(in) :: &
114  pvsp
115  REAL, DIMENSION(nl,nt,np) :: &
117 END FUNCTION glt_enthalpy3d
118 !
119 END INTERFACE
120 END MODULE mode_gltools_enthalpy
121 !
122 ! ------------------ END MODULE mode_gltools_enthalpy ---------------------
123 !
124 !
125 ! -----------------------------------------------------------------------
126 ! ------------------------- SUBROUTINE glt_aventh ---------------------------
127 !
128 ! Computes the total gltools_enthalpy (J.m-2) of sea-ice and snow (separately)
129 ! in an ice-snow slab
130 !
131 SUBROUTINE glt_aventh(tpsit,tpsil,pentsi,pentsn)
133  USE modd_glt_param
134  USE modd_types_glt
135  TYPE(t_sit), DIMENSION(nt,np), INTENT(in) :: &
136  tpsit
137  TYPE(t_vtp), DIMENSION(nl,nt,np), INTENT(in) :: &
138  tpsil
139  REAL, DIMENSION(np), INTENT(out) :: &
140  pentsi,pentsn
141 !
142  INTEGER :: &
143  jl
144  REAL, DIMENSION(nt,np) :: &
145  zmsi,zmsn
146 !
147 ! Enthalpy in the ice part of the slab
148  zmsi(:,:) = rhoice * tpsit(:,:)%fsi * tpsit(:,:)%hsi
149  pentsi(:) = 0.
150  DO jl=1,nilay
151  pentsi(:) = pentsi(:) + &
152  sum( sf3tinv(jl) * zmsi(:,:) * tpsil(jl,:,:)%ent, dim=1 )
153  END DO
154 !
155 ! Enthalpy in the snow part of the slab
156  zmsn(:,:) = tpsit(:,:)%rsn * tpsit(:,:)%fsi * tpsit(:,:)%hsn
157  pentsn(:) = &
158  sum( zmsn(:,:)*sum( tpsil(nilay+1:nl,:,:)%ent,dim=1 ), dim=1 ) / &
159  float(nslay)
160 !
161 END SUBROUTINE glt_aventh
162 !
163 ! ------------------------- END SUBROUTINE glt_aventh -----------------------
164 ! -----------------------------------------------------------------------
165 !
166 !
167 ! -----------------------------------------------------------------------
168 ! ------------------------ FUNCTION glt_enthalpy0d --------------------------
169 !
170 ! The input arguments are temperature profile, in Celsius
171 ! and salinity (g.kg-1). Note that both arguments are compulsory.
172 !
173 FUNCTION glt_enthalpy0d(pt,ps)
174 !
175  USE modd_glt_param
177 !
178  IMPLICIT NONE
179 !
180  REAL, INTENT(in) :: &
181  pt
182  REAL, INTENT(in) :: &
183  ps
184  REAL :: &
186 !
187  REAL :: &
188  ztice_m
189 !
190 !
191 ! 1. Initializations
192 ! ===================
193 !
194 ! .. Compute sea ice melting point as a function of salinity
195 !
196  ztice_m = -mu * ps
197 !
198 !
199 ! 2. If the slab is salty ice
200 ! ============================
201 !
202 !* Compute the amount of energy needed to raise sea ice temperature to
203 ! melting point and melt sea ice completely
204 !
205  IF ( ps>0. ) THEN
206 ! If temperature is lower than melting point
207  IF ( pt<ztice_m ) THEN
208  glt_enthalpy0d = cpice0*( pt-ztice_m ) - xmhofusn0*( 1.-ztice_m/pt )
209  ELSE
210 ! If temperature is melting point
211  glt_enthalpy0d = 0.
212  ENDIF
213 !
214 !* Add a term for the energy needed to increase the meltwater temperature to 0
215 ! Celsius
216 !
217  glt_enthalpy0d = glt_enthalpy0d + cpsw*ztice_m
218 !
219  ELSE
220 !
221 !
222 ! 3. If the slab is pure ice
223 ! ===========================
224 !
225  IF ( pt<0. ) THEN
226  glt_enthalpy0d = cpice0*pt - xmhofusn0
227  ELSE
228  glt_enthalpy0d = 0.
229  ENDIF
230 !
231  ENDIF
232 !
233 END FUNCTION glt_enthalpy0d
234 !
235 ! ------------------------ FUNCTION glt_enthalpy0d --------------------------
236 ! -----------------------------------------------------------------------
237 !
238 !
239 ! -----------------------------------------------------------------------
240 ! ------------------------ FUNCTION glt_enthalpy1d --------------------------
241 !
242 ! The input arguments are temperature, in Celsius and salinity (g.kg-1)
243 ! spatial fields. Note that both arguments are compulsory.
244 !
245 FUNCTION glt_enthalpy1d(gmsk,pt,ps)
246 !
247  USE modd_glt_param, only: np
249 !
250  IMPLICIT NONE
251 !
252  LOGICAL, DIMENSION(np), INTENT(in) :: &
253  gmsk
254  REAL, DIMENSION(np), INTENT(in) :: &
255  pt
256  REAL, DIMENSION(np), INTENT(in) :: &
257  ps
258  REAL, DIMENSION(np) :: &
260 !
261  integer :: &
262  jp
263  REAL, DIMENSION(np) :: &
264  ztice_m
265 !
266 !
267 ! THE CASE OF PURE ICE SHOULD BE ADDRESSED AS WELL
268 !
269 ! 1. Initializations
270 ! ===================
271 !
272 do jp=1,np
273  IF( gmsk(jp) ) then
274 !
275 ! .. Compute sea ice melting point as a function of salinity
276 !
277  ztice_m(jp) = -mu * ps(jp)
278 !
279 !
280 ! 2. Enthalpy of the sea ice part of the slab
281 ! ============================================
282 !
283 !* Compute the amount of energy needed to raise sea ice temperature to
284 ! melting point and melt sea ice completely
285 !
286 ! If temperature is lower than melting point
287 IF ( pt(jp)<ztice_m(jp) ) then
288  glt_enthalpy1d(jp) = &
289  cpice0*( pt(jp)-ztice_m(jp) ) - &
290  xmhofusn0*( 1.-ztice_m(jp)/pt(jp) )
291  ELSE
292 ! If temperature is melting point
293  glt_enthalpy1d(jp) = cpice0*( pt(jp)-ztice_m(jp) )
294 ENDIF
295 !
296 !* Add a term for the energy needed to increase the meltwater temperature to 0
297 ! Celsius
298 !
299  glt_enthalpy1d(jp) = glt_enthalpy1d(jp) + cpsw*ztice_m(jp)
300 !
301  ELSE
302 !
303 !
304 ! 3. Masked part of the domain
305 ! =============================
306 !
307  glt_enthalpy1d(jp) = 0.
308 !
309  ENDIF
310  end do
311 !
312 END FUNCTION glt_enthalpy1d
313 !
314 ! ------------------------ FUNCTION glt_enthalpy1d --------------------------
315 ! -----------------------------------------------------------------------
316 !
317 !
318 ! -----------------------------------------------------------------------
319 ! ------------------------ FUNCTION glt_enthalpy2d --------------------------
320 !
321 ! The input arguments are temperature, in Celsius and salinity (g.kg-1)
322 ! spatial fields. Note that both arguments are compulsory.
323 !
324 FUNCTION glt_enthalpy2d(pt,ps)
325 !
326  USE modd_glt_param, only: np,nt
328 !
329  IMPLICIT NONE
330 !
331  REAL, DIMENSION(nt,np), INTENT(in) :: &
332  pt
333  REAL, DIMENSION(nt,np), INTENT(in) :: &
334  ps
335  REAL, DIMENSION(nt,np) :: &
337 !
338  REAL, DIMENSION(nt,np) :: &
339  ztice_m
340 !
341 !
342 ! THE CASE OF PURE ICE SHOULD BE ADDRESSED AS WELL
343 !
344 ! 1. Initializations
345 ! ===================
346 !
347 ! .. Compute sea ice melting point as a function of salinity
348 !
349  ztice_m(:,:) = -mu * ps(:,:)
350 !
351 !
352 ! 2. Enthalpy of the sea ice part of the slab
353 ! ============================================
354 !
355 !* Compute the amount of energy needed to raise sea ice temperature to
356 ! melting point and melt sea ice completely
357 !
358 ! If temperature is lower than melting point
359  WHERE ( pt(:,:)<ztice_m(:,:) )
360  glt_enthalpy2d(:,:) = &
361  cpice0*( pt(:,:)-ztice_m(:,:) ) - &
362  xmhofusn0*( 1.-ztice_m(:,:)/pt(:,:) )
363  ELSEWHERE
364 ! If temperature is melting point
365  glt_enthalpy2d(:,:) = cpice0*( pt(:,:)-ztice_m(:,:) )
366  ENDWHERE
367 !
368 !* Add a term for the energy needed to increase the meltwater temperature to 0
369 ! Celsius
370 !
371  glt_enthalpy2d(:,:) = glt_enthalpy2d(:,:) + cpsw*ztice_m(:,:)
372 !
373 END FUNCTION glt_enthalpy2d
374 !
375 ! ------------------------ FUNCTION glt_enthalpy2d --------------------------
376 ! -----------------------------------------------------------------------
377 !
378 !
379 ! -----------------------------------------------------------------------
380 ! ------------------------ FUNCTION glt_enthalpy3d --------------------------
381 !
382 ! The input arguments are sea ice vertical temperature profile, in
383 ! Celsius and, if available, vertical salinity profile (g.kg-1).
384 !
385 FUNCTION glt_enthalpy3d(pvtp,pvsp)
386 !
387  USE modd_glt_param, only: nl,np,nt, nilay
389 !
390  IMPLICIT NONE
391 !
392  REAL, DIMENSION(nl,nt,np), INTENT(in) :: &
393  pvtp
394  REAL, DIMENSION(nl,nt,np), OPTIONAL, INTENT(in) :: &
395  pvsp
396  REAL, DIMENSION(nl,nt,np) :: &
398 !
399  INTEGER :: &
400  jl
401  REAL, DIMENSION(nl,nt,np) :: &
402  ztice_m
403 !
404 !
405 ! 1. Initializations
406 ! ===================
407 !
408 ! .. Compute sea ice melting point as a function of salinity
409  IF ( present(pvsp) ) THEN
410  ztice_m(:,:,:) = -mu * pvsp(:,:,:)
411  ELSE
412  ztice_m(1:nilay,:,:) = -mu * sice
413  ztice_m(nilay+1:nl,:,:) = 0.
414  ENDIF
415 !
416 !
417 ! 2. Enthalpy of the sea ice part of the slab
418 ! ============================================
419 !
420  DO jl=1,nilay
421 !
422 !* Compute the amount of energy needed to raise sea ice temperature to
423 ! melting point and melt sea ice completely
424 !
425 ! If temperature is lower than melting point
426  WHERE ( pvtp(jl,:,:)<ztice_m(jl,:,:) )
427  glt_enthalpy3d(jl,:,:) = &
428  cpice0*( pvtp(jl,:,:)-ztice_m(jl,:,:) ) - &
429  xmhofusn0*( 1.-ztice_m(jl,:,:)/pvtp(jl,:,:) )
430  ELSEWHERE
431 ! If temperature is melting point
432  glt_enthalpy3d(jl,:,:) = 0.
433  ENDWHERE
434 !
435 !* Add a term for the energy needed to increase the meltwater temperature to 0C
436 !
437  glt_enthalpy3d(jl,:,:) = glt_enthalpy3d(jl,:,:) + cpsw*ztice_m(jl,:,:)
438 !
439  END DO
440 !
441 !
442 ! 3. Enthalpy of the snow part of the slab
443 ! =========================================
444 !
445  DO jl=nilay+1,nl
446  glt_enthalpy3d(jl,:,:) = cpice0*pvtp(jl,:,:)-xmhofusn0
447  END DO
448 !
449 END FUNCTION glt_enthalpy3d
450 !
451 ! ----------------------- END FUNCTION glt_enthalpy3d -----------------------
452 ! -----------------------------------------------------------------------
subroutine glt_aventh(tpsit, tpsil, pentsi, pentsn)
real function, dimension(np) glt_enthalpy1d(gmsk, pt, ps)
real function glt_enthalpy0d(pt, ps)
real function, dimension(nl, nt, np) glt_enthalpy3d(pvtp, pvsp)
real function, dimension(nt, np) glt_enthalpy2d(pt, ps)