10 #if !defined(KRATOS_NEWTON_RAPHSON_STRATEGY_H_INCLUDED)
11 #define KRATOS_NEWTON_RAPHSON_STRATEGY_H_INCLUDED
53 template <
class TSparseSpace,
105 typename SchemeType::Pointer pScheme,
106 typename BuilderAndSolverType::Pointer pBuilderAndSolver,
107 typename ConvergenceCriterionType::Pointer pConvergenceCriterion,
109 unsigned int MaxIterations = 30)
110 :
LinearStrategy<TSparseSpace, TDenseSpace, TLinearSolver>(rModelPart, pScheme, pBuilderAndSolver, rOptions)
134 typename SchemeType::Pointer pScheme,
135 typename LinearSolverType::Pointer pLinearSolver,
136 typename ConvergenceCriterionType::Pointer pConvergenceCriterion,
138 unsigned int MaxIterations = 30)
207 unsigned int iteration_number = 1;
227 KRATOS_INFO(
" [Iterative loop interrupted] ") <<
"[" << iteration_number <<
" iterations performed] \n";
230 return (this->
Is(LocalFlagType::CONVERGED));
244 bool is_converged =
false;
248 KRATOS_WARNING(
"DOFS") <<
"solution has zero size, no free DOFs" << std::endl;
256 if(this->
mOptions.
IsNot(LocalFlagType::CONSTANT_SYSTEM_MATRIX)){
258 TSparseSpace::SetToZero((*this->
mpA));
259 TSparseSpace::SetToZero((*this->
mpDx));
260 TSparseSpace::SetToZero((*this->
mpb));
266 TSparseSpace::SetToZero((*this->
mpDx));
267 TSparseSpace::SetToZero((*this->
mpb));
281 if(is_converged ==
true)
290 TSparseSpace::SetToZero((*this->
mpb));
Solution Buider and Solver based on block matrix.
Definition: block_builder_and_solver.hpp:58
Convergence Criterion base class.
Definition: convergence_criterion.hpp:52
void SetValue(const Variable< TDataType > &rThisVariable, TDataType const &rValue)
Sets the value for a given variable.
Definition: data_value_container.h:320
void Set(const Flags ThisFlag)
Definition: flags.cpp:33
bool Is(Flags const &rOther) const
Definition: flags.h:274
bool IsNot(Flags const &rOther) const
Definition: flags.h:291
This is the base linear strategy jacobi / gauss-seidel linear strategies.
Definition: linear_strategy.hpp:55
SchemeType::Pointer mpScheme
Definition: linear_strategy.hpp:427
SystemVectorPointerType mpDx
The pointer to the builder and solver employed.
Definition: linear_strategy.hpp:430
void SetEchoLevel(const int Level) override
This sets the level of echo for the solving strategy.
Definition: linear_strategy.hpp:344
void Update() override
Here the database is updated.
Definition: linear_strategy.hpp:483
void FinalizeSolutionStep() override
Performs all the required operations that should be done (for each step) after solving the solution s...
Definition: linear_strategy.hpp:205
void Initialize() override
Initialization of member variables and prior operations.
Definition: linear_strategy.hpp:445
void Clear() override
Clears the internal storage.
Definition: linear_strategy.hpp:285
BuilderAndSolverType::Pointer mpBuilderAndSolver
The pointer to the time scheme employed.
Definition: linear_strategy.hpp:428
int Check() override
Function to perform expensive checks.
Definition: linear_strategy.hpp:310
SystemVectorPointerType mpb
The incremement in the solution.
Definition: linear_strategy.hpp:431
SystemMatrixPointerType mpA
The RHS vector of the system of equations.
Definition: linear_strategy.hpp:432
void InitializeSolutionStep() override
Performs all the required operations that should be done (for each step) before solving the solution ...
Definition: linear_strategy.hpp:166
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
This is the base Newton Raphson strategy.
Definition: newton_raphson_strategy.hpp:58
BaseType::SystemMatrixPointerType SystemMatrixPointerType
Definition: newton_raphson_strategy.hpp:86
unsigned int GetMaxIterationNumber() override
This method gets the flag mMaxIterationNumber.
Definition: newton_raphson_strategy.hpp:369
BaseType::SystemVectorType SystemVectorType
Definition: newton_raphson_strategy.hpp:84
TLinearSolver LinearSolverType
Definition: newton_raphson_strategy.hpp:76
NewtonRaphsonStrategy(ModelPart &rModelPart, typename SchemeType::Pointer pScheme, typename BuilderAndSolverType::Pointer pBuilderAndSolver, typename ConvergenceCriterionType::Pointer pConvergenceCriterion, Flags &rOptions, unsigned int MaxIterations=30)
Definition: newton_raphson_strategy.hpp:104
LinearStrategy< TSparseSpace, TDenseSpace, TLinearSolver > BaseType
Definition: newton_raphson_strategy.hpp:66
TSparseSpace SparseSpaceType
Definition: newton_raphson_strategy.hpp:78
BaseType::BuilderAndSolverType BuilderAndSolverType
Definition: newton_raphson_strategy.hpp:72
bool SolveIteration() override
Solves the iteration. This function returns true if a solution has been found, false otherwise.
Definition: newton_raphson_strategy.hpp:240
unsigned int mMaxIterationNumber
The pointer to the convergence criteria employed.
Definition: newton_raphson_strategy.hpp:394
~NewtonRaphsonStrategy() override
Destructor.
Definition: newton_raphson_strategy.hpp:147
BaseType::SchemeType SchemeType
Definition: newton_raphson_strategy.hpp:74
BaseType::DofsArrayType DofsArrayType
Definition: newton_raphson_strategy.hpp:80
void Initialize() override
Initialization of member variables and prior operations.
Definition: newton_raphson_strategy.hpp:406
BaseType::LocalFlagType LocalFlagType
Definition: newton_raphson_strategy.hpp:68
int Check() override
Function to perform expensive checks.
Definition: newton_raphson_strategy.hpp:320
void InitializeSolutionStep() override
Performs all the required operations that should be done (for each step) before solving the solution ...
Definition: newton_raphson_strategy.hpp:164
NewtonRaphsonStrategy(ModelPart &rModelPart, typename SchemeType::Pointer pScheme, typename LinearSolverType::Pointer pLinearSolver, typename ConvergenceCriterionType::Pointer pConvergenceCriterion, Flags &rOptions, unsigned int MaxIterations=30)
Definition: newton_raphson_strategy.hpp:133
ConvergenceCriterion< TSparseSpace, TDenseSpace > ConvergenceCriterionType
Definition: newton_raphson_strategy.hpp:70
void SetEchoLevel(const int Level) override
This sets the level of echo for the solving strategy.
Definition: newton_raphson_strategy.hpp:351
bool SolveSolutionStep() override
Solves the current step. This function returns true if a solution has been found, false otherwise.
Definition: newton_raphson_strategy.hpp:202
void Clear() override
Clears the internal storage.
Definition: newton_raphson_strategy.hpp:307
BaseType::SystemMatrixType SystemMatrixType
Definition: newton_raphson_strategy.hpp:82
ConvergenceCriterionType::Pointer mpConvergenceCriteria
Definition: newton_raphson_strategy.hpp:392
BaseType::SystemVectorPointerType SystemVectorPointerType
Definition: newton_raphson_strategy.hpp:88
void SetMaxIterationNumber(unsigned int MaxIterationNumber)
This method sets the flag mMaxIterationNumber.
Definition: newton_raphson_strategy.hpp:360
void FinalizeSolutionStep() override
Performs all the required operations that should be done (for each step) after solving the solution s...
Definition: newton_raphson_strategy.hpp:180
KRATOS_CLASS_POINTER_DEFINITION(NewtonRaphsonStrategy)
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
Solution Buider and Solver base class.
Definition: solution_builder_and_solver.hpp:63
Solution scheme base class.
Definition: solution_scheme.hpp:54
TSparseSpace::VectorPointerType SystemVectorPointerType
Definition: solution_strategy.hpp:63
ModelPart & GetModelPart()
Operations to get the pointer to the model.
Definition: solution_strategy.hpp:243
Flags mOptions
Definition: solution_strategy.hpp:267
TSparseSpace::MatrixPointerType SystemMatrixPointerType
Definition: solution_strategy.hpp:62
TSparseSpace::MatrixType SystemMatrixType
Definition: solution_strategy.hpp:60
TSparseSpace::VectorType SystemVectorType
Definition: solution_strategy.hpp:61
virtual int GetEchoLevel()
This returns the level of echo for the solution strategy.
Definition: solution_strategy.hpp:206
Solver local flags class definition.
Definition: solution_local_flags.hpp:48
static IndexType Size(VectorType const &rV)
return size of vector rV
Definition: ublas_space.h:190
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_INFO(label)
Definition: logger.h:250
#define KRATOS_WARNING(label)
Definition: logger.h:265
ProcessInfo & GetProcessInfo(ModelPart &rModelPart)
Definition: add_model_part_to_python.cpp:54
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
shared_ptr< C > make_shared(Args &&...args)
Definition: smart_pointers.h:40