8 #if !defined(KRATOS_DAM_P_SCHEME )
9 #define KRATOS_DAM_P_SCHEME
25 template<
class TSparseSpace,
class TDenseSpace>
63 if(PRESSURE.Key() == 0)
64 KRATOS_THROW_ERROR( std::invalid_argument,
"PRESSURE has Key zero! (check if the application is correctly registered",
"" )
65 if(Dt_PRESSURE.Key() == 0)
66 KRATOS_THROW_ERROR( std::invalid_argument,
"Dt_PRESSURE has Key zero! (check if the application is correctly registered",
"" )
67 if(Dt2_PRESSURE.Key() == 0)
68 KRATOS_THROW_ERROR( std::invalid_argument,
"Dt2_PRESSURE has Key zero! (check if the application is correctly registered",
"" )
69 if ( VELOCITY_PRESSURE_COEFFICIENT.Key() == 0 )
70 KRATOS_THROW_ERROR( std::invalid_argument,
"VELOCITY_PRESSURE_COEFFICIENT has Key zero! (check if the application is correctly registered",
"" )
71 if ( ACCELERATION_PRESSURE_COEFFICIENT.Key() == 0 )
72 KRATOS_THROW_ERROR( std::invalid_argument,
"ACCELERATION_PRESSURE_COEFFICIENT has Key zero! (check if the application is correctly registered",
"" )
75 for(ModelPart::NodesContainerType::iterator it=r_model_part.
NodesBegin(); it!=r_model_part.
NodesEnd(); it++)
77 if(it->SolutionStepsDataHas(PRESSURE) ==
false)
78 KRATOS_THROW_ERROR( std::logic_error,
"PRESSURE variable is not allocated for node ", it->Id() )
79 if(it->SolutionStepsDataHas(Dt_PRESSURE) ==
false)
80 KRATOS_THROW_ERROR( std::logic_error,
"Dt_PRESSURE variable is not allocated for node ", it->Id() )
81 if(it->SolutionStepsDataHas(Dt2_PRESSURE) ==
false)
82 KRATOS_THROW_ERROR( std::logic_error,
"Dt2_PRESSURE variable is not allocated for node ", it->Id() )
84 if(it->HasDofFor(PRESSURE) ==
false)
94 KRATOS_THROW_ERROR( std::invalid_argument,
"Some of the scheme variables: beta or gamma has an invalid value ",
"" )
132 int NElems =
static_cast<int>(r_model_part.
Elements().size());
133 ModelPart::ElementsContainerType::iterator el_begin = r_model_part.
ElementsBegin();
135 #pragma omp parallel for
136 for(
int i = 0;
i < NElems;
i++)
138 ModelPart::ElementsContainerType::iterator itElem = el_begin +
i;
142 int NCons =
static_cast<int>(r_model_part.
Conditions().size());
143 ModelPart::ConditionsContainerType::iterator con_begin = r_model_part.
ConditionsBegin();
145 #pragma omp parallel for
146 for(
int i = 0;
i < NCons;
i++)
148 ModelPart::ConditionsContainerType::iterator itCond = con_begin +
i;
168 double DeltaPressure;
170 const int NNodes =
static_cast<int>(r_model_part.
Nodes().size());
171 ModelPart::NodesContainerType::iterator node_begin = r_model_part.
NodesBegin();
173 #pragma omp parallel for private(DeltaPressure)
174 for(
int i = 0;
i < NNodes;
i++)
176 ModelPart::NodesContainerType::iterator itNode = node_begin +
i;
179 double& CurrentDt2Pressure = itNode->FastGetSolutionStepValue(Dt2_PRESSURE);
180 double& CurrentDtPressure = itNode->FastGetSolutionStepValue(Dt_PRESSURE);
181 DeltaPressure = itNode->FastGetSolutionStepValue(PRESSURE) - itNode->FastGetSolutionStepValue(PRESSURE, 1);
182 const double& PreviousDt2Pressure = itNode->FastGetSolutionStepValue(Dt2_PRESSURE, 1);
183 const double& PreviousDtPressure = itNode->FastGetSolutionStepValue(Dt_PRESSURE, 1);
205 int NElems =
static_cast<int>(r_model_part.
Elements().size());
206 ModelPart::ElementsContainerType::iterator el_begin = r_model_part.
ElementsBegin();
208 #pragma omp parallel for
209 for(
int i = 0;
i < NElems;
i++)
211 ModelPart::ElementsContainerType::iterator itElem = el_begin +
i;
212 itElem -> InitializeNonLinearIteration(CurrentProcessInfo);
215 int NCons =
static_cast<int>(r_model_part.
Conditions().size());
216 ModelPart::ConditionsContainerType::iterator con_begin = r_model_part.
ConditionsBegin();
218 #pragma omp parallel for
219 for(
int i = 0;
i < NCons;
i++)
221 ModelPart::ConditionsContainerType::iterator itCond = con_begin +
i;
222 itCond -> InitializeNonLinearIteration(CurrentProcessInfo);
240 int NElems =
static_cast<int>(r_model_part.
Elements().size());
241 ModelPart::ElementsContainerType::iterator el_begin = r_model_part.
ElementsBegin();
243 #pragma omp parallel for
244 for(
int i = 0;
i < NElems;
i++)
246 ModelPart::ElementsContainerType::iterator itElem = el_begin +
i;
247 itElem -> FinalizeNonLinearIteration(CurrentProcessInfo);
250 int NCons =
static_cast<int>(r_model_part.
Conditions().size());
251 ModelPart::ConditionsContainerType::iterator con_begin = r_model_part.
ConditionsBegin();
253 #pragma omp parallel for
254 for(
int i = 0;
i < NCons;
i++)
256 ModelPart::ConditionsContainerType::iterator itCond = con_begin +
i;
257 itCond -> FinalizeNonLinearIteration(CurrentProcessInfo);
396 dof.GetSolutionStepValue() += TSparseSpace::GetValue(Dx, dof.EquationId());
424 double DeltaPressure;
426 const int NNodes =
static_cast<int>(r_model_part.
Nodes().size());
427 ModelPart::NodesContainerType::iterator node_begin = r_model_part.
NodesBegin();
429 #pragma omp parallel for private(DeltaPressure)
430 for(
int i = 0;
i < NNodes;
i++)
432 ModelPart::NodesContainerType::iterator itNode = node_begin +
i;
436 double& CurrentDt2Pressure = itNode->FastGetSolutionStepValue(Dt2_PRESSURE);
437 double& CurrentDtPressure = itNode->FastGetSolutionStepValue(Dt_PRESSURE);
438 DeltaPressure = itNode->FastGetSolutionStepValue(PRESSURE) - itNode->FastGetSolutionStepValue(PRESSURE, 1);
439 const double& PreviousDt2Pressure = itNode->FastGetSolutionStepValue(Dt2_PRESSURE, 1);
440 const double& PreviousDtPressure = itNode->FastGetSolutionStepValue(Dt_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
Definition: dam_P_scheme.hpp:28
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: dam_P_scheme.hpp:230
void Update(ModelPart &r_model_part, DofsArrayType &rDofSet, TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b) override
Performing the update of the solution.
Definition: dam_P_scheme.hpp:382
DamPScheme(double beta, double gamma)
Constructor.
Definition: dam_P_scheme.hpp:44
void Calculate_RHS_Contribution(Element &rCurrentElement, LocalSystemVectorType &RHS_Contribution, Element::EquationIdVectorType &EquationId, const ProcessInfo &CurrentProcessInfo)
Definition: dam_P_scheme.hpp:307
void Predict(ModelPart &r_model_part, DofsArrayType &rDofSet, TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b) override
Performing the prediction of the solution.
Definition: dam_P_scheme.hpp:157
virtual ~DamPScheme()
Destructor.
Definition: dam_P_scheme.hpp:54
double mBeta
Member Variables.
Definition: dam_P_scheme.hpp:413
BaseType::TSystemVectorType TSystemVectorType
Definition: dam_P_scheme.hpp:37
KRATOS_CLASS_POINTER_DEFINITION(DamPScheme)
BaseType::DofsArrayType DofsArrayType
Definition: dam_P_scheme.hpp:35
BaseType::LocalSystemVectorType LocalSystemVectorType
Definition: dam_P_scheme.hpp:38
void Calculate_LHS_Contribution(Element &rCurrentElement, LocalSystemMatrixType &LHS_Contribution, Element::EquationIdVectorType &EquationId, const ProcessInfo &CurrentProcessInfo)
Definition: dam_P_scheme.hpp:346
Scheme< TSparseSpace, TDenseSpace > BaseType
Definition: dam_P_scheme.hpp:34
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: dam_P_scheme.hpp:267
BaseType::TSystemMatrixType TSystemMatrixType
Definition: dam_P_scheme.hpp:36
void InitializeSolutionStep(ModelPart &r_model_part, TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b) override
Function called once at the beginning of each solution step.
Definition: dam_P_scheme.hpp:118
void Initialize(ModelPart &r_model_part) override
This is the place to initialize the Scheme.
Definition: dam_P_scheme.hpp:103
double mGamma
Definition: dam_P_scheme.hpp:414
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: dam_P_scheme.hpp:287
void Calculate_LHS_Contribution(Condition &rCurrentCondition, LocalSystemMatrixType &LHS_Contribution, Element::EquationIdVectorType &EquationId, const ProcessInfo &CurrentProcessInfo)
Definition: dam_P_scheme.hpp:365
BaseType::LocalSystemMatrixType LocalSystemMatrixType
Definition: dam_P_scheme.hpp:39
void Calculate_RHS_Contribution(Condition &rCurrentCondition, LocalSystemVectorType &RHS_Contribution, Element::EquationIdVectorType &EquationId, const ProcessInfo &CurrentProcessInfo)
Definition: dam_P_scheme.hpp:326
void UpdateVariablesDerivatives(ModelPart &r_model_part)
Definition: dam_P_scheme.hpp:419
double mDeltaTime
Definition: dam_P_scheme.hpp:415
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: dam_P_scheme.hpp:195
int Check(ModelPart &r_model_part) override
Definition: dam_P_scheme.hpp:58
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
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
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
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
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
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
void block_for_each(TIterator itBegin, TIterator itEnd, TFunction &&rFunction)
Execute a functor on all items of a range in parallel.
Definition: parallel_utilities.h:299
b
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:31
float gamma
Definition: generate_two_fluid_navier_stokes.py:131
int dof
Definition: ode_solve.py:393
A
Definition: sensitivityMatrix.py:70
integer i
Definition: TensorModule.f:17