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.
static_scheme.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: November 2017 $
6 // Revision: $Revision: 0.0 $
7 //
8 //
9 
10 #if !defined(KRATOS_STATIC_SCHEME_H_INCLUDED)
11 #define KRATOS_STATIC_SCHEME_H_INCLUDED
12 
13 // System includes
14 
15 // External includes
16 
17 // Project includes
19 
20 namespace Kratos
21 {
36 
39  template<class TSparseSpace, class TDenseSpace >
40  class StaticScheme: public SolutionScheme<TSparseSpace,TDenseSpace>
41  {
42  public:
43 
47 
50 
51  typedef typename BaseType::NodeType NodeType;
58 
62 
65 
69 
71  StaticScheme(IntegrationMethodsVectorType& rTimeVectorIntegrationMethods, Flags& rOptions)
72  :BaseType(rTimeVectorIntegrationMethods, rOptions)
73  {
74  }
75 
77  StaticScheme(IntegrationMethodsVectorType& rTimeVectorIntegrationMethods)
78  :BaseType(rTimeVectorIntegrationMethods)
79  {
80  }
81 
82 
84  StaticScheme(IntegrationMethodsScalarType& rTimeScalarIntegrationMethods, Flags& rOptions)
85  :BaseType(rTimeScalarIntegrationMethods, rOptions)
86  {
87  }
88 
90  StaticScheme(IntegrationMethodsScalarType& rTimeScalarIntegrationMethods)
91  :BaseType(rTimeScalarIntegrationMethods)
92  {
93  }
94 
96  StaticScheme(IntegrationMethodsVectorType& rTimeVectorIntegrationMethods,
97  IntegrationMethodsScalarType& rTimeScalarIntegrationMethods,
98  Flags& rOptions)
99  :BaseType(rTimeVectorIntegrationMethods, rTimeScalarIntegrationMethods, rOptions)
100  {
101  }
102 
104  StaticScheme(IntegrationMethodsVectorType& rTimeVectorIntegrationMethods,
105  IntegrationMethodsScalarType& rTimeScalarIntegrationMethods)
106  :BaseType(rTimeVectorIntegrationMethods, rTimeScalarIntegrationMethods)
107  {
108  }
109 
112  :BaseType(rOther)
113  {
114  }
115 
118  {
119  return BasePointerType( new StaticScheme(*this) );
120  }
121 
123  ~StaticScheme() override {}
124 
128 
132 
137  void Initialize(ModelPart& rModelPart) override
138  {
139  KRATOS_TRY
140 
141  BaseType::Initialize(rModelPart);
142 
143  KRATOS_CATCH("")
144  }
145 
153  void Update(ModelPart& rModelPart,
154  DofsArrayType& rDofSet,
155  SystemVectorType& rDx) override
156  {
157  KRATOS_TRY;
158 
159  this->UpdateDofs(rModelPart,rDofSet,rDx);
160  this->UpdateVariables(rModelPart);
161  this->MoveMesh(rModelPart);
162 
163  KRATOS_CATCH( "" );
164  }
165 
173  void Predict(ModelPart& rModelPart,
174  DofsArrayType& rDofSet,
175  SystemVectorType& rDx) override
176  {
177  KRATOS_TRY;
178 
179  this->PredictVariables(rModelPart);
180  this->MoveMesh(rModelPart);
181 
182  KRATOS_CATCH( "" );
183  }
184 
185 
194  int Check(ModelPart& rModelPart) override
195  {
196  KRATOS_TRY;
197 
198  // Perform base base checks
199  int ErrorCode = 0;
200  ErrorCode = BaseType::Check(rModelPart);
201 
202  // Check that all required variables have been registered
203 
204  // Check that variables are correctly allocated
205  // for(ModelPart::NodesContainerType::iterator it=rModelPart.NodesBegin(); it!=rModelPart.NodesEnd(); ++it)
206  // {
207  // // Nodal data
208  // KRATOS_CHECK_VARIABLE_IN_NODAL_DATA(DISPLACEMENT,(*it));
209 
210  // // Nodal dofs
211  // KRATOS_CHECK_DOF_IN_NODE(DISPLACEMENT_X,(*it));
212  // KRATOS_CHECK_DOF_IN_NODE(DISPLACEMENT_Y,(*it));
213  // if( rModelPart.GetProcessInfo()[SPACE_DIMENSION] == 3 )
214  // KRATOS_CHECK_DOF_IN_NODE(DISPLACEMENT_Z,(*it));
215  // }
216 
217  // Check for minimum value of the buffer index
218  if (rModelPart.GetBufferSize() < 2)
219  {
220  KRATOS_ERROR << "insufficient buffer size. Buffer size should be greater than 2. Current size is" << rModelPart.GetBufferSize() << std::endl;
221  }
222 
223  if ( this->mTimeVectorIntegrationMethods.size() == 0 && this->mTimeScalarIntegrationMethods.size() == 0 ) {
224  KRATOS_ERROR << "Time integration methods for Vector or Scalar variables NOT supplied" << std::endl;
225  }
226 
227  return ErrorCode;
228 
229  KRATOS_CATCH( "" );
230  }
231 
235 
239 
243 
245  std::string Info() const override
246  {
247  std::stringstream buffer;
248  buffer << "StaticScheme";
249  return buffer.str();
250  }
251 
253  void PrintInfo(std::ostream& rOStream) const override
254  {
255  rOStream << "StaticScheme";
256  }
257 
259  void PrintData(std::ostream& rOStream) const override
260  {
261  rOStream << "StaticScheme Data";
262  }
263 
267 
269 
270  protected:
271 
274 
278 
282 
286 
290 
294 
298 
300 
301  private:
302 
305 
309 
313 
317 
321 
325 
329 
333 
335  }; // Class StaticScheme
337 
340 
341 
345 
346 
348 
350 
351 } // namespace Kratos.
352 
353 #endif // KRATOS_STATIC_SCHEME_H_INCLUDED defined
std::vector< DofType::Pointer > DofsVectorType
Definition: element.h:100
Definition: flags.h:58
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
MeshType::ConditionsContainerType ConditionsContainerType
Condintions container. A vector set of Conditions with their Id's as key.
Definition: model_part.h:183
MeshType::ElementsContainerType ElementsContainerType
Element container. A vector set of Elements with their Id's as key.
Definition: model_part.h:168
IndexType GetBufferSize() const
This method gets the suffer size of the model part database.
Definition: model_part.h:1876
MeshType::NodesContainerType NodesContainerType
Nodes container. Which is a vector set of nodes with their Id's as key.
Definition: model_part.h:128
This class defines the node.
Definition: node.h:65
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
Solution scheme base class.
Definition: solution_scheme.hpp:54
virtual void UpdateDofs(ModelPart &rModelPart, DofsArrayType &rDofSet, SystemVectorType &rDx)
Performing the update of the solution Dofs.
Definition: solution_scheme.hpp:421
std::vector< IntegrationScalarPointerType > IntegrationMethodsScalarType
Definition: solution_scheme.hpp:83
virtual int Check(ModelPart &rModelPart)
This function is designed to be called once to perform all the checks needed.
Definition: solution_scheme.hpp:565
SolutionSchemeType::Pointer SolutionSchemePointerType
Definition: solution_scheme.hpp:60
virtual void MoveMesh(ModelPart &rModelPart)
This function is designed to move the mesh.
Definition: solution_scheme.hpp:499
TDenseSpace::MatrixType LocalSystemMatrixType
Definition: solution_scheme.hpp:66
virtual void Initialize(ModelPart &rModelPart)
Performs all the required operations that should be done (for each step) before solving the solution ...
Definition: solution_scheme.hpp:172
virtual void PredictVariables(ModelPart &rModelPart)
Performing the prediction of the solution variables.
Definition: solution_scheme.hpp:471
TDenseSpace::VectorType LocalSystemVectorType
Definition: solution_scheme.hpp:67
TSparseSpace::MatrixType SystemMatrixType
Definition: solution_scheme.hpp:64
IntegrationMethodsVectorType mTimeVectorIntegrationMethods
Definition: solution_scheme.hpp:800
TSparseSpace::VectorType SystemVectorType
Definition: solution_scheme.hpp:65
virtual void UpdateVariables(ModelPart &rModelPart)
Performing the update of the solution variables.
Definition: solution_scheme.hpp:441
std::vector< IntegrationVectorPointerType > IntegrationMethodsVectorType
Definition: solution_scheme.hpp:78
Static integration scheme (for static problems)
Definition: static_scheme.hpp:41
BaseType::SolutionSchemePointerType BasePointerType
Definition: static_scheme.hpp:49
BaseType::SystemMatrixType SystemMatrixType
Definition: static_scheme.hpp:54
void Initialize(ModelPart &rModelPart) override
Definition: static_scheme.hpp:137
ModelPart::NodesContainerType NodesContainerType
Definition: static_scheme.hpp:59
void Update(ModelPart &rModelPart, DofsArrayType &rDofSet, SystemVectorType &rDx) override
Definition: static_scheme.hpp:153
StaticScheme(IntegrationMethodsVectorType &rTimeVectorIntegrationMethods, IntegrationMethodsScalarType &rTimeScalarIntegrationMethods, Flags &rOptions)
Constructor.
Definition: static_scheme.hpp:96
BaseType::IntegrationMethodsScalarType IntegrationMethodsScalarType
Definition: static_scheme.hpp:64
BaseType::IntegrationMethodsVectorType IntegrationMethodsVectorType
Definition: static_scheme.hpp:63
BaseType::DofsArrayType DofsArrayType
Definition: static_scheme.hpp:52
Element::DofsVectorType DofsVectorType
Definition: static_scheme.hpp:53
StaticScheme(IntegrationMethodsScalarType &rTimeScalarIntegrationMethods)
Constructor.
Definition: static_scheme.hpp:90
StaticScheme(StaticScheme &rOther)
Copy Constructor.
Definition: static_scheme.hpp:111
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: static_scheme.hpp:259
BaseType::LocalSystemVectorType LocalSystemVectorType
Definition: static_scheme.hpp:56
StaticScheme(IntegrationMethodsVectorType &rTimeVectorIntegrationMethods)
Constructor.
Definition: static_scheme.hpp:77
StaticScheme(IntegrationMethodsScalarType &rTimeScalarIntegrationMethods, Flags &rOptions)
Constructor.
Definition: static_scheme.hpp:84
BaseType::LocalSystemMatrixType LocalSystemMatrixType
Definition: static_scheme.hpp:57
void Predict(ModelPart &rModelPart, DofsArrayType &rDofSet, SystemVectorType &rDx) override
Definition: static_scheme.hpp:173
ModelPart::ElementsContainerType ElementsContainerType
Definition: static_scheme.hpp:60
KRATOS_CLASS_POINTER_DEFINITION(StaticScheme)
StaticScheme(IntegrationMethodsVectorType &rTimeVectorIntegrationMethods, Flags &rOptions)
Constructor.
Definition: static_scheme.hpp:71
StaticScheme(IntegrationMethodsVectorType &rTimeVectorIntegrationMethods, IntegrationMethodsScalarType &rTimeScalarIntegrationMethods)
Constructor.
Definition: static_scheme.hpp:104
ModelPart::ConditionsContainerType ConditionsContainerType
Definition: static_scheme.hpp:61
BaseType::NodeType NodeType
Definition: static_scheme.hpp:51
BaseType::SystemVectorType SystemVectorType
Definition: static_scheme.hpp:55
std::string Info() const override
Turn back information as a string.
Definition: static_scheme.hpp:245
int Check(ModelPart &rModelPart) override
Definition: static_scheme.hpp:194
~StaticScheme() override
Destructor.
Definition: static_scheme.hpp:123
SolutionScheme< TSparseSpace, TDenseSpace > BaseType
Definition: static_scheme.hpp:48
BasePointerType Clone() override
Clone.
Definition: static_scheme.hpp:117
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: static_scheme.hpp:253
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_ERROR
Definition: exception.h:161
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21