48 template <
class TSparseSpace,
class TDenseSpace>
60 const std::vector<SecondOrderVectorVariable>& rSecondOrderVectorVariables)
61 : mFirstOrderScalarVariables(rFirstOrderScalarVariables),
62 mSecondOrderVectorVariables(rSecondOrderVectorVariables)
71 CheckAllocatedVariables(rModelPart);
72 CheckBufferSize(rModelPart);
93 rElementOrCondition.GetDofList(rDofList, rCurrentProcessInfo);
110 template <
typename T>
112 typename T::EquationIdVectorType& rEquationId,
116 rElementOrCondition.EquationIdVector(rEquationId, rCurrentProcessInfo);
175 template <
typename MemFuncPtr>
180 if (IsActive(rElement)) {
181 (rElement.*pMemberFunction)(r_current_process_info);
186 template <
typename MemFuncPtr>
191 if (IsActive(rCondition)) (rCondition.*pMemberFunction)(r_current_process_info);
198 return !(rComponent.IsDefined(ACTIVE)) || rComponent.Is(ACTIVE);
203 FinalizeSolutionStepActiveEntities(rModelPart,
A, Dx,
b);
212 CalculateSystemContributionsImpl(rCurrentElement, LHS_Contribution, RHS_Contribution,
213 EquationId, CurrentProcessInfo);
222 CalculateSystemContributionsImpl(rCurrentCondition, LHS_Contribution, RHS_Contribution,
223 EquationId, CurrentProcessInfo);
226 template <
typename T>
230 typename T::EquationIdVectorType& EquationId,
236 rCurrentComponent.CalculateLocalSystem(LHS_Contribution, RHS_Contribution, CurrentProcessInfo);
237 rCurrentComponent.EquationIdVector(EquationId, CurrentProcessInfo);
247 CalculateRHSContributionImpl(rCurrentElement, RHS_Contribution, EquationId, CurrentProcessInfo);
255 CalculateRHSContributionImpl(rCurrentCondition, RHS_Contribution, EquationId, CurrentProcessInfo);
258 template <
typename T>
261 typename T::EquationIdVectorType& EquationId,
266 rCurrentComponent.CalculateRightHandSide(RHS_Contribution, CurrentProcessInfo);
267 rCurrentComponent.EquationIdVector(EquationId, CurrentProcessInfo);
277 CalculateLHSContributionImpl(rCurrentElement, LHS_Contribution, EquationId, CurrentProcessInfo);
285 CalculateLHSContributionImpl(rCurrentCondition, LHS_Contribution, EquationId, CurrentProcessInfo);
288 template <
typename T>
291 typename T::EquationIdVectorType& EquationId,
296 rCurrentComponent.CalculateLeftHandSide(LHS_Contribution, CurrentProcessInfo);
297 rCurrentComponent.EquationIdVector(EquationId, CurrentProcessInfo);
308 dof.GetSolutionStepValue() += TSparseSpace::GetValue(Dx, dof.EquationId());
312 UpdateVariablesDerivatives(rModelPart);
319 const std::string& rComponent)
const
335 return mSecondOrderVectorVariables;
340 return mFirstOrderScalarVariables;
344 void CheckAllocatedVariables(
const ModelPart& rModelPart)
const
346 for (
const auto& r_node : rModelPart.
Nodes()) {
347 for (
const auto& r_first_order_scalar_variable : mFirstOrderScalarVariables) {
348 this->CheckSolutionStepsData(r_node, r_first_order_scalar_variable.instance);
349 this->CheckSolutionStepsData(r_node, r_first_order_scalar_variable.first_time_derivative);
350 this->CheckDof(r_node, r_first_order_scalar_variable.instance);
354 for (
const auto& r_node : rModelPart.
Nodes()) {
355 for (
const auto& r_second_order_vector_variable : this->mSecondOrderVectorVariables) {
359 this->CheckSolutionStepsData(r_node, r_second_order_vector_variable.instance);
360 this->CheckSolutionStepsData(r_node, r_second_order_vector_variable.first_time_derivative);
361 this->CheckSolutionStepsData(r_node, r_second_order_vector_variable.second_time_derivative);
364 std::vector<std::string> components{
"X",
"Y"};
365 for (
const auto& component : components) {
366 const auto& variable_component =
367 GetComponentFromVectorVariable(r_second_order_vector_variable.instance, component);
368 this->CheckDof(r_node, variable_component);
374 void CheckBufferSize(
const ModelPart& rModelPart)
const
378 <<
"insufficient buffer size. Buffer size should be "
379 "greater than or equal to "
380 << minimum_buffer_size <<
". Current size is " << rModelPart.GetBufferSize() << std::endl;
384 void CheckSolutionStepsData(
const Node& rNode,
const Variable<T>& rVariable)
const
387 << rVariable.Name() <<
" variable is not allocated for node " << rNode.Id() << std::endl;
391 void CheckDof(
const Node& rNode,
const Variable<T>& rVariable)
const
394 <<
"missing " << rVariable.Name() <<
" dof on node " << rNode.Id() << std::endl;
397 double mDeltaTime = 1.0;
398 std::vector<FirstOrderScalarVariable> mFirstOrderScalarVariables;
399 std::vector<SecondOrderVectorVariable> mSecondOrderVectorVariables;
Base class for all Conditions.
Definition: condition.h:59
virtual void FinalizeSolutionStep(const ProcessInfo &rCurrentProcessInfo)
Definition: condition.h:389
std::vector< std::size_t > EquationIdVectorType
Definition: condition.h:98
virtual void InitializeSolutionStep(const ProcessInfo &rCurrentProcessInfo)
Definition: condition.h:368
std::vector< DofType::Pointer > DofsVectorType
Definition: condition.h:100
virtual void InitializeNonLinearIteration(const ProcessInfo &rCurrentProcessInfo)
Definition: condition.h:375
virtual void FinalizeNonLinearIteration(const ProcessInfo &rCurrentProcessInfo)
Definition: condition.h:382
Base class for all Elements.
Definition: element.h:60
virtual void FinalizeNonLinearIteration(const ProcessInfo &rCurrentProcessInfo)
Definition: element.h:379
virtual void InitializeSolutionStep(const ProcessInfo &rCurrentProcessInfo)
Definition: element.h:365
std::vector< DofType::Pointer > DofsVectorType
Definition: element.h:100
virtual void InitializeNonLinearIteration(const ProcessInfo &rCurrentProcessInfo)
Definition: element.h:372
std::vector< std::size_t > EquationIdVectorType
Definition: element.h:98
virtual void FinalizeSolutionStep(const ProcessInfo &rCurrentProcessInfo)
Definition: element.h:386
Definition: geomechanics_time_integration_scheme.hpp:50
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: geomechanics_time_integration_scheme.hpp:206
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: geomechanics_time_integration_scheme.hpp:201
void CalculateLHSContributionImpl(T &rCurrentComponent, LocalSystemMatrixType &LHS_Contribution, typename T::EquationIdVectorType &EquationId, const ProcessInfo &CurrentProcessInfo)
Definition: geomechanics_time_integration_scheme.hpp:289
void GetDofList(const Condition &rCondition, Condition::DofsVectorType &rDofList, const ProcessInfo &rCurrentProcessInfo) override
Function that returns the list of Degrees of freedom to be assembled in the system for a Given condit...
Definition: geomechanics_time_integration_scheme.hpp:84
void EquationId(const Element &rElement, Element::EquationIdVectorType &rEquationId, const ProcessInfo &rCurrentProcessInfo) override
This method gets the eqaution id corresponding to the current element.
Definition: geomechanics_time_integration_scheme.hpp:96
const std::vector< FirstOrderScalarVariable > & GetFirstOrderScalarVariables() const
Definition: geomechanics_time_integration_scheme.hpp:338
void InitializeNonLinIteration(ModelPart &rModelPart, TSystemMatrixType &, TSystemVectorType &, TSystemVectorType &) override
unction to be called when it is needed to initialize an iteration. It is designed to be called at the...
Definition: geomechanics_time_integration_scheme.hpp:145
void FinalizeSolutionStepActiveEntities(ModelPart &rModelPart, TSystemMatrixType &, TSystemVectorType &, TSystemVectorType &)
Definition: geomechanics_time_integration_scheme.hpp:165
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: geomechanics_time_integration_scheme.hpp:242
void InitializeSolutionStep(ModelPart &rModelPart, TSystemMatrixType &, TSystemVectorType &, TSystemVectorType &) override
Function called once at the beginning of each solution step.
Definition: geomechanics_time_integration_scheme.hpp:133
GeoMechanicsTimeIntegrationScheme(const std::vector< FirstOrderScalarVariable > &rFirstOrderScalarVariables, const std::vector< SecondOrderVectorVariable > &rSecondOrderVectorVariables)
Definition: geomechanics_time_integration_scheme.hpp:59
double GetDeltaTime() const
Definition: geomechanics_time_integration_scheme.hpp:331
void CalculateRHSContributionImpl(T &rCurrentComponent, LocalSystemVectorType &RHS_Contribution, typename T::EquationIdVectorType &EquationId, const ProcessInfo &CurrentProcessInfo)
Definition: geomechanics_time_integration_scheme.hpp:259
const Variable< double > & GetComponentFromVectorVariable(const Variable< array_1d< double, 3 >> &rSource, const std::string &rComponent) const
Definition: geomechanics_time_integration_scheme.hpp:318
static bool IsActive(const T &rComponent)
Definition: geomechanics_time_integration_scheme.hpp:196
virtual void SetTimeFactors(ModelPart &rModelPart)
Definition: geomechanics_time_integration_scheme.hpp:324
void GetDofListImpl(const T &rElementOrCondition, typename T::DofsVectorType &rDofList, const ProcessInfo &rCurrentProcessInfo)
Definition: geomechanics_time_integration_scheme.hpp:90
void GetDofList(const Element &rElement, Element::DofsVectorType &rDofList, const ProcessInfo &rCurrentProcessInfo) override
Function that returns the list of Degrees of freedom to be assembled in the system for a Given elemen...
Definition: geomechanics_time_integration_scheme.hpp:79
void EquationId(const Condition &rCondition, Condition::EquationIdVectorType &rEquationId, const ProcessInfo &rCurrentProcessInfo) override
Functions totally analogous to the precedent but applied to the "condition" objects.
Definition: geomechanics_time_integration_scheme.hpp:103
const std::vector< SecondOrderVectorVariable > & GetSecondOrderVectorVariables() const
Definition: geomechanics_time_integration_scheme.hpp:333
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: geomechanics_time_integration_scheme.hpp:216
void CalculateSystemContributionsImpl(T &rCurrentComponent, LocalSystemMatrixType &LHS_Contribution, LocalSystemVectorType &RHS_Contribution, typename T::EquationIdVectorType &EquationId, const ProcessInfo &CurrentProcessInfo)
Definition: geomechanics_time_integration_scheme.hpp:227
void EquationIdImpl(const T &rElementOrCondition, typename T::EquationIdVectorType &rEquationId, const ProcessInfo &rCurrentProcessInfo)
Definition: geomechanics_time_integration_scheme.hpp:111
void Initialize(ModelPart &rModelPart) override
This is the place to initialize the Scheme.
Definition: geomechanics_time_integration_scheme.hpp:119
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: geomechanics_time_integration_scheme.hpp:250
void Update(ModelPart &rModelPart, DofsArrayType &rDofSet, TSystemMatrixType &, TSystemVectorType &Dx, TSystemVectorType &) override
Performing the update of the solution.
Definition: geomechanics_time_integration_scheme.hpp:302
void BlockForEachActiveElement(ModelPart &rModelPart, MemFuncPtr pMemberFunction)
Definition: geomechanics_time_integration_scheme.hpp:176
void FinalizeNonLinIteration(ModelPart &rModelPart, TSystemMatrixType &, TSystemVectorType &, TSystemVectorType &) override
Function to be called when it is needed to finalize an iteration. It is designed to be called at the ...
Definition: geomechanics_time_integration_scheme.hpp:155
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: geomechanics_time_integration_scheme.hpp:272
virtual void UpdateVariablesDerivatives(ModelPart &rModelPart)=0
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: geomechanics_time_integration_scheme.hpp:280
void Predict(ModelPart &rModelPart, DofsArrayType &, TSystemMatrixType &, TSystemVectorType &, TSystemVectorType &) override
Performing the prediction of the solution.
Definition: geomechanics_time_integration_scheme.hpp:128
int Check(const ModelPart &rModelPart) const final
This function is designed to be called once to perform all the checks needed on the input provided....
Definition: geomechanics_time_integration_scheme.hpp:66
void BlockForEachActiveCondition(ModelPart &rModelPart, MemFuncPtr pMemberFunction)
Definition: geomechanics_time_integration_scheme.hpp:187
KratosComponents class encapsulates a lookup table for a family of classes in a generic way.
Definition: kratos_components.h:49
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
std::size_t IndexType
Pointer definition of ModelPart.
Definition: model_part.h:105
ConditionsContainerType & Conditions(IndexType ThisIndex=0)
Definition: model_part.h:1381
bool HasNodalSolutionStepVariable(VariableData const &ThisVariable) const
Definition: model_part.h:544
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
ElementsContainerType & Elements(IndexType ThisIndex=0)
Definition: model_part.h:1189
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
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 Initialize(ModelPart &rModelPart)
This is the place to initialize the Scheme.
Definition: scheme.h:168
ModelPart::DofsArrayType DofsArrayType
DoF array type definition.
Definition: scheme.h:86
typename TDenseSpace::MatrixType LocalSystemMatrixType
Local system matrix type definition.
Definition: scheme.h:77
virtual int Check(const ModelPart &rModelPart) const
This function is designed to be called once to perform all the checks needed on the input provided....
Definition: scheme.h:508
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_ERROR_IF_NOT(conditional)
Definition: exception.h:163
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
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
int dof
Definition: ode_solve.py:393
A
Definition: sensitivityMatrix.py:70
Definition: geomechanics_time_integration_scheme.hpp:20
FirstOrderScalarVariable(const Variable< double > &instance, const Variable< double > &first_time_derivative, const Variable< double > &delta_time_coefficient)
Definition: geomechanics_time_integration_scheme.hpp:25
Variable< double > delta_time_coefficient
Definition: geomechanics_time_integration_scheme.hpp:23
Variable< double > instance
Definition: geomechanics_time_integration_scheme.hpp:21
Variable< double > first_time_derivative
Definition: geomechanics_time_integration_scheme.hpp:22
Definition: geomechanics_time_integration_scheme.hpp:35
Variable< array_1d< double, 3 > > instance
Definition: geomechanics_time_integration_scheme.hpp:36
Variable< array_1d< double, 3 > > first_time_derivative
Definition: geomechanics_time_integration_scheme.hpp:37
SecondOrderVectorVariable(const Variable< array_1d< double, 3 >> &instance)
Definition: geomechanics_time_integration_scheme.hpp:40
Variable< array_1d< double, 3 > > second_time_derivative
Definition: geomechanics_time_integration_scheme.hpp:38