1 |
C $Header: /u/gcmpack/MITgcm/pkg/seaice/seaice_freedrift.F,v 1.2 2010/10/07 19:54:45 gforget Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "SEAICE_OPTIONS.h" |
5 |
|
6 |
CBOP |
7 |
SUBROUTINE SEAICE_FREEDRIFT( myTime, myIter, myThid ) |
8 |
C /==========================================================\ |
9 |
C | SUBROUTINE SEAICE_FREEDRIFT | |
10 |
C | o Solve ice approximate momentum equation analytically | |
11 |
C \==========================================================/ |
12 |
IMPLICIT NONE |
13 |
|
14 |
C === Global variables === |
15 |
#include "SIZE.h" |
16 |
#include "EEPARAMS.h" |
17 |
#include "PARAMS.h" |
18 |
#include "DYNVARS.h" |
19 |
#include "GRID.h" |
20 |
#include "SEAICE.h" |
21 |
#include "SEAICE_PARAMS.h" |
22 |
|
23 |
#ifdef ALLOW_AUTODIFF_TAMC |
24 |
# include "tamc.h" |
25 |
#endif |
26 |
|
27 |
C === Routine arguments === |
28 |
C myTime :: Simulation time |
29 |
C myIter :: Simulation timestep number |
30 |
C myThid :: my Thread Id. number |
31 |
_RL myTime |
32 |
INTEGER myIter |
33 |
INTEGER myThid |
34 |
CEOP |
35 |
|
36 |
#ifdef SEAICE_ALLOW_FREEDRIFT |
37 |
#ifdef SEAICE_CGRID |
38 |
|
39 |
C === Local variables === |
40 |
INTEGER i, j, kSrf, bi, bj |
41 |
|
42 |
_RL tmpscal1,tmpscal2,tmpscal3,tmpscal4 |
43 |
|
44 |
_RL taux_onIce_cntr, tauy_onIce_cntr, uvel_cntr, vvel_cntr |
45 |
_RL mIceCor, rhs_x, rhs_y, rhs_n, rhs_a, sol_n, sol_a |
46 |
|
47 |
_RL uice_cntr(1-Olx:sNx+Olx,1-Oly:sNy+Oly,nSx,nSy) |
48 |
_RL vice_cntr(1-Olx:sNx+Olx,1-Oly:sNy+Oly,nSx,nSy) |
49 |
|
50 |
|
51 |
kSrf=1 |
52 |
|
53 |
c initialize fields: |
54 |
c ================== |
55 |
|
56 |
DO bj=myByLo(myThid),myByHi(myThid) |
57 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
58 |
DO j=1-OLy,sNy+OLy |
59 |
DO i=1-OLx,sNx+OLx |
60 |
uice_fd(i,j,bi,bj)=0. _d 0 |
61 |
vice_fd(i,j,bi,bj)=0. _d 0 |
62 |
uice_cntr(i,j,bi,bj)=0. _d 0 |
63 |
Vice_cntr(i,j,bi,bj)=0. _d 0 |
64 |
ENDDO |
65 |
ENDDO |
66 |
ENDDO |
67 |
ENDDO |
68 |
|
69 |
CALL EXCH_UV_XY_RL( TAUX, TAUY, .TRUE., myThid ) |
70 |
|
71 |
|
72 |
DO bj=myByLo(myThid),myByHi(myThid) |
73 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
74 |
DO j=1,sNy |
75 |
DO i=1,sNx |
76 |
|
77 |
c preliminary computations: |
78 |
c ========================= |
79 |
c factor to convert air-sea stress to air-ice stresss |
80 |
IF ( YC(I,J,bi,bj) .LT. ZERO ) THEN |
81 |
tmpscal1 = SEAICE_drag_south/OCEAN_drag |
82 |
ELSE |
83 |
tmpscal1 = SEAICE_drag /OCEAN_drag |
84 |
ENDIF |
85 |
c air-ice stress at cell center |
86 |
taux_onIce_cntr= |
87 |
& tmpscal1*HALF*(TAUX(i,j,bi,bj)+TAUX(i+1,j,bi,bj)) |
88 |
tauy_onIce_cntr= |
89 |
& tmpscal1*HALF*(TAUY(i,j,bi,bj)+TAUY(i,j+1,bi,bj)) |
90 |
c mass of ice per unit area (kg/m2) times coriolis f |
91 |
mIceCor=SEAICE_rhoIce*HEFF(i,j,bi,bj)*_fCori(I,J,bi,bj) |
92 |
c ocean velocity at cell center |
93 |
uvel_cntr=HALF*(uvel(i,j,kSrf,bi,bj)+uvel(i+1,j,kSrf,bi,bj)) |
94 |
vvel_cntr=HALF*(vvel(i,j,kSrf,bi,bj)+vvel(i,j+1,kSrf,bi,bj)) |
95 |
c right hand side of free drift equation: |
96 |
rhs_x= -taux_onIce_cntr -mIceCor*vvel_cntr |
97 |
rhs_y= -tauy_onIce_cntr +mIceCor*uvel_cntr |
98 |
|
99 |
c norm of angle of rhs |
100 |
tmpscal1=rhs_x*rhs_x + rhs_y*rhs_y |
101 |
if (tmpscal1.GT.0.) then |
102 |
rhs_n=sqrt( rhs_x*rhs_x + rhs_y*rhs_y ) |
103 |
rhs_a=atan2(rhs_y,rhs_x) |
104 |
else |
105 |
rhs_n=0. _d 0 |
106 |
rhs_a=0. _d 0 |
107 |
endif |
108 |
|
109 |
c solve for norm: |
110 |
c =============== |
111 |
IF ( YC(I,J,bi,bj) .LT. ZERO ) THEN |
112 |
tmpscal1 = 1. _d 0 /SEAICE_waterDrag_south |
113 |
ELSE |
114 |
tmpscal1 = 1. _d 0 /SEAICE_waterDrag |
115 |
ENDIF |
116 |
c polynomial coefficients |
117 |
tmpscal2= +tmpscal1*tmpscal1*mIceCor*mIceCor |
118 |
tmpscal3= -tmpscal1*tmpscal1*rhs_n*rhs_n |
119 |
c discriminant |
120 |
tmpscal4=tmpscal2*tmpscal2-4*tmpscal3 |
121 |
if (tmpscal4.GT.0) then |
122 |
sol_n=sqrt(HALF*(sqrt(tmpscal4)-tmpscal2)) |
123 |
else |
124 |
sol_n=0. _d 0 |
125 |
endif |
126 |
|
127 |
c solve for angle: |
128 |
c ================ |
129 |
IF ( YC(I,J,bi,bj) .LT. ZERO ) THEN |
130 |
tmpscal1 = SEAICE_waterDrag_south |
131 |
ELSE |
132 |
tmpscal1 = SEAICE_waterDrag |
133 |
ENDIF |
134 |
c |
135 |
tmpscal2= tmpscal1*sol_n*sol_n |
136 |
tmpscal3= mIceCor*sol_n |
137 |
c |
138 |
tmpscal4=tmpscal2*tmpscal2 + tmpscal3*tmpscal3 |
139 |
if (tmpscal4.GT.0) then |
140 |
sol_a=rhs_a-atan2(tmpscal3,tmpscal2) |
141 |
else |
142 |
sol_a=0. _d 0 |
143 |
endif |
144 |
|
145 |
c compute uice, vice at cell center: |
146 |
c ================================== |
147 |
uice_cntr(i,j,bi,bj)=uvel_cntr-sol_n*cos(sol_a) |
148 |
vice_cntr(i,j,bi,bj)=vvel_cntr-sol_n*sin(sol_a) |
149 |
|
150 |
ENDDO |
151 |
ENDDO |
152 |
ENDDO |
153 |
ENDDO |
154 |
|
155 |
|
156 |
c interpolated to velocity points: |
157 |
c ================================ |
158 |
|
159 |
CALL EXCH_UV_AGRID_3D_RL(uice_cntr,vice_cntr,.TRUE.,1,myThid) |
160 |
|
161 |
DO bj=myByLo(myThid),myByHi(myThid) |
162 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
163 |
DO j=1,sNy |
164 |
DO i=1,sNx |
165 |
uice_fd(i,j,bi,bj)=HALF* |
166 |
& (uice_cntr(i-1,j,bi,bj)+uice_cntr(i,j,bi,bj)) |
167 |
vice_fd(i,j,bi,bj)=HALF* |
168 |
& (vice_cntr(i,j-1,bi,bj)+vice_cntr(i,j,bi,bj)) |
169 |
ENDDO |
170 |
ENDDO |
171 |
ENDDO |
172 |
ENDDO |
173 |
|
174 |
CALL EXCH_UV_XY_RL( uice_fd, vice_fd, .TRUE., myThid ) |
175 |
|
176 |
C Apply masks (same/similar to seaice_evp.F/seaice_lsr.F) |
177 |
DO bj=myByLo(myThid),myByHi(myThid) |
178 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
179 |
DO j=1-Oly,sNy+Oly |
180 |
DO i=1-Olx,sNx+Olx |
181 |
uIce_fd(i,j,bi,bj)=uIce_fd(i,j,bi,bj)* _maskW(i,j,kSrf,bi,bj) |
182 |
vIce_fd(i,j,bi,bj)=vIce_fd(i,j,bi,bj)* _maskS(i,j,kSrf,bi,bj) |
183 |
ENDDO |
184 |
ENDDO |
185 |
ENDDO |
186 |
ENDDO |
187 |
|
188 |
#endif /* SEAICE_CGRID */ |
189 |
#endif /* SEAICE_ALLOW_FREEDRIFT */ |
190 |
RETURN |
191 |
END |