/[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.7 - (hide annotations) (download)
Wed Jun 9 18:35:31 2004 UTC (20 years ago) by molod
Branch: MAIN
Changes since 1.6: +13 -4 lines
Initialising stuff for fizhi

1 molod 1.6 C $Header: /u/gcmpack/MITgcm/pkg/fizhi/fizhi_init_veg.F,v 1.5 2004/06/07 20:26:43 molod Exp $
2 molod 1.1 C $Name: $
3    
4 molod 1.6 subroutine fizhi_init_veg(mythid,vegdata,im,jm,Nsx,Nsy,Nxg,Nyg,
5 molod 1.7 .maxtyp,nchp,lons,lats,surftype,tilefrac,igrd,ityp,chfr,chlt,chlon)
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.7 C im - longitude dimension
17     C jm - latitude dimension (number of lat. points)
18 molod 1.4 C Nsx - Number of processors in x-direction
19     C Nsy - 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.6 C nchp - integer per-processor number of tiles in tile space
22 molod 1.7 C lons - longitude in degrees [im,jm,nSx,nSy]
23     C lats - latitude in degrees [im,jm,nSx,nSy]
24 molod 1.1 C
25     C OUTPUT:
26     C
27 molod 1.4 C surftype - integer array of land surface types [im,jm,maxtyp,Nsx,Nsy]
28 molod 1.1 C tilefrac - real array of corresponding land surface type fractions
29 molod 1.4 C [im,jm,maxtyp,Nsx,Nsy]
30 molod 1.1 C igrd - integer array in tile space of grid point number for each
31 molod 1.4 C tile [nchp,Nsx,Nsy]
32 molod 1.1 C ityp - integer array in tile space of land surface type for each
33 molod 1.4 C tile [nchp,Nsx,Nsy]
34 molod 1.1 C chfr - real array in tile space of land surface type fraction for
35 molod 1.4 C each tile [nchp,Nsx,Nsy]
36 molod 1.1 C
37     C NOTES:
38     C Vegetation type as follows:
39     C 1: BROADLEAF EVERGREEN TREES
40     C 2: BROADLEAF DECIDUOUS TREES
41     C 3: NEEDLELEAF TREES
42     C 4: GROUND COVER
43     C 5: BROADLEAF SHRUBS
44     C 6: DWARF TREES (TUNDRA)
45     C 7: BARE SOIL
46     C 8: DESERT
47     C 9: GLACIER
48     C 10: DARK DESERT
49     C 100: OCEAN
50     C***********************************************************************
51     implicit none
52 molod 1.5 #include "EEPARAMS.h"
53 molod 1.1
54 molod 1.6 integer mythid,im,jm,maxtyp,nchp,Nsx,Nsy,Nxg,Nyg
55 molod 1.4 integer surftype(im,jm,maxtyp,Nsx,Nsy)
56 molod 1.6 integer igrd(nchp,Nsx,Nsy),ityp(nchp,Nsx,Nsy)
57 molod 1.4 real tilefrac(im,jm,maxtyp,Nsx,Nsy)
58 molod 1.7 real lats(im,jm,nSx,nSy), lons(im,jm,nSx,nSy)
59     real chfr(nchp,Nsx,Nsy),chlt(nchp,Nsx,Nsy),chlon(nchp,Nsx,Nsy)
60 molod 1.1 character*40 vegdata
61 molod 1.6 integer imdata,jmdata,Nxgdata,Nygdata
62     integer nchplocal,nchpland,biglobal,bjglobal
63 molod 1.1
64 molod 1.6 integer*4 im_32, jm_32, Nxg_32, Nyg_32
65     integer*4 iveg_32(im,jm,maxtyp,Nxg,Nyg)
66     real*4 veg_32(im,jm,maxtyp,Nxg,Nyg)
67 molod 1.1
68 molod 1.3 integer i,j,k,bi,bj,ierr1,kveg
69 molod 1.1
70     call mdsfindunit( kveg, myThid )
71 molod 1.2 close(kveg)
72     open(kveg,file=vegdata,form='unformatted',access='sequential',
73     . iostat=ierr1)
74 molod 1.1 if( ierr1.eq.0 ) then
75 molod 1.6 read(kveg)im_32,jm_32,Nxg_32,Nyg_32,IVEG_32,VEG_32
76 molod 1.1 else
77     print *
78     print *, 'Veg Dataset: ',vegdata,' not found!'
79     print *
80 molod 1.2 call exit(101)
81 molod 1.1 endif
82 molod 1.2 close(kveg)
83 molod 1.3 IF (myThid.eq.1) THEN
84 molod 1.2 imdata = im_32
85     jmdata = jm_32
86 molod 1.6 Nxgdata = Nxg_32
87     Nygdata = Nyg_32
88 molod 1.2 if( (imdata.ne.im) .or. (jmdata.ne.jm) .or.
89 molod 1.6 . (Nxgdata.ne.Nxg) .or. (Nygdata.ne.Nyg) ) then
90 molod 1.2 print *
91     print *, 'Veg Data Resolution is Incorrect! '
92     print *,' Model Res: ',im,'x',jm,' Data Res: ',imdata,'x',jmdata
93 molod 1.6 print *,' Model Nxg Nyg: ',Nxg,' ',Nyg,' Data Nxg Nyg: ',Nxgdata,
94     . ' ',Nygdata
95 molod 1.2 print *
96     call exit(102)
97 molod 1.1 ENDIF
98 molod 1.2
99 molod 1.5 DO BJ = myByLo(myThid), myByHi(myThid)
100     DO BI = myBxLo(myThid), myBxHi(myThid)
101    
102     biglobal=bi+(myXGlobalLo-1)/im
103     bjglobal=bj+(myYGlobalLo-1)/jm
104 molod 1.2
105     do k = 1,maxtyp
106 molod 1.4 do j = 1,jm
107     do i = 1,im
108 molod 1.5 surftype(i,j,k,bi,bj) = iveg_32(i,j,k,biglobal,bjglobal)
109     tilefrac(i,j,k,bi,bj) = veg_32(i,j,k,biglobal,bjglobal)
110 molod 1.2 enddo
111 molod 1.1 enddo
112     enddo
113    
114     c create chip arrays for :
115     c igrd : grid index
116     c ityp : veg. type
117     c chfr : vegetation fraction
118 molod 1.7 c chlon: chip longitude
119     c chlt : chip latitude
120 molod 1.1
121 molod 1.6 c nchplnd<=nchplocal is the actual number of land chips
122 molod 1.1
123     c land points
124     c -----------
125     nchplnd = 0
126     do k=1,maxtyp
127     do j=1,jm
128     do i=1,im
129 molod 1.2 if(surftype(i,j,k,bi,bj).lt.100.and.
130     . tilefrac(i,j,k,bi,bj).gt.0.)then
131 molod 1.1 nchplnd = nchplnd + 1
132 molod 1.2 igrd (nchplnd,bi,bj) = i + (j-1)*im
133     ityp (nchplnd,bi,bj) = surftype(i,j,k,bi,bj)
134     chfr (nchplnd,bi,bj) = tilefrac(i,j,k,bi,bj)
135 molod 1.7 chlon(nchplnd,bi,bj) = lons(i,j,bi,bj)
136     chlt (nchplnd,bi,bj) = lats(i,j,bi,bj)
137 molod 1.1 endif
138     enddo
139     enddo
140     enddo
141    
142     c ocean points
143     c ------------
144 molod 1.6 nchplocal = nchplnd
145 molod 1.1
146     do k=1,maxtyp
147     do j=1,jm
148     do i=1,im
149 molod 1.2 if(surftype(i,j,k,bi,bj).ge.100 .and.
150     . tilefrac(i,j,k,bi,bj).gt.0.)then
151 molod 1.6 nchplocal = nchplocal + 1
152     igrd (nchplocal,bi,bj) = i + (j-1)*im
153     ityp (nchplocal,bi,bj) = surftype(i,j,k,bi,bj)
154     chfr (nchplocal,bi,bj) = tilefrac(i,j,k,bi,bj)
155 molod 1.7 chlon(nchplocal,bi,bj) = lons(i,j,bi,bj)
156     chlt (nchplocal,bi,bj) = lats(i,j,bi,bj)
157 molod 1.1 endif
158     enddo
159     enddo
160     enddo
161    
162 molod 1.3 print *, 'bi ',bi,' bj ',bj
163 molod 1.6 print *, 'Number of Total Tiles: ',nchplocal
164 molod 1.1 print *, 'Number of Land Tiles: ',nchplnd
165     print *
166 molod 1.2
167     ENDDO
168     ENDDO
169 molod 1.1
170     RETURN
171     END

  ViewVC Help
Powered by ViewVC 1.1.22