← Back to Documentation Home
CCPP SciDoc v8.0.0  v8.0.0
Common Community Physics Package Developed at DTC
 
Loading...
Searching...
No Matches
canopy_mask.F90
1 module canopy_mask_mod
2
3 use machine , only : kind_phys
4
5 implicit none
6
7 public :: canopy_mask_init, canopy_mask_run
8
9 contains
10
11!:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
12 subroutine canopy_mask_init(im, km, nkc, nkt, &
13 claie, cfch, cfrt, cclu, cpopu, & !in:
14 FRT_mask, & ! out
15 errmsg,errflg)
16
17 implicit none
18
19! Horizontal arrays
20 integer :: im, km ! horizontal & vertical domain specifications
21 integer, intent(in) :: nkc, nkt
22
23 real(kind=kind_phys) :: claie(im), cfch(im), cfrt(im), &
24 cclu(im),cpopu(im)
25 real(kind=kind_phys) :: frt_mask(im)
26
27 character(len=*), intent(out) :: errmsg
28 integer, intent(out) :: errflg
29
30!...local variables
31
32! Initialize CCPP error handling variables
33 errmsg = ''
34 errflg = 0
35
36!...Allocate and initialize new canopy arrays
37
38! Initializations
39
40 frt_mask(:)=0.0
41
42 return
43 end subroutine canopy_mask_init
44
45!:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
46
47 subroutine canopy_mask_run (im, km, nkc, nkt, & !in:
48 claie, cfch, cfrt, cclu, cpopu, & !in:
49 FRT_mask, & !out:
50 errmsg,errflg)
51
52 implicit none
53
54!...Arguments:
55
56! Horizontal arrays
57 integer :: im, km ! horizontal & vertical domain specifications
58 integer, intent(in) :: nkc, nkt
59
60 real(kind=kind_phys) :: claie(im), cfch(im), cfrt(im), &
61 cclu(im), cpopu(im)
62 real(kind=kind_phys) :: frt_mask(im)
63
64 character(len=*), intent(out) :: errmsg
65 integer, intent(out) :: errflg
66
67!...local variables
68
69 integer i
70
71! Initialize CCPP error handling variables
72 errmsg = ''
73 errflg = 0
74
75 do i=1,im
76
77 !NOT a Continuous forest canopy
78 if ( claie(i) .LT. 0.1 &
79 .OR. cfch(i) .LT. 0.5 &
80!IVAI: modified contiguous canopy condition
81! .OR. MAX(0.0, 1.0 - cfrt(i)) .GT. 0.5
82 .OR. max(0.0, 1.0 - cfrt(i)) .GT. 0.75 &
83 .OR. cpopu(i) .GT. 10000.0 &
84 .OR. (exp(-0.5*claie(i)*cclu(i)) .GT. 0.45 &
85 .AND. cfch(i) .LT. 18.) ) THEN
86
87 frt_mask(i) = -1.0
88
89 ! Continuous forest canopy
90 ELSE
91
92 frt_mask(i) = 1.0
93
94 END IF ! Forest Canopy Mask
95
96 end do
97
98 return
99 end subroutine canopy_mask_run
100
101 end module canopy_mask_mod