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.
constant_relaxation_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 //
12 //
13 
14 #if !defined(KRATOS_CONSTANT_RELAXATION_CONVERGENCE_ACCELERATOR)
15 #define KRATOS_CONSTANT_RELAXATION_CONVERGENCE_ACCELERATOR
16 
17 /* System includes */
18 
19 
20 /* External includes */
21 
22 
23 /* Project includes */
25 
26 
27 namespace Kratos
28 {
29 
32 
36 
40 
44 
48 
55 template<class TSparseSpace, class TDenseSpace>
56 class ConstantRelaxationConvergenceAccelerator: public ConvergenceAccelerator<TSparseSpace, TDenseSpace>
57 {
58 public:
59 
62 
64 
66 
67  typedef typename BaseType::Pointer BaseTypePointer;
68 
69  typedef typename BaseType::VectorType VectorType;
71 
75 
84  {
85  Parameters default_settings(R"(
86  {
87  "solver_type": "constant_relaxation",
88  "w": 0.5,
89  "interface_block_newton" : false
90  }
91  )");
92 
93  return default_settings;
94  }
95 
102  : BaseType(),
103  mOmega([] (Parameters x) -> double {x.ValidateAndAssignDefaults(GetDefaultParameters()); return x["w"].GetDouble();} (rConvAcceleratorParameters))
104  {
105  }
106 
112  ConstantRelaxationConvergenceAccelerator(const double rOmega = 0.5)
113  : BaseType(),
114  mOmega(rOmega)
115  {
116  }
117 
124 
130 
134 
138 
148  void UpdateSolution(const VectorType &rResidualVector,
149  VectorType &rIterationGuess) override
150  {
151  KRATOS_TRY;
152 
153  TSparseSpace::UnaliasedAdd(rIterationGuess, mOmega, rResidualVector);
154 
155  KRATOS_CATCH("");
156  }
157 
161 
165 
169 
173 
175 private:
178 
182 
183  const double mOmega;
184 
188 
192 
196 
200 
204 
208 
210 }; /* Class ConstantRelaxationConvergenceAccelerator */
211 
215 
217 } /* namespace Kratos.*/
218 
219 #endif /* KRATOS_CONSTANT_RELAXATION_CONVERGENCE_ACCELERATOR defined */
Constant relaxation convergence accelerator This utility corrects the iteration guess with a constant...
Definition: constant_relaxation_convergence_accelerator.h:57
ConvergenceAccelerator< TSparseSpace, TDenseSpace > BaseType
Definition: constant_relaxation_convergence_accelerator.h:65
ConstantRelaxationConvergenceAccelerator(const ConstantRelaxationConvergenceAccelerator &rOther)=delete
Construct a new Constant Relaxation Convergence Accelerator object Explicitly deleted constant relaxa...
KRATOS_CLASS_POINTER_DEFINITION(ConstantRelaxationConvergenceAccelerator)
ConstantRelaxationConvergenceAccelerator(Parameters rConvAcceleratorParameters)
Construct a new Constant Relaxation Convergence Accelerator object Constructor with json string setti...
Definition: constant_relaxation_convergence_accelerator.h:101
BaseType::VectorPointerType VectorPointerType
Definition: constant_relaxation_convergence_accelerator.h:70
BaseType::VectorType VectorType
Definition: constant_relaxation_convergence_accelerator.h:69
virtual ~ConstantRelaxationConvergenceAccelerator()=default
Destroy the Constant Relaxation Convergence Accelerator object Default constant relaxation constructo...
BaseType::Pointer BaseTypePointer
Definition: constant_relaxation_convergence_accelerator.h:67
void UpdateSolution(const VectorType &rResidualVector, VectorType &rIterationGuess) override
Definition: constant_relaxation_convergence_accelerator.h:148
static Parameters GetDefaultParameters()
Get the Default Settings object This method returns the default parameters for this convergence accel...
Definition: constant_relaxation_convergence_accelerator.h:83
ConstantRelaxationConvergenceAccelerator(const double rOmega=0.5)
Construct a new Constant Relaxation Convergence Accelerator object Constructor with given relaxation ...
Definition: constant_relaxation_convergence_accelerator.h:112
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
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
TSparseSpace::VectorType VectorType
Definition: convergence_accelerator.h:50
TSparseSpace::VectorPointerType VectorPointerType
Definition: convergence_accelerator.h:53
void UnaliasedAdd(TSpaceType &dummy, typename TSpaceType::VectorType &x, const double A, const typename TSpaceType::VectorType &rY)
Definition: add_strategies_to_python.cpp:170
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
TABLE_NUMBER_ANGULAR_VELOCITY TABLE_NUMBER_MOMENT I33 BEAM_INERTIA_ROT_UNIT_LENGHT_Y KRATOS_DEFINE_APPLICATION_VARIABLE(DEM_APPLICATION, double, BEAM_INERTIA_ROT_UNIT_LENGHT_Z) typedef std double
Definition: DEM_application_variables.h:182
x
Definition: sensitivityMatrix.py:49
def ValidateAndAssignDefaults(defaults, settings, recursive=False)
Definition: sdof_solver.py:252