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

Last change on this file since 2987 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
RevLine 
[1308]1      subroutine totalcloudfrac(ngrid,nlayer,nq,rneb,totalrneb,pplev,pq,tau)
[253]2
[728]3      use watercommon_h
[787]4      use comdiurn_h
[858]5      USE tracer_h, only: igcm_h2o_ice
[1397]6      USE callkeys_mod, ONLY: CLFfixval
[253]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
[858]21      integer,intent(in) :: ngrid        ! number of atmospheric columns
[1308]22      integer,intent(in) :: nlayer       ! number of atmospheric layers
[858]23      integer,intent(in) :: nq           ! number of tracers
[1308]24      real,intent(in) :: rneb(ngrid,nlayer)    ! cloud fraction     
[858]25      real,intent(out) :: totalrneb(ngrid)       ! total cloud fraction
[1308]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)
[728]29
[1308]30      real, dimension(nlayer+1) :: masse
[728]31      integer, parameter          :: recovery=7
32      integer ltau_max
33      real massetot
[253]34
35! hypothesis behind recovery. value:
36! 1 = random recovery
37! 2 = maximal recovery
38! 3 = minimal recovery
[728]39! 4 = fixed recovery
40! 5 = recovery on the thicker layer
[253]41!     Local variables
42      integer ig, l
[728]43      real clear,tau_min
44      real, parameter ::  tau_c=0.1 !threshold of optical depth for the calculation of total cloud fraction
[1308]45      real rneb2(nlayer)
[253]46
[728]47
[787]48      do ig=1,ngrid
[253]49         totalrneb(ig) = 0.
50
51         if (recovery.eq.1) then
52            clear = (1.-rneb(ig,1))
[1308]53            do l=2,nlayer     
[253]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)
[1308]60            do l=2,14 !nlayer   
[253]61               totalrneb(ig) = max(rneb(ig,l),totalrneb(ig))
62            enddo
63           
64         elseif (recovery.eq.3) then
65            totalrneb(ig) = rneb(ig,1)
[1308]66            do l=2,nlayer   
[253]67               totalrneb(ig) = min(rneb(ig,l),totalrneb(ig))
68            enddo
69         
[728]70         elseif (recovery.eq.4) then
71            totalrneb(ig) = CLFfixval
72
73         elseif (recovery.eq.5) then
74            totalrneb(ig) = rneb(ig,1)           
[1308]75            do l=1,nlayer
[728]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.           
[1308]83            do l=1,nlayer
[728]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)
[1308]88            do l=1,nlayer
[728]89               totalrneb(ig) = totalrneb(ig)+rneb(ig,l)*masse(l)/massetot
90            enddo
91
92         elseif (recovery.eq.7) then
93
[1308]94            rneb2(:)=rneb(ig,1:nlayer)
95            tau_min=MIN(tau_c,MAXVAL(tau(ig,1:nlayer))/2.)
96            do l=1,nlayer
[728]97               if(tau(ig,l)<tau_min) rneb2(l)=0.       
98            enddo
[1308]99            totalrneb(ig)=maxval(rneb2(1:nlayer))
[728]100
101         endif                  ! (recovery=)   
102
[253]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.