UPP  V11.0.0
 All Data Structures Files Functions Pages
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