UPP  V11.0.0
 All Data Structures Files Functions Pages
CALVIS.f
1 !**********************************************************************c
2  SUBROUTINE calvis(QV,QC,QR,QI,QS,TT,PP,VIS)
3 !
4 ! This routine computes horizontal visibility at the
5 ! surface or lowest model layer, from qc, qr, qi, and qs.
6 ! qv--water vapor mixing ratio (kg/kg)
7 ! qc--cloud water mixing ratio (kg/kg)
8 ! qr--rain water mixing ratio (kg/kg)
9 ! qi--cloud ice mixing ratio (kg/kg)
10 ! qs--snow mixing ratio (kg/kg)
11 ! tt--temperature (k)
12 ! pp--pressure (Pa)
13 !
14 ! If iice=0:
15 ! qprc=qr qrain=qr and qclw=qc if T>0C
16 ! qcld=qc =0 =0 if T<0C
17 ! qsnow=qs and qclice=qc if T<0C
18 ! =0 =0 if T>0C
19 ! If iice=1:
20 ! qprc=qr+qs qrain=qr and qclw=qc
21 ! qcld=qc+qi qsnow=qs and qclice=qc
22 !
23 ! Independent of the above definitions, the scheme can use different
24 ! assumptions of the state of hydrometeors:
25 ! meth='d': qprc is all frozen if T<0, liquid if T>0
26 ! meth='b': Bocchieri scheme used to determine whether qprc
27 ! is rain or snow. A temperature assumption is used to
28 ! determine whether qcld is liquid or frozen.
29 ! meth='r': Uses the four mixing ratios qrain, qsnow, qclw,
30 ! and qclice
31 !
32 ! The routine uses the following
33 ! expressions for extinction coefficient, beta (in km**-1),
34 ! with C being the mass concentration (in g/m**3):
35 !
36 ! cloud water: beta = 144.7 * C ** (0.8800)
37 ! rain water: beta = 2.24 * C ** (0.7500)
38 ! cloud ice: beta = 327.8 * C ** (1.0000)
39 ! snow: beta = 10.36 * C ** (0.7776)
40 !
41 ! These expressions were obtained from the following sources:
42 !
43 ! for cloud water: from Kunkel (1984)
44 ! for rainwater: from M-P dist'n, with No=8e6 m**-4 and
45 ! rho_w=1000 kg/m**3
46 ! for cloud ice: assume randomly oriented plates which follow
47 ! mass-diameter relationship from Rutledge and Hobbs (1983)
48 ! for snow: from Stallabrass (1985), assuming beta = -ln(.02)/vis
49 !
50 ! The extinction coefficient for each water species present is
51 ! calculated, and then all applicable betas are summed to yield
52 ! a single beta. Then the following relationship is used to
53 ! determine visibility (in km), where epsilon is the threshhold
54 ! of contrast, usually taken to be .02:
55 !
56 ! vis = -ln(epsilon)/beta [found in Kunkel (1984)]
57 !
58 ! 2021-05 Wen Meng -Add checking for undfined points invloved in
59 ! computation.
60 ! 2021-10-31 Jesse Meng - 2D DECOMPOSITION
61 !------------------------------------------------------------------
62  use params_mod, only: h1, d608, rd
63  use ctlblk_mod, only: jsta, jend, im, jsta_2l, jend_2u, spval, &
64  ista, iend, ista_2l, iend_2u
65 !- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
66  implicit none
67 !
68 
69  real,dimension(ista_2l:iend_2u,jsta_2l:jend_2u),intent(in) :: qv,qc,qr,qi,qs,tt,pp
70  real,dimension(ista_2l:iend_2u,jsta_2l:jend_2u),intent(inout) :: vis
71 
72  CHARACTER meth*1
73  real celkel,tice,coeflc,coeflp,coeffc,coeffp,exponlc, &
74  exponlp,const1,rhoice,rhowat,qprc,qcld,qrain,qsnow, &
75  qclw,qclice,tv,rhoair,vovermd,conclc,concld,concfc, &
76  concfd,betav,exponfc,exponfp,conclp,concfp
77  integer i,j
78 !------------------------------------------------------------------
79 !------------------------------------------------------------------
80  celkel=273.15
81  tice=celkel-10.
82  coeflc=144.7
83  coeflp=2.24
84  coeffc=327.8
85  coeffp=10.36
86  exponlc=0.8800
87  exponlp=0.7500
88  exponfc=1.0000
89  exponfp=0.7776
90  const1=-log(.02)
91  rhoice=917.
92  rhowat=1000.
93 !
94  DO j=jsta,jend
95  DO i=ista,iend
96  vis(i,j)=spval
97 ! IF(IICE==0)THEN
98 ! QPRC=QR
99 ! QCLD=QC
100 ! IF(TT<CELKEL)THEN
101 ! QRAIN=0.
102 ! QSNOW=QPRC
103 ! QCLW=0.
104 ! QCLICE=QCLD
105 ! ELSE
106 ! QRAIN=QPRC
107 ! QSNOW=0.
108 ! QCLW=QCLD
109 ! QCLICE=0.
110 ! ENDIF
111 ! ELSE
112  IF (qr(i,j) < spval .and. qs(i,j) < spval .and. &
113  qc(i,j) < spval .and. qi(i,j) < spval .and. &
114  tt(i,j) < spval .and. qv(i,j) < spval .and. &
115  pp(i,j) < spval) THEN
116  qprc=qr(i,j)+qs(i,j)
117  qcld=qc(i,j)+qi(i,j)
118  qrain=qr(i,j)
119  qsnow=qs(i,j)
120  qclw=qc(i,j)
121  qclice=qi(i,j)
122 ! ENDIF
123 ! TV=VIRTUAL(TT,QV)
124  tv=tt(i,j)*(h1+d608*qv(i,j))
125  rhoair=pp(i,j)/(rd*tv)
126 ! IF(METH=='D')THEN
127 ! IF(TT<CELKEL)THEN
128 ! VOVERMD=(1.+QV)/RHOAIR+(QPRC+QCLD)/RHOICE
129 ! CONCLC = 0.
130 ! CONCLP = 0.
131 ! CONCFC = QCLD/VOVERMD*1000.
132 ! CONCFP = QPRC/VOVERMD*1000.
133 ! ELSE
134 ! VOVERMD=(1.+QV)/RHOAIR+(QPRC+QCLD)/RHOWAT
135 ! CONCLC = QCLD/VOVERMD*1000.
136 ! CONCLP = QPRC/VOVERMD*1000.
137 ! CONCFC = 0.
138 ! CONCFP = 0.
139 ! ENDIF
140 ! ELSEIF(METH=='B')THEN
141 ! IF(TT<TICE)THEN
142 ! VOVERMD=(1.+QV)/RHOAIR+(QPRC+QCLD)/RHOICE
143 ! CONCLC = 0.
144 ! CONCLP = 0.
145 ! CONCFC = QCLD/VOVERMD*1000.
146 ! CONCFP = QPRC/VOVERMD*1000.
147 ! ELSEIF(PRSNOW>=50.)THEN
148 ! VOVERMD=(1.+QV)/RHOAIR+QPRC/RHOICE+QCLD/RHOWAT
149 ! CONCLC = QCLD/VOVERMD*1000.
150 ! CONCLP = 0.
151 ! CONCFC = 0.
152 ! CONCFP = QPRC/VOVERMD*1000.
153 ! ELSE
154 ! VOVERMD=(1.+QV)/RHOAIR+(QPRC+QCLD)/RHOWAT
155 ! CONCLC = QCLD/VOVERMD*1000.
156 ! CONCLP = QPRC/VOVERMD*1000.
157 ! CONCFC = 0.
158 ! CONCFP = 0.
159 ! ENDIF
160 ! ELSEIF(METH=='R')THEN
161  vovermd=(1.+qv(i,j))/rhoair+(qclw+qrain)/rhowat+ &
162  (qclice+qsnow)/rhoice
163  conclc = max(0., qclw/vovermd*1000.)
164  conclp = max(0., qrain/vovermd*1000.)
165  concfc = max(0., qclice/vovermd*1000.)
166  concfp = max(0., qsnow/vovermd*1000.)
167 ! ENDIF
168  betav=coeffc*concfc**exponfc+coeffp*concfp**exponfp &
169  +coeflc*conclc**exponlc+coeflp*conclp**exponlp &
170  +1.e-10
171 ! CHANGED GSM 3-10-00 --> no point in distinguishing values
172 ! above 20 km, so make that value the max (prev max was 80)
173 ! VIS(I,J)=1.E3*MIN(20.,CONST1/BETAV) ! max of 20km
174 ! Chuang: Per Geoff, the max visibility was changed to be cosistent with visibility ceiling in obs
175  vis(i,j) = 1.e3*min(24.135,const1/betav) ! change max to be consistent with obs
176  ENDIF
177  ENDDO
178  ENDDO
179 !
180  RETURN
181  END