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_accelerator.h
Go to the documentation of this file.
1 // | / |
2 // ' / __| _` | __| _ \ __|
3 // . \ | ( | | ( |\__ `
4 // _|\_\_| \__,_|\__|\___/ ____/
5 // Multi-Physics
6 //
7 // License: BSD License
8 // Kratos default license: kratos/license.txt
9 //
10 // Main authors: Ruben Zorrilla
11 // Philipp Bucher
12 //
13 //
14 
15 #if !defined(KRATOS_CONVERGENCE_ACCELERATOR )
16 #define KRATOS_CONVERGENCE_ACCELERATOR
17 
18 // System includes
19 
20 // External includes
21 
22 // Project includes
23 #include "includes/define.h"
25 
26 namespace Kratos
27 {
28 
31 
34 
41 template<class TSparseSpace, class TDenseSpace>
43 {
44 
45 public:
46 
49 
52 
53  typedef typename TSparseSpace::VectorPointerType VectorPointerType;
54  typedef typename TSparseSpace::MatrixPointerType MatrixPointerType;
55 
58 
59  typedef typename TDenseSpace::MatrixPointerType DenseMatrixPointerType;
60  typedef typename TDenseSpace::VectorPointerType DenseVectorPointerType;
61 
62  // Counted pointer of ConvergenceAccelerator
64 
68 
69  // Default constructor
71 
72  // Constructor with Parameters
74 
75  // Deleted copy constructor
77 
78  // Default destructor
79  virtual ~ConvergenceAccelerator() = default;
80 
84 
89  virtual void Initialize()
90  {
91  }
92 
97  virtual void InitializeSolutionStep()
98  {
99  }
100 
106  {
107  }
108 
116  virtual void UpdateSolution(
117  const VectorType& rResidualVector,
118  VectorType& rIterationGuess)
119  {
120  }
121 
127  {
128  }
129 
134  virtual void FinalizeSolutionStep()
135  {
136  }
137 
142  virtual void Finalize()
143  {
144  }
145 
150  virtual void Clear()
151  {
152  }
153 
159  virtual void SetEchoLevel(int Level)
160  {
161  mEchoLevel = Level;
162  }
163 
170  {
171  return mEchoLevel;
172  }
173 
181  virtual bool IsBlockNewton() const
182  {
183  return false;
184  }
185 
187 protected:
190 
191  // Level of echo for the convergence accelerator
193 
197 
199  {
200  KRATOS_ERROR << "Interface Jacobian approximation cannot be computed with this convergence accelerator." << std::endl;
201  }
202 
204  {
205  KRATOS_ERROR << "Interface Jacobian approximation is not available for this convergence accelerator." << std::endl;
206  }
207 
208  virtual std::size_t GetProblemSize() const
209  {
210  KRATOS_ERROR << "Problem size is not available for this convergence accelerator." << std::endl;
211  }
212 
214 }; // Class ConvergenceAccelerator
215 
217 
218 }
219 
220 #endif // KRATOS_CONVERGENCE_ACCELERATOR defined
Base class for convergence accelerators This class is intended to be the base of any convergence acce...
Definition: convergence_accelerator.h:43
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
TDenseSpace::VectorType DenseVectorType
Definition: convergence_accelerator.h:56
TSparseSpace::VectorType VectorType
Definition: convergence_accelerator.h:50
virtual DenseMatrixPointerType pGetInverseJacobianApproximation()
Definition: convergence_accelerator.h:203
virtual void Finalize()
Finalize the convergence accelerator Perform all the operations required after the resolution of the ...
Definition: convergence_accelerator.h:142
#define KRATOS_ERROR
Definition: exception.h:161
virtual void FinalizeNonLinearIteration()
Operations after each non-linear iteration Performs all the required operations that should be done a...
Definition: convergence_accelerator.h:126
virtual void FinalizeSolutionStep()
Operations after solving the solution step Performs all the required operations that should be done (...
Definition: convergence_accelerator.h:134
virtual std::size_t GetProblemSize() const
Definition: convergence_accelerator.h:208
TDenseSpace::MatrixPointerType DenseMatrixPointerType
Definition: convergence_accelerator.h:59
int GetEchoLevel()
Get the Echo Level object Get the echo level of the convergence accelerator.
Definition: convergence_accelerator.h:169
TDenseSpace::MatrixType DenseMatrixType
Definition: convergence_accelerator.h:57
virtual void InitializeNonLinearIteration()
Operations before each non-linear iteration Performs all the required operations that should be done ...
Definition: convergence_accelerator.h:105
TSparseSpace::VectorPointerType VectorPointerType
Definition: convergence_accelerator.h:53
KRATOS_CLASS_POINTER_DEFINITION(ConvergenceAccelerator)
TSparseSpace::MatrixPointerType MatrixPointerType
Definition: convergence_accelerator.h:54
virtual void InitializeSolutionStep()
Operations before solving the solution step Performs all the required operations that should be done ...
Definition: convergence_accelerator.h:97
ConvergenceAccelerator(Parameters ThisParameters)
Definition: convergence_accelerator.h:73
virtual void Clear()
Clear the internal storage Clears all the internal data (e.g. previous observation matrices)
Definition: convergence_accelerator.h:150
virtual ~ConvergenceAccelerator()=default
virtual bool IsBlockNewton() const
Checks if the update direction is unique or double For the current convergence accelerator,...
Definition: convergence_accelerator.h:181
virtual void ComputeJacobianApproximation()
Definition: convergence_accelerator.h:198
virtual void UpdateSolution(const VectorType &rResidualVector, VectorType &rIterationGuess)
Corrects the given iteration guess Computes the correction of the iteration guess according to the pr...
Definition: convergence_accelerator.h:116
TDenseSpace::VectorPointerType DenseVectorPointerType
Definition: convergence_accelerator.h:60
virtual void Initialize()
Initialize the convergence accelerator Operations that are required to be done once before the resolu...
Definition: convergence_accelerator.h:89
virtual void SetEchoLevel(int Level)
Set the Echo Level object Set the echo level of the convergence accelerator.
Definition: convergence_accelerator.h:159
ConvergenceAccelerator(const ConvergenceAccelerator &Other)=delete
TSparseSpace::MatrixType MatrixType
Definition: convergence_accelerator.h:51
int mEchoLevel
Definition: convergence_accelerator.h:192
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