/[MITgcm]/MITgcm/pkg/gridalt/dyn2phys.F
ViewVC logotype

Annotation of /MITgcm/pkg/gridalt/dyn2phys.F

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


Revision 1.5 - (hide annotations) (download)
Mon Jun 5 18:41:30 2006 UTC (18 years ago) by molod
Branch: MAIN
CVS Tags: checkpoint58l_post, checkpoint58u_post, checkpoint58w_post, checkpoint60, checkpoint61, checkpoint58r_post, checkpoint58n_post, checkpoint58x_post, checkpoint58t_post, checkpoint58h_post, checkpoint58q_post, checkpoint59q, checkpoint59p, checkpoint59r, checkpoint58j_post, checkpoint59e, checkpoint59d, checkpoint59g, checkpoint59f, checkpoint59a, checkpoint59c, checkpoint59b, checkpoint59m, checkpoint59l, checkpoint59o, checkpoint59n, checkpoint59i, checkpoint59h, checkpoint59k, checkpoint59j, checkpoint59, checkpoint58i_post, checkpoint58g_post, checkpoint58o_post, checkpoint58y_post, checkpoint58k_post, checkpoint58v_post, checkpoint58s_post, checkpoint61d, checkpoint61e, checkpoint61b, checkpoint61c, checkpoint58p_post, checkpoint61a, checkpoint58m_post
Changes since 1.4: +21 -4 lines
New option for theta interpolation - interp with constant T near top of atm.

1 molod 1.5 C $Header: /u/gcmpack/MITgcm/pkg/gridalt/dyn2phys.F,v 1.4 2004/05/05 00:39:21 edhill Exp $
2 edhill 1.4 C $Name: $
3    
4 molod 1.1 subroutine dyn2phys(qdyn,pedyn,im1,im2,jm1,jm2,lmdyn,Nsx,Nsy,
5     . idim1,idim2,jdim1,jdim2,bi,bj,windphy,pephy,Lbot,lmphy,nlperdyn,
6     . flg,qphy)
7     C***********************************************************************
8     C Purpose:
9     C To interpolate an arbitrary quantity from the 'dynamics' eta (pstar)
10     C grid to the higher resolution physics grid
11     C Algorithm:
12     C Routine works one layer (edge to edge pressure) at a time.
13     C Dynamics -> Physics retains the dynamics layer mean value,
14     C weights the field either with the profile of the physics grid
15     C wind speed (for U and V fields), or uniformly (T and Q)
16     C
17     C Input:
18     C qdyn..... [im,jm,lmdyn] Arbitrary Quantity on Input Grid
19     C pedyn.... [im,jm,lmdyn+1] Pressures at bottom edges of input levels
20     C im1,2 ... Limits for Longitude Dimension of Input
21     C jm1,2 ... Limits for Latitude Dimension of Input
22     C lmdyn.... Vertical Dimension of Input
23     C Nsx...... Number of processes in x-direction
24     C Nsy...... Number of processes in y-direction
25     C idim1,2.. Beginning and ending i-values to calculate
26     C jdim1,2.. Beginning and ending j-values to calculate
27     C bi....... Index of process number in x-direction
28     C bj....... Index of process number in x-direction
29     C windphy.. [im,jm,lmphy] Magnitude of the wind on the output levels
30     C pephy.... [im,jm,lmphy+1] Pressures at bottom edges of output levels
31     C lmphy.... Vertical Dimension of Output
32     C nlperdyn. [im,jm,lmdyn] Highest Physics level in each dynamics level
33     C flg...... Flag to indicate field type (0 for T or Q, 1 for U or V)
34     C
35     C Output:
36     C qphy..... [im,jm,lmphy] Quantity at output grid (physics grid)
37     C
38     C Notes:
39     C 1) This algorithm assumes that the output (physics) grid levels
40     C fit exactly into the input (dynamics) grid levels
41     C***********************************************************************
42     implicit none
43     #include "CPP_OPTIONS.h"
44    
45     integer im1, im2, jm1, jm2, lmdyn, lmphy, Nsx, Nsy, flg
46     integer idim1, idim2, jdim1, jdim2, bi, bj
47     _RL qdyn(im1:im2,jm1:jm2,lmdyn,Nsx,Nsy)
48     _RL pedyn(im1:im2,jm1:jm2,lmdyn+1,Nsx,Nsy)
49     _RL pephy(im1:im2,jm1:jm2,lmphy+1,Nsx,Nsy)
50     _RL windphy(im1:im2,jm1:jm2,lmphy,Nsx,Nsy)
51     integer nlperdyn(im1:im2,jm1:jm2,lmdyn,Nsx,Nsy)
52     _RL qphy(im1:im2,jm1:jm2,lmphy,Nsx,Nsy)
53     integer Lbot(im1:im2,jm1:jm2,Nsx,Nsy)
54    
55     _RL weights(im1:im2,jm1:jm2,lmphy)
56 molod 1.5 _RL pphy(im1:im2,jm1:jm2,lmphy)
57 molod 1.3 _RL dpkedyn, dpkephy, windsum, qd
58 molod 1.1 integer i,j,L,Lout1,Lout2,Lphy
59     _RL getcon, kappa
60    
61     kappa = getcon('KAPPA')
62    
63 molod 1.5 C define physics grid mid level pressures
64     do Lphy = 1,lmphy
65     do j = jdim1,jdim2
66     do i = idim1,idim2
67     pphy(i,j,Lphy) =
68     . (pephy(i,j,Lphy,bi,bj)+pephy(i,j,Lphy+1,bi,bj))/2.
69     enddo
70     enddo
71     enddo
72    
73 molod 1.3 c do loop for all dynamics (input) levels
74     do L = 1,lmdyn
75 molod 1.1 c do loop for all grid points
76 molod 1.3 do j = jdim1,jdim2
77     do i = idim1,idim2
78     qd = qdyn(i,j,L,bi,bj)
79 molod 1.1 c Check to make sure we are above ground - if not, do nothing
80     if(L.ge.Lbot(i,j,bi,bj))then
81     if(L.eq.Lbot(i,j,bi,bj)) then
82     Lout1 = 0
83     else
84     Lout1 = nlperdyn(i,j,L-1,bi,bj)
85     endif
86     Lout2 = nlperdyn(i,j,L,bi,bj)
87     c for U and V fields, need to compute for the weights:
88 molod 1.5 cinterp1 dpkedyn = (pedyn(i,j,L,bi,bj)**kappa)-
89     cinterp1 (pedyn(i,j,L+1,bi,bj)**kappa)
90     dpkedyn = pedyn(i,j,L,bi,bj)-pedyn(i,j,L+1,bi,bj)
91 molod 1.1 if(flg.eq.1)then
92     windsum = 0.
93     do Lphy = Lout1+1,Lout2
94 molod 1.2 cinterp1 dpkephy = (pephy(i,j,Lphy,bi,bj)**kappa)-
95     cinterp1 (pephy(i,j,Lphy+1,bi,bj)**kappa)
96     dpkephy = pephy(i,j,Lphy,bi,bj)-pephy(i,j,Lphy+1,bi,bj)
97 molod 1.1 windsum = windsum+(windphy(i,j,Lphy,bi,bj)*dpkephy)/dpkedyn
98     enddo
99     endif
100     c do loop for all physics levels contained in this dynamics level
101     do Lphy = Lout1+1,Lout2
102     weights(i,j,Lphy) = 1.
103     if( (flg.eq.1).and.(windsum.ne.0.) )
104     . weights(i,j,Lphy)=windphy(i,j,Lphy,bi,bj)/windsum
105 molod 1.5 if( (flg.eq.2) .and. (pedyn(i,j,L,bi,bj).lt.10000.)) then
106     weights(i,j,Lphy) =
107     . (qd-5. + (10.*(pedyn(i,j,L,bi,bj)-pphy(i,j,Lphy))/dpkedyn))/qd
108     elseif( (flg.eq.2) .and. (pedyn(i,j,L,bi,bj).ge.10000.)) then
109     weights(i,j,Lphy) = 1.
110     endif
111 molod 1.3 qphy(i,j,Lphy,bi,bj) = qd * weights(i,j,Lphy)
112 molod 1.1 enddo
113     endif
114     enddo
115     enddo
116     enddo
117    
118     return
119     end

  ViewVC Help
Powered by ViewVC 1.1.22