Merge remote-tracking branch 'origin/release-v4.5.2'
[WRF.git] / var / da / da_ssmi / cal_sigma_v.inc
blob9329bde5f206392835120093efb41a42dda095f5
1       subroutine cal_sigma_v(ifreq,p0,wv,hwv,ta,gamma,sigma_v)
2       integer ifreq
3       real sigma_v,p0,wv,hwv,ta,gamma
5       real wvc, wvcor(4)
6       real sigv
8       real voh1,otbar1,pbar1
9       real term21,term31,term41,term51,term61
10       real a11,a21,a31,a41,a51,a61
12       real voh2,otbar2,pbar2
13       real term22,term32,term42,term52,term62
14       real a12,a22,a32,a42,a52,a62
16       real voh3,otbar3,pbar3
17       real term23,term33,term43,term53,term63
18       real a13,a23,a33,a43,a53,a63
20       real voh4,otbar4,pbar4
21       real term24,term34,term44,term54,term64
22       real a14,a24,a34,a44,a54,a64
23 !     
24       real const1,const2,const3,const4
25       real h1,h2,h3,h4
27       data const1,const2,const3,const4/0.6,2.8,0.2,0.2/
28       data h1,h2,h3,h4/5.0,4.9,6.8,6.4/
30       data a11,a21,a31,a41,a51,a61/-.13747e-2,-.43061e-4, .14618e+1,  &
31         .25101e-3, .14635e-1,-.18588e+3/
32       data a12,a22,a32,a42,a52,a62/ .22176e-1,-.32367e-4,-.10840e-4,  &
33         -.63578e-1, .16988e-7,-.29824e+2/
34       data a13,a23,a33,a43,a53,a63/-.10566e-2,-.12906e-3, .56975e+0,  &
35          .10828e-8,-.17551e-7, .48601e-1/
36       data a14,a24,a34,a44,a54,a64/-.60808e-2,-.70936e-3, .28721e+1,  &
37          .42636e-8,-.82910e-7, .26166e+0/
39 !      data wvcor/1.01,0.95,1.06,0.92/
40       data wvcor/1.02,0.98,1.02,0.88/
41 ! use modified water vapor value to correct for errors in theoretical absorption
43       wvc = wv*wvcor(ifreq)
45       if (ifreq.eq.1) then
46         pbar1 = p0/(1.0 + hwv/h1)
47         voh1   = wv/hwv
48         term21 = a21*voh1
49         otbar1 = 1.0/(ta - const1*gamma*hwv)
50         term31 = a31*otbar1
51         term61 = a61*otbar1*otbar1
52         term41 = a41*pbar1*otbar1
53         term51 = a51*voh1*otbar1
54         sigv = a11 + term21 + term31 + term41 + term51 + term61
55       else if (ifreq.eq.2) then
56         pbar2 = p0/(1.0 + hwv/h2)
57         term22 = a22*pbar2
58         term52 = a52*pbar2*pbar2
59         voh2   = wv/hwv
60         term32 = a32*voh2
61         otbar2 = 1.0/(ta - const2*gamma*hwv)
62         term42 = a42*otbar2
63         term62 = a62*otbar2*otbar2
64         sigv = a12 + term22 + term32 + term42 + term52 + term62
65       else if (ifreq.eq.3) then
66         pbar3 = p0/(1.0 + hwv/h3)
67         term43 = a43*pbar3*pbar3
68         voh3   = wv/hwv
69         term23 = a23*voh3
70         otbar3 = 1.0/(ta - const3*gamma*hwv)
71         term33 = a33*otbar3
72         term53 = a53*pbar3*voh3
73         term63 = a63*otbar3*voh3
74         sigv = a13 + term23 + term33 + term43 + term53 + term63
75       else if (ifreq.eq.4) then
76         pbar4 = p0/(1.0 + hwv/h4)
77         term44 = a44*pbar4*pbar4
78         voh4   = wv/hwv
79         term24 = a24*voh4
80         otbar4 = 1.0/(ta - const4*gamma*hwv)
81         term34 = a34*otbar4
82         term54 = a54*pbar4*voh4
83         term64 = a64*otbar4*voh4
84         sigv = a14 + term24 + term34 + term44 + term54 + term64
85       else
86         sigv = 0.0
87       endif
88       sigma_v = sigv*wvc
90       end subroutine cal_sigma_v