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

Last change on this file since 1980 was 1542, checked in by emillour, 9 years ago

Generic GCM:

  • fix for 1D in writediagfi to enable writing at "ecritphy" rate.
  • move iniprint.h to "misc"
  • Some code cleanup in anticipation of future updates:
    • changed variable names in comgeomphy.F90: give them more explicit names: rlond => longitude , rlatd => latitude, airephy => cell_area, cuphy => dx , cvphy => dy
    • removed long(), lati() and area() from comgeomfi_h.F90, use longitude(), latitude() and cell_are() from comgeomphy.F90 instead

EM

File size: 3.4 KB
Line 
1      subroutine totalcloudfrac(ngrid,nlayer,nq,rneb,totalrneb,pplev,pq,tau)
2
3      use watercommon_h
4      use comdiurn_h
5      USE tracer_h, only: igcm_h2o_ice
6      USE callkeys_mod, ONLY: CLFfixval
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      integer,intent(in) :: ngrid        ! number of atmospheric columns
22      integer,intent(in) :: nlayer       ! number of atmospheric layers
23      integer,intent(in) :: nq           ! number of tracers
24      real,intent(in) :: rneb(ngrid,nlayer)    ! cloud fraction     
25      real,intent(out) :: totalrneb(ngrid)       ! total cloud fraction
26      real,intent(in) :: pplev(ngrid,nlayer+1) ! inter-layer pressure (Pa)
27      real,intent(in) :: pq(ngrid,nlayer,nq)   ! tracers (.../kg_of_air)
28      real,intent(in) :: tau(ngrid,nlayer)
29
30      real, dimension(nlayer+1) :: masse
31      integer, parameter          :: recovery=7
32      integer ltau_max
33      real massetot
34
35! hypothesis behind recovery. value:
36! 1 = random recovery
37! 2 = maximal recovery
38! 3 = minimal recovery
39! 4 = fixed recovery
40! 5 = recovery on the thicker layer
41!     Local variables
42      integer ig, l
43      real clear,tau_min
44      real, parameter ::  tau_c=0.1 !threshold of optical depth for the calculation of total cloud fraction
45      real rneb2(nlayer)
46
47
48      do ig=1,ngrid
49         totalrneb(ig) = 0.
50
51         if (recovery.eq.1) then
52            clear = (1.-rneb(ig,1))
53            do l=2,nlayer     
54               clear = clear*(1.-rneb(ig,l))
55            enddo
56            totalrneb(ig) = 1.-clear
57
58         elseif (recovery.eq.2) then
59            totalrneb(ig) = rneb(ig,1)
60            do l=2,14 !nlayer   
61               totalrneb(ig) = max(rneb(ig,l),totalrneb(ig))
62            enddo
63           
64         elseif (recovery.eq.3) then
65            totalrneb(ig) = rneb(ig,1)
66            do l=2,nlayer   
67               totalrneb(ig) = min(rneb(ig,l),totalrneb(ig))
68            enddo
69         
70         elseif (recovery.eq.4) then
71            totalrneb(ig) = CLFfixval
72
73         elseif (recovery.eq.5) then
74            totalrneb(ig) = rneb(ig,1)           
75            do l=1,nlayer
76               masse(l)=pq(ig,l,igcm_h2o_ice)*(pplev(ig,l)-pplev(ig,l+1))
77            enddo
78            ltau_max=maxloc(masse,dim=1)
79            totalrneb(ig) = rneb(ig,ltau_max)
80
81         elseif (recovery.eq.6) then
82            totalrneb(ig) = 0.           
83            do l=1,nlayer
84               masse(l)=pq(ig,l,igcm_h2o_ice)*(pplev(ig,l)-pplev(ig,l+1))
85               masse(l)=max(masse(l),0.)
86            enddo
87            massetot=sum(masse,dim=1)
88            do l=1,nlayer
89               totalrneb(ig) = totalrneb(ig)+rneb(ig,l)*masse(l)/massetot
90            enddo
91
92         elseif (recovery.eq.7) then
93
94            rneb2(:)=rneb(ig,1:nlayer)
95            tau_min=MIN(tau_c,MAXVAL(tau(ig,1:nlayer))/2.)
96            do l=1,nlayer
97               if(tau(ig,l)<tau_min) rneb2(l)=0.       
98            enddo
99            totalrneb(ig)=maxval(rneb2(1:nlayer))
100
101         endif                  ! (recovery=)   
102
103         totalrneb(ig) = min(1.,totalrneb(ig))
104         totalrneb(ig) = max(0.,totalrneb(ig))
105         
106      enddo                     ! (ig=)
107     
108     
109    end subroutine totalcloudfrac
Note: See TracBrowser for help on using the repository browser.