SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
modi_gltools_mixice_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_mixice_r =====================
41 ! =======================================================================
42 !
43 ! Goal:
44 ! -----
45 ! This module contains functions and subroutines which are used as
46 ! tools in the rest of the Gelato model. Some of them are purely
47 ! thermodynamic functions, others are used to have some input and
48 ! glt_output of interest displayed in a convenient way.
49 !
50 ! Created : 1996/04 (D. Salas y Melia)
51 ! Case of a 1-D model at one point
52 ! Modified: 1997/03 (D. Salas y Melia)
53 ! Adapted to a 2-D model and rewritten to follow the DOCTOR
54 ! norm.
55 ! Modified: 2007/11 (D. Salas y Melia)
56 ! Merger should be done for surface temperature also
57 ! (or it is subsequently set to melting point in the
58 ! particular case of an ice class change, creating problems)
59 ! Modified: 2009/06 (D. Salas y Melia)
60 ! Reduced grid version
61 !
62 ! ------------------ BEGIN MODULE modi_gltools_mixice_r -------------------
63 !
64 !THXS_SFX!MODULE modi_gltools_mixice_r
65 !THXS_SFX!INTERFACE
66 !THXS_SFX!!
67 !THXS_SFX!SUBROUTINE gltools_mixice_r( tpmxl,tplsit,tplsil,tpsit,tpsil )
68 !THXS_SFX! USE modd_types_glt
69 !THXS_SFX! USE modd_glt_param
70 !THXS_SFX! TYPE(t_mxl),DIMENSION(np), INTENT(in) :: &
71 !THXS_SFX! tpmxl
72 !THXS_SFX! TYPE(t_sit), DIMENSION(:,:,:), INTENT(in) :: &
73 !THXS_SFX! tplsit
74 !THXS_SFX! TYPE(t_vtp), DIMENSION(:,:,:,:), INTENT(in) :: &
75 !THXS_SFX! tplsil
76 !THXS_SFX! TYPE(t_sit), DIMENSION(nt,np), INTENT(inout) :: &
77 !THXS_SFX! tpsit
78 !THXS_SFX! TYPE(t_vtp), DIMENSION(nl,nt,np), INTENT(inout) :: &
79 !THXS_SFX! tpsil
80 !THXS_SFX!END SUBROUTINE gltools_mixice_r
81 !THXS_SFX!!
82 !THXS_SFX!END INTERFACE
83 !THXS_SFX!END MODULE modi_gltools_mixice_r
84 !
85 ! ------------------- END MODULE modi_gltools_mixice_r --------------------
86 !
87 !
88 !
89 ! -----------------------------------------------------------------------
90 ! ------------------------ SUBROUTINE gltools_mixice_r --------------------------
91 !
92 ! This subroutine is used for merging several ice classes together,
93 ! given their areal fractions, overlying snow layers thickness and
94 ! density, and vertical temperature profiles.
95 !
96 SUBROUTINE gltools_mixice_r( tpmxl,tplsit,tplsil,tpsit,tpsil )
97 !
98  USE modd_types_glt
100  USE modd_glt_param
101 !
102  IMPLICIT NONE
103 !
104  TYPE(t_mxl),DIMENSION(np), INTENT(in) :: &
105  tpmxl
106  TYPE(t_sit), DIMENSION(:,:,:), INTENT(in) :: &
107  tplsit
108  TYPE(t_vtp), DIMENSION(:,:,:,:), INTENT(in) :: &
109  tplsil
110  TYPE(t_sit), DIMENSION(nt,np), INTENT(inout) :: &
111  tpsit
112  TYPE(t_vtp), DIMENSION(nl,nt,np), INTENT(inout) :: &
113  tpsil
114  INTEGER :: &
115  jl,jt
116  REAL, DIMENSION(nt,np) :: &
117  zmlf3,zvsi,zvsn,zmsn,zagevsi,zssivsi,zaux,zvmpvsi
118 !
119 !
120 !
121 ! 1. Compute auxiliary array
122 ! ==========================
123 !
124 ! .. Expanded mixed layer freezing point
125 !
126  zmlf3(:,:) = spread(tpmxl(:)%mlf,1,nt)
127 !
128 ! .. For every ice category, volume of ice per sq. meter
129 !
130  zvsi(:,:) = sum( tplsit(:,:,:)%fsi*tplsit(:,:,:)%hsi,dim=1 )
131 !
132 ! .. For every ice category, volume and mass of snow cover per sq. meter
133 !
134  zvsn(:,:) = sum( tplsit(:,:,:)%fsi*tplsit(:,:,:)%hsn,dim=1 )
135  zmsn(:,:) = sum( tplsit(:,:,:)%fsi*tplsit(:,:,:)%hsn* &
136  tplsit(:,:,:)%rsn,dim=1 )
137 !
138 ! .. For every ice category, volume x age
139 !
140  IF ( niceage==1 ) &
141  zagevsi(:,:) = sum( tplsit(:,:,:)%fsi*tplsit(:,:,:)%hsi* &
142  tplsit(:,:,:)%age,dim=1 )
143 !
144 ! .. For every ice category, volume x ssi
145 !
146  IF ( nicesal==1 ) &
147  zssivsi(:,:) = sum( tplsit(:,:,:)%fsi*tplsit(:,:,:)%hsi* &
148  tplsit(:,:,:)%ssi,dim=1 )
149 !
150 ! .. For every ice category, volume x vmp
151 !
152  IF ( nmponds==1 ) &
153  zvmpvsi(:,:) = sum( tplsit(:,:,:)%fsi*tplsit(:,:,:)%hsi* &
154  tplsit(:,:,:)%vmp,dim=1 )
155 !
156 !
157 ! 2. Compute all ice state variables
158 ! ==================================
159 !
160 ! 2.1. Compute merged sea ice fraction
161 ! ------------------------------------
162 !
163 ! .. Compute merged sea ice fractions. It is simply the sum of the
164 ! concentrations of the different ice types_glt that fell into the same
165 ! thickness category.
166 !
167  tpsit(:,:)%fsi = sum(tplsit(:,:,:)%fsi,dim=1)
168 !
169 !
170 ! 2.2. Compute other merged 3D quantities
171 ! ---------------------------------------
172 !
173 ! .. Compute existence boolean, merged sea ice thicknesses, snow
174 ! thickness, surface temperature:
175 !
176  WHERE ( tpsit(:,:)%fsi>epsil1 )
177  tpsit(:,:)%esi = .true.
178  tpsit(:,:)%hsi = zvsi(:,:) / tpsit(:,:)%fsi
179  tpsit(:,:)%hsn = zvsn(:,:) / tpsit(:,:)%fsi
180  tpsit(:,:)%tsf = sum( &
181  tplsit(:,:,:)%fsi*tplsit(:,:,:)%tsf, dim=1 ) / &
182  tpsit(:,:)%fsi
183  tpsit(:,:)%asn = sum( &
184  tplsit(:,:,:)%fsi*tplsit(:,:,:)%asn, dim=1 ) / &
185  tpsit(:,:)%fsi
186  ENDWHERE
187  WHERE ( tpsit(:,:)%fsi<=epsil1 )
188  tpsit(:,:)%esi = .false.
189  tpsit(:,:)%hsi = 0.
190  tpsit(:,:)%hsn = 0.
191  tpsit(:,:)%tsf = zmlf3(:,:)
192  tpsit(:,:)%asn = albw
193  ENDWHERE
194 !
195 ! .. Compute snow density:
196 !
197  WHERE ( tpsit(:,:)%fsi>epsil1 .AND. tpsit(:,:)%hsn>epsil1 )
198  tpsit(:,:)%rsn = zmsn(:,:) / &
199  ( tpsit(:,:)%fsi*tpsit(:,:)%hsn )
200  ENDWHERE
201  WHERE ( tpsit(:,:)%fsi<=epsil1 .OR. tpsit(:,:)%hsn<=epsil1 )
202  tpsit(:,:)%rsn = rhosnwmin
203  ENDWHERE
204 !
205 ! .. Compute ice age:
206 !
207  IF ( niceage==1 ) THEN
208  WHERE ( tpsit(:,:)%fsi>epsil1 .AND. tpsit(:,:)%hsi>epsil1 )
209  tpsit(:,:)%age = zagevsi(:,:) / &
210  ( tpsit(:,:)%fsi*tpsit(:,:)%hsi )
211  ENDWHERE
212  WHERE ( tpsit(:,:)%fsi<=epsil1 .OR. tpsit(:,:)%hsi<=epsil1 )
213  tpsit(:,:)%age = 0.
214  ENDWHERE
215  ELSE
216  tpsit(:,:)%age = 0.
217  ENDIF
218 !
219 ! .. Compute ice salinity
220 !
221  IF ( nicesal==1 ) THEN
222  WHERE ( tpsit(:,:)%fsi>epsil1 .AND. tpsit(:,:)%hsi>epsil1 )
223  tpsit(:,:)%ssi = zssivsi(:,:) / &
224  ( tpsit(:,:)%fsi*tpsit(:,:)%hsi )
225  ENDWHERE
226  WHERE ( tpsit(:,:)%fsi<=epsil1 .OR. tpsit(:,:)%hsi<=epsil1 )
227  tpsit(:,:)%ssi = 0.
228  ENDWHERE
229  ENDIF
230 !
231 ! .. Compute melt pond volume:
232 !
233  IF ( nmponds==1 ) THEN
234  WHERE ( tpsit(:,:)%fsi>epsil1 .AND. tpsit(:,:)%hsi>epsil1 )
235  tpsit(:,:)%vmp = zvmpvsi(:,:) / &
236  ( tpsit(:,:)%fsi*tpsit(:,:)%hsi )
237  ENDWHERE
238  WHERE ( tpsit(:,:)%fsi<=epsil1 .OR. tpsit(:,:)%hsi<=epsil1 )
239  tpsit(:,:)%vmp = 0.
240  ENDWHERE
241  ELSE
242  tpsit(:,:)%vmp = 0.
243  ENDIF
244 !
245 !
246 ! 2.3. Compute merged 4D quantities
247 ! ---------------------------------
248 !
249 ! .. For the time being, only the temperature is concerned.
250 !
251 ! Ice
252 !
253  DO jl = 1,nilay
254  zaux(:,:) = sum( tplsit(:,:,:)%fsi*tplsit(:,:,:)%hsi* &
255  tplsil(:,jl,:,:)%ent,dim=1 )
256  WHERE ( tpsit(:,:)%fsi>epsil1 .AND. tpsit(:,:)%hsi>epsil1 )
257  tpsil(jl,:,:)%ent = zaux(:,:) / &
258  ( tpsit(:,:)%fsi*tpsit(:,:)%hsi )
259  ENDWHERE
260  END DO
261 !
262 ! Snow
263 !
264  DO jl = nilay+1,nl
265  zaux(:,:) = sum( tplsit(:,:,:)%fsi*tplsit(:,:,:)%hsn* &
266  tplsit(:,:,:)%rsn*tplsil(:,jl,:,:)%ent,dim=1 )
267  WHERE ( tpsit(:,:)%fsi>epsil1 .AND. tpsit(:,:)%hsn>epsil1 .AND. &
268  tpsit(:,:)%rsn>epsil1 )
269  tpsil(jl,:,:)%ent = zaux(:,:) / &
270  ( tpsit(:,:)%fsi*tpsit(:,:)%hsn*tpsit(:,:)%rsn )
271  ENDWHERE
272  END DO
273 !
274  DO jl = 1,nl
275  WHERE ( tpsit(:,:)%fsi<=epsil1 .OR. tpsit(:,:)%hsi<=epsil1 )
276  tpsil(jl,:,:)%ent = 0.
277  ENDWHERE
278  END DO
279 !
280 END SUBROUTINE gltools_mixice_r
281 !
282 ! ----------------------- END SUBROUTINE gltools_mixice_r -----------------------
283 ! -----------------------------------------------------------------------
subroutine gltools_mixice_r(tpmxl, tplsit, tplsil, tpsit, tpsil)