/[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.2 by heimbach, Tue Nov 12 20:34:41 2002 UTC revision 1.16 by heimbach, Thu Mar 2 15:30:11 2006 UTC
# Line 1  Line 1 
1  c $Header$  c $Header$
2    
3  #include "EXF_CPPOPTIONS.h"  #include "EXF_OPTIONS.h"
4    
5          subroutine exf_mapfields( mytime, myiter, mythid )
       subroutine exf_mapfields( mythid )  
6    
7  c     ==================================================================  c     ==================================================================
8  c     SUBROUTINE exf_mapfields  c     SUBROUTINE exf_mapfields
9  c     ==================================================================  c     ==================================================================
10  c  c
11  c     o Map the external forcing fields on the ocean model arrays. This  c     o Map external forcing fields (ustress, vstress, hflux, sflux,
12  c       routine is included to separate the ocean state estimation tool  c       swflux, apressure, climsss, climsst, etc.) onto ocean model
13  c       as much as possible from the ocean model. Unit conversion factors  c       arrays (fu, fv, Qnet, EmPmR, Qsw, pload, sss, sst, etc.).
14  c       are to be set by the user.  c       This routine is included to separate the ocean state estimation
15  c  c       tool as much as possible from the ocean model.  Unit and sign
16  c       The units have to be such that the individual forcing record has  c       conventions can be customized using variables exf_outscal_*,
17  c       units equal to [quantity/s]. See the header file *FFIELDS.h* of  c       which are set in exf_readparms.F.  See the header files
18  c       the MITgcmuv.  c       exf_fields.h and FFIELDS.h for definitions of the various input
19  c  c       and output fields and for default unit and sign convetions.
 c       Required units such that no scaling has to be applied:  
 c  
 c       heat flux:          input file W/m^2  
 c       salt flux:          input file m/s  
 c       zonal wind stress:  input file N/m^2  
 c       merid. wind stress: input file N/m^2  
 c  
 c       To allow for such unit conversions this routine contains scaling  
 c       factors scal_quantity.  
20  c  c
21  c     started: Christian Eckert eckert@mit.edu  09-Aug-1999  c     started: Christian Eckert eckert@mit.edu  09-Aug-1999
22  c  c
23  c     changed: Christian Eckert eckert@mit.edu  11-Jan-2000  c     changed: Christian Eckert eckert@mit.edu  11-Jan-2000
 c  
24  c              - Restructured the code in order to create a package  c              - Restructured the code in order to create a package
25  c                for the MITgcmUV.  c                for the MITgcmUV.
26  c  c
27  c              Christian Eckert eckert@mit.edu  12-Feb-2000  c              Christian Eckert eckert@mit.edu  12-Feb-2000
 c  
28  c              - Changed Routine names (package prefix: exf_)  c              - Changed Routine names (package prefix: exf_)
29  c  c
30  c              Patrick Heimbach, heimbach@mit.edu  06-May-2000  c              Patrick Heimbach, heimbach@mit.edu  06-May-2000
 c  
31  c              - added and changed CPP flag structure for  c              - added and changed CPP flag structure for
32  c                ALLOW_BULKFORMULAE, ALLOW_ATM_TEMP  c                ALLOW_BULKFORMULAE, ALLOW_ATM_TEMP
33  c  c
34  c              Patrick Heimbach, heimbach@mit.edu  23-May-2000  c              Patrick Heimbach, heimbach@mit.edu  23-May-2000
 c  
35  c              - sign change of ustress/vstress incorporated into  c              - sign change of ustress/vstress incorporated into
36  c                scaling factors scal_ust, scal_vst  c                scaling factors exf_outscal_ust, exf_outscal_vst
37    c
38    c     mods for pkg/seaice: menemenlis@jpl.nasa.gov 20-Dec-2002
39  c  c
40  c     ==================================================================  c     ==================================================================
41  c     SUBROUTINE exf_mapfields  c     SUBROUTINE exf_mapfields
# Line 59  c     == global variables == Line 47  c     == global variables ==
47    
48  #include "EEPARAMS.h"  #include "EEPARAMS.h"
49  #include "SIZE.h"  #include "SIZE.h"
50    #include "PARAMS.h"
51  #include "FFIELDS.h"  #include "FFIELDS.h"
52    #include "GRID.h"
53    
54  #include "exf_param.h"  #include "exf_param.h"
55  #include "exf_constants.h"  #include "exf_constants.h"
56  #include "exf_fields.h"  #include "exf_fields.h"
57    #include "exf_clim_param.h"
58  #include "exf_clim_fields.h"  #include "exf_clim_fields.h"
59  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
60  # include "tamc.h"  # include "tamc.h"
# Line 73  c     == routine arguments == Line 65  c     == routine arguments ==
65  c     mythid - thread number for this instance of the routine.  c     mythid - thread number for this instance of the routine.
66    
67        integer mythid        integer mythid
68          integer myiter
69          _RL     mytime
70    
71  c     == local variables ==  c     == local variables ==
72    
73        integer bi,bj        integer bi,bj
74        integer i,j        integer i,j,k
75        integer jtlo        integer jtlo
76        integer jthi        integer jthi
77        integer itlo        integer itlo
# Line 116  c     == end of interface == Line 110  c     == end of interface ==
110    
111            do j = jmin,jmax            do j = jmin,jmax
112              do i = imin,imax              do i = imin,imax
113  c             Heat flux.  c            Heat flux.
114                qnet(i,j,bi,bj)  = scal_hfl*hflux(i,j,bi,bj)               qnet(i,j,bi,bj) = exf_outscal_hflux*hflux(i,j,bi,bj)
115                 if ( hfluxfile .EQ. ' ' )
116         &            qnet(i,j,bi,bj) = qnet(i,j,bi,bj) -
117         &            exf_outscal_hflux * ( hflux_exfremo_intercept +
118         &            hflux_exfremo_slope*(mytime-starttime) )
119              enddo              enddo
120            enddo            enddo
121    
122    
123            do j = jmin,jmax            do j = jmin,jmax
124              do i = imin,imax              do i = imin,imax
125  c             Salt flux.  c            Salt flux.
126  #if (defined (ALLOW_BULKFORMULAE)  && defined (ALLOW_ATM_TEMP))               empmr(i,j,bi,bj)= exf_outscal_sflux*sflux(i,j,bi,bj)
127                empmr(i,j,bi,bj) = scal_prc*precip(i,j,bi,bj)               if ( sfluxfile .EQ. ' ' )
128  #else       &            empmr(i,j,bi,bj) = empmr(i,j,bi,bj) -
129                empmr(i,j,bi,bj) = scal_sfl*sflux(i,j,bi,bj)       &            exf_outscal_sflux * ( sflux_exfremo_intercept +
130  #endif       &            sflux_exfremo_slope*(mytime-starttime) )
131              enddo              enddo
132            enddo            enddo
133    
# Line 139  CADJ STORE ustress(:,:,bi,bj) = comlev1_ Line 137  CADJ STORE ustress(:,:,bi,bj) = comlev1_
137            do j = jmin,jmax            do j = jmin,jmax
138              do i = imin,imax              do i = imin,imax
139  c             Zonal wind stress.  c             Zonal wind stress.
140                if (ustress(i,j,bi,bj).gt.2.0D0) then                if (ustress(i,j,bi,bj).gt.windstressmax) then
141                  ustress(i,j,bi,bj)=2.0D0                  ustress(i,j,bi,bj)=windstressmax
142                endif                endif
143              enddo              enddo
144            enddo            enddo
# Line 149  CADJ STORE ustress(:,:,bi,bj) = comlev1_ Line 147  CADJ STORE ustress(:,:,bi,bj) = comlev1_
147  #endif  #endif
148            do j = jmin,jmax            do j = jmin,jmax
149              do i = imin,imax              do i = imin,imax
150                if (ustress(i,j,bi,bj).lt.-2.0D0) then                if (ustress(i,j,bi,bj).lt.-windstressmax) then
151                  ustress(i,j,bi,bj)=-2.0D0                  ustress(i,j,bi,bj)=-windstressmax
152                endif                endif
153              enddo              enddo
154            enddo            enddo
155            do j = jmin,jmax            do j = jmin,jmax
156              do i = imin,imax              do i = imin+1,imax
157                fu(i,j,bi,bj)    = scal_ust*ustress(i,j,bi,bj)  #if (defined (ALLOW_BULKFORMULAE) || defined (USE_EXF_INTERPOLATION))
158    c     Shift wind stresses calculated at C-points to W/S points
159                  fu(i,j,bi,bj) = exf_outscal_ustress*
160         &              (ustress(i,j,bi,bj)+ustress(i-1,j,bi,bj))/2.*
161         &              maskW(i,j,1,bi,bj)
162    #else
163                  fu(i,j,bi,bj) = exf_outscal_ustress*ustress(i,j,bi,bj)
164    #endif
165              enddo              enddo
166            enddo            enddo
167    
# Line 166  CADJ STORE vstress(:,:,bi,bj) = comlev1_ Line 171  CADJ STORE vstress(:,:,bi,bj) = comlev1_
171            do j = jmin,jmax            do j = jmin,jmax
172              do i = imin,imax              do i = imin,imax
173  c             Meridional wind stress.  c             Meridional wind stress.
174                if (vstress(i,j,bi,bj).gt.2.0D0) then                if (vstress(i,j,bi,bj).gt.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
# Line 176  CADJ STORE vstress(:,:,bi,bj) = comlev1_ Line 181  CADJ STORE vstress(:,:,bi,bj) = comlev1_
181  #endif  #endif
182            do j = jmin,jmax            do j = jmin,jmax
183              do i = imin,imax              do i = imin,imax
184                if (vstress(i,j,bi,bj).lt.-2.0D0) then                if (vstress(i,j,bi,bj).lt.-windstressmax) then
185                  vstress(i,j,bi,bj)=-2.0D0                  vstress(i,j,bi,bj)=-windstressmax
186                endif                endif
187              enddo              enddo
188            enddo            enddo
189            do j = jmin,jmax            do j = jmin+1,jmax
190              do i = imin,imax              do i = imin,imax
191                fv(i,j,bi,bj)    = scal_vst*vstress(i,j,bi,bj)  #if (defined (ALLOW_BULKFORMULAE) || defined (USE_EXF_INTERPOLATION))
192    c     Shift wind stresses calculated at C-points to W/S points
193                  fv(i,j,bi,bj) = exf_outscal_vstress*
194         &              (vstress(i,j,bi,bj)+vstress(i,j-1,bi,bj))/2.*
195         &              maskS(i,j,1,bi,bj)
196    #else
197                  fv(i,j,bi,bj) = exf_outscal_vstress*vstress(i,j,bi,bj)
198    #endif
199              enddo              enddo
200            enddo            enddo
201    
202  #ifdef ALLOW_KPP || \  #ifdef SHORTWAVE_HEATING
  (defined (ALLOW_BULKFORMULAE) && defined (ALLOW_ATM_TEMP)))  
203  c             Short wave radiative flux.  c             Short wave radiative flux.
204            do j = jmin,jmax            do j = jmin,jmax
205              do i = imin,imax              do i = imin,imax
206                qsw(i,j,bi,bj)   = scal_swf*swflux(i,j,bi,bj)               qsw(i,j,bi,bj)  = exf_outscal_swflux*swflux(i,j,bi,bj)
207              enddo              enddo
208            enddo            enddo
209  #endif  #endif
# Line 200  c             Short wave radiative flux. Line 211  c             Short wave radiative flux.
211  #ifdef ALLOW_CLIMSST_RELAXATION  #ifdef ALLOW_CLIMSST_RELAXATION
212            do j = jmin,jmax            do j = jmin,jmax
213              do i = imin,imax              do i = imin,imax
214                sst(i,j,bi,bj)   = scal_sst*climsst(i,j,bi,bj)               sst(i,j,bi,bj)  = exf_outscal_sst*climsst(i,j,bi,bj)
215              enddo              enddo
216            enddo            enddo
217  #endif  #endif
# Line 208  c             Short wave radiative flux. Line 219  c             Short wave radiative flux.
219  #ifdef ALLOW_CLIMSSS_RELAXATION  #ifdef ALLOW_CLIMSSS_RELAXATION
220            do j = jmin,jmax            do j = jmin,jmax
221              do i = imin,imax              do i = imin,imax
222                sss(i,j,bi,bj)   = scal_sss*climsss(i,j,bi,bj)               sss(i,j,bi,bj)  = exf_outscal_sss*climsss(i,j,bi,bj)
223              enddo              enddo
224            enddo            enddo
225  #endif  #endif
# Line 216  c             Short wave radiative flux. Line 227  c             Short wave radiative flux.
227  #ifdef ATMOSPHERIC_LOADING  #ifdef ATMOSPHERIC_LOADING
228            do j = jmin,jmax            do j = jmin,jmax
229              do i = imin,imax              do i = imin,imax
230                pload(i,j,bi,bj) = scal_apressure*apressure(i,j,bi,bj)               pload(i,j,bi,bj)=exf_outscal_apressure*apressure(i,j,bi,bj)
231              enddo              enddo
232            enddo            enddo
233  #endif  #endif
234    
   
235          enddo          enddo
236        enddo        enddo
237    
# Line 229  c     Update the tile edges. Line 239  c     Update the tile edges.
239    
240        _EXCH_XY_R4(  qnet, mythid )        _EXCH_XY_R4(  qnet, mythid )
241        _EXCH_XY_R4( empmr, mythid )        _EXCH_XY_R4( empmr, mythid )
242        _EXCH_XY_R4(    fu, mythid )  c      _EXCH_XY_R4(    fu, mythid )
243        _EXCH_XY_R4(    fv, mythid )  c      _EXCH_XY_R4(    fv, mythid )
244  #ifdef ALLOW_KPP         CALL EXCH_UV_XY_RS(fu, fv, .TRUE., myThid)
245    #ifdef SHORTWAVE_HEATING
246        _EXCH_XY_R4(   qsw, mythid )        _EXCH_XY_R4(   qsw, mythid )
247  #endif  #endif
248  #ifdef ALLOW_CLIMSST_RELAXATION  #ifdef ALLOW_CLIMSST_RELAXATION

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

  ViewVC Help
Powered by ViewVC 1.1.22