UPP (develop)
Loading...
Searching...
No Matches
DEWPOINT.f
Go to the documentation of this file.
1
44!--------------------------------------------------------------------------
50!--------------------------------------------------------------------------
51 SUBROUTINE dewpoint( VP, TD)
52
53 use ctlblk_mod, only: jsta, jend, im, spval, ista, iend
54!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
55 implicit none
56!
57! NT IS THE TABLE SIZE
58 integer,PARAMETER :: NT=2000
59!...TRANSLATED BY FPP 3.00Z36 11/09/90 14:48:53
60!...SWITCHES: OPTON=I47,OPTOFF=VAE0
61 real,intent(out) :: TD(ista:iend,jsta:jend)
62 real,intent(in) :: VP(ista:iend,jsta:jend)
63 real TDP(NT)
64!jw
65 integer NN,I,J,JNT
66 real rvp1,rvp2,rt3,rvp3,rlog3,ra,rb,rapb,rtest,rnt,rdvp
67 real rgs,rvp,rlvp,rn,rd,rch,rt,w1,w2
68 real A,B,DNTM1
69
70 logical :: jcontinue=.true.
71
72! PREPARE THE TABLE (TDP=DEWPT AS FCN OF VAPOR PRESS).
73! RANGE IN CENTIBARS IS FROM RVP1 THRU RVP2
74 rvp1 = 0.0001e0
75 rvp2 = 10.e0
76! THE TRIPLE POINT
77 rt3 = 273.16e0
78! VAPOR PRESS AT THE TRIPLE POINT
79 rvp3 = 0.611e0
80 rlog3 = log(rvp3)
81! (SPEC HT OF WATER -CSUBP OF VAPOR)/GAS CONST OF VAPOR.
82 ra = 5.0065e0
83! LATENT HEAT AT T3/(GAS CONST OF VAPOR * TRIPLE PT TEMP).
84 rb = 19.83923e0
85 rapb = ra + rb
86! CRITERION FOR CONVERGENCE OF NEWTON ITERATION
87 rtest = 1.e-6
88!MEB RTEST=1.E-8 ! PROBABLY WON'T CONVERGE WITH 32-BIT AT THIS CRITERION
89!
90 rnt = float(nt)
91! TABLE INCREMENT IN VAPOR PRESS
92 rdvp = (rvp2-rvp1)/(rnt-1.e0)
93! RGS WILL BE THE GUESSED VALUE OF (T3 / DEWPOINT)
94 rgs = 1.e0
95 rvp = rvp1-rdvp
96!
97 DO 20 nn=1,nt
98 rvp=rvp+rdvp
99 rlvp=log(rvp)-rlog3-rapb
100! ***** ENTER NEWTON ITERATION LOOP
101 jcontinue=.true.
102 do while (jcontinue)
103 10 rn=ra*log(rgs)-rapb*rgs-rlvp
104! THAT WAS VALUE OF FUNCTION
105! NOW GET ITS DERIVATIVE
106 rd=(ra/rgs)-rapb
107! THE DESIRED CHANGE IN THE GUESS
108 rch=rn/rd
109 IF( abs(rch) < rtest ) jcontinue=.false.
110! NEED MORE ITERATIONS
111 DO WHILE (abs(rch) >= rtest)
112 rgs=rgs-rch
113 EXIT
114 ENDDO
115 ENDDO
116! *****
117! HAVE ACCURATE ENUF VALUE OF RGS=T3/DEWPOINT.
118 15 rt=rt3/rgs
119 tdp(nn)=rt
120!
121 20 CONTINUE
122! PRINT 25,RVP1,RVP2,TDP(1),TDP(NT)
123! 25 FORMAT(/'0', 'IN SUBROUTINE DEWPOINT, THE DEWPT TABLE ',
124! 1 'HAS RVP1=', 1PE13.6, ', RVP2=', 1PE13.6,
125! 2 ', TDP(1)=', 1PE13.6, ', AND TDP(NT)=',
126! 3 1PE13.6, '.'/)
127! CONSTANTS FOR USING THE TABLE
128 a = 1./rdvp
129 b = 1. - a*rvp1
130 dntm1 = float(nt) -.01
131!
132!X END IF
133!
134! *********** ENTER TO USE THE TABLE. ************
135!
136!$omp parallel do private(i,j,w1,w2,jnt)
137 DO j=jsta,jend
138 DO i=ista,iend
139 IF(vp(i,j)<spval)THEN
140 w1 = min(max((a*vp(i,j)+b),1.0),dntm1)
141 w2 = aint(w1)
142 jnt = int(w2)
143 td(i,j) = tdp(jnt) + (w1-w2)*(tdp(jnt+1)-tdp(jnt))
144 ELSE
145 td(i,j) = spval
146 ENDIF
147 ENDDO
148 ENDDO
149!
150!
151 RETURN
152 END
subroutine dewpoint(vp, td)
DEWPOINT() Subroutine that computes dewpoints from vapor pressure.
Definition DEWPOINT.f:52