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

Diff of /MITgcm_contrib/dgoldberg/streamice/streamice_init_phi.F

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

revision 1.1 by heimbach, Thu Mar 29 15:59:21 2012 UTC revision 1.2 by dgoldberg, Wed Aug 27 19:29:14 2014 UTC
# Line 1  Line 1 
1    C $Header$
2    C $Name$
3    
4  #include "STREAMICE_OPTIONS.h"  #include "STREAMICE_OPTIONS.h"
5    
6  C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|  C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
# Line 28  C     === Local variables === Line 31  C     === Local variables ===
31        INTEGER bi, bj, i, j, xnode, ynode, xq, yq, m, n, p, kx, ky        INTEGER bi, bj, i, j, xnode, ynode, xq, yq, m, n, p, kx, ky
32        REAL gradx(2), grady(2)  ! gradients at quadrature points        REAL gradx(2), grady(2)  ! gradients at quadrature points
33    
34  C     here the terms used to calculate matrix terms in the  C     here the terms used to calculate matrix terms in the
35  C     velocity solve are initialized  C     velocity solve are initialized
36  C  C
37  C     this is a quasi-finite element method; the gradient  C     this is a quasi-finite element method; the gradient
38  C     of the basis functions are approximated based on knowledge  C     of the basis functions are approximated based on knowledge
39  C     of the grid  C     of the grid
40  C  C
41  C     Dphi (i,j,bi,bj,m,n,p):  C     Dphi (i,j,bi,bj,m,n,p):
42  C       gradient (in p-direction) of nodal basis function in  C       gradient (in p-direction) of nodal basis function in
43  C       cell (i,j) on thread (bi,bj) which is centered on node m,  C       cell (i,j) on thread (bi,bj) which is centered on node m,
44  C       at quadrature point n  C       at quadrature point n
45  C  C
46  C    %  3 - 4  C    %  3 - 4
47  C    %  |   |  C    %  |   |
48  C    %  1 - 2  C    %  1 - 2
49  C  C
50  C     NOTE 2x2 quadrature is hardcoded - might make it specifiable through CPP    C     NOTE 2x2 quadrature is hardcoded - might make it specifiable through CPP
51  C  C
52  C     this will not be updated in overlap cells - so we extend it as far as we can  C     this will not be updated in overlap cells - so we extend it as far as we can
53          
54        DO bj = myByLo(myThid), myByHi(myThid)        DO bj = myByLo(myThid), myByHi(myThid)
55         DO bi = myBxLo(myThid), myBxHi(myThid)         DO bi = myBxLo(myThid), myBxHi(myThid)
56          DO j=1-Oly,sNy+Oly-1          DO j=1-Oly,sNy+Oly-1
57           DO i=1-Olx,sNx+Olx-1           DO i=1-Olx,sNx+Olx-1
58    
59            DO xq = 1,2            DO xq = 1,2
60             gradx(xq) = Xquad(3-xq) * recip_dxG (i,j,bi,bj) +             gradx(xq) = Xquad(3-xq) * recip_dxG (i,j,bi,bj) +
61       &                 Xquad(xq) * recip_dxG (i+1,j,bi,bj)       &                 Xquad(xq) * recip_dxG (i+1,j,bi,bj)
62             grady(xq) = Xquad(3-xq) * recip_dyG (i,j,bi,bj) +             grady(xq) = Xquad(3-xq) * recip_dyG (i,j,bi,bj) +
63       &                 Xquad(xq) * recip_dyG (i,j+1,bi,bj)       &                 Xquad(xq) * recip_dyG (i,j+1,bi,bj)
64            ENDDO            ENDDO
65    
66            DO n = 1,4            DO n = 1,4
67          
68             xq = 2 - mod(n,2)             xq = 2 - mod(n,2)
69             yq = floor ((n+1)/2.0)             yq = floor ((n+1)/2.0)
70              
71             DO m = 1,4             DO m = 1,4
72    
73              xnode = 2 - mod(m,2)              xnode = 2 - mod(m,2)
# Line 74  C     this will not be updated in overla Line 77  C     this will not be updated in overla
77              if (xq.eq.xnode) kx = 2              if (xq.eq.xnode) kx = 2
78              if (yq.eq.ynode) ky = 2              if (yq.eq.ynode) ky = 2
79    
80                
81              Dphi (i,j,bi,bj,m,n,1) =              Dphi (i,j,bi,bj,m,n,1) =
82       &       (2*xnode-3) * Xquad(ky) * gradx(yq)       &       (2*xnode-3) * Xquad(ky) * gradx(yq)
83              Dphi (i,j,bi,bj,m,n,2) =              Dphi (i,j,bi,bj,m,n,2) =
84       &       (2*ynode-3) * Xquad(kx) * grady(xq)       &       (2*ynode-3) * Xquad(kx) * grady(xq)
85              
86             ENDDO             ENDDO
87    
88             grid_jacq_streamice (i,j,bi,bj,n) =             grid_jacq_streamice (i,j,bi,bj,n) =
89       &      (Xquad(3-xq)*dyG(i,j,bi,bj) + Xquad(xq)*dyG(i+1,j,bi,bj)) *       &      (Xquad(3-xq)*dyG(i,j,bi,bj) + Xquad(xq)*dyG(i+1,j,bi,bj)) *
90       &      (Xquad(3-yq)*dxG(i,j,bi,bj) + Xquad(yq)*dxG(i,j+1,bi,bj))       &      (Xquad(3-yq)*dxG(i,j,bi,bj) + Xquad(yq)*dxG(i,j+1,bi,bj))
91    
92            ENDDO            ENDDO
93           ENDDO           ENDDO

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.22