proteus.NonlinearSolvers module
A hierarchy of classes for nonlinear algebraic system solvers.
- class proteus.NonlinearSolvers.NonlinearEquation(dim=0, dim_proc=None)[source]
Bases:
objectThe base class for nonlinear equations.
- proteus.NonlinearSolvers.resolveNorm(spec, F)[source]
Return the norm function selected by spec for the nonlinear equation F.
spec is a callable taking the owned entries of a vector (e.g. l2Norm), or one of the finite element norms of a nodal vector x, which the model F must provide:
‘L2’ ||x||_{L^2} = sqrt(x^T M_C x), M_C the consistent mass matrix (F.femL2Norm) ‘L2_lumped’ sqrt(x^T M_L x), M_L the lumped mass matrix (F.femL2Norm(x, lumped=True))
The finite element norms take the full local vector (owned and ghost entries), since M_C x at an owned row needs the ghost values; they are marked with full_vector = True.
- class proteus.NonlinearSolvers.NonlinearSolver(F, J=None, du=None, rtol_r=0.0001, atol_r=1e-16, rtol_du=0.0001, atol_du=1e-16, maxIts=100, norm=<function l2Norm>, convergenceTest='r', computeRates=True, printInfo=True, unorm=None, tol_du=0.33)[source]
Bases:
objectThe base class for nonlinear solvers.
Convergence tests (convergenceTest):
‘r’ ||r_k|| < rtol_r ||r_0|| + atol_r (norm) ‘u’ s ||du_k|| < tol_du, s = rho/(1-rho) from the observed contraction rho (unorm) ‘du’ ||du_k|| < rtol_du ||u_k|| + atol_du: the last increment relative to the
current iterate (unorm). unorm=’L2’ with atol_du = 0 gives the criterion ||p^{k+1}-p^k||_{L2} < tol ||p^{k+1}||_{L2}
- ‘r_and_du’ both ‘r’ and ‘du’ (the increment test alone does not control the residual,
i.e. the discrete mass balance)
‘its’, ‘rits’ fixed iteration counts (with ‘rits’ also stopping on ‘r’)
- class proteus.NonlinearSolvers.Newton(linearSolver, F, J=None, du=None, par_du=None, rtol_r=0.0001, atol_r=1e-16, rtol_du=0.0001, atol_du=1e-16, maxIts=100, norm=<function l2Norm>, convergenceTest='r', computeRates=True, printInfo=True, fullNewton=True, directSolver=False, EWtol=True, maxLSits=100, unorm=None)[source]
Bases:
NonlinearSolverA simple iterative solver that is Newton’s method if you give it the right Jacobian
- lschemeRetry(hybrid, u, r, b, par_u, par_r)[source]
Hybrid Newton/L-scheme step test, called after the Newton update u -= du and r = F(u).
Trigger ‘residual’: the Newton step did not reduce ||r|| (where a line search would start). Trigger ‘theta’: also when Deuflhard’s affine-covariant contraction estimate Theta_k = ||J_k^{-1} F(u_{k+1})|| / ||du_k|| exceeds hybrid[‘theta_max’] (Theta ~ h_k/2 in the Newton-Kantorovich ball test; one extra back-solve with the current factorization). On a trigger the Newton step is undone and replaced by hybrid[‘its’] L-scheme iterations (F.setLScheme), after which Newton resumes. Returns True if the line search is to be skipped.
- setLinearSolverTolerance(r)[source]
This function dynamically sets the relative tolerance of the linear solver associated with the non-linear iteration. Set useEistenstatWalker=True in a simulation’s numerics file to ensure that this function is used.
- Parameters:
r (vector) – non-linear residual vector
Notes
The size of the relative reduction assigned to the linear solver depends on two factors: (i) how far the non-linear solver is from satifying its residual reductions and (ii) how large the drop in the latest non-linear residual was.
If the non-linear solver is both far from its residual reduction targets and the latest non-linear residual showed a big drop, then expect the algorithm to assign a large relative reduction to the linear solver.
As the non-linear residual reduction targets get closer, or the non-linear solver stagnates, the linear solver will be assigned a smaller relative reduction up to a minimum of 0.001.
- solve(u, r=None, b=None, par_u=None, par_r=None, linear=False)[source]
Solves the non-linear system \(F(u) = b\).
- Parameters:
u (
numpy.ndarray) – Solution vector.r (
numpy.ndarray) – Residual vector, \(r = b - F(u)\)b (
numpy.ndarray(ARB - not sure this is always true)) – Right hand side vectorpar_u (
proteus.LinearAlgebraTools.ParVec_petsc4py) – Parallel solution vector.par_r (
proteus.LinearAlgebraTools.ParVec_petsc4py) – Parallel residual vector, \(r = b - F(u)\)
- class proteus.NonlinearSolvers.AddedMassNewton(linearSolver, F, J=None, du=None, par_du=None, rtol_r=0.0001, atol_r=1e-16, rtol_du=0.0001, atol_du=1e-16, maxIts=100, norm=<function l2Norm>, convergenceTest='r', computeRates=True, printInfo=True, fullNewton=True, directSolver=False, EWtol=True, maxLSits=100, unorm=None)[source]
Bases:
Newton- solve(u, r=None, b=None, par_u=None, par_r=None)[source]
Solves the non-linear system \(F(u) = b\).
- Parameters:
u (
numpy.ndarray) – Solution vector.r (
numpy.ndarray) – Residual vector, \(r = b - F(u)\)b (
numpy.ndarray(ARB - not sure this is always true)) – Right hand side vectorpar_u (
proteus.LinearAlgebraTools.ParVec_petsc4py) – Parallel solution vector.par_r (
proteus.LinearAlgebraTools.ParVec_petsc4py) – Parallel residual vector, \(r = b - F(u)\)
- class proteus.NonlinearSolvers.MoveMeshMonitorNewton(linearSolver, F, J=None, du=None, par_du=None, rtol_r=0.0001, atol_r=1e-16, rtol_du=0.0001, atol_du=1e-16, maxIts=100, norm=<function l2Norm>, convergenceTest='r', computeRates=True, printInfo=True, fullNewton=True, directSolver=False, EWtol=True, maxLSits=100, unorm=None)[source]
Bases:
Newton- solve(u, r=None, b=None, par_u=None, par_r=None)[source]
Solves the non-linear system \(F(u) = b\).
- Parameters:
u (
numpy.ndarray) – Solution vector.r (
numpy.ndarray) – Residual vector, \(r = b - F(u)\)b (
numpy.ndarray(ARB - not sure this is always true)) – Right hand side vectorpar_u (
proteus.LinearAlgebraTools.ParVec_petsc4py) – Parallel solution vector.par_r (
proteus.LinearAlgebraTools.ParVec_petsc4py) – Parallel residual vector, \(r = b - F(u)\)
- class proteus.NonlinearSolvers.TwoStageNewton(linearSolver, F, J=None, du=None, par_du=None, rtol_r=0.0001, atol_r=1e-16, rtol_du=0.0001, atol_du=1e-16, maxIts=100, norm=<function l2Norm>, convergenceTest='r', computeRates=True, printInfo=True, fullNewton=True, directSolver=False, EWtol=True, maxLSits=100, unorm=None)[source]
Bases:
NewtonSolves a 2 Stage problem via Newton’s solve
- class proteus.NonlinearSolvers.ExplicitLumpedMassMatrixShallowWaterEquationsSolver(linearSolver, F, J=None, du=None, par_du=None, rtol_r=0.0001, atol_r=1e-16, rtol_du=0.0001, atol_du=1e-16, maxIts=100, norm=<function l2Norm>, convergenceTest='r', computeRates=True, printInfo=True, fullNewton=True, directSolver=False, EWtol=True, maxLSits=100, unorm=None)[source]
Bases:
NewtonThis is a fake solver meant to be used with optimized code A simple iterative solver that is Newton’s method if you give it the right Jacobian
- solve(u, r=None, b=None, par_u=None, par_r=None)[source]
Solves the non-linear system \(F(u) = b\).
- Parameters:
u (
numpy.ndarray) – Solution vector.r (
numpy.ndarray) – Residual vector, \(r = b - F(u)\)b (
numpy.ndarray(ARB - not sure this is always true)) – Right hand side vectorpar_u (
proteus.LinearAlgebraTools.ParVec_petsc4py) – Parallel solution vector.par_r (
proteus.LinearAlgebraTools.ParVec_petsc4py) – Parallel residual vector, \(r = b - F(u)\)
- class proteus.NonlinearSolvers.ExplicitConsistentMassMatrixShallowWaterEquationsSolver(linearSolver, F, J=None, du=None, par_du=None, rtol_r=0.0001, atol_r=1e-16, rtol_du=0.0001, atol_du=1e-16, maxIts=100, norm=<function l2Norm>, convergenceTest='r', computeRates=True, printInfo=True, fullNewton=True, directSolver=False, EWtol=True, maxLSits=100, unorm=None)[source]
Bases:
NewtonThis is a fake solver meant to be used with optimized code A simple iterative solver that is Newton’s method if you give it the right Jacobian
- solve(u, r=None, b=None, par_u=None, par_r=None)[source]
Solves the non-linear system \(F(u) = b\).
- Parameters:
u (
numpy.ndarray) – Solution vector.r (
numpy.ndarray) – Residual vector, \(r = b - F(u)\)b (
numpy.ndarray(ARB - not sure this is always true)) – Right hand side vectorpar_u (
proteus.LinearAlgebraTools.ParVec_petsc4py) – Parallel solution vector.par_r (
proteus.LinearAlgebraTools.ParVec_petsc4py) – Parallel residual vector, \(r = b - F(u)\)
- class proteus.NonlinearSolvers.ExplicitLumpedMassMatrix(linearSolver, F, J=None, du=None, par_du=None, rtol_r=0.0001, atol_r=1e-16, rtol_du=0.0001, atol_du=1e-16, maxIts=100, norm=<function l2Norm>, convergenceTest='r', computeRates=True, printInfo=True, fullNewton=True, directSolver=False, EWtol=True, maxLSits=100, unorm=None)[source]
Bases:
NewtonThis is a fake solver meant to be used with optimized code A simple iterative solver that is Newton’s method if you give it the right Jacobian
- solve(u, r=None, b=None, par_u=None, par_r=None)[source]
Solves the non-linear system \(F(u) = b\).
- Parameters:
u (
numpy.ndarray) – Solution vector.r (
numpy.ndarray) – Residual vector, \(r = b - F(u)\)b (
numpy.ndarray(ARB - not sure this is always true)) – Right hand side vectorpar_u (
proteus.LinearAlgebraTools.ParVec_petsc4py) – Parallel solution vector.par_r (
proteus.LinearAlgebraTools.ParVec_petsc4py) – Parallel residual vector, \(r = b - F(u)\)
- class proteus.NonlinearSolvers.ExplicitLumpedMassMatrixForRichards(linearSolver, F, J=None, du=None, par_du=None, rtol_r=0.0001, atol_r=1e-16, rtol_du=0.0001, atol_du=1e-16, maxIts=100, norm=<function l2Norm>, convergenceTest='r', computeRates=True, printInfo=True, fullNewton=True, directSolver=False, EWtol=True, maxLSits=100, unorm=None)[source]
Bases:
NewtonThis is a fake solver meant to be used with optimized code A simple iterative solver that is Newton’s method if you give it the right Jacobian
- solve(u, r=None, b=None, par_u=None, par_r=None)[source]
Solves the non-linear system \(F(u) = b\).
- Parameters:
u (
numpy.ndarray) – Solution vector.r (
numpy.ndarray) – Residual vector, \(r = b - F(u)\)b (
numpy.ndarray(ARB - not sure this is always true)) – Right hand side vectorpar_u (
proteus.LinearAlgebraTools.ParVec_petsc4py) – Parallel solution vector.par_r (
proteus.LinearAlgebraTools.ParVec_petsc4py) – Parallel residual vector, \(r = b - F(u)\)
- class proteus.NonlinearSolvers.ExplicitConsistentMassMatrixWithRedistancing(linearSolver, F, J=None, du=None, par_du=None, rtol_r=0.0001, atol_r=1e-16, rtol_du=0.0001, atol_du=1e-16, maxIts=100, norm=<function l2Norm>, convergenceTest='r', computeRates=True, printInfo=True, fullNewton=True, directSolver=False, EWtol=True, maxLSits=100, unorm=None)[source]
Bases:
NewtonThis is a fake solver meant to be used with optimized code A simple iterative solver that is Newton’s method if you give it the right Jacobian
- solve(u, r=None, b=None, par_u=None, par_r=None)[source]
Solves the non-linear system \(F(u) = b\).
- Parameters:
u (
numpy.ndarray) – Solution vector.r (
numpy.ndarray) – Residual vector, \(r = b - F(u)\)b (
numpy.ndarray(ARB - not sure this is always true)) – Right hand side vectorpar_u (
proteus.LinearAlgebraTools.ParVec_petsc4py) – Parallel solution vector.par_r (
proteus.LinearAlgebraTools.ParVec_petsc4py) – Parallel residual vector, \(r = b - F(u)\)
- class proteus.NonlinearSolvers.ExplicitConsistentMassMatrixForVOF(linearSolver, F, J=None, du=None, par_du=None, rtol_r=0.0001, atol_r=1e-16, rtol_du=0.0001, atol_du=1e-16, maxIts=100, norm=<function l2Norm>, convergenceTest='r', computeRates=True, printInfo=True, fullNewton=True, directSolver=False, EWtol=True, maxLSits=100, unorm=None)[source]
Bases:
NewtonThis is a fake solver meant to be used with optimized code A simple iterative solver that is Newton’s method if you give it the right Jacobian
- solve(u, r=None, b=None, par_u=None, par_r=None)[source]
Solves the non-linear system \(F(u) = b\).
- Parameters:
u (
numpy.ndarray) – Solution vector.r (
numpy.ndarray) – Residual vector, \(r = b - F(u)\)b (
numpy.ndarray(ARB - not sure this is always true)) – Right hand side vectorpar_u (
proteus.LinearAlgebraTools.ParVec_petsc4py) – Parallel solution vector.par_r (
proteus.LinearAlgebraTools.ParVec_petsc4py) – Parallel residual vector, \(r = b - F(u)\)
- class proteus.NonlinearSolvers.ExplicitConsistentMassMatrixForRichards(linearSolver, F, J=None, du=None, par_du=None, rtol_r=0.0001, atol_r=1e-16, rtol_du=0.0001, atol_du=1e-16, maxIts=100, norm=<function l2Norm>, convergenceTest='r', computeRates=True, printInfo=True, fullNewton=True, directSolver=False, EWtol=True, maxLSits=100, unorm=None)[source]
Bases:
NewtonThis is a fake solver meant to be used with optimized code A simple iterative solver that is Newton’s method if you give it the right Jacobian
- solve(u, r=None, b=None, par_u=None, par_r=None)[source]
Solves the non-linear system \(F(u) = b\).
- Parameters:
u (
numpy.ndarray) – Solution vector.r (
numpy.ndarray) – Residual vector, \(r = b - F(u)\)b (
numpy.ndarray(ARB - not sure this is always true)) – Right hand side vectorpar_u (
proteus.LinearAlgebraTools.ParVec_petsc4py) – Parallel solution vector.par_r (
proteus.LinearAlgebraTools.ParVec_petsc4py) – Parallel residual vector, \(r = b - F(u)\)
- class proteus.NonlinearSolvers.NewtonWithL2ProjectionForMassCorrection(linearSolver, F, J=None, du=None, par_du=None, rtol_r=0.0001, atol_r=1e-16, rtol_du=0.0001, atol_du=1e-16, maxIts=100, norm=<function l2Norm>, convergenceTest='r', computeRates=True, printInfo=True, fullNewton=True, directSolver=False, EWtol=True, maxLSits=100, unorm=None)[source]
Bases:
NewtonThis is a fake solver meant to be used with optimized code A simple iterative solver that is Newton’s method if you give it the right Jacobian
- class proteus.NonlinearSolvers.CLSVOFNewton(linearSolver, F, J=None, du=None, par_du=None, rtol_r=0.0001, atol_r=1e-16, rtol_du=0.0001, atol_du=1e-16, maxIts=100, norm=<function l2Norm>, convergenceTest='r', computeRates=True, printInfo=True, fullNewton=True, directSolver=False, EWtol=True, maxLSits=100, unorm=None)[source]
Bases:
Newton- solve(u, r=None, b=None, par_u=None, par_r=None)[source]
Solves the non-linear system \(F(u) = b\).
- Parameters:
u (
numpy.ndarray) – Solution vector.r (
numpy.ndarray) – Residual vector, \(r = b - F(u)\)b (
numpy.ndarray(ARB - not sure this is always true)) – Right hand side vectorpar_u (
proteus.LinearAlgebraTools.ParVec_petsc4py) – Parallel solution vector.par_r (
proteus.LinearAlgebraTools.ParVec_petsc4py) – Parallel residual vector, \(r = b - F(u)\)
- class proteus.NonlinearSolvers.POD_Newton(linearSolver, F, J=None, du=None, par_du=None, rtol_r=0.0001, atol_r=1e-16, rtol_du=0.0001, atol_du=1e-16, maxIts=100, norm=<function l2Norm>, convergenceTest='r', computeRates=True, printInfo=True, fullNewton=True, directSolver=False, EWtol=True, maxLSits=100, use_deim=False)[source]
Bases:
NewtonNewton’s method on the reduced order system based on POD
- deim_utils = <module 'proteus.deim_utils' from '/home/cekees/proteus-1.9.1-docs/proteus/deim_utils.py'>[source]
- class proteus.NonlinearSolvers.POD_DEIM_Newton(linearSolver, F, J=None, du=None, par_du=None, rtol_r=0.0001, atol_r=1e-16, rtol_du=0.0001, atol_du=1e-16, maxIts=100, norm=<function l2Norm>, convergenceTest='r', computeRates=True, printInfo=True, fullNewton=True, directSolver=False, EWtol=True, maxLSits=100, use_deim=True)[source]
Bases:
NewtonNewton’s method on the reduced order system based on POD
- solveInitialize(u, r, b)[source]
if using deim modifies base initialization by splitting up residual evaluation into separate pieces interpolated by deim (right now just does ‘mass’ and ‘space’)
NOT FINISHED
- class proteus.NonlinearSolvers.NewtonNS(linearSolver, F, J=None, du=None, par_du=None, rtol_r=0.0001, atol_r=1e-16, rtol_du=0.0001, atol_du=1e-16, maxIts=100, norm=<function l2Norm>, convergenceTest='r', computeRates=True, printInfo=True, fullNewton=True, directSolver=False, EWtol=True, maxLSits=100)[source]
Bases:
NonlinearSolverA simple iterative solver that is Newton’s method if you give it the right Jacobian
- class proteus.NonlinearSolvers.SSPRKNewton(linearSolver, F, J=None, du=None, par_du=None, rtol_r=0.0001, atol_r=1e-16, rtol_du=0.0001, atol_du=1e-16, maxIts=100, norm=<function l2Norm>, convergenceTest='r', computeRates=True, printInfo=True, fullNewton=True, directSolver=False, EWtol=True, maxLSits=100)[source]
Bases:
NewtonVersion of Newton for SSPRK so doesn’t refactor unnecessarily
- class proteus.NonlinearSolvers.PicardNewton(linearSolver, F, J=None, du=None, par_du=None, rtol_r=0.0001, atol_r=1e-16, rtol_du=0.0001, atol_du=1e-16, maxIts=100, norm=<function l2Norm>, convergenceTest='r', computeRates=True, printInfo=True, fullNewton=True, directSolver=False, EWtol=True, maxLSits=100)[source]
Bases:
Newton
- class proteus.NonlinearSolvers.NLJacobi(F, J, du, weight=0.8, rtol_r=0.0001, atol_r=1e-16, rtol_du=0.0001, atol_du=1e-16, maxIts=100, norm=<function l2Norm>, convergenceTest='r', computeRates=True, printInfo=True, fullNewton=True)[source]
Bases:
NonlinearSolverNonlinear Jacobi iteration.
- class proteus.NonlinearSolvers.NLGaussSeidel(connectionList, F, J, du, weight=1.0, sym=False, rtol_r=0.0001, atol_r=1e-16, rtol_du=0.0001, atol_du=1e-16, maxIts=100, norm=<function l2Norm>, convergenceTest='r', computeRates=True, printInfo=True, fullNewton=True)[source]
Bases:
NonlinearSolverNonlinear Gauss-Seidel.
- class proteus.NonlinearSolvers.NLStarILU(connectionList, F, J, du, weight=1.0, sym=False, rtol_r=0.0001, atol_r=1e-16, rtol_du=0.0001, atol_du=1e-16, maxIts=100, norm=<function l2Norm>, convergenceTest='r', computeRates=True, printInfo=True, fullNewton=True)[source]
Bases:
NonlinearSolverNonlinear alternating Schwarz on node stars.
- class proteus.NonlinearSolvers.FasTwoLevel(prolong, restrict, restrictSum, coarseF, preSmoother, postSmoother, coarseSolver, F, J=None, du=None, rtol_r=0.0001, atol_r=1e-16, rtol_du=0.0001, atol_du=1e-16, maxIts=100, norm=<function l2Norm>, convergenceTest='r', computeRates=True, printInfo=True)[source]
Bases:
NonlinearSolverA generic nonlinear two-level solver based on the full approximation scheme. (FAS).
- class proteus.NonlinearSolvers.FAS(prolongList, restrictList, restrictSumList, FList, preSmootherList, postSmootherList, coarseSolver, mgItsList=[], printInfo=True)[source]
Bases:
objectA generic nonlinear multigrid W cycle using the Full Approximation Scheme (FAS).
- class proteus.NonlinearSolvers.MultilevelNonlinearSolver(fList, levelNonlinearSolverList, computeRates=False, printInfo=False)[source]
Bases:
objectA generic multilevel solver.
- class proteus.NonlinearSolvers.NLNI(fList=[], solverList=[], prolongList=[], restrictList=[], restrictSumList=[], maxIts=None, tolList=None, atol=None, computeRates=True, printInfo=True)[source]
Bases:
MultilevelNonlinearSolverNonlinear nested iteration.
- proteus.NonlinearSolvers.multilevelNonlinearSolverChooser(nonlinearOperatorList, jacobianList, par_jacobianList, duList=None, par_duList=None, relativeToleranceList=None, absoluteTolerance=1e-08, multilevelNonlinearSolverType=<class 'proteus.NonlinearSolvers.NLNI'>, computeSolverRates=False, printSolverInfo=False, linearSolverList=None, linearDirectSolverFlag=False, solverFullNewtonFlag=True, maxSolverIts=500, solverConvergenceTest='r', levelNonlinearSolverType=<class 'proteus.NonlinearSolvers.Newton'>, levelSolverFullNewtonFlag=True, levelSolverConvergenceTest='r', computeLevelSolverRates=False, printLevelSolverInfo=False, relaxationFactor=None, connectionListList=None, smootherType='Jacobi', prolong_bcList=None, restrict_bcList=None, restrict_bcSumList=None, prolongList=None, restrictList=None, restrictionRowSumList=None, preSmooths=3, postSmooths=3, cycles=3, smootherConvergenceTest='its', computeSmootherRates=False, printSmootherInfo=False, smootherFullNewtonFlag=True, computeCoarseSolverRates=False, printCoarseSolverInfo=False, EWtol=True, maxLSits=100, parallelUsesFullOverlap=True, nonlinearSolverNorm=<function l2Norm>, nonlinearSolverUNorm=None, relativeToleranceDu=0.0001, absoluteToleranceDu=1e-16)[source]