1 | ! |
---|
2 | MODULE calcul_fluxs_mod |
---|
3 | |
---|
4 | |
---|
5 | CONTAINS |
---|
6 | SUBROUTINE calcul_fluxs( knon, nisurf, dtime, & |
---|
7 | tsurf, p1lay, cal, beta, coef1lay, ps, & |
---|
8 | precip_rain, precip_snow, snow, qsurf, & |
---|
9 | radsol, dif_grnd, t1lay, q1lay, u1lay, v1lay, & |
---|
10 | petAcoef, peqAcoef, petBcoef, peqBcoef, & |
---|
11 | tsurf_new, evap, fluxlat, fluxsens, dflux_s, dflux_l) |
---|
12 | |
---|
13 | USE dimphy, ONLY : klon |
---|
14 | USE indice_sol_mod |
---|
15 | |
---|
16 | ! Cette routine calcule les fluxs en h et q a l'interface et eventuellement |
---|
17 | ! une temperature de surface (au cas ou ok_veget = false) |
---|
18 | ! |
---|
19 | ! L. Fairhead 4/2000 |
---|
20 | ! |
---|
21 | ! input: |
---|
22 | ! knon nombre de points a traiter |
---|
23 | ! nisurf surface a traiter |
---|
24 | ! tsurf temperature de surface |
---|
25 | ! p1lay pression 1er niveau (milieu de couche) |
---|
26 | ! cal capacite calorifique du sol |
---|
27 | ! beta evap reelle |
---|
28 | ! coef1lay coefficient d'echange |
---|
29 | ! ps pression au sol |
---|
30 | ! precip_rain precipitations liquides |
---|
31 | ! precip_snow precipitations solides |
---|
32 | ! snow champs hauteur de neige |
---|
33 | ! runoff runoff en cas de trop plein |
---|
34 | ! petAcoef coeff. A de la resolution de la CL pour t |
---|
35 | ! peqAcoef coeff. A de la resolution de la CL pour q |
---|
36 | ! petBcoef coeff. B de la resolution de la CL pour t |
---|
37 | ! peqBcoef coeff. B de la resolution de la CL pour q |
---|
38 | ! radsol rayonnement net aus sol (LW + SW) |
---|
39 | ! dif_grnd coeff. diffusion vers le sol profond |
---|
40 | ! |
---|
41 | ! output: |
---|
42 | ! tsurf_new temperature au sol |
---|
43 | ! qsurf humidite de l'air au dessus du sol |
---|
44 | ! fluxsens flux de chaleur sensible |
---|
45 | ! fluxlat flux de chaleur latente |
---|
46 | ! dflux_s derivee du flux de chaleur sensible / Ts |
---|
47 | ! dflux_l derivee du flux de chaleur latente / Ts |
---|
48 | ! |
---|
49 | |
---|
50 | INCLUDE "YOETHF.h" |
---|
51 | INCLUDE "FCTTRE.h" |
---|
52 | INCLUDE "YOMCST.h" |
---|
53 | |
---|
54 | ! Parametres d'entree |
---|
55 | !**************************************************************************************** |
---|
56 | INTEGER, INTENT(IN) :: knon, nisurf |
---|
57 | REAL , INTENT(IN) :: dtime |
---|
58 | REAL, DIMENSION(klon), INTENT(IN) :: petAcoef, peqAcoef |
---|
59 | REAL, DIMENSION(klon), INTENT(IN) :: petBcoef, peqBcoef |
---|
60 | REAL, DIMENSION(klon), INTENT(IN) :: ps, q1lay |
---|
61 | REAL, DIMENSION(klon), INTENT(IN) :: tsurf, p1lay, cal, beta, coef1lay |
---|
62 | REAL, DIMENSION(klon), INTENT(IN) :: precip_rain, precip_snow ! pas utiles |
---|
63 | REAL, DIMENSION(klon), INTENT(IN) :: radsol, dif_grnd |
---|
64 | REAL, DIMENSION(klon), INTENT(IN) :: t1lay, u1lay, v1lay |
---|
65 | |
---|
66 | ! Parametres entree-sorties |
---|
67 | !**************************************************************************************** |
---|
68 | REAL, DIMENSION(klon), INTENT(INOUT) :: snow ! snow pas utile |
---|
69 | |
---|
70 | ! Parametres sorties |
---|
71 | !**************************************************************************************** |
---|
72 | REAL, DIMENSION(klon), INTENT(OUT) :: qsurf |
---|
73 | REAL, DIMENSION(klon), INTENT(OUT) :: tsurf_new, evap, fluxsens, fluxlat |
---|
74 | REAL, DIMENSION(klon), INTENT(OUT) :: dflux_s, dflux_l |
---|
75 | |
---|
76 | ! Variables locales |
---|
77 | !**************************************************************************************** |
---|
78 | INTEGER :: i |
---|
79 | REAL, DIMENSION(klon) :: zx_mh, zx_nh, zx_oh |
---|
80 | REAL, DIMENSION(klon) :: zx_mq, zx_nq, zx_oq |
---|
81 | REAL, DIMENSION(klon) :: zx_pkh, zx_dq_s_dt, zx_qsat, zx_coef |
---|
82 | REAL, DIMENSION(klon) :: zx_sl, zx_k1 |
---|
83 | REAL, DIMENSION(klon) :: d_ts |
---|
84 | REAL :: zdelta, zcvm5, zx_qs, zcor, zx_dq_s_dh |
---|
85 | REAL :: qsat_new, q1_new |
---|
86 | REAL, PARAMETER :: t_grnd = 271.35, t_coup = 273.15 |
---|
87 | REAL, PARAMETER :: max_eau_sol = 150.0 |
---|
88 | CHARACTER (len = 20) :: modname = 'calcul_fluxs' |
---|
89 | LOGICAL :: fonte_neige |
---|
90 | LOGICAL, SAVE :: check = .FALSE. |
---|
91 | !$OMP THREADPRIVATE(check) |
---|
92 | |
---|
93 | ! End definition |
---|
94 | !**************************************************************************************** |
---|
95 | !Lluis |
---|
96 | INTEGER :: lpt |
---|
97 | lpt = 550 |
---|
98 | |
---|
99 | IF (nisurf == 3) THEN |
---|
100 | PRINT *,' Lluis in calcul_fluxs________________________' |
---|
101 | PRINT *,' knon: ',knon,' nisurf:' , nisurf, ' dtime: ',dtime |
---|
102 | PRINT *,' tsurf: ',tsurf(lpt),' p1lay: ', p1lay(lpt),' cal: ',cal(lpt),' beta: ', beta(lpt) |
---|
103 | PRINT *,' coef1lay: ', coef1lay(lpt),' ps: ', ps(lpt) |
---|
104 | PRINT *,' p_rain: ',precip_rain(lpt),' p_snow: ', precip_snow(lpt),' snow: ', snow(lpt) |
---|
105 | PRINT *,' qsurf: ', qsurf(lpt) |
---|
106 | PRINT *,' radsol: ',radsol(lpt),' dif_grnd: ', dif_grnd(lpt),' t1lay: ', t1lay(lpt) |
---|
107 | PRINT *,' q1lay: ', q1lay(lpt),' u1lay: ', u1lay(lpt),' v1lay: ', v1lay(lpt) |
---|
108 | PRINT *,' ptAcoef: ', petAcoef(lpt),' peqAcoef: ', peqAcoef(lpt) |
---|
109 | PRINT *,' pteBcoef: ', petBcoef(lpt),' peqBcoef: ', peqBcoef(lpt) |
---|
110 | PRINT *,' tsurf_new: ', tsurf_new(lpt), ' evap: ',evap(lpt),' fluxlat: ',fluxlat(lpt) |
---|
111 | PRINT *,' fluxsens: ', fluxsens(lpt),' dflux_s: ', dflux_s(lpt),' dflux_l: ', dflux_l(lpt) |
---|
112 | END IF |
---|
113 | |
---|
114 | IF (check) WRITE(*,*)'Entree ', modname,' surface = ',nisurf |
---|
115 | |
---|
116 | IF (check) THEN |
---|
117 | WRITE(*,*)' radsol (min, max)', & |
---|
118 | MINVAL(radsol(1:knon)), MAXVAL(radsol(1:knon)) |
---|
119 | ENDIF |
---|
120 | |
---|
121 | ! Traitement neige et humidite du sol |
---|
122 | !**************************************************************************************** |
---|
123 | ! |
---|
124 | !!$ WRITE(*,*)'test calcul_flux, surface ', nisurf |
---|
125 | !!PB test |
---|
126 | !!$ if (nisurf == is_oce) then |
---|
127 | !!$ snow = 0. |
---|
128 | !!$ qsol = max_eau_sol |
---|
129 | !!$ else |
---|
130 | !!$ where (precip_snow > 0.) snow = snow + (precip_snow * dtime) |
---|
131 | !!$ where (snow > epsilon(snow)) snow = max(0.0, snow - (evap * dtime)) |
---|
132 | !!$! snow = max(0.0, snow + (precip_snow - evap) * dtime) |
---|
133 | !!$ where (precip_rain > 0.) qsol = qsol + (precip_rain - evap) * dtime |
---|
134 | !!$ endif |
---|
135 | !!$ IF (nisurf /= is_ter) qsol = max_eau_sol |
---|
136 | |
---|
137 | |
---|
138 | ! |
---|
139 | ! Initialisation |
---|
140 | !**************************************************************************************** |
---|
141 | evap = 0. |
---|
142 | fluxsens=0. |
---|
143 | fluxlat=0. |
---|
144 | dflux_s = 0. |
---|
145 | dflux_l = 0. |
---|
146 | ! |
---|
147 | ! zx_qs = qsat en kg/kg |
---|
148 | !**************************************************************************************** |
---|
149 | DO i = 1, knon |
---|
150 | zx_pkh(i) = (ps(i)/ps(i))**RKAPPA |
---|
151 | IF (thermcep) THEN |
---|
152 | zdelta=MAX(0.,SIGN(1.,rtt-tsurf(i))) |
---|
153 | zcvm5 = R5LES*RLVTT*(1.-zdelta) + R5IES*RLSTT*zdelta |
---|
154 | zcvm5 = zcvm5 / RCPD / (1.0+RVTMP2*q1lay(i)) |
---|
155 | zx_qs= r2es * FOEEW(tsurf(i),zdelta)/ps(i) |
---|
156 | zx_qs=MIN(0.5,zx_qs) |
---|
157 | zcor=1./(1.-retv*zx_qs) |
---|
158 | zx_qs=zx_qs*zcor |
---|
159 | zx_dq_s_dh = FOEDE(tsurf(i),zdelta,zcvm5,zx_qs,zcor) & |
---|
160 | /RLVTT / zx_pkh(i) |
---|
161 | ELSE |
---|
162 | IF (tsurf(i).LT.t_coup) THEN |
---|
163 | zx_qs = qsats(tsurf(i)) / ps(i) |
---|
164 | zx_dq_s_dh = dqsats(tsurf(i),zx_qs)/RLVTT & |
---|
165 | / zx_pkh(i) |
---|
166 | ELSE |
---|
167 | zx_qs = qsatl(tsurf(i)) / ps(i) |
---|
168 | zx_dq_s_dh = dqsatl(tsurf(i),zx_qs)/RLVTT & |
---|
169 | / zx_pkh(i) |
---|
170 | ENDIF |
---|
171 | ENDIF |
---|
172 | zx_dq_s_dt(i) = RCPD * zx_pkh(i) * zx_dq_s_dh |
---|
173 | zx_qsat(i) = zx_qs |
---|
174 | zx_coef(i) = coef1lay(i) * & |
---|
175 | (1.0+SQRT(u1lay(i)**2+v1lay(i)**2)) * & |
---|
176 | p1lay(i)/(RD*t1lay(i)) |
---|
177 | |
---|
178 | ENDDO |
---|
179 | |
---|
180 | |
---|
181 | ! === Calcul de la temperature de surface === |
---|
182 | ! zx_sl = chaleur latente d'evaporation ou de sublimation |
---|
183 | !**************************************************************************************** |
---|
184 | |
---|
185 | DO i = 1, knon |
---|
186 | zx_sl(i) = RLVTT |
---|
187 | IF (tsurf(i) .LT. RTT) zx_sl(i) = RLSTT |
---|
188 | zx_k1(i) = zx_coef(i) |
---|
189 | ENDDO |
---|
190 | |
---|
191 | |
---|
192 | DO i = 1, knon |
---|
193 | ! Q |
---|
194 | zx_oq(i) = 1. - (beta(i) * zx_k1(i) * peqBcoef(i) * dtime) |
---|
195 | zx_mq(i) = beta(i) * zx_k1(i) * & |
---|
196 | (peqAcoef(i) - zx_qsat(i) + & |
---|
197 | zx_dq_s_dt(i) * tsurf(i)) & |
---|
198 | / zx_oq(i) |
---|
199 | zx_nq(i) = beta(i) * zx_k1(i) * (-1. * zx_dq_s_dt(i)) & |
---|
200 | / zx_oq(i) |
---|
201 | |
---|
202 | ! H |
---|
203 | zx_oh(i) = 1. - (zx_k1(i) * petBcoef(i) * dtime) |
---|
204 | zx_mh(i) = zx_k1(i) * petAcoef(i) / zx_oh(i) |
---|
205 | zx_nh(i) = - (zx_k1(i) * RCPD * zx_pkh(i))/ zx_oh(i) |
---|
206 | |
---|
207 | ! Tsurface |
---|
208 | tsurf_new(i) = (tsurf(i) + cal(i)/(RCPD * zx_pkh(i)) * dtime * & |
---|
209 | (radsol(i) + zx_mh(i) + zx_sl(i) * zx_mq(i)) & |
---|
210 | + dif_grnd(i) * t_grnd * dtime)/ & |
---|
211 | ( 1. - dtime * cal(i)/(RCPD * zx_pkh(i)) * ( & |
---|
212 | zx_nh(i) + zx_sl(i) * zx_nq(i)) & |
---|
213 | + dtime * dif_grnd(i)) |
---|
214 | |
---|
215 | ! |
---|
216 | ! Y'a-t-il fonte de neige? |
---|
217 | ! |
---|
218 | ! fonte_neige = (nisurf /= is_oce) .AND. & |
---|
219 | ! & (snow(i) > epsfra .OR. nisurf == is_sic .OR. nisurf == is_lic) & |
---|
220 | ! & .AND. (tsurf_new(i) >= RTT) |
---|
221 | ! if (fonte_neige) tsurf_new(i) = RTT |
---|
222 | d_ts(i) = tsurf_new(i) - tsurf(i) |
---|
223 | ! zx_h_ts(i) = tsurf_new(i) * RCPD * zx_pkh(i) |
---|
224 | ! zx_q_0(i) = zx_qsat(i) + zx_dq_s_dt(i) * d_ts(i) |
---|
225 | |
---|
226 | !== flux_q est le flux de vapeur d'eau: kg/(m**2 s) positive vers bas |
---|
227 | !== flux_t est le flux de cpt (energie sensible): j/(m**2 s) |
---|
228 | evap(i) = - zx_mq(i) - zx_nq(i) * tsurf_new(i) |
---|
229 | fluxlat(i) = - evap(i) * zx_sl(i) |
---|
230 | fluxsens(i) = zx_mh(i) + zx_nh(i) * tsurf_new(i) |
---|
231 | |
---|
232 | ! Derives des flux dF/dTs (W m-2 K-1): |
---|
233 | dflux_s(i) = zx_nh(i) |
---|
234 | dflux_l(i) = (zx_sl(i) * zx_nq(i)) |
---|
235 | |
---|
236 | ! Nouvelle valeure de l'humidite au dessus du sol |
---|
237 | qsat_new=zx_qsat(i) + zx_dq_s_dt(i) * d_ts(i) |
---|
238 | q1_new = peqAcoef(i) - peqBcoef(i)*evap(i)*dtime |
---|
239 | qsurf(i)=q1_new*(1.-beta(i)) + beta(i)*qsat_new |
---|
240 | ! |
---|
241 | ! en cas de fonte de neige |
---|
242 | ! |
---|
243 | ! if (fonte_neige) then |
---|
244 | ! bilan_f = radsol(i) + fluxsens(i) - (zx_sl(i) * evap (i)) - & |
---|
245 | ! & dif_grnd(i) * (tsurf_new(i) - t_grnd) - & |
---|
246 | ! & RCPD * (zx_pkh(i))/cal(i)/dtime * (tsurf_new(i) - tsurf(i)) |
---|
247 | ! bilan_f = max(0., bilan_f) |
---|
248 | ! fq_fonte = bilan_f / zx_sl(i) |
---|
249 | ! snow(i) = max(0., snow(i) - fq_fonte * dtime) |
---|
250 | ! qsol(i) = qsol(i) + (fq_fonte * dtime) |
---|
251 | ! endif |
---|
252 | !!$ if (nisurf == is_ter) & |
---|
253 | !!$ & run_off(i) = run_off(i) + max(qsol(i) - max_eau_sol, 0.0) |
---|
254 | !!$ qsol(i) = min(qsol(i), max_eau_sol) |
---|
255 | ENDDO |
---|
256 | ! |
---|
257 | !**************************************************************************************** |
---|
258 | ! |
---|
259 | END SUBROUTINE calcul_fluxs |
---|
260 | ! |
---|
261 | !**************************************************************************************** |
---|
262 | ! |
---|
263 | SUBROUTINE calcul_flux_wind(knon, dtime, & |
---|
264 | u0, v0, u1, v1, cdrag_m, & |
---|
265 | AcoefU, AcoefV, BcoefU, BcoefV, & |
---|
266 | p1lay, t1lay, & |
---|
267 | flux_u1, flux_v1) |
---|
268 | |
---|
269 | USE dimphy |
---|
270 | INCLUDE "YOMCST.h" |
---|
271 | |
---|
272 | ! Input arguments |
---|
273 | !**************************************************************************************** |
---|
274 | INTEGER, INTENT(IN) :: knon |
---|
275 | REAL, INTENT(IN) :: dtime |
---|
276 | REAL, DIMENSION(klon), INTENT(IN) :: u0, v0 ! u and v at niveau 0 |
---|
277 | REAL, DIMENSION(klon), INTENT(IN) :: u1, v1 ! u and v at niveau 1 |
---|
278 | REAL, DIMENSION(klon), INTENT(IN) :: cdrag_m ! cdrag pour momentum |
---|
279 | REAL, DIMENSION(klon), INTENT(IN) :: AcoefU, AcoefV, BcoefU, BcoefV |
---|
280 | REAL, DIMENSION(klon), INTENT(IN) :: p1lay ! pression 1er niveau (milieu de couche) |
---|
281 | REAL, DIMENSION(klon), INTENT(IN) :: t1lay ! temperature |
---|
282 | ! Output arguments |
---|
283 | !**************************************************************************************** |
---|
284 | REAL, DIMENSION(klon), INTENT(OUT) :: flux_u1 |
---|
285 | REAL, DIMENSION(klon), INTENT(OUT) :: flux_v1 |
---|
286 | |
---|
287 | ! Local variables |
---|
288 | !**************************************************************************************** |
---|
289 | INTEGER :: i |
---|
290 | REAL :: mod_wind, buf |
---|
291 | |
---|
292 | !**************************************************************************************** |
---|
293 | ! Calculate the surface flux |
---|
294 | ! |
---|
295 | !**************************************************************************************** |
---|
296 | DO i=1,knon |
---|
297 | mod_wind = 1.0 + SQRT((u1(i) - u0(i))**2 + (v1(i)-v0(i))**2) |
---|
298 | buf = cdrag_m(i) * mod_wind * p1lay(i)/(RD*t1lay(i)) |
---|
299 | flux_u1(i) = (AcoefU(i) - u0(i)) / (1/buf - BcoefU(i)*dtime ) |
---|
300 | flux_v1(i) = (AcoefV(i) - v0(i)) / (1/buf - BcoefV(i)*dtime ) |
---|
301 | END DO |
---|
302 | |
---|
303 | END SUBROUTINE calcul_flux_wind |
---|
304 | ! |
---|
305 | !**************************************************************************************** |
---|
306 | ! |
---|
307 | END MODULE calcul_fluxs_mod |
---|