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

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

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


Revision 1.2 - (hide annotations) (download)
Mon Jun 7 16:04:17 2004 UTC (20 years ago) by molod
Branch: MAIN
Changes since 1.1: +72 -74 lines
Choose to do IO with sequential access

1 molod 1.1 C $Header: $
2     C $Name: $
3    
4 molod 1.2 subroutine fizhi_init_veg ( mythid, vegdata,im,jm,bi,bj,maxtyp,
5     . surftype,tilefrac,igrd,ityp,chfr )
6 molod 1.1 C***********************************************************************
7 molod 1.2 C Subroutine fizhi_init_veg - routine to read in the land surface types,
8     C interpolate to the models grid, and set up tile space for use by
9     C the land surface model, the albedo calculation and the surface
10     C roughness calculation.
11 molod 1.1 C
12     C INPUT:
13     C
14     C mythid - thread number (processor number)
15 molod 1.2 C vegdata - Character*40 Vegetation Dataset name
16 molod 1.1 C im - model grid longitude dimension
17     C jm - model grid latitude dimension (number of lat. points)
18 molod 1.2 C bi - Number of processors in x-direction
19     C bj - Number of processors in y-direction
20 molod 1.1 C maxtyp - maximum allowable number of land surface types per grid box
21 molod 1.2 C nchpmax - integer maximum per-processor number of tiles in tile space
22 molod 1.1 C
23     C OUTPUT:
24     C
25 molod 1.2 C surftype - integer array of land surface types [im,jm,maxtyp,bi,bj]
26 molod 1.1 C tilefrac - real array of corresponding land surface type fractions
27 molod 1.2 C [im,jm,maxtyp,bi,bj]
28 molod 1.1 C igrd - integer array in tile space of grid point number for each
29 molod 1.2 C tile [nchp,bi,bj]
30 molod 1.1 C ityp - integer array in tile space of land surface type for each
31 molod 1.2 C tile [nchp,bi,bj]
32 molod 1.1 C chfr - real array in tile space of land surface type fraction for
33 molod 1.2 C each tile [nchp,bi,bj]
34 molod 1.1 C
35     C NOTES:
36     C Vegetation type as follows:
37     C 1: BROADLEAF EVERGREEN TREES
38     C 2: BROADLEAF DECIDUOUS TREES
39     C 3: NEEDLELEAF TREES
40     C 4: GROUND COVER
41     C 5: BROADLEAF SHRUBS
42     C 6: DWARF TREES (TUNDRA)
43     C 7: BARE SOIL
44     C 8: DESERT
45     C 9: GLACIER
46     C 10: DARK DESERT
47     C 100: OCEAN
48     C***********************************************************************
49     implicit none
50 molod 1.2 #include "EEPARAMS.h"
51 molod 1.1
52 molod 1.2 integer mythid,im,jm,maxtyp,nchpmax
53     integer surftype(im,jm,maxtyp,bi,bj)
54     integer igrd(nchpmax,bi,bj),ityp(nchpmax,bi,bj)
55     real tilefrac(im,jm,maxtyp,bi,bj)
56     real chfr(nchpmax,bi,bj)
57 molod 1.1 character*40 vegdata
58 molod 1.2 integer imdata,jmdata,bidata,bjdata
59     integer nchp,nchpland
60 molod 1.1
61 molod 1.2 integer*4 im_32, jm_32, bi_32, bj_32
62     integer*4 iveg_32(im,jm,maxtyp,bi,bj)
63     real*4 veg_32(im,jm,maxtyp,bi,bj)
64 molod 1.1
65 molod 1.2 integer i,j,k,bilocal,bjlocal,ierr1,kveg
66 molod 1.1
67     IF (myThid.eq.1) THEN
68     call mdsfindunit( kveg, myThid )
69 molod 1.2 close(kveg)
70     open(kveg,file=vegdata,form='unformatted',access='sequential',
71     . iostat=ierr1)
72 molod 1.1 if( ierr1.eq.0 ) then
73 molod 1.2 read(kveg)im_32,jm_32,bi_32,bj_32,IVEG_32,VEG_32
74 molod 1.1 else
75     print *
76     print *, 'Veg Dataset: ',vegdata,' not found!'
77     print *
78 molod 1.2 call exit(101)
79 molod 1.1 endif
80 molod 1.2 close(kveg)
81     imdata = im_32
82     jmdata = jm_32
83     bidata = bi_32
84     bjdata = bj_32
85     if( (imdata.ne.im) .or. (jmdata.ne.jm) .or.
86     . (bi.ne.bidata) .or. (bjdata.ne.bj) ) then
87     print *
88     print *, 'Veg Data Resolution is Incorrect! '
89     print *,' Model Res: ',im,'x',jm,' Data Res: ',imdata,'x',jmdata
90     print *,' Model Bij: ',bi,'x',bj,' Data Bij: ',bidata,'x',bjdata
91     print *
92     call exit(102)
93 molod 1.1 ENDIF
94 molod 1.2
95 molod 1.1 imdata = im_32
96     jmdata = jm_32
97 molod 1.2 bidata = bi_32
98     bjdata = bj_32
99    
100     DO BJLOCAL = myByLo(myThid), myByHi(myThid)
101     DO BILOCAL = myBxLo(myThid), myBxHi(myThid)
102    
103     do k = 1,maxtyp
104     do j = 1,jm_32
105     do i = 1,im_32
106     surftype(i,j,k,bilocal,bjlocal) = iveg_32(i,j,k,bilocal,bjlocal)
107     tilefrac(i,j,k,bilocal,bjlocal) = veg_32(i,j,k,bilocal,bjlocal)
108     enddo
109 molod 1.1 enddo
110     enddo
111    
112     c create chip arrays for :
113     c igrd : grid index
114     c ityp : veg. type
115     c chfr : vegetation fraction
116    
117     c nchplnd<=nchp is the actual number of land chips
118    
119     c land points
120     c -----------
121     nchplnd = 0
122     do k=1,maxtyp
123     do j=1,jm
124     do i=1,im
125 molod 1.2 if(surftype(i,j,k,bi,bj).lt.100.and.
126     . tilefrac(i,j,k,bi,bj).gt.0.)then
127 molod 1.1 nchplnd = nchplnd + 1
128 molod 1.2 igrd (nchplnd,bi,bj) = i + (j-1)*im
129     ityp (nchplnd,bi,bj) = surftype(i,j,k,bi,bj)
130     chfr (nchplnd,bi,bj) = tilefrac(i,j,k,bi,bj)
131 molod 1.1 endif
132     enddo
133     enddo
134     enddo
135    
136     c ocean points
137     c ------------
138     nchp = nchplnd
139    
140     do k=1,maxtyp
141     do j=1,jm
142     do i=1,im
143 molod 1.2 if(surftype(i,j,k,bi,bj).ge.100 .and.
144     . tilefrac(i,j,k,bi,bj).gt.0.)then
145 molod 1.1 nchp = nchp + 1
146 molod 1.2 igrd (nchp,bi,bj) = i + (j-1)*im
147     ityp (nchp,bi,bj) = surftype(i,j,k,bi,bj)
148     chfr (nchp,bi,bj) = tilefrac(i,j,k,bi,bj)
149 molod 1.1 endif
150     enddo
151     enddo
152     enddo
153    
154 molod 1.2 print *, 'bi ',bilocal,' bj ',bjlocal
155 molod 1.1 print *, 'Number of Total Tiles: ',nchp
156     print *, 'Number of Land Tiles: ',nchplnd
157     print *
158 molod 1.2
159     ENDDO
160     ENDDO
161 molod 1.1
162     RETURN
163     END

  ViewVC Help
Powered by ViewVC 1.1.22