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

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

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


Revision 1.28 - (show annotations) (download)
Tue Jul 25 22:23:36 2006 UTC (17 years, 10 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint58o_post, checkpoint58n_post
Changes since 1.27: +59 -36 lines
standard way to switch monitor flags

1 C $Header: /u/gcmpack/MITgcm/model/src/ini_grid.F,v 1.27 2005/11/07 18:26:02 cnh Exp $
2 C $Name: $
3
4 #include "PACKAGES_CONFIG.h"
5 #include "CPP_OPTIONS.h"
6
7 CBOP
8 C !ROUTINE: INI_GRID
9
10 C !INTERFACE:
11 SUBROUTINE INI_GRID( myThid )
12 C !DESCRIPTION:
13 C These arrays are used throughout the code in evaluating gradients,
14 C integrals and spatial avarages. This routine is called separately
15 C by each thread and initializes only the region of the domain it is
16 C "responsible" for.
17
18 C !USES:
19 IMPLICIT NONE
20 #include "SIZE.h"
21 #include "EEPARAMS.h"
22 #include "EESUPPORT.h"
23 #include "PARAMS.h"
24 #include "GRID.h"
25 #ifdef ALLOW_MNC
26 #include "MNC_PARAMS.h"
27 #endif
28 #ifdef ALLOW_MONITOR
29 #include "MONITOR.h"
30 #endif
31
32 C !INPUT/OUTPUT PARAMETERS:
33 INTEGER myThid
34 CEOP
35
36 C !LOCAL VARIABLES:
37 C msgBuf - Used for informational I/O.
38 CHARACTER*(MAX_LEN_MBUF) msgBuf
39 #ifdef ALLOW_MNC
40 INTEGER i
41 #endif
42
43 C load grid spacing (vector) from files
44 _BARRIER
45 CALL LOAD_GRID_SPACING( myThid )
46 _BARRIER
47
48 C Set up vertical grid and coordinate system
49 CALL INI_VERTICAL_GRID( myThid )
50
51 C Two examples are shown in this code. One illustrates the
52 C initialization of a cartesian grid. The other shows the
53 C inialization of a spherical polar grid. Other orthonormal grids
54 C can be fitted into this design. In this case custom metric terms
55 C also need adding to account for the projections of velocity
56 C vectors onto these grids. The structure used here also makes it
57 C possible to implement less regular grid mappings. In particular:
58 C o Schemes which leave out blocks of the domain that are
59 C all land could be supported.
60 C o Multi-level schemes such as icosohedral or cubic
61 C grid projectedions onto a sphere can also be fitted
62 C within the strategy we use.
63 C Both of the above also require modifying the support
64 C routines that map computational blocks to simulation
65 C domain blocks.
66
67 C Set up horizontal grid and coordinate system
68 IF ( usingCartesianGrid ) THEN
69 CALL INI_CARTESIAN_GRID( myThid )
70 ELSEIF ( usingSphericalPolarGrid ) THEN
71 CALL INI_SPHERICAL_POLAR_GRID( myThid )
72 ELSEIF ( usingCurvilinearGrid ) THEN
73 CALL INI_CURVILINEAR_GRID( myThid )
74 ELSEIF ( usingCylindricalGrid ) THEN
75 CALL INI_CYLINDER_GRID( myThid )
76 ELSE
77 _BEGIN_MASTER(myThid)
78 WRITE(msgBuf,'(2A)') 'S/R INI_GRID: ',
79 & 'No grid coordinate system has been selected'
80 CALL PRINT_ERROR( msgBuf , myThid)
81 STOP 'ABNORMAL END: S/R INI_GRID'
82 _END_MASTER(myThid)
83 ENDIF
84
85 #ifdef ALLOW_MONITOR
86 #ifdef ALLOW_USE_MPI
87 IF ( .NOT.useSingleCPUIO .OR. mpiMyId.EQ.0 ) THEN
88 #endif /* ALLOW_USE_MPI */
89 _BEGIN_MASTER(myThid)
90 C-- only the master thread is allowed to switch On/Off mon_write_stdout
91 C & mon_write_mnc (since it's the only thread that uses those flags):
92
93 IF (monitor_stdio) THEN
94 mon_write_stdout = .TRUE.
95 ELSE
96 mon_write_stdout = .FALSE.
97 ENDIF
98 mon_write_mnc = .FALSE.
99 #ifdef ALLOW_MNC
100 IF (useMNC .AND. monitor_mnc) THEN
101 DO i = 1,MAX_LEN_MBUF
102 mon_fname(i:i) = ' '
103 ENDDO
104 mon_fname(1:12) = 'monitor_grid'
105 CALL MNC_CW_SET_UDIM(mon_fname, 1, myThid)
106 mon_write_mnc = .TRUE.
107 ENDIF
108 #endif /* ALLOW_MNC */
109
110 _END_MASTER(myThid)
111 #ifdef ALLOW_USE_MPI
112 ENDIF
113 #endif /* ALLOW_USE_MPI */
114
115 C Print out statistics of each horizontal grid array (helps when
116 C debugging)
117 CALL MON_PRINTSTATS_RS(1,xC,'XC',myThid)
118 CALL MON_PRINTSTATS_RS(1,xG,'XG',myThid)
119 CALL MON_PRINTSTATS_RS(1,dxC,'DXC',myThid)
120 CALL MON_PRINTSTATS_RS(1,dxF,'DXF',myThid)
121 CALL MON_PRINTSTATS_RS(1,dxG,'DXG',myThid)
122 CALL MON_PRINTSTATS_RS(1,dxV,'DXV',myThid)
123 CALL MON_PRINTSTATS_RS(1,yC,'YC',myThid)
124 CALL MON_PRINTSTATS_RS(1,yG,'YG',myThid)
125 CALL MON_PRINTSTATS_RS(1,dyC,'DYC',myThid)
126 CALL MON_PRINTSTATS_RS(1,dyF,'DYF',myThid)
127 CALL MON_PRINTSTATS_RS(1,dyG,'DYG',myThid)
128 CALL MON_PRINTSTATS_RS(1,dyU,'DYU',myThid)
129 CALL MON_PRINTSTATS_RS(1,rA,'RA',myThid)
130 CALL MON_PRINTSTATS_RS(1,rAw,'RAW',myThid)
131 CALL MON_PRINTSTATS_RS(1,rAs,'RAS',myThid)
132 CALL MON_PRINTSTATS_RS(1,rAz,'RAZ',myThid)
133 CALL MON_PRINTSTATS_RS(1,angleCosC,'AngleCS',myThid)
134 CALL MON_PRINTSTATS_RS(1,angleSinC,'AngleSN',myThid)
135
136 #ifdef ALLOW_USE_MPI
137 IF ( .NOT.useSingleCPUIO .OR. mpiMyId.EQ.0 ) THEN
138 #endif /* ALLOW_USE_MPI */
139 _BEGIN_MASTER(myThid)
140
141 mon_write_stdout = .FALSE.
142 mon_write_mnc = .FALSE.
143
144 _END_MASTER(myThid)
145 #ifdef ALLOW_USE_MPI
146 ENDIF
147 #endif /* ALLOW_USE_MPI */
148 #endif /* ALLOW_MONITOR */
149
150 RETURN
151 END

  ViewVC Help
Powered by ViewVC 1.1.22