SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
init_dst.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 init_dst (DST, U, &
6  hprogram, & ! Program calling unit
7  ksize_nature_p, & ! Number of nature points in a patch
8  kr_nature_p, & ! Mask from patch --> nature vectors
9  kpatch, & ! Maximum number of patches
10  pvegtype_patch ) ! fraction (in a nature point) of a vegtype for a patch
11 
12 !
13 USE modd_dst_n, ONLY : dst_t
14 USE modd_surf_atm_n, ONLY : surf_atm_t
15 !
16 USE modd_dst_surf
17 USE modd_data_cover_par, ONLY : nvt_no, nvt_rock
18 !
19 USE modi_get_luout
20 USE modi_get_vegtype_2_patch_mask
21 USE modi_abor1_sfx
22 !
23 USE yomhook ,ONLY : lhook, dr_hook
24 USE parkind1 ,ONLY : jprb
25 !
26 IMPLICIT NONE
27 !
28 !PASSED VARIABLES
29 !
30 TYPE(dst_t), INTENT(INOUT) :: dst
31 TYPE(surf_atm_t), INTENT(INOUT) :: u
32 !
33  CHARACTER(LEN=6), INTENT(IN) :: hprogram !Passing unit
34 !
35 INTEGER, DIMENSION(:), POINTER :: ksize_nature_p
36 INTEGER, DIMENSION(:,:), POINTER :: kr_nature_p
37 INTEGER, INTENT(IN) :: kpatch
38 REAL, DIMENSION(:,:,:), POINTER :: pvegtype_patch
39 !
40 !LOCAL VARIABLES
41  CHARACTER(LEN=4) :: crgunit ! type of log-normal geometric mean radius
42 INTEGER :: jveg ! Counter for vegetation classes
43 INTEGER :: jveg_in ! Vegetation index
44 INTEGER :: jpatch ! Counter for patches
45 INTEGER :: jmode ! Counter for dust modes
46 INTEGER :: jmode_idx ! Index for dust modes
47 INTEGER :: iluout
48 INTEGER :: isize_largest_dst
49 REAL(KIND=JPRB) :: zhook_handle
50 
51 !get output listing unit
52 IF (lhook) CALL dr_hook('INIT_DST',0,zhook_handle)
53  CALL get_luout(hprogram,iluout)
54 !
55 !Allocate memory for the real values which will be used by the model
56 ALLOCATE(dst%XEMISRADIUS_DST(ndstmde))
57 ALLOCATE(dst%XEMISSIG_DST (ndstmde))
58 ALLOCATE(dst%XMSS_FRC_SRC (ndstmde))
59 !
60 !Get initial size distributions. This is cut and pasted
61 !from dead routine dstpsd.F90
62 !Check for different source parameterizations
63 IF(cemisparam_dst.EQ."She84")THEN
64  crgunit = 'MASS'
65  xemisradius_ini_dst(:) = 0.5d6 * (/ 0.0111e-6, 2.524e-6, 42.10e-6 /) ! [um] Mass median radius She84 p. 75 Table 1
66  xemissig_ini_dst(:) = (/ 1.89 , 2.0 , 2.13 /) ! [frc] Geometric standard deviation She84 p. 75 Table 1
67  xmss_frc_src_ini(:) = (/2.6e-6, 0.781, 0.219/) ! [frc] Mass fraction She84 p. 75 Table 1
68 ELSEIF(cemisparam_dst.EQ."PaG77")THEN
69  crgunit = 'MASS'
70  xemisradius_ini_dst(:) = 0.5d6 * (/0.27e-6 , 5.6e-6 , 57.6e-6 /) ! [um] Mass median radius PaG77 p. 2080 Table 1
71  xemissig_ini_dst(:) = (/ 1.88, 2.2 , 1.62 /) ! [frc] Geometric standard deviation PaG77 p. 2080 Table 1
72  xmss_frc_src_ini(:) = (/0.036, 0.957, 0.007/) ! [frc] Mass fraction BSM96 p. 73 Table 2 (ad hoc)
73 ELSEIF(cemisparam_dst.EQ."Dal87") THEN
74  ! D'Almeida, 1987 as default
75  crgunit = 'MASS'
76  xemisradius_ini_dst(:) = 0.5d6 * (/ 0.832e-6 , 4.82e-6 , 19.38e-6 /) ! [um] Mass median radius BSM96 p. 73 Table 2
77  xemissig_ini_dst(:) = (/ 2.10, 1.90 , 1.60 /) ! [frc] Geometric standard deviation BSM96 p. 73 Table 2
78  xmss_frc_src_ini(:) = (/0.036, 0.957, 0.007/) ! [frc] Mass fraction BSM96 p. 73 Table 2
79 ELSEIF (cemisparam_dst.EQ."alf98".OR.cemisparam_dst.eq."EXPLI") THEN ! Alfaro et al 1998 as default
80  IF (cemisparam_dst.EQ."alf98") xflx_mss_fdg_fct = 6e-4
81  IF (cemisparam_dst.EQ."EXPLI") xflx_mss_fdg_fct = 3.5e-4
82  crgunit = 'MASS'
83  xemisradius_ini_dst(:) = 0.5*(/ 1.5, 6.7, 14.2 /) ! [um] Mass median radius BSM96 p. 73 Table 2
84  xemissig_ini_dst(:) = (/1.70, 1.60, 1.50/) ! [frc] Geometric standard deviation BSM96 p. 73 Table 2
85  xmss_frc_src_ini(:) = (/0.01, 0.19, 0.8 /) ! [frc] Mass fraction BSM96 p. 73 Table 2
86 ELSEIF (cemisparam_dst.EQ."AMMA ") THEN ! Default: New distribution from AMMA
87  xflx_mss_fdg_fct = 105.e-4
88  crgunit = 'NUMB'
89  xemisradius_ini_dst(:) = 0.5*(/ 0.078, 0.641, 5.00 /) ! [um] Number median radius
90  xemissig_ini_dst(:) = (/ 1.75, 1.76, 1.70/) ! [frc] Geometric standard deviation
91  xmss_frc_src_ini(:) = (/0.008, 0.092, 0.99/) ! [frc] Mass fraction
92 ELSEIF (cemisparam_dst.EQ."CRUM ") THEN ! Default: New distribution from AMMA
93  xflx_mss_fdg_fct = 10.e-4
94  crgunit = 'NUMB'
95  xemisradius_ini_dst(:) = 0.5*(/ 0.078, 0.641, 5.00 /) ! [um] Number median radius
96  xemissig_ini_dst(:) = (/ 1.75, 1.76, 1.70 /) ! [frc] Geometric standard deviation
97  xmss_frc_src_ini(:) = (/0.0005, 0.0029, 0.9966/) ! [frc] Mass fraction
98 ELSE
99  WRITE(iluout,*) " FATAL ERROR "
100  WRITE(iluout,*) " YOU MUST DECIDE THE EMISSIUON PARAMETERIZATION, YOU USES "
101  WRITE(iluout,*) " CEMISPARAM_DST = ",cemisparam_dst," AND IT IS NOT DEFINED "
102  WRITE(iluout,*) " see init_dstn.f90 to see what dust parameterization is available. "
103  CALL abor1_sfx("INIT_DST: CEMISPARAM_DST not defined ")
104 ENDIF
105 !
106 DO jmode=1,ndstmde
107  jmode_idx=jorder_dst(jmode)
108  !
109  dst%XEMISSIG_DST (jmode) = xemissig_ini_dst(jmode_idx)
110  dst%XEMISRADIUS_DST(jmode) = xemisradius_ini_dst(jmode_idx)
111  dst%XMSS_FRC_SRC (jmode) = xmss_frc_src_ini(jmode_idx)
112  !
113  !Get emisradius, and at the same time convert to number median radius
114  IF (crgunit=='MASS') &
115  dst%XEMISRADIUS_DST(jmode) = dst%XEMISRADIUS_DST(jmode) * exp(-3.d0 * (log(dst%XEMISSIG_DST(jmode)))**2)
116  !
117 ENDDO
118 !
119 !Normalize the sum of the emissions to 1 so that all dust is
120 !put in one mode or the other
121 IF(sum(dst%XMSS_FRC_SRC(:)).LT.1.) dst%XMSS_FRC_SRC(:) = dst%XMSS_FRC_SRC(:) / sum(dst%XMSS_FRC_SRC(:))
122 !
123 !Allocate memory
124 !ALLOCATE(NVEGNO_DST)
125 !Set the number of classes that can emit dust (fxm: set this elsewhere)
126 nvegno_dst = 2
127 !
128 !Allocate memory for the vegtype-translator
129 ALLOCATE(dst%NVT_DST(nvegno_dst))
130 !
131 !Set the dust/vegtype translator vector
132 dst%NVT_DST(1) = nvt_no
133 dst%NVT_DST(2) = nvt_rock
134 !
135 !Allocate memory for roughness lengths of erodible surfaces
136 ALLOCATE(dst%Z0_EROD_DST(nvegno_dst))
137 !
138 !Set the roughness lengths corresponding to erodible surfaces
139 !Smooth roughness length is given to 1.d-5 (dstmbl.f90)
140 dst%Z0_EROD_DST(1) = 30.d-6 !m (30 um)
141 dst%Z0_EROD_DST(2) = 200.d-6 !m (200 um)
142 !
143 !Allocate memory for dust emitter surface vectors in patch vectors
144 IF (.NOT.ASSOCIATED(dst%NSIZE_PATCH_DST)) ALLOCATE(dst%NSIZE_PATCH_DST(nvegno_dst,kpatch))
145 !
146 DO jpatch = 1,kpatch
147  DO jveg = 1,nvegno_dst
148  !Count all the points in the patch where you have dust emitter vegetation
149  dst%NSIZE_PATCH_DST(jveg,jpatch) = count(pvegtype_patch(:,dst%NVT_DST(jveg),jpatch) > 0.)
150  ENDDO
151 ENDDO
152 !
153 !Find the largest dust emitter vector in any patch
154 !ALLOCATE (NSIZE_LARGEST_DST)
155 isize_largest_dst = 0
156 DO jpatch=1,kpatch
157  DO jveg = 1,nvegno_dst
158  isize_largest_dst = max(isize_largest_dst,dst%NSIZE_PATCH_DST(jveg,jpatch))
159  ENDDO
160 ENDDO
161 !
162 !Allocate memory for NR_PATCH_DST mask translate from patch vector to dust vector
163 ALLOCATE(dst%NR_PATCH_DST(isize_largest_dst,nvegno_dst,kpatch))
164 !
165 !Initialize the mask array
166 dst%NR_PATCH_DST(:,:,:)=0
167 !
168 !Get values from the dust emitter vegetation mask
169 DO jpatch=1,kpatch
170  DO jveg=1,nvegno_dst
171  jveg_in = dst%NVT_DST(jveg) ! Get the real vegtype index
172 #ifdef RJ_OFIX
173  CALL get_vegtype_2_patch_mask(iluout, &
174  dst%NSIZE_PATCH_DST(jveg,jpatch), &!I Size of dust emitter vector
175  ksize_nature_p(jpatch), &!I Size of patch vector
176  u%NSIZE_NATURE, &!I Size of nature vector
177 !RJ: attempt to make this call generic
178  kr_nature_p(:ksize_nature_p(jpatch),jpatch),&!I Mask from patch to nature
179  pvegtype_patch, &!I Fraction of vegtype of nature point within jpatch
180  dst%NR_PATCH_DST(:dst%NSIZE_PATCH_DST(jveg,jpatch),jveg,jpatch), &!O Part of mask array to fill with values
181  kpatch, &!I Number of possible patches
182  jpatch, &!I Index of patch in question
183  jveg_in &!I Index of vegtype in question
184  )
185 #else
186  CALL get_vegtype_2_patch_mask(iluout, &
187  dst%NSIZE_PATCH_DST(jveg,jpatch), &!I Size of dust emitter vector
188  ksize_nature_p(jpatch), &!I Size of patch vector
189  u%NSIZE_NATURE, &!I Size of nature vector
190  kr_nature_p, &!I Mask from patch to nature
191  pvegtype_patch, &!I Fraction of vegtype of nature point within jpatch
192  dst%NR_PATCH_DST(:dst%NSIZE_PATCH_DST(jveg,jpatch),jveg,jpatch), &!O Part of mask array to fill with values
193  kpatch, &!I Number of possible patches
194  jpatch, &!I Index of patch in question
195  jveg_in &!I Index of vegtype in question
196  )
197 #endif
198  ENDDO !Loop on patches
199 ENDDO !Loop on veg-types
200 !
201 IF (lhook) CALL dr_hook('INIT_DST',1,zhook_handle)
202 !
203 END SUBROUTINE init_dst
204 
subroutine abor1_sfx(YTEXT)
Definition: abor1_sfx.F90:6
subroutine get_luout(HPROGRAM, KLUOUT)
Definition: get_luout.F90:6
subroutine init_dst(DST, U, HPROGRAM, KSIZE_NATURE_P, KR_NATURE_P, KPATCH, PVEGTYPE_PATCH)
Definition: init_dst.F90:5
subroutine get_vegtype_2_patch_mask(KLUOUT, KSIZE_VEG, KSIZE_PATCH, KSIZE_NAT, KMASK_PATCH_NATURE, PVEGTYPE_PATCH, KMASK, KPATCH_MAX, KPATCH, KVEGTYPE)