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

Contents of /MITgcm_contrib/dgoldberg/streamice/streamice_advect_2dtracer.F

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


Revision 1.1 - (show annotations) (download)
Sat Jun 8 22:15:33 2013 UTC (12 years, 1 month ago) by dgoldberg
Branch: MAIN
new advected scalar; new advection scheme for thickness update; corresponding TAF directives

1 C $Header: /u/gcmpack/MITgcm_contrib/dgoldberg/streamice/streamice_advect_thickness.F,v 1.7 2013/03/07 15:12:19 dgoldberg Exp $
2 C $Name: $
3
4 #include "STREAMICE_OPTIONS.h"
5
6 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
7
8
9 CBOP
10 SUBROUTINE STREAMICE_ADVECT_2DTRACER (
11 & myThid,
12 & myIter,
13 & time_step,
14 & uTrans,
15 & vTrans,
16 & bcMaskx,
17 & bcMasky)
18
19 C /============================================================\
20 C | SUBROUTINE |
21 C | o |
22 C |============================================================|
23 C | |
24 C \============================================================/
25 IMPLICIT NONE
26
27 C === Global variables ===
28 #include "SIZE.h"
29 #include "GRID.h"
30 #include "EEPARAMS.h"
31 #include "PARAMS.h"
32 #include "STREAMICE.h"
33 #include "STREAMICE_ADV.h"
34 #ifdef ALLOW_AUTODIFF_TAMC
35 # include "tamc.h"
36 #endif
37
38 INTEGER myThid, myIter, Gi, Gj
39 _RL time_step
40 _RL uTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
41 _RL vTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
42 _RL bcMaskx(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
43 _RL bcMasky(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
44 ! _RL trac(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
45
46 #ifdef ALLOW_STREAMICE
47 #ifdef ALLOW_STREAMICE_2DTRACER
48
49 INTEGER i, j, bi, bj
50 _RL thick_bd
51 _RL sec_per_year, time_step_loc, MR, SMB, TMB
52 _RL BCVALX(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
53 _RL BCVALY(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
54 _RL xtracflux(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
55 _RL ytracflux(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
56 #ifdef STREAMICE_TRACER_AB
57 _RL GAD_trac_2dNm1(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
58 #endif
59 CHARACTER*(MAX_LEN_MBUF) msgBuf
60
61 sec_per_year = 365.*86400.
62
63 time_step_loc = time_step / sec_per_year
64
65 PRINT *, "time_step_loc ", time_step_loc
66
67
68 DO bj=myByLo(myThid),myByHi(myThid)
69 DO bi=myBxLo(myThid),myBxHi(myThid)
70 DO j=1-3,sNy+3
71 DO i=1-3,sNx+3
72
73 ! H_streamice_prev(i,j,bi,bj) =
74 ! & H_streamice(i,j,bi,bj)
75
76 ytracflux (i,j,bi,bj) = 0. _d 0
77 xtracflux (i,j,bi,bj) = 0. _d 0
78 #ifdef STREAMICE_TRACER_AB
79 GAD_trac_2dNm1(i,j,bi,bj)=GAD_trac_2d(i,j,bi,bj)
80 GAD_trac_2d (i,j,bi,bj) = 0. _d 0
81 #endif
82
83
84 IF (STREAMICE_ufacemask(i,j,bi,bj).eq.3.0) THEN
85 BCVALX(i,j,bi,bj) = trac2d_ubdry_values_SI(i,j,bi,bj)
86 ELSEIF (STREAMICE_ufacemask(i,j,bi,bj).eq.4.0) THEN
87 BCVALX(i,j,bi,bj) = trac2d_ubdry_values_SI(i,j,bi,bj)
88 ENDIF
89
90 IF (STREAMICE_vfacemask(i,j,bi,bj).eq.3.0) THEN
91 BCVALy(i,j,bi,bj) = trac2d_vbdry_values_SI(i,j,bi,bj)
92 ELSEIF (STREAMICE_vfacemask(i,j,bi,bj).eq.4.0) THEN
93 BCVALy(i,j,bi,bj) = trac2d_vbdry_values_SI(i,j,bi,bj)
94 ENDIF
95
96 ENDDO
97 ENDDO
98 ENDDO
99 ENDDO
100
101 _EXCH_XY_RL(BCVALX,myThid)
102 _EXCH_XY_RL(BCVALY,myThid)
103
104
105 #ifdef ALLOW_AUTODIFF_TAMC
106 CADJ STORE trac2d = comlev1, key=ikey_dynamics
107 #endif
108
109
110
111 CALL STREAMICE_ADV_FLUX_FL_X ( myThid ,
112 I uTrans ,
113 I trac2d ,
114 I BCMASKX,
115 I BCVALX,
116 O xtracflux,
117 I time_step_loc)
118
119
120 DO bj=myByLo(myThid),myByHi(myThid)
121 DO bi=myBxLo(myThid),myBxHi(myThid)
122 DO j=1-3,sNy+3
123 DO i=1-1,sNx+1
124 Gi = (myXGlobalLo-1)+(bi-1)*sNx+i
125 Gj = (myYGlobalLo-1)+(bj-1)*sNy+j
126
127 IF (STREAMICE_hmask(i,j,bi,bj).eq.1.0 .or.
128 & STREAMICE_hmask(i,j,bi,bj).eq.2.0) THEN
129
130
131
132 #ifdef STREAMICE_TRACER_AB
133 GAD_trac_2d(i,j,bi,bj) = GAD_trac_2d(i,j,bi,bj) -
134 #else
135 trac2d(i,j,bi,bj) = trac2d(i,j,bi,bj) -
136 #endif
137 & ((xtracflux(i+1,j,bi,bj)*dyG(i+1,j,bi,bj) -
138 & xtracflux(i,j,bi,bj)*dyG(i,j,bi,bj)) *
139 & recip_rA (i,j,bi,bj) -
140 & trac2d(i,j,bi,bj) *
141 & (utrans(i+1,j,bi,bj)*dyG(i+1,j,bi,bj)-
142 & utrans(i,j,bi,bj)*dyG(i,j,bi,bj)) *
143 & recip_rA(i,j,bi,bj))
144 #ifndef STREAMICE_TRACER_AB
145 & * time_step_loc
146 #endif
147 ENDIF
148 ENDDO
149 ENDDO
150 ENDDO
151 ENDDO
152 _EXCH_XY_RL(utrans,myThid)
153
154 #ifdef ALLOW_AUTODIFF_TAMC
155 # ifndef STREAMICE_TRACER_AB
156 CADJ STORE trac2d = comlev1, key=ikey_dynamics
157 # endif
158 #endif
159
160
161 CALL STREAMICE_ADV_FLUX_FL_Y ( myThid ,
162 I vTrans ,
163 I trac2d ,
164 I BCMASKy,
165 I BCVALy,
166 O ytracflux,
167 I time_step_loc)
168
169
170 DO bj=myByLo(myThid),myByHi(myThid)
171 DO bi=myBxLo(myThid),myBxHi(myThid)
172 DO j=1-1,sNy+1
173 DO i=1-1,sNx+1
174 Gi = (myXGlobalLo-1)+(bi-1)*sNx+i
175 Gj = (myYGlobalLo-1)+(bj-1)*sNy+j
176 IF (STREAMICE_hmask(i,j,bi,bj).eq.1.0 .or.
177 & STREAMICE_hmask(i,j,bi,bj).eq.2.0) THEN
178 IF (Gi.eq.34.and.Gj.eq.94) THEN
179 print *, "GOT HERE YFLUX", ytracflux(i,j,bi,bj),
180 & ytracflux(i,j+1,bi,bj),trac2d(i,j,bi,bj),
181 & vtrans(i,j,bi,bj), vtrans(i,j+1,bi,bj),
182 & bcmasky(i,j,bi,bj)
183 ENDIF
184
185 #ifdef STREAMICE_TRACER_AB
186 GAD_trac_2d(i,j,bi,bj) = GAD_trac_2d(i,j,bi,bj) -
187 #else
188 trac2d(i,j,bi,bj) = trac2d(i,j,bi,bj) -
189 #endif
190 & ((ytracflux(i,j+1,bi,bj)*dxG(i,j+1,bi,bj) -
191 & ytracflux(i,j,bi,bj)*dxG(i,j,bi,bj)) *
192 & recip_rA (i,j,bi,bj) -
193 & (vtrans(i,j+1,bi,bj)*dxG(i,j+1,bi,bj) -
194 & vtrans(i,j,bi,bj)*dxG(i,j,bi,bj)) *
195 & trac2d(i,j,bi,bj) *
196 & recip_rA(i,j,bi,bj))
197 #ifndef STREAMICE_TRACER_AB
198 & * time_step_loc
199 #endif
200 ENDIF
201 ENDDO
202 ENDDO
203 ENDDO
204 ENDDO
205
206 #ifdef STREAMICE_TRACER_AB
207
208 DO bj=myByLo(myThid),myByHi(myThid)
209 DO bi=myBxLo(myThid),myBxHi(myThid)
210 DO j=1-OLy,sNy+OLy
211 DO i=1-OLx,sNx+OLx
212
213 trac2d(i,j,bi,bj) = trac2d(i,j,bi,bj) + time_step_loc *
214 & GAD_trac_2d(i,j,bi,bj)
215
216 IF (myIter.eq.0) THEN
217 trac2d(i,j,bi,bj) = trac2d(i,j,bi,bj) + time_step_loc *
218 & (.5+.01) *
219 & (GAD_trac_2d(i,j,bi,bj) - GAD_trac_2dNm1(i,j,bi,bj))
220 ENDIF
221
222
223 ENDDO
224 ENDDO
225 ENDDO
226 ENDDO
227
228 #endif
229
230 _EXCH_XY_RL (trac2d, myThid)
231
232 WRITE(msgBuf,'(A)') 'END STREAMICE_ADVECT_THICKNESS'
233 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
234 & SQUEEZE_RIGHT , 1)
235
236 #endif
237 #endif
238 END
239

  ViewVC Help
Powered by ViewVC 1.1.22