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

Annotation of /MITgcm/pkg/seaice/seaice_calc_strainrates.F

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


Revision 1.19 - (hide annotations) (download)
Tue Mar 6 16:45:20 2012 UTC (13 years, 3 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint64a, checkpoint64c, checkpoint64b, checkpoint64d, checkpoint63p, checkpoint63q, checkpoint63r, checkpoint63s, checkpoint63l, checkpoint63m, checkpoint63n, checkpoint63o, checkpoint63k, checkpoint64
Changes since 1.18: +18 -17 lines
add SEAICE_SIZE.h anywhere SEAICE.h is included

1 jmc 1.19 C $Header: /u/gcmpack/MITgcm/pkg/seaice/seaice_calc_strainrates.F,v 1.18 2011/10/21 17:32:01 jmc Exp $
2 mlosch 1.1 C $Name: $
3    
4     #include "SEAICE_OPTIONS.h"
5 jmc 1.18 #ifdef ALLOW_OBCS
6     # include "OBCS_OPTIONS.h"
7     #else
8     # define OBCS_UVICE_OLD
9     #endif
10 mlosch 1.1
11 jmc 1.18 CBOP
12     C !ROUTINE: SEAICE_CALC_STRAINRATES
13     C !INTERFACE:
14 jmc 1.8 SUBROUTINE SEAICE_CALC_STRAINRATES(
15 mlosch 1.1 I uFld, vFld,
16 mlosch 1.12 O e11Loc, e22Loc, e12Loc,
17 mlosch 1.14 I iStep, myTime, myIter, myThid )
18 jmc 1.18
19     C !DESCRIPTION: \bv
20     C *==========================================================*
21     C | SUBROUTINE SEAICE_CALC_STRAINRATES
22     C | o compute strain rates from ice velocities
23     C *==========================================================*
24     C | written by Martin Losch, Apr 2007
25     C *==========================================================*
26     C \ev
27    
28     C !USES:
29 mlosch 1.1 IMPLICIT NONE
30    
31     C === Global variables ===
32     #include "SIZE.h"
33     #include "EEPARAMS.h"
34     #include "PARAMS.h"
35     #include "GRID.h"
36 jmc 1.19 #include "SEAICE_SIZE.h"
37 mlosch 1.1 #include "SEAICE_PARAMS.h"
38 mlosch 1.11 #include "SEAICE.h"
39 mlosch 1.1
40     #ifdef ALLOW_AUTODIFF_TAMC
41     # include "tamc.h"
42     #endif
43    
44 jmc 1.18 C !INPUT/OUTPUT PARAMETERS:
45 mlosch 1.1 C === Routine arguments ===
46 jmc 1.18 C uFld :: ice velocity, u-component
47     C vFld :: ice velocity, v-component
48     C e11Loc :: strain rate tensor, component 1,1
49     C e22Loc :: strain rate tensor, component 2,2
50     C e12Loc :: strain rate tensor, component 1,2
51 jmc 1.8 C iStep :: Sub-time-step number
52     C myTime :: Simulation time
53     C myIter :: Simulation timestep number
54     C myThid :: My Thread Id. number
55 jmc 1.19 _RL uFld (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
56     _RL vFld (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
57 mlosch 1.12 _RL e11Loc (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
58     _RL e22Loc (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
59     _RL e12Loc (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
60 jmc 1.18 INTEGER iStep
61     _RL myTime
62     INTEGER myIter
63     INTEGER myThid
64     CEOP
65 mlosch 1.1
66     #ifdef SEAICE_CGRID
67     #ifdef SEAICE_ALLOW_DYNAMICS
68 jmc 1.18 C !LOCAL VARIABLES:
69 mlosch 1.1 C === Local variables ===
70 jmc 1.18 C i,j,bi,bj :: Loop counters
71 mlosch 1.1 INTEGER i, j, bi, bj
72 jmc 1.18 C hFacU, hFacV :: determine the no-slip boundary condition
73 mlosch 1.2 INTEGER k
74 mlosch 1.11 _RS hFacU, hFacV, noSlipFac
75 mlosch 1.15 C auxillary variables that help writing code that
76     C vectorizes even after TAFization
77     _RL dudx (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
78     _RL dvdy (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
79     _RL dudy (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
80     _RL dvdx (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
81     _RL uave (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
82     _RL vave (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
83 mlosch 1.2
84 mlosch 1.4 k = 1
85 mlosch 1.11 noSlipFac = 0. _d 0
86     IF ( SEAICE_no_slip ) noSlipFac = 1. _d 0
87 mlosch 1.1 C
88 mlosch 1.11 DO bj=myByLo(myThid),myByHi(myThid)
89     DO bi=myBxLo(myThid),myBxHi(myThid)
90 mlosch 1.15 C abbreviations on C-points, need to do them in separate loops
91     C for vectorization
92 jmc 1.19 DO j=1-OLy,sNy+OLy-1
93     DO i=1-OLx,sNx+OLx-1
94 jmc 1.18 dudx(i,j) = _recip_dxF(i,j,bi,bj) *
95     & (uFld(i+1,j,bi,bj)-uFld(i,j,bi,bj))
96     uave(i,j) = 0.5 _d 0 * (uFld(i,j,bi,bj)+uFld(i+1,j,bi,bj))
97 mlosch 1.15 ENDDO
98     ENDDO
99 jmc 1.19 DO j=1-OLy,sNy+OLy-1
100     DO i=1-OLx,sNx+OLx-1
101 jmc 1.18 dvdy(i,j) = _recip_dyF(i,j,bi,bj) *
102     & (vFld(i,j+1,bi,bj)-vFld(i,j,bi,bj))
103     vave(i,j) = 0.5 _d 0 * (vFld(i,j,bi,bj)+vFld(i,j+1,bi,bj))
104 mlosch 1.15 ENDDO
105     ENDDO
106     C evaluate strain rates at C-points
107 jmc 1.19 DO j=1-OLy,sNy+OLy-1
108     DO i=1-OLx,sNx+OLx-1
109 jmc 1.18 e11Loc(i,j,bi,bj) = dudx(i,j) + vave(i,j) * k2AtC(i,j,bi,bj)
110     e22Loc(i,j,bi,bj) = dvdy(i,j) + uave(i,j) * k1AtC(i,j,bi,bj)
111     ENDDO
112     ENDDO
113     #ifndef OBCS_UVICE_OLD
114     C-- for OBCS: assume no gradient beyong OB
115 jmc 1.19 DO j=1-OLy,sNy+OLy-1
116     DO i=1-OLx,sNx+OLx-1
117 jmc 1.18 e11Loc(i,j,bi,bj) = e11Loc(i,j,bi,bj)*maskInC(i,j,bi,bj)
118     e22Loc(i,j,bi,bj) = e22Loc(i,j,bi,bj)*maskInC(i,j,bi,bj)
119 mlosch 1.11 ENDDO
120     ENDDO
121 jmc 1.18 #endif /* OBCS_UVICE_OLD */
122    
123 mlosch 1.15 C abbreviations at Z-points, need to do them in separate loops
124     C for vectorization
125 jmc 1.19 DO j=1-OLy+1,sNy+OLy
126     DO i=1-OLx+1,sNx+OLx
127 jmc 1.18 dudy(i,j) = ( uFld(i,j,bi,bj) - uFld(i ,j-1,bi,bj) )
128     & * _recip_dyU(i,j,bi,bj)
129     uave(i,j) = 0.5 _d 0 * (uFld(i,j,bi,bj)+uFld(i ,j-1,bi,bj))
130 mlosch 1.15 ENDDO
131     ENDDO
132 jmc 1.19 DO j=1-OLy+1,sNy+OLy
133     DO i=1-OLx+1,sNx+OLx
134 jmc 1.18 dvdx(i,j) = ( vFld(i,j,bi,bj) - vFld(i-1,j ,bi,bj) )
135     & * _recip_dxV(i,j,bi,bj)
136     vave(i,j) = 0.5 _d 0 * (vFld(i,j,bi,bj)+vFld(i-1,j ,bi,bj))
137 mlosch 1.15 ENDDO
138     ENDDO
139     C evaluate strain rates at Z-points
140 jmc 1.19 DO j=1-OLy+1,sNy+OLy
141     DO i=1-OLx+1,sNx+OLx
142 mlosch 1.11 hFacU = _maskW(i,j,k,bi,bj) - _maskW(i,j-1,k,bi,bj)
143     hFacV = _maskS(i,j,k,bi,bj) - _maskS(i-1,j,k,bi,bj)
144 jmc 1.18 e12Loc(i,j,bi,bj) = 0.5 _d 0 * (
145     & dudy(i,j) + dvdx(i,j)
146     & - k1AtZ(i,j,bi,bj) * vave(i,j)
147     & - k2AtZ(i,j,bi,bj) * uave(i,j)
148 mlosch 1.11 & )
149 jmc 1.18 & *maskC(i ,j ,k,bi,bj)*maskC(i-1,j ,k,bi,bj)
150     & *maskC(i ,j-1,k,bi,bj)*maskC(i-1,j-1,k,bi,bj)
151 mlosch 1.11 & + 2.0 _d 0 * noSlipFac * (
152 jmc 1.18 & 2.0 _d 0 * uave(i,j) * _recip_dyU(i,j,bi,bj) * hFacU
153     & + 2.0 _d 0 * vave(i,j) * _recip_dxV(i,j,bi,bj) * hFacV
154 mlosch 1.11 & )
155     C no slip at the boundary implies u(j)+u(j-1)=0 and v(i)+v(i-1)=0
156     C accross the boundary; this is already accomplished by masking so
157     C that the following lines are not necessary
158 jmc 1.18 c$$$ & - hFacV * k1AtZ(i,j,bi,bj) * vave(i,j)
159     c$$$ & - hFacU * k2AtZ(i,j,bi,bj) * uave(i,j)
160 mlosch 1.11 ENDDO
161     ENDDO
162    
163     ENDDO
164     ENDDO
165 gforget 1.16
166     #ifdef ALLOW_AUTODIFF_TAMC
167     #ifdef SEAICE_DYN_STABLE_ADJOINT
168     cgf zero out adjoint fields to stabilize pkg/seaice dyna. adjoint
169     CALL ZERO_ADJ( 1, e11Loc, myThid)
170     CALL ZERO_ADJ( 1, e12Loc, myThid)
171     CALL ZERO_ADJ( 1, e22Loc, myThid)
172     #endif
173     #endif /* ALLOW_AUTODIFF_TAMC */
174    
175 mlosch 1.1 #endif /* SEAICE_ALLOW_DYNAMICS */
176     #endif /* SEAICE_CGRID */
177     RETURN
178     END

  ViewVC Help
Powered by ViewVC 1.1.22