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

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

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

revision 1.9 by dimitri, Wed Mar 17 23:08:09 2004 UTC revision 1.20 by jmc, Mon May 14 19:34:57 2007 UTC
# Line 1  Line 1 
1  c $Header$  C $Header$
2    C $Name$
3    
4  #include "EXF_OPTIONS.h"  #include "EXF_OPTIONS.h"
5    
6        subroutine exf_mapfields( mythid )        subroutine exf_mapfields( mytime, myiter, mythid )
7    
8  c     ==================================================================  c     ==================================================================
9  c     SUBROUTINE exf_mapfields  c     SUBROUTINE exf_mapfields
# Line 15  c       This routine is included to sepa Line 16  c       This routine is included to sepa
16  c       tool as much as possible from the ocean model.  Unit and sign  c       tool as much as possible from the ocean model.  Unit and sign
17  c       conventions can be customized using variables exf_outscal_*,  c       conventions can be customized using variables exf_outscal_*,
18  c       which are set in exf_readparms.F.  See the header files  c       which are set in exf_readparms.F.  See the header files
19  c       exf_fields.h and FFIELDS.h for definitions of the various input  c       EXF_FIELDS.h and FFIELDS.h for definitions of the various input
20  c       and output fields and for default unit and sign convetions.  c       and output fields and for default unit and sign convetions.
21  c  c
22  c     started: Christian Eckert eckert@mit.edu  09-Aug-1999  c     started: Christian Eckert eckert@mit.edu  09-Aug-1999
# Line 47  c     == global variables == Line 48  c     == global variables ==
48    
49  #include "EEPARAMS.h"  #include "EEPARAMS.h"
50  #include "SIZE.h"  #include "SIZE.h"
51    #include "PARAMS.h"
52  #include "FFIELDS.h"  #include "FFIELDS.h"
53  #include "GRID.h"  #include "GRID.h"
54    
55  #include "exf_param.h"  #include "EXF_PARAM.h"
56  #include "exf_constants.h"  #include "EXF_CONSTANTS.h"
57  #include "exf_fields.h"  #include "EXF_FIELDS.h"
 #include "exf_clim_fields.h"  
58  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
59  # include "tamc.h"  # include "tamc.h"
60  # include "tamc_keys.h"  # include "tamc_keys.h"
# Line 62  c     == routine arguments == Line 63  c     == routine arguments ==
63    
64  c     mythid - thread number for this instance of the routine.  c     mythid - thread number for this instance of the routine.
65    
66          _RL     mytime
67          integer myiter
68        integer mythid        integer mythid
69    
70  c     == local variables ==  c     == local variables ==
71    
72        integer bi,bj        integer bi,bj
73        integer i,j        integer i,j,k
74        integer jtlo        INTEGER imin, imax
75        integer jthi        INTEGER jmin, jmax
76        integer itlo        PARAMETER ( imin = 1-OLx , imax = sNx+OLx )
77        integer ithi        PARAMETER ( jmin = 1-OLy , jmax = sNy+OLy )
       integer jmin  
       integer jmax  
       integer imin  
       integer imax  
78    
79  c     == end of interface ==  c     == end of interface ==
80    
81        jtlo = mybylo(mythid)        DO bj = myByLo(myThid),myByHi(myThid)
82        jthi = mybyhi(mythid)          DO bi = myBxLo(myThid),myBxHi(myThid)
       itlo = mybxlo(mythid)  
       ithi = mybxhi(mythid)  
       jmin = 1-oly  
       jmax = sny+oly  
       imin = 1-olx  
       imax = snx+olx  
   
       do bj = jtlo,jthi  
         do bi = itlo,ithi  
83    
84  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
85            act1 = bi - myBxLo(myThid)            act1 = bi - myBxLo(myThid)
# Line 108  c     == end of interface == Line 98  c     == end of interface ==
98              do i = imin,imax              do i = imin,imax
99  c            Heat flux.  c            Heat flux.
100               qnet(i,j,bi,bj) = exf_outscal_hflux*hflux(i,j,bi,bj)               qnet(i,j,bi,bj) = exf_outscal_hflux*hflux(i,j,bi,bj)
101                 if ( hfluxfile .EQ. ' ' )
102         &            qnet(i,j,bi,bj) = qnet(i,j,bi,bj) -
103         &            exf_outscal_hflux * ( hflux_exfremo_intercept +
104         &            hflux_exfremo_slope*(mytime-starttime) )
105              enddo              enddo
106            enddo            enddo
107    
# Line 116  c            Heat flux. Line 110  c            Heat flux.
110              do i = imin,imax              do i = imin,imax
111  c            Salt flux.  c            Salt flux.
112               empmr(i,j,bi,bj)= exf_outscal_sflux*sflux(i,j,bi,bj)               empmr(i,j,bi,bj)= exf_outscal_sflux*sflux(i,j,bi,bj)
113                 if ( sfluxfile .EQ. ' ' )
114         &            empmr(i,j,bi,bj) = empmr(i,j,bi,bj) -
115         &            exf_outscal_sflux * ( sflux_exfremo_intercept +
116         &            sflux_exfremo_slope*(mytime-starttime) )
117              enddo              enddo
118            enddo            enddo
119    
# Line 125  CADJ STORE ustress(:,:,bi,bj) = comlev1_ Line 123  CADJ STORE ustress(:,:,bi,bj) = comlev1_
123            do j = jmin,jmax            do j = jmin,jmax
124              do i = imin,imax              do i = imin,imax
125  c             Zonal wind stress.  c             Zonal wind stress.
126                if (ustress(i,j,bi,bj).gt.2.0D0) then                if (ustress(i,j,bi,bj).gt.windstressmax) then
127                  ustress(i,j,bi,bj)=2.0D0                  ustress(i,j,bi,bj)=windstressmax
128                endif                endif
129              enddo              enddo
130            enddo            enddo
# Line 135  CADJ STORE ustress(:,:,bi,bj) = comlev1_ Line 133  CADJ STORE ustress(:,:,bi,bj) = comlev1_
133  #endif  #endif
134            do j = jmin,jmax            do j = jmin,jmax
135              do i = imin,imax              do i = imin,imax
136                if (ustress(i,j,bi,bj).lt.-2.0D0) then                if (ustress(i,j,bi,bj).lt.-windstressmax) then
137                  ustress(i,j,bi,bj)=-2.0D0                  ustress(i,j,bi,bj)=-windstressmax
138                endif                endif
139              enddo              enddo
140            enddo            enddo
141            do j = jmin,jmax            IF ( stressIsOnCgrid ) THEN
142               do j = jmin,jmax
143              do i = imin+1,imax              do i = imin+1,imax
 #if (defined (ALLOW_BULKFORMULAE) || defined (USE_EXF_INTERPOLATION))  
 c     Shift wind stresses calculated at C-points to W/S points  
               fu(i,j,bi,bj) = exf_outscal_ustress*  
      &              (ustress(i,j,bi,bj)+ustress(i-1,j,bi,bj))/2.*  
      &              maskW(i,j,1,bi,bj)  
 #else  
144                fu(i,j,bi,bj) = exf_outscal_ustress*ustress(i,j,bi,bj)                fu(i,j,bi,bj) = exf_outscal_ustress*ustress(i,j,bi,bj)
 #endif  
145              enddo              enddo
146            enddo             enddo
147              ELSE
148               do j = jmin,jmax
149                do i = imin+1,imax
150    c     Shift wind stresses calculated at Grid-center to W/S points
151                  fu(i,j,bi,bj) = exf_outscal_ustress*
152         &              (ustress(i,j,bi,bj)+ustress(i-1,j,bi,bj))
153         &              *exf_half*maskW(i,j,1,bi,bj)
154                enddo
155               enddo
156              ENDIF
157    
158  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
159  CADJ STORE vstress(:,:,bi,bj) = comlev1_bibj, key=ikey, byte=isbyte  CADJ STORE vstress(:,:,bi,bj) = comlev1_bibj, key=ikey, byte=isbyte
# Line 159  CADJ STORE vstress(:,:,bi,bj) = comlev1_ Line 161  CADJ STORE vstress(:,:,bi,bj) = comlev1_
161            do j = jmin,jmax            do j = jmin,jmax
162              do i = imin,imax              do i = imin,imax
163  c             Meridional wind stress.  c             Meridional wind stress.
164                if (vstress(i,j,bi,bj).gt.2.0D0) then                if (vstress(i,j,bi,bj).gt.windstressmax) then
165                  vstress(i,j,bi,bj)=2.0D0                  vstress(i,j,bi,bj)=windstressmax
166                endif                endif
167              enddo              enddo
168            enddo            enddo
# Line 169  CADJ STORE vstress(:,:,bi,bj) = comlev1_ Line 171  CADJ STORE vstress(:,:,bi,bj) = comlev1_
171  #endif  #endif
172            do j = jmin,jmax            do j = jmin,jmax
173              do i = imin,imax              do i = imin,imax
174                if (vstress(i,j,bi,bj).lt.-2.0D0) then                if (vstress(i,j,bi,bj).lt.-windstressmax) then
175                  vstress(i,j,bi,bj)=-2.0D0                  vstress(i,j,bi,bj)=-windstressmax
176                endif                endif
177              enddo              enddo
178            enddo            enddo
179            do j = jmin+1,jmax            IF ( stressIsOnCgrid ) THEN
180               do j = jmin+1,jmax
181                do i = imin,imax
182                  fv(i,j,bi,bj) = exf_outscal_vstress*vstress(i,j,bi,bj)
183                enddo
184               enddo
185              ELSE
186               do j = jmin+1,jmax
187              do i = imin,imax              do i = imin,imax
 #if (defined (ALLOW_BULKFORMULAE) || defined (USE_EXF_INTERPOLATION))  
188  c     Shift wind stresses calculated at C-points to W/S points  c     Shift wind stresses calculated at C-points to W/S points
189                fv(i,j,bi,bj) = exf_outscal_vstress*                fv(i,j,bi,bj) = exf_outscal_vstress*
190       &              (vstress(i,j,bi,bj)+vstress(i,j-1,bi,bj))/2.*       &              (vstress(i,j,bi,bj)+vstress(i,j-1,bi,bj))
191       &              maskS(i,j,1,bi,bj)       &              *exf_half*maskS(i,j,1,bi,bj)
 #else  
               fv(i,j,bi,bj) = exf_outscal_vstress*vstress(i,j,bi,bj)  
 #endif  
192              enddo              enddo
193            enddo             enddo
194              ENDIF
195    
196  #ifdef SHORTWAVE_HEATING  #ifdef SHORTWAVE_HEATING
197  c             Short wave radiative flux.  c             Short wave radiative flux.
# Line 220  c             Short wave radiative flux. Line 226  c             Short wave radiative flux.
226            enddo            enddo
227  #endif  #endif
228    
229          enddo          ENDDO
230        enddo        ENDDO
231    
232  c     Update the tile edges.  c     Update the tile edges.
233    
234        _EXCH_XY_R4(  qnet, mythid )        _EXCH_XY_R4(  qnet, mythid )
235        _EXCH_XY_R4( empmr, mythid )        _EXCH_XY_R4( empmr, mythid )
 c      _EXCH_XY_R4(    fu, mythid )  
 c      _EXCH_XY_R4(    fv, mythid )  
236         CALL EXCH_UV_XY_RS(fu, fv, .TRUE., myThid)         CALL EXCH_UV_XY_RS(fu, fv, .TRUE., myThid)
237  #ifdef SHORTWAVE_HEATING  #ifdef SHORTWAVE_HEATING
238        _EXCH_XY_R4(   qsw, mythid )        _EXCH_XY_R4(   qsw, mythid )
# Line 243  c      _EXCH_XY_R4(    fv, mythid ) Line 247  c      _EXCH_XY_R4(    fv, mythid )
247        _EXCH_XY_R4( pload, mythid )        _EXCH_XY_R4( pload, mythid )
248  #endif  #endif
249    
250        end        RETURN
251          END

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.20

  ViewVC Help
Powered by ViewVC 1.1.22