Skip to content

Linearsolver context

Arne Morten Kvarving edited this page Mar 1, 2017 · 3 revisions

The linearsolver context

The <linearsolver> context is used to define everything related to linear solvers.

Attributes:

  • class - Set the class of linear solver (dense, spr, samg, superlu, petsc).

Most of the tags beneath are only used with a PETSc based solver.

type

Use this to define the linear solver to be used.

  • Attributes: None
  • Value: The type of linear solver. See the PETSc list.

Example:

<type>gmres</type>

pc

Use this to define the preconditioner to be used.

  • Attributes: None
  • Value: The type of preconditioner. See the PETSc list. Additionally, you can specify "ASMLU" to use additive Schwarz with exact local solvers.

Example:

<pc>asm</pc>

gmres_restart_iterations

Use this to set the number of arnoldi iterations before restart in the GMRES method.

Example:

<gmres_restart_iterations>50</gmres_restart_iterations>

asm

The "asmlu" and "asm" preconditioners operate on subdomains. If nothing is specified, one subdomain per patch is used in serial, and one subdomain per MPI node in parallel. You can override this using these tags. For instance,

<asm nx="1" ny="1"/>

would yield one subdomain per patch, while

<asm nx="2" ny="2"/>

would yield 4 subdomains per process. There is currently no way to have a subdomain consisting of a given number of patches.

atol

Use this to specify the absolute tolerance for iterative solvers.

  • Attributes: None
  • Value: The tolerance

Example:

<atol>1.0e-10</atol>

rtol

Use this to specify the relative tolerance for iterative solvers.

  • Attributes: None
  • Value: The tolerance

Example:

<rtol>1.0e-10</rtol>

dtol

Use this to specify the divergence tolerance for iterative solvers (how much the residual can grow before process is assumed diverged).

  • Attributes: None
  • Value: The tolerance

Example:

<dtol>1.0e3</dtol>

maxits

Use this to specify the maximum number of iterations for iterative solvers.

  • Attributes: None
  • Value: The maximum number of iterations

Example:

<maxits>1000</maxits>

nullspace

Use this if your operator has a null space.

  • Attributes: None
  • Value: The type of null space (currently only constant is allowed).

Example:

<nullspace>constant</nullspace>

package

Use this if you want to use an external solver/preconditioner through PETSc, see the PETSc documentation.

  • Attributes: None
  • Value: The name of the package.

Example:

<package>petsc</package>

hypre

Use this to control parameters for the preconditioner if you are using one from the HYPRE package.

  • Attributes: None
  • Value: The name of the HYPRE preconditioner (pilut, parasails, boomeramg, euclid)

Example:

<hypre type="parasails"/>

multigrid

Use this to control parameters for multigrid preconditioners.

  • Attributes: smoother, levels, no_smooth, no_fine_smooth, finesmoother, ksp, coarse_solver, max_coarse_size

Example:

<multigrid smoother="sor" levels="4" finesmoother="asm" ksp="richardson"/>

block

Use this to define blocks for schur-type field-split preconditioner (currently only two fields). Attributes:

  • basis - Bases block consists of. String with 1,2,3.
  • components - Components from given basis block consists of.

A block either consists of a given number of bases, or a given number of components for a single given basis. All relevant tags can then be specified for the block using the xml hierarchy.

To have two blocks, one for each basis, using a SOR preconditioner for the first block and a multigrid for the second block (ie a mixed saddle-point problem like Stokes), you would use

<block basis="1">
  <pc>sor</pc>
</block>
<block basis="2">
  <pc>gamg</pc>
  <multigrid smoother="sor" no_smooth="4"/>
</block>

Likewise, to have two blocks, one for velocity and one for pressure, using a SOR preconditioner for the first block and an asm preconditioner for the second block (ie a equal-order saddle-point problem like Stokes), you would use

<block basis="1" comp="123">
  <pc>sor</pc>
</block>
<block basis="1" comp="4">
  <pc>gamg</pc>
  <multigrid smoother="sor" no_smooth="4"/>
</block>

schur

Use this to set the type of the field split/schur complement preconditioner used with multiple blocks. Attributes: None Value: upper, lower, diagonal Example:

<schur>upper</schur>