SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
gltools_temper_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_gltools_temper_r ======================
41 ! =======================================================================
42 !
43 ! Goal:
44 ! -----
45 ! This module contains a function that allows to compute temperature
46 ! vertical profile from gltools_enthalpy vertical profile (ent) in the slab
47 ! (both sea ice and snow parts)
48 ! In addition to temperature, a vertical salinity profile can also
49 ! be passed to the routine (optionally).
50 ! Note that the computed glt_output temperature is in Celsius.
51 !
52 ! Created : 12/2009 (D. Salas y Melia)
53 ! Modified: no
54 !
55 ! ----------------- BEGIN MODULE modi_gltools_temper_r --------------------
56 !
58 INTERFACE
59 !
60 FUNCTION gltools_temper_r(pent,pvsp)
61  USE modd_glt_param
62  REAL, DIMENSION(nl,nt,np), INTENT(in) :: &
63  pent
64  REAL, DIMENSION(nl,nt,np), OPTIONAL, INTENT(in) :: &
65  pvsp
66  REAL, DIMENSION(nl,nt,np) :: &
68 END FUNCTION gltools_temper_r
69 !
70 END INTERFACE
71 END MODULE modi_gltools_temper_r
72 !
73 ! ------------------ END MODULE modi_gltools_temper_r ---------------------
74 !
75 !
76 ! -----------------------------------------------------------------------
77 ! ------------------------- FUNCTION gltools_temper_r ---------------------------
78 
79 ! The input argument is sea ice vertical gltools_enthalpy profile, in K.
80 
81 FUNCTION gltools_temper_r(pent,pvsp)
82 !
83  USE modd_glt_param
85 !
86  IMPLICIT NONE
87 !
88  REAL, DIMENSION(nl,nt,np), INTENT(in) :: &
89  pent
90  REAL, DIMENSION(nl,nt,np), OPTIONAL, INTENT(in) :: &
91  pvsp
92  REAL, DIMENSION(nl,nt,np) :: &
94 !
95  INTEGER :: &
96  jl
97  REAL, DIMENSION(nt,np) :: &
98  zb,zc,zdelta
99  REAL, DIMENSION(nl,nt,np) :: &
100  ztice_m
101 !
102 !
103 ! 1. Initializations
104 ! ===================
105 !
106 ! .. Compute sea ice melting point as a function of salinity
107 !
108  IF ( present(pvsp) ) THEN
109 ! Salinity profile passed in argument
110  ztice_m(:,:,:) = -mu * pvsp(:,:,:)
111  ELSE
112 ! Prescribed salinity profile in the sea ice part of the slab
113  ztice_m(1:nilay,:,:) = -mu * sice
114 ! Salinity profile in the snow part of the slab
115  ztice_m(nilay+1:nl,:,:) = 0.
116  ENDIF
117 !
118 !
119 !
120 ! 2. Temperature of the sea ice part of the slab
121 ! ===============================================
122 !
123 !* A second-order equation : aX^2 + bX + c = 0 has to be solved
124 ! ( a = cpice0 )
125 ! Let delta be: delta = b^2 - 4ac
126 ! The only physical root is:
127 ! X0 = -1/(2a) * ( b + delta^0.5 )
128 !
129  DO jl=1,nilay
130 !
131 ! If gltools_enthalpy is lower than melted sea ice gltools_enthalpy
132  WHERE ( pent(jl,:,:)<cpsw*ztice_m(jl,:,:) )
133  zb(:,:) = (cpsw-cpice0)*ztice_m(jl,:,:)- &
134  pent(jl,:,:)-xmhofusn0
135  zc(:,:) = xmhofusn0 * ztice_m(jl,:,:)
136  zdelta(:,:) = zb(:,:)**2-4.*cpice0*zc(:,:)
137  gltools_temper_r(jl,:,:) = -1./( 2.*cpice0 )* &
138  ( zb(:,:)+zdelta(:,:)**0.5 )
139  ELSEWHERE
140 ! If gltools_enthalpy is higher than that of melting sea ice
141  gltools_temper_r(jl,:,:) = ztice_m(jl,:,:)
142  ENDWHERE
143 !
144  END DO
145 !
146 !
147 ! 3. Temperature of the snow part of the slab
148 ! ============================================
149 !
150  DO jl=nilay+1,nl
151 ! If snow gltools_enthalpy is lower than melted snow gltools_enthalpy
152  WHERE ( pent(jl,:,:)<-xmhofusn0 )
153  gltools_temper_r(jl,:,:) = 1./cpice0 * &
154  ( pent(jl,:,:) + xmhofusn0 )
155  ELSEWHERE
156 ! If snow gltools_enthalpy is higher than melted snow gltools_enthalpy
157  gltools_temper_r(jl,:,:) = 0.
158  ENDWHERE
159  END DO
160 !
161 END FUNCTION gltools_temper_r
162 !
163 ! ------------------------ END FUNCTION gltools_temper_r ------------------------
164 ! -----------------------------------------------------------------------
real function, dimension(nl, nt, np) gltools_temper_r(pent, pvsp)