49 template <
class TSparseSpace,
95 typename TSchemeType::Pointer pScheme,
96 bool CalculateReactions =
false,
97 bool ReformDofSetAtEachStep =
false,
213 typename TSchemeType::Pointer pScheme =
GetScheme();
219 if (!pScheme->SchemeIsInitialized())pScheme->Initialize(r_model_part);
222 if (!pScheme->ElementsAreInitialized())pScheme->InitializeElements(r_model_part);
225 if (!pScheme->ConditionsAreInitialized())pScheme->InitializeConditions(r_model_part);
238 const bool has_dof_for_rot_z = !r_nodes.empty() && r_nodes.
begin()->HasDofFor(ROTATION_Z);
239 if (has_dof_for_rot_z) {
277 typename TSchemeType::Pointer pScheme =
GetScheme();
285 pScheme->InitializeSolutionStep(r_model_part, matrix_a_dummy, rDx, rb);
298 const bool has_dof_for_rot_z = r_model_part.
Nodes().begin()->HasDofFor(ROTATION_Z);
299 if (has_dof_for_rot_z) {
333 typename TSchemeType::Pointer pScheme =
GetScheme();
345 pScheme->Predict(r_model_part, dof_set_dummy, rA, rDx, rb);
349 std::vector<std::string> dof_variable_names(2);
350 dof_variable_names[0] =
"DISPLACEMENT";
351 dof_variable_names[1] =
"ROTATION";
352 std::vector<std::string> residual_variable_names(2);
353 residual_variable_names[0] =
"FORCE_RESIDUAL";
354 residual_variable_names[1] =
"MOMENT_RESIDUAL";
359 pScheme->Update(r_model_part, dof_set_dummy, rA, rDx, rb);
366 ComputeExplicitConstraintConstribution(pScheme, r_model_part);
371 CalculateReactions(pScheme, r_model_part, rA, rDx, rb);
383 typename TSchemeType::Pointer pScheme =
GetScheme();
392 pScheme->FinalizeSolutionStep(r_model_part, rA, rDx, rb);
409 KRATOS_INFO(
"MechanicalExplicitStrategy") <<
"Clear function used" << std::endl;
473 void ComputeExplicitConstraintConstribution(
474 typename TSchemeType::Pointer pScheme,
493 void CalculateReactions(
494 typename TSchemeType::Pointer pScheme,
495 ModelPart& rModelPart,
502 auto& r_nodes = rModelPart.Nodes();
504 if (!r_nodes.empty()) {
506 const bool has_dof_for_rot_z = (r_nodes.begin())->HasDofFor(ROTATION_Z);
509 const array_1d<double,3> zero_array =
ZeroVector(3);
512 const auto it_node_begin = r_nodes.begin();
513 const IndexType disppos = it_node_begin->GetDofPosition(DISPLACEMENT_X);
514 const IndexType rotppos = it_node_begin->GetDofPosition(ROTATION_X);
517 std::function<void(Node&)> loop_base, loop;
519 loop_base = [&disppos](Node& rNode){
520 const auto force_residual = rNode.FastGetSolutionStepValue(FORCE_RESIDUAL);
522 if (rNode.GetDof(DISPLACEMENT_X, disppos).IsFixed()) {
523 double& r_reaction = rNode.FastGetSolutionStepValue(REACTION_X);
524 r_reaction = force_residual[0];
526 if (rNode.GetDof(DISPLACEMENT_Y, disppos + 1).IsFixed()) {
527 double& r_reaction = rNode.FastGetSolutionStepValue(REACTION_Y);
528 r_reaction = force_residual[1];
530 if (rNode.GetDof(DISPLACEMENT_Z, disppos + 2).IsFixed()) {
531 double& r_reaction = rNode.FastGetSolutionStepValue(REACTION_Z);
532 r_reaction = force_residual[2];
536 if (has_dof_for_rot_z) {
537 loop = [&rotppos, &loop_base](
Node& rNode){
539 const auto moment_residual = rNode.FastGetSolutionStepValue(MOMENT_RESIDUAL);
540 if (rNode.GetDof(ROTATION_X, rotppos).IsFixed()) {
541 double& r_reaction = rNode.FastGetSolutionStepValue(REACTION_MOMENT_X);
542 r_reaction = moment_residual[0];
544 if (rNode.GetDof(ROTATION_Y, rotppos + 1).IsFixed()) {
545 double& r_reaction = rNode.FastGetSolutionStepValue(REACTION_MOMENT_Y);
546 r_reaction = moment_residual[1];
548 if (rNode.GetDof(ROTATION_Z, rotppos + 2).IsFixed()) {
549 double& r_reaction = rNode.FastGetSolutionStepValue(REACTION_MOMENT_Z);
550 r_reaction = moment_residual[2];
Dof represents a degree of freedom (DoF).
Definition: dof.h:86
Base class for all Elements.
Definition: element.h:60
virtual void AddExplicitContribution(const ProcessInfo &rCurrentProcessInfo)
Definition: element.h:622
Implicit solving strategy base class This is the base class from which we will derive all the implici...
Definition: implicit_solving_strategy.h:61
BaseType::TSystemVectorType TSystemVectorType
Definition: implicit_solving_strategy.h:72
Scheme< TSparseSpace, TDenseSpace > TSchemeType
Definition: implicit_solving_strategy.h:82
void SetRebuildLevel(int Level) override
This sets the build level.
Definition: implicit_solving_strategy.h:207
BaseType::NodesArrayType NodesArrayType
Definition: implicit_solving_strategy.h:92
int mRebuildLevel
Definition: implicit_solving_strategy.h:263
BaseType::TSystemMatrixType TSystemMatrixType
Definition: implicit_solving_strategy.h:70
BaseType::ElementsArrayType ElementsArrayType
Definition: implicit_solving_strategy.h:94
iterator begin()
Definition: amatrix_interface.h:241
This strategy is used for the explicit time integration.
Definition: mechanical_explicit_strategy.hpp:54
TSchemeType::Pointer mpScheme
Definition: mechanical_explicit_strategy.hpp:587
BaseType::ConditionsArrayType ConditionsArrayType
Definition: mechanical_explicit_strategy.hpp:71
void SetCalculateReactionsFlag(bool CalculateReactionsFlag)
This method sets the flag mCalculateReactionsFlag.
Definition: mechanical_explicit_strategy.hpp:172
TSchemeType::Pointer GetScheme()
Get method for the time scheme.
Definition: mechanical_explicit_strategy.hpp:143
DofType::Pointer DofPointerType
Definition: mechanical_explicit_strategy.hpp:76
bool SolveSolutionStep() override
Solves the current step. This function returns true if a solution has been found, false otherwise.
Definition: mechanical_explicit_strategy.hpp:331
void SetScheme(typename TSchemeType::Pointer pScheme)
Set method for the time scheme.
Definition: mechanical_explicit_strategy.hpp:134
KRATOS_CLASS_POINTER_DEFINITION(MechanicalExplicitStrategy)
Counted pointer of MechanicalExplicitStrategy.
void SetInitializePerformedFlag(bool InitializePerformedFlag=true)
This method sets the flag mInitializeWasPerformed.
Definition: mechanical_explicit_strategy.hpp:154
BaseType::ElementsArrayType ElementsArrayType
Definition: mechanical_explicit_strategy.hpp:70
BaseType::DofsArrayType DofsArrayType
Definition: mechanical_explicit_strategy.hpp:64
bool GetCalculateReactionsFlag()
This method returns the flag mCalculateReactionsFlag.
Definition: mechanical_explicit_strategy.hpp:181
BaseType::TSystemVectorPointerType TSystemVectorPointerType
Definition: mechanical_explicit_strategy.hpp:68
bool GetInitializePerformedFlag()
This method gets the flag mInitializeWasPerformed.
Definition: mechanical_explicit_strategy.hpp:163
void FinalizeSolutionStep() override
Performs all the required operations that should be done (for each step) after solving the solution s...
Definition: mechanical_explicit_strategy.hpp:381
BaseType::TSystemMatrixPointerType TSystemMatrixPointerType
Definition: mechanical_explicit_strategy.hpp:67
MechanicalExplicitStrategy(ModelPart &rModelPart, typename TSchemeType::Pointer pScheme, bool CalculateReactions=false, bool ReformDofSetAtEachStep=false, bool MoveMeshFlag=true)
Default constructor.
Definition: mechanical_explicit_strategy.hpp:93
void SetReformDofSetAtEachStepFlag(bool Flag)
This method sets the flag mReformDofSetAtEachStep.
Definition: mechanical_explicit_strategy.hpp:190
bool mInitializeWasPerformed
Flag telling if the initialize was performed.
Definition: mechanical_explicit_strategy.hpp:608
void Clear() override
Clears the internal storage.
Definition: mechanical_explicit_strategy.hpp:405
bool mCalculateReactionsFlag
Flag telling if it is needed or not to compute the reactions.
Definition: mechanical_explicit_strategy.hpp:602
MechanicalExplicitStrategy(const MechanicalExplicitStrategy &Other)
Definition: mechanical_explicit_strategy.hpp:632
void Initialize() override
Initialization of member variables and prior operations.
Definition: mechanical_explicit_strategy.hpp:207
ImplicitSolvingStrategy< TSparseSpace, TDenseSpace, TLinearSolver > BaseType
Definition: mechanical_explicit_strategy.hpp:60
bool GetReformDofSetAtEachStepFlag()
This method returns the flag mReformDofSetAtEachStep.
Definition: mechanical_explicit_strategy.hpp:199
BaseType::LocalSystemVectorType LocalSystemVectorType
Definition: mechanical_explicit_strategy.hpp:72
BaseType::NodesArrayType NodesArrayType
Definition: mechanical_explicit_strategy.hpp:69
Node::DofType DofType
DoF types definition.
Definition: mechanical_explicit_strategy.hpp:75
bool mReformDofSetAtEachStep
The pointer to the integration scheme.
Definition: mechanical_explicit_strategy.hpp:596
int Check() override
This function is designed to be called once to perform all the checks needed on the input provided.
Definition: mechanical_explicit_strategy.hpp:425
BaseType::TSchemeType TSchemeType
Some definitions from the base class.
Definition: mechanical_explicit_strategy.hpp:63
virtual ~MechanicalExplicitStrategy()
Definition: mechanical_explicit_strategy.hpp:117
void InitializeSolutionStep() override
Performs all the required operations that should be done (for each step) before solving the solution ...
Definition: mechanical_explicit_strategy.hpp:274
BaseType::TSystemVectorType TSystemVectorType
Definition: mechanical_explicit_strategy.hpp:66
BaseType::TSystemMatrixType TSystemMatrixType
Definition: mechanical_explicit_strategy.hpp:65
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
MasterSlaveConstraintContainerType & MasterSlaveConstraints(IndexType ThisIndex=0)
Definition: model_part.h:654
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
TSparseSpace::VectorPointerType TSystemVectorPointerType
Definition: solving_strategy.h:77
ModelPart::NodesContainerType NodesArrayType
Definition: solving_strategy.h:89
virtual void SetEchoLevel(const int Level)
This sets the level of echo for the solving strategy.
Definition: solving_strategy.h:255
ModelPart & GetModelPart()
Operations to get the pointer to the model.
Definition: solving_strategy.h:350
ModelPart::ElementsContainerType ElementsArrayType
Definition: solving_strategy.h:91
TSparseSpace::MatrixType TSystemMatrixType
Definition: solving_strategy.h:71
virtual int Check()
Function to perform expensive checks.
Definition: solving_strategy.h:377
TSparseSpace::MatrixPointerType TSystemMatrixPointerType
Definition: solving_strategy.h:75
ModelPart::ConditionsContainerType ConditionsArrayType
Definition: solving_strategy.h:93
bool MoveMeshFlag()
This function returns the flag that says if the mesh is moved.
Definition: solving_strategy.h:290
TSparseSpace::VectorType TSystemVectorType
Definition: solving_strategy.h:73
virtual void MoveMesh()
This function is designed to move the mesh.
Definition: solving_strategy.h:330
TDenseSpace::VectorType LocalSystemVectorType
Definition: solving_strategy.h:81
This class implements a set of auxiliar, already parallelized, methods to perform some common tasks r...
Definition: variable_utils.h:63
void SetNonHistoricalVariable(const TVarType &rVariable, const TType &Value, TContainerType &rContainer)
Sets the container value of any type of non historical variable.
Definition: variable_utils.h:790
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
std::size_t IndexType
The definition of the index type.
Definition: key_hash.h:35
#define KRATOS_INFO(label)
Definition: logger.h:250
void PreComputeExplicitConstraintMassAndInertia(ModelPart &rModelPart, const std::string &DofDisplacementVariableName, const std::string &MassVariableName, const std::string &DofRotationVariableName, const std::string &InertiaVariableName)
This method precomputes the contribution of the explicit MPC over nodal masses and inertias.
Definition: constraint_utilities.cpp:296
void ApplyConstraints(ModelPart &rModelPart)
This method resets the values of the slave dofs.
Definition: constraint_utilities.cpp:159
void PreComputeExplicitConstraintConstribution(ModelPart &rModelPart, const std::vector< std::string > &rDofVariableNames, const std::vector< std::string > &rResidualDofVariableNames)
This method precomputes the contribution of the explicit MPC over nodal residual forces.
Definition: constraint_utilities.cpp:182
void ResetSlaveDofs(ModelPart &rModelPart)
This method resets the values of the slave dofs.
Definition: constraint_utilities.cpp:136
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
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