AbstractLinSolver
AbstractLinSolver_
is an abstract class for solving system of linear equation.
It is important to note that AbstractLinSolver_
is created to build an
interface between EASIFEM
library and other existing open-source
and powerful linear solver libraries.
Structure
TYPE, ABSTRACT :: AbstractLinSolver_
LOGICAL(LGT) :: isInitiated = .FALSE.
!! is object initiated?
TYPE(String) :: engine
!! Name of the engine
!! NATIVE-SERIAL
!! NATIVE-OMP
!! NATIVE-ACC
!! NATIVE-MPI
!! PETSC
!! LIS-OMP
!! LIS-MPI
INTEGER(I4B) :: solverName = 0
!! Solver name
INTEGER(I4B) :: ierr = 0
!! Error code returned by the solver
INTEGER(I4B) :: preconditionOption = 0
!! Name of preconditioner;
!! NO_PRECONDITION
!! LEFT_PRECONDITION
!! RIGHT_PRECONDITION
!! LEFT_RIGHT_PRECONDITON
INTEGER(I4B) :: iter = 0
!! Current iteration number
INTEGER(I4B) :: maxIter = 0
!! Maximum iteration number
REAL(DFP) :: atol = 0.0_DFP
!! absolute tolerance
REAL(DFP) :: rtol = 1.0E-8
!! relative tolerance
REAL(DFP) :: tol = 0.0_DFP
!! Tolerance for testing convergence
REAL(DFP) :: normRes = 0.0_DFP
!! norm Residual
REAL(DFP) :: error0 = 0.0_DFP
!! initial error res or sol
REAL(DFP) :: error = 0.0_DFP
!! final error in res of sol
INTEGER(I4B) :: convergenceIn = convergenceInRes
!! convergence in residual or solution
INTEGER(I4B) :: convergenceType = relativeConvergence
!! relative/ absolute convergence
LOGICAL(LGT) :: relativeToRHS = .FALSE.
!! In case of relative convergence
!! is convergence
!! is relative to
!! right hand side
INTEGER(I4B) :: KrylovSubspaceSize = 15
!! Useful for GMRES type algorithm
INTEGER(I4B) :: globalNumRow = 0, globalNumColumn = 0
!! Size of the global problem;
INTEGER(I4B) :: localNumRow = 0, localNumColumn = 0
!! Size of the problem on a single process
REAL(DFP), ALLOCATABLE :: RES(:)
!! Residual in each iteration
CLASS(AbstractMatrixField_), POINTER :: Amat => NULL()
!! Pointer to child of [[AbstractMatrixField_]]
isInitiated = .FALSE.
is object initiatedengine
is the name of the engine, following options are possible:- NATIVE-SERIAL
- NATIVE-OMP
- NATIVE-ACC
- NATIVE-MPI
- PETSC
- LIS-OMP
- LIS-MPI
solverName=0
is the name of solverierr = 0
denotes the error code returned by the solverpreconditionOption = 0
is the name of preconditioner, following options are possible:- NO_PRECONDITION
- LEFT_PRECONDITION
- RIGHT_PRECONDITION
- LEFT_RIGHT_PRECONDITON
iter = 0
denotes the current iteration number, and total numbe of iterations taken by the solvermaxIter = 0
, is the maximum iteration number allowed for the solver.atol = 0.0_DFP
denotes the absolute tolerance.rtol = 1.0E-8
denotes the relative tolerance.tol = 0.0_DFP
is the tolerance for testing convergence.normRes = 0.0_DFP
is the norm of Residual.error0 = 0.0_DFP
, initial error in residual or solution.error = 0.0_DFP
, final error in residual or solution.convergenceIn = convergenceInRes
, convergence in residual or solutionconvergenceType = relativeConvergence
, relative or absolute convergencerelativeToRHS = .FALSE.
, in case of relative convergence, if relativeToRHS is true, then convergence is relative to right-hand side.KrylovSubspaceSize = 15
, useful for GMRES type algorithmglobalNumRow = 0
,globalNumColumn = 0
, size of the global problem;localNumRow = 0
,localNumColumn = 0
, size of the problem on a single processdbcIndx(:)
, Indices where Dirichlet boundary conditions is prescribedRES(:)
, Residual in each iterationAmat => NULL()
, Pointer to child of AbstractMatrixField_
Convergence criteria
If convergenceIn
is equal to convergenceInSol
For convergenceType
equals to relativeConvergence
, and relativeToRHS=.FALSE.
, we use following convergence criteria:
For convergenceType
equals to relativeConvergence
, and relativeToRHS=.TRUE.
, we use following convergence criteria:
Note that for convergenceType
equals to absoluteConvergence
, we have rtol=0.0
, therefore, relativeToRHS
options is not used, and the resultant criteria becomes:
If convergenceIn
is equal to convergenceInRes
For convergenceType
equals to relativeConvergence
, and relativeToRHS=.FALSE.
, we use following convergence criteria:
For convergenceType
equals to relativeConvergence
, and relativeToRHS=.TRUE.
, we use following convergence criteria:
Note that for convergenceType
equals to absoluteConvergence
, we have rtol=0.0
, therefore, relativeToRHS
options is not used, and the resultant criteria becomes:
Methods
📄️ AbstractLinSolver
AbstractLinSolver_ is an abstract class for solving system of linear equation.
📄️ CheckEssentialParam
This method checks the essential parameters required to construct an instance of AbstractLinSolver.
📄️ Deallocate
Deallocate the memory occupied by the abstract lin solver.
📄️ Display
Display the content of linear solver.
📄️ Export
Export the linear solver.
📄️ GetAbstractLinSolverParam
Get the essential parameters required to construct an instance of abstract linear solver.
📄️ GetParam
Get the field parameters of linear solver.
📄️ GetPreconditionOption
Get the precondition option.
📄️ Import
Import the linear solver from external file.
📄️ Initiate
Initiate an instance of abstract kernel.
📄️ Set
Set the abstract linear solver.
📄️ SetAbstractLinSolverParam
Set the essential parameters required to construct an instance of abstract linear solver.
📄️ SetDirichletBCIndices
Set the Dirichlet boundary condition indices.
📄️ SetParam
Set the fields of linear solver.
📄️ SetTolerance
SEt the tolerance.
📄️ Solve
Solve the system of linear equation.