/[MITgcm]/MITgcm/verification/internal_wave/code/obcs_calc.F
ViewVC logotype

Diff of /MITgcm/verification/internal_wave/code/obcs_calc.F

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

revision 1.1.2.1 by adcroft, Wed Jan 31 23:31:52 2001 UTC revision 1.7 by jmc, Mon Feb 28 16:31:36 2011 UTC
# Line 3  C $Name$ Line 3  C $Name$
3    
4  #include "OBCS_OPTIONS.h"  #include "OBCS_OPTIONS.h"
5    
6        SUBROUTINE OBCS_CALC( bi, bj, futureTime,        SUBROUTINE OBCS_CALC( futureTime, futureIter,
7       &                      uVel, vVel, wVel, theta, salt,       &                      uVel, vVel, wVel, theta, salt,
8       &                      myThid )       &                      myThid )
9  C     /==========================================================\  C     *==========================================================*
10  C     | SUBROUTINE OBCS_CALC                                     |  C     | SUBROUTINE OBCS_CALC
11  C     | o Calculate future boundary data at open boundaries      |  C     | o Calculate future boundary data at open boundaries
12  C     |   at time = futureTime                                   |  C     |   at time = futureTime
13  C     |==========================================================|  C     *==========================================================*
 C     |                                                          |  
 C     \==========================================================/  
14        IMPLICIT NONE        IMPLICIT NONE
15    
16  C     === Global variables ===  C     === Global variables ===
17  #include "SIZE.h"  #include "SIZE.h"
18  #include "EEPARAMS.h"  #include "EEPARAMS.h"
19  #include "PARAMS.h"  #include "PARAMS.h"
20    #include "GRID.h"
21  #include "OBCS.h"  #include "OBCS.h"
22    #include "EOS.h"
23    
24  C     == Routine arguments ==  C     == Routine arguments ==
25        INTEGER bi, bj        INTEGER futureIter
26        _RL futureTime        _RL futureTime
27        _RL uVel (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)        _RL uVel (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
28        _RL vVel (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)        _RL vVel (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
# Line 34  C     == Routine arguments == Line 34  C     == Routine arguments ==
34  #ifdef ALLOW_OBCS  #ifdef ALLOW_OBCS
35    
36  C     == Local variables ==  C     == Local variables ==
37          INTEGER bi, bj
38        INTEGER I, J ,K        INTEGER I, J ,K
   
 #include "GRID.h"  
39        _RL obTimeScale,Uinflow,rampTime2        _RL obTimeScale,Uinflow,rampTime2
40        _RL vertStructWst(Nr)        _RL vertStructWst(Nr)
41        _RL mz,strat,kx        _RL mz,strat,kx
42        _RL tmpsum        _RL tmpsum
43    
44    C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
45    
46    #ifdef ALLOW_DEBUG
47          IF (debugMode) CALL DEBUG_ENTER('OBCS_CALC',myThid)
48    #endif
49    
50  C Vertical mode number  C Vertical mode number
51        mz=1.0        mz=1.0 _d 0
52  C Stratification  C Stratification
53        strat = 1.0 _d -6 / (gravity*tAlpha)        strat = 1.0 _d -6 / (gravity*tAlpha)
54    
# Line 58  C Create a vertical structure function w Line 63  C Create a vertical structure function w
63         vertStructWst(K)=vertStructWst(K)-tmpsum         vertStructWst(K)=vertStructWst(K)-tmpsum
64        enddo        enddo
65  c  c
66        obTimeScale = 44567.0        obTimeScale = 44567.0 _d 0
67         kx=mz*2.*pi/400.0*sqrt((2.0*pi*2.0*pi/(obTimeScale*obTimeScale)         kx=mz*2. _d 0*pi/400.0 _d 0
68         &  *sqrt((2.0 _d 0*pi*2.0 _d 0*pi/(obTimeScale*obTimeScale)
69       & - f0*f0)/(1.0 _d -6       & - f0*f0)/(1.0 _d -6
70       & - 2.0*pi*2.0*pi/(obTimeScale*obTimeScale)))       & - 2.0 _d 0*pi*2.0 _d 0*pi/(obTimeScale*obTimeScale)))
71        Uinflow = 0.024        Uinflow = 0.024 _d 0
72        rampTime2 = 4*44567.0  C *NOTE* I have commented out the ramp function below
73    C just to speed things up. You will probably want to use it
74    C for smoother looking solutions.
75          rampTime2 = 4. _d 0*44567.0 _d 0
76    
77          DO bj=myByLo(myThid),myByHi(myThid)
78          DO bi=myBxLo(myThid),myBxHi(myThid)
79    
80  C     Eastern OB  C     Eastern OB
81        IF (useOrlanskiEast) THEN        IF (useOrlanskiEast) THEN
82          CALL ORLANSKI_EAST(          CALL ORLANSKI_EAST(
83       &          bi, bj, futureTime,       &          bi, bj, futureTime,
84       &          uVel, vVel, wVel, theta, salt,       &          uVel, vVel, wVel, theta, salt,
85       &          myThid )       &          myThid )
86        ELSE        ELSE
87          DO K=1,Nr          DO K=1,Nr
# Line 89  C     Eastern OB Line 100  C     Eastern OB
100  C     Western OB  C     Western OB
101        IF (useOrlanskiWest) THEN        IF (useOrlanskiWest) THEN
102          CALL ORLANSKI_WEST(          CALL ORLANSKI_WEST(
103       &          bi, bj, futureTime,       &          bi, bj, futureTime,
104       &          uVel, vVel, wVel, theta, salt,       &          uVel, vVel, wVel, theta, salt,
105       &          myThid )       &          myThid )
106        ELSE        ELSE
107          DO K=1,Nr          DO K=1,Nr
108            DO J=1-Oly,sNy+Oly            DO J=1-Oly,sNy+Oly
109            OBWu(J,K,bi,bj)=0.            OBWu(J,K,bi,bj)=0. _d 0
110       &       +Uinflow       &       +Uinflow
111       &       *vertStructWst(K)       &       *vertStructWst(K)
112       &       *sin(2.*PI*futureTime/obTimeScale)       &       *sin(2. _d 0*PI*futureTime/obTimeScale)
113       &       *(exp(futureTime/rampTime2)  c    &       *(exp(futureTime/rampTime2)
114       &   - exp(-futureTime/rampTime2))  c    &   - exp(-futureTime/rampTime2))
115       &   /(exp(futureTime/rampTime2)  c    &   /(exp(futureTime/rampTime2)
116       &  + exp(-futureTime/rampTime2))  c    &  + exp(-futureTime/rampTime2))
117       &   *cos(kx*(3-2-0.5)*delX(1))       &   *cos(kx*(3. _d 0-2. _d 0-0.5 _d 0)*delX(1))
118            OBWv(J,K,bi,bj)=0.            OBWv(J,K,bi,bj)=0. _d 0
119       &       +Uinflow       &       +Uinflow
120       &       *f0/(2.0*PI/obTimeScale)       &       *f0/(2.0 _d 0*PI/obTimeScale)
121       &       *vertStructWst(K)       &       *vertStructWst(K)
122       &       *cos(2.*PI*futureTime/obTimeScale )       &       *cos(2. _d 0*PI*futureTime/obTimeScale )
123       & * (exp(futureTime/rampTime2)       & * (exp(futureTime/rampTime2)
124       &   - exp(-futureTime/rampTime2))       &   - exp(-futureTime/rampTime2))
125       &   /(exp(futureTime/rampTime2)       &   /(exp(futureTime/rampTime2)
126       &  + exp(-futureTime/rampTime2))       &  + exp(-futureTime/rampTime2))
127            OBWt(J,K,bi,bj)=tRef(K)            OBWt(J,K,bi,bj)=tRef(K)
128       & + Uinflow*sin(mz*PI*(float(k)-0.5)/float(Nr))       & + Uinflow*sin(mz*PI*(float(k)-0.5 _d 0)/float(Nr))
129       & * sin(2.0*PI*futureTime/obTimeScale)       & * sin(2.0 _d 0*PI*futureTime/obTimeScale)
130       & *sqrt(strat/(tAlpha*gravity))       & *sqrt(strat/(tAlpha*gravity))
131       & *sqrt(2.0*PI/obTimeScale*2.0*PI/obTimeScale - f0*f0)       & *sqrt(2.0 _d 0*PI/obTimeScale*2.0*PI/obTimeScale - f0*f0)
132       & /(2.0*PI/obTimeScale)       & /(2.0 _d 0*PI/obTimeScale)
133       & * (exp(futureTime/rampTime2)  c    & * (exp(futureTime/rampTime2)
134       &   - exp(-futureTime/rampTime2))  c    &   - exp(-futureTime/rampTime2))
135       &   /(exp(futureTime/rampTime2)  c    &   /(exp(futureTime/rampTime2)
136       &  + exp(-futureTime/rampTime2))  c    &  + exp(-futureTime/rampTime2))
137  #ifdef ALLOW_NONHYDROSTATIC  #ifdef ALLOW_NONHYDROSTATIC
138            OBWw(J,K,bi,bj)=-Uinflow            OBWw(J,K,bi,bj)=-Uinflow
139       & *sqrt(2.0*PI/obTimeScale*2.0*PI/obTimeScale - f0*f0)       & *sqrt(2.0 _d 0*PI/obTimeScale*2.0 _d 0*PI/obTimeScale - f0*f0)
140       & /sqrt(strat*strat - 2.0*PI/obTimeScale*2.0*PI/obTimeScale)       & /sqrt(strat*strat -
141       & *sin(mz*PI*(float(k)-0.5)/float(Nr))       &          2.0 _d 0*PI/obTimeScale*2.0 _d 0*PI/obTimeScale)
142       &       *cos(2.*PI*futureTime/obTimeScale)       & *sin(mz*PI*(float(k)-0.5 _d 0)/float(Nr))
143       &       *(exp(futureTime/rampTime2)       &       *cos(2. _d 0*PI*futureTime/obTimeScale)
144       &   - exp(-futureTime/rampTime2))  c    &       *(exp(futureTime/rampTime2)
145       &   /(exp(futureTime/rampTime2)  c    &   - exp(-futureTime/rampTime2))
146       &  + exp(-futureTime/rampTime2))  c    &   /(exp(futureTime/rampTime2)
147    c    &  + exp(-futureTime/rampTime2))
148  #endif  #endif
149            ENDDO            ENDDO
150          ENDDO          ENDDO
# Line 141  C     Western OB Line 153  C     Western OB
153  C         Northern OB, template for forcing  C         Northern OB, template for forcing
154        IF (useOrlanskiNorth) THEN        IF (useOrlanskiNorth) THEN
155          CALL ORLANSKI_NORTH(          CALL ORLANSKI_NORTH(
156       &          bi, bj, futureTime,       &          bi, bj, futureTime,
157       &          uVel, vVel, wVel, theta, salt,       &          uVel, vVel, wVel, theta, salt,
158       &          myThid )       &          myThid )
159        ELSE        ELSE
160          DO K=1,Nr          DO K=1,Nr
# Line 159  C         Northern OB, template for forc Line 171  C         Northern OB, template for forc
171        ENDIF        ENDIF
172    
173  C         Southern OB, template for forcing  C         Southern OB, template for forcing
174        IF (useOrlanskiSouth) THEN          IF (useOrlanskiSouth) THEN
175          CALL ORLANSKI_SOUTH(          CALL ORLANSKI_SOUTH(
176       &          bi, bj, futureTime,       &          bi, bj, futureTime,
177       &          uVel, vVel, wVel, theta, salt,       &          uVel, vVel, wVel, theta, salt,
178       &          myThid )       &          myThid )
179        ELSE        ELSE
180          DO K=1,Nr          DO K=1,Nr
# Line 178  C         Southern OB, template for forc Line 190  C         Southern OB, template for forc
190          ENDDO          ENDDO
191        ENDIF        ENDIF
192    
193    C--   end bi,bj loops.
194          ENDDO
195          ENDDO
196    
197    #ifdef ALLOW_OBCS_BALANCE
198          IF ( useOBCSbalance ) THEN
199            CALL OBCS_BALANCE_FLOW( futureTime, futureIter, myThid )
200          ENDIF
201    #endif /* ALLOW_OBCS_BALANCE */
202    
203    #ifdef ALLOW_DEBUG
204          IF (debugMode) CALL DEBUG_LEAVE('OBCS_CALC',myThid)
205    #endif
206  #endif /* ALLOW_OBCS */  #endif /* ALLOW_OBCS */
207    
208        RETURN        RETURN
209        END        END

Legend:
Removed from v.1.1.2.1  
changed lines
  Added in v.1.7

  ViewVC Help
Powered by ViewVC 1.1.22