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.
bossak_step_rotation_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_BOSSAK_STEP_ROTATION_METHOD_H_INCLUDED)
11 #define KRATOS_BOSSAK_STEP_ROTATION_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 BossakStepRotationMethod : public NewmarkStepRotationMethod<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  BossakStepRotationMethod(const TVariableType& rVariable) : DerivedType(rVariable) {}
86  BossakStepRotationMethod(const TVariableType& rVariable, const TVariableType& rFirstDerivative, const TVariableType& rSecondDerivative) : DerivedType(rVariable,rFirstDerivative,rSecondDerivative) {}
87 
89  BossakStepRotationMethod(const TVariableType& rVariable, const TVariableType& rFirstDerivative, const TVariableType& rSecondDerivative, const TVariableType& rPrimaryVariable) : DerivedType(rVariable,rFirstDerivative,rSecondDerivative,rPrimaryVariable) {}
90 
93  :DerivedType(rOther)
94  ,mAlpha(rOther.mAlpha)
95  {
96  }
97 
100  {
101  return BasePointerType( new BossakStepRotationMethod(*this) );
102  }
103 
106 
110 
114 
115  //calculate parameters (to call it once with the original input parameters)
116  void CalculateParameters(ProcessInfo& rCurrentProcessInfo) override
117  {
118  KRATOS_TRY
119 
120  double beta = 0.25;
121  if (rCurrentProcessInfo.Has(NEWMARK_BETA))
122  {
123  beta = rCurrentProcessInfo[NEWMARK_BETA];
124  }
125  double gamma = 0.5;
126  if (rCurrentProcessInfo.Has(NEWMARK_GAMMA))
127  {
128  gamma = rCurrentProcessInfo[NEWMARK_GAMMA];
129  }
130 
131  mAlpha = -0.3;
132  if (rCurrentProcessInfo.Has(BOSSAK_ALPHA))
133  {
134  mAlpha = rCurrentProcessInfo[BOSSAK_ALPHA];
135  }
136 
137  if(mAlpha > 0.0 || mAlpha < -0.3)
138  {
139  KRATOS_ERROR << "Value not admissible for AlphaBossak. Admissible values should be between 0.0 and -0.3. Current value is " << mAlpha << std::endl;
140  }
141 
142  beta = (1.0 - mAlpha) * (1.0 - mAlpha) * beta;
143  gamma = gamma - mAlpha;
144 
145  rCurrentProcessInfo[NEWMARK_BETA] = beta;
146  rCurrentProcessInfo[NEWMARK_GAMMA] = gamma;
147  rCurrentProcessInfo[BOSSAK_ALPHA] = mAlpha;
148 
149  this->SetParameters(rCurrentProcessInfo);
150 
151  KRATOS_CATCH( "" )
152  }
153 
154  // set parameters (do not calculate parameters here, only read them)
155  void SetParameters(const ProcessInfo& rCurrentProcessInfo) override
156  {
157  KRATOS_TRY
158 
159  double delta_time = rCurrentProcessInfo[DELTA_TIME];
160 
161  if (delta_time < 1.0e-24)
162  {
163  KRATOS_ERROR << " ERROR: detected delta_time = 0 in the Solution Method DELTA_TIME. PLEASE : check if the time step is created correctly for the current model part " << std::endl;
164  }
165 
166  double beta = 0.25;
167  if (rCurrentProcessInfo.Has(NEWMARK_BETA))
168  {
169  beta = rCurrentProcessInfo[NEWMARK_BETA];
170  }
171  double gamma = 0.5;
172  if (rCurrentProcessInfo.Has(NEWMARK_GAMMA))
173  {
174  gamma = rCurrentProcessInfo[NEWMARK_GAMMA];
175  }
176 
177  mAlpha = -0.3;
178  if (rCurrentProcessInfo.Has(BOSSAK_ALPHA))
179  {
180  mAlpha = rCurrentProcessInfo[BOSSAK_ALPHA];
181  }
182 
183  if(mAlpha > 0.0 || mAlpha < -0.3)
184  {
185  KRATOS_ERROR << "Value not admissible for AlphaBossak. Admissible values should be between 0.0 and -0.3. Current value is " << mAlpha << std::endl;
186  }
187 
189 
190  KRATOS_CATCH( "" )
191  }
192 
193 
194  // set parameters to process info
195  void SetProcessInfoParameters(ProcessInfo& rCurrentProcessInfo) override
196  {
197  KRATOS_TRY
198 
199  rCurrentProcessInfo[NEWMARK_BETA] = this->mNewmark.beta;
200  rCurrentProcessInfo[NEWMARK_GAMMA] = this->mNewmark.gamma;
201  rCurrentProcessInfo[BOSSAK_ALPHA] = this->mAlpha;
202 
203  KRATOS_CATCH( "" )
204  }
205 
206 
210 
214 
218 
219 
221  std::string Info() const override
222  {
223  std::stringstream buffer;
224  buffer << "BossakStepRotationMethod";
225  return buffer.str();
226  }
227 
229  void PrintInfo(std::ostream& rOStream) const override
230  {
231  rOStream << "BossakStepRotationMethod";
232  }
233 
235  void PrintData(std::ostream& rOStream) const override
236  {
237  rOStream << "BossakStepRotationMethod Data";
238  }
239 
240 
244 
245 
247 
248  protected:
249 
252 
256 
257  double mAlpha;
258 
262 
266 
270 
271  double& GetSecondDerivativeKineticParameter(double& rParameter) override
272  {
273  rParameter = mAlpha;
274  return rParameter;
275  }
276 
277  double& GetSecondDerivativeInertialParameter(double& rParameter) override
278  {
279  rParameter = (1.0 - mAlpha) * this->mNewmark.c0;
280  return rParameter;
281  }
282 
286 
290 
292 
293  private:
294 
297 
301 
305 
309 
313 
317  friend class Serializer;
318 
319  void save(Serializer& rSerializer) const override
320  {
322  rSerializer.save("BossakAlpha", mAlpha);
323  };
324 
325  void load(Serializer& rSerializer) override
326  {
328  rSerializer.load("BossakAlpha", mAlpha);
329  };
330 
334 
338 
340 
341  }; // Class BossakStepRotationMethod
342 
344 
347 
348 
352 
353  template<class TVariableType, class TValueType>
354  inline std::istream & operator >> (std::istream & rIStream, BossakStepRotationMethod<TVariableType,TValueType>& rThis)
355  {
356  return rIStream;
357  }
358 
359  template<class TVariableType, class TValueType>
360  inline std::ostream & operator << (std::ostream & rOStream, const BossakStepRotationMethod<TVariableType,TValueType>& rThis)
361  {
362  return rOStream << rThis.Info();
363  }
364 
366 
368 
369 } // namespace Kratos.
370 
371 #endif // KRATOS_BOSSAK_STEP_ROTATION_METHOD_H_INCLUDED defined
Short class definition.
Definition: bossak_step_rotation_method.hpp:51
std::string Info() const override
Turn back information as a string.
Definition: bossak_step_rotation_method.hpp:221
BossakStepRotationMethod(const TVariableType &rVariable)
Constructor.
Definition: bossak_step_rotation_method.hpp:84
BasePointerType Clone() override
Clone.
Definition: bossak_step_rotation_method.hpp:99
void SetProcessInfoParameters(ProcessInfo &rCurrentProcessInfo) override
Definition: bossak_step_rotation_method.hpp:195
double mAlpha
Definition: bossak_step_rotation_method.hpp:257
double & GetSecondDerivativeInertialParameter(double &rParameter) override
Definition: bossak_step_rotation_method.hpp:277
BossakStepRotationMethod(BossakStepRotationMethod &rOther)
Copy Constructor.
Definition: bossak_step_rotation_method.hpp:92
void SetParameters(const ProcessInfo &rCurrentProcessInfo) override
Definition: bossak_step_rotation_method.hpp:155
void CalculateParameters(ProcessInfo &rCurrentProcessInfo) override
Definition: bossak_step_rotation_method.hpp:116
BossakStepRotationMethod()
Default Constructor.
Definition: bossak_step_rotation_method.hpp:81
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: bossak_step_rotation_method.hpp:229
BaseType::Pointer BasePointerType
BasePointerType.
Definition: bossak_step_rotation_method.hpp:61
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: bossak_step_rotation_method.hpp:235
NewmarkStepRotationMethod< TVariableType, TValueType > DerivedType
DerivedType.
Definition: bossak_step_rotation_method.hpp:70
TimeIntegrationMethod< TVariableType, TValueType > BaseType
BaseType.
Definition: bossak_step_rotation_method.hpp:58
BossakStepRotationMethod(const TVariableType &rVariable, const TVariableType &rFirstDerivative, const TVariableType &rSecondDerivative)
Constructor.
Definition: bossak_step_rotation_method.hpp:86
BossakStepRotationMethod(const TVariableType &rVariable, const TVariableType &rFirstDerivative, const TVariableType &rSecondDerivative, const TVariableType &rPrimaryVariable)
Constructor.
Definition: bossak_step_rotation_method.hpp:89
~BossakStepRotationMethod() override
Destructor.
Definition: bossak_step_rotation_method.hpp:105
KRATOS_CLASS_POINTER_DEFINITION(BossakStepRotationMethod)
BaseType::NodeType NodeType
NodeType.
Definition: bossak_step_rotation_method.hpp:64
BaseType::VariablePointer VariablePointer
KratosVariable or KratosVariableComponent.
Definition: bossak_step_rotation_method.hpp:67
double & GetSecondDerivativeKineticParameter(double &rParameter) override
Definition: bossak_step_rotation_method.hpp:271
bool Has(const Variable< TDataType > &rThisVariable) const
Checks if the data container has a value associated with a given variable.
Definition: data_value_container.h:382
NewmarkParameters mNewmark
Definition: newmark_method.hpp:320
Short class definition.
Definition: newmark_step_rotation_method.hpp:51
This class defines the node.
Definition: node.h:65
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
void load(std::string const &rTag, TDataType &rObject)
Definition: serializer.h:207
void save(std::string const &rTag, std::array< TDataType, TDataSize > const &rObject)
Definition: serializer.h:545
Short class definition.
Definition: time_integration_method.hpp:55
const TVariableType * VariablePointer
KratosVariable or KratosVariableComponent.
Definition: time_integration_method.hpp:65
#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
delta_time
Definition: generate_frictional_mortar_condition.py:130
float gamma
Definition: generate_two_fluid_navier_stokes.py:131
def load(f)
Definition: ode_solve.py:307
double beta
Definition: newmark_method.hpp:56
double gamma
Definition: newmark_method.hpp:57
double c0
Definition: newmark_method.hpp:62
void SetParameters(const double &rbeta, const double &rgamma, const double &rdelta_time)
Definition: newmark_method.hpp:69