/[MITgcm]/MITgcm/pkg/fizhi/AtoC.F
ViewVC logotype

Contents of /MITgcm/pkg/fizhi/AtoC.F

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


Revision 1.8 - (show annotations) (download)
Sun Aug 27 18:27:36 2006 UTC (17 years, 9 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint64a, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64g, checkpoint64f, checkpoint58u_post, checkpoint58w_post, checkpoint63p, checkpoint63q, checkpoint63r, checkpoint63s, checkpoint63l, checkpoint63m, checkpoint63n, checkpoint63o, checkpoint63h, checkpoint63i, checkpoint63j, checkpoint63k, checkpoint63d, checkpoint63e, checkpoint63f, checkpoint63g, checkpoint63a, checkpoint63b, checkpoint63c, checkpoint64, checkpoint65, checkpoint60, checkpoint61, checkpoint62, checkpoint63, checkpoint58r_post, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint58x_post, checkpoint58t_post, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65o, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, checkpoint58q_post, checkpoint59q, checkpoint59p, checkpoint59r, checkpoint59e, checkpoint59d, checkpoint59g, checkpoint59f, checkpoint59a, checkpoint59c, checkpoint59b, checkpoint59m, checkpoint59l, checkpoint59o, checkpoint59n, checkpoint59i, checkpoint59h, checkpoint59k, checkpoint59j, checkpoint59, checkpoint58o_post, checkpoint62c, checkpoint62b, checkpoint62a, checkpoint62g, checkpoint62f, checkpoint62e, checkpoint62d, checkpoint62k, checkpoint62j, checkpoint62i, checkpoint62h, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62l, checkpoint62s, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint62w, checkpoint62v, checkpoint62u, checkpoint62t, checkpoint62z, checkpoint62y, checkpoint62x, checkpoint58y_post, checkpoint58v_post, checkpoint58s_post, checkpoint61f, checkpoint61g, checkpoint61d, checkpoint61e, checkpoint61b, checkpoint61c, checkpoint58p_post, checkpoint61a, checkpoint61n, checkpoint61o, checkpoint61l, checkpoint61m, checkpoint61j, checkpoint61k, checkpoint61h, checkpoint61i, checkpoint61v, checkpoint61w, checkpoint61t, checkpoint61u, checkpoint61r, checkpoint61s, checkpoint61p, checkpoint61q, checkpoint61z, checkpoint61x, checkpoint61y, HEAD
Changes since 1.7: +6 -4 lines
use _3D_ version of EXCH_UV_AGRID with 3rd dimension as input argument

1 C $Header: /u/gcmpack/MITgcm/pkg/fizhi/AtoC.F,v 1.7 2005/02/24 16:44:25 jmc Exp $
2 C $Name: $
3
4 #include "FIZHI_OPTIONS.h"
5 subroutine AtoC(myThid,fieldin1,fieldin2,mask,idim1,idim2,
6 . jdim1,jdim2,numlevs,Nsx,Nsy,im1,im2,jm1,jm2,fieldout1,fieldout2)
7 c----------------------------------------------------------------------
8 c Subroutine AtoC - Routine to map a velocity component quantity
9 c from the A-Grid to the C-Grid.
10 c This includes doing an exchange to fill the halo region, and
11 c then a linear average with the appropriate topography mask.
12 c Also: Set up "bi, bj loop" here.
13 c
14 c Input: myThid
15 c fieldin1 Field on a-grid to move to a-grid (1st component)
16 c fieldin2 Field on a-grid to move to a-grid (2nd component)
17 c mask Topography [0,1] mask - 1 to indicate above ground
18 c idim1,idim2,jdim1,jdim2 Indeces in x and y for computations
19 c numlevs Number of vertical levels
20 c Nsx, Nsy
21 c im1,im2,jm1,jm2 Span of fields in x and y
22 c
23 c Output: fieldout1 Field mapped to C-Grid (1st component)
24 c fieldout2 Field mapped to C-Grid (2nd component)
25 c
26 c Call: exch_uv_agrid_3d_RL - exchange on a-grid
27 c-----------------------------------------------------------------------
28 implicit none
29 #include "EEPARAMS.h"
30
31 integer myThid, numlevs
32 integer Nsx, Nsy
33 integer idim1, idim2, jdim1, jdim2, im1, im2, jm1, jm2
34 _RS mask(idim1:idim2,jdim1:jdim2,numlevs,Nsx,Nsy)
35 _RL fieldin1(idim1:idim2,jdim1:jdim2,numlevs,Nsx,Nsy)
36 _RL fieldin2(idim1:idim2,jdim1:jdim2,numlevs,Nsx,Nsy)
37 _RL fieldout1(idim1:idim2,jdim1:jdim2,numlevs,Nsx,Nsy)
38 _RL fieldout2(idim1:idim2,jdim1:jdim2,numlevs,Nsx,Nsy)
39
40 integer i, j, L, bi, bj
41 _RL tmpfld1(idim1:idim2,jdim1:jdim2)
42 _RL tmpfld2(idim1:idim2,jdim1:jdim2)
43
44 c Call the exchange routine to fill in the halo regions
45 CALL EXCH_UV_AGRID_3D_RL(
46 U fieldin1, fieldin2,
47 I .TRUE., numlevs, myThid )
48
49 c Now take average
50 do bj = myByLo(myThid), myByHi(myThid)
51 do bi = myBxLo(myThid), myBxHi(myThid)
52
53 do L = 1,numlevs
54 do j = jdim1,jdim2
55 do i = idim1,idim2
56 tmpfld1(i,j) = fieldin1(i,j,L,bi,bj)*mask(i,j,L,bi,bj)
57 tmpfld2(i,j) = fieldin2(i,j,L,bi,bj)*mask(i,j,L,bi,bj)
58 enddo
59 enddo
60 do j = jm1,jm2
61 do i = im1,im2
62 c do j = jm2,jm1,-1
63 c do i = im2,im1,-1
64 if( (mask(i-1,j,L,bi,bj).ne.0.) .or.
65 . (mask(i,j,L,bi,bj).ne.0.) ) then
66 c fieldout1(i,j,L,bi,bj) =
67 c . ( fieldin1(i-1,j,L,bi,bj)*mask(i-1,j,L,bi,bj) +
68 c . fieldin1(i,j,L,bi,bj)*mask(i,j,L,bi,bj) ) /
69 c . ( mask(i-1,j,L,bi,bj) + mask(i,j,L,bi,bj) )
70 fieldout1(i,j,L,bi,bj) =
71 . ( tmpfld1(i-1,j) + tmpfld1(i,j) ) /
72 . ( mask(i-1,j,L,bi,bj) + mask(i,j,L,bi,bj) )
73 else
74 fieldout1(i,j,L,bi,bj) = 0.
75 endif
76 if( (mask(i,j-1,L,bi,bj).ne.0.) .or.
77 . (mask(i,j,L,bi,bj).ne.0.) ) then
78 c fieldout2(i,j,L,bi,bj) =
79 c . ( fieldin2(i,j-1,L,bi,bj)*mask(i,j-1,L,bi,bj) +
80 c . fieldin2(i,j,L,bi,bj)*mask(i,j,L,bi,bj) ) /
81 c . ( mask(i,j,L,bi,bj) + mask(i,j-1,L,bi,bj) )
82 fieldout2(i,j,L,bi,bj) =
83 . ( tmpfld2(i,j-1) + tmpfld2(i,j) ) /
84 . ( mask(i,j,L,bi,bj) + mask(i,j-1,L,bi,bj) )
85 else
86 fieldout2(i,j,L,bi,bj) = 0.
87 endif
88 enddo
89 enddo
90 enddo
91
92 enddo
93 enddo
94
95 return
96 end

  ViewVC Help
Powered by ViewVC 1.1.22