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