SURFEX v8.1
General documentation of Surfex
canopy_evol.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 canopy_evol(SB, KI, PTSTEP, KIMPL, PZZ, PWIND, PTA, PQA, PPA, PRHOA, &
7  PSFLUX_U, PSFLUX_T, PSFLUX_Q, PFORC_U, PDFORC_UDU, &
8  PFORC_E, PDFORC_EDE, PFORC_T, PDFORC_TDT, &
9  PFORC_Q, PDFORC_QDQ, PLM, PLEPS, PUSTAR, &
10  PALFAU, PBETAU, PALFATH, PBETATH, PALFAQ, PBETAQ, &
11  ONEUTRAL )
12 ! #########################################
13 !
14 !!**** *CANOPY_EVOL* - evolution of canopy
15 !!
16 !!
17 !! PURPOSE
18 !! -------
19 !!
20 !!** METHOD
21 !! ------
22 !!
23 !! EXTERNAL
24 !! --------
25 !!
26 !!
27 !! IMPLICIT ARGUMENTS
28 !! ------------------
29 !!
30 !! REFERENCE
31 !! ---------
32 !!
33 !!
34 !! AUTHOR
35 !! ------
36 !! V. Masson *Meteo France*
37 !!
38 !! MODIFICATIONS
39 !! -------------
40 !! Original 07/2006
41 !-------------------------------------------------------------------------------
42 !
43 !* 0. DECLARATIONS
44 ! ------------
45 !
46 USE modd_canopy_n, ONLY : canopy_t
47 !
48 USE modd_csts, ONLY : xg, xrd, xcpd, xp00
49 USE modd_surf_par, ONLY : xundef
50 USE modd_canopy_turb, ONLY : xcmfs, xcshf
51 !
52 USE modi_rmc01_surf
53 USE modi_canopy_evol_wind
54 USE modi_canopy_evol_tke
55 USE modi_canopy_evol_temp
56 !
57 USE mode_sbls
58 !
59 USE yomhook ,ONLY : lhook, dr_hook
60 USE parkind1 ,ONLY : jprb
61 !
62 IMPLICIT NONE
63 !
64 !* 0.1 Declarations of arguments
65 ! -------------------------
66 !
67 TYPE(canopy_t), INTENT(INOUT) :: SB
68 !
69 INTEGER, INTENT(IN) :: KI ! number of horizontal points
70 REAL, INTENT(IN) :: PTSTEP ! atmospheric time-step (s)
71 INTEGER, INTENT(IN) :: KIMPL ! implicitation code:
72 ! ! 1 : computes only alfa and beta coupling
73 ! ! coefficients for all variables
74 ! ! 2 : computes temporal evolution of the
75 ! ! variables
76 REAL, DIMENSION(KI,SB%NLVL), INTENT(IN) :: PZZ ! Mixing length generic profile at mid levels (-)
77 REAL, DIMENSION(KI), INTENT(IN) :: PWIND ! wind speed (m/s)
78 REAL, DIMENSION(KI), INTENT(IN) :: PTA ! Air temperature (K)
79 REAL, DIMENSION(KI), INTENT(IN) :: PQA ! Air humidity (kg/m3)
80 REAL, DIMENSION(KI), INTENT(IN) :: PPA ! Pressure at forcing level (Pa)
81 REAL, DIMENSION(KI), INTENT(IN) :: PRHOA ! Air density at forcing level (kg/m3)
82 REAL, DIMENSION(KI), INTENT(IN) :: PSFLUX_U ! surface flux u'w' (m2/s2)
83 REAL, DIMENSION(KI), INTENT(IN) :: PSFLUX_T ! surface flux w'T' (Km/s)
84 REAL, DIMENSION(KI), INTENT(IN) :: PSFLUX_Q ! surface flux w'q' (kg/m2/s)
85 REAL, DIMENSION(KI,SB%NLVL), INTENT(IN) :: PFORC_U ! tendency of wind due to canopy drag (m/s2)
86 REAL, DIMENSION(KI,SB%NLVL), INTENT(IN) :: PDFORC_UDU! formal derivative of the tendency of
87 ! ! wind due to canopy drag (1/s)
88 REAL, DIMENSION(KI,SB%NLVL), INTENT(IN) :: PFORC_E ! tendency of TKE due to canopy drag (m2/s3)
89 REAL, DIMENSION(KI,SB%NLVL), INTENT(IN) :: PDFORC_EDE! formal derivative of the tendency of
90 ! ! TKE due to canopy drag (1/s)
91 REAL, DIMENSION(KI,SB%NLVL), INTENT(IN) :: PFORC_T ! tendency of Temp due to canopy drag (T/s)
92 REAL, DIMENSION(KI,SB%NLVL), INTENT(IN) :: PDFORC_TDT! formal derivative of the tendency of
93 ! ! Temp due to canopy drag (1/s)
94 REAL, DIMENSION(KI,SB%NLVL), INTENT(IN) :: PFORC_Q ! tendency of Hum. due to canopy drag (kg/m3/s)
95 REAL, DIMENSION(KI,SB%NLVL), INTENT(IN) :: PDFORC_QDQ! formal derivative of the tendency of
96 ! ! Hum. due to canopy drag (1/s)
97 !
98 REAL, DIMENSION(KI,SB%NLVL), INTENT(OUT) :: PLM ! mixing length (m)
99 REAL, DIMENSION(KI,SB%NLVL), INTENT(OUT) :: PLEPS ! dissipative length (m)
100 REAL, DIMENSION(KI), INTENT(OUT) :: PUSTAR ! friction velocity at forcing level (m/s)
101 !
102 REAL, DIMENSION(KI), INTENT(OUT) :: PALFAU ! V+(1) = alfa u'w'(1) + beta
103 REAL, DIMENSION(KI), INTENT(OUT) :: PBETAU ! V+(1) = alfa u'w'(1) + beta
104 REAL, DIMENSION(KI), INTENT(OUT) :: PALFATH ! Th+(1) = alfa w'th'(1) + beta
105 REAL, DIMENSION(KI), INTENT(OUT) :: PBETATH ! Th+(1) = alfa w'th'(1) + beta
106 REAL, DIMENSION(KI), INTENT(OUT) :: PALFAQ ! Q+(1) = alfa w'q'(1) + beta
107 REAL, DIMENSION(KI), INTENT(OUT) :: PBETAQ ! Q+(1) = alfa w'q'(1) + beta
108 !
109 LOGICAL, OPTIONAL, INTENT(IN) :: ONEUTRAL
110 !
111 !* 0.2 Declarations of local variables
112 ! -------------------------------
113 !
114 LOGICAL :: GNEUTRAL
115 !
116 INTEGER :: JLAYER ! loop counter on layers
117 INTEGER :: JI ! loop counter
118 !
119 REAL, DIMENSION(KI,SB%NLVL) :: ZK ! mixing coefficient
120 REAL, DIMENSION(KI,SB%NLVL) :: ZDKDDVDZ ! formal derivative of mixing coefficient according to variable vertical gradient
121 REAL, DIMENSION(KI,SB%NLVL) :: ZTH ! potential temperature at full levels
122 REAL, DIMENSION(KI) :: ZTHA ! potential temperature at forcing level
123 REAL, DIMENSION(KI,SB%NLVL) :: ZEXN ! Exner function at full levels
124 REAL, DIMENSION(KI,SB%NLVL) :: ZUW ! friction at mid levels
125 REAL, DIMENSION(KI) :: ZSFLUX_TH ! Surface flux w'Th' (mK/s)
126 REAL, DIMENSION(KI,SB%NLVL) :: ZFORC_TH ! tendency of Temp due to canopy drag (T/s)
127 REAL, DIMENSION(KI,SB%NLVL) :: ZDFORC_THDTH ! formal derivative of the tendency of
128 ! ! Temp due to canopy drag (1/s)
129 REAL, DIMENSION(KI,SB%NLVL) :: ZWTH ! w'Th' at mid levels
130 REAL, DIMENSION(KI,SB%NLVL) :: ZWQ ! w'q' at mid levels
131 REAL, DIMENSION(KI,SB%NLVL) :: ZSFTH ! heat flux at atmospheric forcing level
132 REAL, DIMENSION(KI,SB%NLVL) :: ZSFRV ! vapor flux at atmospheric forcing level
133 REAL :: ZZ0 ! a value of z0 just for first time-step init.
134 REAL, DIMENSION(KI,SB%NLVL) :: ZRHOA ! air density profile
135 REAL(KIND=JPRB) :: ZHOOK_HANDLE
136 !-------------------------------------------------------------------------------
137 IF (lhook) CALL dr_hook('CANOPY_EVOL',0,zhook_handle)
138 !
139 gneutral = .false.
140 !
141 IF (PRESENT(oneutral)) gneutral = oneutral
142 !
143 !* 1. First time step initialization
144 ! ------------------------------
145 !
146 !* first time step (i.e. wind profile is initially zero) :
147 ! set a neutral wind profile in relation with forcing wind
148 DO ji=1,ki
149  IF(pwind(ji)>0. .AND. sb%XU(ji,sb%NLVL-1)==0.) THEN
150  zz0 = sb%XZ(ji,1)/2.
151  sb%XU(ji,:) = pwind(ji) * log(sb%XZ(ji,:)/zz0) / log(sb%XZ(ji,sb%NLVL)/zz0)
152  END IF
153 END DO
154 !-------------------------------------------------------------------------------
155 !
156 !* 5. mixing and dissipative lengths (at full levels)
157 ! ------------------------------
158 !
159  CALL rmc01_surf(pzz,sb%XLMO,plm,pleps,gneutral)
160 !
161 !-------------------------------------------------------------------------------
162 !
163 !* 6. time evolution of wind in canopy
164 ! --------------------------------
165 !
166 !* 6.1 mixing coefficient for wind at mid layers (at half levels)
167 ! ---------------------------
168 !
169 zk = -999.
170 DO jlayer=2,sb%NLVL
171  zk(:,jlayer) = 0.5 * xcmfs * plm(:,jlayer) * sqrt(sb%XTKE(:,jlayer) ) &
172  + 0.5 * xcmfs * plm(:,jlayer-1) * sqrt(sb%XTKE(:,jlayer-1))
173 END DO
174 !
175 !
176 !* 6.2 mixing coefficient vertical derivative at mid layers (at half levels)
177 ! --------------------------------------
178 !
179 !* there is no formal dependency on wind
180 zdkddvdz = 0.
181 !
182 !
183 !* 6.3 time evolution of wind in canopy
184 ! --------------------------------
185 !
186  CALL canopy_evol_wind(sb, ki, ptstep, kimpl, pwind, zk, zdkddvdz,&
187  psflux_u, pforc_u, pdforc_udu, zuw, palfau, pbetau)
188 !
189 !* 6.4 Friction velocity at top of SBL layers
190 ! --------------------------------------
191 !
192 pustar = sqrt(abs(zuw(:,sb%NLVL)))
193 !
194 !-------------------------------------------------------------------------------
195 !
196 IF (gneutral) THEN
197  !
198  zth = 300.
199  zwth = 0.
200  zwq = 0.
201  !
202 ELSE
203  !
204  !* 7. time evolution of temperature in canopy
205  ! ---------------------------------------
206  !
207  !* 7.3 convertion into potential temperature (at half levels)
208  ! -------------------------------------
209  !
210  DO jlayer=1,sb%NLVL
211  sb%XP(:,jlayer) = ppa(:) + xg * prhoa(:) * (sb%XZ(:,sb%NLVL) - sb%XZ(:,jlayer))
212  END DO
213  zexn = (sb%XP/xp00)**(xrd/xcpd)
214  !
215  zth = xundef
216  WHERE(sb%XT/=xundef) zth(:,:) = sb%XT(:,:) / zexn(:,:)
217  !
218  ztha(:) = pta(:) / zexn(:,sb%NLVL)
219  !
220  !* 7.1 mixing coefficient for wind at mid layers (at half levels)
221  ! ---------------------------
222  !
223  zk = -999.
224  DO jlayer=2,sb%NLVL
225  zk(:,jlayer) = 0.5 * xcshf * plm(:,jlayer) * sqrt(sb%XTKE(:,jlayer) ) &
226  + 0.5 * xcshf * plm(:,jlayer-1) * sqrt(sb%XTKE(:,jlayer-1))
227  END DO
228  !
229  !* 7.2 mixing coefficient vertical derivative at mid layers (at half levels)
230  ! --------------------------------------
231  !
232  !* there is no formal dependency on temperature
233  zdkddvdz = 0.
234  !
235  !* 7.4 conversion of canopy tendency into potential temperature tendency
236  ! -----------------------------------------------------------------
237  !
238  zsflux_th = psflux_t / zexn(:,1)
239  zforc_th = pforc_t / zexn
240  zdforc_thdth = pdforc_tdt
241  !
242  !
243  !* 7.5 time evolution of temperature in canopy
244  ! ---------------------------------------
245  !
246  CALL canopy_evol_temp(sb, ki, ptstep, kimpl, ztha, zk, zdkddvdz, &
247  zsflux_th, zforc_th, zdforc_thdth, zth, zwth, palfath, pbetath)
248  !
249  !* 7.6 convertion into absolute temperature
250  ! ------------------------------------
251  !
252  WHERE(sb%XT/=xundef) sb%XT(:,:) = zth(:,:) * zexn(:,:)
253  !
254  !-------------------------------------------------------------------------------
255  !
256  !* 8. time evolution of Humidity in canopy
257  ! ------------------------------------
258  !
259  CALL canopy_evol_temp(sb, ki, ptstep, kimpl, pqa, zk, zdkddvdz, &
260  psflux_q, pforc_q, pdforc_qdq, sb%XQ, zwq, palfaq, pbetaq)
261  !
262  !-------------------------------------------------------------------------------
263  IF (kimpl==1 .AND. lhook) CALL dr_hook('CANOPY_EVOL',1,zhook_handle)
264  IF (kimpl==1) RETURN
265  !-------------------------------------------------------------------------------
266  !
267 ENDIF
268 !
269 !* 9. time evolution of TKE in canopy
270 ! -------------------------------
271 !
272  CALL canopy_evol_tke(sb, ki, ptstep, prhoa, pforc_e, pdforc_ede, zth, zuw, zwth, zwq, pleps)
273 !
274 !-------------------------------------------------------------------------------
275 !
276 IF (.NOT.gneutral) THEN
277  !
278  !* 10. Monin-Obuhkov length
279  ! --------------------
280  !
281  !* MO length is estimated using the heat and vapor turbulent fluxes at atmospheric level
282  ! (it avoids the problems of vertical variation of the fluxes in the canopy)
283  ! However, friction flux MUST be taken as the maximum flux on the
284  ! profile, in order to avoid unrealistically small MO length when using
285  ! small time-steps
286  !
287  zrhoa(:,:) = spread(prhoa(:),2,sb%NLVL)
288  !
289  zsfth(:,:) = zwth(:,:)
290  zsfrv(:,:) = zwq(:,:) / zrhoa(:,:)
291  !
292  sb%XLMO(:,:) = lmo(sqrt(abs(zuw)),sb%XT,sb%XQ,zsfth,zsfrv)
293  !
294  DO jlayer=1,sb%NLVL
295  WHERE (sb%XLMO(:,jlayer)>0.) sb%XLMO(:,jlayer) = max(sb%XLMO(:,jlayer),sb%XZ(:,sb%NLVL))
296  WHERE (sb%XLMO(:,jlayer)<0.) sb%XLMO(:,jlayer) = min(sb%XLMO(:,jlayer),-sb%XZ(:,sb%NLVL))
297  ENDDO
298  !
299  !-------------------------------------------------------------------------------
300  !
301  !* 11. Security at atmospheric forcing level
302  ! -------------------------------------
303  !
304  sb%XT(:,sb%NLVL) = pta(:)
305  !
306  sb%XQ(:,sb%NLVL) = pqa(:)
307  !
308 ENDIF
309 !
310 sb%XU(:,sb%NLVL) = pwind(:)
311 !
312 IF (lhook) CALL dr_hook('CANOPY_EVOL',1,zhook_handle)
313 !
314 !-------------------------------------------------------------------------------
315 END SUBROUTINE canopy_evol
316 
subroutine canopy_evol_tke(SB, KI, PTSTEP, PRHOA, PFORC_E, PDFORC_
real, save xcpd
Definition: modd_csts.F90:63
real, parameter xundef
real, save xrd
Definition: modd_csts.F90:62
subroutine canopy_evol(SB, KI, PTSTEP, KIMPL, PZZ, PWIND, PTA, PQA
Definition: canopy_evol.F90:7
real, save xg
Definition: modd_csts.F90:55
integer, parameter jprb
Definition: parkind1.F90:32
logical lhook
Definition: yomhook.F90:15
subroutine canopy_evol_wind(SB, KI, PTSTEP, KIMPL, PWIND, PK, PDKD
subroutine rmc01_surf(PZ, PLMO, PLK, PLEPS, ONEUTRAL)
Definition: rmc01_surf.F90:7
real, save xp00
Definition: modd_csts.F90:57
subroutine canopy_evol_temp(SB, KI, PTSTEP, KIMPL,PTHA, PK, PDKDD