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

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

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


Revision 1.29 - (hide annotations) (download)
Wed Sep 6 02:44:11 2006 UTC (17 years, 9 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint58p_post
Changes since 1.28: +6 -2 lines
Temporary cleanup of mixing of MPI-related code with dynamical kernel
until standard of separating MPI from dynamical kernel is restored
(breaks adjoint).

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

  ViewVC Help
Powered by ViewVC 1.1.22