1 |
adcroft |
1.9 |
C $Header: /u/gcmpack/models/MITgcmUV/model/src/ini_grid.F,v 1.8 2001/05/29 14:01:37 adcroft Exp $ |
2 |
adcroft |
1.8 |
C $Name: $ |
3 |
cnh |
1.1 |
|
4 |
cnh |
1.5 |
#include "CPP_OPTIONS.h" |
5 |
cnh |
1.1 |
|
6 |
|
|
CStartOfInterface |
7 |
|
|
SUBROUTINE INI_GRID( myThid ) |
8 |
|
|
C /==========================================================\ |
9 |
|
|
C | SUBROUTINE INI_GRID | |
10 |
|
|
C | o Initialise model grid | |
11 |
|
|
C |==========================================================| |
12 |
|
|
C | These arrays are used throughout the code in evaluating | |
13 |
|
|
C | gradients, integrals and spatial avarages. This routine | |
14 |
|
|
C | is called separately by each thread and initialise only | |
15 |
|
|
C | the region of the domain it is "responsible" for. | |
16 |
|
|
C | Notes: | |
17 |
|
|
C | Two examples are shown in this code. One illustrates the | |
18 |
|
|
C | initialisation of a cartesian grid. The other shows the | |
19 |
|
|
C | inialisation of a spherical polar grid. Other orthonormal| |
20 |
|
|
C | grids can be fitted into this design. In this case | |
21 |
|
|
C | custom metric terms also need adding to account for the | |
22 |
|
|
C | projections of velocity vectors onto these grids. | |
23 |
|
|
C | The structure used here also makes it possible to | |
24 |
|
|
C | implement less regular grid mappings. In particular | |
25 |
|
|
C | o Schemes which leave out blocks of the domain that are | |
26 |
|
|
C | all land could be supported. | |
27 |
|
|
C | o Multi-level schemes such as icosohedral or cubic | |
28 |
|
|
C | grid projectedions onto a sphere can also be fitted | |
29 |
|
|
C | within the strategy we use. | |
30 |
|
|
C | Both of the above also require modifying the support | |
31 |
|
|
C | routines that map computational blocks to simulation | |
32 |
|
|
C | domain blocks. | |
33 |
|
|
C \==========================================================/ |
34 |
adcroft |
1.6 |
IMPLICIT NONE |
35 |
cnh |
1.1 |
|
36 |
|
|
C === Global variables === |
37 |
|
|
#include "SIZE.h" |
38 |
|
|
#include "EEPARAMS.h" |
39 |
|
|
#include "PARAMS.h" |
40 |
|
|
#include "GRID.h" |
41 |
|
|
|
42 |
|
|
C == Routine arguments == |
43 |
|
|
C myThid - Number of this instance of INI_GRID |
44 |
|
|
INTEGER myThid |
45 |
|
|
CEndOfInterface |
46 |
|
|
|
47 |
|
|
C == Local variables == |
48 |
|
|
C msgBuf - Used for informational I/O. |
49 |
|
|
CHARACTER*(MAX_LEN_MBUF) msgBuf |
50 |
|
|
|
51 |
adcroft |
1.4 |
C-- Set up vertical grid and coordinate system |
52 |
|
|
CALL INI_VERTICAL_GRID( myThid ) |
53 |
|
|
|
54 |
|
|
C-- Set up horizontal grid and coordinate system |
55 |
cnh |
1.1 |
IF ( usingCartesianGrid ) THEN |
56 |
|
|
CALL INI_CARTESIAN_GRID( myThid ) |
57 |
|
|
ELSEIF ( usingSphericalPolarGrid ) THEN |
58 |
|
|
CALL INI_SPHERICAL_POLAR_GRID( myThid ) |
59 |
adcroft |
1.8 |
ELSEIF ( usingCurvilinearGrid ) THEN |
60 |
|
|
CALL INI_CURVILINEAR_GRID( myThid ) |
61 |
cnh |
1.1 |
ELSE |
62 |
|
|
_BEGIN_MASTER(myThid) |
63 |
|
|
WRITE(msgBuf,'(A)') |
64 |
|
|
& 'S/R INI_GRID: No grid coordinate system has been selected' |
65 |
|
|
CALL PRINT_ERROR( msgBuf , myThid) |
66 |
|
|
STOP 'ABNORMAL END: S/R INI_GRID' |
67 |
|
|
_END_MASTER(myThid) |
68 |
|
|
ENDIF |
69 |
adcroft |
1.8 |
|
70 |
|
|
C-- Write certain grid data to files (useful for creating netCDF |
71 |
|
|
C and general post-analysis) |
72 |
|
|
CALL WRITE_FLD_XY_RS( 'XC',' ',XC,0,myThid) |
73 |
|
|
CALL WRITE_FLD_XY_RS( 'YC',' ',YC,0,myThid) |
74 |
|
|
CALL WRITE_FLD_XY_RS( 'XG',' ',XG,0,myThid) |
75 |
|
|
CALL WRITE_FLD_XY_RS( 'YG',' ',YG,0,myThid) |
76 |
|
|
CALL WRITE_FLD_XY_RS( 'AC',' ',rA,0,myThid) |
77 |
adcroft |
1.9 |
|
78 |
|
|
C-- Print out statistics of each horizontal grid array (helps when debugging) |
79 |
|
|
CALL MON_PRINTSTATS_RS(1,XC,'XC',myThid) |
80 |
|
|
CALL MON_PRINTSTATS_RS(1,XG,'XG',myThid) |
81 |
|
|
CALL MON_PRINTSTATS_RS(1,DXC,'DXC',myThid) |
82 |
|
|
CALL MON_PRINTSTATS_RS(1,DXF,'DXF',myThid) |
83 |
|
|
CALL MON_PRINTSTATS_RS(1,DXG,'DXG',myThid) |
84 |
|
|
CALL MON_PRINTSTATS_RS(1,DXV,'DXV',myThid) |
85 |
|
|
CALL MON_PRINTSTATS_RS(1,YC,'YC',myThid) |
86 |
|
|
CALL MON_PRINTSTATS_RS(1,YG,'YG',myThid) |
87 |
|
|
CALL MON_PRINTSTATS_RS(1,DYC,'DYC',myThid) |
88 |
|
|
CALL MON_PRINTSTATS_RS(1,DYF,'DYF',myThid) |
89 |
|
|
CALL MON_PRINTSTATS_RS(1,DYG,'DYG',myThid) |
90 |
|
|
CALL MON_PRINTSTATS_RS(1,DYU,'DYU',myThid) |
91 |
|
|
CALL MON_PRINTSTATS_RS(1,RA,'RA',myThid) |
92 |
|
|
CALL MON_PRINTSTATS_RS(1,RAW,'RAW',myThid) |
93 |
|
|
CALL MON_PRINTSTATS_RS(1,RAS,'RAS',myThid) |
94 |
|
|
CALL MON_PRINTSTATS_RS(1,RAZ,'RAZ',myThid) |
95 |
adcroft |
1.8 |
|
96 |
cnh |
1.1 |
RETURN |
97 |
|
|
END |