8 #if !defined(KRATOS_PORO_NEWMARK_DYNAMIC_U_PW_SCHEME )
9 #define KRATOS_PORO_NEWMARK_DYNAMIC_U_PW_SCHEME
18 template<
class TSparseSpace,
class TDenseSpace>
69 if(ierr != 0)
return ierr;
72 if(ACCELERATION.Key() == 0)
73 KRATOS_THROW_ERROR( std::invalid_argument,
"ACCELERATION Key is 0. Check if all applications were correctly registered.",
"" )
76 for(ModelPart::NodesContainerType::iterator it=r_model_part.
NodesBegin(); it!=r_model_part.
NodesEnd(); it++)
78 if(it->SolutionStepsDataHas(ACCELERATION) ==
false)
79 KRATOS_THROW_ERROR( std::logic_error,
"ACCELERATION variable is not allocated for node ", it->Id() )
84 KRATOS_THROW_ERROR( std::invalid_argument,
"Some of the scheme variables: beta or gamma has an invalid value ",
"" )
117 double DeltaPressure;
119 const int NNodes =
static_cast<int>(r_model_part.
Nodes().size());
120 ModelPart::NodesContainerType::iterator node_begin = r_model_part.
NodesBegin();
122 #pragma omp parallel for private(DeltaDisplacement,DeltaPressure)
123 for(
int i = 0;
i < NNodes;
i++)
125 ModelPart::NodesContainerType::iterator itNode = node_begin +
i;
127 array_1d<double,3>& CurrentDisplacement = itNode->FastGetSolutionStepValue(DISPLACEMENT);
128 array_1d<double,3>& CurrentAcceleration = itNode->FastGetSolutionStepValue(ACCELERATION);
131 const array_1d<double,3>& PreviousDisplacement = itNode->FastGetSolutionStepValue(DISPLACEMENT, 1);
132 const array_1d<double,3>& PreviousAcceleration = itNode->FastGetSolutionStepValue(ACCELERATION, 1);
133 const array_1d<double,3>& PreviousVelocity = itNode->FastGetSolutionStepValue(VELOCITY, 1);
135 if (itNode -> IsFixed(ACCELERATION_X))
137 CurrentDisplacement[0] = PreviousDisplacement[0] +
mDeltaTime * PreviousVelocity[0] + std::pow(
mDeltaTime, 2) * ( ( 0.5 -
mBeta) * PreviousAcceleration[0] +
mBeta * CurrentAcceleration[0] );
139 else if (itNode -> IsFixed(VELOCITY_X))
141 CurrentDisplacement[0] = PreviousDisplacement[0] +
mDeltaTime*(
mBeta/
mGamma*(CurrentVelocity[0]-PreviousVelocity[0])+PreviousVelocity[0]);
143 else if (itNode -> IsFixed(DISPLACEMENT_X) ==
false)
145 CurrentDisplacement[0] = PreviousDisplacement[0] +
mDeltaTime * PreviousVelocity[0] + 0.5 * std::pow(
mDeltaTime, 2) * PreviousAcceleration[0];
148 if (itNode -> IsFixed(ACCELERATION_Y))
150 CurrentDisplacement[1] = PreviousDisplacement[1] +
mDeltaTime * PreviousVelocity[1] + std::pow(
mDeltaTime, 2) * ( ( 0.5 -
mBeta) * PreviousAcceleration[1] +
mBeta * CurrentAcceleration[1] );
152 else if (itNode -> IsFixed(VELOCITY_Y))
154 CurrentDisplacement[1] = PreviousDisplacement[1] +
mDeltaTime*(
mBeta/
mGamma*(CurrentVelocity[1]-PreviousVelocity[1])+PreviousVelocity[1]);
156 else if (itNode -> IsFixed(DISPLACEMENT_Y) ==
false)
158 CurrentDisplacement[1] = PreviousDisplacement[1] +
mDeltaTime * PreviousVelocity[1] + 0.5 * std::pow(
mDeltaTime, 2) * PreviousAcceleration[1];
162 if (itNode -> HasDofFor(DISPLACEMENT_Z))
164 if (itNode -> IsFixed(ACCELERATION_Z))
166 CurrentDisplacement[2] = PreviousDisplacement[2] +
mDeltaTime * PreviousVelocity[2] + std::pow(
mDeltaTime, 2) * ( ( 0.5 -
mBeta) * PreviousAcceleration[2] +
mBeta * CurrentAcceleration[2] );
168 else if (itNode -> IsFixed(VELOCITY_Z))
170 CurrentDisplacement[2] = PreviousDisplacement[2] +
mDeltaTime*(
mBeta/
mGamma*(CurrentVelocity[2]-PreviousVelocity[2])+PreviousVelocity[2]);
172 else if (itNode -> IsFixed(DISPLACEMENT_Z) ==
false)
174 CurrentDisplacement[2] = PreviousDisplacement[2] +
mDeltaTime * PreviousVelocity[2] + 0.5 * std::pow(
mDeltaTime, 2) * PreviousAcceleration[2];
178 noalias(DeltaDisplacement) = CurrentDisplacement - PreviousDisplacement;
183 double& CurrentDtPressure = itNode->FastGetSolutionStepValue(DT_WATER_PRESSURE);
184 DeltaPressure = itNode->FastGetSolutionStepValue(WATER_PRESSURE) - itNode->FastGetSolutionStepValue(WATER_PRESSURE, 1);
185 const double& PreviousDtPressure = itNode->FastGetSolutionStepValue(DT_WATER_PRESSURE, 1);
295 double DeltaPressure;
297 const int NNodes =
static_cast<int>(r_model_part.
Nodes().size());
298 ModelPart::NodesContainerType::iterator node_begin = r_model_part.
NodesBegin();
300 #pragma omp parallel for private(DeltaDisplacement,DeltaPressure)
301 for(
int i = 0;
i < NNodes;
i++)
303 ModelPart::NodesContainerType::iterator itNode = node_begin +
i;
305 array_1d<double,3>& CurrentAcceleration = itNode->FastGetSolutionStepValue(ACCELERATION);
307 noalias(DeltaDisplacement) = itNode->FastGetSolutionStepValue(DISPLACEMENT) - itNode->FastGetSolutionStepValue(DISPLACEMENT, 1);
308 const array_1d<double,3>& PreviousAcceleration = itNode->FastGetSolutionStepValue(ACCELERATION, 1);
309 const array_1d<double,3>& PreviousVelocity = itNode->FastGetSolutionStepValue(VELOCITY, 1);
314 double& CurrentDtPressure = itNode->FastGetSolutionStepValue(DT_WATER_PRESSURE);
315 DeltaPressure = itNode->FastGetSolutionStepValue(WATER_PRESSURE) - itNode->FastGetSolutionStepValue(WATER_PRESSURE, 1);
316 const double& PreviousDtPressure = itNode->FastGetSolutionStepValue(DT_WATER_PRESSURE, 1);
void SetValue(const Variable< TDataType > &rThisVariable, TDataType const &rValue)
Sets the value for a given variable.
Definition: data_value_container.h:320
Base class for all Elements.
Definition: element.h:60
virtual void GetFirstDerivativesVector(Vector &values, int Step=0) const
Definition: element.h:310
virtual void CalculateLeftHandSide(MatrixType &rLeftHandSideMatrix, const ProcessInfo &rCurrentProcessInfo)
Definition: element.h:423
virtual void CalculateMassMatrix(MatrixType &rMassMatrix, const ProcessInfo &rCurrentProcessInfo)
Definition: element.h:570
virtual void CalculateRightHandSide(VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo)
Definition: element.h:437
virtual void CalculateDampingMatrix(MatrixType &rDampingMatrix, const ProcessInfo &rCurrentProcessInfo)
Definition: element.h:583
virtual void EquationIdVector(EquationIdVectorType &rResult, const ProcessInfo &rCurrentProcessInfo) const
Definition: element.h:258
virtual void GetSecondDerivativesVector(Vector &values, int Step=0) const
Definition: element.h:320
virtual void CalculateLocalSystem(MatrixType &rLeftHandSideMatrix, VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo)
Definition: element.h:405
std::vector< std::size_t > EquationIdVectorType
Definition: element.h:98
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
NodeIterator NodesBegin(IndexType ThisIndex=0)
Definition: model_part.h:487
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
NodeIterator NodesEnd(IndexType ThisIndex=0)
Definition: model_part.h:497
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
static int ThisThread()
Wrapper for omp_get_thread_num().
Definition: openmp_utils.h:108
static int GetNumThreads()
Returns the current number of threads.
Definition: parallel_utilities.cpp:34
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
Definition: poro_newmark_dynamic_U_Pw_scheme.hpp:21
void Initialize(ModelPart &r_model_part) override
This is the place to initialize the Scheme.
Definition: poro_newmark_dynamic_U_Pw_scheme.hpp:93
void AddDynamicsToRHS(Element &rCurrentElement, LocalSystemVectorType &RHS_Contribution, LocalSystemMatrixType &M, LocalSystemMatrixType &C, const ProcessInfo &CurrentProcessInfo)
Definition: poro_newmark_dynamic_U_Pw_scheme.hpp:339
void CalculateSystemContributions(Element &rCurrentElement, LocalSystemMatrixType &LHS_Contribution, LocalSystemVectorType &RHS_Contribution, Element::EquationIdVectorType &EquationId, const ProcessInfo &CurrentProcessInfo) override
This function is designed to be called in the builder and solver to introduce the selected time integ...
Definition: poro_newmark_dynamic_U_Pw_scheme.hpp:195
BaseType::TSystemVectorType TSystemVectorType
Definition: poro_newmark_dynamic_U_Pw_scheme.hpp:30
KRATOS_CLASS_POINTER_DEFINITION(PoroNewmarkDynamicUPwScheme)
int Check(ModelPart &r_model_part) override
Definition: poro_newmark_dynamic_U_Pw_scheme.hpp:63
BaseType::TSystemMatrixType TSystemMatrixType
Definition: poro_newmark_dynamic_U_Pw_scheme.hpp:29
Scheme< TSparseSpace, TDenseSpace > BaseType
Definition: poro_newmark_dynamic_U_Pw_scheme.hpp:27
void UpdateVariablesDerivatives(ModelPart &r_model_part) override
Definition: poro_newmark_dynamic_U_Pw_scheme.hpp:288
PoroNewmarkDynamicUPwScheme(double beta, double gamma, double theta)
Constructor.
Definition: poro_newmark_dynamic_U_Pw_scheme.hpp:41
void CalculateLHSContribution(Element &rCurrentElement, LocalSystemMatrixType &LHS_Contribution, Element::EquationIdVectorType &EquationId, const ProcessInfo &CurrentProcessInfo) override
This function is designed to calculate just the LHS contribution.
Definition: poro_newmark_dynamic_U_Pw_scheme.hpp:252
void Predict(ModelPart &r_model_part, DofsArrayType &rDofSet, TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b) override
Performing the prediction of the solution.
Definition: poro_newmark_dynamic_U_Pw_scheme.hpp:107
std::vector< Matrix > mMassMatrix
Member Variables.
Definition: poro_newmark_dynamic_U_Pw_scheme.hpp:281
std::vector< Vector > mVelocityVector
Definition: poro_newmark_dynamic_U_Pw_scheme.hpp:284
std::vector< Vector > mAccelerationVector
Definition: poro_newmark_dynamic_U_Pw_scheme.hpp:282
BaseType::LocalSystemMatrixType LocalSystemMatrixType
Definition: poro_newmark_dynamic_U_Pw_scheme.hpp:32
void AddDynamicsToLHS(LocalSystemMatrixType &LHS_Contribution, LocalSystemMatrixType &M, LocalSystemMatrixType &C, const ProcessInfo &CurrentProcessInfo)
Definition: poro_newmark_dynamic_U_Pw_scheme.hpp:326
~PoroNewmarkDynamicUPwScheme() override
Destructor.
Definition: poro_newmark_dynamic_U_Pw_scheme.hpp:59
BaseType::LocalSystemVectorType LocalSystemVectorType
Definition: poro_newmark_dynamic_U_Pw_scheme.hpp:31
BaseType::DofsArrayType DofsArrayType
Definition: poro_newmark_dynamic_U_Pw_scheme.hpp:28
std::vector< Matrix > mDampingMatrix
Definition: poro_newmark_dynamic_U_Pw_scheme.hpp:283
void CalculateRHSContribution(Element &rCurrentElement, LocalSystemVectorType &RHS_Contribution, Element::EquationIdVectorType &EquationId, const ProcessInfo &CurrentProcessInfo) override
This function is designed to calculate just the RHS contribution.
Definition: poro_newmark_dynamic_U_Pw_scheme.hpp:225
Definition: poro_newmark_quasistatic_U_Pw_scheme.hpp:32
double mGamma
Definition: poro_newmark_quasistatic_U_Pw_scheme.hpp:526
double mBeta
Member Variables.
Definition: poro_newmark_quasistatic_U_Pw_scheme.hpp:525
int Check(ModelPart &r_model_part) override
Definition: poro_newmark_quasistatic_U_Pw_scheme.hpp:63
double mTheta
Definition: poro_newmark_quasistatic_U_Pw_scheme.hpp:527
double mDeltaTime
Definition: poro_newmark_quasistatic_U_Pw_scheme.hpp:528
void Initialize(ModelPart &r_model_part) override
This is the place to initialize the Scheme.
Definition: poro_newmark_quasistatic_U_Pw_scheme.hpp:120
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
This class provides the implementation of the basic tasks that are needed by the solution strategy.
Definition: scheme.h:56
typename TSparseSpace::MatrixType TSystemMatrixType
Matrix type definition.
Definition: scheme.h:71
virtual void EquationId(const Element &rElement, Element::EquationIdVectorType &rEquationId, const ProcessInfo &rCurrentProcessInfo)
This method gets the eqaution id corresponding to the current element.
Definition: scheme.h:636
typename TSparseSpace::VectorType TSystemVectorType
Vector type definition.
Definition: scheme.h:74
typename TDenseSpace::VectorType LocalSystemVectorType
Local system vector type definition.
Definition: scheme.h:80
typename TDenseSpace::MatrixType LocalSystemMatrixType
Local system matrix type definition.
Definition: scheme.h:77
#define KRATOS_THROW_ERROR(ExceptionType, ErrorMessage, MoreInfo)
Definition: define.h:77
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
AMatrix::MatrixProductExpression< TExpression1Type, TExpression2Type > prod(AMatrix::MatrixExpression< TExpression1Type, TCategory1 > const &First, AMatrix::MatrixExpression< TExpression2Type, TCategory2 > const &Second)
Definition: amatrix_interface.h:568
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
int C
Definition: generate_hyper_elastic_simo_taylor_neo_hookean.py:27
b
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:31
float gamma
Definition: generate_two_fluid_navier_stokes.py:131
A
Definition: sensitivityMatrix.py:70
integer i
Definition: TensorModule.f:17