1 |
C $Header: /u/gcmpack/MITgcm_contrib/verification_other/shelfice_remeshing/code/shelfice_init_fixed_remesh.F,v 1.1 2016/05/05 18:17:26 dgoldberg Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "SHELFICE_OPTIONS.h" |
5 |
#ifdef ALLOW_COST |
6 |
# include "COST_OPTIONS.h" |
7 |
#endif |
8 |
#ifdef ALLOW_CTRL |
9 |
# include "CTRL_OPTIONS.h" |
10 |
#endif |
11 |
|
12 |
SUBROUTINE SHELFICE_INIT_FIXED_REMESH( myThid ) |
13 |
C *============================================================* |
14 |
C | SUBROUTINE SHELFICE_INIT_FIXED |
15 |
C | o Routine to initialize SHELFICE parameters and variables. |
16 |
C *============================================================* |
17 |
C | Initialize SHELFICE parameters and variables. |
18 |
C *============================================================* |
19 |
IMPLICIT NONE |
20 |
|
21 |
C === Global variables === |
22 |
#include "SIZE.h" |
23 |
#include "EEPARAMS.h" |
24 |
#include "PARAMS.h" |
25 |
#include "GRID.h" |
26 |
#include "SHELFICE.h" |
27 |
#ifdef ALLOW_COST |
28 |
# include "cost.h" |
29 |
# include "SHELFICE_COST.h" |
30 |
#endif /* ALLOW_COST */ |
31 |
|
32 |
C === Routine arguments === |
33 |
C myThid :: Number of this instance of SHELFICE_INIT_FIXED |
34 |
INTEGER myThid |
35 |
|
36 |
#ifdef ALLOW_SHELFICE |
37 |
#ifdef ALLOW_SHELFICE_REMESHING |
38 |
C === Local variables === |
39 |
C i, j, bi, bj :: Loop counters |
40 |
INTEGER i, j, bi, bj |
41 |
#ifdef ALLOW_DIAGNOSTICS |
42 |
INTEGER diagNum |
43 |
INTEGER diagMate |
44 |
CHARACTER*8 diagName |
45 |
CHARACTER*16 diagCode |
46 |
CHARACTER*16 diagUnits |
47 |
CHARACTER*(80) diagTitle |
48 |
#endif /* ALLOW_DIAGNOSTICS */ |
49 |
#if (defined (ALLOW_SHIFWFLX_COST_CONTRIBUTION) && \ |
50 |
defined (ALLOW_SHIFWFLX_CONTROL)) |
51 |
_RL dummy |
52 |
#endif |
53 |
|
54 |
#ifdef ALLOW_MNC |
55 |
C Initialize MNC variable information for SHELFICE |
56 |
IF ( useMNC .AND. (shelfice_tave_mnc.OR.shelfice_dump_mnc) |
57 |
& ) THEN |
58 |
CALL SHELFICE_MNC_INIT( myThid ) |
59 |
ENDIF |
60 |
#endif /* ALLOW_MNC */ |
61 |
|
62 |
C----------------------------------------------------------------------- |
63 |
C-- Initialize SHELFICE variables kTopC |
64 |
C-- kTopC is the same as kSurfC, except outside ice-shelf area: |
65 |
C-- kTop = 0 where there is no ice-shelf (where kSurfC=1) |
66 |
C-- and over land (completely dry column) where kSurfC = Nr+1 |
67 |
C----------------------------------------------------------------------- |
68 |
|
69 |
DO bj = myByLo(myThid), myByHi(myThid) |
70 |
DO bi = myBxLo(myThid), myBxHi(myThid) |
71 |
DO j = 1-OLy, sNy+OLy |
72 |
DO i = 1-OLx, sNx+OLx |
73 |
IF ( kSurfC(i,j,bi,bj).LE.Nr .AND. |
74 |
& R_shelfIce(i,j,bi,bj).LT.zeroRS ) THEN |
75 |
kTopC(i,j,bi,bj) = kSurfC(i,j,bi,bj) |
76 |
ELSE |
77 |
kTopC(i,j,bi,bj) = 0 |
78 |
ENDIF |
79 |
shelficeMassInit (i,j,bi,bj) = 0. _d 0 |
80 |
shelficeLoadAnomaly(i,j,bi,bj) = 0. _d 0 |
81 |
shelfIceMassDynTendency(i,j,bi,bj) = 0. _d 0 |
82 |
ENDDO |
83 |
ENDDO |
84 |
ENDDO |
85 |
ENDDO |
86 |
#ifdef ALLOW_COST |
87 |
#if (defined (ALLOW_SHIFWFLX_COST_CONTRIBUTION) && \ |
88 |
defined (ALLOW_SHIFWFLX_CONTROL)) |
89 |
IF ( shifwflx_errfile .NE. ' ' ) THEN |
90 |
CALL READ_REC_XY_RL( shifwflx_errfile, wshifwflx, 1, 0, myThid ) |
91 |
ENDIF |
92 |
|
93 |
DO bj = myByLo(myThid), myByHi(myThid) |
94 |
DO bi = myBxLo(myThid), myBxHi(myThid) |
95 |
DO j = 1-OLy, sNy+OLy |
96 |
DO i = 1-OLx, sNx+OLx |
97 |
c-- Test for missing values. |
98 |
IF (wshifwflx(i,j,bi,bj) .LT. -9900.) THEN |
99 |
wshifwflx(i,j,bi,bj) = 0. _d 0 |
100 |
ENDIF |
101 |
c-- use weight as mask |
102 |
wshifwflx(i,j,bi,bj) = |
103 |
& max(wshifwflx(i,j,bi,bj),wshifwflx0) |
104 |
& *maskSHI(i,j,1,bi,bj) |
105 |
IF (wshifwflx(i,j,bi,bj) .NE. 0.) THEN |
106 |
wshifwflx(i,j,bi,bj) = |
107 |
& 1./wshifwflx(i,j,bi,bj)/wshifwflx(i,j,bi,bj) |
108 |
ENDIF |
109 |
ENDDO |
110 |
ENDDO |
111 |
ENDDO |
112 |
ENDDO |
113 |
CALL ACTIVE_WRITE_XY_LOC( 'wshifwflx', wshifwflx, |
114 |
& 1, 0, myThid, dummy ) |
115 |
#endif /* ALLOW_SHIFWFLX_COST_CONTRIBUTION and ALLOW_SHIFWFLX_CONTROL */ |
116 |
#endif /* ALLOW_COST */ |
117 |
|
118 |
IF ( SHELFICEloadAnomalyFile .NE. ' ' ) THEN |
119 |
CALL READ_FLD_XY_RL( SHELFICEloadAnomalyFile, ' ', |
120 |
& shelficeLoadAnomaly, 0, myThid ) |
121 |
ENDIF |
122 |
IF ( SHELFICEmassFile.NE.' ' ) THEN |
123 |
CALL READ_FLD_XY_RL( SHELFICEmassFile, ' ', |
124 |
& shelficeMassInit, 0, myThid ) |
125 |
ELSE |
126 |
DO bj = myByLo(myThid), myByHi(myThid) |
127 |
DO bi = myBxLo(myThid), myBxHi(myThid) |
128 |
DO j = 1, sNy |
129 |
DO i = 1, sNx |
130 |
shelficeMassInit(i,j,bi,bj) = |
131 |
& shelficeLoadAnomaly(i,j,bi,bj)*recip_gravity |
132 |
& - rhoConst*Ro_surf(i,j,bi,bj) |
133 |
ENDDO |
134 |
ENDDO |
135 |
ENDDO |
136 |
ENDDO |
137 |
ENDIF |
138 |
_EXCH_XY_RL( shelficeMassInit, myThid ) |
139 |
CALL WRITE_FLD_XY_RL ( 'shelficemassinit', ' ', |
140 |
& shelficeMassInit, 0, myThid ) |
141 |
|
142 |
c IF ( SHELFICEloadAnomalyFile .EQ. ' ' ) THEN |
143 |
C- In case we need shelficeLoadAnomaly in phi0surf for initial pressure |
144 |
C calculation when useDynP_inEos_Zc |
145 |
DO bj = myByLo(myThid), myByHi(myThid) |
146 |
DO bi = myBxLo(myThid), myBxHi(myThid) |
147 |
DO j = 1-OLy, sNy+OLy |
148 |
DO i = 1-OLx, sNx+OLx |
149 |
shelficeLoadAnomaly(i,j,bi,bj) = gravity |
150 |
& *(shelficeMassInit(i,j,bi,bj)+rhoConst*Ro_surf(i,j,bi,bj)) |
151 |
ENDDO |
152 |
ENDDO |
153 |
ENDDO |
154 |
ENDDO |
155 |
c ELSE |
156 |
c _EXCH_XY_RS( shelficeLoadAnomaly, myThid ) |
157 |
c ENDIF |
158 |
IF ( debugLevel.GE.debLevC ) THEN |
159 |
CALL WRITE_FLD_XY_RL( 'SHICE_pLoadAnom', ' ', |
160 |
I shelficeLoadAnomaly, -1, myThid ) |
161 |
ENDIF |
162 |
|
163 |
IF ( SHELFICEMassStepping .AND. |
164 |
& SHELFICEMassDynTendFile .NE. ' ' ) THEN |
165 |
CALL READ_FLD_XY_RS( SHELFICEMassDynTendFile, ' ', |
166 |
& shelfIceMassDynTendency, 0, myThid ) |
167 |
ENDIF |
168 |
|
169 |
#endif |
170 |
#endif /* ALLOW_SHELFICE */ |
171 |
|
172 |
RETURN |
173 |
END |