/[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.4 - (show annotations) (download)
Mon Jun 7 18:32:21 2004 UTC (20 years ago) by molod
Branch: MAIN
Changes since 1.3: +27 -32 lines
Debugging and developing

1 C $Header: $
2 C $Name: $
3
4 subroutine fizhi_init_veg(mythid,vegdata,im,jm,Nsx,Nsy,maxtyp,
5 . surftype,tilefrac,igrd,ityp,chfr )
6 C***********************************************************************
7 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 C
12 C INPUT:
13 C
14 C mythid - thread number (processor number)
15 C vegdata - Character*40 Vegetation Dataset name
16 C im - model grid longitude dimension
17 C jm - model grid latitude dimension (number of lat. points)
18 C Nsx - Number of processors in x-direction
19 C Nsy - Number of processors in y-direction
20 C maxtyp - maximum allowable number of land surface types per grid box
21 C nchpmax - integer maximum per-processor number of tiles in tile space
22 C
23 C OUTPUT:
24 C
25 C surftype - integer array of land surface types [im,jm,maxtyp,Nsx,Nsy]
26 C tilefrac - real array of corresponding land surface type fractions
27 C [im,jm,maxtyp,Nsx,Nsy]
28 C igrd - integer array in tile space of grid point number for each
29 C tile [nchp,Nsx,Nsy]
30 C ityp - integer array in tile space of land surface type for each
31 C tile [nchp,Nsx,Nsy]
32 C chfr - real array in tile space of land surface type fraction for
33 C each tile [nchp,Nsx,Nsy]
34 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
51 integer mythid,im,jm,maxtyp,nchpmax,Nsx,Nsy
52 integer surftype(im,jm,maxtyp,Nsx,Nsy)
53 integer igrd(nchpmax,Nsx,Nsy),ityp(nchpmax,Nsx,Nsy)
54 real tilefrac(im,jm,maxtyp,Nsx,Nsy)
55 real chfr(nchpmax,Nsx,Nsy)
56 character*40 vegdata
57 integer imdata,jmdata,Nsxdata,Nsydata
58 integer nchp,nchpland
59
60 integer*4 im_32, jm_32, Nsx_32, Nsy_32
61 integer*4 iveg_32(im,jm,maxtyp,Nsx,Nsy)
62 real*4 veg_32(im,jm,maxtyp,Nsx,Nsy)
63
64 integer i,j,k,bi,bj,ierr1,kveg
65
66 call mdsfindunit( kveg, myThid )
67 close(kveg)
68 open(kveg,file=vegdata,form='unformatted',access='sequential',
69 . iostat=ierr1)
70 if( ierr1.eq.0 ) then
71 read(kveg)im_32,jm_32,Nsx_32,Nsy_32,IVEG_32,VEG_32
72 else
73 print *
74 print *, 'Veg Dataset: ',vegdata,' not found!'
75 print *
76 call exit(101)
77 endif
78 close(kveg)
79 IF (myThid.eq.1) THEN
80 imdata = im_32
81 jmdata = jm_32
82 Nsxdata = Nsx_32
83 Nsydata = Nsy_32
84 if( (imdata.ne.im) .or. (jmdata.ne.jm) .or.
85 . (Nsxdata.ne.Nsx) .or. (Nsydata.ne.Nsy) ) then
86 print *
87 print *, 'Veg Data Resolution is Incorrect! '
88 print *,' Model Res: ',im,'x',jm,' Data Res: ',imdata,'x',jmdata
89 print *,' Model Nsx Nsy: ',Nsx,' ',Nsy,' Data Nsx Nsy: ',Nsxdata,
90 . ' ',Nsydata
91 print *
92 call exit(102)
93 ENDIF
94
95 DO BJ = 1,Nsx
96 DO BI = 1,Nsy
97
98 do k = 1,maxtyp
99 do j = 1,jm
100 do i = 1,im
101 surftype(i,j,k,bi,bj) = iveg_32(i,j,k,bi,bj)
102 tilefrac(i,j,k,bi,bj) = veg_32(i,j,k,bi,bj)
103 enddo
104 enddo
105 enddo
106
107 c create chip arrays for :
108 c igrd : grid index
109 c ityp : veg. type
110 c chfr : vegetation fraction
111
112 c nchplnd<=nchp is the actual number of land chips
113
114 c land points
115 c -----------
116 nchplnd = 0
117 do k=1,maxtyp
118 do j=1,jm
119 do i=1,im
120 if(surftype(i,j,k,bi,bj).lt.100.and.
121 . tilefrac(i,j,k,bi,bj).gt.0.)then
122 nchplnd = nchplnd + 1
123 igrd (nchplnd,bi,bj) = i + (j-1)*im
124 ityp (nchplnd,bi,bj) = surftype(i,j,k,bi,bj)
125 chfr (nchplnd,bi,bj) = tilefrac(i,j,k,bi,bj)
126 endif
127 enddo
128 enddo
129 enddo
130
131 c ocean points
132 c ------------
133 nchp = nchplnd
134
135 do k=1,maxtyp
136 do j=1,jm
137 do i=1,im
138 if(surftype(i,j,k,bi,bj).ge.100 .and.
139 . tilefrac(i,j,k,bi,bj).gt.0.)then
140 nchp = nchp + 1
141 igrd (nchp,bi,bj) = i + (j-1)*im
142 ityp (nchp,bi,bj) = surftype(i,j,k,bi,bj)
143 chfr (nchp,bi,bj) = tilefrac(i,j,k,bi,bj)
144 endif
145 enddo
146 enddo
147 enddo
148
149 print *, 'bi ',bi,' bj ',bj
150 print *, 'Number of Total Tiles: ',nchp
151 print *, 'Number of Land Tiles: ',nchplnd
152 print *
153
154 ENDDO
155 ENDDO
156
157 RETURN
158 END

  ViewVC Help
Powered by ViewVC 1.1.22