1 |
jmc |
1.4 |
C $Header: /u/gcmpack/models/MITgcmUV/pkg/obcs/obcs_init_fixed.F,v 1.3 2001/05/14 21:36:45 heimbach Exp $ |
2 |
heimbach |
1.3 |
C $Name: $ |
3 |
adcroft |
1.2 |
|
4 |
|
|
#include "OBCS_OPTIONS.h" |
5 |
|
|
|
6 |
|
|
SUBROUTINE OBCS_INIT_FIXED( myThid ) |
7 |
|
|
C /==========================================================\ |
8 |
|
|
C | SUBROUTINE OBCS_INIT_FIXED | |
9 |
|
|
C | o Initialise OBCs fixed arrays | |
10 |
|
|
C |==========================================================| |
11 |
|
|
C | | |
12 |
|
|
C \==========================================================/ |
13 |
|
|
IMPLICIT NONE |
14 |
|
|
|
15 |
|
|
C === Global variables === |
16 |
|
|
#include "SIZE.h" |
17 |
|
|
#include "EEPARAMS.h" |
18 |
|
|
#include "PARAMS.h" |
19 |
|
|
#include "OBCS.h" |
20 |
jmc |
1.4 |
#ifdef NONLIN_FRSURF |
21 |
|
|
#include "GRID.h" |
22 |
|
|
#include "SURFACE.h" |
23 |
|
|
#endif |
24 |
adcroft |
1.2 |
|
25 |
|
|
C == Routine arguments == |
26 |
|
|
C myThid - Number of this instance of INI_DEPTHS |
27 |
|
|
INTEGER myThid |
28 |
|
|
|
29 |
|
|
#ifdef ALLOW_OBCS |
30 |
|
|
|
31 |
|
|
C == Local variables == |
32 |
|
|
INTEGER iG, jG, iGm, jGm |
33 |
|
|
INTEGER bi, bj |
34 |
|
|
INTEGER I, J, K |
35 |
|
|
|
36 |
|
|
DO bj = myByLo(myThid), myByHi(myThid) |
37 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
38 |
|
|
|
39 |
|
|
DO I=1-Olx,sNx+Olx |
40 |
|
|
OB_Jn(I,bi,bj)=0 |
41 |
|
|
OB_Js(I,bi,bj)=0 |
42 |
|
|
ENDDO |
43 |
|
|
|
44 |
|
|
DO J=1-Oly,sNy+Oly |
45 |
|
|
OB_Ie(J,bi,bj)=0 |
46 |
|
|
OB_Iw(J,bi,bj)=0 |
47 |
|
|
ENDDO |
48 |
|
|
|
49 |
|
|
DO J=1-Oly,sNy+Oly |
50 |
heimbach |
1.3 |
C convert from local y index J to global y index jG |
51 |
adcroft |
1.2 |
jG = myYGlobalLo-1+(bj-1)*sNy+J |
52 |
heimbach |
1.3 |
C use periodicity to deal with out of range points caused by the overlaps. |
53 |
|
|
C they will be excluded by the mask in any case, but this saves array |
54 |
|
|
C out-of-bounds errors here. |
55 |
adcroft |
1.2 |
jGm = 1+mod( jG-1+Ny , Ny ) |
56 |
heimbach |
1.3 |
C loop over local x index I |
57 |
adcroft |
1.2 |
DO I=1,sNx |
58 |
|
|
iG = myXGlobalLo-1+(bi-1)*sNx+I |
59 |
|
|
iGm = 1+mod( iG-1+Nx , Nx ) |
60 |
heimbach |
1.3 |
C OB_Ieast(jGm) allows for the eastern boundary to be at variable x locations |
61 |
adcroft |
1.2 |
IF (iG.EQ.OB_Ieast(jGm)) OB_Ie(J,bi,bj)=I |
62 |
|
|
IF (iG.EQ.OB_Iwest(jGm)) OB_Iw(J,bi,bj)=I |
63 |
|
|
ENDDO |
64 |
|
|
ENDDO |
65 |
|
|
DO J=1,sNy |
66 |
|
|
jG = myYGlobalLo-1+(bj-1)*sNy+J |
67 |
|
|
jGm = 1+mod( jG-1+Ny , Ny ) |
68 |
|
|
DO I=1-Olx,sNx+Olx |
69 |
|
|
iG = myXGlobalLo-1+(bi-1)*sNx+I |
70 |
|
|
iGm = 1+mod( iG-1+Nx , Nx ) |
71 |
heimbach |
1.3 |
C OB_Jnorth(iGm) allows for the northern boundary to be at variable y locations |
72 |
adcroft |
1.2 |
IF (jG.EQ.OB_Jnorth(iGm)) OB_Jn(I,bi,bj)=J |
73 |
|
|
IF (jG.EQ.OB_Jsouth(iGm)) OB_Js(I,bi,bj)=J |
74 |
|
|
ENDDO |
75 |
|
|
ENDDO |
76 |
jmc |
1.4 |
|
77 |
|
|
#ifdef NONLIN_FRSURF |
78 |
|
|
|
79 |
|
|
C- save the initial hFacS at the N & S boundaries : |
80 |
|
|
DO i=1-Olx,sNx+Olx |
81 |
|
|
OBNhFac0(i,bi,bj)=0. |
82 |
|
|
OBShFac0(i,bi,bj)=0. |
83 |
|
|
C Northern boundary |
84 |
|
|
IF ( OB_Jn(i,bi,bj).NE.0 ) THEN |
85 |
|
|
j = OB_Jn(i,bi,bj) |
86 |
|
|
k = ksurfS(i,j,bi,bj) |
87 |
|
|
IF (k.LE.Nr) OBNhFac0(i,bi,bj)=hFacS(i,j,k,bi,bj) |
88 |
|
|
ENDIF |
89 |
|
|
C Southern boundary |
90 |
|
|
IF ( OB_Js(i,bi,bj).NE.0 ) THEN |
91 |
|
|
j = OB_Js(i,bi,bj)+1 |
92 |
|
|
k = ksurfS(i,j,bi,bj) |
93 |
|
|
IF (k.LE.Nr) OBShFac0(i,bi,bj)=hFacS(i,j,k,bi,bj) |
94 |
|
|
ENDIF |
95 |
|
|
ENDDO |
96 |
|
|
|
97 |
|
|
C- save the initial hFacW at the E & W boundaries : |
98 |
|
|
DO j=1-Oly,sNy+Oly |
99 |
|
|
OBEhFac0(j,bi,bj)=0. |
100 |
|
|
OBWhFac0(j,bi,bj)=0. |
101 |
|
|
C Eastern boundary |
102 |
|
|
IF ( OB_Ie(j,bi,bj).NE.0 ) THEN |
103 |
|
|
i = OB_Ie(j,bi,bj) |
104 |
|
|
k = ksurfW(i,j,bi,bj) |
105 |
|
|
IF (k.LE.Nr) OBEhFac0(j,bi,bj)=hFacW(i,j,k,bi,bj) |
106 |
|
|
ENDIF |
107 |
|
|
C Western boundary |
108 |
|
|
IF ( OB_Iw(j,bi,bj).NE.0 ) THEN |
109 |
|
|
i = OB_Iw(j,bi,bj)+1 |
110 |
|
|
k = ksurfW(i,j,bi,bj) |
111 |
|
|
IF (k.LE.Nr) OBWhFac0(j,bi,bj)=hFacW(i,j,k,bi,bj) |
112 |
|
|
ENDIF |
113 |
|
|
ENDDO |
114 |
|
|
|
115 |
|
|
#endif /* NONLIN_FRSURF */ |
116 |
adcroft |
1.2 |
|
117 |
|
|
ENDDO |
118 |
|
|
ENDDO |
119 |
|
|
|
120 |
|
|
#endif /* ALLOW_OBCS */ |
121 |
|
|
RETURN |
122 |
|
|
END |