/[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.16 - (show annotations) (download)
Thu May 13 15:40:53 2004 UTC (20 years ago) by adcroft
Branch: MAIN
CVS Tags: checkpoint53d_post, checkpoint53c_post, checkpoint53b_pre, checkpoint53b_post, checkpoint53d_pre
Changes since 1.15: +13 -12 lines
Slight re-arrangment to satisfy JMC opinions on file names!
 o ini_mnc_io.F has been split and replaced by
     ini_model_io.F - responsible for setting units/flags for model-state i/o
     write_grid.F   - responsible for writing the grid variables to file
 o the passing of flags to MDSIO has been moved from ini_parms to ini_model_io
 o ini_depths and ini_masks_etc no longer do I/O which is now in write_grid

1 C $Header: /u/gcmpack/MITgcm/model/src/ini_grid.F,v 1.15 2003/12/10 19:37:25 dimitri Exp $
2 C $Name: $
3
4 #include "PACKAGES_CONFIG.h"
5 #include "CPP_OPTIONS.h"
6
7 CBOP
8 C !ROUTINE: INI_GRID
9 C !INTERFACE:
10 SUBROUTINE INI_GRID( myThid )
11 C !DESCRIPTION: \bv
12 C *==========================================================*
13 C | SUBROUTINE INI_GRID
14 C | o Initialise model grid
15 C *==========================================================*
16 C | These arrays are used throughout the code in evaluating
17 C | gradients, integrals and spatial avarages. This routine
18 C | is called separately by each thread and initialise only
19 C | the region of the domain it is "responsible" for.
20 C | Notes:
21 C | Two examples are shown in this code. One illustrates the
22 C | initialisation of a cartesian grid. The other shows the
23 C | inialisation of a spherical polar grid. Other orthonormal
24 C | grids can be fitted into this design. In this case
25 C | custom metric terms also need adding to account for the
26 C | projections of velocity vectors onto these grids.
27 C | The structure used here also makes it possible to
28 C | implement less regular grid mappings. In particular
29 C | o Schemes which leave out blocks of the domain that are
30 C | all land could be supported.
31 C | o Multi-level schemes such as icosohedral or cubic
32 C | grid projectedions onto a sphere can also be fitted
33 C | within the strategy we use.
34 C | Both of the above also require modifying the support
35 C | routines that map computational blocks to simulation
36 C | domain blocks.
37 C *==========================================================*
38 C \ev
39
40 C !USES:
41 IMPLICIT NONE
42 C === Global variables ===
43 #include "SIZE.h"
44 #include "EEPARAMS.h"
45 #include "PARAMS.h"
46 #include "GRID.h"
47
48 C !INPUT/OUTPUT PARAMETERS:
49 C == Routine arguments ==
50 C myThid - Number of this instance of INI_GRID
51 INTEGER myThid
52
53 C !LOCAL VARIABLES:
54 C == Local variables ==
55 C msgBuf - Used for informational I/O.
56 CHARACTER*(MAX_LEN_MBUF) msgBuf
57 #ifdef ALLOW_EXF
58 INTEGER i, j, bi, bj
59 #endif /* ALLOW_EXF */
60 CEOP
61
62 C-- Set up vertical grid and coordinate system
63 CALL INI_VERTICAL_GRID( myThid )
64
65 C-- Set up horizontal grid and coordinate system
66 IF ( usingCartesianGrid ) THEN
67 CALL INI_CARTESIAN_GRID( myThid )
68 ELSEIF ( usingSphericalPolarGrid ) THEN
69 CALL INI_SPHERICAL_POLAR_GRID( myThid )
70 ELSEIF ( usingCurvilinearGrid ) THEN
71 CALL INI_CURVILINEAR_GRID( myThid )
72 ELSE
73 _BEGIN_MASTER(myThid)
74 WRITE(msgBuf,'(A)')
75 & 'S/R INI_GRID: No grid coordinate system has been selected'
76 CALL PRINT_ERROR( msgBuf , myThid)
77 STOP 'ABNORMAL END: S/R INI_GRID'
78 _END_MASTER(myThid)
79 ENDIF
80
81 #ifdef ALLOW_EXF
82 C-- exf_interp assumes that 0 <= xG, xC <= 360
83 C This is a quick fix until this assumption is relaxed
84 C and the interpolation weights are pre-computed.
85 DO bj = myByLo(myThid), myByHi(myThid)
86 DO bi = myBxLo(myThid), myBxHi(myThid)
87 DO J=1-Oly,sNy+Oly
88 DO I=1-Olx,sNx+Olx
89 IF ( xG(I,J,bi,bj) .LT. 0 )
90 & xG(I,J,bi,bj) = xG(I,J,bi,bj) + 360
91 IF ( xC(I,J,bi,bj) .LT. 0 )
92 & xC(I,J,bi,bj) = xC(I,J,bi,bj) + 360
93 ENDDO
94 ENDDO
95 ENDDO
96 ENDDO
97 #endif /* ALLOW_EXF */
98
99 C-- Write certain grid data to files (useful for creating netCDF
100 C and general post-analysis)
101 C This I/O is now done in write_grid.F
102 c CALL WRITE_FLD_XY_RS( 'XC',' ',XC,0,myThid)
103 c CALL WRITE_FLD_XY_RS( 'YC',' ',YC,0,myThid)
104 c CALL WRITE_FLD_XY_RS( 'XG',' ',XG,0,myThid)
105 c CALL WRITE_FLD_XY_RS( 'YG',' ',YG,0,myThid)
106 c CALL WRITE_FLD_XY_RS( 'RAC',' ',rA,0,myThid)
107 c CALL WRITE_FLD_XY_RS( 'RAW',' ',rAw,0,myThid)
108 c CALL WRITE_FLD_XY_RS( 'RAS',' ',rAs,0,myThid)
109 c CALL WRITE_FLD_XY_RS( 'DXG',' ',DXG,0,myThid)
110 c CALL WRITE_FLD_XY_RS( 'DYG',' ',DYG,0,myThid)
111 c CALL WRITE_FLD_XY_RS( 'DXC',' ',DXC,0,myThid)
112 c CALL WRITE_FLD_XY_RS( 'DYC',' ',DYC,0,myThid)
113
114 C-- Print out statistics of each horizontal grid array (helps when debugging)
115
116 #ifdef ALLOW_MONITOR
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 #endif
134
135 RETURN
136 END

  ViewVC Help
Powered by ViewVC 1.1.22