/[MITgcm]/MITgcm/pkg/exch2/w2_set_gen_facets.F
ViewVC logotype

Contents of /MITgcm/pkg/exch2/w2_set_gen_facets.F

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


Revision 1.3 - (show annotations) (download)
Thu Oct 14 17:34:35 2010 UTC (13 years, 6 months ago) by jahn
Branch: MAIN
CVS Tags: checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint64a, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64g, checkpoint64f, checkpoint63p, checkpoint63q, checkpoint63r, checkpoint63s, checkpoint63l, checkpoint63m, checkpoint63n, checkpoint63o, checkpoint63h, checkpoint63i, checkpoint63j, checkpoint63k, checkpoint63d, checkpoint63e, checkpoint63f, checkpoint63g, checkpoint63a, checkpoint63b, checkpoint63c, checkpoint64, checkpoint65, checkpoint63, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65o, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62s, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint62w, checkpoint62v, checkpoint62u, checkpoint62t, checkpoint62z, checkpoint62y, checkpoint62x, HEAD
Changes since 1.2: +18 -17 lines
allow for empty facets (useful for partial cubed-sphere setup)

1 C $Header: /u/gcmpack/MITgcm/pkg/exch2/w2_set_gen_facets.F,v 1.2 2010/04/23 20:21:06 jmc Exp $
2 C $Name: $
3
4 #include "CPP_EEOPTIONS.h"
5 #include "W2_OPTIONS.h"
6
7 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
8 CBOP 0
9 C !ROUTINE: W2_SET_GEN_FACETS( myThid )
10
11 C !INTERFACE:
12 SUBROUTINE W2_SET_GEN_FACETS( myThid )
13
14 C !DESCRIPTION:
15 C Set-up multi-facets (=sub-domain) topology : general case
16 C process topology information from "data.exch2" (facet_dims,facet_link)
17
18 C !USES:
19 IMPLICIT NONE
20
21 C Tile topology settings data structures
22 #include "SIZE.h"
23 #include "EEPARAMS.h"
24 #include "W2_EXCH2_SIZE.h"
25 #include "W2_EXCH2_PARAMS.h"
26 #include "W2_EXCH2_TOPOLOGY.h"
27
28 C !INPUT PARAMETERS:
29 C myThid :: my Thread Id number
30 C (Note: not relevant since threading has not yet started)
31 INTEGER myThid
32
33 C !LOCAL VARIABLES:
34 C === Local variables ===
35 C msgBuf :: Informational/error message buffer
36 CHARACTER*(MAX_LEN_MBUF) msgBuf
37 CHARACTER*1 edge(4)
38 INTEGER i,j,jj,fNx,fNy
39 INTEGER errCnt
40 CEOP
41 DATA edge / 'N' , 'S' , 'E' , 'W' /
42
43 WRITE(msgBuf,'(2A,I3,A)') 'W2_SET_GEN_FACETS:',
44 & ' preDefTopol=', preDefTopol, ' selected'
45 CALL PRINT_MESSAGE( msgBuf, W2_oUnit,SQUEEZE_RIGHT,myThid )
46
47 C count Nb of Facets (from facet_dims) ; set nFacets
48 C Assume: consecutive pair (x-dim,y-dim) of non-zero dimension
49 errCnt = 0
50 nFacets = 0
51 C find last pair of non-zero dims
52 DO j=1,W2_maxNbFacets
53 fNx = facet_dims(2*j-1)
54 fNy = facet_dims( 2*j )
55 C IF ( nFacets.EQ.0 .AND. fNx*fNy.EQ.0 ) THEN
56 IF ( fNx.NE.0 .AND. fNy.NE.0 ) THEN
57 nFacets = j
58 ELSEIF ( fNx.NE.0 .OR. fNy.NE.0 ) THEN
59 errCnt = errCnt + 1
60 WRITE(msgBuf,'(A,I3,A,2I6)')
61 & 'dimsFacets: Expect pair of >0 dims : facet',j,
62 & ' :',fNx,fNy
63 CALL PRINT_ERROR( msgBuf, myThid )
64 ENDIF
65 ENDDO
66 IF ( nFacets.EQ.0 ) THEN
67 errCnt = errCnt + 1
68 WRITE(msgBuf,'(A)')
69 & 'dimsFacets: All dimensions are zero!'
70 CALL PRINT_ERROR( msgBuf, myThid )
71 ENDIF
72 IF ( errCnt.GT.0 ) THEN
73 WRITE(msgBuf,'(A,I3,A)') 'W2_SET_GEN_FACETS: found', errCnt,
74 & ' errors in dimsFacets list'
75 CALL PRINT_ERROR( msgBuf, myThid )
76 STOP 'ABNORMAL END: W2_SET_GEN_FACETS (dimsFacets list)'
77 ENDIF
78
79 C- print out Nb of facets:
80 WRITE(msgBuf,'(A,I3,A)')
81 & 'W2_SET_GEN_FACETS: Number of facets =', nFacets,
82 & ' (inferred from "dimsFacets")'
83 CALL PRINT_MESSAGE( msgBuf, W2_oUnit, SQUEEZE_RIGHT, myThid )
84
85 C- Check remaining part of the list:
86 errCnt = 0
87 DO jj=2*nFacets+1,2*W2_maxNbFacets
88 IF ( facet_dims(jj).NE.0 ) THEN
89 errCnt = errCnt + 1
90 WRITE(msgBuf,'(A,I3,A,I5,A)') ' dimsFacets(j=',jj,') =',
91 & facet_dims(jj), ' : beyond end of list (=1rst zero)'
92 CALL PRINT_ERROR( msgBuf, myThid )
93 ENDIF
94 ENDDO
95 C- check sign
96 DO jj=1,2*nFacets
97 IF ( facet_dims(jj).LT.0 ) THEN
98 errCnt = errCnt + 1
99 i=1+MOD(jj-1,2)
100 j = (jj+1)/2
101 WRITE(msgBuf,'(A,I2,A,I3,A,I6,A)') 'dimension', i,
102 & ' of facet', j, ' =', facet_dims(jj), ' : invalid (< 0)'
103 CALL PRINT_ERROR( msgBuf, myThid )
104 ENDIF
105 ENDDO
106 IF ( errCnt.GT.0 ) THEN
107 WRITE(msgBuf,'(A,I3,A)') 'W2_SET_GEN_FACETS: found', errCnt,
108 & ' invalid dims'
109 CALL PRINT_ERROR( msgBuf, myThid )
110 STOP 'ABNORMAL END: W2_SET_GEN_FACETS (dimsFacets list)'
111 ENDIF
112
113 C check "facet_link" list:
114 errCnt = 0
115 DO j=nFacets+1,W2_maxNbFacets
116 DO i=1,4
117 IF ( facet_link(i,j).NE.0 ) THEN
118 errCnt = errCnt + 1
119 WRITE(msgBuf,'(3A,I3,A,F6.2,A)')
120 & 'Link for ',edge(i), '.Edge of facet #',j,
121 & ' (facetEdgeLink=',facet_link(i,j),')'
122 CALL PRINT_ERROR( msgBuf, myThid )
123 WRITE(msgBuf,'(A,I3,A)')
124 & ' is beyond range (> nFacets=',nFacets,')'
125 CALL PRINT_ERROR( msgBuf, myThid )
126 ENDIF
127 ENDDO
128 ENDDO
129 IF ( errCnt.GT.0 ) THEN
130 WRITE(msgBuf,'(A,I3,A)') 'W2_SET_GEN_FACETS: found', errCnt,
131 & ' errors in facetEdgeLink list'
132 CALL PRINT_ERROR( msgBuf, myThid )
133 STOP 'ABNORMAL END: W2_SET_GEN_FACETS (facetEdgeLink list)'
134 ENDIF
135
136 RETURN
137 END

  ViewVC Help
Powered by ViewVC 1.1.22