Base class for Chrono solvers based on Eigen iterative linear solvers.

Iterative linear solvers.
Cannot handle VI and complementarity problems, so they cannot be used with NSC formulations.

All iterative solvers are implemented in a matrix-free context and rely on the system descriptor for the required SPMV operations. See ChSystemDescriptor for more information about the problem formulation and the data structures passed to the solver.

The default value for the maximum number of iterations is twice the matrix size.

The threshold value specified through SetTolerance is used by the stopping criteria as an upper bound to the relative residual error: |Ax - b|/|b|. Default: machine precision.

By default, these solvers use a diagonal preconditioner and no warm start. Recall that the warm start option should be used only in conjunction with the Euler implicit linearized integrator.

#include <ChIterativeSolverLS.h>

Inheritance diagram for chrono::ChIterativeSolverLS:
Collaboration diagram for chrono::ChIterativeSolverLS:

Public Member Functions

virtual bool Setup (ChSystemDescriptor &sysd) override
 Perform the solver setup operations. More...
virtual double Solve (ChSystemDescriptor &sysd) override
 Performs the solution of the problem. More...
- Public Member Functions inherited from chrono::ChIterativeSolver
virtual void SetMaxIterations (int max_iterations)
 Set the maximum number of iterations.
void SetTolerance (double tolerance)
 Set the tolerance threshold used by the stopping criteria.
void EnableDiagonalPreconditioner (bool val)
 Enable/disable use of a simple diagonal preconditioner (default: true). More...
void EnableWarmStart (bool val)
 Enable/disable warm starting by providing an initial guess (default: false). More...
int GetMaxIterations () const
 Get the current maximum number of iterations.
double GetTolerance () const
 Get the current tolerance value.
virtual int GetIterations () const =0
 Return the number of iterations performed during the last solve.
virtual double GetError () const =0
 Return the tolerance error reached during the last solve.
- Public Member Functions inherited from chrono::ChSolver
virtual Type GetType () const
 Return type of the solver.
virtual ChDirectSolverLSAsDirect ()
 Downcast to ChDirectSolver.
void SetVerbose (bool mv)
 Set verbose output from solver.
void EnableWrite (bool val, const std::string &frame, const std::string &out_dir=".")
 Enable/disable debug output of matrix, RHS, and solution vector.
virtual void ArchiveOut (ChArchiveOut &archive_out)
 Method to allow serialization of transient data to archives.
virtual void ArchiveIn (ChArchiveIn &archive_in)
 Method to allow de-serialization of transient data from archives.

Protected Member Functions

virtual bool IsIterative () const override
 Return true if iterative solver.
virtual bool IsDirect () const override
 Return true if direct solver.
virtual ChIterativeSolverAsIterative () override
 Downcast to ChIterativeSolver.
virtual bool SolveRequiresMatrix () const override final
 Indicate whether or not the Solve() phase requires an up-to-date problem matrix.
virtual bool SetupProblem ()=0
 Initialize the solver with the current sparse matrix and return true if successful.
virtual bool SolveProblem ()=0
 Solve the linear system using the current factorization and right-hand side vector. More...
- Protected Member Functions inherited from chrono::ChIterativeSolver
 ChIterativeSolver (int max_iterations, double tolerance, bool use_precond, bool warm_start)
void WriteMatrices (ChSystemDescriptor &sysd, bool one_indexed=true)
double CheckSolution (ChSystemDescriptor &sysd, const ChVectorDynamic<> &x)

Protected Attributes

ChMatrixSPMV * m_spmv
 matrix-like wrapper for SPMV operations
ChVectorDynamic< double > m_sol
 solution vector
ChVectorDynamic< double > m_rhs
 right-hand side vector
ChVectorDynamic< double > m_invdiag
 inverse diagonal entries (for preconditioning)
ChVectorDynamic< double > m_initguess
 initial guess (for warm start)
- Protected Attributes inherited from chrono::ChIterativeSolver
bool m_use_precond
 use diagonal preconditioning?
bool m_warm_start
 use initial guesss?
int m_max_iterations
 maximum number of iterations
double m_tolerance
 tolerance threshold in stopping criteria
- Protected Attributes inherited from chrono::ChSolver
bool verbose
bool write_matrix
std::string output_dir
std::string frame_id

Additional Inherited Members

- Public Types inherited from chrono::ChSolver
enum  Type {
  Type::PSOR, Type::PSSOR, Type::PJACOBI, Type::PMINRES,
 Available types of solvers. More...

Member Function Documentation

◆ Setup()

bool chrono::ChIterativeSolverLS::Setup ( ChSystemDescriptor sysd)

Perform the solver setup operations.

Here, sysd is the system description with constraints and variables. Returns true if successful and false otherwise.

Reimplemented from chrono::ChSolver.

◆ Solve()

double chrono::ChIterativeSolverLS::Solve ( ChSystemDescriptor sysd)

Performs the solution of the problem.

Return the maximum constraint violation after termination.

Implements chrono::ChSolver.

◆ SolveProblem()

virtual bool chrono::ChIterativeSolverLS::SolveProblem ( )
protectedpure virtual

Solve the linear system using the current factorization and right-hand side vector.

Load the solution vector (already of appropriate size) and return true if succesful.

The documentation for this class was generated from the following files:
  • /builds/uwsbel/chrono/src/chrono/solver/ChIterativeSolverLS.h
  • /builds/uwsbel/chrono/src/chrono/solver/ChIterativeSolverLS.cpp