subroutine totalcloudfrac(rneb,totalrneb) implicit none !================================================================== ! ! Purpose ! ------- ! Calculates the total cloud fraction ! ! Authors ! ------- ! Adapted from the LMDTERRE code by B Charnay (2010) ! !================================================================== #include "dimensions.h" #include "dimphys.h" #include "comcstfi.h" #include "tracer.h" #include "fisice.h" #include "comgeomfi.h" #include "comdiurn.h" real rneb(ngridmx,nlayermx) ! cloud fraction real totalrneb(ngridmx) ! total cloud fraction integer recovery parameter(recovery=1) ! hypothesis behind recovery. value: ! 1 = random recovery ! 2 = maximal recovery ! 3 = minimal recovery ! Local variables integer ig, l real clear do ig=1,ngridmx totalrneb(ig) = 0. if (recovery.eq.1) then clear = (1.-rneb(ig,1)) do l=2,nlayermx clear = clear*(1.-rneb(ig,l)) enddo totalrneb(ig) = 1.-clear elseif (recovery.eq.2) then totalrneb(ig) = rneb(ig,1) do l=2,nlayermx totalrneb(ig) = max(rneb(ig,l),totalrneb(ig)) enddo elseif (recovery.eq.3) then totalrneb(ig) = rneb(ig,1) do l=2,nlayermx totalrneb(ig) = min(rneb(ig,l),totalrneb(ig)) enddo endif ! (recovery=) totalrneb(ig) = min(1.,totalrneb(ig)) totalrneb(ig) = max(0.,totalrneb(ig)) enddo ! (ig=) end subroutine totalcloudfrac