/[MITgcm]/MITgcm/pkg/exf/exf_set_gen.F
ViewVC logotype

Diff of /MITgcm/pkg/exf/exf_set_gen.F

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

revision 1.15 by dimitri, Mon Dec 11 16:19:19 2006 UTC revision 1.16 by dimitri, Wed Feb 7 17:38:11 2007 UTC
# Line 54  c     == routine arguments == Line 54  c     == routine arguments ==
54        _RL gen0  (1-olx:snx+olx,1-oly:sny+oly,nsx,nsy)        _RL gen0  (1-olx:snx+olx,1-oly:sny+oly,nsx,nsy)
55        _RL gen1  (1-olx:snx+olx,1-oly:sny+oly,nsx,nsy)        _RL gen1  (1-olx:snx+olx,1-oly:sny+oly,nsx,nsy)
56        character*1 genmask        character*1 genmask
57        character*(128) genfile, genfile0, genfile1        character*(128) genfile
58        _RL     mytime        _RL     mytime
59        integer myiter        integer myiter
60        integer mythid        integer mythid
61    
62  #ifdef USE_EXF_INTERPOLATION  #ifdef USE_EXF_INTERPOLATION
63  c     gen_lon_0 ,gen_lat_0 :: longitude and latitude of SouthWest  c     gen_lon_0 ,gen_lat_0 :: longitude and latitude of SouthWest
64  c                             corner of global input grid  c                             corner of global input grid
# Line 71  c     gen_xout, gen_yout   :: coordinate Line 72  c     gen_xout, gen_yout   :: coordinate
72        _RS gen_xout  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)        _RS gen_xout  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
73        _RS gen_yout  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)        _RS gen_yout  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
74        integer interp_method        integer interp_method
75  #endif  #endif /* USE_EXF_INTERPOLATION */
76    
77  c     == local variables ==  c     == local variables ==
78    
79        logical first, changed        logical first, changed
80        integer count0, count1        integer count0, count1
81        integer year0, year1        integer year0, year1
82          integer bi, bj, i, j, il
83        _RL     fac        _RL     fac
84          character*(128) genfile0, genfile1
       integer bi, bj  
       integer i, j, il  
85    
86  c     == external ==  c     == external ==
87    
# Line 90  c     == external == Line 90  c     == external ==
90    
91  c     == end of interface ==  c     == end of interface ==
92    
93        if ( genfile .NE. ' ' ) then        if ( genfile .NE. ' ' .and. genperiod .ne. 0 ) then
94    
95  cph(  cph(
96  cph-exf-print         if (genfile .EQ. hfluxfile)  year0 = 3000  cph-exf-print         if (genfile .EQ. hfluxfile)  year0 = 3000
97  cph)  cph)
98    
99           if ( genperiod .eq. 0 ) then           if ( genperiod .eq. -12 ) then
 c     genperiod=0 means input file is one time-constant field  
             count0 = 1  
             count1 = 1  
   
          elseif ( genperiod .eq. -12 ) then  
100  c     genperiod=-12 means input file contains 12 monthly means  c     genperiod=-12 means input file contains 12 monthly means
101  c     record numbers are assumed 1 to 12 corresponding to  c     record numbers are assumed 1 to 12 corresponding to
102  c     Jan. through Dec.  c     Jan. through Dec.
# Line 160  C     Complete filename with YR or _YEAR Line 155  C     Complete filename with YR or _YEAR
155              call mdsreadfield( genfile0, exf_iprec, exf_yftype, 1              call mdsreadfield( genfile0, exf_iprec, exf_yftype, 1
156       &           , gen1, count0, mythid       &           , gen1, count0, mythid
157       &           )       &           )
158  #endif  #endif /* USE_EXF_INTERPOLATION */
159    
160              if (exf_yftype .eq. 'RL') then              if (exf_yftype .eq. 'RL') then
161                 call exf_filter_rl( gen1, genmask, mythid )                 call exf_filter_rl( gen1, genmask, mythid )
# Line 201  C     Complete filename with YR or _YEAR Line 196  C     Complete filename with YR or _YEAR
196              call mdsreadfield( genfile1, exf_iprec, exf_yftype, 1              call mdsreadfield( genfile1, exf_iprec, exf_yftype, 1
197       &           , gen1, count1, mythid       &           , gen1, count1, mythid
198       &           )       &           )
199  #endif  #endif /* USE_EXF_INTERPOLATION */
200    
201              if (exf_yftype .eq. 'RL') then              if (exf_yftype .eq. 'RL') then
202                 call exf_filter_rl( gen1, genmask, mythid )                 call exf_filter_rl( gen1, genmask, mythid )
# Line 233  c     Interpolate linearly onto the  tim Line 228  c     Interpolate linearly onto the  tim
228        end        end
229    
230    
231    C+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
232    C+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
233    
234        subroutine exf_init_gen (        subroutine exf_init_gen (
235       &     genconst, genfld, gen0, gen1, geninitfile, mythid )       &     genfile, exf_inscal_gen, genmask,
236         &     genconst, genfld, gen0, gen1,
237    #ifdef USE_EXF_INTERPOLATION
238         &     gen_lon0, gen_lon_inc, gen_lat0, gen_lat_inc,
239         &     gen_nlon, gen_nlat, gen_xout, gen_yout, interp_method,
240    #endif
241         &     mythid )
242    
243    
244  c     ==================================================================  c     ==================================================================
245  c     SUBROUTINE exf_init_gen  c     SUBROUTINE exf_init_gen
# Line 263  c     == global variables == Line 267  c     == global variables ==
267    
268  c     == routine arguments ==  c     == routine arguments ==
269    
270          _RL exf_inscal_gen
271        _RL genconst        _RL genconst
272        _RL genfld(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy)        _RL genfld(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy)
273        _RL gen0  (1-olx:snx+olx,1-oly:sny+oly,nsx,nsy)        _RL gen0  (1-olx:snx+olx,1-oly:sny+oly,nsx,nsy)
274        _RL gen1  (1-olx:snx+olx,1-oly:sny+oly,nsx,nsy)        _RL gen1  (1-olx:snx+olx,1-oly:sny+oly,nsx,nsy)
275        character*(128) geninitfile        character*1 genmask
276          character*(128) genfile
277        integer mythid        integer mythid
278    
279    #ifdef USE_EXF_INTERPOLATION
280    c     gen_lon_0 ,gen_lat_0 :: longitude and latitude of SouthWest
281    c                             corner of global input grid
282    c     gen_nlon, gen_nlat   :: input x-grid and y-grid size
283    c     gen_lon_inc          :: scalar x-grid increment
284    c     gen_lat_inc          :: vector y-grid increments
285    c     gen_xout, gen_yout   :: coordinates for output grid
286          _RL gen_lon0, gen_lon_inc
287          _RL gen_lat0, gen_lat_inc(MAX_LAT_INC)
288          INTEGER gen_nlon, gen_nlat
289          _RS gen_xout  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
290          _RS gen_yout  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
291          integer interp_method
292    #endif /* USE_EXF_INTERPOLATION */
293    
294  c     == local variables ==  c     == local variables ==
295    
296        integer bi, bj        integer bi, bj, i, j, count
       integer i, j  
297    
298  c     == end of interface ==  c     == end of interface ==
299    
# Line 289  c     == end of interface == Line 309  c     == end of interface ==
309          enddo          enddo
310        enddo        enddo
311    
312        if ( geninitfile .NE. ' ' ) then        if ( genfile .NE. ' ' ) then
313           call mdsreadfield( geninitfile, exf_iprec, exf_yftype,           count = 1
314       &        1, genfld, 1, mythid )  
315    #ifdef USE_EXF_INTERPOLATION
316             call exf_interp( genfile, exf_iprec
317         &        , genfld, count, gen_xout, gen_yout
318         &        , gen_lon0,gen_lon_inc
319         &        , gen_lat0,gen_lat_inc
320         &        , gen_nlon,gen_nlat,interp_method,mythid
321         &        )
322    #else
323             call mdsreadfield( genfile, exf_iprec, exf_yftype, 1
324         &        , genfld, count, mythid
325         &        )
326    #endif /* USE_EXF_INTERPOLATION */
327    
328             if (exf_yftype .eq. 'RL') then
329                call exf_filter_rl( genfld, genmask, mythid )
330             else
331                call exf_filter_rs( genfld, genmask, mythid )
332             end if
333    
334    c     Loop over tiles.
335             do bj = mybylo(mythid),mybyhi(mythid)
336                do bi = mybxlo(mythid),mybxhi(mythid)
337                   do j = 1,sny
338                      do i = 1,snx
339    c     Interpolate linearly onto the  time.
340                         genfld(i,j,bi,bj) =
341         &                    exf_inscal_gen * genfld(i,j,bi,bj)
342                      enddo
343                   enddo
344                enddo
345             enddo
346    
347        endif        endif
348    
349        end        end

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

  ViewVC Help
Powered by ViewVC 1.1.22