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

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

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


Revision 1.1 - (hide annotations) (download)
Thu Jan 29 14:22:24 2004 UTC (20 years, 5 months ago) by molod
Branch: MAIN
CVS Tags: hrcube4, checkpoint52j_post, checkpoint52k_post, checkpoint52j_pre, hrcube_3
Initial check in of fizhi (fake!)

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

  ViewVC Help
Powered by ViewVC 1.1.22