SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
coupling_dstn.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 SUBROUTINE coupling_dst_n (DST, PKI, &
6  hprogram, &!I [char] Type of ISBA version
7  ki, &!I [nbr] number of points in patch
8  kdst, &!I Number of dust emission variables
9  kpatch, &!I [nbr] number of patch in question
10  pclay, &!I [frc] mass fraction of clay
11  pps, &!I [Pa] surface pressure
12  pts, &!I [K] surface temperature
13  pqa, &!I [kg/kg] atmospheric specific humidity
14  pra, &!I [s/m] atmospheric resistance
15  prhoa, &!I [kg/m3] atmospheric density
16  psand, &!I [frc] mass fraction of sand
17  ppa, &!I [K] Atmospheric pressure
18  pta, &!I [K] Atmospheric temperature
19  ptg, &!I [K] Ground temperature
20  pu, &!I [m/s] zonal wind at atmospheric height
21  puref, &!I [m] reference height of wind
22  pv, &!I [m/s] meridional wind at atmospheric height
23  pwg, &!I [m3/m3] ground volumetric water content
24  pwsat, &!I [m3/m3] saturation volumetric water content
25  pzref, &!I [m] reference height of wind
26  pcd, &!I [] Drag Coefficient for momentum
27  pcdn, &!I [] Drag neutral Coefficient for momentum
28  pch, &!I [] drag coefficient for heat
29  pri, &!I [] Richardson number
30  pz0h_with_snow, &!I [frc] Z0 (heat) with snow
31  psfdst &!O [kg/m2/sec] flux of dust
32  )
33 
34 !PURPOSE
35 !-------
36 !Recieve a full vector for a given patch containing dust emitter surface points
37 !Pack it to vectors for which are purely dust emitter surfaces
38 !Send back the vector PSFDST (kg/m2/s) coming from this patch.
39 !In COUPLING_ISBA this will again be weighted by fraction_of_patch_in_nature_point
40 
41 !AUTHOR
42 !-------
43 !ALF GRINI <alf.grini@cnrm.meteo.fr> 2005
44 ! Modification P. Tulet introduce friction velocity for mode repartition upon
45 ! Alfaro et al, 1998 (Geo. Res. Lett.)
46 !
47 !! Modified 09/2012 : J. Escobar , SIZE(PTA) not allowed without-interface , replace by KI
48 !
49 !
50 USE modd_dst_n, ONLY : dst_t
51 USE modd_pack_isba, ONLY : pack_isba_t
52 !
53 USE modd_csts, ONLY : xrd ! [J/K/kg] The universal gas constant
54 
55 
56 USE modd_dst_surf
57 
58 USE modi_surface_cd
59 USE modi_cls_wind
60 USE modi_cls_t
61 
62 USE modi_dustflux_get ! Dust mobilization routines
63 USE modi_dustflux_get_mb ! Dust mobilization routines (M. Mokhtari)
64 !
65 USE yomhook ,ONLY : lhook, dr_hook
66 USE parkind1 ,ONLY : jprb
67 !
68 IMPLICIT NONE
69 
70 !INPUT
71 !
72 TYPE(dst_t), INTENT(INOUT) :: dst
73 TYPE(pack_isba_t), INTENT(INOUT) :: pki
74 !
75  CHARACTER(LEN=*), INTENT(IN) :: hprogram !I Name of program
76 INTEGER, INTENT(IN) :: ki !I Number of points in patch
77 INTEGER, INTENT(IN) :: kdst !I Number of dust emission variables
78 INTEGER, INTENT(IN) :: kpatch !I Number of patch we are working on
79 REAL, DIMENSION(KI), INTENT(IN) :: pclay !I [frc] mass fraction clay
80 REAL, DIMENSION(KI), INTENT(IN) :: pps !I [Pa] surface pressure
81 REAL, DIMENSION(KI), INTENT(IN) :: pts !I [K] surface temperature
82 REAL, DIMENSION(KI), INTENT(IN) :: pqa !I [kg/kg] atmospheric specific humidity
83 REAL, DIMENSION(KI), INTENT(IN) :: pra !I [s/m] surface resistance
84 REAL, DIMENSION(KI), INTENT(IN) :: prhoa !I [kg/m3] atmospheric density
85 REAL, DIMENSION(KI), INTENT(IN) :: psand !I [frc] mass fraction sand
86 REAL, DIMENSION(KI), INTENT(IN) :: ppa !I [K] Atmospheric pressure
87 REAL, DIMENSION(KI), INTENT(IN) :: pta !I [K] Atmospheric temperature
88 REAL, DIMENSION(KI), INTENT(IN) :: ptg !I [K] Ground temperature
89 REAL, DIMENSION(KI), INTENT(IN) :: pu !I [m/s] zonal wind at atmospheric height
90 REAL, DIMENSION(KI), INTENT(IN) :: puref !I [m] reference height of wind
91 REAL, DIMENSION(KI), INTENT(IN) :: pv !I [m/s] meridional wind at atmospheric height
92 REAL, DIMENSION(KI), INTENT(IN) :: pwg !I [m3/m3] ground volumetric water content
93 REAL, DIMENSION(KI), INTENT(IN) :: pwsat !I [m3/m3] saturation volumetric water content
94 REAL, DIMENSION(KI), INTENT(IN) :: pzref !I [m] reference height of wind
95 REAL, DIMENSION(KI), INTENT(IN) :: pcd !I [] Drag coefficient for momentum
96 REAL, DIMENSION(KI), INTENT(IN) :: pcdn !I [] Drag coefficient for neutral momentum
97 REAL, DIMENSION(KI), INTENT(IN) :: pch !I [] Drag coefficient for heat
98 REAL, DIMENSION(KI), INTENT(IN) :: pri !I [] Richardson number from isba
99 REAL, DIMENSION(KI), INTENT(IN) :: pz0h_with_snow !I [frc] Z0 heat with snow
100 REAL, DIMENSION(KI,KDST), INTENT(OUT) :: psfdst !O [kg/m2/sec] flux of dust for a patch
101 
102 !LOCAL VARIABLES
103 REAL, DIMENSION(KI,NVEGNO_DST,NDSTMDE) :: zsfdst_tile ![kg/m2] flux of dust for each vegetation types and each mode
104 INTEGER :: jveg ![idx] counter for vegetation types
105 REAL(KIND=JPRB) :: zhook_handle
106 
107 
108 !Initialize output which is total flux of dust (kg/m2/sec) from this patch
109 !This number will get weighted by fraction of patch later on (in coupling_isban)
110 IF (lhook) CALL dr_hook('COUPLING_DST_N',0,zhook_handle)
111 psfdst(:,:)=0.d0
112 
113 !Initiate dust emissions for all points in patch
114 zsfdst_tile(:,:,:)=0.d0
115 
116 DO jveg=1,nvegno_dst
117 
118  !Jump out of loop if no dust emitter points
119  IF (dst%NSIZE_PATCH_DST(jveg,kpatch)==0) cycle
120 
121  CALL treat_surf( &
122  dst%NSIZE_PATCH_DST(jveg,kpatch), &!I[idx] number of dust emitter points in patch
123  dst%NR_PATCH_DST(:,jveg,kpatch) &!I[idx] index translator from patch to dustemitter
124  )
125 
126 ENDDO !Loop on dust emitter vegetation
127 
128 !Average dust flux from the two vegetation "tiles"
129 !Make sure you do this correctly so that area is OK.
130 !Need to have this as kg/m2/sec from PATCH because
131 !afterwards this is weighted by fraction of patch
132  CALL avg_flux_dst(nvegno_dst)
133 
134 !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
135 IF (lhook) CALL dr_hook('COUPLING_DST_N',1,zhook_handle)
136 !
137  CONTAINS
138 
139 SUBROUTINE treat_surf(KSIZE,KMASK)
140 
141 IMPLICIT NONE
142 
143 INTEGER, INTENT(IN) :: ksize !Size of dust emitter vector
144 INTEGER, DIMENSION(:), INTENT(IN) :: kmask !mask from patch vector to dust emitter vector
145 
146 !ALLOCATABLE VARIABLES FOR ALL VEGETATION TYPES
147 REAL, DIMENSION(KSIZE) :: zp_clay ![frc] fraction of clay
148 REAL, DIMENSION(KSIZE) :: zp_mer10m ![m/s] meridional wind at 10m
149 REAL, DIMENSION(KSIZE) :: zp_ps ![Pa] surface pressure
150 REAL, DIMENSION(KSIZE) :: zp_ts ![K] surface temperature
151 REAL, DIMENSION(KSIZE) :: zp_qa ![kg_{H2O}/kg_{air}] specific humidity
152 REAL, DIMENSION(KSIZE) :: zp_q2m ![kg_{H2O}/kg_{air}] speficic humidity
153 REAL, DIMENSION(KSIZE) :: zp_hu2m ![-] relative humidity
154 REAL, DIMENSION(KSIZE) :: zp_rhoa ![kg/m3] atmospheric density
155 REAL, DIMENSION(KSIZE) :: zp_rhoa_2m ![kg/m3] atmospheric density close to surface
156 REAL, DIMENSION(KSIZE) :: zp_sand ![frc] fraction of sand
157 REAL, DIMENSION(KSIZE) :: zp_sfdst ![kg/m2/s] dust flux (kg/m2/s)
158 REAL, DIMENSION(KSIZE,NDSTMDE) :: zp_sfdst_mde ![kg/m2/s] dust flux from modes
159 REAL, DIMENSION(KSIZE) :: zp_sfmer ![m/s] wind friction in meridional direction
160 REAL, DIMENSION(KSIZE) :: zp_sfzon ![m/s] wind friction in zonal direction
161 REAL, DIMENSION(KSIZE) :: zp_pa ![K] Atmospheric pressure
162 REAL, DIMENSION(KSIZE) :: zp_ta ![K] Atmospheric temperature
163 REAL, DIMENSION(KSIZE) :: zp_tg ![K] ground temperature
164 REAL, DIMENSION(KSIZE) :: zp_t2m ![K] 2M temperature
165 REAL, DIMENSION(KSIZE) :: zp_u ![m/s] zonal wind at atmospheric height
166 REAL, DIMENSION(KSIZE) :: zp_uref ![m] reference height for wind
167 REAL, DIMENSION(KSIZE) :: zp_ustar ![m/s] wind friction speed
168 REAL, DIMENSION(KSIZE) :: zp_v ![m/s] meridional wind at atmospheric height
169 REAL, DIMENSION(KSIZE) :: zp_vmod ![m/s] Wind at atmospheric height
170 REAL, DIMENSION(KSIZE) :: zp_wg ![m3/m3] ground volumetric water content
171 REAL, DIMENSION(KSIZE) :: zp_wind10m ![m/s] wind at 10m
172 REAL, DIMENSION(KSIZE) :: zp_wsat ![m3/m3] saturation volumetric water content
173 REAL, DIMENSION(KSIZE) :: zp_zon10m ![m/s] zonal wind at 10m
174 REAL, DIMENSION(KSIZE) :: zp_zref ![m] reference height for wind
175 REAL, DIMENSION(KSIZE) :: zp_z0_erod ![m] roughness length for erodible surface
176 REAL, DIMENSION(KSIZE,3) :: zp_mss_frc_src ![%] dust mode fraction of emitted mass
177 REAL, DIMENSION(KSIZE) :: zp_inter ![%] dust mode fraction of emitted mass
178 REAL, DIMENSION(KSIZE) :: zp_cd !I [] drag coefficient for momentum from isba
179 REAL, DIMENSION(KSIZE) :: zp_ch !I [] drag coefficient for heat
180 REAL, DIMENSION(KSIZE) :: zp_cd_dst ! drag coefficient uses by DEAD
181 REAL, DIMENSION(KSIZE) :: zp_cdn ![-] drag coefficient neutral atm
182 REAL, DIMENSION(KSIZE) :: zp_ri !I [-] Richardson number
183 REAL, DIMENSION(KSIZE) :: zp_z0h_with_snow ![frc] Z0 heat with snow
184 REAL, DIMENSION(KSIZE) :: zp_dst_erod !Erodable Surface (COVER004=1 and COVER005=0.01)
185 REAL, DIMENSION(KSIZE) :: zh ! 10m (wind altitude)
186 REAL, DIMENSION(5) :: zseuil
187 REAL, DIMENSION(6,2) :: zpcen
188 INTEGER :: jj, js !Counter for vector points
189 INTEGER :: jmode
190 REAL(KIND=JPRB) :: zhook_handle
191 
192 IF (lhook) CALL dr_hook('COUPLING_DST_n:TREAT_SURF',0,zhook_handle)
193 
194 !Pack patch-vectors to dust emitter vectors
195 !i.e. allocate memory for the packed (dust emitter) vectors
196 DO jj=1,ksize
197  zp_clay(jj) = pclay(kmask(jj))
198  zp_ps(jj) = pps(kmask(jj))
199  zp_ts(jj) = pts(kmask(jj))
200  zp_qa(jj) = pqa(kmask(jj))
201  zp_rhoa(jj) = prhoa(kmask(jj))
202  zp_sand(jj) = psand(kmask(jj))
203  zp_pa(jj) = ppa(kmask(jj))
204  zp_ta(jj) = pta(kmask(jj))
205  zp_tg(jj) = ptg(kmask(jj))
206  zp_u(jj) = pu(kmask(jj))
207  zp_uref(jj) = puref(kmask(jj))
208  zp_v(jj) = pv(kmask(jj))
209  zp_wg(jj) = pwg(kmask(jj))
210  zp_wsat(jj) = pwsat(kmask(jj))
211  zp_zref(jj) = pzref(kmask(jj))
212  zp_cd(jj) = pcd(kmask(jj))
213  zp_cdn(jj) = pcdn(kmask(jj))
214  zp_ch(jj) = pch(kmask(jj))
215  zp_ri(jj) = pri(kmask(jj))
216  zp_z0h_with_snow(jj) = pz0h_with_snow(kmask(jj))
217 ENDDO
218 !
219 !Manipulate some variables since we assume dust emission occurs over flat surface
220 zp_z0_erod(:) = dst%Z0_EROD_DST(jveg) !Set z0 to roughness of erodible surface
221 !
222 IF (jveg ==1) THEN
223  zp_dst_erod(:) = 1.
224 ELSE
225  zp_dst_erod(:) = 0.01
226 ENDIF
227 !
228 zp_cd_dst(:) = zp_cd(:)
229 !
230 IF (cvermod/='CMDVER') THEN
231  !Re-calculate the drag over the dust emitter (erodable) surface. Since we
232  !don't use the roughness length of the patch, but rather use specific roughness
233  !lengths of dust emitter surfaces, the drag changes.
234  CALL surface_cd(zp_ri, zp_zref, zp_uref, zp_z0_erod, zp_z0h_with_snow, zp_cd_dst, zp_cdn)
235 ENDIF
236 !
237 !Get total wind speed
238 zp_vmod(:) = sqrt(zp_u(:)**2 + zp_v(:)**2)
239 !
240 zp_ustar(:) = sqrt(zp_cd_dst(:))*zp_vmod
241 !Get zonal friction speed (m/s)
242 zp_sfzon(:) = - sqrt(zp_cd_dst(:))*zp_u(:)
243 !Get meridional surface stress
244 zp_sfmer(:) = - sqrt(zp_cd_dst(:))*zp_v(:)
245 !
246 !Get the 10m wind speed (needed for one operation in dust model)
247 !And get the density at 2m to feed into erosion model
248 zh(:)=10.
249  CALL cls_wind(zp_u, zp_v, zp_uref, zp_cd_dst, zp_cdn, zp_ri, zh, &
250  zp_zon10m, zp_mer10m )
251 zh(:)=2.
252  CALL cls_t(zp_ta, zp_qa, zp_pa, zp_ps, zp_zref, zp_cd_dst, zp_ch, zp_ri, &
253  zp_ts, zp_z0h_with_snow, zh, zp_t2m )
254 
255 !Get density at 2 meters rho=P/(RT)
256 zp_rhoa_2m(:) = zp_ps(:)/(zp_t2m(:)*xrd)
257 !
258 !Get wind speed at 10m heigh
259 zp_wind10m(:) = sqrt(zp_zon10m(:)**2 + zp_mer10m(:)**2)
260 !
261 !the erodible surface
262 zp_wind10m(:) = max(zp_wind10m(:), 1e-2)
263 !
264 IF (cvermod=='CMDVER') THEN
265  !
266  CALL dustflux_get_mb( &
267  zp_ustar, & !I [m/s] wind friction speed over erodible surface
268  zp_rhoa_2m, & !I [kg/m3] air density at surface
269  zp_wg, & !I [m3/m3] volumetric water content of ground
270  zp_z0_erod, & !I [m] roughness length of erodible surface
271  zp_wsat, & !I [m3/m3] saturation water volumetric content
272  zp_clay, & !I [frc] mass fraction of clay
273  zp_sand, & !I [frc] mass fraction of sand
274  zp_dst_erod, & !I [frc] erodabilitC) de la surface (cover004 = 1 et cocer005=0.5)
275  zp_wind10m, & !I [m/s] wind at 10m
276  zp_sfdst, & !O [kg/m2/sec] flux of dust
277  ksize & !I [nbr] number of points for which we do calculation
278  )
279  !
280 ELSE
281  !
282  CALL dustflux_get( &
283  zp_ustar, &!I [m/s] wind friction speed over erodible surface
284  zp_rhoa_2m, &!I [kg/m3] air density at surface
285  zp_wg, &!I [m3/m3] volumetric water content of ground
286  zp_z0_erod, &!I [m] roughness length of erodible surface
287  zp_wsat, &!I [m3/m3] saturation water volumetric content
288  zp_clay, &!I [frc] mass fraction of clay
289  zp_sand, &!I [frc] mass fraction of sand
290  zp_wind10m, &!I [m/s] wind at 10m
291  zp_sfdst, &!O [kg/m2/sec] flux of dust
292  ksize &!I [nbr] number of points for which we do calculation
293  )
294 ENDIF
295 
296 zp_mss_frc_src(:,:) = 0.
297 
298 IF (cemisparam_dst == "EXPLI" .OR. cemisparam_dst == "AMMA ") THEN
299 
300  ! For the repartition of mass fraction we uses the real USTAR
301  zp_ustar(:) = sqrt(zp_cd_dst(:))*zp_vmod(:)
302 
303  zseuil = (/0., 0.35, 0.42, 0.50 ,0.66/)
304 
305  IF (cemisparam_dst == "EXPLI") THEN
306  ! Compute modes mass fraction of emitted dust upon Alfaro et al. 1998
307  zpcen(:,1) = (/0., 0., 0.01, 0.08, 0.15, 0.15/)
308  zpcen(:,2) = (/0., 0., 0.36, 0.43, 0.76, 0.76/)
309  ! Case of u* < 35E-2 m/s
310  ! only coarse mode is activated
311  ! mode 1 = 0
312  ! mode 2 = 0
313  ! mode 3 = 100
314  ! Case of 35E-2 m/s < u* < 42E-2 m/s
315  ! 0 % < mode 1 < 1 %
316  ! 0 % < mode 2 < 36 %
317  ! 63 % < mode 3 < 100 %
318  ! Case of 42E-2 m/s < u* < 50E-2 m/s
319  ! 1 % < mode 1 < 8 %
320  ! 36 % < mode 2 < 43 %
321  ! 49 % < mode 3 < 63 %
322  ! Case of 50E-2 m/s < u* < 66E-2 m/s
323  ! 8 % < mode 1 < 15 %
324  ! 43 % < mode 2 < 76 %
325  ! 9 % < mode 3 < 49 %
326  ! Case of u* > 66E-2 m/s
327  ! mode 1 = 15 %
328  ! mode 2 = 76 %
329  ! mode 3 = 9 %
330  ELSEIF (cemisparam_dst == "AMMA ") THEN
331  ! For the repartition of mass fraction we uses the real USTAR upon
332  ! Alfaro/Gomes 2001, jgr, table 5, soil type Salty sand.
333  ! Percentage of mass considered between the fin and accumulation modes
334  zpcen(:,1) = (/0., 0., 0.0023, 0.0185, 0.0345, 0.0345/)
335  zpcen(:,2) = (/0., 0., 0.0077, 0.0615, 0.1155, 0.1155/)
336  ! Case of u* < 35E-2 m/s
337  ! only coarse mode is activated
338  ! mode 1 = 0
339  ! mode 2 = 0
340  ! mode 3 = 100
341  ! Case of 35E-2 m/s < u* < 42E-2 m/s
342  ! 0 % < mode 1 < 0.23 %
343  ! 0 % < mode 2 < 0.77 %
344  ! 99 % < mode 3 < 100 %
345  ! Case of 42E-2 m/s < u* < 50E-2 m/s
346  ! 0.23 % < mode 1 < 1.85 %
347  ! 0.77 % < mode 2 < 6.15 %
348  ! 92 % < mode 3 < 99 %
349  ! Case of 50E-2 m/s < u* < 66E-2 m/s
350  ! 1.85 % < mode 1 < 3.45 %
351  ! 6.15 % < mode 2 < 11.55 %
352  ! 85 % < mode 3 < 92 %
353  ! Case of u* > 66E-2 m/s
354  ! mode 1 = 15 %
355  ! mode 2 = 76 %
356  ! mode 3 = 9 %
357  ENDIF
358 
359  DO js = 1, SIZE(zseuil) - 1
360  WHERE (zp_ustar(:) >= zseuil(js) .AND. zp_ustar(:) < zseuil(js+1))
361  zp_inter(:) = (zp_ustar(:) - zseuil(js)) / (zseuil(js+1) - zseuil(js))
362  zp_mss_frc_src(:,1) = zpcen(js,1) + (zpcen(js+1,1) - zpcen(js,1)) * zp_inter(:)
363  zp_mss_frc_src(:,2) = zpcen(js,2) + (zpcen(js+1,2) - zpcen(js,2)) * zp_inter(:)
364  END WHERE
365  ENDDO
366 
367  WHERE (zp_ustar(:) >= zseuil(SIZE(zseuil)))
368  zp_mss_frc_src(:,1) = zpcen(SIZE(zseuil)+1,1)
369  zp_mss_frc_src(:,2) = zpcen(SIZE(zseuil)+1,2)
370  END WHERE
371 
372  zp_mss_frc_src(:,3) = 1. - zp_mss_frc_src(:,1) - zp_mss_frc_src(:,2)
373 
374 ELSE
375  DO jmode = 1,ndstmde
376  zp_mss_frc_src(:,jorder_dst(jmode)) = dst%XMSS_FRC_SRC(jmode)
377  ENDDO
378 END IF
379 
380 DO jmode=1,ndstmde
381  ! Explicit mass fraction from u*
382  zp_sfdst_mde(:,jmode) = zp_sfdst(:) & !Total mass flux of dust
383  * zp_mss_frc_src(:,jorder_dst(jmode)) !Fraction of dust going to each mode
384 ENDDO
385 
386 
387 !Transfer the fluxes to each tile
388 DO jmode=1,ndstmde
389  DO jj=1,ksize
390  zsfdst_tile(kmask(jj),jveg,jmode) = zp_sfdst_mde(jj,jmode)
391  ENDDO
392 ENDDO
393 
394 IF (lhook) CALL dr_hook('COUPLING_DST_n:TREAT_SURF',1,zhook_handle)
395 
396 END SUBROUTINE treat_surf
397 
398 !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
399 SUBROUTINE avg_flux_dst( &
400  ktile & ! Number of different dust emitter vegetations
401  )
402 
403 ! Purpose: Average all fluxes from independent dust emitter surfaces (KTILE)
404 ! Remember: XP_VEGTYPE_PATCH is m^2_{emittersurface}/m^{nature}
405 ! The goal is to obtain PSFDST in kg_{dust}/m^2_{patch}
406 
407 !INPUT
408 INTEGER, INTENT(IN) :: ktile ! Number of different dust emitter vegetation types
409 
410 !LOCAL
411 INTEGER :: ii ! Counter for points in patch-vector
412 INTEGER :: jj ! Counter for vegetation types
413 INTEGER :: jmode ! Counter for modes
414 INTEGER :: jsv_idx ! Index for scalar variable
415 INTEGER :: nmoment ! Number of moments
416 REAL :: vegfrac_in_patch ! fraction of total vegetation in this patch (m^2_{patch}/m^2_{nature})
417 REAL(KIND=JPRB) :: zhook_handle
418 !
419 !Remember: XP_VEGTYPE_PATCH is m^2_{emittersurface}/m^{nature}
420 !The goal is to obtain PSFDST in kg_{dust}/m^2_{patch}
421 !
422 !Start loop on modes
423 IF (lhook) CALL dr_hook('AVG_FLUX_DST',0,zhook_handle)
424 !
425 nmoment = int(SIZE(psfdst,2) / ndstmde)
426 !
427 DO jmode=1,ndstmde
428  !Make sure dust mass emission is put in index 2, 5, 8 etc if 3 moments per mode
429  !Make sure dust mass emission is put in index 2, 4, 6 etc if 2 moments per mode
430  IF (nmoment == 1) THEN
431  jsv_idx = (jmode-1)*nmoment + 1 !Counter for scalar variable
432  ELSE
433  jsv_idx = (jmode-1)*nmoment + 2 !Counter for scalar variable
434  END IF
435 
436  !Start loop on number of dust emitter surfaces
437  DO jj=1,ktile
438  !Loop on points inside patch
439  DO ii=1,ki
440 
441  !Get sum of vegetation fraction in this patch
442  !fxm: VERY BAD LOOP ORDER
443  vegfrac_in_patch = sum(pki%XP_VEGTYPE_PATCH(ii,:))
444 
445  !Get production of flux by adding up the contribution
446  !from the different tiles (here, "tiles" are dust emitter surfaces)
447  psfdst(ii,jsv_idx) = psfdst(ii,jsv_idx) & ![kg/m^2_{patch}/sec] dust flux per patch
448  + (zsfdst_tile(ii,jj,jmode) & ![kg/m^2_{emittersurface}/sec] Dust flux per surface area of dust emitter surface
449  * pki%XP_VEGTYPE_PATCH(ii,dst%NVT_DST(jj)) & ![frc] m^2_{emittersurface}/m^2_{nature}
450  / vegfrac_in_patch ) ![frc] m^2_{patch}/m^2_{nature}
451  ENDDO !loop on point in patch
452  ENDDO !loop on different dust emitter surfaces
453 
454 ENDDO !Loop on modes
455 
456 IF (lhook) CALL dr_hook('AVG_FLUX_DST',1,zhook_handle)
457 
458 END SUBROUTINE avg_flux_dst
459 
460 END SUBROUTINE coupling_dst_n
461 
subroutine cls_wind(PZONA, PMERA, PHW, PCD, PCDN, PRI, PHV, PZON10M, PMER10M)
Definition: cls_wind.F90:6
subroutine cls_t(PTA, PQA, PPA, PPS, PHT, PCD, PCH, PRI, PTS, PZ0H, PH, PTNM)
Definition: cls_t.F90:6
subroutine dustflux_get_mb(PUSTAR, PRHOA, PWG, PZ0, PWSAT, PCLAY, PSAND, PDST_EROD, PWIND10M, PSFDST, KSIZE)
subroutine coupling_dst_n(DST, PKI, HPROGRAM, KI, KDST, KPATCH, PCLAY, PPS, PTS, PQA, PRA, PRHOA, PSAND, PPA, PTA, PTG, PU, PUREF, PV, PWG, PWSAT, PZREF, PCD, PCDN, PCH, PRI, PZ0H_WITH_SNOW, PSFDST)
subroutine dustflux_get(PUSTAR, PRHOA, PWG, PZ0, PWSAT, PCLAY, PSAND, PWIND10M, PSFDST, KSIZE)
Definition: dustflux_get.F90:5
subroutine surface_cd(PRI, PZREF, PUREF, PZ0EFF, PZ0H, PCD, PCDN)
Definition: surface_cd.F90:6
subroutine treat_surf(KMASK, YTYPE)
subroutine avg_flux_dst(KTILE)