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::MixedGenericCriteria< TSparseSpace, TDenseSpace > Class Template Reference

Convergence criteria for mixed vector-scalar problems. More...

#include <mixed_generic_criteria.h>

Inheritance diagram for Kratos::MixedGenericCriteria< TSparseSpace, TDenseSpace >:
Collaboration diagram for Kratos::MixedGenericCriteria< TSparseSpace, TDenseSpace >:

Public Member Functions

Life Cycle
 MixedGenericCriteria ()
 Constructor. More...
 
 MixedGenericCriteria (Kratos::Parameters ThisParameters)
 Default constructor. (with parameters) More...
 
 MixedGenericCriteria (const ConvergenceVariableListType &rConvergenceVariablesList)
 Construct a new Mixed Generic Criteria object Construct the mixed generic convergence criteria from a convergence variables list. The convergence variable list contains for each variable the variable itself as well as the corresponding relative and absolute tolerances. More...
 
 ~MixedGenericCriteria () override
 Destructor. More...
 
Input and output
std::string Info () const override
 Turn back information as a string. More...
 
void PrintInfo (std::ostream &rOStream) const override
 Print information about this object. More...
 
void PrintData (std::ostream &rOStream) const override
 Print object's data. More...
 
- Public Member Functions inherited from Kratos::ConvergenceCriteria< TSparseSpace, TDenseSpace >
 ConvergenceCriteria ()
 
 ConvergenceCriteria (Kratos::Parameters ThisParameters)
 Constructor with Parameters. More...
 
 ConvergenceCriteria (ConvergenceCriteria const &rOther)
 
virtual ~ConvergenceCriteria ()
 
 KRATOS_CLASS_POINTER_DEFINITION (ConvergenceCriteria)
 Pointer definition of ConvergenceCriteria. More...
 
virtual std::vector< TSystemVectorType > & GetRHS_Element_Components ()
 Get component wise element components. More...
 
virtual std::vector< Variable< LocalSystemVectorType > > & GetRHS_Element_Variables ()
 Get component wise element variables. More...
 
virtual std::vector< TSystemVectorType > & GetRHS_Condition_Components ()
 Get component wise condition components. More...
 
virtual std::vector< Variable< LocalSystemVectorType > > & GetRHS_Condition_Variables ()
 Get component wise condition variables. More...
 
virtual void SetEchoLevel (int Level)
 It sets the level of echo for the solving strategy. More...
 
int GetEchoLevel ()
 This returns the level of echo for the solving strategy. More...
 
void SetActualizeRHSFlag (bool ActualizeRHSIsNeeded)
 This method sets the flag mActualizeRHSIsNeeded. More...
 
bool GetActualizeRHSflag ()
 This method gets the flag mActualizeRHSIsNeeded. More...
 
virtual bool PreCriteria (ModelPart &rModelPart, DofsArrayType &rDofSet, const TSystemMatrixType &rA, const TSystemVectorType &rDx, const TSystemVectorType &rb)
 Criterias that need to be called before getting the solution. More...
 
virtual void Initialize (ModelPart &rModelPart)
 This function initialize the convergence criteria. More...
 
virtual bool IsInitialized ()
 This function returns if the convergence criteria is initialized. More...
 
virtual void InitializeSolutionStep (ModelPart &rModelPart, DofsArrayType &rDofSet, const TSystemMatrixType &rA, const TSystemVectorType &rDx, const TSystemVectorType &rb)
 This function initializes the solution step. More...
 
virtual void InitializeNonLinearIteration (ModelPart &rModelPart, DofsArrayType &rDofSet, const TSystemMatrixType &rA, const TSystemVectorType &rDx, const TSystemVectorType &rb)
 This function initializes the non-linear iteration. More...
 
virtual void FinalizeSolutionStep (ModelPart &rModelPart, DofsArrayType &rDofSet, const TSystemMatrixType &rA, const TSystemVectorType &rDx, const TSystemVectorType &rb)
 This function finalizes the solution step. More...
 
virtual void FinalizeNonLinearIteration (ModelPart &rModelPart, DofsArrayType &rDofSet, const TSystemMatrixType &rA, const TSystemVectorType &rDx, const TSystemVectorType &rb)
 This function finalizes the non-linear iteration. More...
 
virtual int Check (ModelPart &rModelPart)
 This function is designed to be called once to perform all the checks needed on the input provided. Checks can be "expensive" as the function is designed to catch user's errors. More...
 
virtual Parameters GetDefaultParameters () const
 This method provides the defaults parameters to avoid conflicts between the different constructors. More...
 

Protected Member Functions

Protected Operations
int GetVariableSize () const
 Get the Variable Size object Get the number of variables to be checked. More...
 
std::vector< const VariableData * > GetVariableDataVector () const
 Get the Variable Data Vector object Get the member vector that stores pointers to the variables to check. More...
 
std::vector< TDataTypeGetRatioToleranceVector () const
 Get the Ratio Tolerance Vector object Get the member vector containing the ratio tolerances for each variable to check. More...
 
std::vector< TDataTypeGetAbsToleranceVector () const
 Get the Abs Tolerance Vector object Get the member vector containing the absolute tolerances for each variable to check. More...
 
std::unordered_map< KeyType, KeyType > & GetLocalKeyMap ()
 Get the Local Key Map object Returns a reference to the variable key local map. More...
 
std::tuple< std::vector< TDataType >, std::vector< TDataType > > CalculateConvergenceNorms (const ModelPart &rModelPart, const DofsArrayType &rDofSet, const TSystemVectorType &rDx)
 Calculate the convergence norms This method calculates the convergence norms for all the variables to be checked. More...
 
virtual void OutputConvergenceStatus (const std::tuple< std::vector< TDataType >, std::vector< TDataType >> &rConvergenceNorms)
 Method to output the convergence status This method prints the convergence status to the screen for each one of the checked variables. More...
 
bool CheckConvergence (const std::tuple< std::vector< TDataType >, std::vector< TDataType >> &rConvergenceNorms)
 Method to check convergence This method checks the convergence of the provided norms with the user-defined tolerances. More...
 
bool FindVarLocalKey (typename DofsArrayType::const_iterator itDof, int &rVarLocalKey) const
 Finds the var local key in the mLocalKeyMap for a gifen DOF. If the variable does not exist in mLocalKeyMap this function returns false. More...
 
- Protected Member Functions inherited from Kratos::ConvergenceCriteria< TSparseSpace, TDenseSpace >
virtual Parameters ValidateAndAssignParameters (Parameters ThisParameters, const Parameters DefaultParameters) const
 This method validate and assign default parameters. More...
 
virtual void AssignSettings (const Parameters ThisParameters)
 This method assigns settings to member variables. More...
 

Type Definitions

typedef ConvergenceCriteria< TSparseSpace, TDenseSpace > BaseType
 
typedef MixedGenericCriteria< TSparseSpace, TDenseSpace > ClassType
 
typedef BaseType::TDataType TDataType
 
typedef BaseType::DofsArrayType DofsArrayType
 
typedef BaseType::TSystemMatrixType TSystemMatrixType
 
typedef BaseType::TSystemVectorType TSystemVectorType
 
typedef std::vector< std::tuple< const VariableData *, TDataType, TDataType > > ConvergenceVariableListType
 
typedef std::size_t KeyType
 
 KRATOS_CLASS_POINTER_DEFINITION (MixedGenericCriteria)
 

Operations

BaseType::Pointer Create (Parameters ThisParameters) const override
 Create method. More...
 
bool PostCriteria (ModelPart &rModelPart, DofsArrayType &rDofSet, const TSystemMatrixType &A, const TSystemVectorType &Dx, const TSystemVectorType &b) override
 Compute relative and absolute error. More...
 
static std::string Name ()
 Returns the name of the class as used in the settings (snake_case format) More...
 

Additional Inherited Members

- Public Types inherited from Kratos::ConvergenceCriteria< TSparseSpace, TDenseSpace >
typedef ConvergenceCriteria< TSparseSpace, TDenseSpace > ClassType
 The definition of the current class. More...
 
typedef TSparseSpace::DataType TDataType
 Data type definition. More...
 
typedef TSparseSpace::MatrixType TSystemMatrixType
 Matrix type definition. More...
 
typedef TSparseSpace::VectorType TSystemVectorType
 Vector type definition. More...
 
typedef TDenseSpace::MatrixType LocalSystemMatrixType
 Local system matrix type definition. More...
 
typedef TDenseSpace::VectorType LocalSystemVectorType
 Local system vector type definition. More...
 
typedef ModelPart::DofsArrayType DofsArrayType
 DoF array type definition. More...
 
- Static Public Member Functions inherited from Kratos::ConvergenceCriteria< TSparseSpace, TDenseSpace >
static std::string Name ()
 Returns the name of the class as used in the settings (snake_case format) More...
 
- Protected Attributes inherited from Kratos::ConvergenceCriteria< TSparseSpace, TDenseSpace >
bool mActualizeRHSIsNeeded = false
 
bool mConvergenceCriteriaIsInitialized = false
 This "flag" is set in order to know if it is necessary to actualize the RHS. More...
 
int mEchoLevel
 This "flag" is set in order to know if it is convergence criteria is initialized. More...
 

Detailed Description

template<class TSparseSpace, class TDenseSpace>
class Kratos::MixedGenericCriteria< TSparseSpace, TDenseSpace >

Convergence criteria for mixed vector-scalar problems.

This class implements a convergence control based on a nodal vector variable and a nodal scalar variable. The error is evaluated separately for each of them, and relative and absolute tolerances for both must be specified.

Member Typedef Documentation

◆ BaseType

template<class TSparseSpace , class TDenseSpace >
typedef ConvergenceCriteria< TSparseSpace, TDenseSpace > Kratos::MixedGenericCriteria< TSparseSpace, TDenseSpace >::BaseType

◆ ClassType

template<class TSparseSpace , class TDenseSpace >
typedef MixedGenericCriteria< TSparseSpace, TDenseSpace > Kratos::MixedGenericCriteria< TSparseSpace, TDenseSpace >::ClassType

◆ ConvergenceVariableListType

template<class TSparseSpace , class TDenseSpace >
typedef std::vector<std::tuple<const VariableData*, TDataType, TDataType> > Kratos::MixedGenericCriteria< TSparseSpace, TDenseSpace >::ConvergenceVariableListType

◆ DofsArrayType

template<class TSparseSpace , class TDenseSpace >
typedef BaseType::DofsArrayType Kratos::MixedGenericCriteria< TSparseSpace, TDenseSpace >::DofsArrayType

◆ KeyType

template<class TSparseSpace , class TDenseSpace >
typedef std::size_t Kratos::MixedGenericCriteria< TSparseSpace, TDenseSpace >::KeyType

◆ TDataType

template<class TSparseSpace , class TDenseSpace >
typedef BaseType::TDataType Kratos::MixedGenericCriteria< TSparseSpace, TDenseSpace >::TDataType

◆ TSystemMatrixType

template<class TSparseSpace , class TDenseSpace >
typedef BaseType::TSystemMatrixType Kratos::MixedGenericCriteria< TSparseSpace, TDenseSpace >::TSystemMatrixType

◆ TSystemVectorType

template<class TSparseSpace , class TDenseSpace >
typedef BaseType::TSystemVectorType Kratos::MixedGenericCriteria< TSparseSpace, TDenseSpace >::TSystemVectorType

Constructor & Destructor Documentation

◆ MixedGenericCriteria() [1/3]

template<class TSparseSpace , class TDenseSpace >
Kratos::MixedGenericCriteria< TSparseSpace, TDenseSpace >::MixedGenericCriteria ( )
inlineexplicit

Constructor.

◆ MixedGenericCriteria() [2/3]

template<class TSparseSpace , class TDenseSpace >
Kratos::MixedGenericCriteria< TSparseSpace, TDenseSpace >::MixedGenericCriteria ( Kratos::Parameters  ThisParameters)
inlineexplicit

Default constructor. (with parameters)

Parameters
ThisParametersThe configuration parameters

◆ MixedGenericCriteria() [3/3]

template<class TSparseSpace , class TDenseSpace >
Kratos::MixedGenericCriteria< TSparseSpace, TDenseSpace >::MixedGenericCriteria ( const ConvergenceVariableListType rConvergenceVariablesList)
inline

Construct a new Mixed Generic Criteria object Construct the mixed generic convergence criteria from a convergence variables list. The convergence variable list contains for each variable the variable itself as well as the corresponding relative and absolute tolerances.

Parameters
rConvergenceVariablesListList containing tuples with the convergence variables to be checked. The tuples are set as <Variable, relative tolerance, absolute tolerance>

◆ ~MixedGenericCriteria()

template<class TSparseSpace , class TDenseSpace >
Kratos::MixedGenericCriteria< TSparseSpace, TDenseSpace >::~MixedGenericCriteria ( )
inlineoverride

Destructor.

Member Function Documentation

◆ CalculateConvergenceNorms()

template<class TSparseSpace , class TDenseSpace >
std::tuple<std::vector<TDataType>, std::vector<TDataType> > Kratos::MixedGenericCriteria< TSparseSpace, TDenseSpace >::CalculateConvergenceNorms ( const ModelPart rModelPart,
const DofsArrayType rDofSet,
const TSystemVectorType rDx 
)
inlineprotected

Calculate the convergence norms This method calculates the convergence norms for all the variables to be checked.

Parameters
rModelPartReference to the ModelPart containing the fluid problem.
rDofSetReference to the container of the problem's degrees of freedom (stored by the BuilderAndSolver)
rDxVector of results (variations on nodal variables)
Returns
std::tuple<std::vector<TDataType>, std::vector<TDataType>> Tuple containing the absolute and relative convergence values

◆ CheckConvergence()

template<class TSparseSpace , class TDenseSpace >
bool Kratos::MixedGenericCriteria< TSparseSpace, TDenseSpace >::CheckConvergence ( const std::tuple< std::vector< TDataType >, std::vector< TDataType >> &  rConvergenceNorms)
inlineprotected

Method to check convergence This method checks the convergence of the provided norms with the user-defined tolerances.

Parameters
rConvergenceNormsTuple containing the absolute and relative convergence values
Returns
true Convergence is satisfied
false Convergence is not satisfied

◆ Create()

template<class TSparseSpace , class TDenseSpace >
BaseType::Pointer Kratos::MixedGenericCriteria< TSparseSpace, TDenseSpace >::Create ( Parameters  ThisParameters) const
inlineoverridevirtual

Create method.

Parameters
ThisParametersThe configuration parameters

Reimplemented from Kratos::ConvergenceCriteria< TSparseSpace, TDenseSpace >.

◆ FindVarLocalKey()

template<class TSparseSpace , class TDenseSpace >
bool Kratos::MixedGenericCriteria< TSparseSpace, TDenseSpace >::FindVarLocalKey ( typename DofsArrayType::const_iterator  itDof,
int rVarLocalKey 
) const
inlineprotected

Finds the var local key in the mLocalKeyMap for a gifen DOF. If the variable does not exist in mLocalKeyMap this function returns false.

Parameters
itDofthe DOF iterator
rVarLocalKeyvariable local key
Returns
dof variable is found or not

◆ GetAbsToleranceVector()

template<class TSparseSpace , class TDenseSpace >
std::vector<TDataType> Kratos::MixedGenericCriteria< TSparseSpace, TDenseSpace >::GetAbsToleranceVector ( ) const
inlineprotected

Get the Abs Tolerance Vector object Get the member vector containing the absolute tolerances for each variable to check.

Returns
std::vector<TDataType> Vector containing the absolute tolerances

◆ GetLocalKeyMap()

template<class TSparseSpace , class TDenseSpace >
std::unordered_map<KeyType, KeyType>& Kratos::MixedGenericCriteria< TSparseSpace, TDenseSpace >::GetLocalKeyMap ( )
inlineprotected

Get the Local Key Map object Returns a reference to the variable key local map.

Returns
std::unordered_map<KeyType, KeyType>& Reference to the local key map

◆ GetRatioToleranceVector()

template<class TSparseSpace , class TDenseSpace >
std::vector<TDataType> Kratos::MixedGenericCriteria< TSparseSpace, TDenseSpace >::GetRatioToleranceVector ( ) const
inlineprotected

Get the Ratio Tolerance Vector object Get the member vector containing the ratio tolerances for each variable to check.

Returns
std::vector<TDataType> Vector containing the ratio tolerances

◆ GetVariableDataVector()

template<class TSparseSpace , class TDenseSpace >
std::vector<const VariableData*> Kratos::MixedGenericCriteria< TSparseSpace, TDenseSpace >::GetVariableDataVector ( ) const
inlineprotected

Get the Variable Data Vector object Get the member vector that stores pointers to the variables to check.

Returns
std::vector<VariableData*> Vector containing pointers to the variables to check

◆ GetVariableSize()

template<class TSparseSpace , class TDenseSpace >
int Kratos::MixedGenericCriteria< TSparseSpace, TDenseSpace >::GetVariableSize ( ) const
inlineprotected

Get the Variable Size object Get the number of variables to be checked.

Returns
const int Number of variables to check

◆ Info()

template<class TSparseSpace , class TDenseSpace >
std::string Kratos::MixedGenericCriteria< TSparseSpace, TDenseSpace >::Info ( ) const
inlineoverridevirtual

Turn back information as a string.

Reimplemented from Kratos::ConvergenceCriteria< TSparseSpace, TDenseSpace >.

◆ KRATOS_CLASS_POINTER_DEFINITION()

template<class TSparseSpace , class TDenseSpace >
Kratos::MixedGenericCriteria< TSparseSpace, TDenseSpace >::KRATOS_CLASS_POINTER_DEFINITION ( MixedGenericCriteria< TSparseSpace, TDenseSpace >  )

◆ Name()

template<class TSparseSpace , class TDenseSpace >
static std::string Kratos::MixedGenericCriteria< TSparseSpace, TDenseSpace >::Name ( )
inlinestatic

Returns the name of the class as used in the settings (snake_case format)

Returns
The name of the class

◆ OutputConvergenceStatus()

template<class TSparseSpace , class TDenseSpace >
virtual void Kratos::MixedGenericCriteria< TSparseSpace, TDenseSpace >::OutputConvergenceStatus ( const std::tuple< std::vector< TDataType >, std::vector< TDataType >> &  rConvergenceNorms)
inlineprotectedvirtual

Method to output the convergence status This method prints the convergence status to the screen for each one of the checked variables.

Parameters
rConvergenceNormsTuple containing the absolute and relative convergence values

◆ PostCriteria()

template<class TSparseSpace , class TDenseSpace >
bool Kratos::MixedGenericCriteria< TSparseSpace, TDenseSpace >::PostCriteria ( ModelPart rModelPart,
DofsArrayType rDofSet,
const TSystemMatrixType A,
const TSystemVectorType Dx,
const TSystemVectorType b 
)
inlineoverridevirtual

Compute relative and absolute error.

Parameters
rModelPartReference to the ModelPart containing the fluid problem.
rDofSetReference to the container of the problem's degrees of freedom (stored by the BuilderAndSolver)
ASystem matrix (unused)
DxVector of results (variations on nodal variables)
bRHS vector (residual)
Returns
true if convergence is achieved, false otherwise

Reimplemented from Kratos::ConvergenceCriteria< TSparseSpace, TDenseSpace >.

Reimplemented in Kratos::TrilinosMixedGenericCriteria< TSparseSpace, TDenseSpace >.

◆ PrintData()

template<class TSparseSpace , class TDenseSpace >
void Kratos::MixedGenericCriteria< TSparseSpace, TDenseSpace >::PrintData ( std::ostream &  rOStream) const
inlineoverridevirtual

Print object's data.

Reimplemented from Kratos::ConvergenceCriteria< TSparseSpace, TDenseSpace >.

◆ PrintInfo()

template<class TSparseSpace , class TDenseSpace >
void Kratos::MixedGenericCriteria< TSparseSpace, TDenseSpace >::PrintInfo ( std::ostream &  rOStream) const
inlineoverridevirtual

Print information about this object.

Reimplemented from Kratos::ConvergenceCriteria< TSparseSpace, TDenseSpace >.


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