10 |
|
|
11 |
use numer_rec_95, only: nr_erf |
use numer_rec_95, only: nr_erf |
12 |
|
|
13 |
! Inputs: |
INTEGER, intent(in):: klon |
14 |
|
INTEGER, intent(in):: ND ! number of vertical levels |
15 |
|
|
16 |
! ND : Number of vertical levels |
REAL, intent(in):: R(klon, ND) |
17 |
! R ND: Domain-averaged mixing ratio of total water |
! domain-averaged mixing ratio of total water |
|
! RS ND: Mean saturation humidity mixing ratio within the gridbox |
|
18 |
|
|
19 |
! QSUB ND: Mixing ratio of condensed water within clouds associated |
REAL, intent(in):: RS(klon, ND) |
20 |
|
! mean saturation humidity mixing ratio within the gridbox |
21 |
|
|
22 |
|
REAL, intent(in):: QSUB(klon, ND) |
23 |
|
! mixing ratio of condensed water within clouds associated |
24 |
! with SUBGRID-SCALE condensation processes (here, it is |
! with SUBGRID-SCALE condensation processes (here, it is |
25 |
! predicted by the convection scheme) |
! predicted by the convection scheme) |
26 |
|
|
27 |
! Outputs: |
LOGICAL, intent(out):: PTCONV(klon, ND) ! Point convectif = TRUE |
28 |
|
REAL, intent(out):: RATQSC(klon, ND) ! largeur normalisee de la distribution |
29 |
! PTCONV ND: Point convectif = TRUE |
REAL, intent(out):: CLDF(klon, ND) ! fraction nuageuse |
|
! RATQSC ND: Largeur normalisee de la distribution |
|
|
! CLDF ND: Fraction nuageuse |
|
|
|
|
|
INTEGER klon, ND |
|
|
REAL R(klon, ND), RS(klon, ND), QSUB(klon, ND) |
|
|
LOGICAL PTCONV(klon, ND) |
|
|
REAL RATQSC(klon, ND) |
|
|
REAL CLDF(klon, ND) |
|
30 |
|
|
31 |
|
! Local: |
32 |
|
|
33 |
! parameters controlling the iteration: |
! parameters controlling the iteration: |
34 |
! nmax : maximum nb of iterations (hopefully never reached) |
! nmax : maximum nb of iterations (hopefully never reached) |
35 |
! epsilon : accuracy of the numerical resolution |
! epsilon : accuracy of the numerical resolution |
46 |
INTEGER i, K, n |
INTEGER i, K, n |
47 |
REAL mu(klon), qsat(klon), delta(klon), beta(klon) |
REAL mu(klon), qsat(klon), delta(klon), beta(klon) |
48 |
real zu2(klon), zv2(klon) |
real zu2(klon), zv2(klon) |
49 |
REAL xx(klon), aux(klon), coeff(klon), block(klon) |
REAL xx(klon), aux(klon), coeff(klon), my_block(klon) |
50 |
REAL dist(klon), fprime(klon), det(klon) |
REAL dist(klon), fprime(klon), det(klon) |
51 |
REAL pi, u(klon), v(klon), erfcu(klon), erfcv(klon) |
REAL pi, u(klon), v(klon), erfcu(klon), erfcv(klon) |
52 |
REAL xx1(klon), xx2(klon) |
REAL xx1(klon), xx2(klon) |
56 |
|
|
57 |
!-------------------------------------------------------------- |
!-------------------------------------------------------------- |
58 |
|
|
59 |
cldf(:, :)=0.0 |
cldf=0.0 |
60 |
|
|
61 |
pi = ACOS(-1.) |
pi = ACOS(-1.) |
62 |
sqrtpi=sqrt(pi) |
sqrtpi=sqrt(pi) |
129 |
enddo |
enddo |
130 |
|
|
131 |
! Debut des nmax iterations pour trouver la solution. |
! Debut des nmax iterations pour trouver la solution. |
132 |
DO n = 1, nmax |
loop_n: DO n = 1, nmax |
133 |
loop_horizontal: do i = 1, klon |
loop_horizontal: do i = 1, klon |
134 |
test_lconv: if (.not.lconv(i)) then |
test_lconv: if (.not.lconv(i)) then |
135 |
u(i) = delta(i)/(xx(i)*sqrt2) + xx(i)/(2.*sqrt2) |
u(i) = delta(i)/(xx(i)*sqrt2) + xx(i)/(2.*sqrt2) |
145 |
aux(i)=0. |
aux(i)=0. |
146 |
endif |
endif |
147 |
xx(i) = -SQRT(aux(i)) |
xx(i) = -SQRT(aux(i)) |
148 |
block(i) = EXP(-v(i)*v(i)) / v(i) / sqrtpi |
my_block(i) = EXP(-v(i)*v(i)) / v(i) / sqrtpi |
149 |
dist(i) = 0.0 |
dist(i) = 0.0 |
150 |
fprime(i) = 1.0 |
fprime(i) = 1.0 |
151 |
ELSE |
ELSE |
156 |
! Attention : ajout d'un seuil pour l'exponentielle |
! Attention : ajout d'un seuil pour l'exponentielle |
157 |
aux(i) = sqrtpi*erfcu(i)*EXP(min(v(i)*v(i), 80.)) |
aux(i) = sqrtpi*erfcu(i)*EXP(min(v(i)*v(i), 80.)) |
158 |
coeff(i) = 1.0 - 1./2./(v(i)**2.) + 3./4./(v(i)**4.) |
coeff(i) = 1.0 - 1./2./(v(i)**2.) + 3./4./(v(i)**4.) |
159 |
block(i) = coeff(i) * EXP(-v(i)*v(i)) / v(i) / sqrtpi |
my_block(i) = coeff(i) * EXP(-v(i)*v(i)) / v(i) / sqrtpi |
160 |
dist(i) = v(i) * aux(i) / coeff(i) - beta(i) |
dist(i) = v(i) * aux(i) / coeff(i) - beta(i) |
161 |
fprime(i) = 2.0 / xx(i) * (v(i)**2.) & |
fprime(i) = 2.0 / xx(i) * (v(i)**2.) & |
162 |
* ( coeff(i)*EXP(-delta(i)) - u(i) * aux(i) ) & |
* ( coeff(i)*EXP(-delta(i)) - u(i) * aux(i) ) & |
167 |
|
|
168 |
erfcu(i) = 1.0-NR_ERF(u(i)) |
erfcu(i) = 1.0-NR_ERF(u(i)) |
169 |
erfcv(i) = 1.0-NR_ERF(v(i)) |
erfcv(i) = 1.0-NR_ERF(v(i)) |
170 |
block(i) = erfcv(i) |
my_block(i) = erfcv(i) |
171 |
dist(i) = erfcu(i) / erfcv(i) - beta(i) |
dist(i) = erfcu(i) / erfcv(i) - beta(i) |
172 |
zu2(i)=u(i)*u(i) |
zu2(i)=u(i)*u(i) |
173 |
zv2(i)=v(i)*v(i) |
zv2(i)=v(i)*v(i) |
189 |
! borne pour l'exponentielle |
! borne pour l'exponentielle |
190 |
ratqsc(i, k)=min(2.*(v(i)-u(i))**2, 20.) |
ratqsc(i, k)=min(2.*(v(i)-u(i))**2, 20.) |
191 |
ratqsc(i, k)=sqrt(exp(ratqsc(i, k))-1.) |
ratqsc(i, k)=sqrt(exp(ratqsc(i, k))-1.) |
192 |
CLDF(i, K) = 0.5 * block(i) |
CLDF(i, K) = 0.5 * my_block(i) |
193 |
else |
else |
194 |
xx(i) = xx(i) - dist(i)/fprime(i) |
xx(i) = xx(i) - dist(i)/fprime(i) |
195 |
endif |
endif |
196 |
endif test_lconv |
endif test_lconv |
197 |
enddo loop_horizontal |
enddo loop_horizontal |
198 |
ENDDO |
ENDDO loop_n |
199 |
end DO loop_vertical |
end DO loop_vertical |
200 |
|
|
201 |
END SUBROUTINE CLOUDS_GNO |
END SUBROUTINE CLOUDS_GNO |