KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
List of all members
Kratos::MultiLevelSolver< TSparseSpaceType, TDenseSpaceType, TReordererType > Class Template Reference

Wrapper for Trilinos-ML preconditioner using the Aztec-Solver. More...

#include <ml_solver.h>

Inheritance diagram for Kratos::MultiLevelSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >:
Collaboration diagram for Kratos::MultiLevelSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >:

Public Member Functions

Life Cycle
 MultiLevelSolver (Parameters Settings)
 Constructor with Parameters. More...
 
 MultiLevelSolver (Teuchos::ParameterList &rAztecParameterList, Teuchos::ParameterList &rMLParameterList, double Tolerance, int MaxIterations)
 
 MultiLevelSolver (const MultiLevelSolver &Other)=delete
 Copy constructor. More...
 
 ~MultiLevelSolver () override
 Destructor. More...
 
Operators
MultiLevelSolveroperator= (const MultiLevelSolver &Other)=delete
 Assignment operator. More...
 
- Public Member Functions inherited from Kratos::LinearSolver< TSparseSpaceType, TDenseSpaceType, Reorderer< TSparseSpaceType, TDenseSpaceType > >
 LinearSolver ()
 Default constructor. More...
 
 LinearSolver (Reorderer< TSparseSpaceType, TDenseSpaceType > NewReorderer)
 Constructor with specific reorderer. More...
 
 LinearSolver (const LinearSolver &Other)
 Copy constructor. More...
 
virtual ~LinearSolver ()
 Destructor. More...
 
LinearSolveroperator= (const LinearSolver &Other)
 Assignment operator. More...
 
virtual void Initialize (SparseMatrixType &rA, VectorType &rX, VectorType &rB)
 
virtual void InitializeSolutionStep (SparseMatrixType &rA, VectorType &rX, VectorType &rB)
 
virtual void PerformSolutionStep (SparseMatrixType &rA, VectorType &rX, VectorType &rB)
 
virtual void FinalizeSolutionStep (SparseMatrixType &rA, VectorType &rX, VectorType &rB)
 
virtual void Solve (SparseMatrixType &K, SparseMatrixType &M, DenseVectorType &Eigenvalues, DenseMatrixType &Eigenvectors)
 
virtual TReordererType::Pointer GetReorderer ()
 
virtual void SetReorderer (typename TReordererType::Pointer pNewReorderer)
 
virtual void SetTolerance (double NewTolerance)
 This method allows to set the tolerance in the linear solver. More...
 
virtual double GetTolerance ()
 This method allows to get the tolerance in the linear solver. More...
 
virtual IndexType GetIterationsNumber ()
 
virtual bool IsConsistent (SparseMatrixType &rA, VectorType &rX, VectorType &rB)
 This method checks if the dimensions of the system of equations are consistent. More...
 
virtual bool IsConsistent (SparseMatrixType &rA, DenseMatrixType &rX, DenseMatrixType &rB)
 This method checks if the dimensions of the system of equations are consistent (dense matrix for RHS and unknowns version) More...
 
virtual bool IsNotConsistent (SparseMatrixType &rA, VectorType &rX, VectorType &rB)
 This method checks if the dimensions of the system of equations are not consistent. More...
 
virtual bool IsNotConsistent (SparseMatrixType &rA, DenseMatrixType &rX, DenseMatrixType &rB)
 This method checks if the dimensions of the system of equations are not consistent. More...
 
virtual std::string Info () const
 Turn back information as a string. More...
 
virtual void PrintData (std::ostream &rOStream) const
 Print object's data. More...
 
 KRATOS_CLASS_POINTER_DEFINITION (LinearSolver)
 Pointer definition of LinearSolver. More...
 

Type Definitions

enum  ScalingType { NoScaling , LeftScaling }
 
typedef LinearSolver< TSparseSpaceType, TDenseSpaceType, TReordererType > BaseType
 
typedef BaseType::SparseMatrixType SparseMatrixType
 
typedef BaseType::VectorType VectorType
 
typedef BaseType::DenseMatrixType DenseMatrixType
 
typedef BaseType::SparseMatrixPointerType SparseMatrixPointerType
 
typedef Kratos::unique_ptr< ML_Epetra::MultiLevelPreconditioner > MLPreconditionerPointerType
 
 KRATOS_CLASS_POINTER_DEFINITION (MultiLevelSolver)
 Pointer definition of MultiLevelSolver. More...
 

Operations

void SetScalingType (ScalingType Value)
 
ScalingType GetScalingType ()
 
void SetReformPrecAtEachStep (bool Value)
 
void ResetPreconditioner ()
 
void Clear () override
 
bool Solve (SparseMatrixType &rA, VectorType &rX, VectorType &rB) override
 
bool Solve (SparseMatrixType &rA, DenseMatrixType &rX, DenseMatrixType &rB) override
 
bool AdditionalPhysicalDataIsNeeded () override
 
void ProvideAdditionalData (SparseMatrixType &rA, VectorType &rX, VectorType &rB, typename ModelPart::DofsArrayType &rdof_set, ModelPart &r_model_part) override
 
void PrintInfo (std::ostream &rOStream) const override
 Print information about this object. More...
 
static void SetDefaults (Teuchos::ParameterList &rParameterlist, const std::string &rSettingsName)
 

Additional Inherited Members

- Public Types inherited from Kratos::LinearSolver< TSparseSpaceType, TDenseSpaceType, Reorderer< TSparseSpaceType, TDenseSpaceType > >
typedef TSparseSpaceType::MatrixType SparseMatrixType
 
typedef TSparseSpaceType::MatrixPointerType SparseMatrixPointerType
 
typedef TSparseSpaceType::VectorType VectorType
 
typedef TSparseSpaceType::VectorPointerType VectorPointerType
 
typedef TDenseSpaceType::MatrixType DenseMatrixType
 
typedef TDenseSpaceType::VectorType DenseVectorType
 
typedef std::size_t SizeType
 
typedef TSparseSpaceType::IndexType IndexType
 The index type definition to be consistent. More...
 

Detailed Description

template<class TSparseSpaceType, class TDenseSpaceType, class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
class Kratos::MultiLevelSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >

Wrapper for Trilinos-ML preconditioner using the Aztec-Solver.

ML is Sandia’s main multigrid preconditioning package. ML is designed to solve large sparse linear systems of equations arising primarily from elliptic PDE discretizations. https://trilinos.org/packages/ml/

Member Typedef Documentation

◆ BaseType

template<class TSparseSpaceType , class TDenseSpaceType , class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
typedef LinearSolver<TSparseSpaceType, TDenseSpaceType, TReordererType> Kratos::MultiLevelSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >::BaseType

◆ DenseMatrixType

template<class TSparseSpaceType , class TDenseSpaceType , class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
typedef BaseType::DenseMatrixType Kratos::MultiLevelSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >::DenseMatrixType

◆ MLPreconditionerPointerType

template<class TSparseSpaceType , class TDenseSpaceType , class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
typedef Kratos::unique_ptr< ML_Epetra::MultiLevelPreconditioner > Kratos::MultiLevelSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >::MLPreconditionerPointerType

◆ SparseMatrixPointerType

template<class TSparseSpaceType , class TDenseSpaceType , class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
typedef BaseType::SparseMatrixPointerType Kratos::MultiLevelSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >::SparseMatrixPointerType

◆ SparseMatrixType

template<class TSparseSpaceType , class TDenseSpaceType , class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
typedef BaseType::SparseMatrixType Kratos::MultiLevelSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >::SparseMatrixType

◆ VectorType

template<class TSparseSpaceType , class TDenseSpaceType , class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
typedef BaseType::VectorType Kratos::MultiLevelSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >::VectorType

Member Enumeration Documentation

◆ ScalingType

template<class TSparseSpaceType , class TDenseSpaceType , class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
enum Kratos::MultiLevelSolver::ScalingType
Enumerator
NoScaling 
LeftScaling 

Constructor & Destructor Documentation

◆ MultiLevelSolver() [1/3]

template<class TSparseSpaceType , class TDenseSpaceType , class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
Kratos::MultiLevelSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >::MultiLevelSolver ( Parameters  Settings)
inline

Constructor with Parameters.

◆ MultiLevelSolver() [2/3]

template<class TSparseSpaceType , class TDenseSpaceType , class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
Kratos::MultiLevelSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >::MultiLevelSolver ( Teuchos::ParameterList &  rAztecParameterList,
Teuchos::ParameterList &  rMLParameterList,
double  Tolerance,
int  MaxIterations 
)
inline

◆ MultiLevelSolver() [3/3]

template<class TSparseSpaceType , class TDenseSpaceType , class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
Kratos::MultiLevelSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >::MultiLevelSolver ( const MultiLevelSolver< TSparseSpaceType, TDenseSpaceType, TReordererType > &  Other)
delete

Copy constructor.

◆ ~MultiLevelSolver()

template<class TSparseSpaceType , class TDenseSpaceType , class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
Kratos::MultiLevelSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >::~MultiLevelSolver ( )
inlineoverride

Destructor.

Member Function Documentation

◆ AdditionalPhysicalDataIsNeeded()

template<class TSparseSpaceType , class TDenseSpaceType , class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
bool Kratos::MultiLevelSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >::AdditionalPhysicalDataIsNeeded ( )
inlineoverridevirtual

Some solvers may require a minimum degree of knowledge of the structure of the matrix. To make an example when solving a mixed u-p problem, it is important to identify the row associated to v and p. another example is the automatic prescription of rotation null-space for smoothed-aggregation solvers which require knowledge on the spatial position of the nodes associated to a given dof. This function tells if the solver requires such data

Reimplemented from Kratos::LinearSolver< TSparseSpaceType, TDenseSpaceType, Reorderer< TSparseSpaceType, TDenseSpaceType > >.

◆ Clear()

template<class TSparseSpaceType , class TDenseSpaceType , class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
void Kratos::MultiLevelSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >::Clear ( )
inlineoverridevirtual

This function is designed to clean up all internal data in the solver. Clear is designed to leave the solver object as if newly created. After a clear a new Initialize is needed

Reimplemented from Kratos::LinearSolver< TSparseSpaceType, TDenseSpaceType, Reorderer< TSparseSpaceType, TDenseSpaceType > >.

◆ GetScalingType()

template<class TSparseSpaceType , class TDenseSpaceType , class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
ScalingType Kratos::MultiLevelSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >::GetScalingType ( )
inline

◆ KRATOS_CLASS_POINTER_DEFINITION()

template<class TSparseSpaceType , class TDenseSpaceType , class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
Kratos::MultiLevelSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >::KRATOS_CLASS_POINTER_DEFINITION ( MultiLevelSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >  )

Pointer definition of MultiLevelSolver.

◆ operator=()

template<class TSparseSpaceType , class TDenseSpaceType , class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
MultiLevelSolver& Kratos::MultiLevelSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >::operator= ( const MultiLevelSolver< TSparseSpaceType, TDenseSpaceType, TReordererType > &  Other)
delete

Assignment operator.

◆ PrintInfo()

template<class TSparseSpaceType , class TDenseSpaceType , class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
void Kratos::MultiLevelSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >::PrintInfo ( std::ostream &  rOStream) const
inlineoverridevirtual

◆ ProvideAdditionalData()

template<class TSparseSpaceType , class TDenseSpaceType , class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
void Kratos::MultiLevelSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >::ProvideAdditionalData ( SparseMatrixType rA,
VectorType rX,
VectorType rB,
typename ModelPart::DofsArrayType rdof_set,
ModelPart r_model_part 
)
inlineoverridevirtual

Some solvers may require a minimum degree of knowledge of the structure of the matrix. To make an example when solving a mixed u-p problem, it is important to identify the row associated to v and p. another example is the automatic prescription of rotation null-space for smoothed-aggregation solvers which require knowledge on the spatial position of the nodes associated to a given dof. This function is the place to eventually provide such data

Reimplemented from Kratos::LinearSolver< TSparseSpaceType, TDenseSpaceType, Reorderer< TSparseSpaceType, TDenseSpaceType > >.

◆ ResetPreconditioner()

template<class TSparseSpaceType , class TDenseSpaceType , class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
void Kratos::MultiLevelSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >::ResetPreconditioner ( )
inline

◆ SetDefaults()

template<class TSparseSpaceType , class TDenseSpaceType , class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
static void Kratos::MultiLevelSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >::SetDefaults ( Teuchos::ParameterList &  rParameterlist,
const std::string &  rSettingsName 
)
inlinestatic

◆ SetReformPrecAtEachStep()

template<class TSparseSpaceType , class TDenseSpaceType , class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
void Kratos::MultiLevelSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >::SetReformPrecAtEachStep ( bool  Value)
inline

◆ SetScalingType()

template<class TSparseSpaceType , class TDenseSpaceType , class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
void Kratos::MultiLevelSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >::SetScalingType ( ScalingType  Value)
inline

◆ Solve() [1/2]

template<class TSparseSpaceType , class TDenseSpaceType , class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
bool Kratos::MultiLevelSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >::Solve ( SparseMatrixType rA,
DenseMatrixType rX,
DenseMatrixType rB 
)
inlineoverridevirtual

Multi solve method for solving a set of linear systems with same coefficient matrix. Solves the linear system Ax=b and puts the result on SystemVector& rX. rX is also th initial guess for iterative methods.

Parameters
rA.System matrix
rX.Solution vector.
rB.Right hand side vector.

Reimplemented from Kratos::LinearSolver< TSparseSpaceType, TDenseSpaceType, Reorderer< TSparseSpaceType, TDenseSpaceType > >.

◆ Solve() [2/2]

template<class TSparseSpaceType , class TDenseSpaceType , class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
bool Kratos::MultiLevelSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >::Solve ( SparseMatrixType rA,
VectorType rX,
VectorType rB 
)
inlineoverridevirtual

Normal solve method. Solves the linear system Ax=b and puts the result in rX. rX is also the initial guess for iterative methods.

Parameters
rA.System matrix.
rX.Solution vector.
rB.Right hand side vector.

Reimplemented from Kratos::LinearSolver< TSparseSpaceType, TDenseSpaceType, Reorderer< TSparseSpaceType, TDenseSpaceType > >.


The documentation for this class was generated from the following file: