1 |
guez |
54 |
module calcul_fluxs_m |
2 |
|
|
|
3 |
|
|
implicit none |
4 |
|
|
|
5 |
|
|
contains |
6 |
|
|
|
7 |
guez |
279 |
SUBROUTINE calcul_fluxs(dtime, tsurf, p1lay, cal, beta, coef1lay, ps, qsurf, & |
8 |
|
|
radsol, dif_grnd, t1lay, q1lay, u1lay, v1lay, petAcoef, peqAcoef, & |
9 |
|
|
petBcoef, peqBcoef, tsurf_new, evap, fluxlat, flux_t, dflux_s, dflux_l) |
10 |
guez |
54 |
|
11 |
guez |
207 |
! Cette routine calcule les flux en h et q à l'interface et une |
12 |
guez |
99 |
! température de surface. |
13 |
guez |
54 |
|
14 |
guez |
214 |
! L. Fairhead, April 2000 |
15 |
guez |
54 |
|
16 |
guez |
279 |
! Note that, if cal = 0, beta = 1 and dif_grnd = 0, then tsurf_new |
17 |
|
|
! = tsurf and qsurf = qsat. |
18 |
|
|
|
19 |
|
|
use nr_util, only: assert_eq |
20 |
|
|
|
21 |
guez |
221 |
USE fcttre, ONLY: foede, foeew |
22 |
guez |
178 |
USE suphec_m, ONLY: rcpd, rd, retv, rlstt, rlvtt, rtt |
23 |
guez |
104 |
USE yoethf_m, ONLY: r2es, r5ies, r5les, rvtmp2 |
24 |
|
|
|
25 |
|
|
real, intent(IN):: dtime |
26 |
guez |
206 |
real, intent(IN):: tsurf(:) ! (knon) température de surface |
27 |
|
|
|
28 |
|
|
real, intent(IN):: p1lay(:) ! (knon) |
29 |
|
|
! pression première couche (milieu de couche) |
30 |
|
|
|
31 |
guez |
104 |
real, intent(IN):: cal(:) ! (knon) capacité calorifique du sol |
32 |
guez |
206 |
real, intent(IN):: beta(:) ! (knon) évaporation réelle |
33 |
guez |
104 |
real, intent(IN):: coef1lay(:) ! (knon) coefficient d'échange |
34 |
|
|
real, intent(IN):: ps(:) ! (knon) pression au sol |
35 |
guez |
206 |
real, intent(OUT):: qsurf(:) ! (knon) humidité de l'air au-dessus du sol |
36 |
guez |
104 |
|
37 |
guez |
206 |
real, intent(IN):: radsol(:) ! (knon) |
38 |
|
|
! rayonnement net au sol (longwave + shortwave) |
39 |
|
|
|
40 |
guez |
104 |
real, intent(IN):: dif_grnd(:) ! (knon) |
41 |
guez |
206 |
! coefficient de diffusion vers le sol profond |
42 |
guez |
104 |
|
43 |
|
|
real, intent(IN):: t1lay(:), q1lay(:), u1lay(:), v1lay(:) ! (knon) |
44 |
|
|
|
45 |
|
|
real, intent(IN):: petAcoef(:), peqAcoef(:) ! (knon) |
46 |
guez |
206 |
! coefficients A de la résolution de la couche limite pour T et q |
47 |
guez |
104 |
|
48 |
|
|
real, intent(IN):: petBcoef(:), peqBcoef(:) ! (knon) |
49 |
guez |
206 |
! coefficients B de la résolution de la couche limite pour t et q |
50 |
guez |
54 |
|
51 |
guez |
104 |
real, intent(OUT):: tsurf_new(:) ! (knon) température au sol |
52 |
guez |
171 |
real, intent(OUT):: evap(:) ! (knon) |
53 |
|
|
|
54 |
guez |
206 |
real, intent(OUT):: fluxlat(:), flux_t(:) ! (knon) |
55 |
guez |
207 |
! flux de chaleurs latente et sensible |
56 |
guez |
171 |
|
57 |
guez |
104 |
real, intent(OUT):: dflux_s(:), dflux_l(:) ! (knon) |
58 |
guez |
171 |
! dérivées des flux de chaleurs sensible et latente par rapport à |
59 |
|
|
! Ts (W m-2 K-1) |
60 |
guez |
54 |
|
61 |
guez |
104 |
! Local: |
62 |
|
|
integer i |
63 |
guez |
279 |
integer knon ! nombre de points \`a traiter |
64 |
guez |
206 |
real, dimension(size(ps)):: mh, oh, mq, nq, oq, dq_s_dt, coef ! (knon) |
65 |
guez |
207 |
real qsat(size(ps)) ! (knon) mass fraction |
66 |
|
|
real sl(size(ps)) ! (knon) chaleur latente d'évaporation ou de sublimation |
67 |
guez |
105 |
logical delta |
68 |
|
|
real zcor |
69 |
guez |
207 |
real, parameter:: t_grnd = 271.35 |
70 |
guez |
54 |
|
71 |
guez |
104 |
!--------------------------------------------------------------------- |
72 |
guez |
54 |
|
73 |
guez |
279 |
knon = assert_eq([size(tsurf), size(p1lay), size(cal), size(beta), & |
74 |
guez |
104 |
size(coef1lay), size(ps), size(qsurf), size(radsol), size(dif_grnd), & |
75 |
|
|
size(t1lay), size(q1lay), size(u1lay), size(v1lay), size(petAcoef), & |
76 |
|
|
size(peqAcoef), size(petBcoef), size(peqBcoef), size(tsurf_new), & |
77 |
guez |
206 |
size(evap), size(fluxlat), size(flux_t), size(dflux_s), & |
78 |
guez |
279 |
size(dflux_l)], "calcul_fluxs knon") |
79 |
guez |
54 |
|
80 |
guez |
206 |
! Traitement de l'humidité du sol |
81 |
guez |
54 |
|
82 |
guez |
207 |
DO i = 1, knon |
83 |
|
|
delta = rtt >= tsurf(i) |
84 |
|
|
qsat(i) = MIN(0.5, r2es * FOEEW(tsurf(i), delta) / ps(i)) |
85 |
|
|
zcor = 1. / (1. - retv * qsat(i)) |
86 |
|
|
qsat(i) = qsat(i) * zcor |
87 |
|
|
dq_s_dt(i) = RCPD * FOEDE(tsurf(i), delta, merge(R5IES * RLSTT, & |
88 |
|
|
R5LES * RLVTT, delta) / RCPD / (1. + RVTMP2 * q1lay(i)), & |
89 |
|
|
qsat(i), zcor) / RLVTT |
90 |
|
|
ENDDO |
91 |
guez |
54 |
|
92 |
guez |
105 |
coef = coef1lay * (1. + SQRT(u1lay**2 + v1lay**2)) * p1lay / (RD * t1lay) |
93 |
|
|
sl = merge(RLSTT, RLVTT, tsurf < RTT) |
94 |
guez |
54 |
|
95 |
guez |
105 |
! Q |
96 |
guez |
266 |
oq = 1. - beta * coef * peqBcoef * dtime |
97 |
guez |
105 |
mq = beta * coef * (peqAcoef - qsat + dq_s_dt * tsurf) / oq |
98 |
guez |
279 |
nq = - beta * coef * dq_s_dt / oq |
99 |
guez |
54 |
|
100 |
guez |
105 |
! H |
101 |
guez |
279 |
oh = 1. - coef * petBcoef * dtime |
102 |
guez |
105 |
mh = coef * petAcoef / oh |
103 |
guez |
279 |
dflux_s = - coef * RCPD / oh |
104 |
guez |
54 |
|
105 |
guez |
105 |
tsurf_new = (tsurf + cal / RCPD * dtime * (radsol + mh + sl * mq) & |
106 |
|
|
+ dif_grnd * t_grnd * dtime) / (1. - dtime * cal / RCPD * (dflux_s & |
107 |
|
|
+ sl * nq) + dtime * dif_grnd) |
108 |
|
|
evap = - mq - nq * tsurf_new |
109 |
|
|
fluxlat = - evap * sl |
110 |
guez |
206 |
flux_t = mh + dflux_s * tsurf_new |
111 |
guez |
105 |
dflux_l = sl * nq |
112 |
|
|
qsurf = (peqAcoef - peqBcoef * evap * dtime) * (1. - beta) + beta * (qsat & |
113 |
|
|
+ dq_s_dt * (tsurf_new - tsurf)) |
114 |
guez |
54 |
|
115 |
|
|
END SUBROUTINE calcul_fluxs |
116 |
|
|
|
117 |
|
|
end module calcul_fluxs_m |