petsc4py.PETSc.SNES#
- class petsc4py.PETSc.SNES#
Bases:
Object
Nonlinear equations solver.
SNES is described in the
PETSc manual
.See also
Enumerations
SNES solver termination reason.
SNES norm schedule.
SNES solver type.
Methods Summary
appendOptionsPrefix
(prefix)Append to the prefix used for searching for options in the database.
callConvergenceTest
(its, xnorm, ynorm, fnorm)Compute the convergence test.
computeFunction
(x, f)Compute the function.
computeJacobian
(x, J[, P])Compute the Jacobian.
computeNGS
(x[, b])Compute a nonlinear Gauss-Seidel step.
Compute the value of the objective function.
converged
(its, xnorm, ynorm, fnorm)Compute the convergence test and update the solver converged reason.
create
([comm])Create a SNES solver.
createPython
([context, comm])Create a nonlinear solver of Python type.
destroy
()Destroy the solver.
Return the application context.
Return the number of solvers in the composite.
Return the n-th solver in the composite.
Return the termination flag.
Return the convergence history.
Return the callback to used as convergence test.
getDM
()Return the
DM
associated with the solver.Get the divergence tolerance parameter used in the convergence tests.
Return the flag indicating error on divergence.
Return the
SNES
used at the coarsest level of the FAS hierarchy.getFASCycleSNES
(level)Return the
SNES
corresponding to a particular level of the FAS hierarchy.getFASInjection
(level)Return the
Mat
used to apply the injection from level-1 to level.getFASInterpolation
(level)Return the
Mat
used to apply the interpolation from level-1 to level.Return the number of levels used.
getFASRestriction
(level)Return the
Mat
used to apply the restriction from level-1 to level.getFASSmoother
(level)Return the smoother used at a given level of the FAS hierarchy.
getFASSmootherDown
(level)Return the downsmoother used at a given level of the FAS hierarchy.
getFASSmootherUp
(level)Return the upsmoother used at a given level of the FAS hierarchy.
Return the callback to compute the nonlinear function.
Return the current number of function evaluations.
Return the function norm.
Return the callback to compute the initial guess.
Return the current iteration number.
Return the matrices used to compute the Jacobian and the callback tuple.
getKSP
()Return the linear solver used by the nonlinear solver.
Return the current number of linear solve failures.
Return the total number of linear iterations.
Return the maximum allowed number of function evaluations.
Return the maximum allowed number of linear solve failures.
Return the maximum allowed number of step failures.
Return the callback used to monitor solver convergence.
Return the number of solvers in NASM.
getNASMSNES
(n)Return the n-th solver in NASM.
getNGS
()Return the nonlinear Gauss-Seidel callback tuple.
getNPC
()Return the nonlinear preconditioner associated with the solver.
Return the nonlinear preconditioning side.
Return the norm schedule.
Return the objective callback tuple.
Return the prefix used for searching for options in the database.
Get the parameters of the Eisenstat and Walker trick.
Return the instance of the class implementing the required Python methods.
Return the fully qualified Python name of the class used by the solver.
getRhs
()Return the vector holding the right-hand side.
Return the vector holding the solution.
Return the vector holding the solution update.
Return the current number of step failures.
Return the tolerance parameters used for the trust region.
Return the update parameters used for the trust region.
Return the tolerance parameters used in the solver convergence tests.
getType
()Return the type of the solver.
Return the callback to compute the update at the beginning of each step.
getUseEW
()Return the flag indicating if the solver uses the Eisenstat-Walker trick.
getUseFD
()Return
true
if the solver uses color finite-differencing for the Jacobian.Return the flag indicating if the solver uses a linear solver.
getUseMF
()Return the flag indicating if the solver uses matrix-free finite-differencing.
Return the index set for the inactive set.
hasNPC
()Return a boolean indicating whether the solver has a nonlinear preconditioner.
logConvergenceHistory
(norm[, linear_its])Log residual norm and linear iterations.
monitor
(its, rnorm)Monitor the solver.
Cancel all the monitors of the solver.
reset
()Reset the solver.
setApplicationContext
(appctx)Set the application context.
setConvergedReason
(reason)Set the termination flag.
setConvergenceHistory
([length, reset])Set the convergence history.
setConvergenceTest
(converged[, args, kargs])Set the callback to use as convergence test.
setDM
(dm)Associate a
DM
with the solver.setDivergenceTolerance
(dtol)Set the divergence tolerance parameter used in the convergence tests.
setErrorIfNotConverged
(flag)Immediately generate an error if the solver has not converged.
setFASInjection
(level, mat)Set the
Mat
to be used to apply the injection from level-1 to level.setFASInterpolation
(level, mat)Set the
Mat
to be used to apply the interpolation from level-1 to level.setFASLevels
(levels[, comms])Set the number of levels to use with FAS.
setFASRScale
(level, vec)Set the scaling factor of the restriction operator from level to level-1.
setFASRestriction
(level, mat)Set the
Mat
to be used to apply the restriction from level-1 to level.setForceIteration
(force)Force solve to take at least one iteration.
Configure the solver from the options database.
setFunction
(function[, f, args, kargs])Set the callback to compute the nonlinear function.
setFunctionNorm
(norm)Set the function norm value.
setInitialGuess
(initialguess[, args, kargs])Set the callback to compute the initial guess.
setIterationNumber
(its)Set the current iteration number.
setJacobian
(jacobian[, J, P, args, kargs])Set the callback to compute the Jacobian.
setKSP
(ksp)Set the linear solver that will be used by the nonlinear solver.
setLineSearchPreCheck
(precheck[, args, kargs])Set the callback that will be called before applying the linesearch.
setMaxFunctionEvaluations
(max_funcs)Set the maximum allowed number of function evaluations.
setMaxKSPFailures
(max_fails)Set the maximum allowed number of linear solve failures.
setMaxStepFailures
(max_fails)Set the maximum allowed number of step failures.
setMonitor
(monitor[, args, kargs])Set the callback used to monitor solver convergence.
setNGS
(ngs[, args, kargs])Set the callback to compute nonlinear Gauss-Seidel.
setNPC
(snes)Set the nonlinear preconditioner.
setNPCSide
(side)Set the nonlinear preconditioning side.
setNormSchedule
(normsched)Set the norm schedule.
setObjective
(objective[, args, kargs])Set the callback to compute the objective function.
setOptionsPrefix
(prefix)Set the prefix used for searching for options in the database.
setParamsEW
([version, rtol_0, rtol_max, ...])Set the parameters for the Eisenstat and Walker trick.
Set cell patch numbering.
setPatchComputeFunction
(function[, args, kargs])Set patch compute function.
setPatchComputeOperator
(operator[, args, kargs])Set patch compute operator.
setPatchConstructType
(typ[, operator, args, ...])Set patch construct type.
setPatchDiscretisationInfo
(dms, bs, ...)Set patch discretisation information.
setPythonContext
(context)Set the instance of the class implementing the required Python methods.
setPythonType
(py_type)Set the fully qualified Python name of the class to be used.
setResetCounters
([reset])Set the flag to reset the counters.
setSolution
(vec)Set the vector used to store the solution.
setTRTolerances
([delta_min, delta_max, delta_0])Set the tolerance parameters used for the trust region.
setTRUpdateParameters
([eta1, eta2, eta3, t1, t2])Set the update parameters used for the trust region.
setTolerances
([rtol, atol, stol, max_it])Set the tolerance parameters used in the solver convergence tests.
setType
(snes_type)Set the type of the solver.
setUp
()Set up the internal data structures for using the solver.
Ensures that matrices are available for Newton-like methods.
setUpdate
(update[, args, kargs])Set the callback to compute update at the beginning of each step.
setUseEW
([flag])Tell the solver to use the Eisenstat-Walker trick.
setUseFD
([flag])Set the boolean flag to use coloring finite-differencing for Jacobian assembly.
setUseKSP
([flag])Set the boolean flag indicating to use a linear solver.
setUseMF
([flag])Set the boolean flag indicating to use matrix-free finite-differencing.
setVariableBounds
(xl, xu)Set the vector for the variable bounds.
solve
([b, x])Solve the nonlinear equations.
view
([viewer])View the solver.
Attributes Summary
Application context.
Absolute residual tolerance.
DM
.Convergence history.
Boolean indicating if the solver has converged.
Boolean indicating if the solver has failed.
Boolean indicating if the solver has not converged yet.
Number of iterations.
Linear solver.
Maximum number of function evaluations.
Maximum number of iterations.
Function norm.
Nonlinear preconditioner.
Converged reason.
Relative residual tolerance.
Solution update tolerance.
Use the Eisenstat-Walker trick.
Boolean indicating if the solver uses coloring finite-differencing.
Boolean indicating if the solver uses a linear solver.
Boolean indicating if the solver uses matrix-free finite-differencing.
Right-hand side vector.
Solution vector.
Update vector.
Methods Documentation
- appendOptionsPrefix(prefix)#
Append to the prefix used for searching for options in the database.
Logically collective.
- callConvergenceTest(its, xnorm, ynorm, fnorm)#
Compute the convergence test.
Collective.
- Parameters:
- Return type:
See also
- computeFunction(x, f)#
Compute the function.
Collective.
See also
- computeJacobian(x, J, P=None)#
Compute the Jacobian.
Collective.
- Parameters:
- Return type:
See also
- computeNGS(x, b=None)#
Compute a nonlinear Gauss-Seidel step.
Collective.
- Parameters:
- Return type:
See also
- computeObjective(x)#
Compute the value of the objective function.
Collective.
See also
- converged(its, xnorm, ynorm, fnorm)#
Compute the convergence test and update the solver converged reason.
Collective.
- Parameters:
- Return type:
See also
- create(comm=None)#
Create a SNES solver.
Collective.
- Parameters:
comm (Comm | None) – MPI communicator, defaults to
Sys.getDefaultComm
.- Return type:
See also
- createPython(context=None, comm=None)#
Create a nonlinear solver of Python type.
Collective.
- Parameters:
context (Any) – An instance of the Python class implementing the required methods.
comm (Comm | None) – MPI communicator, defaults to
Sys.getDefaultComm
.
- Return type:
- destroy()#
Destroy the solver.
Collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:132
- Return type:
- getApplicationContext()#
Return the application context.
Source code at petsc4py/PETSc/SNES.pyx:264
- Return type:
- getCompositeNumber()#
Return the number of solvers in the composite.
Not collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:2280
- Return type:
- getCompositeSNES(n)#
Return the n-th solver in the composite.
Not collective.
See also
- getConvergedReason()#
Return the termination flag.
Not collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:1739
- Return type:
- getConvergenceHistory()#
Return the convergence history.
Not collective.
See also
- getConvergenceTest()#
Return the callback to used as convergence test.
Not collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:1314
- Return type:
- getDM()#
Return the
DM
associated with the solver.Not collective.
Source code at petsc4py/PETSc/SNES.pyx:279
- Return type:
- getDivergenceTolerance()#
Get the divergence tolerance parameter used in the convergence tests.
Not collective.
Source code at petsc4py/PETSc/SNES.pyx:1239
- Return type:
- getErrorIfNotConverged()#
Return the flag indicating error on divergence.
Not collective.
Source code at petsc4py/PETSc/SNES.pyx:1766
- Return type:
- getFASCoarseSolve()#
Return the
SNES
used at the coarsest level of the FAS hierarchy.Not collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:594
- Return type:
- getFASCycleSNES(level)#
Return the
SNES
corresponding to a particular level of the FAS hierarchy.Not collective.
- getFASInjection(level)#
Return the
Mat
used to apply the injection from level-1 to level.Not collective.
See also
- getFASInterpolation(level)#
Return the
Mat
used to apply the interpolation from level-1 to level.Not collective.
See also
- getFASLevels()#
Return the number of levels used.
Not collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:563
- Return type:
- getFASRestriction(level)#
Return the
Mat
used to apply the restriction from level-1 to level.Not collective.
See also
- getFASSmoother(level)#
Return the smoother used at a given level of the FAS hierarchy.
Not collective.
- getFASSmootherDown(level)#
Return the downsmoother used at a given level of the FAS hierarchy.
Not collective.
- getFASSmootherUp(level)#
Return the upsmoother used at a given level of the FAS hierarchy.
Not collective.
- getFunction()#
Return the callback to compute the nonlinear function.
Not collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:843
- Return type:
- getFunctionEvaluations()#
Return the current number of function evaluations.
Not collective.
Source code at petsc4py/PETSc/SNES.pyx:1560
- Return type:
- getFunctionNorm()#
Return the function norm.
Not collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:1837
- Return type:
- getInitialGuess()#
Return the callback to compute the initial guess.
Not collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:796
- Return type:
- getIterationNumber()#
Return the current iteration number.
Not collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:1795
- Return type:
- getJacobian()#
Return the matrices used to compute the Jacobian and the callback tuple.
Not collective.
- Returns:
J (
Mat
) – The matrix to store the Jacobian.P (
Mat
) – The matrix to construct the preconditioner.callback (
SNESJacobianFunction
) – callback, positional and keyword arguments.
- Return type:
See also
- getKSP()#
Return the linear solver used by the nonlinear solver.
Not collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:1936
- Return type:
- getKSPFailures()#
Return the current number of linear solve failures.
Not collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:1642
- Return type:
- getLinearSolveIterations()#
Return the total number of linear iterations.
Not collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:1851
- Return type:
- getMaxFunctionEvaluations()#
Return the maximum allowed number of function evaluations.
Not collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:1544
- Return type:
- getMaxKSPFailures()#
Return the maximum allowed number of linear solve failures.
Not collective.
Source code at petsc4py/PETSc/SNES.pyx:1628
- Return type:
- getMaxStepFailures()#
Return the maximum allowed number of step failures.
Not collective.
Source code at petsc4py/PETSc/SNES.pyx:1587
- Return type:
- getMonitor()#
Return the callback used to monitor solver convergence.
Not collective.
See also
- getNASMNumber()#
Return the number of solvers in NASM.
Not collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:2312
- Return type:
- getNASMSNES(n)#
Return the n-th solver in NASM.
Not collective.
See also
- getNGS()#
Return the nonlinear Gauss-Seidel callback tuple.
Not collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:1119
- Return type:
- getNPC()#
Return the nonlinear preconditioner associated with the solver.
Not collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:662
- Return type:
- getNPCSide()#
Return the nonlinear preconditioning side.
Not collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:715
- Return type:
- getNormSchedule()#
Return the norm schedule.
Not collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:1265
- Return type:
- getObjective()#
Return the objective callback tuple.
Not collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:1013
- Return type:
- getOptionsPrefix()#
Return the prefix used for searching for options in the database.
Not collective.
Source code at petsc4py/PETSc/SNES.pyx:213
- Return type:
- getParamsEW()#
Get the parameters of the Eisenstat and Walker trick.
Not collective.
See also
- getPythonContext()#
Return the instance of the class implementing the required Python methods.
Not collective.
Source code at petsc4py/PETSc/SNES.pyx:2216
- Return type:
- getPythonType()#
Return the fully qualified Python name of the class used by the solver.
Not collective.
See also
PETSc Python nonlinear solver type (TODO),
setPythonContext
,setPythonType
,SNESPythonGetType
Source code at petsc4py/PETSc/SNES.pyx:2246
- Return type:
- getRhs()#
Return the vector holding the right-hand side.
Not collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:1865
- Return type:
- getSolution()#
Return the vector holding the solution.
Not collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:1880
- Return type:
- getSolutionUpdate()#
Return the vector holding the solution update.
Not collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:1907
- Return type:
- getStepFailures()#
Return the current number of step failures.
Not collective.
Source code at petsc4py/PETSc/SNES.pyx:1601
- Return type:
- getTRTolerances()#
Return the tolerance parameters used for the trust region.
Not collective.
- Returns:
- Return type:
- getTRUpdateParameters()#
Return the update parameters used for the trust region.
Not collective.
- Returns:
- Return type:
- getTolerances()#
Return the tolerance parameters used in the solver convergence tests.
Not collective.
- Returns:
- Return type:
See also
- getType()#
Return the type of the solver.
Not collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:185
- Return type:
- getUpdate()#
Return the callback to compute the update at the beginning of each step.
Not collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:904
- Return type:
- getUseEW()#
Return the flag indicating if the solver uses the Eisenstat-Walker trick.
Not collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:1974
- Return type:
- getUseFD()#
Return
true
if the solver uses color finite-differencing for the Jacobian.Not collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:2134
- Return type:
- getUseKSP()#
Return the flag indicating if the solver uses a linear solver.
Not collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:2078
- Return type:
- getUseMF()#
Return the flag indicating if the solver uses matrix-free finite-differencing.
Not collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:2107
- Return type:
- getVIInactiveSet()#
Return the index set for the inactive set.
Not collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:2162
- Return type:
- hasNPC()#
Return a boolean indicating whether the solver has a nonlinear preconditioner.
Not collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:677
- Return type:
- logConvergenceHistory(norm, linear_its=0)#
Log residual norm and linear iterations.
- monitor(its, rnorm)#
Monitor the solver.
Collective.
- Parameters:
its – Current number of iterations.
rnorm – Current value of the residual norm.
- Return type:
See also
- monitorCancel()#
Cancel all the monitors of the solver.
Logically collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:1491
- Return type:
- reset()#
Reset the solver.
Collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:1691
- Return type:
- setApplicationContext(appctx)#
Set the application context.
- setConvergedReason(reason)#
Set the termination flag.
Collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:1726
- Parameters:
reason (ConvergedReason)
- Return type:
- setConvergenceHistory(length=None, reset=False)#
Set the convergence history.
Logically collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:1383
- Return type:
- setConvergenceTest(converged, args=None, kargs=None)#
Set the callback to use as convergence test.
Logically collective.
- Parameters:
- Return type:
- setDivergenceTolerance(dtol)#
Set the divergence tolerance parameter used in the convergence tests.
Logically collective.
- setErrorIfNotConverged(flag)#
Immediately generate an error if the solver has not converged.
Collective.
- setFASInjection(level, mat)#
Set the
Mat
to be used to apply the injection from level-1 to level.Collective.
- setFASInterpolation(level, mat)#
Set the
Mat
to be used to apply the interpolation from level-1 to level.Collective.
- setFASLevels(levels, comms=None)#
Set the number of levels to use with FAS.
Collective.
- Parameters:
levels (int) – The number of levels
comms (Sequence[Comm]) – An optional sequence of communicators of length
Logging Levels
, orNone
for the default communicatorSys.getDefaultComm
.
- Return type:
See also
- setFASRScale(level, vec)#
Set the scaling factor of the restriction operator from level to level-1.
Collective.
See also
- setFASRestriction(level, mat)#
Set the
Mat
to be used to apply the restriction from level-1 to level.Collective.
- setForceIteration(force)#
Force solve to take at least one iteration.
Collective.
See also
- setFromOptions()#
Configure the solver from the options database.
Collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:241
- Return type:
- setFunction(function, f=None, args=None, kargs=None)#
Set the callback to compute the nonlinear function.
Logically collective.
- Parameters:
- Return type:
See also
- setFunctionNorm(norm)#
Set the function norm value.
Collective.
This is only of use to implementers of custom SNES types.
See also
- setInitialGuess(initialguess, args=None, kargs=None)#
Set the callback to compute the initial guess.
Logically collective.
- Parameters:
- Return type:
See also
- setIterationNumber(its)#
Set the current iteration number.
Collective.
This is only of use to implementers of custom SNES types.
See also
- setJacobian(jacobian, J=None, P=None, args=None, kargs=None)#
Set the callback to compute the Jacobian.
Logically collective.
- Parameters:
- Return type:
See also
- setKSP(ksp)#
Set the linear solver that will be used by the nonlinear solver.
Logically collective.
See also
- setLineSearchPreCheck(precheck, args=None, kargs=None)#
Set the callback that will be called before applying the linesearch.
Logically collective.
- Parameters:
- Return type:
See also
- setMaxFunctionEvaluations(max_funcs)#
Set the maximum allowed number of function evaluations.
Collective.
See also
- setMaxKSPFailures(max_fails)#
Set the maximum allowed number of linear solve failures.
Collective.
- setMaxStepFailures(max_fails)#
Set the maximum allowed number of step failures.
Collective.
- setMonitor(monitor, args=None, kargs=None)#
Set the callback used to monitor solver convergence.
Logically collective.
- Parameters:
- Return type:
See also
- setNGS(ngs, args=None, kargs=None)#
Set the callback to compute nonlinear Gauss-Seidel.
Logically collective.
- Parameters:
- Return type:
See also
- setNPC(snes)#
Set the nonlinear preconditioner.
Logically collective.
See also
- setNPCSide(side)#
Set the nonlinear preconditioning side.
Collective.
See also
- setNormSchedule(normsched)#
Set the norm schedule.
Collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:1253
- Parameters:
normsched (NormSchedule)
- Return type:
- setObjective(objective, args=None, kargs=None)#
Set the callback to compute the objective function.
Logically collective.
- Parameters:
- Return type:
See also
- setOptionsPrefix(prefix)#
Set the prefix used for searching for options in the database.
Logically collective.
- setParamsEW(version=None, rtol_0=None, rtol_max=None, gamma=None, alpha=None, alpha2=None, threshold=None)#
Set the parameters for the Eisenstat and Walker trick.
Logically collective.
- Parameters:
- Return type:
See also
- setPatchCellNumbering(sec)#
Set cell patch numbering.
- setPatchComputeFunction(function, args=None, kargs=None)#
Set patch compute function.
Source code at petsc4py/PETSc/SNES.pyx:2381
- Return type:
- setPatchComputeOperator(operator, args=None, kargs=None)#
Set patch compute operator.
Source code at petsc4py/PETSc/SNES.pyx:2373
- Return type:
- setPatchConstructType(typ, operator=None, args=None, kargs=None)#
Set patch construct type.
Source code at petsc4py/PETSc/SNES.pyx:2389
- Return type:
- setPatchDiscretisationInfo(dms, bs, cellNodeMaps, subspaceOffsets, ghostBcNodes, globalBcNodes)#
Set patch discretisation information.
Source code at petsc4py/PETSc/SNES.pyx:2332
- Return type:
- setPythonContext(context)#
Set the instance of the class implementing the required Python methods.
Not collective.
- setPythonType(py_type)#
Set the fully qualified Python name of the class to be used.
Collective.
- setResetCounters(reset=True)#
Set the flag to reset the counters.
Collective.
See also
- setSolution(vec)#
Set the vector used to store the solution.
Collective.
See also
- setTRTolerances(delta_min=None, delta_max=None, delta_0=None)#
Set the tolerance parameters used for the trust region.
Logically collective.
- Parameters:
- Return type:
- setTRUpdateParameters(eta1=None, eta2=None, eta3=None, t1=None, t2=None)#
Set the update parameters used for the trust region.
Logically collective.
- setTolerances(rtol=None, atol=None, stol=None, max_it=None)#
Set the tolerance parameters used in the solver convergence tests.
Logically collective.
- Parameters:
rtol (float) – The relative norm of the residual, or
DETERMINE
to use the value when the object’s type was set. Defaults toCURRENT
.atol (float) – The absolute norm of the residual, or
DETERMINE
to use the value when the object’s type was set. Defaults toCURRENT
.stol (float) – The absolute norm of the step, or
DETERMINE
to use the value when the object’s type was set. Defaults toCURRENT
.max_it (int) – The maximum allowed number of iterations, or
DETERMINE
to use the value when the object’s type was set. Defaults toCURRENT
. UseUNLIMITED
to have no maximum.
- Return type:
See also
- setType(snes_type)#
Set the type of the solver.
Logically collective.
See also
- setUp()#
Set up the internal data structures for using the solver.
Collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:1665
- Return type:
- setUpMatrices()#
Ensures that matrices are available for Newton-like methods.
Collective.
This is only of use to implementers of custom SNES types.
See also
Source code at petsc4py/PETSc/SNES.pyx:1677
- Return type:
- setUpdate(update, args=None, kargs=None)#
Set the callback to compute update at the beginning of each step.
Logically collective.
- Parameters:
- Return type:
See also
- setUseEW(flag=True, *targs, **kargs)#
Tell the solver to use the Eisenstat-Walker trick.
Logically collective.
- Parameters:
flag (bool) – Whether or not to use the Eisenstat-Walker trick.
*targs (Any) – Positional arguments for
setParamsEW
.**kargs (Any) – Keyword arguments for
setParamsEW
.
- Return type:
See also
- setUseFD(flag=True)#
Set the boolean flag to use coloring finite-differencing for Jacobian assembly.
Logically collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:2121
- Return type:
- setUseKSP(flag=True)#
Set the boolean flag indicating to use a linear solver.
Logically collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:2065
- Return type:
- setUseMF(flag=True)#
Set the boolean flag indicating to use matrix-free finite-differencing.
Logically collective.
See also
Source code at petsc4py/PETSc/SNES.pyx:2094
- Return type:
- setVariableBounds(xl, xu)#
Set the vector for the variable bounds.
Collective.
See also
- solve(b=None, x=None)#
Solve the nonlinear equations.
Collective.
- Parameters:
- Return type:
See also
- view(viewer=None)#
View the solver.
Collective.
See also
Attributes Documentation
- appctx#
Application context.
- atol#
Absolute residual tolerance.
- history#
Convergence history.
- is_converged#
Boolean indicating if the solver has converged.
- is_diverged#
Boolean indicating if the solver has failed.
- is_iterating#
Boolean indicating if the solver has not converged yet.
- its#
Number of iterations.
- ksp#
Linear solver.
- max_funcs#
Maximum number of function evaluations.
- max_it#
Maximum number of iterations.
- norm#
Function norm.
- npc#
Nonlinear preconditioner.
- reason#
Converged reason.
- rtol#
Relative residual tolerance.
- stol#
Solution update tolerance.
- use_ew#
Use the Eisenstat-Walker trick.
- use_fd#
Boolean indicating if the solver uses coloring finite-differencing.
- use_ksp#
Boolean indicating if the solver uses a linear solver.
- use_mf#
Boolean indicating if the solver uses matrix-free finite-differencing.
- vec_rhs#
Right-hand side vector.
- vec_sol#
Solution vector.
- vec_upd#
Update vector.