/[MITgcm]/MITgcm/verification/tidal_basin_2d/code/external_forcing.F
ViewVC logotype

Annotation of /MITgcm/verification/tidal_basin_2d/code/external_forcing.F

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


Revision 1.3 - (hide annotations) (download)
Thu May 15 15:19:02 2003 UTC (21 years ago) by adcroft
Branch: MAIN
CVS Tags: checkpoint51e_post, checkpoint51k_post, checkpoint52l_pre, checkpoint52e_pre, checkpoint52n_post, checkpoint52j_post, checkpoint53d_post, checkpoint54a_pre, checkpoint51o_pre, checkpoint52e_post, checkpoint51n_pre, checkpoint54a_post, checkpoint53c_post, checkpoint51l_post, checkpoint51q_post, checkpoint51j_post, checkpoint50g_post, checkpoint50h_post, branch-netcdf, checkpoint52l_post, checkpoint51r_post, checkpoint52k_post, checkpoint52b_pre, checkpoint51a_post, checkpoint54b_post, checkpoint53b_pre, checkpoint52m_post, checkpoint51c_post, checkpoint53a_post, checkpoint54, checkpoint51f_pre, checkpoint53b_post, checkpoint51, checkpoint51o_post, checkpoint51p_post, checkpoint52a_pre, checkpoint51i_post, checkpoint53, checkpoint52, checkpoint51f_post, checkpoint52d_post, checkpoint51b_post, checkpoint51b_pre, checkpoint52a_post, checkpoint52b_post, checkpoint53g_post, checkpoint52f_post, branchpoint-genmake2, checkpoint52c_post, checkpoint51h_pre, checkpoint51l_pre, checkpoint51g_post, ecco_c52_e35, checkpoint50f_post, checkpoint50f_pre, checkpoint51d_post, checkpoint52i_post, checkpoint52j_pre, checkpoint53f_post, checkpoint51t_post, checkpoint53d_pre, checkpoint51n_post, checkpoint51i_pre, checkpoint50i_post, checkpoint52i_pre, checkpoint51u_post, checkpoint52h_pre, checkpoint52f_pre, checkpoint51m_post, checkpoint51s_post
Branch point for: branch-nonh, branch-genmake2, tg2-branch, checkpoint51n_branch, netcdf-sm0
Changes since 1.2: +2 -2 lines
Changed configuration:
 o 10 -> 30 levels
 o different profiles
 o variable resolution (dz)

1 adcroft 1.3 C $Header: /u/gcmpack/models/MITgcmUV/verification/tidal_basin_2d/code/external_forcing.F,v 1.2 2003/03/25 15:24:25 adcroft Exp $
2 adcroft 1.1 C $Name: $
3    
4     #include "CPP_OPTIONS.h"
5    
6     CBOP
7     C !ROUTINE: EXTERNAL_FORCING_U
8     C !INTERFACE:
9     SUBROUTINE EXTERNAL_FORCING_U(
10     I iMin, iMax, jMin, jMax,bi,bj,kLev,
11     I myCurrentTime,myThid)
12     C !DESCRIPTION: \bv
13     C *==========================================================*
14     C | S/R EXTERNAL_FORCING_U
15     C | o Contains problem specific forcing for zonal velocity.
16     C *==========================================================*
17     C | Adds terms to gU for forcing by external sources
18     C | e.g. wind stress, bottom friction etc..................
19     C *==========================================================*
20     C \ev
21    
22     C !USES:
23     IMPLICIT NONE
24     C == Global data ==
25     #include "SIZE.h"
26     #include "EEPARAMS.h"
27     #include "PARAMS.h"
28     #include "GRID.h"
29     #include "DYNVARS.h"
30     #include "FFIELDS.h"
31    
32     C !INPUT/OUTPUT PARAMETERS:
33     C == Routine arguments ==
34     C iMin - Working range of tile for applying forcing.
35     C iMax
36     C jMin
37     C jMax
38     C kLev
39     INTEGER iMin, iMax, jMin, jMax, kLev, bi, bj
40     _RL myCurrentTime
41     INTEGER myThid
42    
43     C !LOCAL VARIABLES:
44     C == Local variables ==
45     C Loop counters
46     INTEGER I, J
47     C number of surface interface layer
48     INTEGER kSurface
49     _RL tidal_freq,tidal_Hscale
50     _RL Coord2longitude,longitud1,longitud2
51     CEOP
52    
53     if ( buoyancyRelation .eq. 'OCEANICP' ) then
54     kSurface = Nr
55     else
56     kSurface = 1
57     endif
58    
59     C-- Forcing term
60     C Add windstress momentum impulse into the top-layer
61     IF ( kLev .EQ. kSurface ) THEN
62     DO j=jMin,jMax
63     DO i=iMin,iMax
64     gU(i,j,kLev,bi,bj) = gU(i,j,kLev,bi,bj)
65     & +foFacMom*surfaceTendencyU(i,j,bi,bj)
66     & *_maskW(i,j,kLev,bi,bj)
67     ENDDO
68     ENDDO
69     ENDIF
70    
71     C-- Tidal body force: written as gradient of geopotential
72     C True M2 frequency is
73     c tidal_freq=2.*pi/(43200.+25.*60.)
74     C But for convenience we are using 12 hour period
75     tidal_freq=2.*pi/(43200.)
76     C Make the tide relatively strong (about 1 m)
77 adcroft 1.2 tidal_Hscale=10.
78 adcroft 1.1 IF ( usingCartesianGrid ) THEN
79     Coord2longitude=1./rSphere
80     ELSEIF ( usingSphericalPolarGrid ) THEN
81     Coord2longitude=pi/180.
82     ELSE
83     STOP 'Be careful about 2D!'
84     ENDIF
85     DO j=jMin,jMax
86     DO i=iMin+1,iMax
87     longitud1=XC(i-1,j,bi,bj)*Coord2longitude
88     longitud2=XC(i,j,bi,bj)*Coord2longitude
89     gU(i,j,kLev,bi,bj) = gU(i,j,kLev,bi,bj)
90     & +gravity*tidal_Hscale*
91 adcroft 1.2 & ( SIN( tidal_freq*myCurrentTime + 2.*longitud2 )
92     & -SIN( tidal_freq*myCurrentTime + 2.*longitud1 )
93 adcroft 1.1 & )*recip_DXC(i,j,bi,bj)
94     & *_maskW(i,j,kLev,bi,bj)
95 adcroft 1.3 c & *min( myCurrentTime/86400. , 1.)
96 adcroft 1.1 ENDDO
97     ENDDO
98    
99     #if (defined (ALLOW_OBCS) && defined (ALLOW_OBCS_SPONGE))
100     IF (useOBCS) THEN
101     CALL OBCS_SPONGE_U(
102     I iMin, iMax, jMin, jMax,bi,bj,kLev,
103     I myCurrentTime,myThid)
104     ENDIF
105     #endif
106    
107     RETURN
108     END
109     CBOP
110     C !ROUTINE: EXTERNAL_FORCING_V
111     C !INTERFACE:
112     SUBROUTINE EXTERNAL_FORCING_V(
113     I iMin, iMax, jMin, jMax,bi,bj,kLev,
114     I myCurrentTime,myThid)
115     C !DESCRIPTION: \bv
116     C *==========================================================*
117     C | S/R EXTERNAL_FORCING_V
118     C | o Contains problem specific forcing for merid velocity.
119     C *==========================================================*
120     C | Adds terms to gV for forcing by external sources
121     C | e.g. wind stress, bottom friction etc..................
122     C *==========================================================*
123     C \ev
124    
125     C !USES:
126     IMPLICIT NONE
127     C == Global data ==
128     #include "SIZE.h"
129     #include "EEPARAMS.h"
130     #include "PARAMS.h"
131     #include "GRID.h"
132     #include "DYNVARS.h"
133     #include "FFIELDS.h"
134    
135     C !INPUT/OUTPUT PARAMETERS:
136     C == Routine arguments ==
137     C iMin - Working range of tile for applying forcing.
138     C iMax
139     C jMin
140     C jMax
141     C kLev
142     INTEGER iMin, iMax, jMin, jMax, kLev, bi, bj
143     _RL myCurrentTime
144     INTEGER myThid
145    
146     C !LOCAL VARIABLES:
147     C == Local variables ==
148     C Loop counters
149     INTEGER I, J
150     C number of surface interface layer
151     INTEGER kSurface
152     CEOP
153    
154     if ( buoyancyRelation .eq. 'OCEANICP' ) then
155     kSurface = Nr
156     else
157     kSurface = 1
158     endif
159    
160     C-- Forcing term
161     C Add windstress momentum impulse into the top-layer
162     IF ( kLev .EQ. kSurface ) THEN
163     DO j=jMin,jMax
164     DO i=iMin,iMax
165     gV(i,j,kLev,bi,bj) = gV(i,j,kLev,bi,bj)
166     & +foFacMom*surfaceTendencyV(i,j,bi,bj)
167     & *_maskS(i,j,kLev,bi,bj)
168     ENDDO
169     ENDDO
170     ENDIF
171    
172     #if (defined (ALLOW_OBCS) && defined (ALLOW_OBCS_SPONGE))
173     IF (useOBCS) THEN
174     CALL OBCS_SPONGE_V(
175     I iMin, iMax, jMin, jMax,bi,bj,kLev,
176     I myCurrentTime,myThid)
177     ENDIF
178     #endif
179    
180     RETURN
181     END
182     CBOP
183     C !ROUTINE: EXTERNAL_FORCING_T
184     C !INTERFACE:
185     SUBROUTINE EXTERNAL_FORCING_T(
186     I iMin, iMax, jMin, jMax,bi,bj,kLev,
187     I myCurrentTime,myThid)
188     C !DESCRIPTION: \bv
189     C *==========================================================*
190     C | S/R EXTERNAL_FORCING_T
191     C | o Contains problem specific forcing for temperature.
192     C *==========================================================*
193     C | Adds terms to gT for forcing by external sources
194     C | e.g. heat flux, climatalogical relaxation..............
195     C *==========================================================*
196     C \ev
197    
198     C !USES:
199     IMPLICIT NONE
200     C == Global data ==
201     #include "SIZE.h"
202     #include "EEPARAMS.h"
203     #include "PARAMS.h"
204     #include "GRID.h"
205     #include "DYNVARS.h"
206     #include "FFIELDS.h"
207     #ifdef SHORTWAVE_HEATING
208     integer two
209     _RL minusone
210     parameter (two=2,minusone=-1.)
211     _RL swfracb(two)
212     #endif
213    
214     C !INPUT/OUTPUT PARAMETERS:
215     C == Routine arguments ==
216     C iMin - Working range of tile for applying forcing.
217     C iMax
218     C jMin
219     C jMax
220     C kLev
221     INTEGER iMin, iMax, jMin, jMax, kLev, bi, bj
222     _RL myCurrentTime
223     INTEGER myThid
224     CEndOfInterface
225    
226     C !LOCAL VARIABLES:
227     C == Local variables ==
228     C Loop counters
229     INTEGER I, J
230     C number of surface interface layer
231     INTEGER kSurface
232     CEOP
233    
234     if ( buoyancyRelation .eq. 'OCEANICP' ) then
235     kSurface = Nr
236     else
237     kSurface = 1
238     endif
239    
240     C-- Forcing term
241     C Add heat in top-layer
242     IF ( kLev .EQ. kSurface ) THEN
243     DO j=jMin,jMax
244     DO i=iMin,iMax
245     gT(i,j,kLev,bi,bj)=gT(i,j,kLev,bi,bj)
246     & +maskC(i,j,kLev,bi,bj)*surfaceTendencyT(i,j,bi,bj)
247     ENDDO
248     ENDDO
249     ENDIF
250    
251     #ifdef SHORTWAVE_HEATING
252     C Penetrating SW radiation
253     swfracb(1)=abs(rF(klev))
254     swfracb(2)=abs(rF(klev+1))
255     call SWFRAC(
256     I two,minusone,
257     I myCurrentTime,myThid,
258     O swfracb)
259     DO j=jMin,jMax
260     DO i=iMin,iMax
261     gT(i,j,klev,bi,bj) = gT(i,j,klev,bi,bj)
262     & -maskC(i,j,klev,bi,bj)*Qsw(i,j,bi,bj)*(swfracb(1)-swfracb(2))
263     & *recip_Cp*recip_rhoConst*recip_drF(klev)
264     ENDDO
265     ENDDO
266     #endif
267    
268     #if (defined (ALLOW_OBCS) && defined (ALLOW_OBCS_SPONGE))
269     IF (useOBCS) THEN
270     CALL OBCS_SPONGE_T(
271     I iMin, iMax, jMin, jMax,bi,bj,kLev,
272     I myCurrentTime,myThid)
273     ENDIF
274     #endif
275    
276     RETURN
277     END
278     CBOP
279     C !ROUTINE: EXTERNAL_FORCING_S
280     C !INTERFACE:
281     SUBROUTINE EXTERNAL_FORCING_S(
282     I iMin, iMax, jMin, jMax,bi,bj,kLev,
283     I myCurrentTime,myThid)
284    
285     C !DESCRIPTION: \bv
286     C *==========================================================*
287     C | S/R EXTERNAL_FORCING_S
288     C | o Contains problem specific forcing for merid velocity.
289     C *==========================================================*
290     C | Adds terms to gS for forcing by external sources
291     C | e.g. fresh-water flux, climatalogical relaxation.......
292     C *==========================================================*
293     C \ev
294    
295     C !USES:
296     IMPLICIT NONE
297     C == Global data ==
298     #include "SIZE.h"
299     #include "EEPARAMS.h"
300     #include "PARAMS.h"
301     #include "GRID.h"
302     #include "DYNVARS.h"
303     #include "FFIELDS.h"
304    
305     C !INPUT/OUTPUT PARAMETERS:
306     C == Routine arguments ==
307     C iMin - Working range of tile for applying forcing.
308     C iMax
309     C jMin
310     C jMax
311     C kLev
312     INTEGER iMin, iMax, jMin, jMax, kLev, bi, bj
313     _RL myCurrentTime
314     INTEGER myThid
315    
316     C !LOCAL VARIABLES:
317     C == Local variables ==
318     C Loop counters
319     INTEGER I, J
320     C number of surface interface layer
321     INTEGER kSurface
322     CEOP
323    
324     if ( buoyancyRelation .eq. 'OCEANICP' ) then
325     kSurface = Nr
326     else
327     kSurface = 1
328     endif
329    
330    
331     C-- Forcing term
332     C Add fresh-water in top-layer
333     IF ( kLev .EQ. kSurface ) THEN
334     DO j=jMin,jMax
335     DO i=iMin,iMax
336     gS(i,j,kLev,bi,bj)=gS(i,j,kLev,bi,bj)
337     & +maskC(i,j,kLev,bi,bj)*surfaceTendencyS(i,j,bi,bj)
338     ENDDO
339     ENDDO
340     ENDIF
341    
342     #if (defined (ALLOW_OBCS) && defined (ALLOW_OBCS_SPONGE))
343     IF (useOBCS) THEN
344     CALL OBCS_SPONGE_S(
345     I iMin, iMax, jMin, jMax,bi,bj,kLev,
346     I myCurrentTime,myThid)
347     ENDIF
348     #endif
349    
350     RETURN
351     END

  ViewVC Help
Powered by ViewVC 1.1.22