/[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.30 - (hide annotations) (download)
Tue Oct 17 18:20:18 2006 UTC (17 years, 7 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint58q_post, checkpoint58r_post
Changes since 1.29: +10 -24 lines
use function "MASTER_CPU_IO" to hide EESUPPORT.h from TAF.

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

  ViewVC Help
Powered by ViewVC 1.1.22