/[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.17 - (show annotations) (download)
Sun Oct 10 06:08:48 2004 UTC (19 years, 8 months ago) by edhill
Branch: MAIN
CVS Tags: checkpoint55h_post, checkpoint55g_post, checkpoint55f_post
Changes since 1.16: +2 -4 lines
 o move useMNC and related runtime switches to PARAMS.h

1 C $Header: /u/gcmpack/MITgcm/pkg/fizhi/fizhi_init_veg.F,v 1.16 2004/09/23 03:28:42 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,nchptot,nchpland,Nsx,Nsy,Nxg,Nyg
59 integer surftype(im,jm,maxtyp,Nsx,Nsy)
60 integer igrd(nchp,Nsx,Nsy),ityp(nchp,Nsx,Nsy)
61 _RL tilefrac(im,jm,maxtyp,Nsx,Nsy)
62 _RL lats(im,jm,nSx,nSy), lons(im,jm,nSx,nSy)
63 _RL chfr(nchp,Nsx,Nsy),chlt(nchp,Nsx,Nsy),chlon(nchp,Nsx,Nsy)
64 character*40 vegdata
65 integer imdata,jmdata,Nxgdata,Nygdata
66 integer biglobal,bjglobal
67
68 integer*4 im_32, jm_32, Nxg_32, Nyg_32
69 integer*4 iveg_32(im,jm,maxtyp,Nxg,Nyg)
70 real*4 veg_32(im,jm,maxtyp,Nxg,Nyg)
71
72 integer i,j,k,bi,bj,ierr1,kveg
73
74 #ifdef ALLOW_MNC
75 character*(MAX_LEN_FNAM) fizhi_veg_bn
76 #endif
77
78 C Allow for MDSIO format if someday needed
79 #ifdef ALLOW_MDSIO
80 IF ( .FALSE. ) THEN
81
82 call mdsfindunit( kveg, myThid )
83 close(kveg)
84 open(kveg,file=vegdata,form='unformatted',access='sequential',
85 . iostat=ierr1)
86 if( ierr1.eq.0 ) then
87 read(kveg)im_32,jm_32,Nxg_32,Nyg_32,IVEG_32,VEG_32
88 else
89 print *
90 print *, 'Veg Dataset: ',vegdata,' not found!'
91 print *
92 call exit(101)
93 endif
94 close(kveg)
95
96 IF (myThid.eq.1) THEN
97 imdata = im_32
98 jmdata = jm_32
99 Nxgdata = Nxg_32
100 Nygdata = Nyg_32
101 if( (imdata.ne.im) .or. (jmdata.ne.jm) .or.
102 . (Nxgdata.ne.Nxg) .or. (Nygdata.ne.Nyg) ) then
103 print *
104 print *, 'Veg Data Resolution is Incorrect! '
105 print *,' Model Res: ',im,'x',jm,' Data Res: ',imdata,'x',jmdata
106 print *,' Model Nxg Nyg: ',Nxg,' ',Nyg,' Data Nxg Nyg: ',Nxgdata,
107 . ' ',Nygdata
108 print *
109 call exit(102)
110 ENDIF
111 ENDIF
112
113 DO BJ = myByLo(myThid), myByHi(myThid)
114 DO BI = myBxLo(myThid), myBxHi(myThid)
115
116 biglobal=bi+(myXGlobalLo-1)/im
117 bjglobal=bj+(myYGlobalLo-1)/jm
118 #if defined( _BYTESWAPIO ) && defined( ALLOW_MDSIO )
119 call MDS_BYTESWAPR4(im*jm*maxtyp,veg_32(1,1,1,biglobal,bjglobal))
120 #endif
121 do k = 1,maxtyp
122 do j = 1,jm
123 do i = 1,im
124 surftype(i,j,k,bi,bj) = iveg_32(i,j,k,biglobal,bjglobal)
125 tilefrac(i,j,k,bi,bj) = veg_32(i,j,k,biglobal,bjglobal)
126 enddo
127 enddo
128 enddo
129
130 ENDDO
131 ENDDO
132
133 ENDIF
134 #endif
135
136 #ifdef ALLOW_MNC
137 IF (useMNC) THEN
138 _BEGIN_MASTER( myThid )
139
140 do i = 1,MAX_LEN_FNAM
141 fizhi_veg_bn(i:i) = ' '
142 enddo
143
144 C The following base name should be handled by some sort of input
145 C name parameter in FIZHI_READPARMS() plus a possible size.
146
147 C Set the base name 1234567890
148 fizhi_veg_bn(1:10) = 'fizhi_veg '
149
150 CALL MNC_CW_I_R('I', fizhi_veg_bn, 0,0,
151 & 'surftype',surftype,myThid)
152 CALL MNC_CW_RL_R('R', fizhi_veg_bn, 0,0,
153 & 'tilefrac', tilefrac, myThid)
154
155 _END_MASTER( myThid )
156 ENDIF
157 #endif
158
159 c create chip arrays for :
160 c igrd : grid index
161 c ityp : veg. type
162 c chfr : vegetation fraction
163 c chlon: chip longitude
164 c chlt : chip latitude
165
166 c nchpland<=nchptot is the actual number of land chips
167
168 DO BJ = myByLo(myThid), myByHi(myThid)
169 DO BI = myBxLo(myThid), myBxHi(myThid)
170
171 c land points
172 c -----------
173 nchpland = 0
174 do k=1,maxtyp
175 do j=1,jm
176 do i=1,im
177 if(surftype(i,j,k,bi,bj).lt.100 .and.
178 . tilefrac(i,j,k,bi,bj).gt.0.) then
179 nchpland = nchpland + 1
180 igrd (nchpland,bi,bj) = i + (j-1)*im
181 ityp (nchpland,bi,bj) = surftype(i,j,k,bi,bj)
182 chfr (nchpland,bi,bj) = tilefrac(i,j,k,bi,bj)
183 chlon(nchpland,bi,bj) = lons(i,j,bi,bj)
184 chlt (nchpland,bi,bj) = lats(i,j,bi,bj)
185 endif
186 enddo
187 enddo
188 enddo
189
190 c ocean points
191 c ------------
192 nchptot = nchpland
193
194 do k=1,maxtyp
195 do j=1,jm
196 do i=1,im
197 if(surftype(i,j,k,bi,bj).ge.100 .and.
198 . tilefrac(i,j,k,bi,bj).gt.0.) then
199 nchptot = nchptot + 1
200 igrd (nchptot,bi,bj) = i + (j-1)*im
201 ityp (nchptot,bi,bj) = surftype(i,j,k,bi,bj)
202 chfr (nchptot,bi,bj) = tilefrac(i,j,k,bi,bj)
203 chlon(nchptot,bi,bj) = lons(i,j,bi,bj)
204 chlt (nchptot,bi,bj) = lats(i,j,bi,bj)
205 endif
206 enddo
207 enddo
208 enddo
209
210 if(bi.eq.1.and.bj.eq.1)then
211 print *, 'Number of Total Tiles: ',nchptot
212 print *, 'Number of Land Tiles: ',nchpland
213 print *
214 endif
215
216 ENDDO
217 ENDDO
218
219 RETURN
220 END

  ViewVC Help
Powered by ViewVC 1.1.22