SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
modi_glt_updtfl_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_updtfl_r =========================
41 ! =======================================================================
42 !
43 ! Goal:
44 ! -----
45 ! Transform sea ice ablation/accretion or snow ablation into salt,
46 ! water and heat fluxes directed to the ocean.
47 !
48 ! Method:
49 ! -------
50 ! For every category of ice or snow involved in melting / freezing
51 ! in the grid cell, the following quantities are needed:
52 ! - mass (kg.m-2)
53 ! - massic gltools_enthalpy (J.kg-1)
54 ! - salt (g.kg-1)
55 ! As Gelato can be coupled to rigid lid models (that need a virtual
56 ! freshwater flux) or a free-surface model (that need a virtual
57 ! freshwater flux and a water mass flux). A heat flux is also
58 ! computed
59 !
60 ! Remarks:
61 ! --------
62 ! Note that dmass (the provided mass of melted ice or snow) are
63 ! in kg.m-2. In the case of sea ice:
64 ! (sea ice density) * (fraction) * (thickness variation).
65 ! In case of an exchange between the ice and a fresh water flux
66 ! (ie snow2ice or sublim), then the provided mass is the masse of fresh water
67 ! given to the ice compartment
68 !
69 !
70 ! Created : 2001/07 (D. Salas y Melia)
71 ! Taken out from imod_thermo_ice.f90 routine (rigid lid
72 ! assumption is made).
73 !
74 ! Modified: 2002/10 (D. Salas y Melia)
75 ! Introduction of free surface approach.
76 !
77 ! Modified: 2009/06 (D. Salas y Melia) reduced grid
78 !
79 ! Modified: 2009/12 (D. Salas y Melia) make glt_updtfl consistent with the
80 ! new gltools_enthalpy formulation in Gelato.
81 !
82 ! Modified: 2011/12 (A. Voldoire) Re-formulation of this ice/water fluxes
83 ! interface, depending on the source and target media involved.
84 !
85 ! ---------------------- BEGIN MODULE modi_glt_updtfl_r ---------------------
86 !
87 !THXS_SFX!MODULE modi_glt_updtfl_r
88 !THXS_SFX!INTERFACE
89 !THXS_SFX!!
90 !THXS_SFX!SUBROUTINE glt_updtfl_r( hflag,tpmxl,tptfl,pdmass,pent,psalt )
91 !THXS_SFX!!
92 !THXS_SFX! USE modd_types_glt
93 !THXS_SFX! USE modd_glt_param
94 !THXS_SFX! CHARACTER(*), INTENT(in) :: &
95 !THXS_SFX! hflag
96 !THXS_SFX! TYPE(t_mxl), DIMENSION(np), INTENT(in) :: &
97 !THXS_SFX! tpmxl
98 !THXS_SFX! TYPE(t_tfl), DIMENSION(np), INTENT(inout) :: &
99 !THXS_SFX! tptfl
100 !THXS_SFX! REAL, DIMENSION(nt,np), INTENT(in) :: &
101 !THXS_SFX! pdmass
102 !THXS_SFX! REAL, DIMENSION(nt,np), INTENT(in), OPTIONAL :: &
103 !THXS_SFX! psalt,pent
104 !THXS_SFX!END SUBROUTINE glt_updtfl_r
105 !THXS_SFX!!
106 !THXS_SFX!END INTERFACE
107 !THXS_SFX!END MODULE modi_glt_updtfl_r
108 !
109 ! ---------------------- END MODULE modi_glt_updtfl_r -----------------------
110 !
111 !
112 !
113 ! -----------------------------------------------------------------------
114 ! ------------------------- SUBROUTINE glt_updtfl_r -------------------------
115 !
116 SUBROUTINE glt_updtfl_r( hflag,tpmxl,tptfl,pdmass,pent,psalt )
117 !
119  USE modd_types_glt
120  USE modd_glt_param
121  USE modi_glt_salflx_r
122 !
123  IMPLICIT NONE
124 !
125 ! .. Arguments
126 !
127  CHARACTER(*), INTENT(in) :: &
128  hflag
129  TYPE(t_mxl), DIMENSION(np), INTENT(in) :: &
130  tpmxl
131  TYPE(t_tfl), DIMENSION(np), INTENT(inout) :: &
132  tptfl
133  REAL, DIMENSION(nt,np), INTENT(in) :: &
134  pdmass
135  REAL, DIMENSION(nt,np), INTENT(in), OPTIONAL :: &
136  psalt,pent
137 !
138 ! .. Local variables
139 !
140  REAL, DIMENSION(np) :: &
141  zqm,zqsalt,zqent
142  REAL, DIMENSION(nt,np) :: &
143  zsalt,zaux,zsml,zqsalt2,zent
144 !
145 !
146 !
147 ! 1. Case of sea ice volume variation
148 ! ===================================
149 !
150 ! 1.1. Compute agregated mass flux
151 ! ---------------------------------
152 !
153 ! .. zqm is in kg.m-2.s-1
154 !
155  zqm(:) = sum( pdmass(:,:),dim=1 ) / dtt
156 !
157 ! .. Salinity of considered medium (in g.kg-1)
158 !
159 !
160 ! 1.2. Compute agregated salt flux
161 ! ---------------------------------
162 !
163 ! .. zsalt is in g.kg-1
164 !
165  IF ( present( psalt ) ) THEN
166  zsalt(:,:) = psalt(:,:)
167  ELSE
168  zsalt(:,:) = 0.
169  ENDIF
170  IF ( present( pent ) ) THEN
171  zent(:,:) = pent(:,:)
172  ELSE
173  zent(:,:) = 0.
174  ENDIF
175 !
176 ! .. The salt flux is expressed in g.m-2.s-1
177 !
178  zqsalt2(:,:) = pdmass(:,:)*zsalt(:,:) ! For glt_salflx_r routine
179  zqsalt(:) = sum( zqsalt2(:,:),dim=1 ) / dtt
180 !
181 !
182 ! 1.2. Compute agregated gltools_enthalpy flux
183 ! -------------------------------------
184 !
185 ! .. Note there is no gltools_enthalpy exchange if sea ice / snow mass increases
186 !
187  zqent(:) = sum( amin1( pdmass(:,:),0. )*zent(:,:),dim=1 ) / dtt ! - &
188 ! zqm(:) * tpmxl(:)%hco
189 !
190 !
191 !
192 ! 2. Compute glt_output fluxes
193 ! =========================
194 !
195 ! 3 types_glt of exchanges :
196 ! 'FW2O' - between fresh water and ocean
197 ! only a wlo flux
198 ! 'I2O' - between ice and the ocean
199 ! only a cio flux
200 ! 'FW2I' - between fresh water and ice
201 ! a wio and a cio flux (cio=-wio)
202 !
203 !
204 !
205 !
206 ! Ice <-> Ocean
207  IF ( hflag=='I2O' ) THEN
208  IF ( nleviti==1 ) THEN
209 ! .. Update virtual water flux (concentration/dilution) in kg.m-2.s-1
210  CALL glt_salflx_r( zqsalt2,tpmxl,tptfl,pdmass=pdmass,psalt=zsalt )
211 !
212 ! .. Salt flux in kg.m-2.s-1
213 !
214  tptfl(:)%sio = tptfl(:)%sio - 1.e-3 * zqsalt(:)
215  ENDIF
216 ! Fresh Water <-> Ocean
217  ELSE IF ( hflag=='FW2O') THEN
218  tptfl(:)%wlo = tptfl(:)%wlo - zqm(:)
219 ! Fresh Water <-> Ice
220  ELSE IF ( hflag=='FW2I') THEN
221  tptfl(:)%wio = tptfl(:)%wio + zqm(:)
222  IF ( nleviti==1 ) THEN
223  tptfl(:)%cio = tptfl(:)%cio - zqm(:)
224  ENDIF
225  ENDIF
226 !
227 ! .. Heat flux in W.m-2
228 !
229  tptfl(:)%tio = tptfl(:)%tio - zqent(:)
230 !
231 !
232 END SUBROUTINE glt_updtfl_r
233 !
234 ! ----------------------- END SUBROUTINE glt_updtfl_r -----------------------
235 ! -----------------------------------------------------------------------
subroutine glt_updtfl_r(hflag, tpmxl, tptfl, pdmass, pent, psalt)
subroutine glt_salflx_r(pqsalt, tpmxl, tptfl, pdmass, psalt)