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