/[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.9 by adcroft, Mon Jun 4 19:46:22 2001 UTC revision 1.25 by jmc, Sun Jul 31 22:07:47 2005 UTC
# Line 1  Line 1 
1  C $Header$  C $Header$
2  C $Name$  C $Name$
3    
4    #include "PACKAGES_CONFIG.h"
5  #include "CPP_OPTIONS.h"  #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     \==========================================================/  
       IMPLICIT NONE  
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 "PARAMS.h"  #include "PARAMS.h"
23    #ifdef ALLOW_MNC
24    #include "MNC_PARAMS.h"
25    #endif
26  #include "GRID.h"  #include "GRID.h"
27    #ifdef ALLOW_MONITOR
28    #include "MONITOR.h"
29    #endif
30    
31  C     == Routine arguments ==  C     !INPUT/OUTPUT PARAMETERS:
 C     myThid -  Number of this instance of INI_GRID  
32        INTEGER myThid        INTEGER myThid
33  CEndOfInterface  CEOP
34    
35  C     == Local variables ==  C     !LOCAL VARIABLES:
36  C     msgBuf - Used for informational I/O.  C     msgBuf - Used for informational I/O.
37        CHARACTER*(MAX_LEN_MBUF) msgBuf        CHARACTER*(MAX_LEN_MBUF) msgBuf
38          INTEGER i
39    
40  C--   Set up vertical grid and coordinate system  C     load grid spacing (vector) from files
41          CALL LOAD_GRID_SPACING( myThid )
42    
43    C     Set up vertical grid and coordinate system
44        CALL INI_VERTICAL_GRID( myThid )        CALL INI_VERTICAL_GRID( myThid )
45    
46  C--   Set up horizontal grid and coordinate system  C     Two examples are shown in this code. One illustrates the
47    C     initialization of a cartesian grid. The other shows the
48    C     inialization of a spherical polar grid. Other orthonormal grids
49    C     can be fitted into this design. In this case custom metric terms
50    C     also need adding to account for the projections of velocity
51    C     vectors onto these grids.  The structure used here also makes it
52    C     possible to implement less regular grid mappings. In particular:
53    C      o Schemes which leave out blocks of the domain that are  
54    C        all land could be supported.                            
55    C      o Multi-level schemes such as icosohedral or cubic        
56    C        grid projectedions onto a sphere can also be fitted    
57    C       within the strategy we use.                            
58    C        Both of the above also require modifying the support    
59    C        routines that map computational blocks to simulation    
60    C        domain blocks.                                          
61    
62    C     Set up horizontal grid and coordinate system
63        IF ( usingCartesianGrid ) THEN        IF ( usingCartesianGrid ) THEN
64         CALL INI_CARTESIAN_GRID( myThid )          CALL INI_CARTESIAN_GRID( myThid )
65        ELSEIF ( usingSphericalPolarGrid ) THEN        ELSEIF ( usingSphericalPolarGrid ) THEN
66         CALL INI_SPHERICAL_POLAR_GRID( myThid )          CALL INI_SPHERICAL_POLAR_GRID( myThid )
67        ELSEIF ( usingCurvilinearGrid ) THEN        ELSEIF ( usingCurvilinearGrid ) THEN
68         CALL INI_CURVILINEAR_GRID( myThid )          CALL INI_CURVILINEAR_GRID( myThid )
69          ELSEIF ( usingCylindricalGrid ) THEN
70            CALL INI_CYLINDER_GRID( myThid )
71        ELSE        ELSE
72         _BEGIN_MASTER(myThid)          _BEGIN_MASTER(myThid)
73          WRITE(msgBuf,'(A)')          WRITE(msgBuf,'(2A)') 'S/R INI_GRID: ',
74       &   'S/R INI_GRID: No grid coordinate system has been selected'       &       'No grid coordinate system has been selected'
75           CALL PRINT_ERROR( msgBuf , myThid)          CALL PRINT_ERROR( msgBuf , myThid)
76           STOP 'ABNORMAL END: S/R INI_GRID'          STOP 'ABNORMAL END: S/R INI_GRID'
77         _END_MASTER(myThid)          _END_MASTER(myThid)
78        ENDIF        ENDIF
79    
80  C--   Write certain grid data to files (useful for creating netCDF  #ifdef ALLOW_MONITOR
81  C     and general post-analysis)        mon_write_stdout = .FALSE.
82        CALL WRITE_FLD_XY_RS( 'XC',' ',XC,0,myThid)        mon_write_mnc    = .FALSE.
83        CALL WRITE_FLD_XY_RS( 'YC',' ',YC,0,myThid)        IF (monitor_stdio) THEN
84        CALL WRITE_FLD_XY_RS( 'XG',' ',XG,0,myThid)          mon_write_stdout = .TRUE.
85        CALL WRITE_FLD_XY_RS( 'YG',' ',YG,0,myThid)        ENDIF
86        CALL WRITE_FLD_XY_RS( 'AC',' ',rA,0,myThid)        
87    #ifdef ALLOW_MNC
88  C--   Print out statistics of each horizontal grid array (helps when debugging)        IF (useMNC .AND. monitor_mnc) THEN
89            DO i = 1,MAX_LEN_MBUF
90              mon_fname(i:i) = ' '
91            ENDDO
92            mon_fname(1:12) = 'monitor_grid'
93            CALL MNC_CW_SET_UDIM(mon_fname, 1, myThid)
94            mon_write_mnc = .TRUE.
95          ENDIF
96    #endif /*  ALLOW_MNC  */
97          
98    C     Print out statistics of each horizontal grid array (helps when
99    C     debugging)
100        CALL MON_PRINTSTATS_RS(1,XC,'XC',myThid)        CALL MON_PRINTSTATS_RS(1,XC,'XC',myThid)
101        CALL MON_PRINTSTATS_RS(1,XG,'XG',myThid)        CALL MON_PRINTSTATS_RS(1,XG,'XG',myThid)
102        CALL MON_PRINTSTATS_RS(1,DXC,'DXC',myThid)        CALL MON_PRINTSTATS_RS(1,DXC,'DXC',myThid)
# Line 92  C--   Print out statistics of each horiz Line 113  C--   Print out statistics of each horiz
113        CALL MON_PRINTSTATS_RS(1,RAW,'RAW',myThid)        CALL MON_PRINTSTATS_RS(1,RAW,'RAW',myThid)
114        CALL MON_PRINTSTATS_RS(1,RAS,'RAS',myThid)        CALL MON_PRINTSTATS_RS(1,RAS,'RAS',myThid)
115        CALL MON_PRINTSTATS_RS(1,RAZ,'RAZ',myThid)        CALL MON_PRINTSTATS_RS(1,RAZ,'RAZ',myThid)
116          CALL MON_PRINTSTATS_RS(1,angleCosC,'AngleCS',myThid)
117          CALL MON_PRINTSTATS_RS(1,angleSinC,'AngleSN',myThid)
118    
119          mon_write_stdout = .FALSE.
120          mon_write_mnc    = .FALSE.
121    #endif
122    
123        RETURN        RETURN
124        END        END

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.25

  ViewVC Help
Powered by ViewVC 1.1.22