source: LMDZ5/branches/testing/libf/phylmd/clouds_bigauss.F90 @ 5320

Last change on this file since 5320 was 2220, checked in by Laurent Fairhead, 10 years ago

Merged trunk changes -r2186:2216 into testing branch

File size: 3.0 KB
Line 
1
2! $Header$
3
4
5! ================================================================================
6
7SUBROUTINE clouds_bigauss(klon, nd, r, rs, qtc, sigt, ptconv, ratqsc, cldf)
8  IMPLICIT NONE
9
10  ! --------------------------------------------------------------------------------
11
12  ! Inputs:
13
14  ! ND----------: Number of vertical levels
15  ! R--------ND-: Domain-averaged mixing ratio of total water
16  ! RS-------ND-: Mean saturation humidity mixing ratio within the gridbox
17  ! QSUB-----ND-: Mixing ratio of condensed water within clouds associated
18  ! with SUBGRID-SCALE condensation processes (here, it is
19  ! predicted by the convection scheme)
20  ! Outputs:
21
22  ! PTCONV-----ND-: Point convectif = TRUE
23  ! RATQSC-----ND-: Largeur normalisee de la distribution
24  ! CLDF-----ND-: Fraction nuageuse
25
26  ! --------------------------------------------------------------------------------
27
28
29  INTEGER klon, nd
30  REAL r(klon, nd), rs(klon, nd), qtc(klon, nd), sigt(klon, nd)
31  LOGICAL ptconv(klon, nd)
32  REAL ratqsc(klon, nd)
33  REAL cldf(klon, nd)
34
35  ! -- parameters controlling the iteration:
36  ! --    nmax    : maximum nb of iterations (hopefully never reached)
37  ! --    epsilon : accuracy of the numerical resolution
38  ! --    vmax    : v-value above which we use an asymptotic expression for
39  ! ERF(v)
40
41  INTEGER nmax
42  PARAMETER (nmax=10)
43  REAL epsilon, vmax0, vmax(klon)
44  PARAMETER (epsilon=0.02, vmax0=2.0)
45
46  REAL min_mu, min_q
47  PARAMETER (min_mu=1.E-12, min_q=1.E-12)
48
49  INTEGER i, k, n, m
50  REAL mu, qsat, delta
51  REAL sigma1, sigma2, alpha, qconv
52  REAL xconv, xenv
53  REAL cconv, cenv
54  REAL pi, u, v
55  REAL erf
56  REAL sqrtpi, sqrt2
57  ! lconv = true si le calcul a converge (entre autre si qsub < min_q)
58  LOGICAL lconv(klon)
59
60
61  cldf(1:klon, 1:nd) = 0.0 ! cym
62  ratqsc(1:klon, 1:nd) = 0.0
63  ptconv(1:klon, 1:nd) = .FALSE.
64  ! cdir end arraycomb
65
66  pi = acos(-1.)
67  sqrtpi = sqrt(pi)
68  sqrt2 = sqrt(2.)
69
70
71  DO k = 1, nd
72
73  DO i = 1, klon ! vector
74
75      mu = r(i, k)
76      mu = max(mu, min_mu)
77      qsat = rs(i, k)
78      qsat = max(qsat, min_mu)
79      delta = log(mu/qsat)
80      qconv=qtc(i,k)
81      alpha=sigt(i,k)
82
83     IF (qconv<min_q) THEN
84        ptconv(i, k) = .FALSE.
85        ratqsc(i, k) = 0.
86
87        ! Rien on a deja initialise
88
89      ELSE
90   
91      sigma1=0.1*((qconv-mu)**2)**0.5+0.002*mu
92      sigma2=0.1*((qconv-mu)**2)**0.5+0.002*qconv
93
94!      sigma2=0.09*((qconv-mu)**2)**0.5/(alpha+0.01)**0.5+0.002*qconv
95!-----------------------------------------------------------------------------------------------------------------
96! Calcul de la couverture nuageuse et de ratqs
97!-----------------------------------------------------------------------------------------------------------------
98
99      xconv=(qsat-qconv)/(sqrt(2.)*sigma2)
100      xenv=(qsat-mu)/(sqrt(2.)*sigma1)
101
102      cconv=0.5*(1.-1.*erf(xconv))
103      cenv=0.5*(1.-1.*erf(xenv))
104      cldf(i,k)=alpha*cconv+(1.-1.*alpha)*cenv
105      ratqsc(i,k)= alpha*sigma1+(1.-1.*alpha)*sigma2
106      ptconv(i,k)= .TRUE.
107
108     END IF
109
110  END DO ! vector
111
112
113  END DO  ! K
114
115  RETURN
116  END SUBROUTINE clouds_bigauss
117
118
119
Note: See TracBrowser for help on using the repository browser.