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,lons,lats,surftype,tilefrac,igrd,ityp,chfr,chlt,chlon) |
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 - longitude dimension |
17 |
C jm - 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 lons - longitude in degrees [im,jm,nSx,nSy] |
23 |
C lats - latitude in degrees [im,jm,nSx,nSy] |
24 |
C |
25 |
C OUTPUT: |
26 |
C |
27 |
C surftype - integer array of land surface types [im,jm,maxtyp,Nsx,Nsy] |
28 |
C tilefrac - real array of corresponding land surface type fractions |
29 |
C [im,jm,maxtyp,Nsx,Nsy] |
30 |
C igrd - integer array in tile space of grid point number for each |
31 |
C tile [nchp,Nsx,Nsy] |
32 |
C ityp - integer array in tile space of land surface type for each |
33 |
C tile [nchp,Nsx,Nsy] |
34 |
C chfr - real array in tile space of land surface type fraction for |
35 |
C each tile [nchp,Nsx,Nsy] |
36 |
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 |
#include "EEPARAMS.h" |
53 |
|
54 |
integer mythid,im,jm,maxtyp,nchp,Nsx,Nsy,Nxg,Nyg |
55 |
integer surftype(im,jm,maxtyp,Nsx,Nsy) |
56 |
integer igrd(nchp,Nsx,Nsy),ityp(nchp,Nsx,Nsy) |
57 |
real tilefrac(im,jm,maxtyp,Nsx,Nsy) |
58 |
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 |
character*40 vegdata |
61 |
integer imdata,jmdata,Nxgdata,Nygdata |
62 |
integer nchplocal,nchpland,biglobal,bjglobal |
63 |
|
64 |
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 |
|
68 |
integer i,j,k,bi,bj,ierr1,kveg |
69 |
|
70 |
call mdsfindunit( kveg, myThid ) |
71 |
close(kveg) |
72 |
open(kveg,file=vegdata,form='unformatted',access='sequential', |
73 |
. iostat=ierr1) |
74 |
if( ierr1.eq.0 ) then |
75 |
read(kveg)im_32,jm_32,Nxg_32,Nyg_32,IVEG_32,VEG_32 |
76 |
else |
77 |
print * |
78 |
print *, 'Veg Dataset: ',vegdata,' not found!' |
79 |
print * |
80 |
call exit(101) |
81 |
endif |
82 |
close(kveg) |
83 |
IF (myThid.eq.1) THEN |
84 |
imdata = im_32 |
85 |
jmdata = jm_32 |
86 |
Nxgdata = Nxg_32 |
87 |
Nygdata = Nyg_32 |
88 |
if( (imdata.ne.im) .or. (jmdata.ne.jm) .or. |
89 |
. (Nxgdata.ne.Nxg) .or. (Nygdata.ne.Nyg) ) then |
90 |
print * |
91 |
print *, 'Veg Data Resolution is Incorrect! ' |
92 |
print *,' Model Res: ',im,'x',jm,' Data Res: ',imdata,'x',jmdata |
93 |
print *,' Model Nxg Nyg: ',Nxg,' ',Nyg,' Data Nxg Nyg: ',Nxgdata, |
94 |
. ' ',Nygdata |
95 |
print * |
96 |
call exit(102) |
97 |
ENDIF |
98 |
|
99 |
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 |
|
105 |
do k = 1,maxtyp |
106 |
do j = 1,jm |
107 |
do i = 1,im |
108 |
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 |
enddo |
111 |
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 |
c chlon: chip longitude |
119 |
c chlt : chip latitude |
120 |
|
121 |
c nchplnd<=nchplocal is the actual number of land chips |
122 |
|
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 |
if(surftype(i,j,k,bi,bj).lt.100.and. |
130 |
. tilefrac(i,j,k,bi,bj).gt.0.)then |
131 |
nchplnd = nchplnd + 1 |
132 |
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 |
chlon(nchplnd,bi,bj) = lons(i,j,bi,bj) |
136 |
chlt (nchplnd,bi,bj) = lats(i,j,bi,bj) |
137 |
endif |
138 |
enddo |
139 |
enddo |
140 |
enddo |
141 |
|
142 |
c ocean points |
143 |
c ------------ |
144 |
nchplocal = nchplnd |
145 |
|
146 |
do k=1,maxtyp |
147 |
do j=1,jm |
148 |
do i=1,im |
149 |
if(surftype(i,j,k,bi,bj).ge.100 .and. |
150 |
. tilefrac(i,j,k,bi,bj).gt.0.)then |
151 |
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 |
chlon(nchplocal,bi,bj) = lons(i,j,bi,bj) |
156 |
chlt (nchplocal,bi,bj) = lats(i,j,bi,bj) |
157 |
endif |
158 |
enddo |
159 |
enddo |
160 |
enddo |
161 |
|
162 |
print *, 'bi ',bi,' bj ',bj |
163 |
print *, 'Number of Total Tiles: ',nchplocal |
164 |
print *, 'Number of Land Tiles: ',nchplnd |
165 |
print * |
166 |
|
167 |
ENDDO |
168 |
ENDDO |
169 |
|
170 |
RETURN |
171 |
END |