source: trunk/LMDZ.GENERIC/libf/phystd/totalcloudfrac.F90 @ 1150

Last change on this file since 1150 was 858, checked in by emillour, 12 years ago

Generic GCM:

  • Fixed sedimentation issue: ensure in callsedim that the correct radii are provided to newsedim and also that the updated temperature and tracer mixing ratios are used to compute sedimentation.
  • Updated the way aerosol radii are considered and used; routines in radii_mod (h2o_reffrad, co2_reffrad, etc.) only handle a single aerosol. The idea here is that these can be called from anywhere and that the caller doesn't need to have the full (naerkind size) array of aerosol radii.
  • cleanup (addition of intent(..) to routine arguments) in various routines

EM

File size: 3.5 KB
Line 
1      subroutine totalcloudfrac(ngrid,nq,rneb,totalrneb,pplev,pq,tau)
2
3      use watercommon_h
4      use comdiurn_h
5      USE comgeomfi_h
6      USE tracer_h, only: igcm_h2o_ice
7      implicit none
8
9!==================================================================
10!     
11!     Purpose
12!     -------
13!     Calculates the total cloud fraction
14!     
15!     Authors
16!     -------
17!     Adapted from the LMDTERRE code by B Charnay (2010)
18!     
19!==================================================================
20
21#include "dimensions.h"
22#include "dimphys.h"
23#include "comcstfi.h"
24#include "callkeys.h"
25
26      integer,intent(in) :: ngrid        ! number of atmospheric columns
27      integer,intent(in) :: nq           ! number of tracers
28      real,intent(in) :: rneb(ngrid,nlayermx)    ! cloud fraction     
29      real,intent(out) :: totalrneb(ngrid)       ! total cloud fraction
30      real,intent(in) :: pplev(ngrid,nlayermx+1) ! inter-layer pressure (Pa)
31      real,intent(in) :: pq(ngrid,nlayermx,nq)   ! tracers (.../kg_of_air)
32      real,intent(in) :: tau(ngrid,nlayermx)
33
34      real, dimension(nlayermx+1) :: masse
35      integer, parameter          :: recovery=7
36      integer ltau_max
37      real massetot
38
39! hypothesis behind recovery. value:
40! 1 = random recovery
41! 2 = maximal recovery
42! 3 = minimal recovery
43! 4 = fixed recovery
44! 5 = recovery on the thicker layer
45!     Local variables
46      integer ig, l
47      real clear,tau_min
48      real, parameter ::  tau_c=0.1 !threshold of optical depth for the calculation of total cloud fraction
49      real rneb2(nlayermx)
50
51
52      do ig=1,ngrid
53         totalrneb(ig) = 0.
54
55         if (recovery.eq.1) then
56            clear = (1.-rneb(ig,1))
57            do l=2,nlayermx       
58               clear = clear*(1.-rneb(ig,l))
59            enddo
60            totalrneb(ig) = 1.-clear
61
62         elseif (recovery.eq.2) then
63            totalrneb(ig) = rneb(ig,1)
64            do l=2,14 !nlayermx       
65               totalrneb(ig) = max(rneb(ig,l),totalrneb(ig))
66            enddo
67           
68         elseif (recovery.eq.3) then
69            totalrneb(ig) = rneb(ig,1)
70            do l=2,nlayermx       
71               totalrneb(ig) = min(rneb(ig,l),totalrneb(ig))
72            enddo
73         
74         elseif (recovery.eq.4) then
75            totalrneb(ig) = CLFfixval
76
77         elseif (recovery.eq.5) then
78            totalrneb(ig) = rneb(ig,1)           
79            do l=1,nlayermx
80               masse(l)=pq(ig,l,igcm_h2o_ice)*(pplev(ig,l)-pplev(ig,l+1))
81            enddo
82            ltau_max=maxloc(masse,dim=1)
83            totalrneb(ig) = rneb(ig,ltau_max)
84
85         elseif (recovery.eq.6) then
86            totalrneb(ig) = 0.           
87            do l=1,nlayermx
88               masse(l)=pq(ig,l,igcm_h2o_ice)*(pplev(ig,l)-pplev(ig,l+1))
89               masse(l)=max(masse(l),0.)
90            enddo
91            massetot=sum(masse,dim=1)
92            do l=1,nlayermx
93               totalrneb(ig) = totalrneb(ig)+rneb(ig,l)*masse(l)/massetot
94            enddo
95
96         elseif (recovery.eq.7) then
97
98            rneb2(:)=rneb(ig,1:nlayermx)
99            tau_min=MIN(tau_c,MAXVAL(tau(ig,1:nlayermx))/2.)
100            do l=1,nlayermx
101               if(tau(ig,l)<tau_min) rneb2(l)=0.       
102            enddo
103            totalrneb(ig)=maxval(rneb2(1:nlayermx))
104
105         endif                  ! (recovery=)   
106
107         totalrneb(ig) = min(1.,totalrneb(ig))
108         totalrneb(ig) = max(0.,totalrneb(ig))
109         
110      enddo                     ! (ig=)
111     
112     
113    end subroutine totalcloudfrac
Note: See TracBrowser for help on using the repository browser.