# LINEAR_SOLVER¶

Specifies linear solver parameters associated with the simulation. A typical general purpose example is as follows:

```
LINEAR_SOLVER FLOW
KSP_TYPE FGMRES
PC_TYPE CPR
END
```

An unlikely example demonstrating all possible options is:

```
LINEAR_SOLVER FLOW
KSP_TYPE FGMRES
PC_TYPE CPR
ATOL 1.d-6
RTOL 1.d-6
DTOL 1.d-6
MAXIT 50
GMRES_RESTART 200
GMRES_MODIFIED_GS
CPR_OPTIONS
CPR_MANUAL_AMG_CONFIG
CPR_AMG_REPORT
END
END
```

The meanings of the keywords above are given in the following sections.

The preconditioner CPR is the implementation of the compressed pressure residual preconditioner that OGS has developed. This is a two stage preconditioner which uses AMG (algebraic multigrid) as the first stage; currently block Jacobi is the only available second stage. CPR is a very effective modern preconditioner and should provide a significant increase in efficiency and decrease in linear iterations in almost all nontrivial situations.

In addition to the options described above there is a sub-card CPR_OPTIONS which collects options specifically for the CPR preconditioner. These are listed in Advanced AMG/CPR configuration section.

## LINEAR_SOLVER Type¶

The word after `LINEAR_SOLVER`

at the start of this card can be either FLOW or TRANSPORT. For TOIL_IMS, GAS_WATER, BLACK_OIL,TODD_LONGSTAFF and SOLVENT_TL, this must be FLOW.

## KSP_TYPE¶

Specifies solver type, where options include: DIRECT, ITERATIVE, GMRES, BCGS, IBCGS. DIRECT uses LU and ITERATIVE employs Bi-CGStab (BCGS) and block Jacobi preconditioning with ILU[0] in each block.

## PC_TYPE¶

Specifies preconditioner type, where options include: NONE, ILU, LU, BJACOBI, ADDITIVE_SCHWARZ or ASM, HYPRE, or CPR. CPR is the compressed pressure residual preconditioner which OGS has implemented for PFLOTRAN. This is the AMG linear solver option, more on the CPR and its options are discussed above.

## ATOL¶

absolute tolerance. Absolute size of 2-norm of residual.

## RTOL¶

Relative tolerance. Relative decrease in size of 2-norm of residual.

## DTOL¶

Divergence tolerance. Relative increase in residual norm.

## MAXIT¶

Maximum number of linear solver iterations before reporting failed convergence.

## GMRES_RESTART¶

How many linear iterations to allow before restarting the Krylov subspace, if using GMRES or FGMRES as the linear solver.

## GMRES_MODIFIED_GS¶

Use modified instead of classical Gram-Schmidt orthogonalization in the construction of the Krylov subspace if using GMRES or FGMRES as the linear solver.