SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
modi_glt_constrain_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_constrain_r ====================
41 ! =======================================================================
42 !
43 ! Goal:
44 ! -----
45 ! This module contains a subroutine that allows to constrain
46 ! sea ice. So far, the only option is newtonian damping. The variables
47 ! that can be constrained are: ice surface temperature, concentration
48 ! and thickness.
49 !
50 ! Method:
51 ! -------
52 ! Newtonian damping. This method does not ensure energy is conserved.
53 ! Note that prescribing sea ice concentration and thickness can lead to
54 ! conflicts if constraints are contradictory (e.g. constraining
55 ! thickness to 1m but concentration to 0). Note that we chose to constrain
56 ! sea ice concentration last (seen as more important...)
57 !
58 ! Created : 2012/03 (D. Salas y Melia)
59 ! Modified: 2015/07 (D. Salas y Melia) Complete rewriting; suppress
60 ! multi-category damping, and add the possibility to prescribe sea ice
61 ! fraction and/or thickness.
62 !
63 ! ------------------ BEGIN MODULE modi_glt_constrain_r ------------------
64 !
65 !THXS_SFX!MODULE modi_glt_constrain_r
66 !THXS_SFX!INTERFACE
67 !THXS_SFX!!
68 !THXS_SFX!SUBROUTINE glt_constrain_r( tpdom,tpmxl,tpsit,tpsil,tpdia,tpsit_d )
69 !THXS_SFX! USE modd_types_glt
70 !THXS_SFX! USE modd_glt_param
71 !THXS_SFX! TYPE(t_dom), DIMENSION(np), INTENT(in) :: &
72 !THXS_SFX! tpdom
73 !THXS_SFX! TYPE(t_mxl), DIMENSION(np), INTENT(inout) :: &
74 !THXS_SFX! tpmxl
75 !THXS_SFX! TYPE(t_sit), DIMENSION(nt,np), INTENT(inout) :: &
76 !THXS_SFX! tpsit
77 !THXS_SFX! TYPE(t_vtp), DIMENSION(nt,np), INTENT(inout) :: &
78 !THXS_SFX! tpsil
79 !THXS_SFX! TYPE(t_dia), DIMENSION(np), INTENT(inout) :: &
80 !THXS_SFX! tpdia
81 !THXS_SFX! TYPE(t_sit), DIMENSION(ntd,np), INTENT(in) :: &
82 !THXS_SFX! tpsit_d
83 !THXS_SFX!END SUBROUTINE glt_constrain_r
84 !THXS_SFX!!
85 !THXS_SFX!END INTERFACE
86 !THXS_SFX!END MODULE modi_glt_constrain_r
87 !
88 ! --------------------- END MODULE modi_glt_constrain_r ---------------------
89 !
90 !
91 ! -----------------------------------------------------------------------
92 ! ---------------------- SUBROUTINE glt_constrain_r ---------------------
93 !
94 !
95 SUBROUTINE glt_constrain_r( tpdom,tpmxl,tpsit,tpsil,tpdia,tpsit_d )
96  USE modd_types_glt
97  USE modd_glt_param
100  USE modi_gltools_newice_r
102  USE modi_gltools_glterr
103 !
104  IMPLICIT NONE
105 !
106  TYPE(t_dom), DIMENSION(np), INTENT(in) :: &
107  tpdom
108  TYPE(t_mxl), DIMENSION(np), INTENT(inout) :: &
109  tpmxl
110  TYPE(t_sit), DIMENSION(nt,np), INTENT(inout) :: &
111  tpsit
112  TYPE(t_vtp), DIMENSION(nt,np), INTENT(inout) :: &
113  tpsil
114  TYPE(t_dia), DIMENSION(np), INTENT(inout) :: &
115  tpdia
116  TYPE(t_sit), DIMENSION(ntd,np), INTENT(in) :: &
117  tpsit_d
118 !
119  LOGICAL :: &
120  gcontinue
121  INTEGER, PARAMETER :: &
122  ppcent=0.01
123  INTEGER :: &
124  jk,jp
125  REAL :: &
126  zmin,zdhsit,zfsit0
127  REAL, DIMENSION(np) :: &
128  zdamp,zwork,zfsit_i,zhsit_i,zfac,zfacfsi, &
129  zenti_i,zents_i,zenti_f,zents_f
130  REAL, DIMENSION(nt,np) :: &
131  zfsi,zhsi,zfsinew,zhsinew
132 !
133 !
134 !
135 ! 1. Initialization
136 ! ==================
137 !
138 ! .. Initial snow and ice enthalpy
139 !
140  CALL glt_aventh( tpsit,tpsil,zenti_i,zents_i )
141 !
142 ! .. Global initializations
143 !
144  tpdia(:)%dci = 0.
145 !
146 !
147 !
148 ! 2. Damp sea ice thickness
149 ! ==========================
150 !
151  IF ( chsidmp(1:4)=='DAMP' .OR. trim(chsidmp)=='PRESCRIBE' ) THEN
152 !
153 ! Initial state
154 !
155  zfsinew(:,:) = tpsit(:,:)%fsi
156  zhsinew(:,:) = tpsit(:,:)%hsi
157  zfsit_i(:) = sum( tpsit(:,:)%fsi,dim=1 ) ! sea ice total concentration
158  zhsit_i(:) = glt_avhicem_r( tpsit ) ! sea ice mean thickness
159 !
160 ! These arrays need to be initialized here but also in the sea ice
161 ! concentration section
162 !
163  zfsi(:,:) = 0.
164  zhsi(:,:) = 0.
165 !
166 ! .. Check thickness data toward which we would like to restore
167 !
168  IF ( (SIZE(tpsit_d(1,:)%hsi) > 0) .AND. &
169  (maxval( tpsit_d(1,:)%hsi ) < -1.) ) THEN
170  CALL gltools_glterr( 'constrain_r', &
171  'Wrong ice thickness damping data (all %hsi < -1).','STOP' )
172  ENDIF
173 !
174  DO jp=1,np
175 !
176 ! .. Compute sea ice thickness change (damping case)
177 !
178  IF ( chsidmp(1:4)=='DAMP' ) THEN
179  zdhsit = dtt / ( xhsidmpeft*xday2sec ) * &
180  ( tpsit_d(1,jp)%hsi - zhsit_i(jp) )
181  ELSE IF ( trim(chsidmp)=='PRESCRIBE' ) THEN
182  zdhsit = tpsit_d(1,jp)%hsi - zhsit_i(jp)
183  ENDIF
184 !
185  IF ( zfsit_i(jp)>epsil1 ) THEN
186 !
187 !
188 ! 2.1. Method #1: add the same correction to all categories
189 ! ----------------------------------------------------------
190 !
191 ! .. Now, modify the thickness of the ice categories to modify the mean
192 ! ice thickness by zdhsit. Note the contribution of a dynamic bias should
193 ! be proportional to the thickness of every category. This will not be the
194 ! case at all for thermodynamic biases (due to e.g. an atmospheric radiative
195 ! bias or an ocean temperature bias). In more detail (examples):
196 ! - ocean heat flux bias: affects all ice categories in the same way
197 ! - air temperature bias: affects heat conduction (broadly proportional
198 ! to the inverse of ice thickness)
199 ! - SW radiative bias: tends to affect all ice categories in the same way
200 !
201 ! .. Update ice thickness
202 !
203  IF ( trim(chsidmp)=='DAMP_ADD' .OR. trim(chsidmp)=='PRESCRIBE') THEN
204  gcontinue = .true.
205  zfsit0 = zfsit_i(jp)
206  jk=0
207  DO WHILE( gcontinue .AND. jk<=5 )
208  jk=jk+1
209  zmin = minval(zhsinew(:,jp),mask=zfsinew(:,jp)>epsil1)
210 ! First case: sea thickness is uniformly increased to meet the constraint
211 ! (no problem), or sea ice thickness that is uniformly removed is less than
212 ! minimum thickness for all categories.
213  IF ( zdhsit/zfsit0+zmin>0. ) THEN
214  WHERE( zfsinew(:,jp)>epsil1 )
215  zhsinew(:,jp) = zhsinew(:,jp) + zdhsit/zfsit0
216  ENDWHERE
217  gcontinue = .false.
218 ! Second case: first, uniformly remove zmin to all categories, then remove
219 ! more ice to the remaining categories, until the constraint is met.
220  ELSE
221  WHERE( zfsinew(:,jp)>epsil1 )
222  zhsinew(:,jp) = zhsinew(:,jp)-zmin
223  ENDWHERE
224  zdhsit = zdhsit+zmin*zfsit0
225  ENDIF
226  WHERE ( zhsinew(:,jp)<epsil1 )
227  zfsinew(:,jp)=0.
228  ENDWHERE
229  zfsit0 = sum( zfsinew(:,jp) )
230  END DO
231 !
232  WHERE ( tpsit(:,jp)%hsi>epsil1 .AND. zhsinew(:,jp)<=epsil1 )
233  tpsit(:,jp)%esi = .false.
234  ENDWHERE
235 !
236 !
237 ! 2.2. Method #2: multiply all thicknesses by a factor
238 ! -----------------------------------------------------
239 !
240  ELSE IF ( trim(chsidmp)=='DAMP_FAC' ) THEN
241  zfac(jp) = 1.
242  IF ( zhsit_i(jp)>epsil1 ) THEN
243  zfac(jp) = 1. + zdhsit/zhsit_i(jp)
244  ENDIF
245 !
246 ! Define a multiplicative factor for sea ice concentration (to help reducing or
247 ! increasing sea ice thickness)
248  zfacfsi(jp) = 1.
249  IF ( abs(zfac(jp)-1.) > ppcent ) THEN
250 ! Low values of the factor: decrease sea ice concentration to contribute to
251 ! reducing mean sea ice thickness
252  IF ( zfac(jp) < 1.-ppcent ) THEN
253  zfacfsi(jp) = zfac(jp)/(1.-ppcent)
254  zfac(jp) = 1.-ppcent
255 ! High values of the factor: increase very low sea ice concentrations,
256 ! but not more than 0.15
257  ELSE
258  IF ( zfsit_i(jp)<xfsic ) THEN
259  zfacfsi(jp) = exp( dtt/(3.*xday2sec)*log( xfsic/zfsit_i(jp) ) )
260  zfac(jp) = amin1( zfac(jp)/zfacfsi(jp),1.+ppcent )
261  ENDIF
262  ENDIF
263  ENDIF
264 !
265 ! We do not want to modify sea ice thickness by more than 1%, in order to
266 ! avoid runaway thickness of categories
267  zfsinew(:,jp) = zfacfsi(jp) * tpsit(:,jp)%fsi
268  zhsinew(:,jp) = zfac(jp) * tpsit(:,jp)%hsi
269  ENDIF
270 !
271  ELSE ! IF zfsit_i(jp)<=epsil1
272 !
273 ! Case without initial sea ice: DAMP_ADD or DAMP_FAC plays no role
274  zfsi(1,jp) = xfsic
275  zhsi(1,jp) = zdhsit / xfsic
276  ENDIF
277  END DO ! Loop on jp
278 !
279  tpsit(:,:)%hsi = zhsinew(:,:)
280  tpsit(:,:)%fsi = zfsinew(:,:)
281 !
282 ! This routine will be active only where zfsi(:,:)>=epsil1 and tpsit(:,:)<epsil1
283 !
284  CALL gltools_newice_r( zfsi,zhsi,tpmxl,tpsit,tpsil )
285 !
286 ! Add rate of change of sea ice mass due to thickness constraint
287 !
288  tpdia(:)%dci = tpdia(:)%dci + &
289  rhoice * ( glt_avhicem_r(tpsit) - zhsit_i(:) ) / dtt
290 !
291  ENDIF
292 !
293 !
294 !
295 ! 3. Damp/prescribe sea ice concentration
296 ! ========================================
297 !
298 ! Note that concentration should be damped before thickness
299 ! (if both are damped)
300 !
301 ! We assume here that we modify sea ice concentrations, without
302 ! conserving total, nor per-category, ice volume.
303 ! If total sea ice concentration is less than epsil1=1.e-10, we consider
304 ! there was no sea ice at all initially, meaning that we must create
305 ! new sea ice from nothing.
306 !
307  IF ( trim(cfsidmp)=='DAMP' .OR. trim(cfsidmp)=='PRESCRIBE' ) THEN
308 !
309 ! Initial state
310 !
311  zfsinew(:,:) = tpsit(:,:)%fsi
312  zhsinew(:,:) = tpsit(:,:)%hsi
313  zfsit_i(:) = sum( tpsit(:,:)%fsi,dim=1 ) ! sea ice total concentration
314  zhsit_i(:) = glt_avhicem_r( tpsit ) ! sea ice mean thickness
315 !
316 ! These arrays need to be initialized here but also in the sea ice thickness
317 ! damping section
318 !
319  zfsi(:,:) = 0.
320  zhsi(:,:) = 0.
321 !
322 ! .. Check concentration data toward which we would like to restore
323 !
324  IF ( (SIZE(tpsit_d(1,:)%fsi) > 0) .AND. &
325  ( minval( tpsit_d(1,:)%fsi ) < 0. .OR. &
326  maxval( tpsit_d(1,:)%fsi ) > 1. )) THEN
327  CALL gltools_glterr( 'constrain_r', &
328  'Wrong ice concentration damping data &
329  & (probably given in % instead of fraction of unity).','STOP' )
330  ENDIF
331  DO jp=1,np
332 !
333  IF ( zfsit_i(jp)>epsil1 ) THEN
334 !
335 ! .. Case 1: total sea ice fraction > epsil1
336 !
337  IF ( trim(cfsidmp)=='DAMP' ) THEN
338  zdamp(jp) = dtt / ( xfsidmpeft*xday2sec ) * &
339  ( min(tpsit_d(1,jp)%fsi,xfsimax) - zfsit_i(jp) )
340 !
341  DO jk=1,nt
342  tpsit(jk,jp)%fsi = tpsit(jk,jp)%fsi * &
343  ( 1. + zdamp(jp) / zfsit_i(jp) )
344 ! Conserve sea ice volume
345  tpsit(jk,jp)%hsi = tpsit(jk,jp)%hsi / &
346  ( 1. + zdamp(jp) / zfsit_i(jp) )
347  END DO
348 !
349  ELSE IF ( trim(cfsidmp)=='PRESCRIBE' ) THEN
350  zwork(jp) = max( &
351  min(tpsit_d(1,jp)%fsi,xfsimax) / zfsit_i(jp), epsil1 )
352  DO jk=1,nt
353  tpsit(jk,jp)%fsi = tpsit(jk,jp)%fsi * zwork(jp)
354 ! Conserve sea ice volume
355  tpsit(jk,jp)%hsi = tpsit(jk,jp)%hsi / zwork(jp)
356  END DO
357 !
358  ENDIF
359 !
360  ELSE ! IF zfsit_i(jp)<=epsil1
361 !
362 ! .. Case 2: total sea ice fraction <= epsil1
363 !
364 ! If zfsit_i<=epsil1, the concentration of every category tpsit(jk,:)<=epsil1.
365 ! In particular, the thinnest category has a concentration <=epsil1. If new
366 ! ice has to appear here, we decide to increase only the concentration of the
367 ! thinnest category, and to assign it a small thickness, in order to limit
368 ! the ice volume change.
369 ! Note that if this concentration constraint is not consistent with the
370 ! thickness constraint (e.g. hsi_d = 0. but fsi_d /= 0.), we choose to respect
371 ! the concentration constraint but not the thickness constraint.
372 !
373  IF ( trim(cfsidmp)=='DAMP' ) THEN
374  zfsi(1,jp) = dtt / ( xfsidmpeft*xday2sec ) * &
375  ( min(tpsit_d(1,jp)%fsi,xfsimax) - zfsit_i(jp) )
376  ELSE IF ( trim(cfsidmp)=='PRESCRIBE' ) THEN
377  zfsi(1,jp) = min(tpsit_d(1,jp)%fsi,xfsimax)
378  ENDIF
379  zhsi(1,jp) = xhsimin
380 !
381  ENDIF
382 !
383  END DO ! Loop on jp
384 !
385 ! This routine will be active only where zfsi(:,:)>=epsil1 and tpsit(:,:)<epsil1
386 !
387  CALL gltools_newice_r( zfsi,zhsi,tpmxl,tpsit,tpsil )
388 !
389 ! We want to make sure that the new total sea ice concentration does not
390 ! exceed xfsimax
391 !
392  zwork(:) = sum( tpsit(:,:)%fsi,dim=1 )
393  DO jk=1,nt
394  WHERE ( zwork(:) > xfsimax )
395  tpsit(jk,:)%fsi = tpsit(jk,:)%fsi * xfsimax / zwork(:)
396  ENDWHERE
397  END DO
398 !
399 ! Add rate of change of sea ice mass due to ice concentration constraint
400 !
401  tpdia(:)%dci = tpdia(:)%dci + &
402  rhoice * ( glt_avhicem_r(tpsit) - zhsit_i(:) ) / dtt
403 !
404 ! Diagnose constraint
405 !
406  tpdia(:)%cst = 100.*tpsit_d(1,:)%fsi
407 !
408  ENDIF
409 !
410 !
411 !
412 ! 4. Final operations
413 ! ====================
414 !
415 ! .. Diagnose changes in snow/ice enthalpy due to damping/restoring
416 ! (there is no separation of the effects of the different operations)
417 !
418  CALL glt_aventh( tpsit,tpsil,zenti_f,zents_f )
419  tpdia(:)%dmp = ( zenti_f+zents_f-zenti_i-zents_i ) / dtt
420 !
421 END SUBROUTINE glt_constrain_r
422 !
423 ! ------------------- END SUBROUTINE glt_constrain_r --------------------
424 ! -----------------------------------------------------------------------
subroutine gltools_glterr(hroutine, hmess, hflag)
subroutine gltools_newice_r(pfsi, phsi, tpmxl, tpsit, tpsil, ptsf, pssi, phsn, prsn, pasn, pent)
subroutine glt_constrain_r(tpdom, tpmxl, tpsit, tpsil, tpdia, tpsit_d)