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