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.
convergence_criterion.hpp
Go to the documentation of this file.
1 //
2 // Project Name: KratosSolidMechanicsApplication $
3 // Created by: $Author: JMCarbonell $
4 // Last modified by: $Co-Author: $
5 // Date: $Date: May 2018 $
6 // Revision: $Revision: 0.0 $
7 //
8 //
9 
10 #if !defined(KRATOS_CONVERGENCE_CRITERION_H_INCLUDED )
11 #define KRATOS_CONVERGENCE_CRITERION_H_INCLUDED
12 
13 // System includes
14 
15 // External includes
16 
17 // Project includes
19 #include "includes/model_part.h"
20 //#include "includes/dof.h"
21 
22 namespace Kratos
23 {
26 
29 
33 
37 
41 
45 
46 
50 template<class TSparseSpace, class TDenseSpace>
52 {
53  public:
54 
58  typedef typename TSparseSpace::DataType DataType;
64 
67 
71 
74  {
75  SetEchoLevel(1);
76  }
77 
80  :mEchoLevel(rOther.mEchoLevel)
81  {
82  }
83 
86  {
87  }
88 
92 
96 
97  //*********************************************************************************
98 
104  virtual void SetEchoLevel(int Level)
105  {
106  mEchoLevel = Level;
107  }
108 
110  {
111  return mEchoLevel;
112  }
113 
114 
115  /*Criterias that need to be called before getting the solution */
116  virtual bool PreCriteria(ModelPart& rModelPart,
117  DofsArrayType& rDofSet,
118  const SystemMatrixType& rA,
119  const SystemVectorType& rDx,
120  const SystemVectorType& rb)
121  {
122  return true;
123  }
124 
125  /*Criterias that need to be called after getting the solution */
126  virtual bool PostCriteria(ModelPart& rModelPart,
127  DofsArrayType& rDofSet,
128  const SystemMatrixType& rA,
129  const SystemVectorType& rDx,
130  const SystemVectorType& rb)
131 
132  {
133  return true;
134  }
135 
136  virtual void InitializeSolutionStep(ModelPart& rModelPart,
137  DofsArrayType& rDofSet,
138  const SystemMatrixType& rA,
139  const SystemVectorType& rDx,
140  const SystemVectorType& rb)
141  {
142  }
143 
144  virtual void FinalizeSolutionStep(ModelPart& rModelPart,
145  DofsArrayType& rDofSet,
146  const SystemMatrixType& rA,
147  const SystemVectorType& rDx,
148  const SystemVectorType& rb)
149  {
150  }
151 
159  virtual int Check(ModelPart& rModelPart)
160  {
161  KRATOS_TRY
162 
163  return 0;
164 
165  KRATOS_CATCH("")
166  }
167 
171 
175 
179 
183 
185 
186  protected:
189 
193 
195 
199 
203 
207 
211 
215 
217 
218  private:
221 
225 
229 
233 
237 
241 
245 
247 
248 }; // Class ConvergenceCriterion
249 
251 
254 
255 
259 
261 
263 
264 } // namespace Kratos.
265 
266 #endif // KRATOS_CONVERGENCE_CRITERION_H_INCLUDED defined
Convergence Criterion base class.
Definition: convergence_criterion.hpp:52
~ConvergenceCriterion() override
Destructor.
Definition: convergence_criterion.hpp:85
TSparseSpace::DataType DataType
Definition: convergence_criterion.hpp:58
int GetEchoLevel()
Definition: convergence_criterion.hpp:109
virtual void InitializeSolutionStep(ModelPart &rModelPart, DofsArrayType &rDofSet, const SystemMatrixType &rA, const SystemVectorType &rDx, const SystemVectorType &rb)
Definition: convergence_criterion.hpp:136
TSparseSpace::MatrixType SystemMatrixType
Definition: convergence_criterion.hpp:60
virtual bool PreCriteria(ModelPart &rModelPart, DofsArrayType &rDofSet, const SystemMatrixType &rA, const SystemVectorType &rDx, const SystemVectorType &rb)
Definition: convergence_criterion.hpp:116
CriterionLocalFlags LocalFlagType
Definition: convergence_criterion.hpp:57
int mEchoLevel
Definition: convergence_criterion.hpp:194
virtual void SetEchoLevel(int Level)
Definition: convergence_criterion.hpp:104
KRATOS_CLASS_POINTER_DEFINITION(ConvergenceCriterion)
Pointer definition of ConvergenceCriterion.
ModelPart::DofsArrayType DofsArrayType
Definition: convergence_criterion.hpp:59
virtual void FinalizeSolutionStep(ModelPart &rModelPart, DofsArrayType &rDofSet, const SystemMatrixType &rA, const SystemVectorType &rDx, const SystemVectorType &rb)
Definition: convergence_criterion.hpp:144
virtual int Check(ModelPart &rModelPart)
Definition: convergence_criterion.hpp:159
TSparseSpace::VectorType SystemVectorType
Definition: convergence_criterion.hpp:61
TDenseSpace::VectorType LocalSystemVectorType
Definition: convergence_criterion.hpp:63
virtual bool PostCriteria(ModelPart &rModelPart, DofsArrayType &rDofSet, const SystemMatrixType &rA, const SystemVectorType &rDx, const SystemVectorType &rb)
Definition: convergence_criterion.hpp:126
ConvergenceCriterion(ConvergenceCriterion const &rOther)
Copy contructor.
Definition: convergence_criterion.hpp:79
ConvergenceCriterion()
Constructor.
Definition: convergence_criterion.hpp:73
TDenseSpace::MatrixType LocalSystemMatrixType
Definition: convergence_criterion.hpp:62
Solver local flags class definition.
Definition: solution_local_flags.hpp:74
Definition: flags.h:58
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
A sorted associative container similar to an STL set, but uses a vector to store pointers to its data...
Definition: pointer_vector_set.h:72
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
Vector VectorType
Definition: geometrical_transformation_utilities.h:56
Matrix MatrixType
Definition: geometrical_transformation_utilities.h:55
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21