10 #if !defined(KRATOS_NEWMARK_METHOD_H_INCLUDED)
11 #define KRATOS_NEWMARK_METHOD_H_INCLUDED
49 template<
class TVariableType,
class TValueType>
71 const double& rdelta_time)
81 c3 = ( 0.5 / (beta) - 1.0 );
82 c4 = ( (
gamma / beta) - 1.0 );
93 rSerializer.
save(
"beta", beta);
96 rSerializer.
save(
"c0", c0);
97 rSerializer.
save(
"c1", c1);
98 rSerializer.
save(
"c2", c2);
99 rSerializer.
save(
"c3", c3);
100 rSerializer.
save(
"c4", c4);
101 rSerializer.
save(
"c5", c5);
106 rSerializer.
load(
"beta", beta);
109 rSerializer.
load(
"c0", c0);
110 rSerializer.
load(
"c1", c1);
111 rSerializer.
load(
"c2", c2);
112 rSerializer.
load(
"c3", c3);
113 rSerializer.
load(
"c4", c4);
114 rSerializer.
load(
"c5", c5);
150 NewmarkMethod(
const TVariableType& rVariable,
const TVariableType& rFirstDerivative,
const TVariableType& rSecondDerivative) :
BaseType(rVariable,rFirstDerivative,rSecondDerivative) {}
153 NewmarkMethod(
const TVariableType& rVariable,
const TVariableType& rFirstDerivative,
const TVariableType& rSecondDerivative,
const TVariableType& rPrimaryVariable) :
BaseType(rVariable,rFirstDerivative,rSecondDerivative,rPrimaryVariable) {}
158 ,mNewmark(rOther.mNewmark)
185 if (rCurrentProcessInfo.
Has(NEWMARK_BETA))
187 beta = rCurrentProcessInfo[NEWMARK_BETA];
191 if (rCurrentProcessInfo.
Has(NEWMARK_GAMMA))
193 gamma = rCurrentProcessInfo[NEWMARK_GAMMA];
196 rCurrentProcessInfo[NEWMARK_BETA] = beta;
197 rCurrentProcessInfo[NEWMARK_GAMMA] =
gamma;
199 this->SetParameters(rCurrentProcessInfo);
209 double delta_time = rCurrentProcessInfo[DELTA_TIME];
213 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;
217 if (rCurrentProcessInfo.
Has(NEWMARK_BETA))
219 beta = rCurrentProcessInfo[NEWMARK_BETA];
222 if (rCurrentProcessInfo.
Has(NEWMARK_GAMMA))
224 gamma = rCurrentProcessInfo[NEWMARK_GAMMA];
237 rCurrentProcessInfo[NEWMARK_BETA] = mNewmark.beta;
238 rCurrentProcessInfo[NEWMARK_GAMMA] = mNewmark.gamma;
254 ErrorCode = BaseType::Check(rCurrentProcessInfo);
257 if( this->mpFirstDerivative ==
nullptr ){
258 KRATOS_ERROR <<
" time integration method FirstDerivative not set " <<std::endl;
261 if( this->mpSecondDerivative ==
nullptr ){
262 KRATOS_ERROR <<
" time integration method SecondDerivative not set " <<std::endl;
284 std::string
Info()
const override
286 std::stringstream buffer;
287 buffer <<
"NewmarkMethod";
294 rOStream <<
"NewmarkMethod";
300 rOStream <<
"NewmarkMethod Data";
334 CurrentFirstDerivative -= CurrentFirstDerivative;
335 CurrentSecondDerivative -= CurrentSecondDerivative;
354 CurrentVariable = PreviousVariable + this->mNewmark.
delta_time * ( ( 1.0 - (this->mNewmark.
beta/this->mNewmark.
gamma) ) * PreviousFirstDerivative + (this->mNewmark.
beta/this->mNewmark.
gamma) * CurrentFirstDerivative + this->mNewmark.
delta_time * 0.5 * ( 1.0 - 2.0 * (this->mNewmark.beta/this->mNewmark.gamma) ) * PreviousSecondDerivative );
361 CurrentVariable -= this->mNewmark.
delta_time * PreviousFirstDerivative;
364 CurrentSecondDerivative -= CurrentSecondDerivative;
384 CurrentVariable = PreviousVariable + this->mNewmark.
delta_time * PreviousFirstDerivative + this->mNewmark.
delta_time * this->mNewmark.
delta_time * ( 0.5 * ( 1.0 - 2.0 * this->mNewmark.
beta ) * PreviousSecondDerivative + this->mNewmark.
beta * CurrentSecondDerivative );
387 CurrentVariable -= this->mNewmark.
delta_time * PreviousFirstDerivative + 0.5 * this->mNewmark.
delta_time * this->mNewmark.
delta_time * PreviousSecondDerivative;
399 this->PredictVariable(rNode);
400 this->PredictFirstDerivative(rNode);
401 this->PredictSecondDerivative(rNode);
413 this->PredictSecondDerivative(rNode);
414 this->PredictVariable(rNode);
428 CurrentVariable += this->mNewmark.
delta_time * CurrentFirstDerivative + 0.5 * this->mNewmark.
delta_time * this->mNewmark.
delta_time * CurrentSecondDerivative;
445 CurrentFirstDerivative = this->mNewmark.
c1 * (CurrentVariable-PreviousVariable) - this->mNewmark.
c4 * PreviousFirstDerivative - this->mNewmark.c5 * PreviousSecondDerivative;
463 CurrentSecondDerivative = ( 1.0 / (this->mNewmark.
gamma * this->mNewmark.
delta_time) ) * ( CurrentFirstDerivative - PreviousFirstDerivative - ( 1.0 - this->mNewmark.
gamma ) * this->mNewmark.
delta_time * PreviousSecondDerivative );
473 this->UpdateVariable(rNode);
474 this->UpdateFirstDerivative(rNode);
475 this->UpdateSecondDerivative(rNode);
492 CurrentSecondDerivative = (this->mNewmark.
c0/this->mNewmark.
c1) * (CurrentFirstDerivative + this->mNewmark.
c4 * PreviousFirstDerivative + this->mNewmark.c5 * PreviousSecondDerivative) - this->mNewmark.
c2 * PreviousFirstDerivative - this->mNewmark.
c3 * PreviousSecondDerivative;
494 CurrentVariable = PreviousVariable + (1.0/this->mNewmark.
c1) * (CurrentFirstDerivative + this->mNewmark.
c4 * PreviousFirstDerivative + this->mNewmark.c5 * PreviousSecondDerivative);
504 KRATOS_ERROR <<
" Calling UpdateFromSecondDerivative for Newmark time integration method : NOT IMPLEMENTED " <<std::endl;
528 CurrentFirstDerivative = (this->mNewmark.
c1 * (CurrentVariable-PreviousVariable) - this->mNewmark.
c4 * PreviousFirstDerivative - this->mNewmark.c5 * PreviousSecondDerivative);
544 CurrentSecondDerivative = (this->mNewmark.
c0 * (CurrentVariable-PreviousVariable) - this->mNewmark.
c2 * PreviousFirstDerivative - this->mNewmark.c3 * PreviousSecondDerivative);
560 rParameter = mNewmark.
c1;
566 rParameter = mNewmark.
c0;
606 void save(
Serializer& rSerializer)
const override
609 rSerializer.
save(
"NewmarkParameters", mNewmark);
615 rSerializer.
load(
"NewmarkParameters", mNewmark);
640 template<
class TVariableType,
class TValueType>
646 template<
class TVariableType,
class TValueType>
649 return rOStream << rThis.
Info();
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
Short class definition.
Definition: newmark_method.hpp:51
NewmarkMethod(NewmarkMethod &rOther)
Copy Constructor.
Definition: newmark_method.hpp:156
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: newmark_method.hpp:292
void UpdateFromSecondDerivative(NodeType &rNode) override
Definition: newmark_method.hpp:500
BaseType::Pointer BasePointerType
BasePointerType.
Definition: newmark_method.hpp:128
void UpdateVariable(NodeType &rNode) override
Definition: newmark_method.hpp:509
NewmarkMethod(const TVariableType &rVariable)
Constructor.
Definition: newmark_method.hpp:147
void PredictVariable(NodeType &rNode) override
Definition: newmark_method.hpp:419
BasePointerType Clone() override
Clone.
Definition: newmark_method.hpp:163
KRATOS_CLASS_POINTER_DEFINITION(NewmarkMethod)
TimeIntegrationMethod< TVariableType, TValueType > BaseType
BaseType.
Definition: newmark_method.hpp:125
double & GetFirstDerivativeInertialParameter(double &rParameter) override
Definition: newmark_method.hpp:558
void UpdateFromFirstDerivative(NodeType &rNode) override
Definition: newmark_method.hpp:480
BaseType::NodeType NodeType
NodeType.
Definition: newmark_method.hpp:131
int Check(const ProcessInfo &rCurrentProcessInfo) override
This function is designed to be called once to perform all the checks needed.
Definition: newmark_method.hpp:248
void SetProcessInfoParameters(ProcessInfo &rCurrentProcessInfo) override
Definition: newmark_method.hpp:233
void UpdateFirstDerivative(NodeType &rNode) override
Definition: newmark_method.hpp:517
NewmarkMethod(const TVariableType &rVariable, const TVariableType &rFirstDerivative, const TVariableType &rSecondDerivative, const TVariableType &rPrimaryVariable)
Constructor.
Definition: newmark_method.hpp:153
void PredictFromFirstDerivative(NodeType &rNode) override
Definition: newmark_method.hpp:407
void AssignFromVariable(NodeType &rNode) override
Definition: newmark_method.hpp:326
void PredictFromVariable(NodeType &rNode) override
Definition: newmark_method.hpp:394
void PredictSecondDerivative(NodeType &rNode) override
Definition: newmark_method.hpp:454
void UpdateSecondDerivative(NodeType &rNode) override
Definition: newmark_method.hpp:533
NewmarkParameters mNewmark
Definition: newmark_method.hpp:320
void AssignFromSecondDerivative(NodeType &rNode) override
Definition: newmark_method.hpp:371
void CalculateParameters(ProcessInfo &rCurrentProcessInfo) override
Definition: newmark_method.hpp:180
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: newmark_method.hpp:298
void SetParameters(const ProcessInfo &rCurrentProcessInfo) override
Definition: newmark_method.hpp:205
NewmarkMethod()
Default Constructor.
Definition: newmark_method.hpp:144
~NewmarkMethod() override
Destructor.
Definition: newmark_method.hpp:169
double & GetSecondDerivativeInertialParameter(double &rParameter) override
Definition: newmark_method.hpp:564
void PredictFirstDerivative(NodeType &rNode) override
Definition: newmark_method.hpp:433
void UpdateFromVariable(NodeType &rNode) override
Definition: newmark_method.hpp:469
void AssignFromFirstDerivative(NodeType &rNode) override
Definition: newmark_method.hpp:341
std::string Info() const override
Turn back information as a string.
Definition: newmark_method.hpp:284
BaseType::VariablePointer VariablePointer
KratosVariable or KratosVariableComponent.
Definition: newmark_method.hpp:134
NewmarkMethod(const TVariableType &rVariable, const TVariableType &rFirstDerivative, const TVariableType &rSecondDerivative)
Constructor.
Definition: newmark_method.hpp:150
This class defines the node.
Definition: node.h:65
TVariableType::Type & FastGetSolutionStepValue(const TVariableType &rThisVariable)
Definition: node.h:435
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
Definition: newmark_method.hpp:55
double c5
Definition: newmark_method.hpp:67
double c4
Definition: newmark_method.hpp:66
double c1
Definition: newmark_method.hpp:63
double delta_time
Definition: newmark_method.hpp:59
double beta
Definition: newmark_method.hpp:56
double gamma
Definition: newmark_method.hpp:57
double c3
Definition: newmark_method.hpp:65
double c0
Definition: newmark_method.hpp:62
void SetParameters(const double &rbeta, const double &rgamma, const double &rdelta_time)
Definition: newmark_method.hpp:69
double c2
Definition: newmark_method.hpp:64