/[MITgcm]/MITgcm/pkg/fizhi/fizhi_init_veg.F
ViewVC logotype

Contents of /MITgcm/pkg/fizhi/fizhi_init_veg.F

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


Revision 1.18 - (show annotations) (download)
Fri Oct 22 19:20:55 2004 UTC (19 years, 8 months ago) by molod
Branch: MAIN
CVS Tags: checkpoint57d_post, checkpoint57b_post, checkpoint57c_pre, checkpoint55j_post, checkpoint56b_post, checkpoint56c_post, checkpoint57a_post, checkpoint57a_pre, checkpoint55i_post, checkpoint57, checkpoint56, checkpoint57c_post, checkpoint56a_post
Changes since 1.17: +20 -22 lines
Updating

1 C $Header: /u/gcmpack/MITgcm/pkg/fizhi/fizhi_init_veg.F,v 1.17 2004/10/10 06:08:48 edhill Exp $
2 C $Name: $
3
4 #include "FIZHI_OPTIONS.h"
5
6 subroutine fizhi_init_veg(mythid,vegdata,im,jm,Nsx,Nsy,Nxg,Nyg,
7 . maxtyp,nchp,nchptot,nchpland,lons,lats,surftype,tilefrac,
8 . igrd,ityp,chfr,chlt,chlon)
9 C***********************************************************************
10 C Subroutine fizhi_init_veg - routine to read in the land surface types,
11 C interpolate to the models grid, and set up tile space for use by
12 C the land surface model, the albedo calculation and the surface
13 C roughness calculation.
14 C
15 C INPUT:
16 C
17 C mythid - thread number (processor number)
18 C vegdata - Character*40 Vegetation Dataset name
19 C im - longitude dimension
20 C jm - latitude dimension (number of lat. points)
21 C Nsx - Number of processors in x-direction
22 C Nsy - Number of processors in y-direction
23 C maxtyp - maximum allowable number of land surface types per grid box
24 C nchp - integer per-processor number of tiles in tile space
25 C lons - longitude in degrees [im,jm,nSx,nSy]
26 C lats - latitude in degrees [im,jm,nSx,nSy]
27 C
28 C OUTPUT:
29 C
30 C surftype - integer array of land surface types [im,jm,maxtyp,Nsx,Nsy]
31 C tilefrac - real array of corresponding land surface type fractions
32 C [im,jm,maxtyp,Nsx,Nsy]
33 C igrd - integer array in tile space of grid point number for each
34 C tile [nchp,Nsx,Nsy]
35 C ityp - integer array in tile space of land surface type for each
36 C tile [nchp,Nsx,Nsy]
37 C chfr - real array in tile space of land surface type fraction for
38 C each tile [nchp,Nsx,Nsy]
39 C
40 C NOTES:
41 C Vegetation type as follows:
42 C 1: BROADLEAF EVERGREEN TREES
43 C 2: BROADLEAF DECIDUOUS TREES
44 C 3: NEEDLELEAF TREES
45 C 4: GROUND COVER
46 C 5: BROADLEAF SHRUBS
47 C 6: DWARF TREES (TUNDRA)
48 C 7: BARE SOIL
49 C 8: DESERT
50 C 9: GLACIER
51 C 10: DARK DESERT
52 C 100: OCEAN
53 C***********************************************************************
54 implicit none
55 #include "EEPARAMS.h"
56 #include "PARAMS.h"
57
58 integer mythid,im,jm,maxtyp,nchp,Nsx,Nsy,Nxg,Nyg
59 integer nchptot(Nsx,Nsy), nchpland(Nsx,Nsy)
60 integer surftype(im,jm,maxtyp,Nsx,Nsy)
61 integer igrd(nchp,Nsx,Nsy),ityp(nchp,Nsx,Nsy)
62 _RL tilefrac(im,jm,maxtyp,Nsx,Nsy)
63 _RL lats(im,jm,nSx,nSy), lons(im,jm,nSx,nSy)
64 _RL chfr(nchp,Nsx,Nsy),chlt(nchp,Nsx,Nsy),chlon(nchp,Nsx,Nsy)
65 character*40 vegdata
66 integer imdata,jmdata,Nxgdata,Nygdata
67 integer biglobal,bjglobal
68
69 integer*4 im_32, jm_32, Nxg_32, Nyg_32
70 integer*4 iveg_32(im,jm,maxtyp,Nxg,Nyg)
71 real*4 veg_32(im,jm,maxtyp,Nxg,Nyg)
72
73 integer i,j,k,bi,bj,ierr1,kveg
74
75 #ifdef ALLOW_MNC
76 character*(MAX_LEN_FNAM) fizhi_veg_bn
77 #endif
78
79 C Allow for MDSIO format if someday needed
80 #ifdef ALLOW_MDSIO
81 IF ( .FALSE. ) THEN
82
83 call mdsfindunit( kveg, myThid )
84 close(kveg)
85 open(kveg,file=vegdata,form='unformatted',access='sequential',
86 . iostat=ierr1)
87 if( ierr1.eq.0 ) then
88 read(kveg)im_32,jm_32,Nxg_32,Nyg_32,IVEG_32,VEG_32
89 else
90 print *
91 print *, 'Veg Dataset: ',vegdata,' not found!'
92 print *
93 call exit(101)
94 endif
95 close(kveg)
96
97 IF (myThid.eq.1) THEN
98 imdata = im_32
99 jmdata = jm_32
100 Nxgdata = Nxg_32
101 Nygdata = Nyg_32
102 if( (imdata.ne.im) .or. (jmdata.ne.jm) .or.
103 . (Nxgdata.ne.Nxg) .or. (Nygdata.ne.Nyg) ) then
104 print *
105 print *, 'Veg Data Resolution is Incorrect! '
106 print *,' Model Res: ',im,'x',jm,' Data Res: ',imdata,'x',jmdata
107 print *,' Model Nxg Nyg: ',Nxg,' ',Nyg,' Data Nxg Nyg: ',Nxgdata,
108 . ' ',Nygdata
109 print *
110 call exit(102)
111 ENDIF
112 ENDIF
113
114 DO BJ = myByLo(myThid), myByHi(myThid)
115 DO BI = myBxLo(myThid), myBxHi(myThid)
116
117 biglobal=bi+(myXGlobalLo-1)/im
118 bjglobal=bj+(myYGlobalLo-1)/jm
119 #if defined( _BYTESWAPIO ) && defined( ALLOW_MDSIO )
120 call MDS_BYTESWAPR4(im*jm*maxtyp,veg_32(1,1,1,biglobal,bjglobal))
121 #endif
122 do k = 1,maxtyp
123 do j = 1,jm
124 do i = 1,im
125 surftype(i,j,k,bi,bj) = iveg_32(i,j,k,biglobal,bjglobal)
126 tilefrac(i,j,k,bi,bj) = veg_32(i,j,k,biglobal,bjglobal)
127 enddo
128 enddo
129 enddo
130
131 ENDDO
132 ENDDO
133
134 ENDIF
135 #endif
136
137 #ifdef ALLOW_MNC
138 IF (useMNC) THEN
139 _BEGIN_MASTER( myThid )
140
141 do i = 1,MAX_LEN_FNAM
142 fizhi_veg_bn(i:i) = ' '
143 enddo
144
145 C The following base name should be handled by some sort of input
146 C name parameter in FIZHI_READPARMS() plus a possible size.
147
148 C Set the base name 1234567890
149 fizhi_veg_bn(1:10) = 'fizhi_veg '
150
151 CALL MNC_CW_I_R('I', fizhi_veg_bn, 0,0,
152 & 'surftype',surftype,myThid)
153 CALL MNC_CW_RL_R('R', fizhi_veg_bn, 0,0,
154 & 'tilefrac', tilefrac, myThid)
155
156 _END_MASTER( myThid )
157 ENDIF
158 #endif
159
160 c create chip arrays for :
161 c igrd : grid index
162 c ityp : veg. type
163 c chfr : vegetation fraction
164 c chlon: chip longitude
165 c chlt : chip latitude
166
167 c nchpland<=nchptot is the actual number of land chips
168
169 DO BJ = myByLo(myThid), myByHi(myThid)
170 DO BI = myBxLo(myThid), myBxHi(myThid)
171
172 c land points
173 c -----------
174 nchpland(bi,bj) = 0
175 do k=1,maxtyp
176 do j=1,jm
177 do i=1,im
178 if(surftype(i,j,k,bi,bj).lt.100 .and.
179 . tilefrac(i,j,k,bi,bj).gt.0.) then
180 nchpland(bi,bj) = nchpland(bi,bj) + 1
181 igrd (nchpland(bi,bj),bi,bj) = i + (j-1)*im
182 ityp (nchpland(bi,bj),bi,bj) = surftype(i,j,k,bi,bj)
183 chfr (nchpland(bi,bj),bi,bj) = tilefrac(i,j,k,bi,bj)
184 chlon(nchpland(bi,bj),bi,bj) = lons(i,j,bi,bj)
185 chlt (nchpland(bi,bj),bi,bj) = lats(i,j,bi,bj)
186 endif
187 enddo
188 enddo
189 enddo
190
191 c ocean points
192 c ------------
193 nchptot(bi,bj) = nchpland(bi,bj)
194
195 do k=1,maxtyp
196 do j=1,jm
197 do i=1,im
198 if(surftype(i,j,k,bi,bj).ge.100 .and.
199 . tilefrac(i,j,k,bi,bj).gt.0.) then
200 nchptot(bi,bj) = nchptot(bi,bj) + 1
201 igrd (nchptot(bi,bj),bi,bj) = i + (j-1)*im
202 ityp (nchptot(bi,bj),bi,bj) = surftype(i,j,k,bi,bj)
203 chfr (nchptot(bi,bj),bi,bj) = tilefrac(i,j,k,bi,bj)
204 chlon(nchptot(bi,bj),bi,bj) = lons(i,j,bi,bj)
205 chlt (nchptot(bi,bj),bi,bj) = lats(i,j,bi,bj)
206 endif
207 enddo
208 enddo
209 enddo
210
211 print *,'Number of Total Tiles for bi=',bi,': ',nchptot(bi,bj)
212 print *,'Number of Land Tiles for bi=',bi,': ',nchpland(bi,bj)
213
214 ENDDO
215 ENDDO
216
217 RETURN
218 END

  ViewVC Help
Powered by ViewVC 1.1.22