UPP (develop)
Loading...
Searching...
No Matches
TTBLEX.f
1 SUBROUTINE ttblex(TREF,TTBL,ITB,JTB,KARR,PMIDL &
2 ,PL,QQ,PP,RDP,THE0,STHE,RDTHE,THESP &
3 , IPTB,ITHTB)
4!FPP$ NOCONCUR R
5!$$$ SUBPROGRAM DOCUMENTATION BLOCK
6! . . .
7! SUBPROGRAM: TTBLEX COMPUTES T ALONG A MOIST ADIABAT
8! PRGRMMR: BLACK ORG: W/NP2 DATE: ??-??-??
9!
10! ABSTRACT:
11! THIS ROUTINE COMPUTES THE TEMPERATURE ALONG A MOIST
12! ADIABAT GIVEN THE SATURATION POTENTIAL TEMPERATURE
13! AND THE PRESSURE
14! .
15!
16! PROGRAM HISTORY LOG:
17! ??-??-?? T BLACK - ORIGINATOR
18! 98-06-12 T BLACK - CONVERSION FROM 1-D TO 2-D
19! 00-01-04 JIM TUCCILLO - MPI VERSION
20! 01-10-22 H CHUANG - MODIFIED TO PROCESS HYBRID MODEL OUTPUT
21! 02-01-15 MIKE BALDWIN - WRF VERSION
22! 21-09-13 J MENG - 2D DECOMPOSITION
23!
24! OUTPUT FILES:
25! NONE
26!
27! SUBPROGRAMS CALLED:
28! UTILITIES:
29! NONE
30!
31! ATTRIBUTES:
32! LANGUAGE: FORTRAN
33!----------------------------------------------------------------------
34 use ctlblk_mod, only: jsta, jend, im, jsta_2l, jend_2u, me, &
35 ista, iend, ista_2l, iend_2u
36!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
37 implicit none
38!----------------------------------------------------------------------
39
40 integer,intent(in) :: ITB,JTB
41 integer,intent(in) :: KARR(ista:iend,jsta:jend)
42 real,dimension(JTB,ITB),intent(in) :: TTBL
43 real,dimension(ISTA_2L:IEND_2U,JSTA_2L:JEND_2U),intent(in) :: PMIDL
44 real,dimension(ISTA_2L:IEND_2U,JSTA_2L:JEND_2U),intent(out) :: TREF
45 real,dimension(ista:iend,jsta:jend),intent(out) :: QQ,PP
46 real,dimension(ista:iend,jsta:jend),intent(in) :: THESP
47 real,dimension(ITB), intent(in) :: THE0,STHE
48 integer,dimension(ista:iend,jsta:jend),intent(out) :: IPTB,ITHTB
49 real,intent(in) :: PL,RDP,RDTHE
50
51!
52 integer I,J,ITH,IP,IPTBK
53 real PK,TPK,T00K,T10K,T01K,T11K,BTHE00K,STHE00K,BTHK,STHK, &
54 tthk,bthe10k,sthe10k
55!-----------------------------------------------------------------------
56!$omp parallel do &
57!$omp& private(i,j,bthe00k,bthe10k,bthk,ip,iptbk,ith,pk,sthe00k,sthe10k,&
58!$omp& sthk,t00k,t01k,t10k,t11k,tpk,tthk)
59 DO j=jsta,jend
60 DO i=ista,iend
61 IF(karr(i,j) > 0) THEN
62!--------------SCALING PRESSURE & TT TABLE INDEX------------------------
63 pk = pmidl(i,j)
64 tpk = (pk-pl)*rdp
65 qq(i,j) = tpk-aint(tpk)
66 iptb(i,j) = int(tpk) + 1
67!--------------KEEPING INDICES WITHIN THE TABLE-------------------------
68 IF(iptb(i,j) < 1) THEN
69 iptb(i,j) = 1
70 qq(i,j) = 0.
71 ENDIF
72!
73 IF(iptb(i,j) >= itb) THEN
74 iptb(i,j) = itb-1
75 qq(i,j) = 0.
76 ENDIF
77!--------------BASE AND SCALING FACTOR FOR THE--------------------------
78 iptbk = iptb(i,j)
79 bthe00k = the0(iptbk)
80 sthe00k = sthe(iptbk)
81 bthe10k = the0(iptbk+1)
82 sthe10k = sthe(iptbk+1)
83!--------------SCALING THE & TT TABLE INDEX-----------------------------
84 bthk = (bthe10k-bthe00k)*qq(i,j)+bthe00k
85 sthk = (sthe10k-sthe00k)*qq(i,j)+sthe00k
86 tthk = (thesp(i,j)-bthk)/sthk*rdthe
87 pp(i,j) = tthk-aint(tthk)
88! write(1000+me,*)' i=',i,' j=',j,' tthk=',tthk,' thesp=',thesp(i,j) &
89! , ' bthk=',bthk,' sthk=',sthk,' rdthe=',rdthe
90
91 ithtb(i,j) = int(tthk)+1
92!--------------KEEPING INDICES WITHIN THE TABLE-------------------------
93 IF(ithtb(i,j) < 1) THEN
94 ithtb(i,j) = 1
95 pp(i,j) = 0.
96 ENDIF
97!
98 IF(ithtb(i,j) >= jtb) THEN
99 ithtb(i,j) = jtb-1
100 pp(i,j) = 0.
101 ENDIF
102!--------------TEMPERATURE AT FOUR SURROUNDING TT TABLE PTS.------------
103 ith = ithtb(i,j)
104 ip = iptb(i,j)
105 t00k = ttbl(ith ,ip )
106 t10k = ttbl(ith+1,ip )
107 t01k = ttbl(ith ,ip+1)
108 t11k = ttbl(ith+1,ip+1)
109!--------------PARCEL TEMPERATURE-------------------------------------
110 tref(i,j) = (t00k+(t10k-t00k)*pp(i,j)+(t01k-t00k)*qq(i,j) &
111 + (t00k-t10k-t01k+t11k)*pp(i,j)*qq(i,j))
112 ENDIF
113 ENDDO
114 ENDDO
115!
116 RETURN
117 END SUBROUTINE ttblex
118!&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
119!
120!-------------------------------------------------------------------------------------
121!