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

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

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


Revision 1.25 - (show 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 C $Header: /u/gcmpack/MITgcm/model/src/ini_cartesian_grid.F,v 1.24 2011/12/22 00:11:11 jmc Exp $
2 C $Name: $
3
4 #include "CPP_OPTIONS.h"
5
6 CBOP
7 C !ROUTINE: INI_CARTESIAN_GRID
8 C !INTERFACE:
9 SUBROUTINE INI_CARTESIAN_GRID( myThid )
10
11 C !DESCRIPTION: \bv
12 C *==========================================================*
13 C | SUBROUTINE INI_CARTESIAN_GRID
14 C | o Initialise model coordinate system
15 C *==========================================================*
16 C | The grid arrays, initialised here, are used throughout
17 C | the code in evaluating gradients, integrals and spatial
18 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 C | depending on the vertical gridding mode.
24 C *==========================================================*
25 C \ev
26
27 C !USES:
28 IMPLICIT NONE
29 C === Global variables ===
30 #include "SIZE.h"
31 #include "EEPARAMS.h"
32 #include "PARAMS.h"
33 #include "GRID.h"
34
35 C !INPUT/OUTPUT PARAMETERS:
36 C == Routine arguments ==
37 C myThid :: my Thread Id Number
38 INTEGER myThid
39
40 C !LOCAL VARIABLES:
41 C == Local variables ==
42 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 CEOP
58
59 C-- For each tile ...
60 DO bj = myByLo(myThid), myByHi(myThid)
61 DO bi = myBxLo(myThid), myBxHi(myThid)
62
63 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
72 C-- Make a permanent copy of [xGloc,yGloc] in [xG,yG]
73 DO j=1-OLy,sNy+OLy
74 DO i=1-OLx,sNx+OLx
75 xG(i,j,bi,bj) = xGloc(i,j)
76 yG(i,j,bi,bj) = yGloc(i,j)
77 ENDDO
78 ENDDO
79
80 C-- Calculate [xC,yC], coordinates of cell centers
81 DO j=1-OLy,sNy+OLy
82 DO i=1-OLx,sNx+OLx
83 C by averaging
84 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 ENDDO
89 ENDDO
90
91 C-- Calculate [dxF,dyF], lengths between cell faces (through center)
92 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 ENDDO
97 ENDDO
98
99 C-- Calculate [dxG,dyG], lengths along cell boundaries
100 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 ENDDO
105 ENDDO
106
107 C-- The following arrays are not defined in some parts of the halo
108 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
111 C-- Calculate [dxC], zonal length between cell centers
112 DO j=1-OLy,sNy+OLy
113 DO i=1-OLx+1,sNx+OLx ! NOTE range
114 dxC(i,j,bi,bj) = 0.5 _d 0*(dxF(i,j,bi,bj)+dxF(i-1,j,bi,bj))
115 ENDDO
116 ENDDO
117
118 C-- Calculate [dyC], meridional length between cell centers
119 DO j=1-OLy+1,sNy+OLy ! NOTE range
120 DO i=1-OLx,sNx+OLx
121 dyC(i,j,bi,bj) = 0.5 _d 0*(dyF(i,j,bi,bj)+dyF(i,j-1,bi,bj))
122 ENDDO
123 ENDDO
124
125 C-- Calculate [dxV,dyU], length between velocity points (through corners)
126 DO j=1-OLy+1,sNy+OLy ! NOTE range
127 DO i=1-OLx+1,sNx+OLx ! NOTE range
128 C by averaging (method I)
129 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 C by averaging (method II)
132 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 ENDDO
135 ENDDO
136
137 C-- Calculate vertical face area
138 DO j=1-OLy,sNy+OLy
139 DO i=1-OLx,sNx+OLx
140 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 C-- Set trigonometric terms & grid orientation:
145 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 ENDDO
151 ENDDO
152
153 C-- end bi,bj loops
154 ENDDO
155 ENDDO
156
157 RETURN
158 END

  ViewVC Help
Powered by ViewVC 1.1.22