/[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.6 - (show annotations) (download)
Tue Jun 8 22:26:08 2004 UTC (20 years ago) by molod
Branch: MAIN
Changes since 1.5: +25 -25 lines
Developing inputs for fizhi

1 C $Header: /u/gcmpack/MITgcm/pkg/fizhi/fizhi_init_veg.F,v 1.5 2004/06/07 20:26:43 molod Exp $
2 C $Name: $
3
4 subroutine fizhi_init_veg(mythid,vegdata,im,jm,Nsx,Nsy,Nxg,Nyg,
5 . maxtyp,nchp,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 nchp - integer 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 #include "EEPARAMS.h"
51
52 integer mythid,im,jm,maxtyp,nchp,Nsx,Nsy,Nxg,Nyg
53 integer surftype(im,jm,maxtyp,Nsx,Nsy)
54 integer igrd(nchp,Nsx,Nsy),ityp(nchp,Nsx,Nsy)
55 real tilefrac(im,jm,maxtyp,Nsx,Nsy)
56 real chfr(nchp,Nsx,Nsy)
57 character*40 vegdata
58 integer imdata,jmdata,Nxgdata,Nygdata
59 integer nchplocal,nchpland,biglobal,bjglobal
60
61 integer*4 im_32, jm_32, Nxg_32, Nyg_32
62 integer*4 iveg_32(im,jm,maxtyp,Nxg,Nyg)
63 real*4 veg_32(im,jm,maxtyp,Nxg,Nyg)
64
65 integer i,j,k,bi,bj,ierr1,kveg
66
67 call mdsfindunit( kveg, myThid )
68 close(kveg)
69 open(kveg,file=vegdata,form='unformatted',access='sequential',
70 . iostat=ierr1)
71 if( ierr1.eq.0 ) then
72 read(kveg)im_32,jm_32,Nxg_32,Nyg_32,IVEG_32,VEG_32
73 else
74 print *
75 print *, 'Veg Dataset: ',vegdata,' not found!'
76 print *
77 call exit(101)
78 endif
79 close(kveg)
80 IF (myThid.eq.1) THEN
81 imdata = im_32
82 jmdata = jm_32
83 Nxgdata = Nxg_32
84 Nygdata = Nyg_32
85 if( (imdata.ne.im) .or. (jmdata.ne.jm) .or.
86 . (Nxgdata.ne.Nxg) .or. (Nygdata.ne.Nyg) ) 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 Nxg Nyg: ',Nxg,' ',Nyg,' Data Nxg Nyg: ',Nxgdata,
91 . ' ',Nygdata
92 print *
93 call exit(102)
94 ENDIF
95
96 DO BJ = myByLo(myThid), myByHi(myThid)
97 DO BI = myBxLo(myThid), myBxHi(myThid)
98
99 biglobal=bi+(myXGlobalLo-1)/im
100 bjglobal=bj+(myYGlobalLo-1)/jm
101
102 do k = 1,maxtyp
103 do j = 1,jm
104 do i = 1,im
105 surftype(i,j,k,bi,bj) = iveg_32(i,j,k,biglobal,bjglobal)
106 tilefrac(i,j,k,bi,bj) = veg_32(i,j,k,biglobal,bjglobal)
107 enddo
108 enddo
109 enddo
110
111 c create chip arrays for :
112 c igrd : grid index
113 c ityp : veg. type
114 c chfr : vegetation fraction
115
116 c nchplnd<=nchplocal is the actual number of land chips
117
118 c land points
119 c -----------
120 nchplnd = 0
121 do k=1,maxtyp
122 do j=1,jm
123 do i=1,im
124 if(surftype(i,j,k,bi,bj).lt.100.and.
125 . tilefrac(i,j,k,bi,bj).gt.0.)then
126 nchplnd = nchplnd + 1
127 igrd (nchplnd,bi,bj) = i + (j-1)*im
128 ityp (nchplnd,bi,bj) = surftype(i,j,k,bi,bj)
129 chfr (nchplnd,bi,bj) = tilefrac(i,j,k,bi,bj)
130 endif
131 enddo
132 enddo
133 enddo
134
135 c ocean points
136 c ------------
137 nchplocal = nchplnd
138
139 do k=1,maxtyp
140 do j=1,jm
141 do i=1,im
142 if(surftype(i,j,k,bi,bj).ge.100 .and.
143 . tilefrac(i,j,k,bi,bj).gt.0.)then
144 nchplocal = nchplocal + 1
145 igrd (nchplocal,bi,bj) = i + (j-1)*im
146 ityp (nchplocal,bi,bj) = surftype(i,j,k,bi,bj)
147 chfr (nchplocal,bi,bj) = tilefrac(i,j,k,bi,bj)
148 endif
149 enddo
150 enddo
151 enddo
152
153 print *, 'bi ',bi,' bj ',bj
154 print *, 'Number of Total Tiles: ',nchplocal
155 print *, 'Number of Land Tiles: ',nchplnd
156 print *
157
158 ENDDO
159 ENDDO
160
161 RETURN
162 END

  ViewVC Help
Powered by ViewVC 1.1.22