sfepy.solvers.ls module¶
-
class
sfepy.solvers.ls.
MUMPSSolver
(conf, **kwargs)[source]¶ Interface to MUMPS solver.
Kind: ‘ls.mumps’
For common configuration parameters, see
Solver
.Specific configuration parameters:
-
name
= 'ls.mumps'¶
-
-
class
sfepy.solvers.ls.
MultiProblem
(conf, context=None, **kwargs)[source]¶ Conjugate multiple problems.
Allows to define conjugate multiple problems.
Kind: ‘ls.cm_pb’
For common configuration parameters, see
Solver
.Specific configuration parameters:
Parameters: method : {‘auto’, ‘umfpack’, ‘superlu’} (default: ‘auto’)
The actual solver to use.
presolve : bool (default: False)
If True, pre-factorize the matrix.
warn : bool (default: True)
If True, allow warnings.
others : list
The list of auxiliary problem definition files.
coupling_variables : list
The list of coupling variables.
-
name
= 'ls.cm_pb'¶
-
-
class
sfepy.solvers.ls.
PETScKrylovSolver
(conf, comm=None, context=None, **kwargs)[source]¶ PETSc Krylov subspace solver.
The solver supports parallel use with a given MPI communicator (see comm argument of
PETScKrylovSolver.__init__()
) and allows passing in PETSc matrices and vectors. Returns a (global) PETSc solution vector instead of a (local) numpy array, when given a PETSc right-hand side vector.The solver and preconditioner types are set upon the solver object creation. Tolerances can be overridden when called by passing a conf object.
Convergence is reached when rnorm < max(eps_r * rnorm_0, eps_a), where, in PETSc, rnorm is by default the norm of preconditioned residual.
Kind: ‘ls.petsc’
For common configuration parameters, see
Solver
.Specific configuration parameters:
Parameters: method : str (default: ‘cg’)
The actual solver to use.
setup_precond : callable
User-supplied function for the preconditioner initialization/setup. It is called as setup_precond(mtx, context), where mtx is the matrix, context is a user-supplied context, and should return an object with setUp(self, pc) and apply(self, pc, x, y) methods. Has precedence over the precond/sub_precond parameters.
precond : str (default: ‘icc’)
The preconditioner.
sub_precond : str (default: ‘none’)
The preconditioner for matrix blocks (in parallel runs).
precond_side : {‘left’, ‘right’, ‘symmetric’, None}
The preconditioner side.
i_max : int (default: 100)
The maximum number of iterations.
eps_a : float (default: 1e-08)
The absolute tolerance for the residual.
eps_r : float (default: 1e-08)
The relative tolerance for the residual.
eps_d : float (default: 100000.0)
The divergence tolerance for the residual.
force_reuse : bool (default: False)
If True, skip the check whether the KSP solver object corresponds to the mtx argument: it is always reused.
* : *
Additional parameters supported by the method. Can be used to pass all PETSc options supported by
petsc.Options()
.-
name
= 'ls.petsc'¶
-
-
class
sfepy.solvers.ls.
PyAMGKrylovSolver
(conf, context=None, **kwargs)[source]¶ Interface to PyAMG Krylov solvers.
Kind: ‘ls.pyamg_krylov’
For common configuration parameters, see
Solver
.Specific configuration parameters:
Parameters: method : str (default: ‘cg’)
The actual solver to use.
setup_precond : callable (default: <function <lambda> at 0x7f47e16e6e60>)
User-supplied function for the preconditioner initialization/setup. It is called as setup_precond(mtx, context), where mtx is the matrix, context is a user-supplied context, and should return one of {sparse matrix, dense matrix, LinearOperator}.
callback : callable
User-supplied function to call after each iteration. It is called as callback(xk), where xk is the current solution vector, except the gmres method, where the argument is the residual norm.
i_max : int (default: 100)
The maximum number of iterations.
eps_r : float (default: 1e-08)
The relative tolerance for the residual.
* : *
Additional parameters supported by the method.
-
name
= 'ls.pyamg_krylov'¶
-
-
class
sfepy.solvers.ls.
PyAMGSolver
(conf, **kwargs)[source]¶ Interface to PyAMG solvers.
The method parameter can be one of: ‘smoothed_aggregation_solver’, ‘ruge_stuben_solver’. The accel parameter specifies the Krylov solver name, that is used as an accelerator for the multigrid solver.
Kind: ‘ls.pyamg’
For common configuration parameters, see
Solver
.Specific configuration parameters:
Parameters: method : str (default: ‘smoothed_aggregation_solver’)
The actual solver to use.
accel : str
The accelerator.
callback : callable
User-supplied function to call after each iteration. It is called as callback(xk), where xk is the current solution vector, except the gmres accelerator, where the argument is the residual norm.
i_max : int (default: 100)
The maximum number of iterations.
eps_r : float (default: 1e-08)
The relative tolerance for the residual.
force_reuse : bool (default: False)
If True, skip the check whether the MG solver object corresponds to the mtx argument: it is always reused.
* : *
Additional parameters supported by the method. Use the ‘method:’ prefix for arguments of the method construction function (e.g. ‘method:max_levels’ : 5), and the ‘solve:’ prefix for the subsequent solver call.
-
name
= 'ls.pyamg'¶
-
-
class
sfepy.solvers.ls.
SchurComplement
(conf, **kwargs)[source]¶ Schur complement.
Solution of the linear system
\left[ \begin{array}{cc} A & B \\ C & D \end{array} \right] \cdot \left[ \begin{array}{c} u \\ v \end{array} \right] = \left[ \begin{array}{c} f \\ g \end{array} \right]
is obtained by solving the following equation:
(D - C A^{-1} B) \cdot v = g - C A^{-1} f
variable(s) u are specified in “eliminate” list, variable(s) v are specified in “keep” list,
See: http://en.wikipedia.org/wiki/Schur_complement
Kind: ‘ls.schur_complement’
For common configuration parameters, see
Solver
.Specific configuration parameters:
Parameters: method : {‘auto’, ‘umfpack’, ‘superlu’} (default: ‘auto’)
The actual solver to use.
presolve : bool (default: False)
If True, pre-factorize the matrix.
warn : bool (default: True)
If True, allow warnings.
blocks : dict
The description of blocks:
{block_name1 : [variable_name1, ...], ...}
.function : callable
The user defined function.
eliminate : list
The list of variables to eliminate.
keep : list
The list of variables to keep.
-
name
= 'ls.schur_complement'¶
-
-
class
sfepy.solvers.ls.
SchurGeneralized
(conf, context=None, **kwargs)[source]¶ Generalized Schur complement.
Defines the matrix blocks and calls user defined function.
Kind: ‘ls.schur_generalized’
For common configuration parameters, see
Solver
.Specific configuration parameters:
Parameters: method : {‘auto’, ‘umfpack’, ‘superlu’} (default: ‘auto’)
The actual solver to use.
presolve : bool (default: False)
If True, pre-factorize the matrix.
warn : bool (default: True)
If True, allow warnings.
blocks : dict
The description of blocks:
{block_name1 : [variable_name1, ...], ...}
.function : callable
The user defined function.
-
name
= 'ls.schur_generalized'¶
-
-
class
sfepy.solvers.ls.
ScipyDirect
(conf, **kwargs)[source]¶ Direct sparse solver from SciPy.
Kind: ‘ls.scipy_direct’
For common configuration parameters, see
Solver
.Specific configuration parameters:
Parameters: method : {‘auto’, ‘umfpack’, ‘superlu’} (default: ‘auto’)
The actual solver to use.
presolve : bool (default: False)
If True, pre-factorize the matrix.
warn : bool (default: True)
If True, allow warnings.
-
name
= 'ls.scipy_direct'¶
-
-
class
sfepy.solvers.ls.
ScipyIterative
(conf, context=None, **kwargs)[source]¶ Interface to SciPy iterative solvers.
The eps_r tolerance is both absolute and relative - the solvers stop when either the relative or the absolute residual is below it.
Kind: ‘ls.scipy_iterative’
For common configuration parameters, see
Solver
.Specific configuration parameters:
Parameters: method : str (default: ‘cg’)
The actual solver to use.
setup_precond : callable (default: <function <lambda> at 0x7f47e16e69b0>)
User-supplied function for the preconditioner initialization/setup. It is called as setup_precond(mtx, context), where mtx is the matrix, context is a user-supplied context, and should return one of {sparse matrix, dense matrix, LinearOperator}.
callback : callable
User-supplied function to call after each iteration. It is called as callback(xk), where xk is the current solution vector, except the gmres method, where the argument is the residual.
i_max : int (default: 100)
The maximum number of iterations.
eps_a : float (default: 1.0)
The absolute tolerance for the residual.
eps_r : float (default: 1e-08)
The relative tolerance for the residual.
* : *
Additional parameters supported by the method.
-
name
= 'ls.scipy_iterative'¶
-
-
sfepy.solvers.ls.
petsc_call
(call)[source]¶ Decorator handling argument preparation and timing for PETSc-based linear solvers.