/[MITgcm]/MITgcm/model/src/ini_cartesian_grid.F
ViewVC logotype

Annotation of /MITgcm/model/src/ini_cartesian_grid.F

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


Revision 1.25 - (hide annotations) (download)
Sun Feb 17 02:18:16 2013 UTC (11 years, 3 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, checkpoint65, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint65o, checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint64e, checkpoint64d, checkpoint64g, checkpoint64f, HEAD
Changes since 1.24: +8 -25 lines
- move initialisation of all horizontal grid arrays to null value
  from specific horizontal grid S/R to main S/R INI_GRID;
- initialise new projection array for model C-grid velocity;
- initialise horizontal grid reciprocal arrays.

1 jmc 1.25 C $Header: /u/gcmpack/MITgcm/model/src/ini_cartesian_grid.F,v 1.24 2011/12/22 00:11:11 jmc Exp $
2 adcroft 1.16 C $Name: $
3 cnh 1.1
4 cnh 1.10 #include "CPP_OPTIONS.h"
5 cnh 1.1
6 cnh 1.17 CBOP
7     C !ROUTINE: INI_CARTESIAN_GRID
8     C !INTERFACE:
9 cnh 1.1 SUBROUTINE INI_CARTESIAN_GRID( myThid )
10 jmc 1.22
11 cnh 1.17 C !DESCRIPTION: \bv
12     C *==========================================================*
13 jmc 1.21 C | SUBROUTINE INI_CARTESIAN_GRID
14     C | o Initialise model coordinate system
15 cnh 1.17 C *==========================================================*
16 jmc 1.21 C | The grid arrays, initialised here, are used throughout
17     C | the code in evaluating gradients, integrals and spatial
18 jmc 1.23 C | avarages. This routine is called separately by each
19     C | thread and initialises only the region of the domain
20     C | it is "responsible" for.
21     C | Under the cartesian grid mode primitive distances
22     C | in X and Y are in metres. Distance in Z are in m or Pa
23 jmc 1.21 C | depending on the vertical gridding mode.
24 cnh 1.17 C *==========================================================*
25     C \ev
26    
27     C !USES:
28 adcroft 1.12 IMPLICIT NONE
29 cnh 1.1 C === Global variables ===
30     #include "SIZE.h"
31     #include "EEPARAMS.h"
32     #include "PARAMS.h"
33     #include "GRID.h"
34    
35 cnh 1.17 C !INPUT/OUTPUT PARAMETERS:
36 cnh 1.1 C == Routine arguments ==
37 jmc 1.23 C myThid :: my Thread Id Number
38 cnh 1.1 INTEGER myThid
39    
40 cnh 1.17 C !LOCAL VARIABLES:
41 cnh 1.1 C == Local variables ==
42 jmc 1.23 C bi,bj :: tile indices
43     C i, j :: loop counters
44     C delXloc :: mesh spacing in X direction
45     C delYloc :: mesh spacing in Y direction
46     C xGloc :: mesh corner-point location (local "Long" real array type)
47     C yGloc :: mesh corner-point location (local "Long" real array type)
48     INTEGER bi, bj
49     INTEGER i, j
50     INTEGER gridNx, gridNy
51     C NOTICE the extended range of indices!!
52     _RL delXloc(0-OLx:sNx+OLx)
53     _RL delYloc(0-OLy:sNy+OLy)
54     C NOTICE the extended range of indices!!
55     _RL xGloc(1-OLx:sNx+OLx+1,1-OLy:sNy+OLy+1)
56     _RL yGloc(1-OLx:sNx+OLx+1,1-OLy:sNy+OLy+1)
57 cnh 1.17 CEOP
58 adcroft 1.16
59 jmc 1.23 C-- For each tile ...
60 cnh 1.1 DO bj = myByLo(myThid), myByHi(myThid)
61     DO bi = myBxLo(myThid), myBxHi(myThid)
62 adcroft 1.16
63 jmc 1.23 C-- set tile local mesh (same units as delX,deY)
64     C corresponding to coordinates of cell corners for N+1 grid-lines
65    
66     CALL INI_LOCAL_GRID(
67     O xGloc, yGloc,
68     O delXloc, delYloc,
69     O gridNx, gridNy,
70     I bi, bj, myThid )
71 adcroft 1.16
72     C-- Make a permanent copy of [xGloc,yGloc] in [xG,yG]
73 jmc 1.23 DO j=1-OLy,sNy+OLy
74     DO i=1-OLx,sNx+OLx
75 jmc 1.22 xG(i,j,bi,bj) = xGloc(i,j)
76     yG(i,j,bi,bj) = yGloc(i,j)
77 adcroft 1.16 ENDDO
78     ENDDO
79    
80     C-- Calculate [xC,yC], coordinates of cell centers
81 jmc 1.23 DO j=1-OLy,sNy+OLy
82     DO i=1-OLx,sNx+OLx
83 adcroft 1.16 C by averaging
84 jmc 1.22 xC(i,j,bi,bj) = 0.25 _d 0*(
85     & xGloc(i,j)+xGloc(i+1,j)+xGloc(i,j+1)+xGloc(i+1,j+1) )
86     yC(i,j,bi,bj) = 0.25 _d 0*(
87     & yGloc(i,j)+yGloc(i+1,j)+yGloc(i,j+1)+yGloc(i+1,j+1) )
88 adcroft 1.16 ENDDO
89     ENDDO
90    
91     C-- Calculate [dxF,dyF], lengths between cell faces (through center)
92 jmc 1.23 DO j=1-OLy,sNy+OLy
93     DO i=1-OLx,sNx+OLx
94     dxF(i,j,bi,bj) = delXloc(i)
95     dyF(i,j,bi,bj) = delYloc(j)
96 adcroft 1.16 ENDDO
97     ENDDO
98    
99     C-- Calculate [dxG,dyG], lengths along cell boundaries
100 jmc 1.23 DO j=1-OLy,sNy+OLy
101     DO i=1-OLx,sNx+OLx
102     dxG(i,j,bi,bj) = delXloc(i)
103     dyG(i,j,bi,bj) = delYloc(j)
104 adcroft 1.16 ENDDO
105     ENDDO
106    
107     C-- The following arrays are not defined in some parts of the halo
108 jmc 1.25 C region. We set them to zero here for safety.
109     C Note: this is now done earlier in main S/R INI_GRID
110 adcroft 1.16
111     C-- Calculate [dxC], zonal length between cell centers
112 jmc 1.23 DO j=1-OLy,sNy+OLy
113     DO i=1-OLx+1,sNx+OLx ! NOTE range
114 jmc 1.22 dxC(i,j,bi,bj) = 0.5 _d 0*(dxF(i,j,bi,bj)+dxF(i-1,j,bi,bj))
115 cnh 1.1 ENDDO
116     ENDDO
117 adcroft 1.16
118     C-- Calculate [dyC], meridional length between cell centers
119 jmc 1.23 DO j=1-OLy+1,sNy+OLy ! NOTE range
120     DO i=1-OLx,sNx+OLx
121 jmc 1.22 dyC(i,j,bi,bj) = 0.5 _d 0*(dyF(i,j,bi,bj)+dyF(i,j-1,bi,bj))
122 cnh 1.1 ENDDO
123     ENDDO
124 adcroft 1.16
125     C-- Calculate [dxV,dyU], length between velocity points (through corners)
126 jmc 1.23 DO j=1-OLy+1,sNy+OLy ! NOTE range
127     DO i=1-OLx+1,sNx+OLx ! NOTE range
128 adcroft 1.16 C by averaging (method I)
129 jmc 1.22 dxV(i,j,bi,bj) = 0.5 _d 0*(dxG(i,j,bi,bj)+dxG(i-1,j,bi,bj))
130     dyU(i,j,bi,bj) = 0.5 _d 0*(dyG(i,j,bi,bj)+dyG(i,j-1,bi,bj))
131 adcroft 1.16 C by averaging (method II)
132 jmc 1.22 c dxV(i,j,bi,bj) = 0.5*(dxG(i,j,bi,bj)+dxG(i-1,j,bi,bj))
133     c dyU(i,j,bi,bj) = 0.5*(dyC(i,j,bi,bj)+dyC(i-1,j,bi,bj))
134 cnh 1.1 ENDDO
135     ENDDO
136 adcroft 1.16
137 jmc 1.21 C-- Calculate vertical face area
138 jmc 1.23 DO j=1-OLy,sNy+OLy
139     DO i=1-OLx,sNx+OLx
140 jmc 1.22 rA (i,j,bi,bj) = dxF(i,j,bi,bj)*dyF(i,j,bi,bj)
141     rAw(i,j,bi,bj) = dxC(i,j,bi,bj)*dyG(i,j,bi,bj)
142     rAs(i,j,bi,bj) = dxG(i,j,bi,bj)*dyC(i,j,bi,bj)
143     rAz(i,j,bi,bj) = dxV(i,j,bi,bj)*dyU(i,j,bi,bj)
144 jmc 1.18 C-- Set trigonometric terms & grid orientation:
145 jmc 1.25 C Note: this is now done earlier in main S/R INI_GRID
146     c tanPhiAtU(i,j,bi,bj) = 0.
147     c tanPhiAtV(i,j,bi,bj) = 0.
148     c angleCosC(i,j,bi,bj) = 1.
149     c angleSinC(i,j,bi,bj) = 0.
150 cnh 1.6 ENDDO
151     ENDDO
152 cnh 1.1
153 jmc 1.21 C-- end bi,bj loops
154     ENDDO
155     ENDDO
156 adcroft 1.16
157 cnh 1.1 RETURN
158     END

  ViewVC Help
Powered by ViewVC 1.1.22