1 |
jmc |
1.25 |
C $Header: /u/gcmpack/MITgcm/model/src/ini_grid.F,v 1.24 2005/07/13 00:34:39 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 |
|
|
#include "PARAMS.h" |
23 |
edhill |
1.23 |
#ifdef ALLOW_MNC |
24 |
|
|
#include "MNC_PARAMS.h" |
25 |
|
|
#endif |
26 |
cnh |
1.1 |
#include "GRID.h" |
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 |
cnh |
1.10 |
C !LOCAL VARIABLES: |
36 |
cnh |
1.1 |
C msgBuf - Used for informational I/O. |
37 |
|
|
CHARACTER*(MAX_LEN_MBUF) msgBuf |
38 |
edhill |
1.21 |
INTEGER i |
39 |
cnh |
1.1 |
|
40 |
jmc |
1.25 |
C load grid spacing (vector) from files |
41 |
|
|
CALL LOAD_GRID_SPACING( myThid ) |
42 |
|
|
|
43 |
edhill |
1.21 |
C Set up vertical grid and coordinate system |
44 |
adcroft |
1.4 |
CALL INI_VERTICAL_GRID( myThid ) |
45 |
|
|
|
46 |
edhill |
1.21 |
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 |
cnh |
1.1 |
IF ( usingCartesianGrid ) THEN |
64 |
edhill |
1.21 |
CALL INI_CARTESIAN_GRID( myThid ) |
65 |
cnh |
1.1 |
ELSEIF ( usingSphericalPolarGrid ) THEN |
66 |
edhill |
1.21 |
CALL INI_SPHERICAL_POLAR_GRID( myThid ) |
67 |
adcroft |
1.8 |
ELSEIF ( usingCurvilinearGrid ) THEN |
68 |
edhill |
1.21 |
CALL INI_CURVILINEAR_GRID( myThid ) |
69 |
afe |
1.17 |
ELSEIF ( usingCylindricalGrid ) THEN |
70 |
jmc |
1.24 |
CALL INI_CYLINDER_GRID( myThid ) |
71 |
cnh |
1.1 |
ELSE |
72 |
edhill |
1.21 |
_BEGIN_MASTER(myThid) |
73 |
|
|
WRITE(msgBuf,'(2A)') 'S/R INI_GRID: ', |
74 |
|
|
& 'No grid coordinate system has been selected' |
75 |
|
|
CALL PRINT_ERROR( msgBuf , myThid) |
76 |
|
|
STOP 'ABNORMAL END: S/R INI_GRID' |
77 |
|
|
_END_MASTER(myThid) |
78 |
cnh |
1.1 |
ENDIF |
79 |
dimitri |
1.15 |
|
80 |
adcroft |
1.20 |
#ifdef ALLOW_MONITOR |
81 |
edhill |
1.21 |
mon_write_stdout = .FALSE. |
82 |
|
|
mon_write_mnc = .FALSE. |
83 |
|
|
IF (monitor_stdio) THEN |
84 |
|
|
mon_write_stdout = .TRUE. |
85 |
|
|
ENDIF |
86 |
|
|
|
87 |
|
|
#ifdef ALLOW_MNC |
88 |
|
|
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 |
adcroft |
1.9 |
CALL MON_PRINTSTATS_RS(1,XC,'XC',myThid) |
101 |
|
|
CALL MON_PRINTSTATS_RS(1,XG,'XG',myThid) |
102 |
|
|
CALL MON_PRINTSTATS_RS(1,DXC,'DXC',myThid) |
103 |
|
|
CALL MON_PRINTSTATS_RS(1,DXF,'DXF',myThid) |
104 |
|
|
CALL MON_PRINTSTATS_RS(1,DXG,'DXG',myThid) |
105 |
|
|
CALL MON_PRINTSTATS_RS(1,DXV,'DXV',myThid) |
106 |
|
|
CALL MON_PRINTSTATS_RS(1,YC,'YC',myThid) |
107 |
|
|
CALL MON_PRINTSTATS_RS(1,YG,'YG',myThid) |
108 |
|
|
CALL MON_PRINTSTATS_RS(1,DYC,'DYC',myThid) |
109 |
|
|
CALL MON_PRINTSTATS_RS(1,DYF,'DYF',myThid) |
110 |
|
|
CALL MON_PRINTSTATS_RS(1,DYG,'DYG',myThid) |
111 |
|
|
CALL MON_PRINTSTATS_RS(1,DYU,'DYU',myThid) |
112 |
|
|
CALL MON_PRINTSTATS_RS(1,RA,'RA',myThid) |
113 |
|
|
CALL MON_PRINTSTATS_RS(1,RAW,'RAW',myThid) |
114 |
|
|
CALL MON_PRINTSTATS_RS(1,RAS,'RAS',myThid) |
115 |
|
|
CALL MON_PRINTSTATS_RS(1,RAZ,'RAZ',myThid) |
116 |
jmc |
1.24 |
CALL MON_PRINTSTATS_RS(1,angleCosC,'AngleCS',myThid) |
117 |
|
|
CALL MON_PRINTSTATS_RS(1,angleSinC,'AngleSN',myThid) |
118 |
edhill |
1.21 |
|
119 |
|
|
mon_write_stdout = .FALSE. |
120 |
|
|
mon_write_mnc = .FALSE. |
121 |
heimbach |
1.12 |
#endif |
122 |
adcroft |
1.8 |
|
123 |
cnh |
1.1 |
RETURN |
124 |
|
|
END |