10 #if !defined(KRATOS_SEGREGATED_STRATEGY_H_INCLUDED)
11 #define KRATOS_SEGREGATED_STRATEGY_H_INCLUDED
54 template <
class TSparseSpace,
99 :
SolutionStrategy<TSparseSpace, TDenseSpace, TLinearSolver>(rModelPart, rOptions)
115 :
SolutionStrategy<TSparseSpace, TDenseSpace, TLinearSolver>(rModelPart, rOptions)
159 (*it)->InitializeSolutionStep();
183 (*it)->FinalizeSolutionStep();
201 unsigned int iteration_number = 1;
207 unsigned int MaxIterationNumber = 1;
210 if(MaxIterationNumber < (*it)->GetMaxIterationNumber())
211 MaxIterationNumber = (*it)->GetMaxIterationNumber();
220 while( this->
IsNot(LocalFlagType::CONVERGED) && ++iteration_number < MaxIterationNumber)
229 if(iteration_number >= MaxIterationNumber)
232 KRATOS_INFO(
" [Iterative loop interrupted] ") <<
"[" << iteration_number <<
" iterations performed] \n";
235 return (this->
Is(LocalFlagType::CONVERGED));
250 std::vector<bool> convergences(
mStrategies.size());
251 std::fill(convergences.begin(), convergences.end(),
false);
257 convergences[
counter] = (*it)->SolveIteration();
261 bool convergence = std::all_of(convergences.begin(), convergences.end(), [](
bool const n){return n == true;});
262 if(convergence ==
true){
267 return (convergence);
333 (*it)->SetEchoLevel(Level);
This is the base class to define the different convergence criterion considered.
Definition: convergence_criteria.h:58
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 class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
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 class for a segregated strategy for the same model part.
Definition: segregated_strategy.hpp:59
BaseType::LocalFlagType LocalFlagType
Definition: segregated_strategy.hpp:69
void Clear() override
Clears the internal storage.
Definition: segregated_strategy.hpp:276
void InitializeSolutionStep() override
Performs all the required operations that should be done (for each step) before solving the solution ...
Definition: segregated_strategy.hpp:144
std::vector< BasePointerType > StrategiesContainerType
Definition: segregated_strategy.hpp:71
KRATOS_CLASS_POINTER_DEFINITION(SegregatedStrategy)
BaseType::SystemMatrixPointerType SystemMatrixPointerType
Definition: segregated_strategy.hpp:84
StrategiesContainerType mStrategies
Definition: segregated_strategy.hpp:375
~SegregatedStrategy() override
Destructor.
Definition: segregated_strategy.hpp:127
BaseType::SystemMatrixType SystemMatrixType
Definition: segregated_strategy.hpp:82
void SetEchoLevel(const int Level) override
This sets the level of echo for the solving strategy.
Definition: segregated_strategy.hpp:328
TLinearSolver LinearSolverType
Definition: segregated_strategy.hpp:78
BaseType::SystemVectorType SystemVectorType
Definition: segregated_strategy.hpp:83
StrategiesContainerType::iterator StrategiesContainerIteratorType
Definition: segregated_strategy.hpp:72
SolutionStrategy< TSparseSpace, TDenseSpace, TLinearSolver > BaseType
Definition: segregated_strategy.hpp:67
SegregatedStrategy(ModelPart &rModelPart, Flags &rOptions)
Definition: segregated_strategy.hpp:97
BasePointerType GetStrategy(unsigned int Label)
Get method for the time scheme.
Definition: segregated_strategy.hpp:351
int Check() override
Function to perform expensive checks.
Definition: segregated_strategy.hpp:295
BaseType::BuilderAndSolverType BuilderAndSolverType
Definition: segregated_strategy.hpp:75
BaseType::Pointer BasePointerType
Definition: segregated_strategy.hpp:68
void AddStrategy(const BasePointerType pStrategy)
Set method for the time scheme.
Definition: segregated_strategy.hpp:342
bool SolveSolutionStep() override
Solves the current step. This function returns true if a solution has been found, false otherwise.
Definition: segregated_strategy.hpp:196
BaseType::SystemVectorPointerType SystemVectorPointerType
Definition: segregated_strategy.hpp:85
void FinalizeSolutionStep() override
Performs all the required operations that should be done (for each step) after solving the solution s...
Definition: segregated_strategy.hpp:169
ConvergenceCriteria< TSparseSpace, TDenseSpace > ConvergenceCriterionType
Definition: segregated_strategy.hpp:74
bool SolveIteration() override
Solves the iteration. This function returns true if a solution has been found, false otherwise.
Definition: segregated_strategy.hpp:245
BaseType::DofsArrayType DofsArrayType
Definition: segregated_strategy.hpp:81
TSparseSpace SparseSpaceType
Definition: segregated_strategy.hpp:79
SegregatedStrategy(ModelPart &rModelPart, Flags &rOptions, StrategiesContainerType &rStrategies)
Definition: segregated_strategy.hpp:112
BaseType::SchemeType SchemeType
Definition: segregated_strategy.hpp:76
Solution Buider and Solver base class.
Definition: solution_builder_and_solver.hpp:63
Solution scheme base class.
Definition: solution_scheme.hpp:54
Solution strategy base class.
Definition: solution_strategy.hpp:52
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 void SetEchoLevel(const int Level)
This sets the level of echo for the solution strategy.
Definition: solution_strategy.hpp:190
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
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_INFO(label)
Definition: logger.h:250
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
int n
manufactured solution and derivatives (u=0 at z=0 dudz=0 at z=domain_height)
Definition: ode_solve.py:402
int counter
Definition: script_THERMAL_CORRECT.py:218