SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
modi_glt_updhsi_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_updhsi_r =========================
41 ! =======================================================================
42 !
43 ! Goal:
44 ! -----
45 ! Update the thickness of a sea ice cover, knowing the different
46 ! fluxes at the top and bottom of the slab.
47 !
48 ! Created : 2001/07 (D. Salas y Melia)
49 ! Taken out from thermo_ice routine.
50 ! Modified: 2009/06 (D. Salas y Melia)
51 ! Reduced grid
52 ! Modified: (A. Voldoire)
53 ! new ice/water fluxes interface CALL
54 ! Split of ice/water fluxes for melting and freezing for conservation
55 ! (not linear)
56 !
57 ! ---------------------- BEGIN MODULE modi_glt_updhsi_r ---------------------
58 !
59 !THXS_SFX!MODULE modi_glt_updhsi_r
60 !THXS_SFX!INTERFACE
61 !THXS_SFX!!
62 !THXS_SFX!SUBROUTINE glt_updhsi_r &
63 !THXS_SFX! ( pcondb,pqtopmelt,pdhmelt,tpmxl,tpdia,tptfl,tpsit,tpsil )
64 !THXS_SFX!!
65 !THXS_SFX! USE modd_types_glt
66 !THXS_SFX! USE modd_glt_param
67 !THXS_SFX! REAL, DIMENSION(nt,np), INTENT(in) :: &
68 !THXS_SFX! pcondb,pqtopmelt
69 !THXS_SFX! REAL, DIMENSION(nl,nt,np), INTENT(in) :: &
70 !THXS_SFX! pdhmelt
71 !THXS_SFX! TYPE(t_mxl), DIMENSION(np), INTENT(in) :: &
72 !THXS_SFX! tpmxl
73 !THXS_SFX! TYPE(t_dia), DIMENSION(np), INTENT(inout) :: &
74 !THXS_SFX! tpdia
75 !THXS_SFX! TYPE(t_tfl), DIMENSION(np), INTENT(inout) :: &
76 !THXS_SFX! tptfl
77 !THXS_SFX! TYPE(t_sit), DIMENSION(nt,np), INTENT(inout) :: &
78 !THXS_SFX! tpsit
79 !THXS_SFX! TYPE(t_vtp), DIMENSION(nl,nt,np), INTENT(inout) :: &
80 !THXS_SFX! tpsil
81 !THXS_SFX!END SUBROUTINE glt_updhsi_r
82 !THXS_SFX!!
83 !THXS_SFX!END INTERFACE
84 !THXS_SFX!END MODULE modi_glt_updhsi_r
85 !
86 ! ---------------------- END MODULE modi_glt_updhsi_r -----------------------
87 !
88 !
89 ! -----------------------------------------------------------------------
90 ! ------------------------- SUBROUTINE glt_updhsi_r -------------------------
91 !
92 SUBROUTINE glt_updhsi_r &
93  ( pcondb,pqtopmelt,pdhmelt,tpmxl,tpdia,tptfl,tpsit,tpsil )
94 !
96  USE modd_types_glt
97  USE modd_glt_param
98  USE modi_glt_updtfl_r
99  USE modi_glt_saltrap_r
100  USE modi_glt_frzvtp_r
101  USE modi_glt_mltvtp_r
102  USE mode_glt_stats_r
104 !
105  IMPLICIT NONE
106 !
107 !* Arguments
108 !
109  REAL, DIMENSION(nt,np), INTENT(in) :: &
110  pcondb,pqtopmelt
111  REAL, DIMENSION(nl,nt,np), INTENT(in) :: &
112  pdhmelt
113  TYPE(t_mxl), DIMENSION(np), INTENT(in) :: &
114  tpmxl
115  TYPE(t_dia), DIMENSION(np), INTENT(inout) :: &
116  tpdia
117  TYPE(t_tfl), DIMENSION(np), INTENT(inout) :: &
118  tptfl
119  TYPE(t_sit), DIMENSION(nt,np), INTENT(inout) :: &
120  tpsit
121  TYPE(t_vtp), DIMENSION(nl,nt,np), INTENT(inout) :: &
122  tpsil
123 !
124 !* Local variables
125 !
126  CHARACTER(4) :: &
127  yword
128  INTEGER :: &
129  jk,jl
130  LOGICAL, DIMENSION(np) :: &
131  yfreeze
132  REAL, DIMENSION(np) :: &
133  zfsit,zqtio,zwork,zssib,zentb,zdhsib,ztem
134  REAL, DIMENSION(nt,np) :: &
135  zlf,zhsi,zhsn,zssi,zdmsi,zdmsn,zqfac,zqres,zwork2,zent0,zqtio2,zhsi_m
136  REAL, DIMENSION(nilay,nt,np) :: &
137  zdhi
138 ! real,dimension(np) :: zei1,zei2,zes1,zes2
139 !
140 !
141 !
142 ! 1. Initializations
143 ! ==================
144 !
145 ! .. Enthalpy transfer between melted ice and ocean
146 !
147  zqtio2(:,:) = 0.
148 !
149 ! .. Total available flux (zqfac) and flux affecting the ocean (zqtio)
150 !
151  zfsit(:) = sum( tpsit(:,:)%fsi,dim=1 )
152  zqfac(:,:) = pcondb(:,:) + &
153  spread( tpmxl(:)%qoc + tpmxl(:)%qml,1,nt )
154 !write(noutlu,*) '(1) pdhmelt =',pdhmelt
155 !write(noutlu,*) '(7) pcondb =',pcondb
156 !write(noutlu,*) '(7) qoc =',tpmxl%qoc
157 !write(noutlu,*) '(7) qoc =',tpmxl%qml
158 !write(noutlu,*) '(7) qfac =',zqfac
159 !
160 ! .. Diagnostic of ocean-ice heat flux per m2 of the marine surface
161 !
162  tpdia(:)%qoi = tpdia(:)%qoi + tpmxl(:)%qoc*zfsit(:)
163 !
164 ! .. Heat flux sent to the ocean
165 !
166  zqtio(:) = - tpmxl(:)%qoc*zfsit(:) - tpmxl(:)%qml
167 !
168 ! .. Initial snow and ice thicknesses
169 !
170  zhsn(:,:)=tpsit(:,:)%hsn
171  zhsi(:,:)=tpsit(:,:)%hsi
172 !
173 ! .. Enthalpy of melting sea ice
174 !
175  zent0(:,:) = -cpsw * mu * tpsit(:,:)%ssi
176 !
177 !
178 !
179 ! 2. Treat sea ice temperatures exceeding melting point
180 ! ======================================================
181 !
182 ! 1) For every level, compute the energy flux that is necessary to
183 ! bring sea ice temperature down to tice_m
184 ! 2) Melt part of the concerned level
185 ! 3) If the level has melted completely, the rest of the energy is sent
186 ! to the mixed layer
187 !
188 !!write(noutlu,*)'zfsit=',zfsit
189 !!write(noutlu,*)'fsi =',tpsit%fsi
190  DO jl=1,nilay
191 !
192 ! Initialize sea ice vertical level thicknesses
193  zdhi(jl,:,:) = zhsi(:,:) * sf3tinv(jl)
194 !
195 !!write(noutlu,*)'****************** JL =',jl
196 !!write(noutlu,*) 'stop 1'
197 !!write(noutlu,*) 'zdhi(jl,2,:) = ',zdhi(jl,2,:)
198 !!write(noutlu,*) 'pdhmelt(jl,2,:) = ',pdhmelt(jl,2,:)
199 !!write(noutlu,*) '(6) qfac =',zqfac
200 !!write(noutlu,*) 'zqfac(2,:) = ',zqfac(2,:)
201 ! pdhmelt > 0 means that sea ice gltools_enthalpy is at its maximum
202 ! (i.e. sea ice has melted completely); sea ice gltools_enthalpy goes to the mixed layer
203  WHERE( pdhmelt(jl,:,:)>0. )
204  zqtio2(:,:) = zqtio2(:,:) + &
205  ( rhoice * zdhi(jl,:,:) * tpsil(jl,:,:)%ent + pdhmelt(jl,:,:) ) / dtt
206  zdhi(jl,:,:) = 0.
207 ! zqfac(:,:) = zqfac(:,:) + pdhmelt(jl,:,:)/dtt
208  ENDWHERE
209 !!write(noutlu,*) '(5) qfac =',zqfac
210 !!write(noutlu,*) 'stop 2'
211 !!write(noutlu,*) 'tpsil(jl,2,:)=',tpsil(jl,2,:)%ent
212 !!write(noutlu,*) 'zdhi(jl,2,:) = ',zdhi(jl,2,:)
213 !!write(noutlu,*) 'zqfac(2,:) = ',zqfac(2,:)
214 !
215 ! Melt some ice (if at this level sea ice temperature > tice_m)
216  WHERE( tpsil(jl,:,:)%ent>=zent0(:,:) .AND. zhsi(:,:)>0. )
217  zqtio2(:,:) = zqtio2(:,:) + &
218  rhoice*( tpsil(jl,:,:)%ent-zent0(:,:) )* zdhi(jl,:,:)/dtt
219 ! zqtio2(:,:) = zqtio2(:,:) + &
220 ! rhoice*zent0(:,:)*tpsit(:,:)%fsi*zdhi(jl,:,:)/dtt
221  zdhi(jl,:,:) = 0.
222  tpsil(jl,:,:)%ent = zent0(:,:)
223  ENDWHERE
224 !!write(noutlu,*) 'stop 3'
225 !!write(noutlu,*) 'tpsil(jl,2,:)=',tpsil(jl,2,:)%ent
226 !!write(noutlu,*) 'zdhi(jl,2,:) = ',zdhi(jl,2,:)
227 !!write(noutlu,*) '(4) qfac =',zqfac
228 !!write(noutlu,*) 'zqfac(2,:) = ',zqfac(2,:)
229 !
230  END DO
231 !
232 ! .. Diagnose top melting (Melting Rate Top) - negative if melting occurs
233 ! [kg.m-2.s-1]
234 !
235  tpdia(:)%mrt = &
236  rhoice*sum( &
237  tpsit(:,:)%fsi*( sum( zdhi(:,:,:),dim=1 )-tpsit(:,:)%hsi ), dim=1 )/dtt
238 !
239 !
240 !
241 ! 3. Case of basal sea ice melting
242 ! =================================
243 !
244 ! .. Now that zqfac is completely defined, update thickness of sea ice layers
245 !
246 !
247 ! 3.1. Update sea ice thickness (level by level)
248 ! -----------------------------------------------
249 !
250  DO jl=1,nilay
251 !
252 ! .. Note that this thickness can become negative if zqfac is too intense.
253 !!write(noutlu,*) '(7) qfac =',zqfac
254 !!write(noutlu,*) '(LOOP 4.1) qfac =',zqfac
255 !
256  WHERE ( zqfac(:,:)>0. .AND. zdhi(jl,:,:)>0. )
257  zdhi(jl,:,:) = zdhi(jl,:,:) + dtt*zqfac(:,:)/ &
258  ( tpsil(jl,:,:)%ent*rhoice )
259 !
260 ! No problem in melting current ice layer: all zqfac was used.
261  WHERE ( zdhi(jl,:,:)>=0. )
262  zqfac(:,:) = 0.
263 !
264 ! Current ice layer melting was not enough to use all of qmelt ;
265 ! zqfac will be used to melt all of or part of next ice level.
266  ELSEWHERE
267  zqfac(:,:) = rhoice*tpsil(jl,:,:)%ent*zdhi(jl,:,:) / dtt
268  zdhi(jl,:,:) = 0.
269  ENDWHERE
270 !
271  ENDWHERE
272 !!write(noutlu,*) '(LOOP 4.2) qfac =',zqfac
273 !!write(noutlu,*) 'zqfac residuel (jl=',jl,'), zqfac=',zqfac(2,:)
274 !
275  END DO
276 !
277 !
278 ! 3.2. Update snow thickness
279 ! --------------------------
280 !
281 ! .. If zqfac is still positive, it means all the sea ice has melted. All the
282 ! snow must disappear. All of/part of it contributes to reducing zqfac, the
283 ! rest will go to the mixed layer.
284 !
285 !!write(noutlu,*) '(8) qfac =',zqfac
286  zqres(:,:) = 0.
287  WHERE ( zqfac(:,:)>0. )
288  zqfac(:,:) = zqfac(:,:) + &
289  tpsit(:,:)%hsn*tpsit(:,:)%rsn/dtt * &
290  sum( tpsil(nilay+1:nl,:,:)%ent,dim=1 )/float(nslay)
291  zhsn(:,:) = 0.
292  WHERE ( zqfac(:,:)<0. ) ! Compute residual heat flux
293  zqres(:,:) = zqfac(:,:)
294  zqfac(:,:) = 0.
295  ENDWHERE
296  ENDWHERE
297 !
298 !!write(noutlu,*) '(3) qfac =',zqfac
299 !!write(noutlu,*) 'zqfac residuel apres neige zqfac=',zqfac(2,:)
300 !
301 !
302 !
303 ! 4. Correct temperature vertical profiles
304 ! =========================================
305 !
306 ! 4.1. Case of sea ice melting
307 ! -----------------------------
308 !
309 !CALL glt_aventh(tpsit,tpsil,zei1,zes1)
310 !print*,'Enthalpie avant =',zei1+zes1
311  CALL glt_mltvtp_r( zdhi,zhsi,tpsil )
312 !print*,'zqtio2 =',sum(zqtio2*tpsit%fsi,dim=1)
313 ! print*,'(2) zqfac=',sum(zqfac*tpsit%fsi,dim=1)
314 ! print*,'(2) zqres=',sum(zqres*tpsit%fsi,dim=1)
315 ! CHANGEMENT d'enthalpie = CHANGEMENT de zqfac
316 
317 ! Update water, heat and salt fluxes affecting the ocean due to melting
318  zdmsi(:,:) = rhoice * &
319  ( zhsi(:,:)-tpsit(:,:)%hsi ) * tpsit(:,:)%fsi
320  zhsi_m(:,:) = zhsi(:,:)
321  zwork2(:,:) = 0.
322  CALL glt_updtfl_r( 'I2O',tpmxl,tptfl,zdmsi,pent=zwork2,psalt=tpsit(:,:)%ssi )
323 ! print*,'Enthalpie envoyee a l ocean =',SUM(0.*zdmsi,dim=1)/dtt
324 !
325 !
326 ! 4.2. Case of sea ice freezing
327 ! ------------------------------
328 !
329 ! .. AR5 diagnostic: compute the rate of congelation at the base of the ice
330 ! slab due to the bottom conduction heat flux separately from other
331 ! processes (reproduce what is in glt_frzvtp_r, but for pcondb alone)
332 ! [kg.m-2.s-1]
333  tpdia(:)%cgl = 0.
334  DO jk=1,nt
335  ztem(:) = -2.
336  yfreeze(:) = ( pcondb(jk,:)<0. )
337  CALL glt_saltrap_r( yfreeze,pcondb(jk,:),ztem(:),tpmxl,zssib,zentb,zdhsib )
338  tpdia(:)%cgl = tpdia(:)%cgl + tpsit(jk,:)%fsi*zdhsib(:)
339  END DO
340  tpdia(:)%cgl = rhoice*tpdia(:)%cgl/dtt ! Convert to kg.m-2.s-1
341 !
342  CALL glt_frzvtp_r( tpmxl,tpsit,zqfac,zhsi,zssi,tpsil )
343 !
344 ! .. Sea ice freezing
345 ! - zqfac was completely used: set it to 0.
346 ! - reference salinity is computed by glt_frzvtp_r
347  WHERE( zqfac(:,:)<0. )
348  zqfac(:,:) = 0.
349  ENDWHERE
350 !
351 ! Update water, heat and salt fluxes affecting the ocean due to freezing
352  zdmsi(:,:) = rhoice * &
353  ( zhsi(:,:)-zhsi_m(:,:) ) * tpsit(:,:)%fsi
354  CALL glt_updtfl_r( 'I2O',tpmxl,tptfl,zdmsi,pent=zent0,psalt=zssi )
355 !
356 !
357 !
358 ! 5. Energy conservation
359 ! =======================
360 !
361 ! 5.1. Flux sent to the mixed layer due to residual zqfac and zqtio
362 ! ------------------------------------------------------------------
363 !
364 !!write(noutlu,*) '(avant) tio =',tptfl(:)%tio
365 !!write(noutlu,*) '(avant)qfac =',zqfac
366 !!write(noutlu,*) '(avant)qtio2=',zqtio2
367  tptfl(:)%tio = tptfl(:)%tio + &
368  sum( ( zqfac(:,:)+zqtio2(:,:)+zqres(:,:) )*tpsit(:,:)%fsi,dim=1 ) + &
369  zqtio(:)
370 !print*,'tio=',tptfl(:)%tio
371 !print*,'zqfac=',zqfac
372 !print*,'fsi=',tpsit%fsi
373 !print*,'zqtio2=',zqtio2
374 !print*,'zqtio=',zqtio
375 !print*,'zqres=',zqres
376  zqfac(:,:) = 0.
377 !!write(noutlu,*) '(apres) tio =',tptfl(:)%tio
378 !
379 !
380 ! 5.2. Compute involved fluxes of snow
381 ! ------------------------------------
382 !
383 ! .. Variation of snow mass due to vertical freezing/melting
384 !
385 ! If the ice has melted completely, the snow (if any) should go to the ocean
386 !
387  WHERE ( tpsit(:,:)%hsi<epsil1 .AND. tpsit(:,:)%fsi>=epsil1 )
388  zhsn(:,:) = 0.
389  ENDWHERE
390  zdmsn(:,:) = tpsit(:,:)%rsn * &
391  ( zhsn(:,:)-tpsit(:,:)%hsn ) * tpsit(:,:)%fsi
392 !
393 !
394 ! 5.3. Massic gltools_enthalpy of removed snow
395 ! -------------------------------------
396 !
397 ! Before going to the mixed layer, snow has been warmed up to gltools_enthalpy=0
398 ! Not needed anymore, done directly in glt_updtfl_r
399 ! zent0(:,:) = 0.
400 !
401 !
402 ! 5.4. Update water, heat and salt fluxes affecting the ocean
403 ! ------------------------------------------------------------
404 !
405  CALL glt_updtfl_r( 'FW2O',tpmxl,tptfl,zdmsn)
406 !
407 !
408 !
409 ! 6. Last updates
410 ! ===============
411 !
412 ! 6.1. AR5 diagnostic: bottom melting
413 ! ------------------------------------
414 !
415 ! .. We tried to separate congelation from ocean-heat flux melting at the
416 ! bottom of the sea ice slab. However, it may turn out that the diagnosed
417 ! sea ice mass vertical rate due to ocean-heat flux is positive. In this
418 ! case we set it to zero and increase the congelation ice growth rate.
419 !
420  tpdia(:)%mrb = sum( zdmsi(:,:),dim=1 )/dtt - tpdia(:)%cgl - tpdia(:)%mrt
421 !
422  WHERE( tpdia(:)%mrb>0. )
423  tpdia(:)%cgl = tpdia(:)%cgl + tpdia(:)%mrb
424  tpdia(:)%mrb = 0.
425  ENDWHERE
426 !
427 !
428 ! 6.2. All cases: update sea ice/snow thicknesses
429 ! -----------------------------------------------
430 !
431 ! .. Update ice layer thickness
432 !
433  tpsit(:,:)%hsi = zhsi(:,:)
434 !
435 ! .. Update snow layer thickness
436 !
437  tpsit(:,:)%hsn = zhsn(:,:)
438 !
439 !CALL glt_aventh(tpsit,tpsil,zei2,zes2)
440 !print*,'Enthalpie apres =',zei2+zes2
441 !print*,'Delta Enthalpie =',(zei2+zes2-zei1-zes1)/dtt
442 !
443 !
444 ! 6.3. Reinitialize a sea ice type in case of total melting
445 ! ---------------------------------------------------------
446 !
447  WHERE ( tpsit(:,:)%hsi<epsil1 .AND. tpsit(:,:)%fsi>=epsil1 )
448  tpsit(:,:)%esi = .false.
449  tpsit(:,:)%fsi = 0.
450  tpsit(:,:)%hsi = 0.
451  tpsit(:,:)%asn = albw
452  tpsit(:,:)%hsn = 0.
453  tpsit(:,:)%rsn = rhosnwmin
454  ENDWHERE
455 !
456  IF ( niceage==1 ) THEN
457  WHERE ( tpsit(:,:)%hsi<epsil1 .AND. tpsit(:,:)%fsi>=epsil1 )
458  tpsit(:,:)%age = 0.
459  ENDWHERE
460  ENDIF
461 !
462  IF ( nicesal==1 ) THEN
463  WHERE ( tpsit(:,:)%hsi<epsil1 .AND. tpsit(:,:)%fsi>=epsil1 )
464  tpsit(:,:)%ssi = 0.
465  ENDWHERE
466  ENDIF
467 !
468  IF ( nmponds==1 ) THEN
469  WHERE ( tpsit(:,:)%hsi<epsil1 .AND. tpsit(:,:)%fsi>=epsil1 )
470  tpsit(:,:)%vmp = 0.
471  ENDWHERE
472  ENDIF
473 !
474 END SUBROUTINE glt_updhsi_r
475 !
476 ! ----------------------- END SUBROUTINE glt_updhsi_r -----------------------
477 ! -----------------------------------------------------------------------
subroutine glt_saltrap_r(gfreeze, phef, ptem, tpmxl, psalt, pent, phsi)
subroutine glt_updtfl_r(hflag, tpmxl, tptfl, pdmass, pent, psalt)
subroutine glt_mltvtp_r(pdhi, phsi, tpsil)
subroutine glt_updhsi_r(pcondb, pqtopmelt, pdhmelt, tpmxl, tpdia, tptfl, tpsit, tpsil)
subroutine glt_frzvtp_r(tpmxl, tpsit, pqfac, phsi, pssi, tpsil)