/[MITgcm]/MITgcm/pkg/fizhi/fizhi_init_veg.F
ViewVC logotype

Diff of /MITgcm/pkg/fizhi/fizhi_init_veg.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.3 by molod, Mon Jun 7 18:04:06 2004 UTC revision 1.6 by molod, Tue Jun 8 22:26:08 2004 UTC
# Line 1  Line 1 
1  C $Header$  C $Header$
2  C $Name$  C $Name$
3    
4        subroutine fizhi_init_veg(mythid,vegdata,im,jm,maxbi,maxbj,maxtyp,        subroutine fizhi_init_veg(mythid,vegdata,im,jm,Nsx,Nsy,Nxg,Nyg,
5       . surftype,tilefrac,igrd,ityp,chfr )       . maxtyp,nchp,surftype,tilefrac,igrd,ityp,chfr )
6  C***********************************************************************  C***********************************************************************
7  C Subroutine fizhi_init_veg - routine to read in the land surface types,  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  C      interpolate to the models grid, and set up tile space for use by
# Line 15  C mythid   - thread number (processor nu Line 15  C mythid   - thread number (processor nu
15  C vegdata  - Character*40 Vegetation Dataset name  C vegdata  - Character*40 Vegetation Dataset name
16  C im       - model grid longitude dimension  C im       - model grid longitude dimension
17  C jm       - model grid latitude dimension (number of lat. points)  C jm       - model grid latitude dimension (number of lat. points)
18  C maxbi    - Number of processors in x-direction  C Nsx      - Number of processors in x-direction
19  C maxbj    - Number of processors in y-direction  C Nsy      - Number of processors in y-direction
20  C maxtyp   - maximum allowable number of land surface types per grid box  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  C nchp     - integer per-processor number of tiles in tile space
22  C  C
23  C OUTPUT:  C OUTPUT:
24  C  C
25  C surftype - integer array of land surface types [im,jm,maxtyp,bi,bj]  C surftype - integer array of land surface types [im,jm,maxtyp,Nsx,Nsy]
26  C tilefrac - real array of corresponding land surface type fractions  C tilefrac - real array of corresponding land surface type fractions
27  C            [im,jm,maxtyp,bi,bj]  C            [im,jm,maxtyp,Nsx,Nsy]
28  C igrd     - integer array in tile space of grid point number for each  C igrd     - integer array in tile space of grid point number for each
29  C            tile [nchp,bi,bj]  C            tile [nchp,Nsx,Nsy]
30  C ityp     - integer array in tile space of land surface type for each  C ityp     - integer array in tile space of land surface type for each
31  C            tile [nchp,bi,bj]  C            tile [nchp,Nsx,Nsy]
32  C chfr     - real array in tile space of land surface type fraction for  C chfr     - real array in tile space of land surface type fraction for
33  C            each tile [nchp,bi,bj]  C            each tile [nchp,Nsx,Nsy]
34  C  C
35  C NOTES:  C NOTES:
36  C       Vegetation type as follows:  C       Vegetation type as follows:
# Line 49  C*************************************** Line 49  C***************************************
49        implicit none        implicit none
50  #include "EEPARAMS.h"  #include "EEPARAMS.h"
51    
52        integer mythid,im,jm,maxtyp,nchpmax,maxbi,maxbj        integer mythid,im,jm,maxtyp,nchp,Nsx,Nsy,Nxg,Nyg
53        integer surftype(im,jm,maxtyp,maxbi,maxbj)        integer surftype(im,jm,maxtyp,Nsx,Nsy)
54        integer igrd(nchpmax,bi,bj),ityp(nchpmax,maxbi,maxbj)        integer igrd(nchp,Nsx,Nsy),ityp(nchp,Nsx,Nsy)
55        real tilefrac(im,jm,maxtyp,maxbi,maxbj)        real tilefrac(im,jm,maxtyp,Nsx,Nsy)
56        real chfr(nchpmax,maxbi,maxbj)        real chfr(nchp,Nsx,Nsy)
57        character*40 vegdata        character*40 vegdata
58        integer imdata,jmdata,bidata,bjdata        integer imdata,jmdata,Nxgdata,Nygdata
59        integer nchp,nchpland        integer nchplocal,nchpland,biglobal,bjglobal
60    
61        integer*4 im_32, jm_32, bi_32, bj_32        integer*4 im_32, jm_32, Nxg_32, Nyg_32
62        integer*4 iveg_32(im,jm,maxtyp,bi,bj)        integer*4 iveg_32(im,jm,maxtyp,Nxg,Nyg)
63           real*4  veg_32(im,jm,maxtyp,bi,bj)           real*4  veg_32(im,jm,maxtyp,Nxg,Nyg)
64    
65        integer i,j,k,bi,bj,ierr1,kveg        integer i,j,k,bi,bj,ierr1,kveg
66    
# Line 69  C*************************************** Line 69  C***************************************
69        open(kveg,file=vegdata,form='unformatted',access='sequential',        open(kveg,file=vegdata,form='unformatted',access='sequential',
70       .                      iostat=ierr1)       .                      iostat=ierr1)
71        if( ierr1.eq.0 ) then        if( ierr1.eq.0 ) then
72            read(kveg)im_32,jm_32,bi_32,bj_32,IVEG_32,VEG_32            read(kveg)im_32,jm_32,Nxg_32,Nyg_32,IVEG_32,VEG_32
73        else        else
74         print *         print *
75         print *, 'Veg Dataset: ',vegdata,' not found!'         print *, 'Veg Dataset: ',vegdata,' not found!'
# Line 80  C*************************************** Line 80  C***************************************
80        IF (myThid.eq.1) THEN        IF (myThid.eq.1) THEN
81        imdata = im_32        imdata = im_32
82        jmdata = jm_32        jmdata = jm_32
83        bidata = bi_32        Nxgdata = Nxg_32
84        bjdata = bj_32        Nygdata = Nyg_32
85        if( (imdata.ne.im) .or. (jmdata.ne.jm) .or.        if( (imdata.ne.im) .or. (jmdata.ne.jm) .or.
86       .                        (bi.ne.bidata) .or. (bjdata.ne.bj) ) then       .                     (Nxgdata.ne.Nxg) .or. (Nygdata.ne.Nyg) ) then
87         print *         print *
88         print *, 'Veg Data Resolution is Incorrect! '         print *, 'Veg Data Resolution is Incorrect! '
89         print *,' Model Res: ',im,'x',jm,' Data Res: ',imdata,'x',jmdata         print *,' Model Res: ',im,'x',jm,' Data Res: ',imdata,'x',jmdata
90         print *,' Model Bij: ',bi,'x',bj,' Data Bij: ',bidata,'x',bjdata         print *,' Model Nxg Nyg: ',Nxg,' ',Nyg,' Data Nxg Nyg: ',Nxgdata,
91         .                    ' ',Nygdata
92         print *         print *
93         call exit(102)         call exit(102)
94        ENDIF        ENDIF
95                                                                                                                                                                    
       imdata = im_32  
       jmdata = jm_32  
       bidata = bi_32  
       bjdata = bj_32  
   
96        DO BJ = myByLo(myThid), myByHi(myThid)        DO BJ = myByLo(myThid), myByHi(myThid)
97        DO BI = myBxLo(myThid), myBxHi(myThid)        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        do k = 1,maxtyp
103        do j = 1,jm_32        do j = 1,jm
104        do i = 1,im_32        do i = 1,im
105         surftype(i,j,k,bi,bj) = iveg_32(i,j,k,bi,bj)         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,bi,bj)         tilefrac(i,j,k,bi,bj) = veg_32(i,j,k,biglobal,bjglobal)
107        enddo        enddo
108        enddo        enddo
109        enddo        enddo
# Line 114  c      igrd :  grid index Line 113  c      igrd :  grid index
113  c      ityp :  veg. type  c      ityp :  veg. type
114  c      chfr :  vegetation fraction  c      chfr :  vegetation fraction
115    
116  c  nchplnd<=nchp is the actual number of land chips  c  nchplnd<=nchplocal is the actual number of land chips
117    
118  c land points  c land points
119  c -----------  c -----------
# Line 135  c ----------- Line 134  c -----------
134    
135  c ocean points  c ocean points
136  c ------------  c ------------
137        nchp = nchplnd        nchplocal = nchplnd
138    
139        do k=1,maxtyp        do k=1,maxtyp
140        do j=1,jm        do j=1,jm
141        do i=1,im        do i=1,im
142        if(surftype(i,j,k,bi,bj).ge.100 .and.        if(surftype(i,j,k,bi,bj).ge.100 .and.
143       .                                  tilefrac(i,j,k,bi,bj).gt.0.)then       .                                  tilefrac(i,j,k,bi,bj).gt.0.)then
144               nchp  = nchp + 1               nchplocal  = nchplocal + 1
145         igrd (nchp,bi,bj) = i + (j-1)*im         igrd (nchplocal,bi,bj) = i + (j-1)*im
146         ityp (nchp,bi,bj) = surftype(i,j,k,bi,bj)         ityp (nchplocal,bi,bj) = surftype(i,j,k,bi,bj)
147         chfr (nchp,bi,bj) = tilefrac(i,j,k,bi,bj)         chfr (nchplocal,bi,bj) = tilefrac(i,j,k,bi,bj)
148        endif        endif
149        enddo        enddo
150        enddo        enddo
151        enddo        enddo
152    
153        print *, 'bi ',bi,' bj ',bj        print *, 'bi ',bi,' bj ',bj
154        print *, 'Number of Total Tiles: ',nchp        print *, 'Number of Total Tiles: ',nchplocal
155        print *, 'Number of Land  Tiles: ',nchplnd        print *, 'Number of Land  Tiles: ',nchplnd
156        print *        print *
157    

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.6

  ViewVC Help
Powered by ViewVC 1.1.22