UPP (develop)
Loading...
Searching...
No Matches
TABLEQ.f
1!&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
2 SUBROUTINE tableq(TTBLQ,RDP,RDTHE,PL,THL,STHE,THE0)
3! ******************************************************************
4! * *
5! * GENERATE VALUES FOR FINER LOOK-UP TABLES USED *
6! * IN CONVECTION *
7! * *
8! ******************************************************************
9!
10!
11 implicit none
12
13 integer,parameter :: ITB=152,jtb=440
14 real,parameter :: THH=325.,ph=105000. &
15 &, pq0=379.90516,a1=610.78,a2=17.2693882,a3=273.16,a4=35.86 &
16 &, r=287.04,cp=1004.6,eliwv=2.683e6,eps=1.e-9
17!
18 real,dimension(JTB,ITB),intent(out) :: TTBLQ
19 real,dimension(ITB),intent(out) :: THE0,STHE
20 real,intent(in) :: PL,THL
21 real,intent(out) :: RDP,RDTHE
22!
23 real TOLD (JTB),THEOLD(JTB) &
24 &, Y2T (JTB),THENEW(JTB),APT (JTB),AQT (JTB),TNEW (JTB)
25!
26 real PT,RDQ,DTH,DP,RDTH,TH,P,APE,DENOM,the0k, dthe, &
27 qs0k,sqsk,dqs,qs,theok,sthek
28 integer KTHM,KPM,KTHM1,KPM1,KP,KMM,KTH
29!
30!--------------COARSE LOOK-UP TABLE FOR SATURATION POINT----------------
31 kthm=jtb
32 kpm=itb
33 kthm1=kthm-1
34 kpm1=kpm-1
35!
36 dth=(thh-thl)/real(kthm-1)
37 dp =(ph -pl )/real(kpm -1)
38!
39 rdp=1./dp
40 th=thl-dth
41!--------------COARSE LOOK-UP TABLE FOR T(P) FROM CONSTANT THE----------
42 p=pl-dp
43 DO 550 kp=1,kpm
44 p=p+dp
45 th=thl-dth
46 DO 560 kth=1,kthm
47 th=th+dth
48 ape=(100000./p)**(r/cp)
49 qs=pq0/p*exp(a2*(th-a3*ape)/(th-a4*ape))
50 told(kth)=th/ape
51 theold(kth)=th*exp(eliwv*qs/(cp*told(kth)))
52 560 CONTINUE
53!
54 the0k=theold(1)
55 sthek=theold(kthm)-theold(1)
56 theold(1 )=0.
57 theold(kthm)=1.
58!
59 DO 570 kth=2,kthm1
60 theold(kth)=(theold(kth)-the0k)/sthek
61!
62 IF((theold(kth)-theold(kth-1))<eps) &
63 theold(kth)=theold(kth-1) + eps
64!
65 570 CONTINUE
66!
67 the0(kp)=the0k
68 sthe(kp)=sthek
69!-----------------------------------------------------------------------
70 thenew(1 )=0.
71 thenew(kthm)=1.
72 dthe=1./real(kthm-1)
73 rdthe=1./dthe
74!
75 DO 580 kth=2,kthm1
76 thenew(kth)=thenew(kth-1)+dthe
77 580 CONTINUE
78!
79 y2t(1 )=0.
80 y2t(kthm)=0.
81!
82 CALL spline(jtb,kthm,theold,told,y2t,kthm,thenew,tnew,apt,aqt)
83!
84 DO 590 kth=1,kthm
85 ttblq(kth,kp)=tnew(kth)
86 590 CONTINUE
87!-----------------------------------------------------------------------
88 550 CONTINUE
89!
90 RETURN
91 END