15 #if !defined(KRATOS_MPM_EXPLICIT_STRATEGY )
16 #define KRATOS_MPM_EXPLICIT_STRATEGY
41 template<
class TSparseSpace,
80 typename TSchemeType::Pointer pScheme,
82 bool ReformDofSetAtEachStep =
false,
126 typename TSchemeType::Pointer pScheme =
GetScheme();
137 if (pScheme->SchemeIsInitialized() ==
false)
142 if (pScheme->ElementsAreInitialized() ==
false)
147 if (pScheme->ConditionsAreInitialized() ==
false)
166 typename TSchemeType::Pointer pScheme =
GetScheme();
177 KRATOS_INFO_IF(
"MPM_Explicit_Strategy", this->
GetEchoLevel() >= 3) <<
"Initialize Solution Step in strategy finished" << std::endl;
186 typename TSchemeType::Pointer pScheme =
GetScheme();
260 typename TSchemeType::Pointer pScheme =
GetScheme();
302 typename TSchemeType::Pointer pScheme,
314 #pragma omp parallel for firstprivate(RHS_Contribution, equation_id_vector_dummy), schedule(guided,512)
315 for (
int i = 0; i < static_cast<int>(r_conditions.size()); ++
i) {
316 auto it_cond = r_conditions.begin() +
i;
317 pScheme->CalculateRHSContribution(*it_cond, RHS_Contribution, equation_id_vector_dummy, rModelPart.
GetProcessInfo());
320 #pragma omp parallel for firstprivate(RHS_Contribution, equation_id_vector_dummy), schedule(guided,512)
321 for (
int i = 0; i < static_cast<int>(r_elements.size()); ++
i) {
322 auto it_elem = r_elements.begin() +
i;
323 pScheme->CalculateRHSContribution(*it_elem, RHS_Contribution, equation_id_vector_dummy, rModelPart.
GetProcessInfo());
331 typename TSchemeType::Pointer pScheme,
339 auto& r_nodes = rModelPart.
Nodes();
342 const bool has_dof_for_rot_z = (r_nodes.begin())->HasDofFor(ROTATION_Z);
350 const auto it_node_begin = r_nodes.begin();
351 const IndexType disppos = it_node_begin->GetDofPosition(DISPLACEMENT_X);
352 const IndexType rotppos = it_node_begin->GetDofPosition(ROTATION_X);
355 #pragma omp parallel for firstprivate(force_residual, moment_residual), schedule(guided,512)
356 for (
int i = 0; i < static_cast<int>(r_nodes.size()); ++
i) {
357 auto it_node = it_node_begin +
i;
359 noalias(force_residual) = it_node->FastGetSolutionStepValue(FORCE_RESIDUAL);
360 if (has_dof_for_rot_z) {
361 noalias(moment_residual) = it_node->FastGetSolutionStepValue(MOMENT_RESIDUAL);
364 noalias(moment_residual) = zero_array;
367 if (it_node->GetDof(DISPLACEMENT_X, disppos).IsFixed()) {
368 double& r_reaction = it_node->FastGetSolutionStepValue(REACTION_X);
369 r_reaction = force_residual[0];
371 if (it_node->GetDof(DISPLACEMENT_Y, disppos + 1).IsFixed()) {
372 double& r_reaction = it_node->FastGetSolutionStepValue(REACTION_Y);
373 r_reaction = force_residual[1];
375 if (it_node->GetDof(DISPLACEMENT_Z, disppos + 2).IsFixed()) {
376 double& r_reaction = it_node->FastGetSolutionStepValue(REACTION_Z);
377 r_reaction = force_residual[2];
379 if (has_dof_for_rot_z) {
380 if (it_node->GetDof(ROTATION_X, rotppos).IsFixed()) {
381 double& r_reaction = it_node->FastGetSolutionStepValue(REACTION_MOMENT_X);
382 r_reaction = moment_residual[0];
384 if (it_node->GetDof(ROTATION_Y, rotppos + 1).IsFixed()) {
385 double& r_reaction = it_node->FastGetSolutionStepValue(REACTION_MOMENT_Y);
386 r_reaction = moment_residual[1];
388 if (it_node->GetDof(ROTATION_Z, rotppos + 2).IsFixed()) {
389 double& r_reaction = it_node->FastGetSolutionStepValue(REACTION_MOMENT_Z);
390 r_reaction = moment_residual[2];
std::vector< std::size_t > EquationIdVectorType
Definition: element.h:98
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::LocalSystemVectorType LocalSystemVectorType
Definition: implicit_solving_strategy.h:80
BaseType::ConditionsArrayType ConditionsArrayType
Definition: implicit_solving_strategy.h:96
BaseType::TSystemMatrixType TSystemMatrixType
Definition: implicit_solving_strategy.h:70
BaseType::ElementsArrayType ElementsArrayType
Definition: implicit_solving_strategy.h:94
Short class definition.
Definition: mpm_explicit_strategy.hpp:47
BaseType::LocalSystemMatrixType LocalSystemMatrixType
Definition: mpm_explicit_strategy.hpp:67
TSparseSpace SparseSpaceType
Definition: mpm_explicit_strategy.hpp:55
BaseType::TSystemVectorType TSystemVectorType
Definition: mpm_explicit_strategy.hpp:63
void InitializeSolutionStep() override
Performs all the required operations that should be done (for each step) before solving the solution ...
Definition: mpm_explicit_strategy.hpp:159
MPMExplicitStrategy(const MPMExplicitStrategy &Other)
Copy constructor.
Definition: mpm_explicit_strategy.hpp:397
virtual ~MPMExplicitStrategy()
Destructor.
Definition: mpm_explicit_strategy.hpp:105
void Clear() override
Clears the internal storage.
Definition: mpm_explicit_strategy.hpp:205
void SetScheme(typename TSchemeType::Pointer pScheme)
Definition: mpm_explicit_strategy.hpp:111
void SetKeepSystemConstantDuringIterations(bool value)
Definition: mpm_explicit_strategy.hpp:213
bool mInitializeWasPerformed
Definition: mpm_explicit_strategy.hpp:246
bool GetKeepSystemConstantDuringIterations()
Definition: mpm_explicit_strategy.hpp:218
TSchemeType::Pointer GetScheme()
Definition: mpm_explicit_strategy.hpp:116
ImplicitSolvingStrategy< TSparseSpace, TDenseSpace, TLinearSolver > BaseType
Definition: mpm_explicit_strategy.hpp:51
bool mFinalizeSolutionStep
flag to allow to not finalize the solution step, so the historical variables are not updated
Definition: mpm_explicit_strategy.hpp:252
int Check() override
Definition: mpm_explicit_strategy.hpp:289
BaseType::TSchemeType TSchemeType
Definition: mpm_explicit_strategy.hpp:57
KRATOS_CLASS_POINTER_DEFINITION(MPMExplicitStrategy)
bool mSolutionStepIsInitialized
Definition: mpm_explicit_strategy.hpp:244
BaseType::ElementsArrayType ElementsArrayType
Definition: mpm_explicit_strategy.hpp:72
MPMExplicitStrategy(ModelPart &model_part, typename TSchemeType::Pointer pScheme, bool CalculateReactions=false, bool ReformDofSetAtEachStep=false, bool MoveMeshFlag=false)
Definition: mpm_explicit_strategy.hpp:78
BaseType::TSystemMatrixType TSystemMatrixType
Definition: mpm_explicit_strategy.hpp:61
BaseType::DofsArrayType DofsArrayType
Definition: mpm_explicit_strategy.hpp:59
void CalculateAndAddRHS(typename TSchemeType::Pointer pScheme, ModelPart &rModelPart)
Definition: mpm_explicit_strategy.hpp:301
BaseType::NodesArrayType NodesArrayType
Definition: mpm_explicit_strategy.hpp:74
bool mReformDofSetAtEachStep
Definition: mpm_explicit_strategy.hpp:239
BaseType::LocalSystemVectorType LocalSystemVectorType
Definition: mpm_explicit_strategy.hpp:65
BaseType::ConditionsArrayType ConditionsArrayType
Definition: mpm_explicit_strategy.hpp:76
bool SolveSolutionStep() override
the problem of interest is solved
Definition: mpm_explicit_strategy.hpp:184
void CalculateReactions(typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb)
Definition: mpm_explicit_strategy.hpp:330
BaseType::TSystemVectorPointerType TSystemVectorPointerType
Definition: mpm_explicit_strategy.hpp:70
bool mCalculateReactionsFlag
Flag telling if it is needed or not to compute the reactions, default = true.
Definition: mpm_explicit_strategy.hpp:242
BaseType::TSystemMatrixPointerType TSystemMatrixPointerType
Definition: mpm_explicit_strategy.hpp:69
TSchemeType::Pointer mpScheme
Definition: mpm_explicit_strategy.hpp:229
void Initialize() override
Initialize members.
Definition: mpm_explicit_strategy.hpp:122
void FinalizeSolutionStep() override
Performs all the required operations that should be done (for each step) after solving the solution s...
Definition: mpm_explicit_strategy.hpp:257
BaseType::TDataType TDataType
Definition: mpm_explicit_strategy.hpp:53
bool mKeepSystemConstantDuringIterations
flag to allow keeping system matrix constant during iterations
Definition: mpm_explicit_strategy.hpp:249
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
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
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
TSparseSpace::VectorPointerType TSystemVectorPointerType
Definition: solving_strategy.h:77
TDenseSpace::MatrixType LocalSystemMatrixType
Definition: solving_strategy.h:79
ModelPart::NodesContainerType NodesArrayType
Definition: solving_strategy.h:89
TSparseSpace::DataType TDataType
Definition: solving_strategy.h:69
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
int GetEchoLevel()
This returns the level of echo for the solving strategy.
Definition: solving_strategy.h:271
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
#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_ERROR_IF(conditional)
Definition: exception.h:162
#define KRATOS_INFO_IF(label, conditional)
Definition: logger.h:251
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
model_part
Definition: face_heat.py:14
integer i
Definition: TensorModule.f:17
double precision function mb(a)
Definition: TensorModule.f:849