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

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

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


Revision 1.18 - (hide annotations) (download)
Mon Oct 24 18:16:07 2005 UTC (18 years, 7 months ago) by jmc
Branch: MAIN
Changes since 1.17: +37 -27 lines
consolidate the previous modif using writegrid_mnc flag.

1 jmc 1.18 C $Header: /u/gcmpack/MITgcm/model/src/write_grid.F,v 1.17 2005/10/20 20:23:15 edhill Exp $
2 edhill 1.2 C $Name: $
3 adcroft 1.1
4     #include "PACKAGES_CONFIG.h"
5     #include "CPP_OPTIONS.h"
6    
7     C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
8     CBOP
9     C !ROUTINE: WRITE_GRID
10     C !INTERFACE:
11     SUBROUTINE WRITE_GRID(
12     I myThid )
13    
14 edhill 1.2 C !DESCRIPTION:
15     C Writes the model geometry and grid arrays to file(s) using which
16     C ever I/O package is available/active. This includes horizontal
17     C and vertical grid and finite volume modulating factors (hFacs).
18     C Essentailly, it dumps the contents of GRID.h to disk.
19 adcroft 1.1
20     C !CALLING SEQUENCE:
21     C INITIALIZE_FIXED
22     C |
23     C |-- WRITE_GRID
24    
25     IMPLICIT NONE
26     #include "SIZE.h"
27     #include "EEPARAMS.h"
28     #include "PARAMS.h"
29 edhill 1.6 #ifdef ALLOW_MNC
30     #include "MNC_PARAMS.h"
31     #endif
32 adcroft 1.1 #include "GRID.h"
33    
34     C !INPUT/OUTPUT PARAMETERS:
35     C myThid - Number of this instances
36     INTEGER myThid
37    
38     C !LOCAL VARIABLES:
39     C tmpfld - Temporary array used to compute & write Total Depth
40     C has to be in common for multi threading
41     C ?aja: not sure why the COMMON block is necessary - should ask JMC?
42 jmc 1.10 c COMMON / LOCAL_INI_MASKS_ETC / tmpfld
43 adcroft 1.1 _RS tmpfld(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
44     INTEGER i,j,bi,bj
45 jmc 1.18 LOGICAL writegrid_mdsio
46     #ifdef ALLOW_MNC
47     CHARACTER*(4) bfname
48     #endif
49 adcroft 1.1 CEOP
50    
51 edhill 1.2 C Calculate the fluid thickness in R coordinates as seen by the
52     C model. This may differ from what the user specified due to
53     C partial cells, etc.
54 adcroft 1.1 DO bj = myByLo(myThid), myByHi(myThid)
55 edhill 1.2 DO bi = myBxLo(myThid), myBxHi(myThid)
56     DO j=1-Oly,sNy+Oly
57     DO i=1-Olx,sNx+Olx
58     C Total fluid column thickness (r_unit) :
59     tmpfld(i,j,bi,bj) = Ro_surf(i,j,bi,bj) - R_low(i,j,bi,bj)
60     ENDDO
61     ENDDO
62 adcroft 1.1 ENDDO
63     ENDDO
64    
65 jmc 1.18 writegrid_mdsio = .TRUE.
66 edhill 1.17 #ifdef ALLOW_MNC
67 jmc 1.18 IF ( useMNC ) THEN
68     writegrid_mdsio = outputTypesInclusive .OR. .NOT.writegrid_mnc
69     ENDIF
70 edhill 1.17 #endif /* ALLOW_MNC */
71    
72 jmc 1.18 IF ( writegrid_mdsio ) THEN
73    
74     _BEGIN_MASTER( myThid )
75 edhill 1.2
76 edhill 1.8 C Write horizontal grid arrays
77 jmc 1.18 CALL WRITE_FLD_XY_RS( 'XC',' ',XC,0,myThid)
78     CALL WRITE_FLD_XY_RS( 'YC',' ',YC,0,myThid)
79     CALL WRITE_FLD_XY_RS( 'XG',' ',XG,0,myThid)
80     CALL WRITE_FLD_XY_RS( 'YG',' ',YG,0,myThid)
81     CALL WRITE_FLD_XY_RS( 'RAC',' ',rA,0,myThid)
82     CALL WRITE_FLD_XY_RS( 'RAW',' ',rAw,0,myThid)
83     CALL WRITE_FLD_XY_RS( 'RAS',' ',rAs,0,myThid)
84     CALL WRITE_FLD_XY_RS( 'RAZ',' ',rAz,0,myThid)
85     CALL WRITE_FLD_XY_RS( 'DXG',' ',DXG,0,myThid)
86     CALL WRITE_FLD_XY_RS( 'DYG',' ',DYG,0,myThid)
87     CALL WRITE_FLD_XY_RS( 'DXC',' ',DXC,0,myThid)
88     CALL WRITE_FLD_XY_RS( 'DYC',' ',DYC,0,myThid)
89     IF ( usingCurvilinearGrid ) THEN
90     CALL WRITE_FLD_XY_RS( 'AngleCS',' ',angleCosC,0,myThid)
91     CALL WRITE_FLD_XY_RS( 'AngleSN',' ',angleSinC,0,myThid)
92     ENDIF
93 edhill 1.8 C Write 3D geometry arrays
94 jmc 1.18 CALL WRITE_FLD_XY_RS( 'Depth',' ',tmpfld,0,myThid)
95     CALL WRITE_FLD_XYZ_RS( 'hFacC',' ',hFacC,0,myThid)
96     CALL WRITE_FLD_XYZ_RS( 'hFacW',' ',hFacW,0,myThid)
97     CALL WRITE_FLD_XYZ_RS( 'hFacS',' ',hFacS,0,myThid)
98     IF (buoyancyRelation .EQ. 'ATMOSPHERIC')
99 edhill 1.8 & CALL WRITE_FLD_XY_RS( 'topo_P',' ',Ro_surf,0,myThid)
100 edhill 1.2
101 jmc 1.18 _END_MASTER(myThid)
102    
103     ENDIF
104 adcroft 1.1
105     #ifdef ALLOW_MNC
106 jmc 1.18 IF ( useMNC .AND. writegrid_mnc ) THEN
107 edhill 1.17
108     _BEGIN_MASTER( myThid )
109 edhill 1.7 bfname='grid'
110 edhill 1.8
111 edhill 1.2 C Write the GRID.h variables to a file
112     CALL MNC_CW_SET_UDIM(bfname, 0, myThid)
113 edhill 1.15 CALL MNC_CW_SET_CITER(bfname, 2, -1, -1, -1, myThid)
114 edhill 1.16 CALL MNC_CW_SET_UDIM(bfname, 1, myThid)
115 edhill 1.2 CALL MNC_CW_RL_W('D',bfname,0,0,'RC',rC,myThid)
116     CALL MNC_CW_RL_W('D',bfname,0,0,'RF',rF,myThid)
117 edhill 1.11 CALL MNC_CW_RL_W('D',bfname,0,0,'RU',rF(2),myThid)
118     CALL MNC_CW_RL_W('D',bfname,0,0,'RL',rF,myThid)
119 edhill 1.2 CALL MNC_CW_RL_W('D',bfname,0,0,'drC',drC,myThid)
120     CALL MNC_CW_RL_W('D',bfname,0,0,'drF',drF,myThid)
121     CALL MNC_CW_RL_W('D',bfname,0,0,'XC',xC,myThid)
122     CALL MNC_CW_RL_W('D',bfname,0,0,'YC',yC,myThid)
123 jmc 1.10 c CALL MNC_CW_RL_W('D',bfname,0,0,'XU',xG,myThid)
124     c CALL MNC_CW_RL_W('D',bfname,0,0,'YU',yC,myThid)
125     c CALL MNC_CW_RL_W('D',bfname,0,0,'XV',xC,myThid)
126     c CALL MNC_CW_RL_W('D',bfname,0,0,'YV',yG,myThid)
127 edhill 1.2 CALL MNC_CW_RL_W('D',bfname,0,0,'XG',xG,myThid)
128     CALL MNC_CW_RL_W('D',bfname,0,0,'YG',yG,myThid)
129     CALL MNC_CW_RL_W('D',bfname,0,0,'dxC',dxC,myThid)
130     CALL MNC_CW_RL_W('D',bfname,0,0,'dyC',dyC,myThid)
131     CALL MNC_CW_RL_W('D',bfname,0,0,'dxF',dxF,myThid)
132     CALL MNC_CW_RL_W('D',bfname,0,0,'dyF',dyF,myThid)
133     CALL MNC_CW_RL_W('D',bfname,0,0,'dxG',dxG,myThid)
134     CALL MNC_CW_RL_W('D',bfname,0,0,'dyG',dyG,myThid)
135     CALL MNC_CW_RL_W('D',bfname,0,0,'dxV',dxV,myThid)
136     CALL MNC_CW_RL_W('D',bfname,0,0,'dyU',dyU,myThid)
137     CALL MNC_CW_RL_W('D',bfname,0,0,'rA',rA,myThid)
138     CALL MNC_CW_RL_W('D',bfname,0,0,'rAw',rAw,myThid)
139     CALL MNC_CW_RL_W('D',bfname,0,0,'rAs',rAs,myThid)
140     CALL MNC_CW_RL_W('D',bfname,0,0,'rAz',rAz,myThid)
141 jmc 1.12 IF ( usingCurvilinearGrid ) THEN
142 edhill 1.13 CALL MNC_CW_RL_W('D',bfname,0,0,'AngleCS',angleCosC,myThid)
143     CALL MNC_CW_RL_W('D',bfname,0,0,'AngleSN',angleSinC,myThid)
144 jmc 1.12 ENDIF
145 edhill 1.2 CALL MNC_CW_RL_W('D',bfname,0,0,'fCori',fCori,myThid)
146     CALL MNC_CW_RL_W('D',bfname,0,0,'fCoriG',fCoriG,myThid)
147     CALL MNC_CW_RL_W('D',bfname,0,0,'R_low',R_low,myThid)
148     CALL MNC_CW_RL_W('D',bfname,0,0,'Ro_surf',Ro_surf,myThid)
149     CALL MNC_CW_RL_W('D',bfname,0,0,'Depth',tmpfld,myThid)
150     CALL MNC_CW_RL_W('D',bfname,0,0,'HFacC',HFacC,myThid)
151     CALL MNC_CW_RL_W('D',bfname,0,0,'HFacW',HFacW,myThid)
152     CALL MNC_CW_RL_W('D',bfname,0,0,'HFacS',HFacS,myThid)
153 edhill 1.17 _END_MASTER(myThid)
154 edhill 1.2
155 adcroft 1.1 ENDIF
156     #endif /* ALLOW_MNC */
157    
158     RETURN
159     END
160    
161     C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
162    

  ViewVC Help
Powered by ViewVC 1.1.22