Reference documentation for deal.II version GIT e22cb6a53e 2023-09-21 14:00:02+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Static Private Member Functions | List of all members
PETScWrappers::SolverTCQMR Class Reference

#include <deal.II/lac/petsc_solver.h>

Inheritance diagram for PETScWrappers::SolverTCQMR:


struct  AdditionalData

Public Member Functions

 SolverTCQMR (SolverControl &cn, const AdditionalData &data=AdditionalData())
 SolverTCQMR (SolverControl &cn, const MPI_Comm mpi_communicator, const AdditionalData &data=AdditionalData())
void solve (const MatrixBase &A, VectorBase &x, const VectorBase &b, const PreconditionBase &preconditioner)
virtual void reset ()
void set_prefix (const std::string &prefix)
SolverControlcontrol () const
void initialize (const PreconditionBase &preconditioner)
KSP petsc_ksp ()
 operator KSP () const

Protected Member Functions

virtual void set_solver_type (KSP &ksp) const override
void initialize_ksp_with_comm (const MPI_Comm comm)
void perhaps_set_convergence_test () const

Protected Attributes

const AdditionalData additional_data
KSP ksp
SmartPointer< SolverControl, SolverBasesolver_control
std::string prefix_name

Static Private Member Functions

static PetscErrorCode convergence_test (KSP ksp, const PetscInt iteration, const PetscReal residual_norm, KSPConvergedReason *reason, void *solver_control)

Detailed Description

An implementation of the solver interface using the PETSc TFQMR-2 solver (called TCQMR in PETSc). Note that this solver had a serious bug in versions up to and including PETSc 2.1.6, in that it did not check convergence and always returned an error code. Thus, this class will abort with an error indicating failure to converge with PETSc 2.1.6 and prior. This should be fixed in later versions of PETSc, though.

Definition at line 679 of file petsc_solver.h.

Constructor & Destructor Documentation

◆ SolverTCQMR() [1/2]

PETScWrappers::SolverTCQMR::SolverTCQMR ( SolverControl cn,
const AdditionalData data = AdditionalData() 

Constructor. In contrast to deal.II's own solvers, there is no need to give a vector memory object.

The last argument takes a structure with additional, solver dependent flags for tuning.

Definition at line 515 of file

◆ SolverTCQMR() [2/2]

PETScWrappers::SolverTCQMR::SolverTCQMR ( SolverControl cn,
const MPI_Comm  mpi_communicator,
const AdditionalData data = AdditionalData() 

Constructor. This constructor is deprecated and ignores the MPI communicator argument. Use the other constructor instead.


Definition at line 521 of file

Member Function Documentation

◆ set_solver_type()

void PETScWrappers::SolverTCQMR::set_solver_type ( KSP &  ksp) const

Function that takes a Krylov Subspace Solver context object, and sets the type of solver that is appropriate for this class.

Reimplemented from PETScWrappers::SolverBase.

Definition at line 529 of file

◆ solve()

void SolverBase< VectorType >::solve ( const MatrixBase A,
VectorBase x,
const VectorBase b,
const PreconditionBase preconditioner 

Solve the linear system Ax=b. Depending on the information provided by derived classes and the object passed as a preconditioner, one of the linear solvers and preconditioners of PETSc is chosen. Repeated calls to solve() do not reconstruct the preconditioner for performance reasons. See class Documentation.

Definition at line 84 of file

◆ reset()

void SolverBase< VectorType >::reset ( )

Resets the contained preconditioner and solver object. See class description for more details.

Definition at line 149 of file

◆ set_prefix()

void SolverBase< VectorType >::set_prefix ( const std::string &  prefix)

Sets a prefix name for the solver object. Useful when customizing the PETSc KSP object with command-line options.

Definition at line 142 of file

◆ control()

SolverControl & SolverBase< VectorType >::control ( ) const

Access to object that controls convergence.

Definition at line 156 of file

◆ initialize()

void SolverBase< VectorType >::initialize ( const PreconditionBase preconditioner)

initialize the solver with the preconditioner. This function is intended for use with SLEPc spectral transformation class.

Definition at line 232 of file

◆ petsc_ksp()

KSP SolverBase< VectorType >::petsc_ksp ( )

Return the PETSc KSP object.

Definition at line 69 of file

◆ operator KSP()

SolverBase< VectorType >::operator KSP ( ) const

Conversion operator to gain access to the underlying PETSc type. If you do this, you cut this class off some information it may need, so this conversion operator should only be used if you know what you do.

Definition at line 76 of file

◆ initialize_ksp_with_comm()

void SolverBase< VectorType >::initialize_ksp_with_comm ( const MPI_Comm  comm)

Utility to create the KSP object and attach convergence test.

Definition at line 207 of file

◆ perhaps_set_convergence_test()

void SolverBase< VectorType >::perhaps_set_convergence_test ( ) const

Utility to use deal.II convergence testing.

This call changes the convergence criterion when the instance of the class has a SolverControl object associated.

Definition at line 223 of file

◆ convergence_test()

PetscErrorCode SolverBase< VectorType >::convergence_test ( KSP  ksp,
const PetscInt  iteration,
const PetscReal  residual_norm,
KSPConvergedReason *  reason,
void *  solver_control 

A function that is used in PETSc as a callback to check on convergence. It takes the information provided from PETSc and checks it against deal.II's own SolverControl objects to see if convergence has been reached.

Definition at line 167 of file

Member Data Documentation

◆ additional_data

const AdditionalData PETScWrappers::SolverTCQMR::additional_data

Store a copy of the flags for this particular solver.

Definition at line 713 of file petsc_solver.h.

◆ ksp

KSP PETScWrappers::SolverBase::ksp

The PETSc KSP object.

Definition at line 168 of file petsc_solver.h.

◆ solver_control

SmartPointer<SolverControl, SolverBase> PETScWrappers::SolverBase::solver_control

Reference to the object that controls convergence of the iterative solver. In fact, for these PETSc wrappers, PETSc does so itself, but we copy the data from this object before starting the solution process, and copy the data back into it afterwards.

Definition at line 176 of file petsc_solver.h.

◆ prefix_name

std::string PETScWrappers::SolverBase::prefix_name

Solver prefix name to qualify options specific to the PETSc KSP object in the current context. Note: A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen.

Definition at line 206 of file petsc_solver.h.

The documentation for this class was generated from the following files: