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.
implicit_solving_strategy.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: Riccardo Rossi
11 //
12 //
13 
14 #pragma once
15 
16 /* System includes */
17 
18 /* External includes */
19 
20 /* Project includes */
21 #include "includes/define.h"
22 #include "includes/model_part.h"
23 #include "solving_strategy.h"
27 
28 namespace Kratos
29 {
30 
33 
34 
38 
42 
43 
47 
51 
59 template<class TSparseSpace, class TDenseSpace, class TLinearSolver>
60 class ImplicitSolvingStrategy : public SolvingStrategy<TSparseSpace, TDenseSpace>
61 {
62 public:
65 
67 
68  typedef typename BaseType::TDataType TDataType;
69 
71 
73 
75 
77 
79 
81 
83 
85 
87 
88  typedef typename BaseType::TDofType TDofType;
89 
91 
93 
95 
97 
100 
104 
108  explicit ImplicitSolvingStrategy() { }
109 
116  ModelPart& rModelPart,
117  Parameters ThisParameters)
118  : BaseType(rModelPart, ThisParameters)
119  {
120  // Validate and assign defaults
121  ThisParameters = this->ValidateAndAssignParameters(ThisParameters, this->GetDefaultParameters());
122  this->AssignSettings(ThisParameters);
123  }
124 
131  ModelPart& rModelPart,
132  bool MoveMeshFlag = false)
133  : BaseType(rModelPart, MoveMeshFlag)
134  {
135  }
136 
140 
144 
148 
154  typename BaseType::Pointer Create(
155  ModelPart& rModelPart,
156  Parameters ThisParameters) const override
157  {
158  return Kratos::make_shared<ClassType>(rModelPart, ThisParameters);
159  }
160 
164 
170  {
171  Parameters default_parameters = Parameters(R"(
172  {
173  "name" : "implicit_solving_strategy",
174  "build_level" : 2
175  })");
176 
177  // Getting base class default parameters
178  const Parameters base_default_parameters = BaseType::GetDefaultParameters();
179  default_parameters.RecursivelyAddMissingParameters(base_default_parameters);
180 
181  return default_parameters;
182  }
183 
188  static std::string Name()
189  {
190  return "implicit_solving_strategy";
191  }
192 
196 
207  void SetRebuildLevel(int Level) override
208  {
209  mRebuildLevel = Level;
210  mStiffnessMatrixIsBuilt = false;
211  }
212 
223  int GetRebuildLevel() const override
224  {
225  return mRebuildLevel;
226  }
227 
232  void SetStiffnessMatrixIsBuilt(const bool StiffnessMatrixIsBuilt)
233  {
234  mStiffnessMatrixIsBuilt = StiffnessMatrixIsBuilt;
235  }
236 
242  {
244  }
245 
249 
251  std::string Info() const override
252  {
253  return "ImplicitSolvingStrategy";
254  }
255 
257 
258 protected:
261 
262  // Settings for the rebuilding of the stiffness matrix
265 
269 
273 
274 
278 
283  void AssignSettings(const Parameters ThisParameters) override
284  {
285  // Add base strategy settings
286  BaseType::AssignSettings(ThisParameters);
287 
288  // By default the matrices are rebuilt at each iteration
289  mRebuildLevel = ThisParameters["build_level"].GetInt();
290  }
291 
295 
296 
300 
301 
305 
306 private:
307 
311 
312 
316 
317 
321 
322 
326 
327 
331 
332 
336 
337 
341 
345 
347 
348 }; /* Class ImplicitSolvingStrategy */
349 
351 
354 
355 
357 
358 } /* namespace Kratos.*/
Current class provides an implementation for the base builder and solving operations.
Definition: builder_and_solver.h:64
Dof represents a degree of freedom (DoF).
Definition: dof.h:86
Implicit solving strategy base class This is the base class from which we will derive all the implici...
Definition: implicit_solving_strategy.h:61
BaseType::TSystemVectorType TSystemVectorType
Definition: implicit_solving_strategy.h:72
virtual ~ImplicitSolvingStrategy()
Definition: implicit_solving_strategy.h:139
Scheme< TSparseSpace, TDenseSpace > TSchemeType
Definition: implicit_solving_strategy.h:82
void SetRebuildLevel(int Level) override
This sets the build level.
Definition: implicit_solving_strategy.h:207
BaseType::NodesArrayType NodesArrayType
Definition: implicit_solving_strategy.h:92
void AssignSettings(const Parameters ThisParameters) override
This method assigns settings to member variables.
Definition: implicit_solving_strategy.h:283
int mRebuildLevel
Definition: implicit_solving_strategy.h:263
BaseType::DofsArrayType DofsArrayType
Definition: implicit_solving_strategy.h:90
bool mStiffnessMatrixIsBuilt
The current rebuild level.
Definition: implicit_solving_strategy.h:264
BaseType::TSystemVectorPointerType TSystemVectorPointerType
Definition: implicit_solving_strategy.h:76
BuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver > TBuilderAndSolverType
Definition: implicit_solving_strategy.h:84
void SetStiffnessMatrixIsBuilt(const bool StiffnessMatrixIsBuilt)
This method sets the flag mStiffnessMatrixIsBuilt.
Definition: implicit_solving_strategy.h:232
BaseType::TSystemMatrixPointerType TSystemMatrixPointerType
Definition: implicit_solving_strategy.h:74
KRATOS_CLASS_POINTER_DEFINITION(ImplicitSolvingStrategy)
BaseType::LocalSystemVectorType LocalSystemVectorType
Definition: implicit_solving_strategy.h:80
SolvingStrategy< TSparseSpace, TDenseSpace > BaseType
Definition: implicit_solving_strategy.h:66
ImplicitSolvingStrategy()
Default constructor.
Definition: implicit_solving_strategy.h:108
ImplicitSolvingStrategy(ModelPart &rModelPart, bool MoveMeshFlag=false)
Default constructor.
Definition: implicit_solving_strategy.h:130
BaseType::ConditionsArrayType ConditionsArrayType
Definition: implicit_solving_strategy.h:96
int GetRebuildLevel() const override
This returns the build level.
Definition: implicit_solving_strategy.h:223
BaseType::TSystemMatrixType TSystemMatrixType
Definition: implicit_solving_strategy.h:70
BaseType::LocalSystemMatrixType LocalSystemMatrixType
Definition: implicit_solving_strategy.h:78
ImplicitSolvingStrategy< TSparseSpace, TDenseSpace, TLinearSolver > ClassType
Definition: implicit_solving_strategy.h:86
ImplicitSolvingStrategy(ModelPart &rModelPart, Parameters ThisParameters)
Default constructor. (with parameters)
Definition: implicit_solving_strategy.h:115
Parameters GetDefaultParameters() const override
This method provides the defaults parameters to avoid conflicts between the different constructors.
Definition: implicit_solving_strategy.h:169
std::string Info() const override
Turn back information as a string.
Definition: implicit_solving_strategy.h:251
static std::string Name()
Returns the name of the class as used in the settings (snake_case format)
Definition: implicit_solving_strategy.h:188
BaseType::TDofType TDofType
Definition: implicit_solving_strategy.h:88
BaseType::Pointer Create(ModelPart &rModelPart, Parameters ThisParameters) const override
Create method.
Definition: implicit_solving_strategy.h:154
BaseType::TDataType TDataType
Definition: implicit_solving_strategy.h:68
BaseType::ElementsArrayType ElementsArrayType
Definition: implicit_solving_strategy.h:94
bool GetStiffnessMatrixIsBuilt() const
This method gets the flag mStiffnessMatrixIsBuilt.
Definition: implicit_solving_strategy.h:241
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
int GetInt() const
This method returns the integer contained in the current Parameter.
Definition: kratos_parameters.cpp:666
void RecursivelyAddMissingParameters(const Parameters &rDefaultParameters)
This function is designed to verify that the parameters under testing contain at least all parameters...
Definition: kratos_parameters.cpp:1457
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
This class provides the implementation of the basic tasks that are needed by the solution strategy.
Definition: scheme.h:56
Solving strategy base class This is the base class from which we will derive all the strategies (impl...
Definition: solving_strategy.h:64
TSparseSpace::VectorPointerType TSystemVectorPointerType
Definition: solving_strategy.h:77
TDenseSpace::MatrixType LocalSystemMatrixType
Definition: solving_strategy.h:79
ModelPart::NodesContainerType NodesArrayType
Definition: solving_strategy.h:89
TSparseSpace::DataType TDataType
Definition: solving_strategy.h:69
ModelPart::ElementsContainerType ElementsArrayType
Definition: solving_strategy.h:91
virtual Parameters ValidateAndAssignParameters(Parameters ThisParameters, const Parameters DefaultParameters) const
This method validate and assign default parameters.
Definition: solving_strategy.h:507
TSparseSpace::MatrixType TSystemMatrixType
Definition: solving_strategy.h:71
TSparseSpace::MatrixPointerType TSystemMatrixPointerType
Definition: solving_strategy.h:75
virtual void AssignSettings(const Parameters ThisParameters)
This method assigns settings to member variables.
Definition: solving_strategy.h:519
bool MoveMeshFlag()
This function returns the flag that says if the mesh is moved.
Definition: solving_strategy.h:290
TSparseSpace::VectorType TSystemVectorType
Definition: solving_strategy.h:73
virtual Parameters GetDefaultParameters() const
This method provides the defaults parameters to avoid conflicts between the different constructors.
Definition: solving_strategy.h:397
TDenseSpace::VectorType LocalSystemVectorType
Definition: solving_strategy.h:81
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21