UPP  001
 All Data Structures Files Functions Pages
CALWXT_DOMINANT.f
1  SUBROUTINE calwxt_dominant_post(PREC,RAIN,FREEZR,SLEET,SNOW, &
2  & domr,domzr,domip,doms)
3 !
4 ! WRITTEN: 24 AUGUST 2005, G MANIKIN
5 !
6 ! THIS ROUTINE TAKES THE PRECIP TYPE SOLUTIONS FROM DIFFERENT
7 ! ALGORITHMS AND SUMS THEM UP TO GIVE A DOMINANT TYPE
8 !
9 ! use params_mod
10  use ctlblk_mod, only: jsta, jend, pthresh, im, jsta_2l, jend_2u
11 ! use ctlblk_mod
12 !- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13  implicit none
14 !
15  integer,PARAMETER :: nalg=5
16 ! INPUT:
17  REAL prec(im,jsta_2l:jend_2u)
18  real,DIMENSION(IM,jsta:jend), intent(inout) :: doms,domr,domzr,domip
19  real,DIMENSION(IM,jsta:jend,NALG),intent(in) :: rain,snow,sleet,freezr
20  integer i,j,l
21  real totsn,totip,totr,totzr
22 !--------------------------------------------------------------------------
23 !$omp parallel do private(i,j)
24  DO j=jsta,jend
25  DO i=1,im
26  domr(i,j) = 0.
27  doms(i,j) = 0.
28  domzr(i,j) = 0.
29  domip(i,j) = 0.
30  ENDDO
31  ENDDO
32 !
33 !$omp parallel do private(i,j,totsn,totip,totr,totzr)
34  DO j=jsta,jend
35  DO i=1,im
36 ! SKIP THIS POINT IF NO PRECIP THIS TIME STEP
37  IF (prec(i,j) <= pthresh) cycle
38  totsn = 0
39  totip = 0
40  totr = 0
41  totzr = 0
42 ! LOOP OVER THE NUMBER OF DIFFERENT ALGORITHMS THAT ARE USED
43  DO l = 1, nalg
44  IF (rain(i,j,l) > 0) THEN
45  totr = totr + 1
46  cycle
47  ENDIF
48 
49  IF (snow(i,j,l) > 0) THEN
50  totsn = totsn + 1
51  cycle
52  ENDIF
53 
54  IF (sleet(i,j,l) > 0) THEN
55  totip = totip + 1
56  cycle
57  ENDIF
58 
59  IF (freezr(i,j,l) > 0) THEN
60  totzr = totzr + 1
61  ENDIF
62  enddo
63 
64 ! TIES ARE BROKEN TO FAVOR THE MOST DANGEROUS FORM OF PRECIP
65 ! FREEZING RAIN > SNOW > SLEET > RAIN
66  IF (totsn > totip) THEN
67  IF (totsn > totzr) THEN
68  IF (totsn >= totr) THEN
69  doms(i,j) = 1
70  ELSE
71  domr(i,j) = 1
72  ENDIF
73  ELSE IF (totzr >= totr) THEN
74  domzr(i,j) = 1
75  ELSE
76  domr(i,j) = 1
77  ENDIF
78  ELSE IF (totip > totzr) THEN
79  IF (totip >= totr) THEN
80  domip(i,j) = 1
81  ELSE
82  domr(i,j) = 1
83  ENDIF
84  ELSE IF (totzr >= totr) THEN
85  domzr(i,j) = 1
86  ELSE
87  domr(i,j) = 1
88  ENDIF
89  enddo
90  enddo
91 !
92  RETURN
93  END