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