/[lmdze]/trunk/phylmd/Interface_surf/calcul_fluxs.f
ViewVC logotype

Annotation of /trunk/phylmd/Interface_surf/calcul_fluxs.f

Parent Directory Parent Directory | Revision Log Revision Log


Revision 300 - (hide annotations)
Thu Aug 2 15:55:01 2018 UTC (5 years, 10 months ago) by guez
File size: 4187 byte(s)
The calls to calcul_fluxs were always done with an array argument
dif_grnd set to a scalar (and that is also the case in LMDZ). So just
use a scalar argument.

In procedure fonte_neige, the value of run_off_lic from previous call
was actually not used. So we can remove the save attribute and make it
an automatic array.

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

  ViewVC Help
Powered by ViewVC 1.1.21