/[MITgcm]/MITgcm/pkg/obcs/obcs_readparms.F
ViewVC logotype

Diff of /MITgcm/pkg/obcs/obcs_readparms.F

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

revision 1.9 by heimbach, Wed Sep 22 20:44:37 2004 UTC revision 1.22 by mlosch, Fri Apr 25 12:13:38 2008 UTC
# Line 19  C     === Global variables === Line 19  C     === Global variables ===
19  #ifdef ALLOW_ORLANSKI  #ifdef ALLOW_ORLANSKI
20  #include "ORLANSKI.h"  #include "ORLANSKI.h"
21  #endif  #endif
22    #ifdef ALLOW_PTRACERS
23    #include "PTRACERS_SIZE.h"
24    #include "OBCS_PTRACERS.h"
25    #endif /* ALLOW_PTRACERS */
26    
27  C     === Routine arguments ===  C     === Routine arguments ===
28        INTEGER myThid        INTEGER myThid
29    
30  #ifdef ALLOW_OBCS  #ifdef ALLOW_OBCS
31    
32    C     === Local variables ===
33    C     msgBuf      - Informational/error meesage buffer
34    C     iUnit       - Work variable for IO unit number
35          CHARACTER*(MAX_LEN_MBUF) msgBuf
36          INTEGER iUnit
37          INTEGER I,J,iTracer
38          INTEGER bi, bj, iG, jG, iGm, jGm
39    
40        NAMELIST /OBCS_PARM01/        NAMELIST /OBCS_PARM01/
41       &          OB_Jnorth,OB_Jsouth,OB_Ieast,OB_Iwest,       &          OB_Jnorth,OB_Jsouth,OB_Ieast,OB_Iwest,
42       &          useOrlanskiNorth,useOrlanskiSouth,       &          useOrlanskiNorth,useOrlanskiSouth,
43       &          useOrlanskiEast,useOrlanskiWest,       &          useOrlanskiEast,useOrlanskiWest,
44       &          OBNuFile,OBNvFile,OBNtFile,OBNsFile,       &          OBNuFile,OBNvFile,OBNtFile,OBNsFile,OBNaFile,OBNhFile,
45       &          OBSuFile,OBSvFile,OBStFile,OBSsFile,       &          OBSuFile,OBSvFile,OBStFile,OBSsFile,OBSaFile,OBShFile,
46       &          OBEuFile,OBEvFile,OBEtFile,OBEsFile,       &          OBEuFile,OBEvFile,OBEtFile,OBEsFile,OBEaFile,OBEhFile,
47       &          OBWuFile,OBWvFile,OBWtFile,OBWsFile,       &          OBWuFile,OBWvFile,OBWtFile,OBWsFile,OBWaFile,OBWhFile,
48       &          useOBCSsponge, useOBCSbalance, useOBCSprescribe       &          OBNslFile,OBSslFile,OBEslFile,OBWslFile,
49         &          OBNsnFile,OBSsnFile,OBEsnFile,OBWsnFile,
50         &          OBNuiceFile,OBSuiceFile,OBEuiceFile,OBWuiceFile,
51         &          OBNviceFile,OBSviceFile,OBEviceFile,OBWviceFile,
52         &          useOBCSsponge, useOBCSbalance, useOBCSprescribe,
53         &          OBCSprintDiags, useOBCSYearlyFields, OBCSfixTopo
54    #ifdef ALLOW_PTRACERS
55         &        , OBNptrFile,OBSptrFile,OBEptrFile,OBWptrFile
56    #endif
57    
58  #ifdef ALLOW_ORLANSKI  #ifdef ALLOW_ORLANSKI
59        NAMELIST /OBCS_PARM02/        NAMELIST /OBCS_PARM02/
# Line 47  C     === Routine arguments === Line 67  C     === Routine arguments ===
67       &          spongeThickness       &          spongeThickness
68  #endif  #endif
69    
70  C     === Local variables ===        _BEGIN_MASTER(myThid)
 C     msgBuf      - Informational/error meesage buffer  
 C     iUnit       - Work variable for IO unit number  
       CHARACTER*(MAX_LEN_MBUF) msgBuf  
       INTEGER iUnit  
       INTEGER I,J  
71    
72  C--   OBCS_READPARMS has been called so we know that  C--   OBCS_READPARMS has been called so we know that
73  C     the package is active.  C     the package is active.
74        OBCSIsOn=.TRUE.        OBCSIsOn=.TRUE.
75    
76        _BEGIN_MASTER(myThid)        IF ( debugLevel .GE. debLevB ) THEN
77           WRITE(msgBuf,'(A)') ' OBCS_READPARMS: opening data.obcs'
78        WRITE(msgBuf,'(A)') ' OBCS_READPARMS: opening data.obcs'         CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
79        CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,       &      SQUEEZE_RIGHT , 1)
80       &                    SQUEEZE_RIGHT , 1)        ENDIF
81    
82        CALL OPEN_COPY_DATA_FILE(        CALL OPEN_COPY_DATA_FILE(
83       I                          'data.obcs', 'OBCS_READPARMS',       I                          'data.obcs', 'OBCS_READPARMS',
# Line 78  C--   Default flags and values for OBCS Line 93  C--   Default flags and values for OBCS
93         OB_Ieast(J)=0         OB_Ieast(J)=0
94         OB_Iwest(J)=0         OB_Iwest(J)=0
95        ENDDO        ENDDO
96        useOrlanskiNorth=.FALSE.        useOrlanskiNorth   =.FALSE.
97        useOrlanskiSouth=.FALSE.        useOrlanskiSouth   =.FALSE.
98        useOrlanskiEast =.FALSE.        useOrlanskiEast    =.FALSE.
99        useOrlanskiWest =.FALSE.        useOrlanskiWest    =.FALSE.
100        useOBCSsponge   =.FALSE.        useOBCSsponge      =.FALSE.
101        useOBCSbalance  =.FALSE.        useOBCSbalance     =.FALSE.
102        useOBCSprescribe = .FALSE.        useOBCSprescribe   =.FALSE.
103          OBCSprintDiags     =.TRUE.
104          useOBCSYearlyFields=.FALSE.
105          OBCSfixTopo        =.TRUE.
106    
107        OBNuFile = ' '        OBNuFile = ' '
108        OBNvFile = ' '        OBNvFile = ' '
109        OBNtFile = ' '        OBNtFile = ' '
110        OBNsFile = ' '        OBNsFile = ' '
111          OBNaFile = ' '
112          OBNslFile = ' '
113          OBNsnFile = ' '
114          OBNuiceFile = ' '
115          OBNviceFile = ' '
116          OBNhFile = ' '
117        OBSuFile = ' '        OBSuFile = ' '
118        OBSvFile = ' '        OBSvFile = ' '
119        OBStFile = ' '        OBStFile = ' '
120        OBSsFile = ' '        OBSsFile = ' '
121          OBSaFile = ' '
122          OBShFile = ' '
123          OBSslFile = ' '
124          OBSsnFile = ' '
125          OBSuiceFile = ' '
126          OBSviceFile = ' '
127        OBEuFile = ' '        OBEuFile = ' '
128        OBEvFile = ' '        OBEvFile = ' '
129        OBEtFile = ' '        OBEtFile = ' '
130        OBEsFile = ' '        OBEsFile = ' '
131          OBEaFile = ' '
132          OBEhFile = ' '
133          OBEslFile = ' '
134          OBEsnFile = ' '
135          OBEuiceFile = ' '
136          OBEviceFile = ' '
137        OBWuFile = ' '        OBWuFile = ' '
138        OBWvFile = ' '        OBWvFile = ' '
139        OBWtFile = ' '        OBWtFile = ' '
140        OBWsFile = ' '        OBWsFile = ' '
141          OBWaFile = ' '
142          OBWhFile = ' '
143          OBWslFile = ' '
144          OBWsnFile = ' '
145          OBWuiceFile = ' '
146          OBWviceFile = ' '
147    #ifdef ALLOW_PTRACERS
148          DO iTracer = 1, PTRACERS_num
149           OBNptrFile(iTracer) = ' '
150           OBSptrFile(iTracer) = ' '
151           OBEptrFile(iTracer) = ' '
152           OBWptrFile(iTracer) = ' '
153          ENDDO
154    #endif
155    
156  C--   Read parameters from open data file  C--   Read parameters from open data file
157        READ(UNIT=iUnit,NML=OBCS_PARM01)        READ(UNIT=iUnit,NML=OBCS_PARM01)
# Line 113  C     Account for periodicity if negativ Line 163  C     Account for periodicity if negativ
163        DO I=1,Nx        DO I=1,Nx
164         IF (OB_Jnorth(I).lt.0) OB_Jnorth(I)=OB_Jnorth(I)+Ny+1         IF (OB_Jnorth(I).lt.0) OB_Jnorth(I)=OB_Jnorth(I)+Ny+1
165        ENDDO        ENDDO
166        write(*,*) 'OB Jn =',OB_Jnorth        IF ( debugLevel .GE. debLevB ) THEN
167        write(*,*) 'OB Js =',OB_Jsouth         write(*,*) 'OB Jn =',OB_Jnorth
168        write(*,*) 'OB Ie =',OB_Ieast         write(*,*) 'OB Js =',OB_Jsouth
169        write(*,*) 'OB Iw =',OB_Iwest         write(*,*) 'OB Ie =',OB_Ieast
170           write(*,*) 'OB Iw =',OB_Iwest
171          ENDIF
172    
173  #ifdef ALLOW_ORLANSKI  #ifdef ALLOW_ORLANSKI
174  C     Default Orlanski radiation parameters  C     Default Orlanski radiation parameters
# Line 128  C     Default Orlanski radiation paramet Line 180  C     Default Orlanski radiation paramet
180        IF (useOrlanskiNorth.OR.        IF (useOrlanskiNorth.OR.
181       &    useOrlanskiSouth.OR.       &    useOrlanskiSouth.OR.
182       &    useOrlanskiEast.OR.       &    useOrlanskiEast.OR.
183       &    useOrlanskiWest)       &    useOrlanskiWest)
184       & READ(UNIT=iUnit,NML=OBCS_PARM02)       & READ(UNIT=iUnit,NML=OBCS_PARM02)
185  #endif  #endif
186          
187  #ifdef ALLOW_OBCS_SPONGE  #ifdef ALLOW_OBCS_SPONGE
188  C     Default sponge layer parameters  C     Default sponge layer parameters:
189        spongeThickness = 2  C     sponge layer is turned off by default
190        Urelaxobcsinner = 5. _d 0        spongeThickness = 0
191        Urelaxobcsbound = 1. _d 0        Urelaxobcsinner = 0. _d 0
192        Vrelaxobcsinner = 5. _d 0        Urelaxobcsbound = 0. _d 0
193        Vrelaxobcsbound = 1. _d 0        Vrelaxobcsinner = 0. _d 0
194          Vrelaxobcsbound = 0. _d 0
195    CML this was the previous default in units of days
196    CML      spongeThickness = 2
197    CML      Urelaxobcsinner = 5. _d 0
198    CML      Urelaxobcsbound = 1. _d 0
199    CML      Vrelaxobcsinner = 5. _d 0
200    CML      Vrelaxobcsbound = 1. _d 0
201        IF (useOBCSsponge)        IF (useOBCSsponge)
202       & READ(UNIT=iUnit,NML=OBCS_PARM03)       & READ(UNIT=iUnit,NML=OBCS_PARM03)
203  #endif  #endif
204    
205        WRITE(msgBuf,'(A)') ' OBCS_READPARMS: finished reading data.obcs'        IF ( debugLevel .GE. debLevB ) THEN
206        CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,         WRITE(msgBuf,'(A)') ' OBCS_READPARMS: finished reading data.obcs'
207       &                    SQUEEZE_RIGHT , 1)         CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
208         &      SQUEEZE_RIGHT , 1)
209          ENDIF
210    
211  C--   Close the open data file  C--   Close the open data file
212        CLOSE(iUnit)        CLOSE(iUnit)
# Line 154  C--   Close the open data file Line 215  C--   Close the open data file
215  C--   Everyone else must wait for the parameters to be loaded  C--   Everyone else must wait for the parameters to be loaded
216        _BARRIER        _BARRIER
217    
218    C--   Calculate the tiled index arrays OB_Jn/Js/Ie/Iw here from the
219    C     global arrays OB_Jnorth/Jsouth/Ieast/Iwest.
220    C     Note: This part of the code has been moved from obcs_init_fixed to
221    C     routine routine because the OB_Jn/Js/Ie/Iw index arrays are
222    C     required by ini_depth which is called befoer obcs_init_fixed
223          DO bj = myByLo(myThid), myByHi(myThid)
224           DO bi = myBxLo(myThid), myBxHi(myThid)
225    
226            DO I=1-Olx,sNx+Olx
227             OB_Jn(I,bi,bj)=0
228             OB_Js(I,bi,bj)=0
229            ENDDO
230    
231            DO J=1-Oly,sNy+Oly
232             OB_Ie(J,bi,bj)=0
233             OB_Iw(J,bi,bj)=0
234            ENDDO
235    
236            DO J=1-Oly,sNy+Oly
237    C convert from local y index J to global y index jG
238             jG = myYGlobalLo-1+(bj-1)*sNy+J
239    C use periodicity to deal with out of range points caused by the overlaps.
240    C they will be excluded by the mask in any case, but this saves array
241    C out-of-bounds errors here.
242             jGm = 1+mod( jG-1+Ny , Ny )
243    C loop over local x index I
244             DO I=1,sNx
245              iG = myXGlobalLo-1+(bi-1)*sNx+I
246              iGm = 1+mod( iG-1+Nx , Nx )
247    C OB_Ieast(jGm) allows for the eastern boundary to be at variable x locations
248              IF (iG.EQ.OB_Ieast(jGm))  OB_Ie(J,bi,bj)=I
249              IF (iG.EQ.OB_Iwest(jGm))  OB_Iw(J,bi,bj)=I
250             ENDDO
251            ENDDO
252            DO J=1,sNy
253             jG = myYGlobalLo-1+(bj-1)*sNy+J
254             jGm = 1+mod( jG-1+Ny , Ny )
255             DO I=1-Olx,sNx+Olx
256              iG = myXGlobalLo-1+(bi-1)*sNx+I
257              iGm = 1+mod( iG-1+Nx , Nx )
258    C OB_Jnorth(iGm) allows for the northern boundary to be at variable y locations
259              IF (jG.EQ.OB_Jnorth(iGm)) OB_Jn(I,bi,bj)=J
260              IF (jG.EQ.OB_Jsouth(iGm)) OB_Js(I,bi,bj)=J
261             ENDDO
262            ENDDO
263    C     bi,bj-loops
264           ENDDO
265          ENDDO
266    
267  #endif /* ALLOW_OBCS */  #endif /* ALLOW_OBCS */
268        RETURN        RETURN
269        END        END

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.22

  ViewVC Help
Powered by ViewVC 1.1.22