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