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

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

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


Revision 1.4 - (show annotations) (download)
Wed May 5 00:39:21 2004 UTC (20 years, 1 month ago) by edhill
Branch: MAIN
CVS Tags: checkpoint57t_post, checkpoint57o_post, checkpoint58e_post, checkpoint57v_post, checkpoint52n_post, checkpoint53d_post, checkpoint54a_pre, checkpoint57m_post, checkpoint55c_post, checkpoint54e_post, checkpoint57s_post, checkpoint54a_post, checkpoint53c_post, checkpoint57k_post, checkpoint55d_pre, checkpoint57d_post, checkpoint57g_post, checkpoint57b_post, checkpoint57c_pre, checkpoint55j_post, checkpoint56b_post, checkpoint57i_post, checkpoint57y_post, checkpoint57e_post, checkpoint55h_post, checkpoint57g_pre, checkpoint54b_post, checkpoint53b_pre, checkpoint55b_post, checkpoint54d_post, checkpoint56c_post, checkpoint57y_pre, checkpoint55, checkpoint53a_post, checkpoint57f_pre, checkpoint57a_post, checkpoint54, checkpoint54f_post, checkpoint53b_post, checkpoint55g_post, checkpoint55f_post, checkpoint57r_post, checkpoint58, checkpoint57a_pre, checkpoint55i_post, checkpoint57, checkpoint56, checkpoint53, eckpoint57e_pre, checkpoint57h_done, checkpoint58f_post, checkpoint53g_post, checkpoint57x_post, checkpoint57n_post, checkpoint58d_post, checkpoint58c_post, checkpoint57w_post, checkpoint57p_post, checkpint57u_post, checkpoint57f_post, checkpoint58a_post, checkpoint57q_post, checkpoint57z_post, checkpoint57c_post, checkpoint55e_post, checkpoint53f_post, checkpoint55a_post, checkpoint53d_pre, checkpoint54c_post, checkpoint57j_post, checkpoint58b_post, checkpoint57h_pre, checkpoint57l_post, checkpoint57h_post, checkpoint56a_post, checkpoint55d_post
Changes since 1.3: +3 -0 lines
 o adding cvs 'Header:' and 'Name:' strings

1 C $Header: $
2 C $Name: $
3
4 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 _RL dpkedyn, dpkephy, windsum, qd
57 integer i,j,L,Lout1,Lout2,Lphy
58 _RL getcon, kappa
59
60 kappa = getcon('KAPPA')
61
62 c do loop for all dynamics (input) levels
63 do L = 1,lmdyn
64 c do loop for all grid points
65 do j = jdim1,jdim2
66 do i = idim1,idim2
67 qd = qdyn(i,j,L,bi,bj)
68 c Check to make sure we are above ground - if not, do nothing
69 if(L.ge.Lbot(i,j,bi,bj))then
70 if(L.eq.Lbot(i,j,bi,bj)) then
71 Lout1 = 0
72 else
73 Lout1 = nlperdyn(i,j,L-1,bi,bj)
74 endif
75 Lout2 = nlperdyn(i,j,L,bi,bj)
76 c for U and V fields, need to compute for the weights:
77 if(flg.eq.1)then
78 cinterp1 dpkedyn = (pedyn(i,j,L,bi,bj)**kappa)-
79 cinterp1 (pedyn(i,j,L+1,bi,bj)**kappa)
80 dpkedyn = pedyn(i,j,L,bi,bj)-pedyn(i,j,L+1,bi,bj)
81 windsum = 0.
82 do Lphy = Lout1+1,Lout2
83 cinterp1 dpkephy = (pephy(i,j,Lphy,bi,bj)**kappa)-
84 cinterp1 (pephy(i,j,Lphy+1,bi,bj)**kappa)
85 dpkephy = pephy(i,j,Lphy,bi,bj)-pephy(i,j,Lphy+1,bi,bj)
86 windsum = windsum+(windphy(i,j,Lphy,bi,bj)*dpkephy)/dpkedyn
87 enddo
88 endif
89 c do loop for all physics levels contained in this dynamics level
90 do Lphy = Lout1+1,Lout2
91 weights(i,j,Lphy) = 1.
92 if( (flg.eq.1).and.(windsum.ne.0.) )
93 . weights(i,j,Lphy)=windphy(i,j,Lphy,bi,bj)/windsum
94 qphy(i,j,Lphy,bi,bj) = qd * weights(i,j,Lphy)
95 enddo
96 endif
97 enddo
98 enddo
99 enddo
100
101 return
102 end

  ViewVC Help
Powered by ViewVC 1.1.22