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

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

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


Revision 1.2 - (hide annotations) (download)
Mon Feb 23 20:34:38 2004 UTC (20 years, 4 months ago) by molod
Branch: MAIN
CVS Tags: checkpoint52l_pre, checkpoint52l_post, checkpoint52m_post, hrcube5
Changes since 1.1: +2 -2 lines
check in of working fizhi routines

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

  ViewVC Help
Powered by ViewVC 1.1.22