SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
modi_glt_thermo_end_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_thermo_end_r ======================
41 ! =======================================================================
42 !
43 !
44 ! * Previous calls to other thermodynamic subroutines may have led to
45 ! disruptions in ice types_glt classification, for several reasons :
46 ! - an ice type has grown in thickness, moving to the next class.
47 ! - an ice type has disappeared totally because of lateral or
48 ! (and) vertical melting.
49 ! - sea ice may has grown on an open water surface.
50 !
51 ! * The goal of the present subroutine is to assess which ice type(s)
52 ! are now in the different classes. If necessary, merge them, as well
53 ! as associated leads.
54 !
55 ! Modified : 2007/11 (D. Salas y Melia)
56 ! thick(jh) < Hsi < thick(jh+1) is not correct: misses cases
57 ! like Hsi = thick(jh)
58 ! corrected to: thick(jh) < Hsi <= thick(jh+1)
59 ! Modified : 2009/06 (D. Salas y Melia)
60 ! Reduced grid version
61 !
62 ! ------------------- BEGIN MODULE modi_glt_thermo_end_r --------------------
63 
64 !THXS_SFX!MODULE modi_glt_thermo_end_r
65 !THXS_SFX!INTERFACE
66 !THXS_SFX!
67 !THXS_SFX!SUBROUTINE glt_thermo_end_r( tpdom,tpml,tpldsit,tpldsil,tpsit,tpsil )
68 !THXS_SFX!!
69 !THXS_SFX! USE modd_types_glt
70 !THXS_SFX! USE modd_glt_param
71 !THXS_SFX!
72 !THXS_SFX!! --- INTENT(in) arguments.
73 !THXS_SFX! TYPE(t_dom), DIMENSION(np), INTENT(in) :: &
74 !THXS_SFX! tpdom
75 !THXS_SFX! TYPE(t_mxl), DIMENSION(np), INTENT(in) :: &
76 !THXS_SFX! tpml
77 !THXS_SFX! TYPE(t_sit), DIMENSION(nt,np), INTENT(in) :: &
78 !THXS_SFX! tpldsit
79 !THXS_SFX! TYPE(t_vtp), DIMENSION(nl,nt,np), INTENT(in) :: &
80 !THXS_SFX! tpldsil
81 !THXS_SFX!
82 !THXS_SFX!! --- INTENT(inout) arguments.
83 !THXS_SFX! TYPE(t_sit), DIMENSION(nt,np), INTENT(inout) :: &
84 !THXS_SFX! tpsit
85 !THXS_SFX! TYPE(t_vtp), DIMENSION(nl,nt,np), INTENT(inout) :: &
86 !THXS_SFX! tpsil
87 !THXS_SFX!END SUBROUTINE glt_thermo_end_r
88 !THXS_SFX!
89 !THXS_SFX!END INTERFACE
90 !THXS_SFX!END MODULE modi_glt_thermo_end_r
91 
92 ! -------------------- END MODULE modi_glt_thermo_end_r ---------------------
93 
94 
95 
96 ! -----------------------------------------------------------------------
97 ! ----------------------- SUBROUTINE glt_thermo_end_r -----------------------
98 
99 SUBROUTINE glt_thermo_end_r( tpdom,tpml,tpldsit,tpldsil,tpsit,tpsil )
100 !
101 !
102 ! 1. Declarations
103 ! ================
104 !
105 ! 1.1. Module declarations
106 ! -------------------------
107 !
108  USE modd_types_glt
109  USE modd_glt_param
111  USE modi_gltools_mixice_r
112  USE modi_gltools_chkglo_r
113 !
114  IMPLICIT NONE
115 !
116 !
117 ! 1.2. Dummy arguments declarations
118 ! ----------------------------------
119 !
120 ! --- INTENT(in) arguments.
121  TYPE(t_dom), DIMENSION(np), INTENT(in) :: &
122  tpdom
123  TYPE(t_mxl), DIMENSION(np), INTENT(in) :: &
124  tpml
125  TYPE(t_sit), DIMENSION(nt,np), INTENT(in) :: &
126  tpldsit
127  TYPE(t_vtp), DIMENSION(nl,nt,np), INTENT(in) :: &
128  tpldsil
129 !
130 ! --- INTENT(inout) arguments.
131  TYPE(t_sit), DIMENSION(nt,np), INTENT(inout) :: &
132  tpsit
133  TYPE(t_vtp), DIMENSION(nl,nt,np), INTENT(inout) :: &
134  tpsil
135 !
136 !
137 ! 1.3. Local variables declarations
138 ! ----------------------------------
139 
140  INTEGER :: &
141  it,jp,jh,jk,intype
142  INTEGER, DIMENSION(nt,np) :: &
143  inbth_in_cl
144  REAL, DIMENSION(np) :: &
145  z2_scell
146  TYPE(t_sit), DIMENSION(:,:,:), ALLOCATABLE :: &
147  tzsit
148  TYPE(t_vtp), DIMENSION(:,:,:,:), ALLOCATABLE :: &
149  tzsil
150 !
151 !
152 !
153 ! 2. Initializations
154 ! ===================
155 !
156 ! 2.1. Welcome message
157 ! ---------------------
158 !
159  IF (lp1) THEN
160  WRITE(noutlu,*) ' '
161  WRITE(noutlu,*) '**** LEVEL 4 - SUBROUTINE THERMO_END_R'
162  WRITE(noutlu,*) ' '
163  ENDIF
164 !
165 !
166 ! 2.2. Check in
167 ! --------------
168 !
169  CALL gltools_chkglo_r( 'Before THERMO_END_R',tpdom,tpsit )
170 !
171 !
172 !
173 ! 3. Final computation of thermodynamic variables
174 ! ================================================
175 !
176 ! 3.1. Merging newly frozen ice with the rest of the ice
177 ! -------------------------------------------------------
178 !
179 ! .. inbth_in_cl(jk,jp) gives the number of ice types_glt which are now
180 ! gathered in class number jk = ]thick(jk), thickl(jk+1)] at (jp)
181 ! grid point.
182 !
183 ! - Initialize inbth_in_cl.
184 !
185  inbth_in_cl(:,:) = 0
186 !
187 ! .. Include first ice formed in leads into sea ice types_glt count, then
188 ! sea ice that was already present.
189 !
190  DO jk = 1,nt
191  DO jh = 1,nt
192  WHERE (tpldsit(jk,:)%esi .AND. thick(jh)<tpldsit(jk,:)%hsi &
193  .AND. tpldsit(jk,:)%hsi<=thick(jh+1))
194  inbth_in_cl(jh,:) = inbth_in_cl(jh,:) + 1
195  ENDWHERE
196  WHERE (tpsit(jk,:)%esi .AND. thick(jh)<tpsit(jk,:)%hsi &
197  .AND. tpsit(jk,:)%hsi<=thick(jh+1))
198  inbth_in_cl(jh,:) = inbth_in_cl(jh,:) + 1
199  ENDWHERE
200  END DO
201  END DO
202 !
203 ! .. Determine (on the whole domain) what is the maximum number of sea
204 ! ice types_glt gathered in the same class.
205 !
206  intype = maxval(inbth_in_cl(:,:))
207 !
208 ! .. Allocate memory to the arrays that contains all ice types_glt existing
209 ! on the domain (formatted input to gltools_mixice_r subroutine).
210 !
211  ALLOCATE(tzsit(intype,nt,np))
212  ALLOCATE(tzsil(intype,nl,nt,np))
213 !
214 ! .. Re-initialize inbth_in_cl(:,:)
215 !
216  inbth_in_cl(:,:) = 0
217 !
218 ! .. Compute tzsit and tzsil arrays.
219 ! (the following should be improved by the use of pointers).
220 !
221 ! .. Initialize ice thermodynamics and vertical temperature profile
222 !
223  tzsit(:,:,:)%esi = .false.
224  tzsit(:,:,:)%asn = albw
225  tzsit(:,:,:)%fsi = 0.
226  tzsit(:,:,:)%hsi = 0.
227  tzsit(:,:,:)%hsn = 0.
228  tzsit(:,:,:)%rsn = rhosnwmax
229  tzsit(:,:,:)%tsf = spread(spread(tpml(:)%tml,1,nt),1,intype)
230  tzsit(:,:,:)%age = 0.
231  tzsit(:,:,:)%ssi = spread(spread(tpml(:)%sml,1,nt),1,intype)
232  tzsit(:,:,:)%vmp = 0.
233 !
234 ! .. Ice vertical gltools_enthalpy profile.
235 !
236  tzsil(:,:,:,:)%ent = -xmhofusn0
237 !
238  DO jp = 1,np
239  DO jk = 1,nt
240  DO jh = 1,nt
241 !
242 ! .. Case of new ice that was formed on leads
243 !
244  IF (tpldsit(jk,jp)%esi .AND. &
245  thick(jh)<tpldsit(jk,jp)%hsi .AND. &
246  tpldsit(jk,jp)%hsi<=thick(jh+1)) THEN
247 !
248  inbth_in_cl(jh,jp) = inbth_in_cl(jh,jp) + 1
249  it = inbth_in_cl(jh,jp)
250 !
251  tzsit(it,jh,jp)%esi = tpldsit(jk,jp)%esi
252  tzsit(it,jh,jp)%asn = tpldsit(jk,jp)%asn
253  tzsit(it,jh,jp)%fsi = tpldsit(jk,jp)%fsi
254  tzsit(it,jh,jp)%hsi = tpldsit(jk,jp)%hsi
255  tzsit(it,jh,jp)%hsn = tpldsit(jk,jp)%hsn
256  tzsit(it,jh,jp)%rsn = tpldsit(jk,jp)%rsn
257  tzsit(it,jh,jp)%tsf = tpldsit(jk,jp)%tsf
258  tzsil(it,:,jh,jp)%ent = tpldsil(:,jk,jp)%ent
259  tzsit(it,jh,jp)%age = tpldsit(jk,jp)%age
260  tzsit(it,jh,jp)%ssi = tpldsit(jk,jp)%ssi
261  tzsit(it,jh,jp)%vmp = tpldsit(jk,jp)%vmp
262  ENDIF
263 !
264 ! .. Case of 'older' ice
265 !
266  IF (tpsit(jk,jp)%esi .AND. &
267  thick(jh)<tpsit(jk,jp)%hsi .AND. &
268  tpsit(jk,jp)%hsi<=thick(jh+1)) THEN
269 !
270  inbth_in_cl(jh,jp) = inbth_in_cl(jh,jp) + 1
271  it = inbth_in_cl(jh,jp)
272 !
273  tzsit(it,jh,jp)%esi = tpsit(jk,jp)%esi
274  tzsit(it,jh,jp)%asn = tpsit(jk,jp)%asn
275  tzsit(it,jh,jp)%fsi = tpsit(jk,jp)%fsi
276  tzsit(it,jh,jp)%hsi = tpsit(jk,jp)%hsi
277  tzsit(it,jh,jp)%hsn = tpsit(jk,jp)%hsn
278  tzsit(it,jh,jp)%rsn = tpsit(jk,jp)%rsn
279  tzsit(it,jh,jp)%tsf = tpsit(jk,jp)%tsf
280  tzsil(it,:,jh,jp)%ent = tpsil(:,jk,jp)%ent
281  tzsit(it,jh,jp)%age = tpsit(jk,jp)%age
282  tzsit(it,jh,jp)%ssi = tpsit(jk,jp)%ssi
283  tzsit(it,jh,jp)%vmp = tpsit(jk,jp)%vmp
284  ENDIF
285  END DO
286  END DO
287  END DO
288 !
289 ! .. Mix together all ice types_glt that are gathered in the same class.
290 !
291  CALL gltools_mixice_r(tpml,tzsit,tzsil,tpsit,tpsil)
292 !
293 ! .. Deallocate auxiliary arrays memory.
294 !
295  DEALLOCATE(tzsil)
296  DEALLOCATE(tzsit)
297 !
298 !
299 ! 3.2. Increment ice age
300 ! -----------------------
301 !
302  IF ( niceage==1 ) THEN
303  WHERE ( tpsit(:,:)%fsi>epsil1 )
304  tpsit(:,:)%age = tpsit(:,:)%age + dtt
305  ENDWHERE
306  ENDIF
307 !
308 !
309 ! 3.3. Check out
310 ! ---------------
311 !
312  CALL gltools_chkglo_r( 'After THERMO_END_R',tpdom,tpsit )
313 !
314 !
315 ! 3.4. Farewell message
316 ! ----------------------
317 !
318  IF (lp1) THEN
319  WRITE(noutlu,*) ' '
320  WRITE(noutlu,*) '**** LEVEL 4 - END SUBROUTINE THERMO_END_R'
321  WRITE(noutlu,*) ' '
322  ENDIF
323 !
324 END SUBROUTINE glt_thermo_end_r
325 !
326 ! -------------------- END SUBROUTINE glt_thermo_end_r ----------------------
327 ! -----------------------------------------------------------------------
subroutine gltools_mixice_r(tpmxl, tplsit, tplsil, tpsit, tpsil)
subroutine gltools_chkglo_r(omsg, tpdom, tpsit)
subroutine glt_thermo_end_r(tpdom, tpml, tpldsit, tpldsil, tpsit, tpsil)