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