1 |
C $Header$ |
2 |
|
3 |
#include "CPP_OPTIONS.h" |
4 |
|
5 |
CStartOfInterface |
6 |
SUBROUTINE SET_OBCS( myCurrentTime, myThid ) |
7 |
C /==========================================================\ |
8 |
C | SUBROUTINE SET_OBCS | |
9 |
C | o Set boundary conditions at open boundaries | |
10 |
C |==========================================================| |
11 |
C | | |
12 |
C \==========================================================/ |
13 |
|
14 |
C === Global variables === |
15 |
#include "SIZE.h" |
16 |
#include "EEPARAMS.h" |
17 |
#include "PARAMS.h" |
18 |
#include "DYNVARS.h" |
19 |
#include "OBCS.h" |
20 |
|
21 |
C == Routine arguments == |
22 |
C myThid - Number of this instance of INI_DEPTHS |
23 |
_RL myCurrentTime |
24 |
INTEGER myThid |
25 |
CEndOfInterface |
26 |
|
27 |
C == Local variables == |
28 |
C xG, yG - Global coordinate location. |
29 |
C zG |
30 |
C zUpper - Work arrays for upper and lower |
31 |
C zLower cell-face heights. |
32 |
C phi - Temporary scalar |
33 |
C iG, jG - Global coordinate index |
34 |
C bi,bj - Loop counters |
35 |
C zUpper - Temporary arrays holding z coordinates of |
36 |
C zLower upper and lower faces. |
37 |
C I,i,K |
38 |
INTEGER iG, jG |
39 |
INTEGER bi, bj |
40 |
INTEGER I, J, K |
41 |
_RL obTimeScale,Uinflow |
42 |
c |
43 |
obTimeScale = 2000.0 |
44 |
Uinflow = 0.25 |
45 |
|
46 |
DO bj = myByLo(myThid), myByHi(myThid) |
47 |
DO bi = myBxLo(myThid), myBxHi(myThid) |
48 |
DO K=1,Nr |
49 |
DO J=1-Oly,sNy+Oly |
50 |
OBEu(J,K,bi,bj)=Uinflow |
51 |
c & *sin(2.*PI*myCurrentTime/obTimeScale) |
52 |
c & *max(myCurrentTime/obTimeScale,1.) |
53 |
OBEv(J,K,bi,bj)=0. |
54 |
OBEt(J,K,bi,bj)=tRef(K) |
55 |
OBWu(J,K,bi,bj)=Uinflow |
56 |
c & *sin(2.*PI*myCurrentTime/obTimeScale) |
57 |
c & *max(myCurrentTime/obTimeScale,1.) |
58 |
OBWv(J,K,bi,bj)=0. |
59 |
OBWt(J,K,bi,bj)=tRef(K) |
60 |
ENDDO |
61 |
DO I=1-Olx,sNx+Olx |
62 |
OBNu(I,K,bi,bj)=Uinflow |
63 |
OBNv(I,K,bi,bj)=0. |
64 |
OBNt(I,K,bi,bj)=tRef(K) |
65 |
OBSu(I,K,bi,bj)=Uinflow |
66 |
OBSv(I,K,bi,bj)=0. |
67 |
OBSt(I,K,bi,bj)=tRef(K) |
68 |
ENDDO |
69 |
ENDDO |
70 |
ENDDO |
71 |
ENDDO |
72 |
|
73 |
#ifdef SIMPLE_OBCS |
74 |
C This is an example of some rudimentary OBCs. |
75 |
C These work but aren't very sophisticated... |
76 |
C (The above specified OBCs produce nicer results!) |
77 |
C [Remove the CPP #ifdef and #endif to use this code] |
78 |
|
79 |
C Simple upwind-type radiation OBCs |
80 |
DO bj = myByLo(myThid), myByHi(myThid) |
81 |
DO bi = myBxLo(myThid), myBxHi(myThid) |
82 |
|
83 |
DO K=1,Nr |
84 |
DO J=1-Oly,sNy+Oly |
85 |
C Eastern boundary |
86 |
IF (uVel( OB_Ie(J,bi,bj) ,J,K,bi,bj).LE.0.) THEN |
87 |
C Incoming flow or forced in-flow |
88 |
OBEu(J,K,bi,bj)=Uinflow |
89 |
OBEt(J,K,bi,bj)=tRef(K) |
90 |
ELSE |
91 |
C Outgoing flow |
92 |
OBEu(J,K,bi,bj)=uVel( OB_Ie(J,bi,bj)-1 ,J,K,bi,bj) |
93 |
OBEt(J,K,bi,bj)=theta( OB_Ie(J,bi,bj)-1 ,J,K,bi,bj) |
94 |
ENDIF |
95 |
OBEv(J,K,bi,bj)=0. |
96 |
C Western boundary |
97 |
IF (uVel( OB_Iw(J,bi,bj)+1 ,J,K,bi,bj).GE.0.) THEN |
98 |
C Incoming flow or forced in-flow |
99 |
OBWu(J,K,bi,bj)=Uinflow |
100 |
OBWt(J,K,bi,bj)=tRef(K) |
101 |
ELSE |
102 |
C Outgoing flow |
103 |
OBEu(J,K,bi,bj)=uVel( OB_Iw(J,bi,bj)+1 ,J,K,bi,bj) |
104 |
OBEt(J,K,bi,bj)=theta( OB_Iw(J,bi,bj)+1 ,J,K,bi,bj) |
105 |
ENDIF |
106 |
OBWv(J,K,bi,bj)=0. |
107 |
ENDDO |
108 |
ENDDO |
109 |
|
110 |
DO K=1,Nr |
111 |
DO I=1-Olx,sNx+Olx |
112 |
C Northern boundary |
113 |
IF (vVel(I, OB_Jn(I,bi,bj) ,K,bi,bj).LE.0.) THEN |
114 |
C Incoming flow or forced in-flow |
115 |
OBNv(I,K,bi,bj)=0. |
116 |
OBNt(I,K,bi,bj)=tRef(K) |
117 |
ELSE |
118 |
C Outgoing |
119 |
OBNv(I,K,bi,bj)=vVel(I, OB_Jn(I,bi,bj)-1 ,K,bi,bj) |
120 |
OBNt(I,K,bi,bj)=theta(I, OB_Jn(I,bi,bj)-1 ,K,bi,bj) |
121 |
ENDIF |
122 |
OBNu(I,K,bi,bj)=Uinflow |
123 |
C Southern boundary |
124 |
IF (vVel(I, OB_Js(I,bi,bj)+1 ,K,bi,bj).GE.0.) THEN |
125 |
C Incoming flow or forced in-flow |
126 |
OBSv(I,K,bi,bj)=0. |
127 |
OBSt(I,K,bi,bj)=tRef(K) |
128 |
ELSE |
129 |
C Outgoing |
130 |
OBSv(I,K,bi,bj)=vVel(I, OB_Js(I,bi,bj)+1 ,K,bi,bj) |
131 |
OBSt(I,K,bi,bj)=theta(I, OB_Js(I,bi,bj)+1 ,K,bi,bj) |
132 |
ENDIF |
133 |
OBSu(I,K,bi,bj)=Uinflow |
134 |
ENDDO |
135 |
ENDDO |
136 |
|
137 |
ENDDO |
138 |
ENDDO |
139 |
#endif |
140 |
|
141 |
|
142 |
C |
143 |
RETURN |
144 |
END |