/[MITgcm]/MITgcm/model/src/ini_cori.F
ViewVC logotype

Annotation of /MITgcm/model/src/ini_cori.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.31 - (hide annotations) (download)
Tue Mar 16 00:08:27 2010 UTC (14 years, 2 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint62e, checkpoint62d
Changes since 1.30: +2 -2 lines
avoid unbalanced quote (single or double) in commented line

1 jmc 1.31 C $Header: /u/gcmpack/MITgcm/model/src/ini_cori.F,v 1.30 2009/06/28 01:03:24 jmc Exp $
2 adcroft 1.10 C $Name: $
3 cnh 1.1
4 jmc 1.17 #include "PACKAGES_CONFIG.h"
5 cnh 1.6 #include "CPP_OPTIONS.h"
6 cnh 1.1
7 cnh 1.12 CBOP
8     C !ROUTINE: INI_CORI
9 edhill 1.18
10 cnh 1.12 C !INTERFACE:
11 cnh 1.1 SUBROUTINE INI_CORI( myThid )
12 edhill 1.18 C !DESCRIPTION:
13 jmc 1.23 C Initialise coriolis term.
14 cnh 1.12
15     C !USES:
16 adcroft 1.7 IMPLICIT NONE
17 cnh 1.1 #include "SIZE.h"
18     #include "EEPARAMS.h"
19     #include "PARAMS.h"
20 jmc 1.23 #include "GRID.h"
21 jmc 1.27 #ifdef ALLOW_EXCH2
22 jmc 1.28 # include "W2_EXCH2_SIZE.h"
23 jmc 1.27 # include "W2_EXCH2_TOPOLOGY.h"
24     #endif
25 edhill 1.20 #ifdef ALLOW_MNC
26 jmc 1.27 # include "MNC_PARAMS.h"
27 edhill 1.20 #endif
28 edhill 1.18 #ifdef ALLOW_MONITOR
29 jmc 1.27 # include "MONITOR.h"
30 edhill 1.18 #endif
31 cnh 1.1
32 cnh 1.12 C !INPUT/OUTPUT PARAMETERS:
33 cnh 1.1 INTEGER myThid
34 edhill 1.18 CEOP
35 cnh 1.1
36 jmc 1.26 C === Functions ====
37     LOGICAL MASTER_CPU_IO
38     EXTERNAL MASTER_CPU_IO
39    
40 cnh 1.12 C !LOCAL VARIABLES:
41 jmc 1.23 C bi,bj :: Tile Indices counters
42     C i, j :: Loop counters
43     C facGrid :: Factor for grid to meter conversion
44     INTEGER bi,bj
45     INTEGER i, j
46 cnh 1.1 _RL facGrid
47 jmc 1.27 #ifndef OLD_GRID_IO
48     INTEGER myTile, iG, iLen
49     CHARACTER*(MAX_LEN_FNAM) fName
50     CHARACTER*(MAX_LEN_MBUF) msgBuf
51     INTEGER ILNBLNK
52     EXTERNAL ILNBLNK
53     #endif
54    
55 cnh 1.1
56 edhill 1.18 C Initialise coriolis parameter
57 cnh 1.3 IF ( useConstantF ) THEN
58 edhill 1.18 C Constant F case
59     DO bj = myByLo(myThid), myByHi(myThid)
60     DO bi = myBxLo(myThid), myBxHi(myThid)
61 jmc 1.23 DO j=1-Oly,sNy+Oly
62     DO i=1-Olx,sNx+Olx
63     fCori(i,j,bi,bj) = f0
64     fCoriG(i,j,bi,bj) = f0
65     fCoriCos(i,j,bi,bj)=0. _d 0
66 edhill 1.18 ENDDO
67 jmc 1.23 ENDDO
68 cnh 1.1 ENDDO
69     ENDDO
70 cnh 1.3 ELSEIF ( useBetaPlaneF ) THEN
71 edhill 1.18 C Beta plane case
72     facGrid = 1. _d 0
73 jmc 1.23 IF ( usingSphericalPolarGrid
74     & .OR. usingCurvilinearGrid ) facGrid = deg2rad*rSphere
75 edhill 1.18 DO bj = myByLo(myThid), myByHi(myThid)
76     DO bi = myBxLo(myThid), myBxHi(myThid)
77 jmc 1.23 DO j=1-Oly,sNy+Oly
78     DO i=1-Olx,sNx+Olx
79     fCori(i,j,bi,bj) = f0+beta*_yC(i,j,bi,bj)*facGrid
80     fCoriG(i,j,bi,bj) = f0+beta* yG(i,j,bi,bj)*facGrid
81     fCoriCos(i,j,bi,bj)=0. _d 0
82 edhill 1.18 ENDDO
83 jmc 1.23 ENDDO
84 cnh 1.3 ENDDO
85     ENDDO
86     ELSEIF ( useSphereF ) THEN
87 edhill 1.18 C Spherical case
88     C Note in this case we assume yC is in degrees.
89     DO bj = myByLo(myThid), myByHi(myThid)
90     DO bi = myBxLo(myThid), myBxHi(myThid)
91 jmc 1.23 DO j=1-Oly,sNy+Oly
92     DO i=1-Olx,sNx+Olx
93     fCori(i,j,bi,bj) =
94 edhill 1.18 & 2. _d 0*omega*sin(_yC(i,j,bi,bj)*deg2rad)
95 jmc 1.23 fCoriG(i,j,bi,bj) =
96 edhill 1.18 & 2. _d 0*omega*sin(yG(i,j,bi,bj)*deg2rad)
97 jmc 1.23 fCoriCos(i,j,bi,bj)=
98 edhill 1.18 & 2. _d 0*omega*cos(_yC(i,j,bi,bj)*deg2rad)
99     ENDDO
100 jmc 1.23 ENDDO
101 cnh 1.3 ENDDO
102     ENDDO
103 jmc 1.21 c CALL WRITE_FLD_XY_RL('fCoriC',' ',fCori , 0,myThid)
104     c CALL WRITE_FLD_XY_RL('fCoriG',' ',fCoriG , 0,myThid)
105     c CALL WRITE_FLD_XY_RL('fCorCs',' ',fCoriCos,0,myThid)
106 cnh 1.3 ELSE
107 edhill 1.18 C Special custom form
108     DO bj = myByLo(myThid), myByHi(myThid)
109     DO bi = myBxLo(myThid), myBxHi(myThid)
110 jmc 1.23 DO j=1-Oly,sNy+Oly
111     DO i=1-Olx,sNx+Olx
112     fCori(i,j,bi,bj) = 0. _d 0
113     fCoriG(i,j,bi,bj) = 0. _d 0
114     fCoriCos(i,j,bi,bj)=0. _d 0
115 edhill 1.18 ENDDO
116 jmc 1.23 ENDDO
117 cnh 1.3 ENDDO
118     ENDDO
119 jmc 1.21 CALL READ_REC_XY_RS( 'fCoriC.bin', fCori, 1, 0, myThid )
120     CALL READ_REC_XY_RS( 'fCorCs.bin', fCoriCos,1, 0, myThid )
121 jmc 1.27 IF ( .NOT.useCubedSphereExchange ) THEN
122     CALL READ_REC_XY_RS('fCoriG.bin', fCoriG, 1, 0, myThid )
123     ELSE
124     #ifdef OLD_GRID_IO
125     CALL READ_REC_XY_RS('fCoriG.bin', fCoriG, 1, 0, myThid )
126 jmc 1.21 C- deal with the 2 missing corners (for fCoriG):
127     DO bj = myByLo(myThid), myByHi(myThid)
128     DO bi = myBxLo(myThid), myBxHi(myThid)
129     C- Notes: this will only works with 6 tiles (1 per face) and
130     C with 2 polar faces + 4 equatorials:
131     IF (bi.LE.3 .OR. bi.GE.5) THEN
132     fCoriG(sNx+1,1,bi,bj) = fCoriG(1,1,bi,bj)
133     ELSE
134     fCoriG(sNx+1,1,bi,bj) = -fCoriG(1,1,bi,bj)
135     ENDIF
136     IF (bi.GE.3) THEN
137     fCoriG(1,sNy+1,bi,bj) = fCoriG(1,1,bi,bj)
138     fCoriG(sNx+1,sNy+1,bi,bj) = fCoriG(sNx+1,1,bi,bj)
139     ELSE
140     fCoriG(1,sNy+1,bi,bj) = -fCoriG(1,1,bi,bj)
141     fCoriG(sNx+1,sNy+1,bi,bj) = -fCoriG(sNx+1,1,bi,bj)
142     ENDIF
143     ENDDO
144     ENDDO
145 jmc 1.27 #else /* OLD_GRID_IO */
146     _BEGIN_MASTER(myThid)
147     DO bj = 1,nSy
148     DO bi = 1,nSx
149     iG = bi+(myXGlobalLo-1)/sNx
150     myTile = iG
151     #ifdef ALLOW_EXCH2
152 jmc 1.30 myTile = W2_myTileList(bi,bj)
153 jmc 1.27 iG = exch2_myface(myTile)
154     #endif
155     WRITE(fName,'(2A,I3.3,A)') 'fCoriG','.face',iG,'.bin'
156     iLen = ILNBLNK(fName)
157     WRITE(msgBuf,'(A,I6,2A)')
158     & ' Reading tile:', myTile, ' from file ', fName(1:iLen)
159     CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
160     & SQUEEZE_RIGHT , myThid )
161     #ifdef ALLOW_MDSIO
162     CALL MDS_FACEF_READ_RS( fName, readBinaryPrec, 1,
163     & fCoriG, bi, bj, myThid )
164     #else /* ALLOW_MDSIO */
165     WRITE(msgBuf,'(A)') 'INI_CORI: Needs to compile MDSIO pkg'
166     CALL PRINT_ERROR( msgBuf, myThid )
167     STOP 'ABNORMAL END: S/R INI_CORI'
168     #endif /* ALLOW_MDSIO */
169    
170     ENDDO
171     ENDDO
172     _END_MASTER(myThid)
173     #endif /* OLD_GRID_IO */
174 jmc 1.21 ENDIF
175    
176 jmc 1.24 CALL EXCH_XY_RS( fCori, myThid )
177     CALL EXCH_XY_RS( fCoriCos, myThid )
178     CALL EXCH_Z_3D_RS( fCoriG, 1, myThid )
179 cnh 1.3 ENDIF
180 adcroft 1.11
181 edhill 1.16 #ifdef ALLOW_MONITOR
182 jmc 1.26 IF ( MASTER_CPU_IO(myThid) ) THEN
183 jmc 1.23 C-- only the master thread is allowed to switch On/Off mon_write_stdout
184 jmc 1.31 C & mon_write_mnc (since it is the only thread that uses those flags):
185 jmc 1.23
186     IF (monitor_stdio) THEN
187     mon_write_stdout = .TRUE.
188     ELSE
189     mon_write_stdout = .FALSE.
190     ENDIF
191     mon_write_mnc = .FALSE.
192 edhill 1.18 #ifdef ALLOW_MNC
193 jmc 1.23 IF (useMNC .AND. monitor_mnc) THEN
194     DO i = 1,MAX_LEN_MBUF
195     mon_fname(i:i) = ' '
196     ENDDO
197     mon_fname(1:12) = 'monitor_grid'
198     CALL MNC_CW_SET_UDIM(mon_fname, 1, myThid)
199     mon_write_mnc = .TRUE.
200     ENDIF
201     #endif /* ALLOW_MNC */
202    
203 edhill 1.18 ENDIF
204 jmc 1.23
205 adcroft 1.11 CALL MON_PRINTSTATS_RS(1,fCori,'fCori',myThid)
206     CALL MON_PRINTSTATS_RS(1,fCoriG,'fCoriG',myThid)
207 adcroft 1.15 CALL MON_PRINTSTATS_RS(1,fCoriCos,'fCoriCos',myThid)
208 edhill 1.18
209 jmc 1.26 IF ( MASTER_CPU_IO(myThid) ) THEN
210 jmc 1.23 mon_write_stdout = .FALSE.
211     mon_write_mnc = .FALSE.
212     ENDIF
213     #endif /* ALLOW_MONITOR */
214 cnh 1.1
215     RETURN
216     END

  ViewVC Help
Powered by ViewVC 1.1.22