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

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

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


Revision 1.3.4.1 - (hide annotations) (download)
Thu Jul 11 21:56:21 2002 UTC (21 years, 9 months ago) by jmc
Branch: release1
CVS Tags: release1_p13_pre, release1_p13, release1_p8, release1_p9, release1_p5, release1_p6, release1_p7, release1_p12, release1_p10, release1_p11, release1_p16, release1_p17, release1_p14, release1_p15, release1_p12_pre
Branch point for: release1_50yr
Changes since 1.3: +3 -2 lines
o argument futureIter of S/R obcs_calc was missing
 (corresponds to checkpoint45a_post in MAIN branch)

1 jmc 1.3.4.1 C $Header: /u/gcmpack/MITgcm/verification/internal_wave/code/obcs_calc.F,v 1.4 2002/04/06 01:33:42 jmc Exp $
2 adcroft 1.3 C $Name: $
3 adcroft 1.2
4     #include "OBCS_OPTIONS.h"
5    
6 jmc 1.3.4.1 SUBROUTINE OBCS_CALC( bi, bj, futureTime, futureIter,
7 adcroft 1.2 & uVel, vVel, wVel, theta, salt,
8     & myThid )
9     C /==========================================================\
10     C | SUBROUTINE OBCS_CALC |
11     C | o Calculate future boundary data at open boundaries |
12     C | at time = futureTime |
13     C |==========================================================|
14     C | |
15     C \==========================================================/
16     IMPLICIT NONE
17    
18     C === Global variables ===
19     #include "SIZE.h"
20     #include "EEPARAMS.h"
21     #include "PARAMS.h"
22     #include "OBCS.h"
23    
24     C == Routine arguments ==
25     INTEGER bi, bj
26 jmc 1.3.4.1 INTEGER futureIter
27 adcroft 1.2 _RL futureTime
28     _RL uVel (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
29     _RL vVel (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
30     _RL wVel (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
31     _RL theta(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
32     _RL salt (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
33     INTEGER myThid
34    
35     #ifdef ALLOW_OBCS
36    
37     C == Local variables ==
38     INTEGER I, J ,K
39    
40     #include "GRID.h"
41     _RL obTimeScale,Uinflow,rampTime2
42     _RL vertStructWst(Nr)
43     _RL mz,strat,kx
44     _RL tmpsum
45    
46     C Vertical mode number
47 adcroft 1.3 mz=1.0 _d 0
48 adcroft 1.2 C Stratification
49     strat = 1.0 _d -6 / (gravity*tAlpha)
50    
51     C Create a vertical structure function with zero mean
52     tmpsum=0.
53     do K=1,Nr
54     vertStructWst(K)=cos(mz*PI* (rC(K)/rF(Nr+1)) )
55     tmpsum=tmpsum+vertStructWst(K)*drF(K)
56     enddo
57     tmpsum=tmpsum/rF(Nr+1)
58     do K=1,Nr
59     vertStructWst(K)=vertStructWst(K)-tmpsum
60     enddo
61     c
62 adcroft 1.3 obTimeScale = 44567.0 _d 0
63     kx=mz*2. _d 0*pi/400.0 _d 0
64     & *sqrt((2.0 _d 0*pi*2.0 _d 0*pi/(obTimeScale*obTimeScale)
65 adcroft 1.2 & - f0*f0)/(1.0 _d -6
66 adcroft 1.3 & - 2.0 _d 0*pi*2.0 _d 0*pi/(obTimeScale*obTimeScale)))
67     Uinflow = 0.024 _d 0
68     C *NOTE* I have commented out the ramp function below
69     C just to speed things up. You will probably want to use it
70     C for smoother looking solutions.
71     rampTime2 = 4. _d 0*44567.0 _d 0
72 adcroft 1.2
73    
74     C Eastern OB
75     IF (useOrlanskiEast) THEN
76     CALL ORLANSKI_EAST(
77     & bi, bj, futureTime,
78     & uVel, vVel, wVel, theta, salt,
79     & myThid )
80     ELSE
81     DO K=1,Nr
82     DO J=1-Oly,sNy+Oly
83     OBEu(J,K,bi,bj)=0.
84     OBEv(J,K,bi,bj)=0.
85     OBEt(J,K,bi,bj)=tRef(K)
86     OBEs(J,K,bi,bj)=sRef(K)
87     #ifdef ALLOW_NONHYDROSTATIC
88     OBEw(J,K,bi,bj)=0.
89     #endif
90     ENDDO
91     ENDDO
92     ENDIF
93    
94     C Western OB
95     IF (useOrlanskiWest) THEN
96     CALL ORLANSKI_WEST(
97     & bi, bj, futureTime,
98     & uVel, vVel, wVel, theta, salt,
99     & myThid )
100     ELSE
101     DO K=1,Nr
102     DO J=1-Oly,sNy+Oly
103 adcroft 1.3 OBWu(J,K,bi,bj)=0. _d 0
104 adcroft 1.2 & +Uinflow
105     & *vertStructWst(K)
106 adcroft 1.3 & *sin(2. _d 0*PI*futureTime/obTimeScale)
107     c & *(exp(futureTime/rampTime2)
108     c & - exp(-futureTime/rampTime2))
109     c & /(exp(futureTime/rampTime2)
110     c & + exp(-futureTime/rampTime2))
111     & *cos(kx*(3. _d 0-2. _d 0-0.5 _d 0)*delX(1))
112     OBWv(J,K,bi,bj)=0. _d 0
113 adcroft 1.2 & +Uinflow
114 adcroft 1.3 & *f0/(2.0 _d 0*PI/obTimeScale)
115 adcroft 1.2 & *vertStructWst(K)
116 adcroft 1.3 & *cos(2. _d 0*PI*futureTime/obTimeScale )
117 adcroft 1.2 & * (exp(futureTime/rampTime2)
118     & - exp(-futureTime/rampTime2))
119     & /(exp(futureTime/rampTime2)
120     & + exp(-futureTime/rampTime2))
121     OBWt(J,K,bi,bj)=tRef(K)
122 adcroft 1.3 & + Uinflow*sin(mz*PI*(float(k)-0.5 _d 0)/float(Nr))
123     & * sin(2.0 _d 0*PI*futureTime/obTimeScale)
124 adcroft 1.2 & *sqrt(strat/(tAlpha*gravity))
125 adcroft 1.3 & *sqrt(2.0 _d 0*PI/obTimeScale*2.0*PI/obTimeScale - f0*f0)
126     & /(2.0 _d 0*PI/obTimeScale)
127     c & * (exp(futureTime/rampTime2)
128     c & - exp(-futureTime/rampTime2))
129     c & /(exp(futureTime/rampTime2)
130     c & + exp(-futureTime/rampTime2))
131 adcroft 1.2 #ifdef ALLOW_NONHYDROSTATIC
132     OBWw(J,K,bi,bj)=-Uinflow
133 adcroft 1.3 & *sqrt(2.0 _d 0*PI/obTimeScale*2.0 _d 0*PI/obTimeScale - f0*f0)
134     & /sqrt(strat*strat -
135     & 2.0 _d 0*PI/obTimeScale*2.0 _d 0*PI/obTimeScale)
136     & *sin(mz*PI*(float(k)-0.5 _d 0)/float(Nr))
137     & *cos(2. _d 0*PI*futureTime/obTimeScale)
138     c & *(exp(futureTime/rampTime2)
139     c & - exp(-futureTime/rampTime2))
140     c & /(exp(futureTime/rampTime2)
141     c & + exp(-futureTime/rampTime2))
142 adcroft 1.2 #endif
143     ENDDO
144     ENDDO
145     ENDIF
146    
147     C Northern OB, template for forcing
148     IF (useOrlanskiNorth) THEN
149     CALL ORLANSKI_NORTH(
150     & bi, bj, futureTime,
151     & uVel, vVel, wVel, theta, salt,
152     & myThid )
153     ELSE
154     DO K=1,Nr
155     DO I=1-Olx,sNx+Olx
156     OBNv(I,K,bi,bj)=0.
157     OBNu(I,K,bi,bj)=0.
158     OBNt(I,K,bi,bj)=tRef(K)
159     OBNs(I,K,bi,bj)=sRef(K)
160     #ifdef ALLOW_NONHYDROSTATIC
161     OBNw(I,K,bi,bj)=0.
162     #endif
163     ENDDO
164     ENDDO
165     ENDIF
166    
167     C Southern OB, template for forcing
168     IF (useOrlanskiSouth) THEN
169     CALL ORLANSKI_SOUTH(
170     & bi, bj, futureTime,
171     & uVel, vVel, wVel, theta, salt,
172     & myThid )
173     ELSE
174     DO K=1,Nr
175     DO I=1-Olx,sNx+Olx
176     OBSu(I,K,bi,bj)=0.
177     OBSv(I,K,bi,bj)=0.
178     OBSt(I,K,bi,bj)=tRef(K)
179     OBSs(I,K,bi,bj)=sRef(K)
180     #ifdef ALLOW_NONHYDROSTATIC
181     OBSw(I,K,bi,bj)=0.
182     #endif
183     ENDDO
184     ENDDO
185     ENDIF
186    
187     #endif /* ALLOW_OBCS */
188     RETURN
189     END

  ViewVC Help
Powered by ViewVC 1.1.22