SURFEX v8.1
General documentation of Surfex
canopy_evol_tke.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_tke(SB, KI, PTSTEP, PRHOA, PFORC_E, PDFORC_EDE, &
7  PTH, PUW, PWTH, PWQ, PLEPS )
8 ! #########################################
9 !
10 !!**** *CANOPY_EVOL_TKE* - evolution of wind in canopy
11 !!
12 !!
13 !! PURPOSE
14 !! -------
15 !!
16 !!** METHOD
17 !! ------
18 !!
19 !! EXTERNAL
20 !! --------
21 !!
22 !!
23 !! IMPLICIT ARGUMENTS
24 !! ------------------
25 !!
26 !! REFERENCE
27 !! ---------
28 !!
29 !!
30 !! AUTHOR
31 !! ------
32 !! V. Masson *Meteo France*
33 !!
34 !! MODIFICATIONS
35 !! -------------
36 !! Original 07/2006
37 !-------------------------------------------------------------------------------
38 !
39 !* 0. DECLARATIONS
40 ! ------------
41 !
42 USE modd_canopy_n, ONLY : canopy_t
43 !
44 USE modi_tridiag_surf
45 USE modd_canopy_turb, ONLY : xced, xtkemin
46 USE modd_csts, ONLY : xg, xrd, xrv
47 !
48 !
49 USE yomhook ,ONLY : lhook, dr_hook
50 USE parkind1 ,ONLY : jprb
51 !
52 IMPLICIT NONE
53 !
54 !* 0.1 Declarations of arguments
55 ! -------------------------
56 !
57 TYPE(canopy_t), INTENT(INOUT) :: SB
58 !
59 INTEGER, INTENT(IN) :: KI ! number of horizontal points
60 REAL, INTENT(IN) :: PTSTEP ! time-step (s)
61 REAL, DIMENSION(KI), INTENT(IN) :: PRHOA ! Air density (kg/m3)
62 REAL, DIMENSION(KI,SB%NLVL), INTENT(IN) :: PFORC_E ! tendency of wind due to canopy drag (m2/s3)
63 REAL, DIMENSION(KI,SB%NLVL), INTENT(IN) :: PDFORC_EDE! formal derivative of the tendency of
64 ! ! wind due to canopy drag (1/s)
65 REAL, DIMENSION(KI,SB%NLVL), INTENT(IN) :: PTH ! pot. temp. at canopy levels (K)
66 REAL, DIMENSION(KI,SB%NLVL), INTENT(IN) :: PUW ! turbulent flux (at half levels) (m2/s2)
67 REAL, DIMENSION(KI,SB%NLVL), INTENT(IN) :: PWTH ! w'Th' flux (at half levels) (mK/s)
68 REAL, DIMENSION(KI,SB%NLVL), INTENT(IN) :: PWQ ! w'q' flux (at half levels) (kg/m2/s)
69 REAL, DIMENSION(KI,SB%NLVL), INTENT(IN) :: PLEPS ! dissipative length (full levels) (m)
70 !
71 !
72 !* 0.2 Declarations of local variables
73 ! -------------------------------
74 !
75 INTEGER :: JLAYER ! loop counter on layers
76 !
77 REAL, DIMENSION(KI,SB%NLVL) :: ZDUDZ ! dU/dz at mid levels
78 REAL, DIMENSION(KI,SB%NLVL) :: ZDP ! dynamical production at full levels
79 ! ! (at full levels)
80 REAL, DIMENSION(KI,SB%NLVL) :: ZTP ! thermal production at full levels
81 ! ! (at full levels)
82 REAL, DIMENSION(KI,SB%NLVL) :: ZDISS_O_TKE ! dissipation/TKE ratio at full levels
83 REAL, DIMENSION(KI,SB%NLVL) :: ZF ! turbulent flux at mid levels
84 REAL, DIMENSION(KI,SB%NLVL) :: ZDFDDVDZ ! derivative of turbulent flux as a
85 ! ! function of vertical gradient of wind variable
86 ! ! (at mid levels)
87 REAL, DIMENSION(KI,SB%NLVL) :: ZEXT ! external forcing at full levels
88 REAL, DIMENSION(KI,SB%NLVL) :: ZDEXTDV ! derivative of external forcing as a
89 ! ! function of vertical variable
90 ! ! (at full levels)
91 REAL, DIMENSION(KI,SB%NLVL) :: ZTKE ! TKE at canopy levels (work var.)
92 REAL(KIND=JPRB) :: ZHOOK_HANDLE
93 !
94 !-------------------------------------------------------------------------------
95 !
96 !
97 !* 1. initializations
98 ! ---------------
99 !
100 !* external forces
101 !
102 IF (lhook) CALL dr_hook('CANOPY_EVOL_TKE',0,zhook_handle)
103 zext = 0.
104 zdextdv = 0.
105 !
106 !* turbulent flux
107 !
108 zf = 0.
109 zdfddvdz = 0.
110 !
111 !-------------------------------------------------------------------------------
112 !
113 !* 2. wind vertical derivative mid layers (at half levels below full levels)
114 ! ------------------------
115 !
116 zdudz(:,:) = -999.
117 DO jlayer=2,sb%NLVL
118  zdudz(:,jlayer) = (sb%XU(:,jlayer) - sb%XU(:,jlayer-1)) / sb%XDZF(:,jlayer)
119 END DO
120 !-------------------------------------------------------------------------------
121 !
122 !* 3. Dynamical production of TKE (at full levels)
123 ! ---------------------------
124 !
125 zdp(:,:) = -999.
126 !
127 !* first level using an extrapolation using a 1/z law
128 zdp(:,1) = - puw(:,2) * zdudz(:,2) * (sb%XZF(:,2)/sb%XZ(:,1))
129 
130 ! other levels
131 DO jlayer=2,sb%NLVL-1
132  zdp(:,jlayer) = - 0.5 * (puw(:,jlayer) * zdudz(:,jlayer) ) &
133  - 0.5 * (puw(:,jlayer+1) * zdudz(:,jlayer+1))
134 END DO
135 !
136 !* upper level using an extrapolation using a 1/z law
137 zdp(:,sb%NLVL) = - puw(:,sb%NLVL) * zdudz(:,sb%NLVL) * (sb%XZF(:,sb%NLVL)/sb%XZ(:,sb%NLVL))
138 !
139 !* adds dynamical production in non-transport forces
140 zext = zext + zdp
141 zdextdv = zdextdv + 0.
142 !
143 !-------------------------------------------------------------------------------
144 !
145 !* 4. Thermal production of TKE (at full levels)
146 ! -------------------------
147 !
148 ztp(:,:) = -999.
149 !
150 ! other levels
151 DO jlayer=1,sb%NLVL-1
152  ztp(:,jlayer) = xg/pth(:,jlayer) * 0.5 * ( (pwth(:,jlayer) + pwth(:,jlayer+1) ) &
153  + (xrv/xrd-1) * (pwq(:,jlayer) + pwq(:,jlayer) )/prhoa(:) )
154 END DO
155 !
156 !* upper level
157 ztp(:,sb%NLVL) = xg/pth(:,sb%NLVL) * pwth(:,sb%NLVL)
158 !
159 !* adds dynamical production in non-transport forces
160 zext = zext + ztp
161 zdextdv = zdextdv + 0.
162 !
163 !-------------------------------------------------------------------------------
164 !
165 !* 4. Dissipation/TKE ratio (to prepare implicitation of dissipation)
166 ! ---------------------
167 !
168 zdiss_o_tke = - xced * sqrt(sb%XTKE(:,:)) / pleps(:,:)
169 !
170 !* adds dissipation in non-transport forces
171 zext = zext + zdiss_o_tke * sb%XTKE(:,:)
172 zdextdv = zdextdv + 1.5 * zdiss_o_tke
173 !
174 !-------------------------------------------------------------------------------
175 !
176 !* 6. Adds Creation force due to canopy
177 ! ---------------------------------
178 !
179 !
180 zext = zext + pforc_e(:,:)
181 zdextdv = zdextdv + pdforc_ede(:,:)
182 
183 
184 !-------------------------------------------------------------------------------
185 !
186 !* 7. Evolution of TKE due to Dyn prod, Dissipation and Drag production
187 ! -----------------------------------------------------------------
188 !
189 !* note that dissipation is implicited
190 !
191  CALL tridiag_surf(sb%XTKE,zf,zdfddvdz,zext,zdextdv,ptstep,sb%XDZF,sb%XDZ,ztke)
192 !
193 !-------------------------------------------------------------------------------
194 !
195 !* 7. New value of TKE (at full levels)
196 ! ----------------
197 !
198 sb%XTKE(:,:) = ztke(:,:)
199 !
200 !-------------------------------------------------------------------------------
201 !
202 !* 8. Security at all levels : set minimum threshold
203 ! ----------------------
204 !
205 sb%XTKE(:,:) = max(sb%XTKE,xtkemin)
206 !
207 IF (lhook) CALL dr_hook('CANOPY_EVOL_TKE',1,zhook_handle)
208 !
209 !----------------------------------------------------------------
210 !
211 END SUBROUTINE canopy_evol_tke
subroutine canopy_evol_tke(SB, KI, PTSTEP, PRHOA, PFORC_E, PDFORC_
real, save xrd
Definition: modd_csts.F90:62
real, save xg
Definition: modd_csts.F90:55
integer, parameter jprb
Definition: parkind1.F90:32
real, save xrv
Definition: modd_csts.F90:62
logical lhook
Definition: yomhook.F90:15
subroutine tridiag_surf(PVARM, PF, PDFDDTDZ, PEXT, PDEXTDV, PTSTEP, PDZZ, PDZM, PVARP, OIMPL, PALFA, PBETA)
Definition: tridiag_surf.F90:8