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