SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
canopy_evol_field.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_field(KI, KLVL, PTSTEP, KIMPL, PK, PDKDDVDZ, &
7  psflux_f, pforc_f, pdforc_fdf, pdz, pdzf, &
8  pext, pdextdv, pf, pwf, palfa, pbeta )
9 ! #########################################
10 !
11 !!**** *CANOPY_EVOL_FIELD* - evolution of wind in canopy
12 !!
13 !!
14 !! PURPOSE
15 !! -------
16 !!
17 !!** METHOD
18 !! ------
19 !!
20 !! EXTERNAL
21 !! --------
22 !!
23 !!
24 !! IMPLICIT ARGUMENTS
25 !! ------------------
26 !!
27 !! REFERENCE
28 !! ---------
29 !!
30 !!
31 !! AUTHOR
32 !! ------
33 !! V. Masson *Meteo France*
34 !!
35 !! MODIFICATIONS
36 !! -------------
37 !! Original 07/2006
38 !-------------------------------------------------------------------------------
39 !
40 !* 0. DECLARATIONS
41 ! ------------
42 !
43 USE modi_tridiag_surf
44 !
45 USE yomhook ,ONLY : lhook, dr_hook
46 USE parkind1 ,ONLY : jprb
47 !
48 IMPLICIT NONE
49 !
50 !* 0.1 Declarations of arguments
51 ! -------------------------
52 !
53 INTEGER, INTENT(IN) :: ki ! number of horizontal points
54 INTEGER, INTENT(IN) :: klvl ! number of levels in canopy
55 REAL, INTENT(IN) :: ptstep ! time-step (s)
56 INTEGER, INTENT(IN) :: kimpl ! implicitation code:
57 ! ! 1 : computes only alfa and beta coupling
58 ! ! coefficients for all variables
59 ! ! 2 : computes temporal evolution of the
60 ! ! variables
61 REAL, DIMENSION(KI,KLVL), INTENT(IN) :: pk ! mixing exchange coefficient (m2/s)
62 REAL, DIMENSION(KI,KLVL), INTENT(IN) :: pdkddvdz ! derivative of mixing coefficient as a
63 ! ! function of vertical gradient of wind
64 ! ! (at mid levels) (m2)
65 REAL, DIMENSION(KI), INTENT(IN) :: psflux_f ! surface flux w'Th' (mK/s)
66 REAL, DIMENSION(KI,KLVL), INTENT(IN) :: pforc_f ! tendency of wind due to canopy drag (K/s)
67 REAL, DIMENSION(KI,KLVL), INTENT(IN) :: pdforc_fdf! formal derivative of the tendency of
68 ! ! wind due to canopy drag (1/s)
69 REAL, DIMENSION(KI,KLVL), INTENT(IN) :: pdz ! deltaZ between canopy half levels,
70 ! ! located at full levels (m)
71 REAL, DIMENSION(KI,KLVL), INTENT(IN) :: pdzf ! deltaZ between canopy (full) levels,
72 ! ! located at half levels (m)
73 REAL, DIMENSION(KI,KLVL), INTENT(IN) :: pext ! external forcing at full levels
74 REAL, DIMENSION(KI,KLVL), INTENT(IN) :: pdextdv ! derivative of external forcing as a
75 ! ! function of vertical variable
76 ! ! (at full levels)
77 REAL, DIMENSION(KI,KLVL), INTENT(INOUT) :: pf ! pot. temp. at canopy levels (K)
78 REAL, DIMENSION(KI,KLVL), INTENT(OUT) :: pwf ! turbulent flux (at half levels) (mK/s)
79 REAL, DIMENSION(KI), OPTIONAL, INTENT(OUT) :: palfa ! V+(1) = alfa F(1) + beta
80 REAL, DIMENSION(KI), OPTIONAL, INTENT(OUT) :: pbeta ! V+(1) = alfa F(1) + beta
81 !
82 !
83 !* 0.2 Declarations of local variables
84 ! -------------------------------
85 !
86 INTEGER :: jlayer ! loop counter on layers
87 !
88 REAL, DIMENSION(KI,KLVL) :: zdfdz ! dTh/dz at mid levels
89 REAL, DIMENSION(KI,KLVL) :: zwork ! work variable : wind at futur instant
90 ! ! (or past at the end of the routine)
91 REAL, DIMENSION(KI,KLVL) :: zf ! turbulent flux at mid levels
92 REAL, DIMENSION(KI,KLVL) :: zdfddvdz ! derivative of turbulent flux as a
93 ! ! function of vertical gradient of wind variable
94 ! ! (at mid levels)
95 REAL, DIMENSION(KI) :: zdfadt ! dTHa/dt at forcing level
96 REAL, DIMENSION(KI) :: zdwfdz ! dw'Th'/dz at forcing level
97 REAL, DIMENSION(KI) :: zalfa, zbeta
98 LOGICAL :: limpl
99 REAL(KIND=JPRB) :: zhook_handle
100 !
101 !-------------------------------------------------------------------------------
102 !
103 !
104 !* 1. initializations
105 ! ---------------
106 !
107 !* external forces
108 !
109 IF (lhook) CALL dr_hook('CANOPY_EVOL_FIELD',0,zhook_handle)
110 !
111 !-------------------------------------------------------------------------------
112 !
113 !* 2. pot. temp. vertical derivative (at half levels below full levels)
114 ! ------------------------------
115 !
116 zdfdz(:,:) = -999.
117 DO jlayer=2,klvl
118  zdfdz(:,jlayer) = (pf(:,jlayer) - pf(:,jlayer-1)) / pdzf(:,jlayer)
119 END DO
120 !
121 !-------------------------------------------------------------------------------
122 !
123 !* 3. turbulent flux (at half levels below full levels)
124 ! --------------
125 !
126 zwork = -999.
127 !
128 !* surface flux
129 zwork(:,1) = psflux_f(:)
130 !
131 !* flux at other levels
132 DO jlayer=2,klvl
133  zwork(:,jlayer) = -pk(:,jlayer) * zdfdz(:,jlayer)
134 END DO
135 !
136 !-------------------------------------------------------------------------------
137 !
138 !* 4. formal derivative of turbulent flux for variable X=(dU/dz)
139 ! ----------------------------------------------------------
140 !
141 !* no implicitation of surface flux
142 !
143 zdfddvdz(:,:) = 0.
144 !
145 !* other levels (at half levels below full levels)
146 !
147 zdfddvdz(:,2:klvl) = - pk(:,2:klvl) - pdkddvdz(:,2:klvl) * zdfdz(:,2:klvl)
148 !
149 !-------------------------------------------------------------------------------
150 !
151 !* 7. adds Forces & divergence of turbulent flux to dU/dt (at full levels)
152 ! ---------------------------------------------------
153 !
154 limpl=(kimpl==1)
155  CALL tridiag_surf(pf, zwork, zdfddvdz, pext, pdextdv, ptstep, &
156  pdzf, pdz, zf, limpl, zalfa, zbeta )
157 !
158 IF (present(palfa)) palfa = zalfa
159 IF (present(pbeta)) pbeta = zbeta
160 !
161 !-------------------------------------------------------------------------------
162 !
163 !* 8. updated turbulent flux (at half levels below full levels)
164 ! ----------------------
165 !
166 pwf(:,:) = -999.
167 pwf(:,1) = psflux_f(:)
168 !
169 DO jlayer=2,klvl
170  pwf(:,jlayer) = pwf(:,jlayer-1) &
171  + ( pforc_f(:,jlayer-1) + pdforc_fdf(:,jlayer-1) * (zf(:,jlayer-1)-pf(:,jlayer-1)) ) &
172  * pdz(:,jlayer-1)
173 END DO
174 !
175 !-------------------------------------------------------------------------------
176 !
177 !* 8. New value of potential temperature (at full levels)
178 ! ----------------------------------
179 !
180 pf(:,:) = zf(:,:)
181 !
182 IF (lhook) CALL dr_hook('CANOPY_EVOL_FIELD',1,zhook_handle)
183 !----------------------------------------------------------------
184 !
185 END SUBROUTINE canopy_evol_field
subroutine canopy_evol_field(KI, KLVL, PTSTEP, KIMPL, PK, PDKDDVDZ, PSFLUX_F, PFORC_F, PDFORC_FDF, PDZ, PDZF, PEXT, PDEXTDV, PF, PWF, PALFA, PBETA)
subroutine tridiag_surf(PVARM, PF, PDFDDTDZ, PEXT, PDEXTDV, PTSTEP, PDZZ, PDZM, PVARP, OIMPL, PALFA, PBETA)
Definition: tridiag_surf.F90:6