/[MITgcm]/MITgcm_contrib/eh3_spgr/hs94.cs-32x32x5/code_v2/w2_write_atopo.F
ViewVC logotype

Annotation of /MITgcm_contrib/eh3_spgr/hs94.cs-32x32x5/code_v2/w2_write_atopo.F

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


Revision 1.1 - (hide annotations) (download)
Sat Sep 24 19:38:18 2005 UTC (19 years, 10 months ago) by edhill
Branch: MAIN
 o write out topology as versioned ASCII

1 edhill 1.1 C $Header: $
2     C $Name: $
3    
4     #include "PACKAGES_CONFIG.h"
5     #include "CPP_EEOPTIONS.h"
6    
7     C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
8     CBOP
9     C !ROUTINE: W2_WRITE_ATOPO
10    
11     C !INTERFACE:
12     SUBROUTINE W2_WRITE_ATOPO
13    
14     C !DESCRIPTION:
15     C Write in the EXCH2 tile topology information to a "flat" ascii
16     C text file compatible with the format used by W2_READ_ATOPO
17    
18     C !USES:
19     IMPLICIT NONE
20     #include "SIZE.h"
21     #include "EEPARAMS.h"
22     #include "EESUPPORT.h"
23     #include "W2_EXCH2_TOPOLOGY.h"
24     #include "W2_EXCH2_PARAMS.h"
25     INTEGER IFNBLNK
26     EXTERNAL IFNBLNK
27     INTEGER ILNBLNK
28     EXTERNAL ILNBLNK
29     CEOP
30    
31     C !LOCAL VARIABLES:
32     C iUnit :: Work variable for IO unit number
33     C errIO :: IO unit error flag
34     C IL :: Temp. for index strings
35     C msgBuf :: Temp. for textual I/O
36     C line :: Temp. for textual I/O
37     INTEGER IL, errIO, iUnit
38     CHARACTER*(MAX_LEN_MBUF) msgBuf
39     INTEGER ii, jj, k, nneigh
40    
41    
42     IL = ILNBLNK(W2_ATOPO_ONAME)
43     iUnit = eeDataUnit
44     OPEN(UNIT=iUnit,FILE=W2_ATOPO_ONAME(1:IL),
45     & status='unknown',err=100,IOSTAT=errIO)
46     IF ( errIO .GE. 0 ) GOTO 200
47     100 CONTINUE
48     WRITE(msgBuf,'(A)')
49     & 'S/R W2_WRITE_ATOPO'
50     CALL PRINT_ERROR( msgBuf , 1)
51     WRITE(msgBuf,'(3A)')
52     & 'Unable to open file "',W2_ATOPO_FNAME(1:IL),'"'
53     CALL PRINT_ERROR( msgBuf , 1)
54     STOP 'ABNORMAL END: S/R W2_WRITE_ATOPO'
55    
56     200 CONTINUE
57    
58     300 FORMAT(10i12)
59     C The above format is not an efficient way to pack the topology
60     C data. But it does NOT matter! Considering a system with 10,000
61     C tiles (one full order of magnitude larger than any MITgcm run
62     C performed up and including to 2005) and the file size is still
63     C less than 7MB:
64     C
65     C (10000 tiles) * (~4000 bytes / 6 tiles) = 6.4 MB
66    
67     C Write the topo-file version string :
68     C = 0 0
69     C = 123456789 123456789
70     C = EXCH2TOPO ver 001
71     C = ===
72    
73     C VERSION : "001"
74     WRITE(iUnit,'(a)') '#'
75     WRITE(iUnit,'(a)') '# MODEL GENERATED'
76     WRITE(iUnit,'(a)') '#'
77     WRITE(iUnit,'(a)') 'EXCH2TOPO ver 001'
78    
79     WRITE(iUnit,300) NTILES
80     DO k = 1,NTILES
81    
82     WRITE(iUnit,300) k
83     C exch2_myFace = 1 ;
84     C exch2_isNedge = 1 ;
85     C exch2_isSedge = 1 ;
86     C exch2_isEedge = 1 ;
87     C exch2_isWedge = 1 ;
88     WRITE(iUnit,300) exch2_myFace(k),
89     & exch2_isNedge(k), exch2_isSedge(k),
90     & exch2_isEedge(k), exch2_isWedge(k)
91     C exch2_txglobalo = 1 ;
92     C exch2_tyglobalo = 1 ;
93     C exch2_tbasex = 0 ;
94     C exch2_tbasey = 0 ;
95     C exch2_nNeighbours = 4 ;
96     WRITE(iUnit,300)
97     & exch2_txglobalo(k), exch2_tyglobalo(k),
98     & exch2_tbasex(k), exch2_tbasey(k),
99     & exch2_nNeighbours(k)
100     nneigh = exch2_nNeighbours(k)
101     C exch2_neighbourId = 3, 6, 2, 5 ;
102     WRITE(iUnit,300)
103     & (exch2_neighbourId(ii,k), ii=1,nneigh)
104     C exch2_pi = 0, -1, 1, 0, 1, 0, 0, 1 ;
105     WRITE(iUnit,300)
106     & ((exch2_pi(jj,ii,k), jj=1,2), ii=1,nneigh)
107     C exch2_pj = 1, 0, 0, 1, 0, 1, -1, 0 ;
108     WRITE(iUnit,300)
109     & ((exch2_pj(jj,ii,k), jj=1,2), ii=1,nneigh)
110     C exch2_oi = 33, 0, 32, -32 ;
111     WRITE(iUnit,300)
112     & (exch2_oi(ii,k), ii=1,nneigh)
113     C exch2_oj = 32, -32, 0, 33 ;
114     WRITE(iUnit,300)
115     & (exch2_oj(ii,k), ii=1,nneigh)
116     C exch2_oi_f = 34, 0, 32, -32 ;
117     WRITE(iUnit,300)
118     & (exch2_oi_f(ii,k), ii=1,nneigh)
119     C exch2_oj_f = 32, -32, 0, 34 ;
120     WRITE(iUnit,300)
121     & (exch2_oj_f(ii,k), ii=1,nneigh)
122    
123     ENDDO
124    
125     CLOSE(iUnit)
126    
127     RETURN
128     END

  ViewVC Help
Powered by ViewVC 1.1.22