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.
simo_method.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_SIMO_METHOD_H_INCLUDED)
11 #define KRATOS_SIMO_METHOD_H_INCLUDED
12 
13 // System includes
14 
15 // External includes
16 
17 // Project includes
19 
20 namespace Kratos
21 {
24 
27 
31 
35 
39 
43 
44 
46 
49  template<class TVariableType, class TValueType>
50  class SimoMethod : public BossakMethod<TVariableType,TValueType>
51  {
52  public:
53 
56 
59 
61  typedef typename BaseType::Pointer BasePointerType;
62 
64  typedef typename BaseType::NodeType NodeType;
65 
68 
71 
72 
74 
78 
79 
82 
84  SimoMethod(const TVariableType& rVariable) : DerivedType(rVariable) {}
85 
87  SimoMethod(const TVariableType& rVariable, const TVariableType& rFirstDerivative, const TVariableType& rSecondDerivative) : DerivedType(rVariable,rFirstDerivative,rSecondDerivative) {}
88 
90  SimoMethod(const TVariableType& rVariable, const TVariableType& rFirstDerivative, const TVariableType& rSecondDerivative, const TVariableType& rPrimaryVariable) : DerivedType(rVariable,rFirstDerivative,rSecondDerivative,rPrimaryVariable) {}
91 
93  SimoMethod(SimoMethod& rOther) : DerivedType(rOther) {}
94 
97  {
98  return BasePointerType( new SimoMethod(*this) );
99  }
100 
102  ~SimoMethod() override{}
103 
107 
111 
115 
119 
123 
124 
126  std::string Info() const override
127  {
128  std::stringstream buffer;
129  buffer << "SimoMethod";
130  return buffer.str();
131  }
132 
134  void PrintInfo(std::ostream& rOStream) const override
135  {
136  rOStream << "SimoMethod";
137  }
138 
140  void PrintData(std::ostream& rOStream) const override
141  {
142  rOStream << "SimoMethod Data";
143  }
144 
145 
149 
150 
152 
153  protected:
154 
157 
161 
162 
166 
170 
171  void AssignFromVariable(NodeType& rNode) override
172  {
173  KRATOS_TRY
174 
175 
176  KRATOS_CATCH( "" )
177  }
178 
179  void AssignFromFirstDerivative(NodeType& rNode) override
180  {
181  KRATOS_TRY
182 
183  // predict variable from first derivative
184  TValueType& CurrentVariable = rNode.FastGetSolutionStepValue(*this->mpVariable, 0);
185  const TValueType& PreviousVariable = rNode.FastGetSolutionStepValue(*this->mpVariable, 1);
186 
187  const TValueType& CurrentFirstDerivative = rNode.FastGetSolutionStepValue(*this->mpFirstDerivative, 0);
188 
189  CurrentVariable = PreviousVariable + CurrentFirstDerivative * (1.0/this->mNewmark.c1);
190 
191  KRATOS_CATCH( "" )
192  }
193 
194  void AssignFromSecondDerivative(NodeType& rNode) override
195  {
196  KRATOS_TRY
197 
198  // predict variable from second derivative
199  TValueType& CurrentVariable = rNode.FastGetSolutionStepValue(*this->mpVariable, 0);
200  const TValueType& PreviousVariable = rNode.FastGetSolutionStepValue(*this->mpVariable, 1);
201 
202  const TValueType& CurrentFirstDerivative = rNode.FastGetSolutionStepValue(*this->mpFirstDerivative, 0);
203 
204  const TValueType& CurrentSecondDerivative = rNode.FastGetSolutionStepValue(*this->mpSecondDerivative, 0);
205 
206 
207  CurrentVariable = PreviousVariable + CurrentFirstDerivative * (1.0/this->mNewmark.c1) + CurrentSecondDerivative * (1.0/this->mNewmark.c0);
208 
209 
210  KRATOS_CATCH( "" )
211  }
212 
213  void PredictVariable(NodeType& rNode) override
214  {
215  KRATOS_TRY
216 
217  KRATOS_CATCH( "" )
218  }
219 
220  void PredictFirstDerivative(NodeType& rNode) override
221  {
222  KRATOS_TRY
223 
224  const TValueType& CurrentVariable = rNode.FastGetSolutionStepValue(*this->mpVariable, 0);
225  TValueType& CurrentFirstDerivative = rNode.FastGetSolutionStepValue(*this->mpFirstDerivative, 0);
226 
227  const TValueType& PreviousVariable = rNode.FastGetSolutionStepValue(*this->mpVariable, 1);
228 
229  CurrentFirstDerivative = this->mNewmark.c1 * (CurrentVariable-PreviousVariable);
230 
231  KRATOS_CATCH( "" )
232  }
233 
234  void PredictSecondDerivative(NodeType& rNode) override
235  {
236  KRATOS_TRY
237 
238  TValueType& CurrentSecondDerivative = rNode.FastGetSolutionStepValue(*this->mpSecondDerivative, 0);
239 
240  const TValueType& CurrentFirstDerivative = rNode.FastGetSolutionStepValue(*this->mpFirstDerivative, 0);
241  const TValueType& PreviousFirstDerivative = rNode.FastGetSolutionStepValue(*this->mpFirstDerivative, 1);
242 
243 
244  CurrentSecondDerivative = (this->mNewmark.c0/this->mNewmark.c1) * (CurrentFirstDerivative-PreviousFirstDerivative);
245 
246 
247  KRATOS_CATCH( "" )
248  }
249 
250  void UpdateFromFirstDerivative(NodeType& rNode) override
251  {
252  KRATOS_TRY
253 
254  KRATOS_ERROR << " Calling UpdateFromFirstDerivative for Simo time integration method : NOT IMPLEMENTED " <<std::endl;
255 
256  KRATOS_CATCH( "" )
257  }
258 
259  void UpdateVariable(NodeType& rNode) override
260  {
261  KRATOS_TRY
262 
263 
264  KRATOS_CATCH( "" )
265  }
266 
267  void UpdateFirstDerivative(NodeType& rNode) override
268  {
269  KRATOS_TRY
270 
271  const TValueType& CurrentVariable = rNode.FastGetSolutionStepValue(*this->mpVariable, 0);
272  TValueType& CurrentFirstDerivative = rNode.FastGetSolutionStepValue(*this->mpFirstDerivative, 0);
273 
274  const TValueType& PreviousVariable = rNode.FastGetSolutionStepValue(*this->mpVariable, 1);
275 
276  CurrentFirstDerivative = this->mNewmark.c1 * (CurrentVariable-PreviousVariable);
277 
278  KRATOS_CATCH( "" )
279  }
280 
281  void UpdateSecondDerivative(NodeType& rNode) override
282  {
283  KRATOS_TRY
284 
285 
286  const TValueType& CurrentFirstDerivative = rNode.FastGetSolutionStepValue(*this->mpFirstDerivative, 0);
287 
288  const TValueType& PreviousFirstDerivative = rNode.FastGetSolutionStepValue(*this->mpFirstDerivative, 1);
289 
290  TValueType& CurrentSecondDerivative = rNode.FastGetSolutionStepValue(*this->mpSecondDerivative, 0);
291 
292  CurrentSecondDerivative = (this->mNewmark.c0/this->mNewmark.c1) * (CurrentFirstDerivative-PreviousFirstDerivative);
293 
294 
295  KRATOS_CATCH( "" )
296  }
297 
298 
299 
303 
307 
311 
313 
314  private:
315 
318 
322 
326 
330 
334 
338  friend class Serializer;
339 
340  void save(Serializer& rSerializer) const override
341  {
343  };
344 
345  void load(Serializer& rSerializer) override
346  {
348  };
349 
353 
357 
359 
360  }; // Class SimoMethod
361 
363 
366 
367 
371 
372  template<class TVariableType, class TValueType>
373  inline std::istream & operator >> (std::istream & rIStream, SimoMethod<TVariableType,TValueType>& rThis)
374  {
375  return rIStream;
376  }
377 
378  template<class TVariableType, class TValueType>
379  inline std::ostream & operator << (std::ostream & rOStream, const SimoMethod<TVariableType,TValueType>& rThis)
380  {
381  return rOStream << rThis.Info();
382  }
383 
385 
387 
388 } // namespace Kratos.
389 
390 #endif // KRATOS_SIMO_METHOD_H_INCLUDED defined
Short class definition.
Definition: bossak_method.hpp:51
BaseType::Pointer BasePointerType
BasePointerType.
Definition: bossak_method.hpp:64
Short class definition.
Definition: newmark_method.hpp:51
NewmarkParameters mNewmark
Definition: newmark_method.hpp:320
This class defines the node.
Definition: node.h:65
TVariableType::Type & FastGetSolutionStepValue(const TVariableType &rThisVariable)
Definition: node.h:435
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
Short class definition.
Definition: simo_method.hpp:51
SimoMethod(const TVariableType &rVariable, const TVariableType &rFirstDerivative, const TVariableType &rSecondDerivative, const TVariableType &rPrimaryVariable)
Constructor.
Definition: simo_method.hpp:90
std::string Info() const override
Turn back information as a string.
Definition: simo_method.hpp:126
void UpdateFromFirstDerivative(NodeType &rNode) override
Definition: simo_method.hpp:250
BasePointerType Clone() override
Clone.
Definition: simo_method.hpp:96
SimoMethod(const TVariableType &rVariable, const TVariableType &rFirstDerivative, const TVariableType &rSecondDerivative)
Constructor.
Definition: simo_method.hpp:87
void UpdateVariable(NodeType &rNode) override
Definition: simo_method.hpp:259
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: simo_method.hpp:134
TimeIntegrationMethod< TVariableType, TValueType > BaseType
BaseType.
Definition: simo_method.hpp:58
BaseType::NodeType NodeType
NodeType.
Definition: simo_method.hpp:64
void AssignFromFirstDerivative(NodeType &rNode) override
Definition: simo_method.hpp:179
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: simo_method.hpp:140
BaseType::Pointer BasePointerType
BasePointerType.
Definition: simo_method.hpp:61
KRATOS_CLASS_POINTER_DEFINITION(SimoMethod)
void AssignFromVariable(NodeType &rNode) override
Definition: simo_method.hpp:171
SimoMethod()
Default Constructor.
Definition: simo_method.hpp:81
BaseType::VariablePointer VariablePointer
KratosVariable or KratosVariableComponent.
Definition: simo_method.hpp:67
void PredictFirstDerivative(NodeType &rNode) override
Definition: simo_method.hpp:220
BossakMethod< TVariableType, TValueType > DerivedType
DerivedType.
Definition: simo_method.hpp:70
void PredictVariable(NodeType &rNode) override
Definition: simo_method.hpp:213
void UpdateFirstDerivative(NodeType &rNode) override
Definition: simo_method.hpp:267
void AssignFromSecondDerivative(NodeType &rNode) override
Definition: simo_method.hpp:194
SimoMethod(const TVariableType &rVariable)
Constructor.
Definition: simo_method.hpp:84
void UpdateSecondDerivative(NodeType &rNode) override
Definition: simo_method.hpp:281
void PredictSecondDerivative(NodeType &rNode) override
Definition: simo_method.hpp:234
~SimoMethod() override
Destructor.
Definition: simo_method.hpp:102
SimoMethod(SimoMethod &rOther)
Copy Constructor.
Definition: simo_method.hpp:93
Short class definition.
Definition: time_integration_method.hpp:55
VariablePointer mpVariable
Definition: time_integration_method.hpp:405
const TVariableType * VariablePointer
KratosVariable or KratosVariableComponent.
Definition: time_integration_method.hpp:65
VariablePointer mpFirstDerivative
Definition: time_integration_method.hpp:407
VariablePointer mpSecondDerivative
Definition: time_integration_method.hpp:409
#define KRATOS_SERIALIZE_SAVE_BASE_CLASS(Serializer, BaseType)
Definition: define.h:812
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_SERIALIZE_LOAD_BASE_CLASS(Serializer, BaseType)
Definition: define.h:815
#define KRATOS_ERROR
Definition: exception.h:161
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
def load(f)
Definition: ode_solve.py:307
double c1
Definition: newmark_method.hpp:63
double c0
Definition: newmark_method.hpp:62