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