14 #if !defined(KRATOS_ARC_LENGTH_STRATEGY)
15 #define KRATOS_ARC_LENGTH_STRATEGY
59 template <
class TSparseSpace,
class TDenseSpace,
class TLinearSolver>
91 typename TSchemeType::Pointer pScheme,
92 typename TConvergenceCriteriaType::Pointer pNewConvergenceCriteria,
93 typename TBuilderAndSolverType::Pointer pNewBuilderAndSolver,
96 pNewConvergenceCriteria, pNewBuilderAndSolver, ThisParameters[
"max_iteration"].GetInt(),
97 ThisParameters[
"compute_reactions"].GetBool(), ThisParameters[
"reform_dofs_at_each_step"].GetBool(),
98 ThisParameters[
"move_mesh_flag"].GetBool())
125 if (ThisParameters[
"loads_sub_model_part_list"].size() > 0) {
127 mVariableNames.resize(ThisParameters[
"loads_variable_list"].size());
131 const auto& r_sub_model_parts_names = ThisParameters[
"loads_sub_model_part_list"].
GetStringArray();
201 TSystemVectorType& rDx = *(this->
mpDx);
202 TSystemVectorType& rb = *(this->
mpb);
203 TSparseSpace::SetToZero(rA);
204 TSparseSpace::SetToZero(rDx);
205 TSparseSpace::SetToZero(rb);
214 TSystemVectorType& rf = *
mpf;
215 TSparseSpace::SetToZero(rf);
252 const std::size_t iteration_number = r_model_part.
GetProcessInfo()[NL_ITERATION_NUMBER];
280 TSystemMatrixType& r_A = *(this->
mpA);
281 TSystemVectorType& r_Dx = *(this->
mpDx);
282 TSystemVectorType& r_b = *(this->
mpb);
283 TSystemVectorType& r_f = *
mpf;
290 unsigned int iteration_number = 1;
291 r_model_part.
GetProcessInfo()[NL_ITERATION_NUMBER] = iteration_number;
293 this->
mpScheme->InitializeNonLinIteration(r_model_part, r_A, r_Dx, r_b);
295 bool is_converged = this->
mpConvergenceCriteria->PreCriteria(r_model_part, r_dof_set, r_A, r_Dx, r_b);
297 TSparseSpace::SetToZero(r_A);
298 TSparseSpace::SetToZero(r_b);
299 TSparseSpace::SetToZero(r_Dxf);
312 TSparseSpace::InplaceMult(r_Dxf, lambda_increment);
315 TSparseSpace::InplaceMult(r_Dxf, 1.0 / lambda_increment);
318 this->
mpScheme->FinalizeNonLinIteration(r_model_part, r_A, r_DxPred, r_b);
323 TSparseSpace::SetToZero(r_b);
333 r_model_part.
GetProcessInfo()[NL_ITERATION_NUMBER] = iteration_number;
335 this->
mpScheme->InitializeNonLinIteration(r_model_part, r_A, r_Dx, r_b);
339 TSparseSpace::SetToZero(r_A);
340 TSparseSpace::SetToZero(r_b);
341 TSparseSpace::SetToZero(r_Dxf);
349 TSparseSpace::SetToZero(r_A);
350 TSparseSpace::SetToZero(r_b);
351 TSparseSpace::SetToZero(r_Dxb);
363 this->
mpScheme->FinalizeNonLinIteration(r_model_part, r_A, r_Dx, r_b);
368 TSparseSpace::SetToZero(r_b);
379 <<
"Convergence achieved after " << iteration_number <<
" / "
401 r_node.FastGetSolutionStepValue(var) *= (mLambda/mLambda_old);
411 if (mInsideIterationLoop)
412 r_condition.GetValue(r_var) *= mLambda / mLambda_old;
414 r_condition.GetValue(r_var) *= mLambda;
420 KRATOS_ERROR <<
"One variable of the applied loads has a non supported type. Variable: " << r_variable_name << std::endl;
436 "name" : "arc_length_strategy",
437 "desired_iterations" : 4,
438 "max_radius_factor" : 10.0,
439 "min_radius_factor" : 0.1,
440 "loads_sub_model_part_list" : [],
441 "loads_variable_list" : []
447 return default_parameters;
456 return "arc_length_strategy";
471 if (
v.size() != this->mpBuilderAndSolver->GetEquationSystemSize())
485 if (
v.size() != this->mpBuilderAndSolver->GetEquationSystemSize())
512 std::string
Info()
const override
514 return "ArcLengthStrategy";
This is the base ArcLengthStrategy.
Definition: arc_length_strategy.h:62
void MaxIterationsExceeded() override
This method prints information after reach the max number of iterations.
Definition: arc_length_strategy.h:620
void FinalizeSolutionStep() override
Performs all the required operations that should be done (for each step) after solving the solution s...
Definition: arc_length_strategy.h:246
bool SolveSolutionStep() override
Solves the current step. This function returns true if a solution has been found, false otherwise.
Definition: arc_length_strategy.h:270
void InitializeSolutionStep() override
Performs all the required operations that should be done (for each step) before solving the solution ...
Definition: arc_length_strategy.h:183
void Clear() override
Clears the internal storage.
Definition: arc_length_strategy.h:152
ResidualBasedNewtonRaphsonStrategy< TSparseSpace, TDenseSpace, TLinearSolver > BaseType
Definition: arc_length_strategy.h:70
void UpdateExternalLoads()
This method updates the value of the external load according to the new load factor Lambda.
Definition: arc_length_strategy.h:391
void SaveInitializeSystemVector(TSystemVectorPointerType &pv)
It saves system vector pointer.
Definition: arc_length_strategy.h:478
BaseType::LocalSystemVectorType LocalSystemVectorType
Definition: arc_length_strategy.h:79
BaseType::TSystemVectorPointerType TSystemVectorPointerType
Definition: arc_length_strategy.h:82
void Initialize() override
Initialization of member variables and prior operations.
Definition: arc_length_strategy.h:142
BaseType::TSchemeType TSchemeType
Definition: arc_length_strategy.h:74
TSystemVectorPointerType mpf
Definition: arc_length_strategy.h:573
void UpdateDatabase(TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb, const bool MoveMesh) override
Here the database is updated.
Definition: arc_length_strategy.h:605
BaseType::TBuilderAndSolverType TBuilderAndSolverType
Definition: arc_length_strategy.h:71
BaseType::TDataType TDataType
Definition: arc_length_strategy.h:72
std::vector< std::string > mVariableNames
List of SubModelParts associated to an external load.
Definition: arc_length_strategy.h:591
double mMaxRadiusFactor
Definition: arc_length_strategy.h:584
~ArcLengthStrategy() override=default
Destructor.
TSystemVectorPointerType mpDxStep
Delta x of prediction phase.
Definition: arc_length_strategy.h:577
ArcLengthStrategy(ModelPart &model_part, typename TSchemeType::Pointer pScheme, typename TConvergenceCriteriaType::Pointer pNewConvergenceCriteria, typename TBuilderAndSolverType::Pointer pNewBuilderAndSolver, Parameters ThisParameters)
Definition: arc_length_strategy.h:89
BaseType::TSystemMatrixType TSystemMatrixType
Definition: arc_length_strategy.h:77
double mLambda_old
Definition: arc_length_strategy.h:586
double mRadius
Used to limit the radius of the arc length strategy.
Definition: arc_length_strategy.h:585
TSparseSpace SparseSpaceType
Definition: arc_length_strategy.h:73
TSystemVectorPointerType mpDxf
Vector of reference external forces.
Definition: arc_length_strategy.h:574
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: arc_length_strategy.h:524
static std::string Name()
Returns the name of the class as used in the settings (snake_case format)
Definition: arc_length_strategy.h:454
ArcLengthStrategy(const ArcLengthStrategy &Other)
Definition: arc_length_strategy.h:645
TSystemVectorPointerType mpDxPred
Delta x of A*Dxb=b.
Definition: arc_length_strategy.h:576
std::string Info() const override
Turn back information as a string.
Definition: arc_length_strategy.h:512
bool mInsideIterationLoop
Definition: arc_length_strategy.h:582
double mLambda
Radius of the arc length strategy.
Definition: arc_length_strategy.h:586
BaseType::DofsArrayType DofsArrayType
Definition: arc_length_strategy.h:76
double mNormxEquilibrium
current and old loading factor
Definition: arc_length_strategy.h:587
double mDLambdaStep
Norm of the solution vector in equilibrium.
Definition: arc_length_strategy.h:588
bool mInitializeArcLengthWasPerformed
This is used to calculate the radius of the next step.
Definition: arc_length_strategy.h:581
void AssignSettings(const Parameters ThisParameters) override
This method assigns settings to member variables.
Definition: arc_length_strategy.h:115
unsigned int mDesiredIterations
Delta x of the current step.
Definition: arc_length_strategy.h:579
BaseType::LocalSystemMatrixType LocalSystemMatrixType
Definition: arc_length_strategy.h:80
BaseType::TSystemVectorType TSystemVectorType
Definition: arc_length_strategy.h:78
double mMinRadiusFactor
Definition: arc_length_strategy.h:584
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: arc_length_strategy.h:518
KRATOS_CLASS_POINTER_DEFINITION(ArcLengthStrategy)
double mRadius_0
Definition: arc_length_strategy.h:585
std::vector< ModelPart * > mSubModelPartList
Delta lambda of the current step.
Definition: arc_length_strategy.h:590
void InitializeSystemVector(TSystemVectorPointerType &pv)
It resizes and initializes a system vector.
Definition: arc_length_strategy.h:462
Parameters GetDefaultParameters() const override
This method provides the defaults parameters to avoid conflicts between the different constructors.
Definition: arc_length_strategy.h:432
BaseType::TSystemMatrixPointerType TSystemMatrixPointerType
Definition: arc_length_strategy.h:81
TSystemVectorPointerType mpDxb
Delta x of A*Dxf=f.
Definition: arc_length_strategy.h:575
BaseType::TConvergenceCriteriaType TConvergenceCriteriaType
Definition: arc_length_strategy.h:75
Base class for all Conditions.
Definition: condition.h:59
This is the base class to define the different convergence criterion considered.
Definition: convergence_criteria.h:58
KratosComponents class encapsulates a lookup table for a family of classes in a generic way.
Definition: kratos_components.h:49
static const TComponentType & Get(const std::string &rName)
Retrieves a component with the specified name.
Definition: kratos_components.h:114
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
ModelPart & GetSubModelPart(std::string const &SubModelPartName)
Definition: model_part.cpp:2029
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
This class defines the node.
Definition: node.h:65
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
std::vector< std::string > GetStringArray() const
This method returns the array of strings in the current Parameter.
Definition: kratos_parameters.cpp:693
double GetDouble() const
This method returns the double contained in the current Parameter.
Definition: kratos_parameters.cpp:657
int GetInt() const
This method returns the integer contained in the current Parameter.
Definition: kratos_parameters.cpp:666
void RecursivelyAddMissingParameters(const Parameters &rDefaultParameters)
This function is designed to verify that the parameters under testing contain at least all parameters...
Definition: kratos_parameters.cpp:1457
std::string GetString() const
This method returns the string contained in the current Parameter.
Definition: kratos_parameters.cpp:684
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
This is the base Newton Raphson strategy.
Definition: residualbased_newton_raphson_strategy.h:66
BaseType::LocalSystemMatrixType LocalSystemMatrixType
Definition: residualbased_newton_raphson_strategy.h:97
virtual void UpdateDatabase(TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb, const bool MoveMesh)
Here the database is updated.
Definition: residualbased_newton_raphson_strategy.h:1278
BaseType::TDataType TDataType
Definition: residualbased_newton_raphson_strategy.h:83
unsigned int mMaxIterationNumber
Definition: residualbased_newton_raphson_strategy.h:1261
BaseType::TSystemVectorType TSystemVectorType
Definition: residualbased_newton_raphson_strategy.h:93
TSystemVectorPointerType mpb
The increment in the solution.
Definition: residualbased_newton_raphson_strategy.h:1237
TSystemMatrixPointerType mpA
The RHS vector of the system of equations.
Definition: residualbased_newton_raphson_strategy.h:1238
bool mCalculateReactionsFlag
Flag telling if it is needed or not to compute the reactions.
Definition: residualbased_newton_raphson_strategy.h:1253
Parameters GetDefaultParameters() const override
This method provides the defaults parameters to avoid conflicts between the different constructors.
Definition: residualbased_newton_raphson_strategy.h:1069
TSystemVectorPointerType mpDx
The pointer to the convergence criteria employed.
Definition: residualbased_newton_raphson_strategy.h:1236
TBuilderAndSolverType::Pointer mpBuilderAndSolver
The pointer to the time scheme employed.
Definition: residualbased_newton_raphson_strategy.h:1233
BaseType::TSchemeType TSchemeType
Definition: residualbased_newton_raphson_strategy.h:87
void Initialize() override
Initialization of member variables and prior operations.
Definition: residualbased_newton_raphson_strategy.h:672
TSchemeType::Pointer mpScheme
Definition: residualbased_newton_raphson_strategy.h:1232
void AssignSettings(const Parameters ThisParameters) override
This method assigns settings to member variables.
Definition: residualbased_newton_raphson_strategy.h:1351
void InitializeSolutionStep() override
Performs all the required operations that should be done (for each step) before solving the solution ...
Definition: residualbased_newton_raphson_strategy.h:781
BaseType::TBuilderAndSolverType TBuilderAndSolverType
Definition: residualbased_newton_raphson_strategy.h:81
BaseType::TSystemMatrixType TSystemMatrixType
Definition: residualbased_newton_raphson_strategy.h:91
void Clear() override
Clears the internal storage.
Definition: residualbased_newton_raphson_strategy.h:707
TConvergenceCriteriaType::Pointer mpConvergenceCriteria
The pointer to the builder and solver employed.
Definition: residualbased_newton_raphson_strategy.h:1234
BaseType::TSystemVectorPointerType TSystemVectorPointerType
Definition: residualbased_newton_raphson_strategy.h:101
void FinalizeSolutionStep() override
Performs all the required operations that should be done (for each step) after solving the solution s...
Definition: residualbased_newton_raphson_strategy.h:848
BaseType::LocalSystemVectorType LocalSystemVectorType
Definition: residualbased_newton_raphson_strategy.h:95
BaseType::TSystemMatrixPointerType TSystemMatrixPointerType
Definition: residualbased_newton_raphson_strategy.h:99
ModelPart & GetModelPart()
Operations to get the pointer to the model.
Definition: solving_strategy.h:350
virtual Parameters ValidateAndAssignParameters(Parameters ThisParameters, const Parameters DefaultParameters) const
This method validate and assign default parameters.
Definition: solving_strategy.h:507
int GetEchoLevel()
This returns the level of echo for the solving strategy.
Definition: solving_strategy.h:271
bool MoveMeshFlag()
This function returns the flag that says if the mesh is moved.
Definition: solving_strategy.h:290
virtual void MoveMesh()
This function is designed to move the mesh.
Definition: solving_strategy.h:330
static void Resize(MatrixType &rA, SizeType m, SizeType n)
Definition: ublas_space.h:558
static void Clear(MatrixPointerType &pA)
Definition: ublas_space.h:578
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_ERROR
Definition: exception.h:161
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
#define KRATOS_INFO_IF(label, conditional)
Definition: logger.h:251
bool Has(const std::string &ModelerName)
Checks if the modeler is registered.
Definition: modeler_factory.cpp:24
double TwoNorm(SparseSpaceType &dummy, SparseSpaceType::VectorType &x)
Definition: add_strategies_to_python.cpp:164
double Dot(SparseSpaceType &dummy, SparseSpaceType::VectorType &rX, SparseSpaceType::VectorType &rY)
Definition: add_strategies_to_python.cpp:85
void UnaliasedAdd(TSpaceType &dummy, typename TSpaceType::VectorType &x, const double A, const typename TSpaceType::VectorType &rY)
Definition: add_strategies_to_python.cpp:170
void Assign(const Expression &rExpression, const IndexType EntityIndex, const IndexType EntityDataBeginIndex, TDataType &rValue, std::index_sequence< TIndex... >)
Definition: variable_expression_data_io.cpp:41
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
model_part
Definition: face_heat.py:14
v
Definition: generate_convection_diffusion_explicit_element.py:114
integer i
Definition: TensorModule.f:17