14 #if !defined(KRATOS_PORO_NEWMARK_QUASISTATIC_U_PW_SCHEME )
15 #define KRATOS_PORO_NEWMARK_QUASISTATIC_U_PW_SCHEME
29 template<
class TSparseSpace,
class TDenseSpace>
68 if(DELTA_TIME.Key() == 0)
69 KRATOS_THROW_ERROR( std::invalid_argument,
"DELTA_TIME Key is 0. Check if all applications were correctly registered.",
"")
70 if(DISPLACEMENT.Key() == 0)
71 KRATOS_THROW_ERROR( std::invalid_argument,
"DISPLACEMENT Key is 0. Check if all applications were correctly registered.",
"" )
72 if(VELOCITY.Key() == 0)
73 KRATOS_THROW_ERROR( std::invalid_argument,
"VELOCITY Key is 0. Check if all applications were correctly registered.",
"" )
74 if(WATER_PRESSURE.Key() == 0)
75 KRATOS_THROW_ERROR( std::invalid_argument,
"WATER_PRESSURE Key is 0. Check if all applications were correctly registered.",
"" )
76 if(DT_WATER_PRESSURE.Key() == 0)
77 KRATOS_THROW_ERROR( std::invalid_argument,
"DT_WATER_PRESSURE Key is 0. Check if all applications were correctly registered.",
"" )
78 if ( VELOCITY_COEFFICIENT.Key() == 0 )
79 KRATOS_THROW_ERROR( std::invalid_argument,
"VELOCITY_COEFFICIENT Key is 0. Check if all applications were correctly registered.",
"" )
80 if ( DT_PRESSURE_COEFFICIENT.Key() == 0 )
81 KRATOS_THROW_ERROR( std::invalid_argument,
"DT_PRESSURE_COEFFICIENT Key is 0. Check if all applications were correctly registered.",
"" )
84 for(ModelPart::NodesContainerType::iterator it=r_model_part.
NodesBegin(); it!=r_model_part.
NodesEnd(); it++)
86 if(it->SolutionStepsDataHas(DISPLACEMENT) ==
false)
87 KRATOS_THROW_ERROR( std::logic_error,
"DISPLACEMENT variable is not allocated for node ", it->Id() )
88 if(it->SolutionStepsDataHas(VELOCITY) ==
false)
89 KRATOS_THROW_ERROR( std::logic_error,
"VELOCITY variable is not allocated for node ", it->Id() )
90 if(it->SolutionStepsDataHas(WATER_PRESSURE) ==
false)
91 KRATOS_THROW_ERROR( std::logic_error,
"WATER_PRESSURE variable is not allocated for node ", it->Id() )
92 if(it->SolutionStepsDataHas(DT_WATER_PRESSURE) ==
false)
93 KRATOS_THROW_ERROR( std::logic_error,
"DT_WATER_PRESSURE variable is not allocated for node ", it->Id() )
95 if(it->HasDofFor(DISPLACEMENT_X) ==
false)
96 KRATOS_THROW_ERROR( std::invalid_argument,
"missing DISPLACEMENT_X dof on node ",it->Id() )
97 if(it->HasDofFor(DISPLACEMENT_Y) ==
false)
98 KRATOS_THROW_ERROR( std::invalid_argument,
"missing DISPLACEMENT_Y dof on node ",it->Id() )
99 if(it->HasDofFor(DISPLACEMENT_Z) ==
false)
100 KRATOS_THROW_ERROR( std::invalid_argument,
"missing DISPLACEMENT_Z dof on node ",it->Id() )
101 if(it->HasDofFor(WATER_PRESSURE) ==
false)
102 KRATOS_THROW_ERROR( std::invalid_argument,
"missing WATER_PRESSURE dof on node ",it->Id() )
107 KRATOS_THROW_ERROR( std::logic_error,
"insufficient buffer size. Buffer size should be greater than 2. Current size is", r_model_part.
GetBufferSize() )
129 const int NNodes =
static_cast<int>(r_model_part.
Nodes().size());
130 ModelPart::NodesContainerType::iterator node_begin = r_model_part.
NodesBegin();
133 #pragma omp parallel for
134 for(
int i = 0;
i < NNodes;
i++)
136 ModelPart::NodesContainerType::iterator itNode = node_begin +
i;
138 Matrix& rInitialStress = itNode->FastGetSolutionStepValue(INITIAL_STRESS_TENSOR);
139 if(rInitialStress.size1() != 3)
140 rInitialStress.
resize(3,3,
false);
157 int NElems =
static_cast<int>(rModelPart.
Elements().size());
158 ModelPart::ElementsContainerType::iterator el_begin = rModelPart.
ElementsBegin();
161 for(
int i = 0;
i < NElems;
i++)
163 ModelPart::ElementsContainerType::iterator itElem = el_begin +
i;
184 int NElems =
static_cast<int>(r_model_part.
Elements().size());
185 ModelPart::ElementsContainerType::iterator el_begin = r_model_part.
ElementsBegin();
187 #pragma omp parallel for
188 for(
int i = 0;
i < NElems;
i++)
190 ModelPart::ElementsContainerType::iterator itElem = el_begin +
i;
194 int NCons =
static_cast<int>(r_model_part.
Conditions().size());
195 ModelPart::ConditionsContainerType::iterator con_begin = r_model_part.
ConditionsBegin();
197 #pragma omp parallel for
198 for(
int i = 0;
i < NCons;
i++)
200 ModelPart::ConditionsContainerType::iterator itCond = con_begin +
i;
231 int NElems =
static_cast<int>(r_model_part.
Elements().size());
232 ModelPart::ElementsContainerType::iterator el_begin = r_model_part.
ElementsBegin();
234 #pragma omp parallel for
235 for(
int i = 0;
i < NElems;
i++)
237 ModelPart::ElementsContainerType::iterator itElem = el_begin +
i;
238 itElem -> InitializeNonLinearIteration(CurrentProcessInfo);
241 int NCons =
static_cast<int>(r_model_part.
Conditions().size());
242 ModelPart::ConditionsContainerType::iterator con_begin = r_model_part.
ConditionsBegin();
244 #pragma omp parallel for
245 for(
int i = 0;
i < NCons;
i++)
247 ModelPart::ConditionsContainerType::iterator itCond = con_begin +
i;
248 itCond -> InitializeNonLinearIteration(CurrentProcessInfo);
266 int NElems =
static_cast<int>(r_model_part.
Elements().size());
267 ModelPart::ElementsContainerType::iterator el_begin = r_model_part.
ElementsBegin();
269 #pragma omp parallel for
270 for(
int i = 0;
i < NElems;
i++)
272 ModelPart::ElementsContainerType::iterator itElem = el_begin +
i;
273 itElem -> FinalizeNonLinearIteration(CurrentProcessInfo);
276 int NCons =
static_cast<int>(r_model_part.
Conditions().size());
277 ModelPart::ConditionsContainerType::iterator con_begin = r_model_part.
ConditionsBegin();
279 #pragma omp parallel for
280 for(
int i = 0;
i < NCons;
i++)
282 ModelPart::ConditionsContainerType::iterator itCond = con_begin +
i;
283 itCond -> FinalizeNonLinearIteration(CurrentProcessInfo);
301 const int NNodes =
static_cast<int>(rModelPart.
Nodes().size());
302 ModelPart::NodesContainerType::iterator node_begin = rModelPart.
NodesBegin();
305 #pragma omp parallel for
306 for(
int i = 0;
i < NNodes;
i++)
308 ModelPart::NodesContainerType::iterator itNode = node_begin +
i;
310 itNode->FastGetSolutionStepValue(NODAL_AREA) = 0.0;
311 Matrix& rNodalStress = itNode->FastGetSolutionStepValue(NODAL_EFFECTIVE_STRESS_TENSOR);
312 if(rNodalStress.size1() != 3)
313 rNodalStress.
resize(3,3,
false);
315 array_1d<double,3>& r_nodal_grad_pressure = itNode->FastGetSolutionStepValue(NODAL_WATER_PRESSURE_GRADIENT);
317 itNode->FastGetSolutionStepValue(NODAL_DAMAGE_VARIABLE) = 0.0;
318 itNode->FastGetSolutionStepValue(NODAL_JOINT_AREA) = 0.0;
319 itNode->FastGetSolutionStepValue(NODAL_JOINT_WIDTH) = 0.0;
320 itNode->FastGetSolutionStepValue(NODAL_JOINT_DAMAGE) = 0.0;
326 #pragma omp parallel for
327 for(
int n = 0;
n < NNodes;
n++)
329 ModelPart::NodesContainerType::iterator itNode = node_begin +
n;
331 const double& NodalArea = itNode->FastGetSolutionStepValue(NODAL_AREA);
332 if (NodalArea>1.0e-20)
334 const double InvNodalArea = 1.0/NodalArea;
335 Matrix& rNodalStress = itNode->FastGetSolutionStepValue(NODAL_EFFECTIVE_STRESS_TENSOR);
336 array_1d<double,3>& r_nodal_grad_pressure = itNode->FastGetSolutionStepValue(NODAL_WATER_PRESSURE_GRADIENT);
337 for(
unsigned int i = 0;
i<3;
i++)
339 r_nodal_grad_pressure[
i] *= InvNodalArea;
340 for(
unsigned int j = 0;
j<3;
j++)
342 rNodalStress(
i,
j) *= InvNodalArea;
345 double& NodalDamage = itNode->FastGetSolutionStepValue(NODAL_DAMAGE_VARIABLE);
346 NodalDamage *= InvNodalArea;
349 const double& NodalJointArea = itNode->FastGetSolutionStepValue(NODAL_JOINT_AREA);
350 if (NodalJointArea>1.0e-20)
352 const double InvNodalJointArea = 1.0/NodalJointArea;
353 double& NodalJointWidth = itNode->FastGetSolutionStepValue(NODAL_JOINT_WIDTH);
354 NodalJointWidth *= InvNodalJointArea;
355 double& NodalJointDamage = itNode->FastGetSolutionStepValue(NODAL_JOINT_DAMAGE);
356 NodalJointDamage *= InvNodalJointArea;
539 double DeltaPressure;
541 const int NNodes =
static_cast<int>(r_model_part.
Nodes().size());
542 ModelPart::NodesContainerType::iterator node_begin = r_model_part.
NodesBegin();
544 #pragma omp parallel for private(DeltaDisplacement,DeltaPressure)
545 for(
int i = 0;
i < NNodes;
i++)
547 ModelPart::NodesContainerType::iterator itNode = node_begin +
i;
550 noalias(DeltaDisplacement) = itNode->FastGetSolutionStepValue(DISPLACEMENT) - itNode->FastGetSolutionStepValue(DISPLACEMENT, 1);
551 const array_1d<double,3>& PreviousVelocity = itNode->FastGetSolutionStepValue(VELOCITY, 1);
557 double& CurrentDtPressure = itNode->FastGetSolutionStepValue(DT_WATER_PRESSURE);
558 DeltaPressure = itNode->FastGetSolutionStepValue(WATER_PRESSURE) - itNode->FastGetSolutionStepValue(WATER_PRESSURE, 1);
559 const double& PreviousDtPressure = itNode->FastGetSolutionStepValue(DT_WATER_PRESSURE, 1);
Base class for all Conditions.
Definition: condition.h:59
virtual void CalculateLeftHandSide(MatrixType &rLeftHandSideMatrix, const ProcessInfo &rCurrentProcessInfo)
Definition: condition.h:426
virtual void EquationIdVector(EquationIdVectorType &rResult, const ProcessInfo &rCurrentProcessInfo) const
Definition: condition.h:260
virtual void CalculateRightHandSide(VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo)
Definition: condition.h:440
virtual void CalculateLocalSystem(MatrixType &rLeftHandSideMatrix, VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo)
Definition: condition.h:408
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 CalculateLeftHandSide(MatrixType &rLeftHandSideMatrix, const ProcessInfo &rCurrentProcessInfo)
Definition: element.h:423
virtual void CalculateRightHandSide(VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo)
Definition: element.h:437
virtual void EquationIdVector(EquationIdVectorType &rResult, const ProcessInfo &rCurrentProcessInfo) const
Definition: element.h:258
virtual void CalculateLocalSystem(MatrixType &rLeftHandSideMatrix, VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo)
Definition: element.h:405
std::vector< std::size_t > EquationIdVectorType
Definition: element.h:98
void resize(std::size_t NewSize1, std::size_t NewSize2, bool preserve=0)
Definition: amatrix_interface.h:224
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
ElementIterator ElementsBegin(IndexType ThisIndex=0)
Definition: model_part.h:1169
ConditionIterator ConditionsBegin(IndexType ThisIndex=0)
Definition: model_part.h:1361
IndexType GetBufferSize() const
This method gets the suffer size of the model part database.
Definition: model_part.h:1876
NodeIterator NodesBegin(IndexType ThisIndex=0)
Definition: model_part.h:487
ConditionsContainerType & Conditions(IndexType ThisIndex=0)
Definition: model_part.h:1381
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
ElementsContainerType & Elements(IndexType ThisIndex=0)
Definition: model_part.h:1189
NodeIterator NodesEnd(IndexType ThisIndex=0)
Definition: model_part.h:497
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
static void DivideInPartitions(const int NumTerms, const int NumThreads, PartitionVector &Partitions)
Divide an array of length NumTerms between NumThreads threads.
Definition: openmp_utils.h:158
static int ThisThread()
Wrapper for omp_get_thread_num().
Definition: openmp_utils.h:108
std::vector< int > PartitionVector
Vector type for the output of DivideInPartitions method.
Definition: openmp_utils.h:53
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
boost::indirect_iterator< typename TContainerType::iterator > iterator
Definition: pointer_vector_set.h:95
size_type size() const
Returns the number of elements in the container.
Definition: pointer_vector_set.h:502
iterator begin()
Returns an iterator pointing to the beginning of the container.
Definition: pointer_vector_set.h:278
Definition: poro_newmark_quasistatic_U_Pw_scheme.hpp:32
void Update(ModelPart &r_model_part, DofsArrayType &rDofSet, TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b) override
Performing the update of the solution.
Definition: poro_newmark_quasistatic_U_Pw_scheme.hpp:486
void InitializeSolutionStep(ModelPart &r_model_part, TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b) override
Function called once at the beginning of each solution step.
Definition: poro_newmark_quasistatic_U_Pw_scheme.hpp:174
virtual void UpdateVariablesDerivatives(ModelPart &r_model_part)
Definition: poro_newmark_quasistatic_U_Pw_scheme.hpp:532
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_quasistatic_U_Pw_scheme.hpp:372
void InitializeElements(ModelPart &rModelPart) override
This is the place to initialize the elements.
Definition: poro_newmark_quasistatic_U_Pw_scheme.hpp:151
double mGamma
Definition: poro_newmark_quasistatic_U_Pw_scheme.hpp:526
BaseType::DofsArrayType DofsArrayType
Definition: poro_newmark_quasistatic_U_Pw_scheme.hpp:39
void CalculateLHSContribution(Condition &rCurrentCondition, LocalSystemMatrixType &LHS_Contribution, Element::EquationIdVectorType &EquationId, const ProcessInfo &CurrentProcessInfo) override
Functions totally analogous to the precedent but applied to the "condition" objects.
Definition: poro_newmark_quasistatic_U_Pw_scheme.hpp:469
void CalculateSystemContributions(Condition &rCurrentCondition, LocalSystemMatrixType &LHS_Contribution, LocalSystemVectorType &RHS_Contribution, Element::EquationIdVectorType &EquationId, const ProcessInfo &CurrentProcessInfo) override
Functions totally analogous to the precedent but applied to the "condition" objects.
Definition: poro_newmark_quasistatic_U_Pw_scheme.hpp:392
void InitializeNonLinIteration(ModelPart &r_model_part, TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b) override
unction to be called when it is needed to initialize an iteration. It is designed to be called at the...
Definition: poro_newmark_quasistatic_U_Pw_scheme.hpp:221
double mBeta
Member Variables.
Definition: poro_newmark_quasistatic_U_Pw_scheme.hpp:525
void FinalizeNonLinIteration(ModelPart &r_model_part, TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b) override
Function to be called when it is needed to finalize an iteration. It is designed to be called at the ...
Definition: poro_newmark_quasistatic_U_Pw_scheme.hpp:256
KRATOS_CLASS_POINTER_DEFINITION(PoroNewmarkQuasistaticUPwScheme)
void Predict(ModelPart &r_model_part, DofsArrayType &rDofSet, TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b) override
Performing the prediction of the solution.
Definition: poro_newmark_quasistatic_U_Pw_scheme.hpp:209
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_quasistatic_U_Pw_scheme.hpp:450
BaseType::TSystemVectorType TSystemVectorType
Definition: poro_newmark_quasistatic_U_Pw_scheme.hpp:41
int Check(ModelPart &r_model_part) override
Definition: poro_newmark_quasistatic_U_Pw_scheme.hpp:63
BaseType::LocalSystemVectorType LocalSystemVectorType
Definition: poro_newmark_quasistatic_U_Pw_scheme.hpp:42
double mTheta
Definition: poro_newmark_quasistatic_U_Pw_scheme.hpp:527
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_quasistatic_U_Pw_scheme.hpp:412
Scheme< TSparseSpace, TDenseSpace > BaseType
Definition: poro_newmark_quasistatic_U_Pw_scheme.hpp:38
double mDeltaTime
Definition: poro_newmark_quasistatic_U_Pw_scheme.hpp:528
BaseType::TSystemMatrixType TSystemMatrixType
Definition: poro_newmark_quasistatic_U_Pw_scheme.hpp:40
~PoroNewmarkQuasistaticUPwScheme() override
Destructor.
Definition: poro_newmark_quasistatic_U_Pw_scheme.hpp:59
void CalculateRHSContribution(Condition &rCurrentCondition, LocalSystemVectorType &RHS_Contribution, Element::EquationIdVectorType &EquationId, const ProcessInfo &CurrentProcessInfo) override
Functions totally analogous to the precedent but applied to the "condition" objects.
Definition: poro_newmark_quasistatic_U_Pw_scheme.hpp:431
PoroNewmarkQuasistaticUPwScheme(double beta, double gamma, double theta)
Constructor.
Definition: poro_newmark_quasistatic_U_Pw_scheme.hpp:48
BaseType::LocalSystemMatrixType LocalSystemMatrixType
Definition: poro_newmark_quasistatic_U_Pw_scheme.hpp:43
void FinalizeSolutionStep(ModelPart &rModelPart, TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b) override
Function called once at the end of a solution step, after convergence is reached if an iterative proc...
Definition: poro_newmark_quasistatic_U_Pw_scheme.hpp:291
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
virtual void FinalizeSolutionStep(ModelPart &rModelPart, TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b)
Function called once at the end of a solution step, after convergence is reached if an iterative proc...
Definition: scheme.h:294
typename TDenseSpace::MatrixType LocalSystemMatrixType
Local system matrix type definition.
Definition: scheme.h:77
void SetElementsAreInitialized(bool ElementsAreInitializedFlag=true)
This method sets if the elements have been initialized or not (true by default)
Definition: scheme.h:206
bool mSchemeIsInitialized
Definition: scheme.h:755
#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
Parameters GetValue(Parameters &rParameters, const std::string &rEntry)
Definition: add_kratos_parameters_to_python.cpp:53
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
KratosZeroMatrix< double > ZeroMatrix
Definition: amatrix_interface.h:559
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
b
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:31
float gamma
Definition: generate_two_fluid_navier_stokes.py:131
int n
manufactured solution and derivatives (u=0 at z=0 dudz=0 at z=domain_height)
Definition: ode_solve.py:402
int k
Definition: quadrature.py:595
int j
Definition: quadrature.py:648
A
Definition: sensitivityMatrix.py:70
integer i
Definition: TensorModule.f:17