92class ParallelBiCGStabSolverBackend :
public ParallelBaseBackend<TypeTag>
94 using ParentType = ParallelBaseBackend<TypeTag>;
100 using ParallelOperator =
typename ParentType::ParallelOperator;
101 using OverlappingVector =
typename ParentType::OverlappingVector;
102 using ParallelPreconditioner =
typename ParentType::ParallelPreconditioner;
103 using ParallelScalarProduct =
typename ParentType::ParallelScalarProduct;
105 using MatrixBlock =
typename SparseMatrixAdapter::MatrixBlock;
109 ParallelPreconditioner>;
111 static_assert(std::is_same<SparseMatrixAdapter, IstlSparseMatrixAdapter<MatrixBlock> >::value,
112 "The ParallelIstlSolverBackend linear solver backend requires the IstlSparseMatrixAdapter");
115 explicit ParallelBiCGStabSolverBackend(
const Simulator& simulator)
116 : ParentType(simulator)
124 (
"The maximum residual error which the linear solver tolerates"
125 " without giving up");
131 std::shared_ptr<RawLinearSolver> prepareSolver_(ParallelOperator& parOperator,
132 ParallelScalarProduct& parScalarProduct,
133 ParallelPreconditioner& parPreCond)
135 const auto& gridView = this->simulator_.gridView();
140 if(linearSolverAbsTolerance < 0.0)
141 linearSolverAbsTolerance = this->simulator_.model().newtonMethod().tolerance() / 100.0;
143 convCrit_.reset(
new CCC(gridView.comm(),
144 linearSolverTolerance,
145 linearSolverAbsTolerance,
148 auto bicgstabSolver =
149 std::make_shared<RawLinearSolver>(parPreCond, *convCrit_, parScalarProduct);
152 if (parOperator.overlap().myRank() == 0)
154 bicgstabSolver->setVerbosity(verbosity);
156 bicgstabSolver->setLinearOperator(&parOperator);
157 bicgstabSolver->setRhs(this->overlappingb_);
159 return bicgstabSolver;
162 std::pair<bool,int> runSolver_(std::shared_ptr<RawLinearSolver> solver)
164 bool converged = solver->apply(*this->overlappingx_);
165 return std::make_pair(converged,
int(solver->report().iterations()));
168 void cleanupSolver_()
171 std::unique_ptr<ConvergenceCriterion<OverlappingVector> > convCrit_;
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition propertysystem.hh:233
auto Get(bool errorIfNotRegistered=true)
Retrieve a runtime parameter.
Definition parametersystem.hpp:187