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

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

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

revision 1.2 by cnh, Fri Apr 24 02:05:41 1998 UTC revision 1.28 by jmc, Tue Jul 25 22:23:36 2006 UTC
# Line 1  Line 1 
1  C $Header$  C $Header$
2    C $Name$
3    
4  #include "CPP_EEOPTIONS.h"  #include "PACKAGES_CONFIG.h"
5    #include "CPP_OPTIONS.h"
6    
7  CStartOfInterface  CBOP
8    C     !ROUTINE: INI_GRID
9    
10    C     !INTERFACE:
11        SUBROUTINE INI_GRID( myThid )        SUBROUTINE INI_GRID( myThid )
12  C     /==========================================================\  C     !DESCRIPTION:
13  C     | SUBROUTINE INI_GRID                                      |  C     These arrays are used throughout the code in evaluating gradients,
14  C     | o Initialise model grid                                  |  C     integrals and spatial avarages. This routine is called separately
15  C     |==========================================================|  C     by each thread and initializes only the region of the domain it is
16  C     | These arrays are used throughout the code in evaluating  |  C     "responsible" for.
 C     | gradients, integrals and spatial avarages. This routine  |  
 C     | is called separately by each thread and initialise only  |  
 C     | the region of the domain it is "responsible" for.        |  
 C     | Notes:                                                   |  
 C     | Two examples are shown in this code. One illustrates the |  
 C     | initialisation of a cartesian grid. The other shows the  |  
 C     | inialisation of a spherical polar grid. Other orthonormal|  
 C     | grids can be fitted into this design. In this case       |  
 C     | custom metric terms also need adding to account for the  |  
 C     | projections of velocity vectors onto these grids.        |  
 C     | The structure used here also makes it possible to        |  
 C     | implement less regular grid mappings. In particular      |  
 C     | o Schemes which leave out blocks of the domain that are  |  
 C     |   all land could be supported.                           |  
 C     | o Multi-level schemes such as icosohedral or cubic       |  
 C     |   grid projectedions onto a sphere can also be fitted    |  
 C     |   within the strategy we use.                            |  
 C     |   Both of the above also require modifying the support   |  
 C     |   routines that map computational blocks to simulation   |  
 C     |   domain blocks.                                         |  
 C     \==========================================================/  
17    
18  C     === Global variables ===  C     !USES:
19          IMPLICIT NONE
20  #include "SIZE.h"  #include "SIZE.h"
21  #include "EEPARAMS.h"  #include "EEPARAMS.h"
22    #include "EESUPPORT.h"
23  #include "PARAMS.h"  #include "PARAMS.h"
24  #include "GRID.h"  #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     == Routine arguments ==  C     !INPUT/OUTPUT PARAMETERS:
 C     myThid -  Number of this instance of INI_GRID  
33        INTEGER myThid        INTEGER myThid
34  CEndOfInterface  CEOP
35    
36  C     == Local variables ==  C     !LOCAL VARIABLES:
37  C     msgBuf - Used for informational I/O.  C     msgBuf - Used for informational I/O.
38        CHARACTER*(MAX_LEN_MBUF) msgBuf        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 grid coordinate system  C     Set up horizontal grid and coordinate system
68        IF ( usingCartesianGrid ) THEN        IF ( usingCartesianGrid ) THEN
69         CALL INI_CARTESIAN_GRID( myThid )          CALL INI_CARTESIAN_GRID( myThid )
70        ELSEIF ( usingSphericalPolarGrid ) THEN        ELSEIF ( usingSphericalPolarGrid ) THEN
71         CALL INI_SPHERICAL_POLAR_GRID( myThid )          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        ELSE
77         _BEGIN_MASTER(myThid)          _BEGIN_MASTER(myThid)
78          WRITE(msgBuf,'(A)')          WRITE(msgBuf,'(2A)') 'S/R INI_GRID: ',
79       &   'S/R INI_GRID: No grid coordinate system has been selected'       &       'No grid coordinate system has been selected'
80           CALL PRINT_ERROR( msgBuf , myThid)          CALL PRINT_ERROR( msgBuf , myThid)
81           STOP 'ABNORMAL END: S/R INI_GRID'          STOP 'ABNORMAL END: S/R INI_GRID'
82         _END_MASTER(myThid)          _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        ENDIF
147  C  #endif /* ALLOW_USE_MPI */
148    #endif /* ALLOW_MONITOR */
149    
150        RETURN        RETURN
151        END        END
   
 C     $Id$  

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.28

  ViewVC Help
Powered by ViewVC 1.1.22