/[MITgcm]/MITgcm/pkg/seaice/seaice_calc_lhs.F
ViewVC logotype

Contents of /MITgcm/pkg/seaice/seaice_calc_lhs.F

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


Revision 1.12 - (show annotations) (download)
Thu Dec 17 11:37:39 2015 UTC (8 years, 5 months ago) by mlosch
Branch: MAIN
CVS Tags: checkpoint65r, checkpoint65s, checkpoint65v, checkpoint65t, checkpoint65u
Changes since 1.11: +5 -5 lines
this is yet another bug: actually apply "weights" areaS and areaW after
computing them

1 C $Header: /u/gcmpack/MITgcm/pkg/seaice/seaice_calc_lhs.F,v 1.11 2015/12/16 12:16:08 mlosch Exp $
2 C $Name: $
3
4 #include "SEAICE_OPTIONS.h"
5 #ifdef ALLOW_AUTODIFF
6 # include "AUTODIFF_OPTIONS.h"
7 #endif
8
9 CBOP
10 C !ROUTINE: SEAICE_CALC_LHS
11 C !INTERFACE:
12 SUBROUTINE SEAICE_CALC_LHS(
13 I uIceLoc, vIceLoc,
14 O uIceLHS, vIceLHS,
15 I newtonIter, myTime, myIter, myThid )
16
17 C !DESCRIPTION: \bv
18 C *==========================================================*
19 C | SUBROUTINE SEAICE_CALC_LHS
20 C | o Left-hand side of momentum equations, i.e. all terms
21 C | that depend on the ice velocities of the current
22 C | iterate of the Newton-Krylov iteration
23 C |
24 C | o The scheme is backward Euler in time, i.e. the
25 C | rhs-vector contains only terms that are independent
26 C | of u/vIce, except for the time derivative part
27 C | mass*(u/vIce-u/vIceNm1)/deltaT
28 C | o Left-hand side contributions
29 C | + mass*(u/vIce)/deltaT
30 C | + Cdrag*(uIce*cosWat - vIce*sinWat)
31 C | /(vIce*cosWat + uIce*sinWat)
32 C | - mass*f*vIce/+mass*f*uIce
33 C | - dsigma/dx / -dsigma/dy, eta and zeta are
34 C | computed only once per Newton iterate
35 C *==========================================================*
36 C | written by Martin Losch, Oct 2012
37 C *==========================================================*
38 C \ev
39
40 C !USES:
41 IMPLICIT NONE
42
43 C === Global variables ===
44 #include "SIZE.h"
45 #include "EEPARAMS.h"
46 #include "PARAMS.h"
47 #include "GRID.h"
48 #include "SEAICE_SIZE.h"
49 #include "SEAICE_PARAMS.h"
50 #include "SEAICE.h"
51
52 #ifdef ALLOW_AUTODIFF_TAMC
53 # include "tamc.h"
54 #endif
55
56 C !INPUT/OUTPUT PARAMETERS:
57 C === Routine arguments ===
58 C myTime :: Simulation time
59 C myIter :: Simulation timestep number
60 C myThid :: my Thread Id. number
61 C newtonIter :: current iterate of Newton iteration
62 _RL myTime
63 INTEGER myIter
64 INTEGER myThid
65 INTEGER newtonIter
66 C u/vIceLoc :: local copies of the current ice velocity
67 _RL uIceLoc(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
68 _RL vIceLoc(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
69 C u/vIceLHS :: LHS of momentum equations
70 _RL uIceLHS(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
71 _RL vIceLHS(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
72
73 #ifdef SEAICE_ALLOW_JFNK
74 C i,j,bi,bj,k :: loop indices
75 INTEGER i,j,bi,bj
76 INTEGER k
77 _RS SINWAT
78 _RL COSWAT, recip_deltaT, eplus, eminus
79 C backward difference extrapolation factor
80 _RL bdfAlpha
81 C components of symmetric stress tensor
82 _RL sig11(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
83 _RL sig22(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
84 _RL sig12(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
85 C fractional area at velocity points
86 _RL areaW(1:sNx,1:sNy)
87 _RL areaS(1:sNx,1:sNy)
88 CEOP
89
90 k=1
91 recip_deltaT = 1. _d 0 / SEAICE_deltaTdyn
92 C-- introduce turning angles
93 SINWAT=SIN(SEAICE_waterTurnAngle*deg2rad)
94 COSWAT=COS(SEAICE_waterTurnAngle*deg2rad)
95 C backward difference extrapolation factor
96 bdfAlpha = 1. _d 0
97 IF ( SEAICEuseBDF2 ) THEN
98 IF ( myIter.EQ.nIter0 .AND. SEAICEmomStartBDF.EQ.0 ) THEN
99 bdfAlpha = 1. _d 0
100 ELSE
101 bdfAlpha = 1.5 _d 0
102 ENDIF
103 ENDIF
104
105 C initialise fractional areas at velocity points
106 DO J=1,sNy
107 DO I=1,sNx
108 areaW(I,J) = 1. _d 0
109 areaS(I,J) = 1. _d 0
110 ENDDO
111 ENDDO
112
113 DO bj=myByLo(myThid),myByHi(myThid)
114 DO bi=myBxLo(myThid),myBxHi(myThid)
115 C compute components of stress tensor from current velocity field
116 DO j=1-OLy,sNy+OLy
117 DO i=1-OLx,sNx+OLx
118 sig11(I,J) = 0. _d 0
119 sig22(I,J) = 0. _d 0
120 sig12(I,J) = 0. _d 0
121 ENDDO
122 ENDDO
123
124 DO j=0,sNy
125 DO i=0,sNx
126 eplus = e11(I,J,bi,bj) + e22(I,J,bi,bj)
127 eminus= e11(I,J,bi,bj) - e22(I,J,bi,bj)
128 sig11(I,J) = zeta(I,J,bi,bj)*eplus + eta(I,J,bi,bj)*eminus
129 & - 0.5 _d 0 * PRESS(I,J,bi,bj)
130 sig22(I,J) = zeta(I,J,bi,bj)*eplus - eta(I,J,bi,bj)*eminus
131 & - 0.5 _d 0 * PRESS(I,J,bi,bj)
132 ENDDO
133 ENDDO
134
135 DO j=1,sNy+1
136 DO i=1,sNx+1
137 sig12(I,J) = 2. _d 0 * e12(I,J,bi,bj) * etaZ(I,J,bi,bj)
138 ENDDO
139 ENDDO
140 C
141 C compute divergence of stress tensor
142 C
143 DO J=1,sNy
144 DO I=1,sNx
145 stressDivergenceX(I,J,bi,bj) =
146 & ( sig11(I ,J ) * _dyF(I ,J,bi,bj)
147 & - sig11(I-1,J ) * _dyF(I-1,J,bi,bj)
148 & + sig12(I ,J+1) * _dxV(I,J+1,bi,bj)
149 & - sig12(I ,J ) * _dxV(I,J ,bi,bj)
150 & ) * recip_rAw(I,J,bi,bj)
151 stressDivergenceY(I,J,bi,bj) =
152 & ( sig22(I ,J ) * _dxF(I,J ,bi,bj)
153 & - sig22(I ,J-1) * _dxF(I,J-1,bi,bj)
154 & + sig12(I+1,J ) * _dyU(I+1,J,bi,bj)
155 & - sig12(I ,J ) * _dyU(I ,J,bi,bj)
156 & ) * recip_rAs(I,J,bi,bj)
157 ENDDO
158 ENDDO
159 C compute lhs side of momentum equations
160 IF ( SEAICEscaleSurfStress ) THEN
161 DO J=1,sNy
162 DO I=1,sNx
163 areaW(I,J) = 0.5 _d 0*(AREA(I,J,bi,bj)+AREA(I-1,J,bi,bj))
164 areaS(I,J) = 0.5 _d 0*(AREA(I,J,bi,bj)+AREA(I,J-1,bi,bj))
165 ENDDO
166 ENDDO
167 ENDIF
168 DO J=1,sNy
169 DO I=1,sNx
170 C mass*(uIce)/deltaT - dsigma/dx
171 uIceLHS(I,J,bi,bj) =
172 & bdfAlpha*seaiceMassU(I,J,bi,bj)*recip_deltaT
173 & *uIceLoc(I,J,bi,bj) - stressDivergenceX(I,J,bi,bj)
174 C mass*(vIce)/deltaT - dsigma/dy
175 vIceLHS(I,J,bi,bj) =
176 & bdfAlpha*seaiceMassV(I,J,bi,bj)*recip_deltaT
177 & *vIceLoc(I,J,bi,bj) - stressDivergenceY(I,J,bi,bj)
178 C coriols terms: - mass*f*vIce
179 uIceLHS(I,J,bi,bj) = uIceLHS(I,J,bi,bj) - 0.5 _d 0*(
180 & seaiceMassC(I ,J,bi,bj) * _fCori(I ,J,bi,bj)
181 & * 0.5 _d 0*( vIceLoc(I ,J,bi,bj)+vIceLoc(I ,J+1,bi,bj) )
182 & + seaiceMassC(I-1,J,bi,bj) * _fCori(I-1,J,bi,bj)
183 & * 0.5 _d 0*( vIceLoc(I-1,J,bi,bj)+vIceLoc(I-1,J+1,bi,bj) )
184 & )
185 C + mass*f*uIce
186 vIceLHS(I,J,bi,bj) = vIceLHS(I,J,bi,bj) + 0.5 _d 0*(
187 & seaiceMassC(I,J ,bi,bj) * _fCori(I,J ,bi,bj)
188 & * 0.5 _d 0*( uIceLoc(I,J ,bi,bj)+uIceLoc(I+1, J,bi,bj) )
189 & + seaiceMassC(I,J-1,bi,bj) * _fCori(I,J-1,bi,bj)
190 & * 0.5 _d 0*( uIceLoc(I,J-1,bi,bj)+uIceLoc(I+1,J-1,bi,bj) )
191 & )
192 C ocean-ice drag terms: + Cdrag*(uIce*cosWat - vIce*sinWat)
193 uIceLHS(I,J,bi,bj) = uIceLHS(I,J,bi,bj) + (
194 & 0.5 _d 0 * ( DWATN(I,J,bi,bj)+DWATN(I-1,J,bi,bj) ) *
195 & COSWAT * uIceLoc(I,J,bi,bj)
196 & - SIGN(SINWAT, _fCori(I,J,bi,bj))* 0.5 _d 0 *
197 & ( DWATN(I ,J,bi,bj) * 0.5 _d 0 *
198 & (vIceLoc(I ,J,bi,bj)+vIceLoc(I ,J+1,bi,bj))
199 & + DWATN(I-1,J,bi,bj) * 0.5 _d 0 *
200 & (vIceLoc(I-1,J,bi,bj)+vIceLoc(I-1,J+1,bi,bj))
201 & ) ) * areaW(I,J)
202 C + Cdrag*(vIce*cosWat + uIce*sinWat)
203 vIceLHS(I,J,bi,bj) = vIceLHS(I,J,bi,bj) + (
204 & 0.5 _d 0 * ( DWATN(I,J,bi,bj)+DWATN(I,J-1,bi,bj) ) *
205 & COSWAT * vIceLoc(I,J,bi,bj)
206 & + SIGN(SINWAT, _fCori(I,J,bi,bj)) * 0.5 _d 0 *
207 & ( DWATN(I,J ,bi,bj) * 0.5 _d 0 *
208 & (uIceLoc(I,J ,bi,bj)+uIceLoc(I+1,J ,bi,bj))
209 & + DWATN(I,J-1,bi,bj) * 0.5 _d 0 *
210 & (uIceLoc(I,J-1,bi,bj)+uIceLoc(I+1,J-1,bi,bj))
211 & ) ) * areaS(I,J)
212 C apply masks for interior (important when we have open boundaries)
213 uIceLHS(I,J,bi,bj) = uIceLHS(I,J,bi,bj)*maskinW(I,J,bi,bj)
214 vIceLHS(I,J,bi,bj) = vIceLHS(I,J,bi,bj)*maskinS(I,J,bi,bj)
215 ENDDO
216 ENDDO
217 ENDDO
218 ENDDO
219
220 #endif /* SEAICE_ALLOW_JFNK */
221
222 RETURN
223 END

  ViewVC Help
Powered by ViewVC 1.1.22