/[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.1 by heimbach, Mon May 14 22:08:41 2001 UTC revision 1.10 by mlosch, Mon Apr 19 22:30:46 2004 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( mythid )
       subroutine exf_MapFields(  
      I                          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
42  c     ==================================================================  c     ==================================================================
43    
44        implicit none        implicit none
# Line 62  c     == global variables == Line 48  c     == global variables ==
48  #include "EEPARAMS.h"  #include "EEPARAMS.h"
49  #include "SIZE.h"  #include "SIZE.h"
50  #include "FFIELDS.h"  #include "FFIELDS.h"
51    #include "GRID.h"
52    
53    #include "exf_param.h"
54  #include "exf_constants.h"  #include "exf_constants.h"
55  #include "exf_fields.h"  #include "exf_fields.h"
56  #include "exf_clim_fields.h"  #include "exf_clim_fields.h"
57    #ifdef ALLOW_AUTODIFF_TAMC
58    # include "tamc.h"
59    # include "tamc_keys.h"
60    #endif
61  c     == routine arguments ==  c     == routine arguments ==
62    
63  c     mythid - thread number for this instance of the routine.  c     mythid - thread number for this instance of the routine.
# Line 84  c     == local variables == Line 76  c     == local variables ==
76        integer jmax        integer jmax
77        integer imin        integer imin
78        integer imax        integer imax
       _RL     scal_hfl  
       _RL     scal_ust  
       _RL     scal_vst  
       _RL     scal_swf  
       _RL     scal_sst  
       _RL     scal_sss  
 #if (defined (ALLOW_BULKFORMULAE) && defined (ALLOW_ATM_TEMP))  
       _RL     scal_prc  
 #else  
       _RL     scal_sfl  
 #endif  
79    
80  c     == end of interface ==  c     == end of interface ==
81    
# Line 107  c     == end of interface == Line 88  c     == end of interface ==
88        imin = 1-olx        imin = 1-olx
89        imax = snx+olx        imax = snx+olx
90    
       scal_hfl =  1. _d 0  
       scal_ust =  -1. _d 0  
       scal_vst =  -1. _d 0  
       scal_swf =  1. _d 0  
       scal_sst =  1. _d 0  
       scal_sss =  1. _d 0  
 #if (defined (ALLOW_BULKFORMULAE) && defined (ALLOW_ATM_TEMP))  
       scal_prc =  1. _d 0  
 #else  
       scal_sfl =  1. _d 0      
 #endif  
   
91        do bj = jtlo,jthi        do bj = jtlo,jthi
92          do bi = itlo,ithi          do bi = itlo,ithi
93    
94    #ifdef ALLOW_AUTODIFF_TAMC
95              act1 = bi - myBxLo(myThid)
96              max1 = myBxHi(myThid) - myBxLo(myThid) + 1
97              act2 = bj - myByLo(myThid)
98              max2 = myByHi(myThid) - myByLo(myThid) + 1
99              act3 = myThid - 1
100              max3 = nTx*nTy
101              act4 = ikey_dynamics - 1
102              ikey = (act1 + 1) + act2*max1
103         &                      + act3*max1*max2
104         &                      + act4*max1*max2*max3
105    #endif /* ALLOW_AUTODIFF_TAMC */
106    
107            do j = jmin,jmax            do j = jmin,jmax
108              do i = imin,imax              do i = imin,imax
109    c            Heat flux.
110                 qnet(i,j,bi,bj) = exf_outscal_hflux*hflux(i,j,bi,bj)
111                enddo
112              enddo
113    
 c             Heat flux.  
               qnet(i,j,bi,bj)  = scal_hfl*hflux(i,j,bi,bj)  
114    
115  c             Salt flux.            do j = jmin,jmax
116  #if (defined (ALLOW_BULKFORMULAE)  && defined (ALLOW_ATM_TEMP))              do i = imin,imax
117                empmr(i,j,bi,bj) = scal_prc*precip(i,j,bi,bj)  c            Salt flux.
118  #else               empmr(i,j,bi,bj)= exf_outscal_sflux*sflux(i,j,bi,bj)
119                empmr(i,j,bi,bj) = scal_sfl*sflux(i,j,bi,bj)              enddo
120  #endif            enddo
121    
122    #ifdef ALLOW_AUTODIFF_TAMC
123    CADJ STORE ustress(:,:,bi,bj) = comlev1_bibj, key=ikey, byte=isbyte
124    #endif
125              do j = jmin,jmax
126                do i = imin,imax
127  c             Zonal wind stress.  c             Zonal wind stress.
128                fu(i,j,bi,bj)    = scal_ust*ustress(i,j,bi,bj)                if (ustress(i,j,bi,bj).gt.windstressmax) then
129                    ustress(i,j,bi,bj)=windstressmax
130                  endif
131                enddo
132              enddo
133    #ifdef ALLOW_AUTODIFF_TAMC
134    CADJ STORE ustress(:,:,bi,bj) = comlev1_bibj, key=ikey, byte=isbyte
135    #endif
136              do j = jmin,jmax
137                do i = imin,imax
138                  if (ustress(i,j,bi,bj).lt.-windstressmax) then
139                    ustress(i,j,bi,bj)=-windstressmax
140                  endif
141                enddo
142              enddo
143              do j = jmin,jmax
144                do i = imin+1,imax
145    #if (defined (ALLOW_BULKFORMULAE) || defined (USE_EXF_INTERPOLATION))
146    c     Shift wind stresses calculated at C-points to W/S points
147                  fu(i,j,bi,bj) = exf_outscal_ustress*
148         &              (ustress(i,j,bi,bj)+ustress(i-1,j,bi,bj))/2.*
149         &              maskW(i,j,1,bi,bj)
150    #else
151                  fu(i,j,bi,bj) = exf_outscal_ustress*ustress(i,j,bi,bj)
152    #endif
153                enddo
154              enddo
155    
156    #ifdef ALLOW_AUTODIFF_TAMC
157    CADJ STORE vstress(:,:,bi,bj) = comlev1_bibj, key=ikey, byte=isbyte
158    #endif
159              do j = jmin,jmax
160                do i = imin,imax
161  c             Meridional wind stress.  c             Meridional wind stress.
162                fv(i,j,bi,bj)    = scal_vst*vstress(i,j,bi,bj)                if (vstress(i,j,bi,bj).gt.windstressmax) then
163                    vstress(i,j,bi,bj)=windstressmax
164                  endif
165                enddo
166              enddo
167    #ifdef ALLOW_AUTODIFF_TAMC
168    CADJ STORE vstress(:,:,bi,bj) = comlev1_bibj, key=ikey, byte=isbyte
169    #endif
170              do j = jmin,jmax
171                do i = imin,imax
172                  if (vstress(i,j,bi,bj).lt.-windstressmax) then
173                    vstress(i,j,bi,bj)=-windstressmax
174                  endif
175                enddo
176              enddo
177              do j = jmin+1,jmax
178                do i = imin,imax
179    #if (defined (ALLOW_BULKFORMULAE) || defined (USE_EXF_INTERPOLATION))
180    c     Shift wind stresses calculated at C-points to W/S points
181                  fv(i,j,bi,bj) = exf_outscal_vstress*
182         &              (vstress(i,j,bi,bj)+vstress(i,j-1,bi,bj))/2.*
183         &              maskS(i,j,1,bi,bj)
184    #else
185                  fv(i,j,bi,bj) = exf_outscal_vstress*vstress(i,j,bi,bj)
186    #endif
187                enddo
188              enddo
189    
190  #ifdef ALLOW_KPP || (defined (ALLOW_BULKFORMULAE) && defined (ALLOW_ATM_TEMP)))  #ifdef SHORTWAVE_HEATING
191  c             Short wave radiative flux.  c             Short wave radiative flux.
192                qsw(i,j,bi,bj)   = scal_swf*swflux(i,j,bi,bj)            do j = jmin,jmax
193                do i = imin,imax
194                 qsw(i,j,bi,bj)  = exf_outscal_swflux*swflux(i,j,bi,bj)
195                enddo
196              enddo
197  #endif  #endif
198    
199  #ifdef ALLOW_CLIMSST_RELAXATION  #ifdef ALLOW_CLIMSST_RELAXATION
200                sst(i,j,bi,bj)   = scal_sst*climsst(i,j,bi,bj)            do j = jmin,jmax
201                do i = imin,imax
202                 sst(i,j,bi,bj)  = exf_outscal_sst*climsst(i,j,bi,bj)
203                enddo
204              enddo
205  #endif  #endif
206    
207  #ifdef ALLOW_CLIMSSS_RELAXATION  #ifdef ALLOW_CLIMSSS_RELAXATION
208                sss(i,j,bi,bj)   = scal_sss*climsss(i,j,bi,bj)            do j = jmin,jmax
209                do i = imin,imax
210                 sss(i,j,bi,bj)  = exf_outscal_sss*climsss(i,j,bi,bj)
211                enddo
212              enddo
213  #endif  #endif
214    
215    #ifdef ATMOSPHERIC_LOADING
216              do j = jmin,jmax
217                do i = imin,imax
218                 pload(i,j,bi,bj)=exf_outscal_apressure*apressure(i,j,bi,bj)
219              enddo              enddo
220            enddo            enddo
221    #endif
222    
223          enddo          enddo
224        enddo        enddo
225    
# Line 162  c     Update the tile edges. Line 227  c     Update the tile edges.
227    
228        _EXCH_XY_R4(  qnet, mythid )        _EXCH_XY_R4(  qnet, mythid )
229        _EXCH_XY_R4( empmr, mythid )        _EXCH_XY_R4( empmr, mythid )
230        _EXCH_XY_R4(    fu, mythid )  c      _EXCH_XY_R4(    fu, mythid )
231        _EXCH_XY_R4(    fv, mythid )  c      _EXCH_XY_R4(    fv, mythid )
232  #ifdef ALLOW_KPP         CALL EXCH_UV_XY_RS(fu, fv, .TRUE., myThid)
233    #ifdef SHORTWAVE_HEATING
234        _EXCH_XY_R4(   qsw, mythid )        _EXCH_XY_R4(   qsw, mythid )
235  #endif  #endif
236  #ifdef ALLOW_CLIMSST_RELAXATION  #ifdef ALLOW_CLIMSST_RELAXATION
# Line 173  c     Update the tile edges. Line 239  c     Update the tile edges.
239  #ifdef ALLOW_CLIMSSS_RELAXATION  #ifdef ALLOW_CLIMSSS_RELAXATION
240        _EXCH_XY_R4(   sss, mythid )        _EXCH_XY_R4(   sss, mythid )
241  #endif  #endif
242    #ifdef ATMOSPHERIC_LOADING
243          _EXCH_XY_R4( pload, mythid )
244    #endif
245    
246        end        end

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.10

  ViewVC Help
Powered by ViewVC 1.1.22