1 |
dgoldberg |
1.1 |
C $Header: /u/gcmpack/MITgcm/model/inc/CG2D.h,v 1.16 2009/11/23 16:13:57 mlosch Exp $ |
2 |
|
|
C $Name: $ |
3 |
|
|
|
4 |
|
|
CBOP |
5 |
|
|
C !ROUTINE: CG2D.h |
6 |
|
|
C !INTERFACE: |
7 |
|
|
C include "CG2D.h" |
8 |
|
|
C |
9 |
|
|
C !DESCRIPTION: |
10 |
|
|
C \bv |
11 |
|
|
C *==========================================================* |
12 |
|
|
C | CG2D.h |
13 |
|
|
C | o Two-dimensional conjugate gradient solver header. |
14 |
|
|
C *==========================================================* |
15 |
|
|
C | Internal (private) data structures. |
16 |
|
|
C *==========================================================* |
17 |
|
|
C \ev |
18 |
|
|
CEOP |
19 |
|
|
|
20 |
|
|
C-- COMMON /CG2D_I_L/ cg2dNormaliseRHS |
21 |
|
|
C cg2dNormaliseRHS :: flag set to TRUE if normalise RHS in the Solver |
22 |
|
|
COMMON /CG2D_I_L/ cg2dNormaliseRHS |
23 |
|
|
LOGICAL cg2dNormaliseRHS |
24 |
|
|
|
25 |
|
|
C-- COMMON /CG2D_R/ DEL**2 Laplacian operators |
26 |
|
|
C aW2d :: East-west operator. |
27 |
|
|
C aS2d :: North-south operator. |
28 |
|
|
C aC2d :: 2D operator main diagonal term. |
29 |
|
|
C pW :: East-west off-diagonal term of preconditioner. |
30 |
|
|
C pS :: North-south off-diagonal term of preconditioner. |
31 |
|
|
C pC :: Main diagonal term of preconditioner. |
32 |
|
|
C cg2dNorm :: A matrix normalisation factor. |
33 |
|
|
C cg2dTolerance :: cg2d solver Tolerance (solver unit = m2/s2 or no unit, |
34 |
|
|
C depending on cg2dNormaliseRHS) |
35 |
|
|
COMMON /CG2D_I_R/ |
36 |
|
|
& aW2d, aS2d, aC2d, |
37 |
|
|
& pW, pS, pC, |
38 |
|
|
& cg2dNorm, cg2dTolerance |
39 |
|
|
_RS aW2d (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
40 |
|
|
_RS aS2d (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
41 |
|
|
_RS aC2d (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
42 |
|
|
_RS pW (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
43 |
|
|
_RS pS (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
44 |
|
|
_RS pC (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
45 |
|
|
_RL cg2dNorm, cg2dTolerance |
46 |
|
|
|
47 |
|
|
C-- COMMON /CG2D_I_WK_R/ Work array common block |
48 |
|
|
C cg2d_q :: Intermediate matrix-vector product term |
49 |
|
|
C cg2d_r :: *same* |
50 |
|
|
C cg2d_s :: *same* |
51 |
|
|
COMMON /CG2D_I_WK_R/ |
52 |
|
|
& cg2d_q, cg2d_r, cg2d_s |
53 |
|
|
_RL cg2d_q(1-1:sNx+1,1-1:sNy+1,nSx,nSy) |
54 |
|
|
!#ifdef ALLOW_CG2D_NSA |
55 |
|
|
#if defined (ALLOW_CG2D_NSA) || defined (ALLOW_DIFFERENTIATE_CG2D_MATRIX) |
56 |
|
|
_RL cg2d_r(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
57 |
|
|
_RL cg2d_s(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
58 |
|
|
#else /* ALLOW_CG2D_NSA */ |
59 |
|
|
_RL cg2d_r(1-1:sNx+1,1-1:sNy+1,nSx,nSy) |
60 |
|
|
_RL cg2d_s(1-1:sNx+1,1-1:sNy+1,nSx,nSy) |
61 |
|
|
#endif /* ALLOW_CG2D_NSA */ |
62 |
|
|
|
63 |
|
|
#ifdef ALLOW_CG2D_NSA |
64 |
|
|
C-- COMMON /CG2D_I_WK_R2/ extra work array common block |
65 |
|
|
C cg2d_z :: Intermediate matrix-vector product term |
66 |
|
|
C :: reduces the number of recomputation in adjoint mode |
67 |
|
|
C :: this field is superfluous if your cg2d is self-adjoint. |
68 |
|
|
COMMON /CG2D_I_WK_R2/ cg2d_z |
69 |
|
|
_RL cg2d_z(1-1:sNx+1,1-1:sNy+1,nSx,nSy) |
70 |
|
|
#endif /* ALLOW_CG2D_NSA */ |
71 |
|
|
|
72 |
|
|
#ifdef ALLOW_SRCG |
73 |
|
|
C-- COMMON /CG2D_I_WK_R3/ Work array common block |
74 |
|
|
C cg2d_y :: residual scaled by preconditioner |
75 |
|
|
C cg2d_v :: z times the operator |
76 |
|
|
C cg2d_q :: Intermediate matrix-vector product term |
77 |
|
|
C cg2d_r :: *same* |
78 |
|
|
C cg2d_s :: *same* |
79 |
|
|
C sumPhi :: needed to call global_vec_sum_r8 when mutli-threaded |
80 |
|
|
COMMON /CG2D_I_WK_R3/ |
81 |
|
|
& cg2d_y,cg2d_v,sumPhi |
82 |
|
|
_RL cg2d_y(1-1:sNx+1,1-1:sNy+1,nSx,nSy) |
83 |
|
|
_RL cg2d_v(1-1:sNx+1,1-1:sNy+1,nSx,nSy) |
84 |
|
|
_RL sumPhi(3,nSx,nSy) |
85 |
|
|
#endif /* ALLOW_SRCG */ |