14 #if !defined(KRATOS_GAUSS_SEIDEL_LINEAR_STRATEGY)
15 #define KRATOS_GAUSS_SEIDEL_LINEAR_STRATEGY
20 #include "boost/smart_ptr.hpp"
77 template <
class TSparseSpace,
125 typename TSchemeType::Pointer pScheme,
126 typename TLinearSolver::Pointer pNewLinearSolver,
127 typename TBuilderAndSolverType::Pointer pNewBuilderAndSolver,
128 bool ReformDofSetAtEachStep =
true,
129 bool CalculateNormDxFlag =
false)
136 mReformDofSetAtEachStep = ReformDofSetAtEachStep;
137 mCalculateNormDxFlag = CalculateNormDxFlag;
143 mpLinearSolver = pNewLinearSolver;
146 mpBuilderAndSolver = pNewBuilderAndSolver;
149 mInitializeWasPerformed =
false;
153 mReformDofSetAtEachStep =
true;
194 mpBuilderAndSolver = pNewBuilderAndSolver;
199 return mpBuilderAndSolver;
204 mReformDofSetAtEachStep = flag;
205 mReformDofSetAtEachStep =
true;
211 return mReformDofSetAtEachStep;
272 typename TSchemeType::Pointer pScheme =
GetScheme();
281 TSparseSpace::SetToZero(mA);
282 TSparseSpace::SetToZero(mDx);
283 TSparseSpace::SetToZero(
mb);
292 TSparseSpace::SetToZero(mDx);
293 TSparseSpace::SetToZero(
mb);
299 std::cout <<
"SystemMatrix = " << mA << std::endl;
300 std::cout <<
"solution obtained = " << mDx << std::endl;
301 std::cout <<
"RHS = " <<
mb << std::endl;
306 std::stringstream matrix_market_name;
310 std::stringstream matrix_market_vectname;
323 double normDx = 0.00;
324 if (mCalculateNormDxFlag ==
true)
441 typename TLinearSolver::Pointer mpLinearSolver;
443 typename TSchemeType::Pointer mpScheme;
445 typename TBuilderAndSolverType::Pointer mpBuilderAndSolver;
459 bool mReformDofSetAtEachStep;
462 bool mCalculateNormDxFlag;
469 bool mInitializeWasPerformed;
471 unsigned int mMaxIterationNumber;
479 void Initialize()
override
484 std::cout <<
"entering in the Initialize of the GaussSeidelLinearStrategy" << std::endl;
487 typename TSchemeType::Pointer pScheme =
GetScheme();
490 if (pScheme->SchemeIsInitialized() ==
false)
494 if (pScheme->ElementsAreInitialized() ==
false)
498 if (pScheme->ConditionsAreInitialized() ==
false)
502 std::cout <<
"exiting the Initialize of the GaussSeidelLinearStrategy" << std::endl;
510 void InitializeSolutionStep()
override
515 typename TSchemeType::Pointer pScheme =
GetScheme();
522 if (mInitializeWasPerformed ==
false)
525 mInitializeWasPerformed =
true;
561 void MaxIterationsExceeded()
563 std::cout <<
"***************************************************" << std::endl;
564 std::cout <<
"******* ATTENTION: max iterations exceeded ********" << std::endl;
565 std::cout <<
"***************************************************" << std::endl;
571 void Clear()
override
Short class definition.
Definition: gauss_seidel_linear_strategy.h:83
BaseType::DofsArrayType DofsArrayType
Definition: gauss_seidel_linear_strategy.h:100
void SetScheme(typename TSchemeType::Pointer pScheme)
Definition: gauss_seidel_linear_strategy.h:180
BaseType::TSystemMatrixPointerType TSystemMatrixPointerType
Definition: gauss_seidel_linear_strategy.h:110
BaseType::TBuilderAndSolverType TBuilderAndSolverType
Definition: gauss_seidel_linear_strategy.h:98
TSparseSpace SparseSpaceType
Definition: gauss_seidel_linear_strategy.h:95
TSystemMatrixType & GetSystemMatrix() override
This method returns the LHS matrix.
Definition: gauss_seidel_linear_strategy.h:344
BaseType::TSchemeType TSchemeType
Definition: gauss_seidel_linear_strategy.h:97
BaseType::LocalSystemMatrixType LocalSystemMatrixType
Definition: gauss_seidel_linear_strategy.h:108
BaseType::TSystemMatrixType TSystemMatrixType
Definition: gauss_seidel_linear_strategy.h:102
void CalculateOutputData() override
Definition: gauss_seidel_linear_strategy.h:368
KRATOS_CLASS_POINTER_DEFINITION(GaussSeidelLinearStrategy)
BaseType::LocalSystemVectorType LocalSystemVectorType
Definition: gauss_seidel_linear_strategy.h:106
BaseType::TDataType TDataType
Definition: gauss_seidel_linear_strategy.h:93
virtual ~GaussSeidelLinearStrategy()
Definition: gauss_seidel_linear_strategy.h:167
GaussSeidelLinearStrategy(ModelPart &model_part, typename TSchemeType::Pointer pScheme, typename TLinearSolver::Pointer pNewLinearSolver, typename TBuilderAndSolverType::Pointer pNewBuilderAndSolver, bool ReformDofSetAtEachStep=true, bool CalculateNormDxFlag=false)
Definition: gauss_seidel_linear_strategy.h:123
bool GetReformDofSetAtEachStepFlag()
Definition: gauss_seidel_linear_strategy.h:209
BaseType::TSystemVectorType TSystemVectorType
Definition: gauss_seidel_linear_strategy.h:104
ImplicitSolvingStrategy< TSparseSpace, TDenseSpace, TLinearSolver > BaseType
Definition: gauss_seidel_linear_strategy.h:91
void SetEchoLevel(int Level) override
This sets the level of echo for the solving strategy.
Definition: gauss_seidel_linear_strategy.h:221
void SetReformDofSetAtEachStepFlag(bool flag)
Definition: gauss_seidel_linear_strategy.h:202
void SetBuilderAndSolver(typename TBuilderAndSolverType::Pointer pNewBuilderAndSolver)
Definition: gauss_seidel_linear_strategy.h:192
double GetResidualNorm() override
Operations to get the residual norm.
Definition: gauss_seidel_linear_strategy.h:352
TSchemeType::Pointer GetScheme()
Definition: gauss_seidel_linear_strategy.h:185
double Solve() override
Definition: gauss_seidel_linear_strategy.h:267
BaseType::TSystemVectorPointerType TSystemVectorPointerType
Definition: gauss_seidel_linear_strategy.h:111
TBuilderAndSolverType::Pointer GetBuilderAndSolver()
Definition: gauss_seidel_linear_strategy.h:197
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
int mRebuildLevel
Definition: implicit_solving_strategy.h:263
bool mStiffnessMatrixIsBuilt
The current rebuild level.
Definition: implicit_solving_strategy.h:264
BuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver > TBuilderAndSolverType
Definition: implicit_solving_strategy.h:84
BaseType::TSystemMatrixType TSystemMatrixType
Definition: implicit_solving_strategy.h:70
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
TSparseSpace::VectorPointerType TSystemVectorPointerType
Definition: solving_strategy.h:77
TDenseSpace::MatrixType LocalSystemMatrixType
Definition: solving_strategy.h:79
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
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
TSparseSpace::VectorType TSystemVectorType
Definition: solving_strategy.h:73
TDenseSpace::VectorType LocalSystemVectorType
Definition: solving_strategy.h:81
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
double TwoNorm(SparseSpaceType &dummy, SparseSpaceType::VectorType &x)
Definition: add_strategies_to_python.cpp:164
TSpaceType::IndexType Size(TSpaceType &dummy, typename TSpaceType::VectorType const &rV)
Definition: add_strategies_to_python.cpp:111
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
bool WriteMatrixMarketVector(const char *FileName, VectorType &V)
Definition: matrix_market_interface.h:539
bool WriteMatrixMarketMatrix(const char *FileName, CompressedMatrixType &M, bool Symmetric)
Definition: matrix_market_interface.h:308
model_part
Definition: face_heat.py:14
double precision function mb(a)
Definition: TensorModule.f:849