/[MITgcm]/MITgcm/pkg/diagnostics/prestopres.F
ViewVC logotype

Annotation of /MITgcm/pkg/diagnostics/prestopres.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (hide annotations) (download)
Tue Oct 25 16:27:30 2005 UTC (18 years, 8 months ago) by molod
Branch: MAIN
CVS Tags: checkpoint58r_post, checkpoint58l_post, checkpoint57y_post, checkpoint58c_post, checkpoint58g_post, checkpoint57x_post, checkpoint58k_post, checkpoint58, checkpoint58e_post, mitgcm_mapl_00, checkpoint58n_post, checkpoint58h_post, checkpoint58s_post, checkpoint58f_post, checkpoint58p_post, checkpoint58b_post, checkpoint58m_post, checkpoint58q_post, checkpoint58j_post, checkpoint58d_post, checkpoint57w_post, checkpoint58a_post, checkpoint58i_post, checkpoint57y_pre, checkpoint58o_post, checkpoint57z_post
Changes since 1.2: +11 -8 lines
change arg list to prestopres, put cpp options in prestopres to use macros

1 molod 1.3 C $Header: $
2     C $Name: $
3     #include "DIAG_OPTIONS.h"
4     subroutine prestopres (qprs,qinp,pkz,pksrf,ptop,p,im,jm,lm,myThid)
5 molod 1.1 C***********************************************************************
6     C
7     C PURPOSE
8     C To interpolate an arbitrary quantity to Specified Pressure Levels
9     C
10     C INPUT
11     C QINP .. QINP (im,jm,lm) Arbitrary Input Quantity
12     C PKZ ... PKZ (im,jm,lm) Pressure to the Kappa at Input Levels
13     C PKSRF . PKSRF(im,jm) Surface Pressure to the Kappa
14     C PTOP .. Pressure at Input-Level-Edge (1) (top of model)
15     C P ..... Output Pressure Level (mb)
16     C IM .... Longitude Dimension of Input
17     C JM .... Latitude Dimension of Input
18     C LM .... Vertical Dimension of Input
19     C
20     C OUTPUT
21     C QPRS .. QPRS (im,jm) Arbitrary Quantity at Pressure p
22     C
23     C NOTE
24     C Quantity is interpolated Linear in P**Kappa.
25     C Between PTOP**Kappa and PKZ(1), quantity is extrapolated.
26     C Between PKSRF**Kappa and PKZ(LM), quantity is extrapolated.
27     C Undefined Input quantities are not used.
28 molod 1.2 C Finally: This routine assumes that pressure levels are counted
29     C top down -- ie, level 1 is the top, level lm is the bottom
30 molod 1.1 C
31     C***********************************************************************
32     C
33     implicit none
34 molod 1.3 integer i,l,im,jm,lm,myThid
35 molod 1.1
36 molod 1.3 _RL qprs(im,jm)
37     _RL qinp(im,jm,lm)
38     _RL pkz(im,jm,lm)
39     _RL pksrf(im,jm)
40 molod 1.1
41 molod 1.3 _RL ptop,p,undef,kappa,getcon
42     _RL pk,pkmin,pkmax,pktop,temp
43 molod 1.1
44     undef = getcon('UNDEF')
45     kappa = getcon('KAPPA')
46    
47     pk = p**kappa
48 molod 1.2 if(ptop.ne.0.) then
49     pktop = ptop**kappa
50     else
51     pktop = 0.
52     endif
53 molod 1.1
54     c Initialize to UNDEFINED
55     c -----------------------
56     do i=1,im*jm
57     qprs(i,1) = undef
58     enddo
59    
60     c Interpolate to Pressure Between Input Levels
61     c --------------------------------------------
62     do L=1,lm-1
63     pkmin = pkz(1,1,L)
64     pkmax = pkz(1,1,L+1)
65    
66     do i=2,im*jm
67     if( pkz(i,1,L) .lt.pkmin ) pkmin = pkz(i,1,L)
68     if( pkz(i,1,L+1).gt.pkmax ) pkmax = pkz(i,1,L+1)
69     enddo
70    
71     if( pk.le.pkmax .and. pk.ge.pkmin ) then
72     do i=1,im*jm
73     if( pk.le.pkz(i,1,L+1) .and. pk.ge.pkz(i,1,L) ) then
74     temp = ( pkz(i,1,L)-pk ) / ( pkz(i,1,L)-pkz(i,1,L+1) )
75    
76     if( qinp(i,1,L) .ne.undef .and.
77     . qinp(i,1,L+1).ne.undef ) then
78     qprs(i,1) = qinp(i,1,L+1)*temp + qinp(i,1,L)*(1.-temp)
79     else if( qinp(i,1,L+1).ne.undef .and. temp.ge.0.5 ) then
80     qprs(i,1) = qinp(i,1,L+1)
81     else if( qinp(i,1,L) .ne.undef .and. temp.le.0.5 ) then
82     qprs(i,1) = qinp(i,1,L)
83     endif
84    
85     endif
86     enddo
87     endif
88    
89     enddo
90    
91     do i=1,im*jm
92     c Extrapolate to Pressure between Ptop and First Input Level
93     c ----------------------------------------------------------
94     if( pk.le.pkz(i,1,1) .and. pk.ge.pktop ) then
95     temp = ( pkz(i,1,1)-pk ) / ( pkz(i,1,1)-pkz(i,1,2) )
96    
97     if( qinp(i,1,1).ne.undef .and.
98     . qinp(i,1,2).ne.undef ) then
99     qprs(i,1) = qinp(i,1,2)*temp + qinp(i,1,1)*(1.-temp)
100     else if( qinp(i,1,1).ne.undef ) then
101     qprs(i,1) = qinp(i,1,1)
102     endif
103    
104     endif
105    
106     c Extrapolate to Pressure between Psurf and Lowest Input Level
107     c ------------------------------------------------------------
108     if( pk.le.pksrf(i,1) .and. pk.ge.pkz(i,1,lm ) ) then
109     temp = ( pkz(i,1,lm)-pk ) / ( pkz(i,1,lm)-pkz(i,1,lm-1) )
110    
111     if( qinp(i,1,lm) .ne.undef .and.
112     . qinp(i,1,lm-1).ne.undef ) then
113     qprs(i,1) = qinp(i,1,lm-1)*temp + qinp(i,1,lm)*(1.-temp)
114     else if( qinp(i,1,lm) .ne.undef ) then
115     qprs(i,1) = qinp(i,1,lm)
116     endif
117    
118     endif
119     enddo
120    
121     return
122     end

  ViewVC Help
Powered by ViewVC 1.1.22