sfepy.solvers.ls module

class sfepy.solvers.ls.PETScKrylovSolver(conf, **kwargs)[source]

PETSc Krylov subspace solver.

The solver and preconditioner types are set upon the solver object creation. Tolerances can be overriden when called by passing a conf object.

Notes

Convergence is reached when rnorm < max(eps_r * rnorm_0, eps_a), where, in PETSc, rnorm is by default the norm of preconditioned residual.

name = 'ls.petsc'
static process_conf(conf, kwargs)[source]

Missing items are set to default values.

Example configuration, all items:

solver_120 = {
    'name' : 'ls120',
    'kind' : 'ls.petsc',

    'method' : 'cg', # ksp_type
    'precond' : 'icc', # pc_type
    'precond_side' : 'left', # ksp_pc_side
    'eps_a' : 1e-12, # abstol
    'eps_r' : 1e-12, # rtol
    'eps_d' : 1e5, # divtol
    'i_max' : 1000, # maxits
}
set_matrix(mtx)[source]
class sfepy.solvers.ls.PETScParallelKrylovSolver(conf, **kwargs)[source]

PETSc Krylov subspace solver able to run in parallel by storing the system to disk and running a separate script via mpiexec.

The solver and preconditioner types are set upon the solver object creation. Tolerances can be overriden when called by passing a conf object.

Notes

Convergence is reached when rnorm < max(eps_r * rnorm_0, eps_a), where, in PETSc, rnorm is by default the norm of preconditioned residual.

name = 'ls.petsc_parallel'
static process_conf(conf, kwargs)[source]

Missing items are set to default values.

Example configuration, all items:

solver_1 = {
    'name' : 'ls',
    'kind' : 'ls.petsc_parallel',

    'n_proc' : 5, # Number of processes to run.

    'method' : 'cg', # ksp_type
    'precond' : 'bjacobi', # pc_type
    'sub_precond' : 'icc', # sub_pc_type
    'eps_a' : 1e-12, # abstol
    'eps_r' : 1e-12, # rtol
    'eps_d' : 1e5, # divtol
    'i_max' : 1000, # maxits
}
class sfepy.solvers.ls.PyAMGSolver(conf, **kwargs)[source]

Interface to PyAMG solvers.

Notes

Uses relative convergence tolerance, i.e. eps_r is scaled by ||b||.

name = 'ls.pyamg'
static process_conf(conf, kwargs)[source]

Missing items are set to default values.

Example configuration, all items:

solver_102 = {
    'name' : 'ls102',
    'kind' : 'ls.pyamg',

    'method' : 'smoothed_aggregation_solver',
    'accel' : 'cg'
    'eps_r' : 1e-12,
}
class sfepy.solvers.ls.SchurComplement(conf, **kwargs)[source]

Schur complement.

Solution of the linear system

System Message: WARNING/2 (\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] )

latex exited with error [stdout] This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/TeX Live for SUSE Linux) restricted \write18 enabled. entering extended mode (./math.tex LaTeX2e <2011/06/27> Babel <3.9f> and hyphenation patterns for 78 languages loaded. (/usr/share/texmf/tex/latex/base/article.cls Document Class: article 2007/10/19 v1.4h Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size12.clo)) (/usr/share/texmf/tex/latex/base/inputenc.sty ! LaTeX Error: File `utf8x.def’ not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: def) Enter file name: ! Emergency stop. <read *> l.131 \endinput ^^M No pages of output. Transcript written on math.log.

is obtained by solving the following equation:

System Message: WARNING/2 ((D - C A^{-1} B) \cdot v = g - C A^{-1} f )

latex exited with error [stdout] This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/TeX Live for SUSE Linux) restricted \write18 enabled. entering extended mode (./math.tex LaTeX2e <2011/06/27> Babel <3.9f> and hyphenation patterns for 78 languages loaded. (/usr/share/texmf/tex/latex/base/article.cls Document Class: article 2007/10/19 v1.4h Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size12.clo)) (/usr/share/texmf/tex/latex/base/inputenc.sty ! LaTeX Error: File `utf8x.def’ not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: def) Enter file name: ! Emergency stop. <read *> l.131 \endinput ^^M No pages of output. Transcript written on math.log.

variable(s)

System Message: WARNING/2 (u)

latex exited with error [stdout] This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/TeX Live for SUSE Linux) restricted \write18 enabled. entering extended mode (./math.tex LaTeX2e <2011/06/27> Babel <3.9f> and hyphenation patterns for 78 languages loaded. (/usr/share/texmf/tex/latex/base/article.cls Document Class: article 2007/10/19 v1.4h Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size12.clo)) (/usr/share/texmf/tex/latex/base/inputenc.sty ! LaTeX Error: File `utf8x.def’ not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: def) Enter file name: ! Emergency stop. <read *> l.131 \endinput ^^M No pages of output. Transcript written on math.log.
are specified in “eliminate” list, variable(s)

System Message: WARNING/2 (v)

latex exited with error [stdout] This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/TeX Live for SUSE Linux) restricted \write18 enabled. entering extended mode (./math.tex LaTeX2e <2011/06/27> Babel <3.9f> and hyphenation patterns for 78 languages loaded. (/usr/share/texmf/tex/latex/base/article.cls Document Class: article 2007/10/19 v1.4h Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size12.clo)) (/usr/share/texmf/tex/latex/base/inputenc.sty ! LaTeX Error: File `utf8x.def’ not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: def) Enter file name: ! Emergency stop. <read *> l.131 \endinput ^^M No pages of output. Transcript written on math.log.
are specified in “keep” list,

See: http://en.wikipedia.org/wiki/Schur_complement

name = 'ls.schur_complement'
static process_conf(conf, kwargs)[source]

Setup solver configuration options.

Example configuration:

solvers = {
    'ls': ('ls.schur_complement',
           {'eliminate': ['displacement'],
            'keep': ['pressure'],
            'needs_problem_instance': True,
            })
}
static schur_fun(res, mtx, rhs, nn)[source]
class sfepy.solvers.ls.SchurGeneralized(conf, **kwargs)[source]

Generalized Schur complement.

Defines the matrix blocks and calls user defined function.

name = 'ls.schur_generalized'
static process_conf(conf, kwargs)[source]

Setup solver configuration options.

Example configuration:

solvers = {
    'ls': ('ls.schur_generalized',
           {'blocks':
            {'u': ['displacement1', 'displacement2'],
             'v': ['velocity1', 'velocity2'],
             'w': ['pressure1', 'pressure2'],
             },
            'function': my_schur,
            'needs_problem_instance': True,
            })
}
class sfepy.solvers.ls.ScipyDirect(conf, **kwargs)[source]
name = 'ls.scipy_direct'
static process_conf(conf, kwargs)[source]

Missing items are set to default values.

Example configuration, all items:

solver_1100 = {
    'name' : 'dls1100',
    'kind' : 'ls.scipy_direct',

    'method' : 'superlu',
    'presolve' : False,
    'warn' : True,
}
class sfepy.solvers.ls.ScipyIterative(conf, **kwargs)[source]

Interface to SciPy iterative solvers.

Notes

The eps_r tolerance is both absolute and relative - the solvers stop when either the relative or the absolute residual is below it.

A preconditioner can be anything that the SciPy solvers accept (sparse matrix, dense matrix, LinearOperator).

name = 'ls.scipy_iterative'
static process_conf(conf, kwargs)[source]

Missing items are set to default values.

Example configuration, all items:

solver_110 = {
    'name' : 'ls110',
    'kind' : 'ls.scipy_iterative',

    'method' : 'cg',
    'precond' : None,
    'callback' : None,
    'i_max' : 1000,
    'eps_r' : 1e-12,
}
class sfepy.solvers.ls.Umfpack(conf, **kwargs)[source]

This class stays for compatability with old input files. Use ScipyDirect isntead.

name = 'ls.umfpack'
sfepy.solvers.ls.standard_call(call)[source]

Decorator handling argument preparation and timing for linear solvers.