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

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

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


Revision 1.6 - (hide annotations) (download)
Thu Sep 27 20:29:00 2012 UTC (12 years, 9 months ago) by dgoldberg
Branch: MAIN
Changes since 1.5: +37 -3 lines
various changes

1 dgoldberg 1.6 C $Header: /u/gcmpack/MITgcm_contrib/dgoldberg/streamice/streamice_init_varia.F,v 1.5 2012/09/20 02:04:45 heimbach Exp $
2 heimbach 1.1 C $Name: $
3    
4 dgoldberg 1.6 #include "COST_OPTIONS.h"
5 heimbach 1.1 #include "STREAMICE_OPTIONS.h"
6    
7     C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
8    
9     CBOP
10     SUBROUTINE STREAMICE_INIT_VARIA( myThid )
11     C /============================================================\
12     C | SUBROUTINE STREAMICE_INIT_VARIA |
13     C | o Routine to initialize STREAMICE variables. |
14     C |============================================================|
15     C | Initialize STREAMICE parameters and variables. |
16     C \============================================================/
17     IMPLICIT NONE
18    
19     C === Global variables ===
20     #include "SIZE.h"
21     #include "GRID.h"
22 dgoldberg 1.4 #include "SET_GRID.h"
23 heimbach 1.1 #include "EEPARAMS.h"
24     #include "PARAMS.h"
25     #include "STREAMICE.h"
26     #include "STREAMICE_CG.h"
27     #include "STREAMICE_ADV.h"
28    
29     C === Routine arguments ===
30     C myThid - Number of this instance of STREAMICE_INIT_VARIA
31     INTEGER myThid
32     CEndOfInterface
33    
34     #ifdef ALLOW_STREAMICE
35     C === Local variables ===
36     C I,J,bi,bj - Loop counters
37     INTEGER i, j, k, bi, bj, Gi, Gj
38     INTEGER col_y, col_x
39 dgoldberg 1.4 _RL slope_pos, c1, x, y, lenx, leny
40 heimbach 1.1 CHARACTER*(MAX_LEN_MBUF) msgBuf
41     CEOP
42    
43     C ZERO OUT FLOATING POINT ARRAYS
44    
45     DO bj = myByLo(myThid), myByHi(myThid)
46     DO bi = myBxLo(myThid), myBxHi(myThid)
47     DO j=1-Oly,sNy+Oly
48     DO i=1-Olx,sNx+Olx
49     H_streamIce(i,j,bi,bj) = 0. _d 0
50     U_streamice(i,j,bi,bj) = 0. _d 0
51     V_streamice(i,j,bi,bj) = 0. _d 0
52     visc_streamice(i,j,bi,bj) = 0. _d 0
53     tau_beta_eff_streamice(i,j,bi,bj) = 0. _d 0
54     float_frac_streamice(i,j,bi,bj) = 0. _d 0
55     base_el_streamice(i,j,bi,bj) = 0. _d 0
56     surf_el_streamice(i,j,bi,bj) = 0. _d 0
57     area_shelf_streamice(i,j,bi,bj) = 0. _d 0
58     mass_ice_streamice(i,j,bi,bj) = 0. _d 0
59 dgoldberg 1.3 BDOT_streamice(i,j,bi,bj) = 0. _d 0
60 dgoldberg 1.4 ! C_basal_friction(i,j,bi,bj) = C_basal_fric_const
61 dgoldberg 1.3 A_glen(i,j,bi,bj) = A_glen_isothermal
62 heimbach 1.1 #ifdef ALLOW_AUTODIFF_TAMC
63     ru_old_si(i,j,bi,bj) = 0. _d 0
64     rv_old_si(i,j,bi,bj) = 0. _d 0
65     zu_old_si(i,j,bi,bj) = 0. _d 0
66     zv_old_si(i,j,bi,bj) = 0. _d 0
67     h_after_uflux_SI(i,j,bi,bj) = 0. _d 0
68     #endif
69 dgoldberg 1.6 #ifdef USE_ALT_RLOW
70     R_low_si(i,j,bi,bj) = 0. _d 0
71     #endif
72    
73 dgoldberg 1.4 #ifdef STREAMICE_HYBRID_STRESS
74     do k=1,Nr
75     visc_streamice_full(i,j,k,bi,bj) =
76     & eps_glen_min**((1-n_glen)/n_glen)
77     enddo
78 heimbach 1.5 streamice_taubx (i,j,bi,bj) = 0. _d 0
79     streamice_tauby (i,j,bi,bj) = 0. _d 0
80 dgoldberg 1.4 #endif
81 heimbach 1.1 ENDDO
82     ENDDO
83 dgoldberg 1.6
84     #ifdef ALLOW_COST_TEST
85     cost_func1_streamice (bi,bj) = 0.0
86     #endif
87    
88 heimbach 1.1 ENDDO
89     ENDDO
90    
91     DO j = 1-oly, sNy+oly
92     DO i = 1-olx, sNx+olx
93     DO bj = myByLo(myThid), myByHi(myThid)
94     DO bi = myBxLo(myThid), myBxHi(myThid)
95     cc DO k=1,4
96     DO col_x=-1,1
97     DO col_y=-1,1
98     streamice_cg_A1(i,j,bi,bj,col_x,col_y)=0.0
99     streamice_cg_A2(i,j,bi,bj,col_x,col_y)=0.0
100     streamice_cg_A3(i,j,bi,bj,col_x,col_y)=0.0
101     streamice_cg_A4(i,j,bi,bj,col_x,col_y)=0.0
102     ENDDO
103     ENDDO
104     cc ENDDO
105     ENDDO
106     ENDDO
107     ENDDO
108     ENDDO
109    
110     C INIT. INTEGER ARRAYS
111    
112     DO bj = myByLo(myThid), myByHi(myThid)
113     DO bi = myBxLo(myThid), myBxHi(myThid)
114     DO j=1-Oly,sNy+Oly
115     DO i=1-Olx,sNx+Olx
116     STREAMICE_hmask(i,j,bi,bj) = -1.0
117     STREAMICE_umask(i,j,bi,bj) = 0.0
118     STREAMICE_vmask(i,j,bi,bj) = 0.0
119     STREAMICE_ufacemask(i,j,bi,bj) = 0.0
120     STREAMICE_vfacemask(i,j,bi,bj) = 0.0
121     STREAMICE_float_cond(i,j,bi,bj) = 0.0
122     ENDDO
123     ENDDO
124     ENDDO
125     ENDDO
126    
127 dgoldberg 1.6
128     #ifdef USE_ALT_RLOW
129     ! init alternate array for topog
130     IF ( bathyFile .NE. ' ' ) THEN
131     _BARRIER
132     C The 0 is the "iteration" argument. The ' ' is an empty suffix
133     CALL READ_FLD_XY_RS( bathyFile, '',
134     & R_low_si, 0, myThid )
135    
136     ELSE
137     WRITE(msgBuf,'(A)') 'STREAMICE TOPOG - FILENAME MISSING'
138     CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
139     & SQUEEZE_RIGHT , 1)
140     ENDIF
141     #endif
142    
143 dgoldberg 1.4 ! initialize thickness
144 heimbach 1.1
145     IF ( STREAMICEthickInit.EQ.'PARAM' ) THEN
146    
147     WRITE(msgBuf,'(A)') 'initializing analytic thickness'
148     CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
149     & SQUEEZE_RIGHT , 1)
150    
151     slope_pos = shelf_edge_pos - shelf_flat_width
152     c1 = 0.0
153     IF (shelf_slope_scale .GT. 0.0) THEN
154     c1 = 1.0 / shelf_slope_scale
155     ENDIF
156    
157     DO bj = myByLo(myThid), myByHi(myThid)
158     DO bi = myBxLo(myThid), myBxHi(myThid)
159     DO j=1,sNy
160     DO i=1,sNx
161     Gi = (myXGlobalLo-1)+(bi-1)*sNx+i
162     Gj = (myYGlobalLo-1)+(bj-1)*sNy+j
163    
164     IF ((Gi.lt.Nx).and.(Gj.lt.Ny)) THEN
165    
166     C IF (flow_dir .EQ. 2.0) THEN
167     IF (.TRUE.) THEN
168     IF (xC(i-1,j,bi,bj).GE.shelf_edge_pos) THEN
169     area_shelf_streamice(i,j,bi,bj) = 0. _d 0
170     STREAMICE_hmask(i,j,bi,bj) = 0. _d 0
171     ELSE
172    
173     IF (xC(i,j,bi,bj).GT.slope_pos) THEN
174     H_streamice (i,j,bi,bj) = shelf_min_draft
175     ELSE
176     H_streamice (i,j,bi,bj) = (shelf_min_draft +
177     & (shelf_max_draft - shelf_min_draft) *
178     & min (1.0, (c1*(slope_pos-xC(i,j,bi,bj)))**2))
179     ENDIF
180    
181     IF (xC(i,j,bi,bj).GT.shelf_edge_pos) THEN
182     area_shelf_streamice(i,j,bi,bj) = rA(i,j,bi,bj) *
183     & (shelf_edge_pos-xG(i,j,bi,bj)) /
184     & (xG(i+1,j,bi,bj)-xG(i,j,bi,bj))
185 heimbach 1.5 IF (area_shelf_streamice(i,j,bi,bj).gt. 0. _d 0) THEN
186 heimbach 1.1 STREAMICE_hmask(i,j,bi,bj) = 2.0
187     ELSE
188     STREAMICE_hmask(i,j,bi,bj) = 0.0
189     H_streamice(i,j,bi,bj) = 0.0
190     ENDIF
191     ELSE
192     area_shelf_streamice(i,j,bi,bj) = rA(i,j,bi,bj)
193     STREAMICE_hmask(i,j,bi,bj) = 1.0
194     ENDIF
195    
196    
197     ENDIF
198     ENDIF
199     ENDIF
200     ENDDO
201     ENDDO
202     ENDDO
203     ENDDO
204    
205     ELSE IF ( STREAMICEthickInit.EQ.'FILE' ) THEN
206    
207     IF ( STREAMICEthickFile .NE. ' ' ) THEN
208     _BARRIER
209     C The 0 is the "iteration" argument. The ' ' is an empty suffix
210     CALL READ_FLD_XY_RS( STREAMICEthickFile, ' ', H_streamice,
211     & 0, myThid )
212     DO bj = myByLo(myThid), myByHi(myThid)
213     DO bi = myBxLo(myThid), myBxHi(myThid)
214     DO j=1,sNy
215     DO i=1,sNx
216     Gi = (myXGlobalLo-1)+(bi-1)*sNx+i
217     Gj = (myYGlobalLo-1)+(bj-1)*sNy+j
218 dgoldberg 1.4 IF ((Gi.lt.Nx.OR.STREAMICE_EW_periodic).and.
219     & (Gj.lt.Ny.OR.STREAMICE_NS_periodic)) THEN
220 heimbach 1.1 IF (H_streamice(i,j,bi,bj).GT.0. _d 0) THEN
221     area_shelf_streamice(i,j,bi,bj) = rA(i,j,bi,bj)
222     STREAMICE_hmask(i,j,bi,bj) = 1.0
223     ELSE
224     area_shelf_streamice(i,j,bi,bj) = 0. _d 0
225     STREAMICE_hmask(i,j,bi,bj) = 0. _d 0
226     ENDIF
227     ENDIF
228     ENDDO
229     ENDDO
230     ENDDO
231     ENDDO
232     ELSE
233     WRITE(msgBuf,'(A)') 'INIT THICKNESS - FILENAME MISSING'
234     CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
235     & SQUEEZE_RIGHT , 1)
236     ENDIF
237    
238     ELSE
239    
240     WRITE(msgBuf,'(A)') 'INIT THICKNESS - NOT IMPLENTED'
241     CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
242     & SQUEEZE_RIGHT , 1)
243     ENDIF
244    
245 dgoldberg 1.4 ! finish initialize thickness
246    
247     ! initialize basal traction
248    
249     IF ( STREAMICEbasalTracConfig.EQ.'FILE' ) THEN
250    
251     IF ( STREAMICEbasalTracFile .NE. ' ' ) THEN
252     _BARRIER
253     C The 0 is the "iteration" argument. The ' ' is an empty suffix
254     CALL READ_FLD_XY_RS( STREAMICEbasalTracFile, ' ',
255     & C_basal_friction, 0, myThid )
256    
257     ELSE
258     WRITE(msgBuf,'(A)') 'INIT THICKNESS - FILENAME MISSING'
259     CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
260     & SQUEEZE_RIGHT , 1)
261     ENDIF
262    
263     ELSE IF (STREAMICEbasalTracConfig.EQ.'UNIFORM' ) THEN
264    
265     DO bj = myByLo(myThid), myByHi(myThid)
266     DO bi = myBxLo(myThid), myBxHi(myThid)
267     DO j=1,sNy
268     DO i=1,sNx
269     C_basal_friction(i,j,bi,bj) = C_basal_fric_const
270     ENDDO
271     ENDDO
272     ENDDO
273     ENDDO
274    
275     ELSE IF (STREAMICEbasalTracConfig.EQ.'2DPERIODIC' ) THEN
276    
277     lenx = sNx*nSx*nPx*delX(1)
278     leny = sNy*nSy*nPy*delY(1)
279     print *, 'lenx', lenx
280     print *, 'leny', leny
281     DO bj = myByLo(myThid), myByHi(myThid)
282     DO bi = myBxLo(myThid), myBxHi(myThid)
283     DO j=1,sNy
284     DO i=1,sNx
285     x = xC(i,j,bi,bj)
286     y = yC(i,j,bi,bj)
287     C_basal_friction(i,j,bi,bj) =
288     & sqrt(C_basal_fric_const**2*
289     & (1+sin(2*streamice_kx_b_init*PI*x/lenx)*
290     & sin(2*streamice_ky_b_init*PI*y/leny)))
291     ENDDO
292     ENDDO
293     ENDDO
294     ENDDO
295    
296     ELSE IF (STREAMICEbasalTracConfig.EQ.'1DPERIODIC' ) THEN
297    
298     lenx = sNx*nSx*nPx*delX(1)
299     print *, 'lenx', lenx
300     DO bj = myByLo(myThid), myByHi(myThid)
301     DO bi = myBxLo(myThid), myBxHi(myThid)
302     DO j=1,sNy
303     DO i=1,sNx
304     x = xC(i,j,bi,bj)
305     y = yC(i,j,bi,bj)
306     C_basal_friction(i,j,bi,bj) =
307     & sqrt(C_basal_fric_const**2*(1+
308     & sin(2*streamice_kx_b_init*PI*x/lenx)))
309     ENDDO
310     ENDDO
311     ENDDO
312     ENDDO
313    
314     ELSE
315    
316     WRITE(msgBuf,'(A)') 'INIT THICKNESS - NOT IMPLENTED'
317     CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
318     & SQUEEZE_RIGHT , 1)
319     ENDIF
320    
321     ! finish initialize basal traction
322    
323     CALL STREAMICE_UPD_FFRAC_UNCOUPLED ( myThid )
324 heimbach 1.1
325     _EXCH_XY_RL(H_streamice, myThid )
326     _EXCH_XY_RL(STREAMICE_hmask, myThid )
327     _EXCH_XY_RL(area_shelf_streamice, myThid )
328 dgoldberg 1.4 _EXCH_XY_RL(C_basal_friction, myThid )
329 dgoldberg 1.6 #ifdef USE_ALT_RLOW
330     _EXCH_XY_RL(R_low_si, myThid )
331     #endif
332 dgoldberg 1.4
333     #ifdef STREAMICE_HYBRID_STRESS
334    
335     CALL STREAMICE_VISC_BETA (myThid)
336    
337     #endif
338 dgoldberg 1.6
339     CALL WRITE_FLD_XY_RL ( "C_basal_fric", "",
340     & C_basal_friction, 0, myThid )
341 heimbach 1.1 CALL WRITE_FLD_XY_RL ( "H_streamice", "init",
342     & H_streamIce, 0, myThid )
343     CALL WRITE_FLD_XY_RL ( "area_shelf_streamice", "init",
344     & area_shelf_streamice, 0, myThid )
345     CALL WRITE_FLD_XY_RL ( "STREAMICE_hmask", "init",
346     & STREAMICE_hmask, 0, myThid )
347    
348 dgoldberg 1.2 ! CALL STREAMICE_VELMASK_UPD (myThid)
349     ! CALL STREAMICE_UPD_FFRAC_UNCOUPLED ( myThid )
350     ! CALL STREAMICE_VEL_SOLVE( myThid )
351 heimbach 1.1
352     CALL WRITE_FLD_XY_RL ( "U_init", "",
353 dgoldberg 1.4 & C_basal_friction, 0, myThid )
354 heimbach 1.1 CALL WRITE_FLD_XY_RL ( "V_init", "",
355     & V_streamice, 0, myThid )
356 dgoldberg 1.6 #ifdef USE_ALT_RLOW
357     CALL WRITE_FLD_XY_RL ( "R_low_si", "init",
358     & R_low_si, 0, myThid )
359     #endif
360 heimbach 1.1
361     ! CALL WRITE_FULLARRAY_RL ("H",H_streamice,1,0,0,1,0,myThid)
362     ! CALL WRITE_FULLARRAY_RL ("hmask",STREAMICE_hmask,1,0,0,1,0,myThid)
363     ! CALL WRITE_FULLARRAY_RL ("umask",STREAMICE_umask,1,0,0,1,0,myThid)
364    
365     #endif /* ALLOW_STREAMICE */
366    
367     RETURN
368     END
369    

  ViewVC Help
Powered by ViewVC 1.1.22