SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
modi_glt_sndmlrf.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_sndmlrf =========================
41 ! =======================================================================
42 !
43 ! This routine was created for Gelato version 3, i.e. Gelato is under the
44 ! form of a routine inserted in the OPA 8 code.
45 ! It allows Gelato to transmit the forcing the ocean needs as a routine
46 ! glt_output argument.
47 !
48 ! Created : 10/1999 (D. Salas y Melia)
49 ! Modified: 02/2000 (D. Salas y Melia)
50 ! Suppress the computation of stress derivatives
51 ! Modified: 08/2009 (D. Salas y Melia)
52 ! Adaptation to the new Gelato interface
53 ! Modified: 06/2010 (D. Salas y Melia)
54 ! Collects the mass of snow that is lost/gained due to advection
55 ! processes and redistribute it under sea ice (by hemisphere)
56 ! Modified: 12/2011 (A. Voldoire)
57 ! New ice/water fluxes interface CALL + add sio from tzdfl to tptfl
58 ! Modified: 07/2012 (D. Salas y Melia)
59 ! Parallelism
60 !
61 ! --------------------- BEGIN MODULE modi_glt_sndmlrf -----------------------
62 !
63 !THXS_SFX!MODULE modi_glt_sndmlrf
64 !THXS_SFX!INTERFACE
65 !THXS_SFX!!
66 !THXS_SFX!SUBROUTINE glt_sndmlrf(pbathy,tpdom,tpatc,tpml,tpdia,tpsit,tptfl, &
67 !THXS_SFX! pustar,tpall_oce )
68 !THXS_SFX! USE modd_types_glt
69 !THXS_SFX! USE modd_glt_param
70 !THXS_SFX! REAL, DIMENSION(nx,ny), INTENT(in) :: &
71 !THXS_SFX! pbathy
72 !THXS_SFX! TYPE(t_dom), DIMENSION(nx,ny), INTENT(in) :: &
73 !THXS_SFX! tpdom
74 !THXS_SFX! TYPE(t_atm), DIMENSION(nx,ny), INTENT(in) :: &
75 !THXS_SFX! tpatc
76 !THXS_SFX! TYPE(t_mxl), DIMENSION(nx,ny), INTENT(in) :: &
77 !THXS_SFX! tpml
78 !THXS_SFX! TYPE(t_dia), DIMENSION(nx,ny), INTENT(inout) :: &
79 !THXS_SFX! tpdia
80 !THXS_SFX! TYPE(t_sit), DIMENSION(nt,nx,ny), INTENT(in) :: &
81 !THXS_SFX! tpsit
82 !THXS_SFX! TYPE(t_tfl), DIMENSION(nx,ny), INTENT(inout) :: &
83 !THXS_SFX! tptfl
84 !THXS_SFX! REAL, DIMENSION(nx,ny), INTENT(out) :: &
85 !THXS_SFX! pustar
86 !THXS_SFX! TYPE(t_2oc), DIMENSION(nx,ny), INTENT(inout) :: &
87 !THXS_SFX! tpall_oce
88 !THXS_SFX!END SUBROUTINE glt_sndmlrf
89 !THXS_SFX!!
90 !THXS_SFX!END INTERFACE
91 !THXS_SFX!END MODULE modi_glt_sndmlrf
92 !
93 ! ---------------------- END MODULE modi_glt_sndmlrf ------------------------
94 !
95 !
96 !
97 ! -----------------------------------------------------------------------
98 ! ----------------------- SUBROUTINE glt_sndmlrf ----------------------------
99 !
100 SUBROUTINE glt_sndmlrf( pbathy,tpdom,tpatc,tpml,tpdia,tpsit,tptfl, &
101  pustar,tpall_oce )
102  USE modd_types_glt
103  USE modd_glt_param
106 #if ! defined in_surfex
107  USE mode_gltools_bound
108 #endif
109  USE modi_gltools_adjflx
110  USE modi_glt_updtfl
111 !
112  IMPLICIT NONE
113 
114  REAL, DIMENSION(nx,ny), INTENT(in) :: &
115  pbathy
116  TYPE(t_dom), DIMENSION(nx,ny), INTENT(in) :: &
117  tpdom
118  TYPE(t_atm), DIMENSION(nx,ny), INTENT(in) :: &
119  tpatc
120  TYPE(t_mxl), DIMENSION(nx,ny), INTENT(in) :: &
121  tpml
122  TYPE(t_dia), DIMENSION(nx,ny), INTENT(inout) :: &
123  tpdia
124  TYPE(t_sit), DIMENSION(nt,nx,ny), INTENT(in) :: &
125  tpsit
126  TYPE(t_tfl), DIMENSION(nx,ny), INTENT(inout) :: &
127  tptfl
128  REAL, DIMENSION(nx,ny), INTENT(out) :: &
129  pustar
130  TYPE(t_2oc), DIMENSION(nx,ny), INTENT(inout) :: &
131  tpall_oce
132 !
133  INTEGER :: &
134  ji,jj
135  LOGICAL, DIMENSION(nx,ny) :: &
136  ycrit
137  REAL, DIMENSION(nx,ny) :: &
138  zfsit,zfld,ztxgw,ztygw,zmsi,zmsa,zssi
139  REAL, DIMENSION(nt,nx,ny) :: &
140  zdm,zent,zsalt
141  REAL, DIMENSION(nx,ny) :: &
142  zwork2,zhsit_ext,zdx_ext,zdy_ext
143  TYPE(t_tfl), DIMENSION(nx,ny) :: &
144  tzdfl
145 !
146 !
147 !
148 ! 1. Momentum flux
149 ! =================
150 !
151 ! .. Transmitted u and v stress components (N.m-2). This stress is the
152 ! result of a weighing between ice-ocean stress (for ice covered areas)
153 ! and air-ocean stress.
154 ! - Note that in glt_gelato, Tx(i,j) and Ty(i,j) are respectively
155 ! defined at the middle of the western and southern corners of T(i,j)
156 ! cell.
157 ! - The glt_output stress should be defined also on Arakawa-C grid,
158 ! but with Tx(i,j) at the middle of the eastern corner of T(i,j) cell
159 ! and Ty(i,j) at the middle of the northern corner of T(i,j) cell.
160 ! - So the glt_output grid should be shifted by one grid cell along
161 ! the X and Y axis. To achieve that, the initial fields are bounded,
162 ! then
163 !
164 ! .. Sea ice total fraction and lead fraction
165 !
166  zfsit(:,:) = sum( tpsit(:,:,:)%fsi,dim=1 )
167  zfld(:,:) = 1.-zfsit(:,:)
168 !
169 ! .. Ice/water friction velocity
170 !
171  pustar(:,:) = sqrt( sqrt(tptfl(:,:)%xio**2+tptfl(:,:)%yio**2)/rhosw )
172 !
173 ! .. Where ocean depth is less than 80m, assume that ice-water stress
174 ! is equal to ice-air stress multiplied by leads fraction
175 ! (we assume that sea ice does not exert any stress on water)
176 !
177  WHERE ( pbathy(:,:)<=80. )
178  tptfl(:,:)%xio = tpatc(:,:)%ztx
179  tptfl(:,:)%yio = tpatc(:,:)%mty
180  ENDWHERE
181 !
182 ! .. Global ice+air/water stress : u-component
183 !
184  tpdia(:,:)%atx = zfsit(:,:)*tpatc(:,:)%ztx
185  tpdia(:,:)%otx = -zfsit(:,:)*tptfl(:,:)%xio
186  ztxgw(:,:) = -tpdia(:,:)%otx + zfld(:,:)*tpatc(:,:)%ztx
187 !
188  ztxgw(:,:) = ztxgw(:,:)*float( tpdom(:,:)%umk )
189 !
190 ! .. Global ice+air/water stress : v-component
191 !
192  tpdia(:,:)%aty = zfsit(:,:)*tpatc(:,:)%mty
193  tpdia(:,:)%oty = -zfsit(:,:)*tptfl(:,:)%yio
194  ztygw(:,:) = -tpdia(:,:)%oty + zfld(:,:)*tpatc(:,:)%mty
195 !
196  ztygw(:,:) = ztygw(:,:)*float( tpdom(:,:)%vmk )
197 
198 #if ! defined in_surfex
199  CALL gltools_bound( 'U','vector',ztxgw )
200  CALL gltools_bound( 'V','vector',ztygw )
201 #endif
202 !
203 !
204 !
205 ! 2. Take the effect of snow, salt and ice mass changes due to dynamics
206 ! ======================================================================
207 !
208 ! 2.1. Initialise fluxes transmitted to the ocean
209 ! ------------------------------------------------
210 !
211  CALL initfl( tzdfl )
212 !
213  IF ( nadvect==1 .AND. ndyncor==1 ) THEN
214 !
215 !
216 ! 2.2. Effect of snow
217 ! --------------------
218 !
219 ! .. The snow mass change is computed per hemisphere and redistributed
220 ! to the ice zones.
221 !
222  zdm(:,:,:) = 0.
223  zent(:,:,:) = 0.
224 !
225 ! -> north hemisphere
226  ycrit = ( tpdom(:,:)%lat>0..AND.tpdom(:,:)%tmk==1.AND.zfsit(:,:)>epsil1 )
227  zdm(1,:,:) = zdm(1,:,:) + gltools_adjflx( tpdom,ycrit,tpdia%ddn )
228 ! -> south hemisphere
229  ycrit = ( tpdom(:,:)%lat<0..AND.tpdom(:,:)%tmk==1.AND.zfsit(:,:)>epsil1 )
230  zdm(1,:,:) = zdm(1,:,:) + gltools_adjflx( tpdom,ycrit,tpdia%ddn )
231 !
232  CALL glt_updtfl('FW2O', tpml,tzdfl,zdm,pent=zent )
233 !
234 !
235 ! 2.3. Effect of sea ice
236 ! -----------------------
237 !
238  zdm(:,:,:) = 0.
239  zent(:,:,:) = 0.
240  zsalt(:,:,:) = 0.
241 !
242 ! .. Compute average ice mass and salinity changes
243 ! (note that %dds is in kg.kg-1)
244 !
245 ! -> north hemisphere
246  ycrit = ( tpdom(:,:)%lat>0..AND.tpdom(:,:)%tmk==1.AND.zfsit(:,:)>epsil1 )
247  zmsi = gltools_adjflx( tpdom,ycrit,tpdia%ddi )
248  zmsa = gltools_adjflx( tpdom,ycrit,tpdia%dds )
249  WHERE( abs( zmsi(:,:) )>epsil2 )
250  zssi(:,:) = zmsa(:,:)/zmsi(:,:)
251  ELSEWHERE
252  zmsi(:,:) = 0.
253  zssi(:,:) = 0.
254  ENDWHERE
255  zdm(1,:,:) = zdm(1,:,:) + zmsi(:,:)
256 ! print*,'compensatory flux (north)=',glt_avg(tpdom,zmsi(:,:),0)
257  zsalt(1,:,:) = zsalt(1,:,:) + 1000.*zssi(:,:) ! should be provided in g.kg-1
258 !
259 ! -> south hemisphere
260  ycrit = ( tpdom(:,:)%lat<0..AND.tpdom(:,:)%tmk==1.AND.zfsit(:,:)>epsil1 )
261  zmsi = gltools_adjflx( tpdom,ycrit,tpdia%ddi )
262  zmsa = gltools_adjflx( tpdom,ycrit,tpdia%dds )
263  WHERE( abs( zmsi(:,:) )>epsil2 )
264  zssi(:,:) = zmsa(:,:)/zmsi(:,:)
265  ELSEWHERE
266  zmsi(:,:) = 0.
267  zssi(:,:) = 0.
268  ENDWHERE
269  zdm(1,:,:) = zdm(1,:,:) + zmsi(:,:)
270 ! print*,'compensatory flux (south)=',glt_avg(tpdom,zmsi(:,:),0)
271  zsalt(1,:,:) = zsalt(1,:,:) + 1000.*zssi(:,:) ! should be provided in g.kg-1
272 ! print*,'Compare...'
273 ! print*,'sea ice mass change =',glt_avg(tpdom,tpdia%ddi,0)*dtt
274 ! print*,'compensatory flux=',glt_avg(tpdom,zdm(1,:,:),0)
275 ! print*,'Compare...'
276 ! print*,'salt mass change =',glt_avg(tpdom,tpdia%dds,0)*dtt
277 ! print*,'compensatory flux=',glt_avg(tpdom,zsalt(1,:,:)*zdm(1,:,:),0)/1000.
278 !
279  CALL glt_updtfl('I2O', tpml,tzdfl,zdm,pent=zent,psalt=zsalt )
280 !
281 !
282 ! 2.4. Add up correction to initial fluxes
283 ! -----------------------------------------
284 !
285  tptfl(:,:)%tio = tptfl(:,:)%tio + tzdfl(:,:)%tio
286  tptfl(:,:)%tlo = tptfl(:,:)%tlo + tzdfl(:,:)%tlo
287  tptfl(:,:)%wio = tptfl(:,:)%wio + tzdfl(:,:)%wio
288  tptfl(:,:)%wlo = tptfl(:,:)%wlo + tzdfl(:,:)%wlo
289  tptfl(:,:)%cio = tptfl(:,:)%cio + tzdfl(:,:)%cio
290  tptfl(:,:)%sio = tptfl(:,:)%sio + tzdfl(:,:)%sio
291  ENDIF
292 !
293 !
294 !
295 ! 3. Define all the fields sent to the ocean model
296 ! =================================================
297 !
298 ! * Please note that total sea ice fraction is used by the ocean but was
299 ! already computed by glt_sndatmf routine.
300 !
301 !
302 ! 3.1. Transmitted non solar heat flux (W.m-2)
303 ! ---------------------------------------------
304 !
305  zwork2(:,:) = &
306  ( tptfl(:,:)%tio + tptfl(:,:)%tlo )* &
307  float( tpdom(:,:)%tmk )
308 #if ! defined in_surfex
309  CALL gltools_bound( 'T','scalar',zwork2 )
310 #endif
311  tpall_oce(:,:)%nsf = zwork2(:,:)
312 !
313 !
314 ! 3.2. Transmitted solar heat flux (W.m-2)
315 ! -----------------------------------------
316 !
317  zwork2(:,:) = ( tptfl(:,:)%lio + tptfl(:,:)%llo )* &
318  float( tpdom(:,:)%tmk )
319 #if ! defined in_surfex
320  CALL gltools_bound( 'T','scalar',zwork2 )
321 #endif
322  tpall_oce(:,:)%swa = zwork2(:,:)
323 !
324 !
325 ! 3.3. Transmitted water fluxes (kg.m-2.s-1)
326 ! -------------------------------------------
327 !
328 ! .. Note that here the sign convention is that a water flux is
329 ! positive is the ocean gains fresh water
330 !
331 ! Concentration / dilution flux
332 !
333  zwork2(:,:) = &
334  ( tptfl(:,:)%cio + tptfl(:,:)%wlo + tptfl(:,:)%wio )* &
335  float( tpdom(:,:)%tmk )
336 #if ! defined in_surfex
337  CALL gltools_bound( 'T','scalar',zwork2 )
338 #endif
339  tpall_oce(:,:)%cdf = zwork2(:,:)
340 !
341 ! Salt flux
342 ! Note that the ocean uses the concentration/dilution flux or the salt flux not both
343 !
344  zwork2(:,:) = &
345  ( tptfl(:,:)%sio )*float( tpdom(:,:)%tmk )
346 #if ! defined in_surfex
347  CALL gltools_bound( 'T','scalar',zwork2 )
348 #endif
349  tpall_oce(:,:)%saf = zwork2(:,:)
350 !
351 ! Water flux
352 !
353 ! If the ocean model ignores the mass of water exchanged between sea ice and
354 ! ocean ("levitating sea ice")
355  zwork2(:,:) = &
356  ( tptfl(:,:)%wio + tptfl(:,:)%wlo )*float( tpdom(:,:)%tmk )
357 !
358 ! Just comment these two lines if you do not want to have %sp1, %sp2 as outputs
359  tpdia%sp1 = tzdfl%wio
360  tpdia%sp2 = tzdfl%wlo
361 !
362 #if ! defined in_surfex
363  CALL gltools_bound( 'T','scalar',zwork2 )
364 #endif
365  tpall_oce(:,:)%wfl = zwork2(:,:)
366 !
367 !
368 ! 3.4. Momentum fluxes (N.m-2)
369 ! -----------------------------
370 !
371 ! .. u-component
372 !
373  zwork2(:,:) = ztxgw(:,:)*float( tpdom(:,:)%umk )
374 #if ! defined in_surfex
375  CALL gltools_bound( 'U','vector',zwork2 )
376 #endif
377  tpall_oce(:,:)%ztx = zwork2(:,:)
378 !
379 ! .. v-component
380 !
381  zwork2(:,:) = ztygw(:,:)*float( tpdom(:,:)%vmk )
382 #if ! defined in_surfex
383  CALL gltools_bound( 'V','vector',zwork2 )
384 #endif
385  tpall_oce(:,:)%mty = zwork2(:,:)
386 !
387 !
388 ! 3.5. Friction velocity (m.s-1)
389 ! -------------------------------
390 !
391  zwork2(:,:) = pustar(:,:)*float( tpdom(:,:)%tmk )
392 #if ! defined in_surfex
393  CALL gltools_bound( 'T','scalar',zwork2 )
394 #endif
395  tpall_oce(:,:)%ust = zwork2(:,:)
396 
397 
398 !
399 END SUBROUTINE glt_sndmlrf
400 !
401 ! --------------------- END SUBROUTINE glt_sndmlrf --------------------------
402 ! -----------------------------------------------------------------------
subroutine initfl(tptfl)
subroutine glt_sndmlrf(pbathy, tpdom, tpatc, tpml, tpdia, tpsit, tptfl, pustar, tpall_oce)
real function, dimension(nx, ny) gltools_adjflx(tpdom, ocrit, pfield)
subroutine glt_updtfl(hflag, tpmxl, tptfl, pdmass, pent, psalt)