/[MITgcm]/MITgcm_contrib/dgoldberg/streamice/streamice_cg_wrapper.F
ViewVC logotype

Annotation of /MITgcm_contrib/dgoldberg/streamice/streamice_cg_wrapper.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (hide annotations) (download)
Wed Jan 9 21:56:18 2013 UTC (12 years, 6 months ago) by dgoldberg
Branch: MAIN
Changes since 1.1: +23 -1 lines
changes to accept real datasets

1 dgoldberg 1.2 C $Header: /u/gcmpack/MITgcm_contrib/dgoldberg/streamice/streamice_cg_wrapper.F,v 1.1 2012/07/19 18:55:26 dgoldberg Exp $
2 dgoldberg 1.1 C $Name: $
3    
4     #include "STREAMICE_OPTIONS.h"
5    
6     C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
7    
8     CBOP
9     SUBROUTINE STREAMICE_CG_WRAPPER(
10     U cg_Uin,
11     U cg_Vin,
12     I cg_tauU,
13     I cg_tauV,
14     I tolerance,
15     O iters,
16     I myThid )
17    
18     C /============================================================\
19     C | SUBROUTINE |
20     C | o |
21     C |============================================================|
22     C | |
23     C \============================================================/
24     IMPLICIT NONE
25    
26     C === Global variables ===
27     #include "SIZE.h"
28     #include "EEPARAMS.h"
29     #include "PARAMS.h"
30     #include "STREAMICE.h"
31     #include "STREAMICE_CG.h"
32    
33    
34     C !INPUT/OUTPUT ARGUMENTS
35     C cg_Uin, cg_Vin - input and output velocities
36     C cg_Bu, cg_Bv - driving stress
37    
38     INTEGER myThid
39     INTEGER iters
40     _RL tolerance
41    
42     _RL cg_Uin (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
43     _RL cg_Vin (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
44     _RL cg_tauU (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
45     _RL cg_tauV (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
46    
47     #ifdef ALLOW_STREAMICE
48    
49     _RL dot_p1, dot_p2
50     _RL dot_p1_tile (nSx,nSy)
51     _RL dot_p2_tile (nSx,nSy)
52     INTEGER i, j, bi, bj
53    
54    
55    
56     DO bj = myByLo(myThid), myByHi(myThid)
57     DO bi = myBxLo(myThid), myBxHi(myThid)
58     DO j=1,sNy
59     DO i=1,sNx
60    
61     DIAGu_SI (i,j,bi,bj) = 0. _d 0
62     DIAGv_SI (i,j,bi,bj) = 0. _d 0
63     ubd_SI (i,j,bi,bj) = 0. _d 0
64     vbd_SI (i,j,bi,bj) = 0. _d 0
65     ENDDO
66     ENDDO
67     ENDDO
68     ENDDO
69    
70     C DIRICHLET BOUNDARY VALUES ADDED TO RHS
71    
72     CALL STREAMICE_CG_BOUND_VALS( myThid,
73     O ubd_SI,
74     O vbd_SI)
75    
76 dgoldberg 1.2
77     ! CALL WRITE_FLD_XY_RL ( "ubd_SI", "",
78     ! & ubd_SI, 0, myThid )
79    
80     ! CALL WRITE_FLD_XY_RL ( "vbd_SI", "",
81     ! & STREAMICE_vmask, 0, myThid )
82    
83 dgoldberg 1.1 DO bj = myByLo(myThid), myByHi(myThid)
84     DO bi = myBxLo(myThid), myBxHi(myThid)
85     DO j=1-OLy,sNy+OLy
86     DO i=1-OLx,sNx+OLx
87     RHSu_SI (i,j,bi,bj) = cg_tauU (i,j,bi,bj)
88     & - ubd_SI(i,j,bi,bj)
89     RHSv_SI (i,j,bi,bj) = cg_tauV (i,j,bi,bj)
90     & - vbd_SI(i,j,bi,bj)
91     ENDDO
92     ENDDO
93     ENDDO
94     ENDDO
95    
96     _EXCH_XY_RL( RHSu_SI, myThid )
97     _EXCH_XY_RL( RHSv_SI, myThid )
98    
99     C GET DIAGONAL OF MATRIX
100    
101     CALL STREAMICE_CG_ADIAG( myThid,
102     O DIAGu_SI,
103     O DIAGv_SI)
104    
105     _EXCH_XY_RL( DIAGu_SI, myThid )
106     _EXCH_XY_RL( DIAGv_SI, myThid )
107    
108     C ccccc
109    
110 dgoldberg 1.2 DO bj = myByLo(myThid), myByHi(myThid)
111     DO bi = myBxLo(myThid), myBxHi(myThid)
112     DO j=1-OLy,sNy+OLy
113     DO i=1-OLy,sNx+OLy
114     IF (STREAMICE_umask(i,j,bi,bj).ne.1.0)
115     & cg_Uin(i,j,bi,bj)=0.0
116     IF (STREAMICE_vmask(i,j,bi,bj).ne.1.0)
117     & cg_Vin(i,j,bi,bj)=0.0
118    
119     ! print *, "rhs", i,j,RHSu_SI(i,j,bi,bj)
120    
121     ENDDO
122     ENDDO
123     ENDDO
124     ENDDO
125 dgoldberg 1.1
126    
127     #ifdef STREAMICE_CONSTRUCT_MATRIX
128    
129    
130     CALL STREAMICE_CG_MAKE_A(myThid)
131    
132     ! print *, "MATRIX 1"
133     ! do i=1,sNx
134     ! print *, i,
135     ! & streamice_cg_A1(i,1,1,1,-1,0),
136     ! & streamice_cg_A1(i,1,1,1,0,0),
137     ! & streamice_cg_A1(i,1,1,1,1,0),
138     ! & streamice_cg_A1(i,2,1,1,-1,0),
139     ! & streamice_cg_A1(i,2,1,1,0,0),
140     ! & streamice_cg_A1(i,2,1,1,1,0),
141     ! & streamice_cg_A1(i,3,1,1,-1,0),
142     ! & streamice_cg_A1(i,3,1,1,0,0),
143     ! & streamice_cg_A1(i,3,1,1,1,0),
144     ! & visc_streamice(i,1,1,1),visc_streamice(i,2,1,1),
145     ! & visc_streamice(i,3,1,1)
146     ! enddo
147    
148     CALL STREAMICE_CG_SOLVE(
149     & cg_Uin,
150     & cg_Vin,
151     & RHSu_SI,
152     & RHSv_SI,
153     & streamice_cg_A1,
154     & streamice_cg_A2,
155     & streamice_cg_A3,
156     & streamice_cg_A4,
157     & tolerance,
158     & iters,
159     & myThid )
160    
161     _EXCH_XY_RL( RHSu_SI, myThid )
162     _EXCH_XY_RL( RHSv_SI, myThid )
163    
164     ! DO bj = myByLo(myThid), myByHi(myThid)
165     ! DO bi = myBxLo(myThid), myBxHi(myThid)
166     ! DO j=1-OLy,sNy+OLy
167     ! DO i=1-OLx,sNx+OLx
168     ! cg_Uin(i,j,bi,bj) = cg_Uin(i,j,bi,bj) +
169     ! & 0.0 * cg_Uin(i,j,bi,bj)**2
170     ! cg_Vin(i,j,bi,bj) = cg_Vin(i,j,bi,bj) +
171     ! & 0.0 * cg_Vin(i,j,bi,bj)**2
172     ! ENDDO
173     ! ENDDO
174     ! ENDDO
175     ! ENDDO
176    
177    
178    
179     #else
180    
181     CALL STREAMICE_CG_SOLVE_MATFREE(
182     & cg_Uin,
183     & cg_Vin,
184     & RHSu_SI,
185     & RHSv_SI,
186     & tolerance,
187     & iters,
188     & myThid )
189    
190     #endif
191    
192    
193     C ACTUAL CG CALL
194    
195    
196    
197    
198     DO bj = myByLo(myThid), myByHi(myThid)
199     DO bi = myBxLo(myThid), myBxHi(myThid)
200     DO j=1-OLy,sNy+OLy
201     DO i=1-OLy,sNx+OLy
202     IF (STREAMICE_umask(i,j,bi,bj).eq.3.0)
203     & cg_Uin(i,j,bi,bj)=u_bdry_values_SI(i,j,bi,bj)
204     IF (STREAMICE_vmask(i,j,bi,bj).eq.3.0)
205     & cg_Vin(i,j,bi,bj)=v_bdry_values_SI(i,j,bi,bj)
206    
207     ! print *, "rhs", i,j,RHSu_SI(i,j,bi,bj)
208    
209     ENDDO
210     ENDDO
211     ENDDO
212     ENDDO
213    
214     _EXCH_XY_RL( cg_Uin, myThid )
215     _EXCH_XY_RL( cg_Vin, myThid )
216    
217    
218     #endif
219     RETURN
220     END
221    

  ViewVC Help
Powered by ViewVC 1.1.22