Subroutine FASTSOLVE2
Solves the matrix equation AX = B
using the iterative biconjugate gradient method, where X
is the output vector. The matrix A
is created from the contents of arrays icd
and cond
.
Calling convention:
call fastsolv(icd,cond,icond,itype,isink,par,ierr,x,b)
Arguments | Data type | Input/Output | Description |
---|---|---|---|
icd
|
Integer array (2,icond) | Call |
Input array of length
|
cond
|
Real array (icond) | Call | Conductance value. |
itype
|
Integer array (icond) | Call |
Specifies conductances type. A value of –1 indictaes that it is a 1-way conductance (only the first element is affected). A value > 0 implies a regular conductance. |
icond
|
Integer | Call | The number of conductances in cond . |
isink
|
Integer array (icond) | Call | If isink(i) =1 then elementi is a boundary condition and takes on the value b(i) . |
ierr
|
Integer | Return | Error flag. Set to 1 on error, else set to 0. |
par
|
Real array (20) | Both | Parameters related to solution. For more information, see the parameter table. |
x
|
Real array | Return | The output vector. The array must be greater than the highest element number in array icd . |
b
|
Real array | Call | The right side input vector. The array must be greater than the highest element number in array icd . Contains sink values on input. |
Parameter table
Parameter number | Parameter description |
---|---|
1 | The input initial fill-in value estimate for the preconditioning matrix. The ILUT preconditioning method is used.
|
2 | The input tolerance value specified for eliminating small terms in the preconditioning matrix. |
3 | The input convergence criterion. The solution is considered converged if
|
4 | The input maximum number of iterations. par(4) = 0 defaults to 200 . |
5 | The input flag that prints the convergence residual value to the verbose log file and to the screen. par(5) = 0 defaults to no residuals printed. |
6 | Reserved. |
7 | On return contains the value of the convergence residual. |
8 | On return contains the number of iterations completed. |
9 | An input flag to re-use the previously created preconditioning matrix on exit.
|
10 | Maximum number of outer loop iterations calling the Conjugate Gradient solver. |
11 | Input flag to increase performance for repeated re-entry.
|
12 | An input flag to increase performance for reported re-entry with the same matrix but different B .
|
13 | Reserved. |
14 | Reserved. |
15 | Reserved. |
16 | Reserved. |
17 | Reserved. |
18 | Reserved. |
19 | Reserved. |
20 | Reserved. |
The following example solves the matrix AX = B
, where the matrices A
and B
are the following:
The matrix is entered as a sum of 3 conductances: G21
= 1, G12
= 1, and G11
= -1. The second conductance is specified as a 1-way conductance with ITYPE(2) = -1
, such that only row 1 is affected, not row 2.
Example:
subroutine user1(gg,t,c,q,qd,r,time,dt,it,
+kode,nocon,maxno,iconv,dum1,dum2,dtp,tf)
dimension t(*),x(4),b(4),par(20),icd(2,2)
dimension cond(2), isink(2),itype(3)
save
data par,x,b,isink,itype/24*0.0,5*0/
icond=3
icd(1,1)=2
icd(2,1)=1
cond(1)=1
icd(1,2)=1
icd(2,2)=2
cond(2)=1
itype(2)=-1
icd(1,3)=1
icd(2,3)=1
cond(3)=-1
b(1)=100
call fastsolve2(icd,cond,icond,itype,isink,par,ierr,x,b)
t(1)=x(1)
t(2)=x(2)
return
end