5 |
|
|
6 |
#define VERBOSE |
#define VERBOSE |
7 |
|
|
8 |
|
CBOP |
9 |
|
C !ROUTINE: CG3D |
10 |
|
C !INTERFACE: |
11 |
SUBROUTINE CG3D( |
SUBROUTINE CG3D( |
12 |
I cg3d_b, |
I cg3d_b, |
13 |
U cg3d_x, |
U cg3d_x, |
15 |
O lastResidual, |
O lastResidual, |
16 |
U numIters, |
U numIters, |
17 |
I myThid ) |
I myThid ) |
18 |
C /==========================================================\ |
C !DESCRIPTION: \bv |
19 |
C | SUBROUTINE CG3D | |
C *==========================================================* |
20 |
C | o Three-dimensional grid problem conjugate-gradient | |
C | SUBROUTINE CG3D |
21 |
C | inverter (with preconditioner). | |
C | o Three-dimensional grid problem conjugate-gradient |
22 |
C |==========================================================| |
C | inverter (with preconditioner). |
23 |
C | Con. grad is an iterative procedure for solving Ax = b. | |
C *==========================================================* |
24 |
C | It requires the A be symmetric. | |
C | Con. grad is an iterative procedure for solving Ax = b. |
25 |
C | This implementation assumes A is a five-diagonal | |
C | It requires the A be symmetric. |
26 |
C | matrix of the form that arises in the discrete | |
C | This implementation assumes A is a seven-diagonal |
27 |
C | representation of the del^2 operator in a | |
C | matrix of the form that arises in the discrete |
28 |
C | two-dimensional space. | |
C | representation of the del^2 operator in a |
29 |
C | Notes: | |
C | three-dimensional space. |
30 |
C | ====== | |
C | Notes: |
31 |
C | This implementation can support shared-memory | |
C | ====== |
32 |
C | multi-threaded execution. In order to do this COMMON | |
C | This implementation can support shared-memory |
33 |
C | blocks are used for many of the arrays - even ones that | |
C | multi-threaded execution. In order to do this COMMON |
34 |
C | are only used for intermedaite results. This design is | |
C | blocks are used for many of the arrays - even ones that |
35 |
C | OK if you want to all the threads to collaborate on | |
C | are only used for intermedaite results. This design is |
36 |
C | solving the same problem. On the other hand if you want | |
C | OK if you want to all the threads to collaborate on |
37 |
C | the threads to solve several different problems | |
C | solving the same problem. On the other hand if you want |
38 |
C | concurrently this implementation will not work. | |
C | the threads to solve several different problems |
39 |
C \==========================================================/ |
C | concurrently this implementation will not work. |
40 |
IMPLICIT NONE |
C *==========================================================* |
41 |
|
C \ev |
42 |
|
|
43 |
|
C !USES: |
44 |
|
IMPLICIT NONE |
45 |
C === Global data === |
C === Global data === |
46 |
#include "SIZE.h" |
#include "SIZE.h" |
47 |
#include "EEPARAMS.h" |
#include "EEPARAMS.h" |
49 |
#include "GRID.h" |
#include "GRID.h" |
50 |
#include "CG3D.h" |
#include "CG3D.h" |
51 |
|
|
52 |
|
C !INPUT/OUTPUT PARAMETERS: |
53 |
C === Routine arguments === |
C === Routine arguments === |
54 |
C myThid - Thread on which I am working. |
C myThid - Thread on which I am working. |
55 |
C cg2d_b - The source term or "right hand side" |
C cg2d_b - The source term or "right hand side" |
68 |
|
|
69 |
#ifdef ALLOW_NONHYDROSTATIC |
#ifdef ALLOW_NONHYDROSTATIC |
70 |
|
|
71 |
|
C !LOCAL VARIABLES: |
72 |
C === Local variables ==== |
C === Local variables ==== |
73 |
C actualIts - Number of iterations taken |
C actualIts - Number of iterations taken |
74 |
C actualResidual - residual |
C actualResidual - residual |
106 |
INTEGER exchWidthY |
INTEGER exchWidthY |
107 |
INTEGER myNz |
INTEGER myNz |
108 |
_RL topLevTerm |
_RL topLevTerm |
109 |
|
CEOP |
110 |
|
|
111 |
C-- Initialise inverter |
C-- Initialise inverter |
112 |
eta_qrNM1 = 1. D0 |
eta_qrNM1 = 1. D0 |