SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
fix_meb_veg.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 ! ################################################################
6  SUBROUTINE fix_meb_veg (DTI, IG, I, &
7  kpatch)
8 ! ################################################################
9 !
10 !! PURPOSE
11 !! -------
12 !!
13 !! A MEB routine:
14 !!
15 !! For LMEB=true ...
16 !!
17 !! ... XPAR_VEG/XDATA_VEG has to be set to >0 for those NVEGTYPE positions
18 !! corresponding to the patches where TEMP_LMEB_PATCH = true.
19 !! Otherwise, if XPAR_VEG/XDATA_VEG is 0 for these NVEGTYPE positions
20 !! PLAI will be set to undefined in CONVERT_PATCH_ISBA.
21 !!
22 !! ... XPAR_VEG/XDATA_VEG has to be set to <1 for those NVEGTYPE positions
23 !! corresponding to the patches where TEMP_LMEB_PATCH = true.
24 !! Otherwise, if XPAR_VEG/XDATA_VEG is 1 for these NVEGTYPE positions
25 !! PALBNIR_SOIL will be set to undefined in CONVERT_PATCH_ISBA.
26 !!
27 !! Therefore, XPAR_VEG/XDATA_VEG is set to 0.5 in the identified cases!
28 !!
29 !!
30 !! METHOD
31 !! ------
32 !!
33 !! EXTERNAL
34 !! --------
35 !!
36 !! IMPLICIT ARGUMENTS
37 !! ------------------
38 !!
39 !! REFERENCE
40 !! ---------
41 !!
42 !! AUTHOR
43 !! ------
44 !!
45 !! P. Samuelsson
46 !!
47 !! MODIFICATION
48 !! ------------
49 !!
50 !! Original 09/2013
51 !!
52 !----------------------------------------------------------------------------
53 !
54 !* 0. DECLARATION
55 ! -----------
56 !
57 !
58 USE modd_data_isba_n, ONLY : data_isba_t
59 USE modd_isba_grid_n, ONLY : isba_grid_t
60 USE modd_isba_n, ONLY : isba_t
61 !
62 USE modd_data_cover, ONLY : xdata_veg
63 USE modd_data_cover_par, ONLY : nvegtype
64 !
65 USE modi_vegtype_to_patch
66 !
67 !
68 !
69 USE yomhook ,ONLY : lhook, dr_hook
70 USE parkind1 ,ONLY : jprb
71 !
72 IMPLICIT NONE
73 !
74 !* 0.1 Declaration of arguments
75 ! ------------------------
76 !
77 !
78 TYPE(data_isba_t), INTENT(INOUT) :: dti
79 TYPE(isba_grid_t), INTENT(INOUT) :: ig
80 TYPE(isba_t), INTENT(INOUT) :: i
81 !
82 INTEGER, INTENT(IN) :: kpatch
83 !
84 !* 0.2 Declaration of local variables
85 ! ------------------------------
86 !
87 INTEGER :: ipatch
88 !
89 REAL, DIMENSION(IG%NDIM,DTI%NTIME) :: zworkpar
90 REAL, DIMENSION(SIZE(XDATA_VEG,1),SIZE(XDATA_VEG,2)) :: zworkdata
91 !
92 INTEGER :: jvegtype! loop on vegtype
93 INTEGER :: patch_list(nvegtype)
94 REAL(KIND=JPRB) :: zhook_handle
95 
96 !-------------------------------------------------------------------------------
97 !
98 !
99 IF (lhook) CALL dr_hook('FIX_MEB_VEG',0,zhook_handle)
100 !
101 DO jvegtype=1,nvegtype
102  patch_list(jvegtype) = vegtype_to_patch(jvegtype, kpatch)
103 ENDDO
104 !
105 DO jvegtype=1,nvegtype
106  !
107  zworkdata(:,:)=xdata_veg(:,:,jvegtype)
108  IF (dti%LDATA_VEG) zworkpar(:,:)=dti%XPAR_VEG(:,:,jvegtype)
109  !
110  DO ipatch=1,kpatch
111  IF(patch_list(jvegtype)==ipatch .AND. i%LMEB_PATCH(ipatch))THEN
112  zworkdata(:,:)=0.5
113  IF (dti%LDATA_VEG) zworkpar(:,:)=0.5
114  EXIT
115  ENDIF
116  ENDDO
117  !
118  xdata_veg(:,:,jvegtype)=zworkdata(:,:)
119  IF (dti%LDATA_VEG) dti%XPAR_VEG(:,:,jvegtype)=zworkpar(:,:)
120  !
121 ENDDO
122 !
123 !
124 IF (lhook) CALL dr_hook('FIX_MEB_VEG',1,zhook_handle)
125 !-------------------------------------------------------------------------------
126 !
127 END SUBROUTINE fix_meb_veg
128 
integer function vegtype_to_patch(IVEGTYPE, INPATCH)
subroutine fix_meb_veg(DTI, IG, I, KPATCH)
Definition: fix_meb_veg.F90:6