UPP  001
 All Data Structures Files Functions Pages
CALTHTE.f
Go to the documentation of this file.
1 
22 
23  SUBROUTINE calthte(P1D,T1D,Q1D,THTE)
24 
25 !
26 !
27  use params_mod, only: d00, eps, oneps, d01, h1m12, p1000, h1
28  use ctlblk_mod, only: jsta, jend, im, spval
29 !- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
30  implicit none
31 !
32  real,PARAMETER :: kg2g=1.e3
33  real,PARAMETER :: d35=3.5,d4805=4.805,h2840=2840.,h55=55.
34  real,PARAMETER :: d2845=0.2845,d00028=0.00028,d3376=3.376
35  real,PARAMETER :: d00254=0.00254,d00081=0.00081,d81=0.81
36  real,PARAMETER :: d28=0.28,h2675=2675.
37 !
38 ! DECLARE VARIABLES.
39 !
40  REAL,dimension(IM,jsta:jend),intent(in) :: p1d,t1d,q1d
41  REAL,dimension(IM,jsta:jend),intent(inout) :: thte
42 
43  integer i,j
44  real p,t,q,evp,rmx,ckapa,rkapa,arg,denom,tlcl,plcl,fac, &
45  eterm,thetae
46 !
47 !***************************************************************
48 ! START CALTHTE.
49 !
50 ! ZERO THETA-E ARRAY
51 !$omp parallel do private(i,j)
52  DO j=jsta,jend
53  DO i=1,im
54  thte(i,j) = d00
55  ENDDO
56  ENDDO
57 !
58 ! COMPUTE THETA-E.
59 !
60 ! DO J=JSTA_M,JEND_M
61 ! DO I=2,IM-1
62 !$omp parallel do private(i,j,p,t,q,evp,rmx,ckapa,rkapa,arg,denom,tlcl,plcl,fac,eterm,thetae)
63  DO j=jsta,jend
64  DO i=1,im
65  IF(p1d(i,j)<spval.and.t1d(i,j)<spval.and.q1d(i,j)<spval)THEN
66  p = p1d(i,j)
67  t = t1d(i,j)
68  q = q1d(i,j)
69  evp = p*q/(eps+oneps*q)
70  rmx = eps*evp/(p-evp)
71  ckapa = d2845*(1.-d28*rmx)
72  rkapa = 1./ckapa
73  arg = max(h1m12, evp*d01)
74  denom = d35*log(t) - log(evp*d01) - d4805
75  tlcl = h2840/denom + h55
76  plcl = p*(tlcl/t)**rkapa
77  fac = (p1000/p)**ckapa
78  eterm = (d3376/tlcl-d00254)*(rmx*kg2g*(h1+d81*rmx))
79  thetae = t*fac*exp(eterm)
80  thte(i,j)= thetae
81  ENDIF
82  ENDDO
83  ENDDO
84 !
85 ! END OF ROUTINE.
86 !
87  RETURN
88  END