15#ifndef dealii_solver_richardson_h
16#define dealii_solver_richardson_h
63template <
typename VectorType = Vector<
double>>
77 const bool use_preconditioned_residual =
false);
112 template <
typename MatrixType,
typename PreconditionerType>
116 void solve(const MatrixType &A,
119 const PreconditionerType &preconditioner);
124 template <typename MatrixType, typename PreconditionerType>
126 (
concepts::is_transpose_linear_operator_on<MatrixType, VectorType> &&
127 concepts::is_transpose_linear_operator_on<PreconditionerType, VectorType>))
128 void Tsolve(const MatrixType &A,
131 const PreconditionerType &preconditioner);
137 set_omega(const
double om = 1.);
145 print_vectors(const
unsigned int step,
148 const VectorType &d) const;
157 virtual typename VectorType::value_type
158 criterion(const VectorType &r, const VectorType &d) const;
171template <
typename VectorType>
175 const bool use_preconditioned_residual)
177 , use_preconditioned_residual(use_preconditioned_residual)
181template <
typename VectorType>
185 const AdditionalData &data)
187 , additional_data(data)
192template <
typename VectorType>
195 const AdditionalData &data)
197 , additional_data(data)
202template <
typename VectorType>
204template <
typename MatrixType,
typename PreconditionerType>
212 const PreconditionerType &preconditioner)
216 double last_criterion = std::numeric_limits<double>::lowest();
218 unsigned int iter = 0;
240 preconditioner.vmult(d, r);
244 last_criterion = criterion(r, d);
245 conv = this->iteration_status(iter, last_criterion, x);
249 x.add(additional_data.
omega, d);
250 print_vectors(iter, x, r, d);
263template <
typename VectorType>
265template <
typename MatrixType,
typename PreconditionerType>
273 const PreconditionerType &preconditioner)
276 double last_criterion = std::numeric_limits<double>::lowest();
278 unsigned int iter = 0;
300 preconditioner.Tvmult(d, r);
302 last_criterion = criterion(r, d);
303 conv = this->iteration_status(iter, last_criterion, x);
307 x.add(additional_data.
omega, d);
308 print_vectors(iter, x, r, d);
322template <
typename VectorType>
327 const VectorType &)
const
332template <
typename VectorType>
334inline typename VectorType::value_type
336 const VectorType &d)
const
345template <
typename VectorType>
349 additional_data.
omega = om;
@ iterate
Continue iteration.
@ success
Stop iteration, goal reached.
virtual void print_vectors(const unsigned int step, const VectorType &x, const VectorType &r, const VectorType &d) const
void solve(const MatrixType &A, VectorType &x, const VectorType &b, const PreconditionerType &preconditioner)
void set_omega(const double om=1.)
SolverRichardson(SolverControl &cn, VectorMemory< VectorType > &mem, const AdditionalData &data=AdditionalData())
void Tsolve(const MatrixType &A, VectorType &x, const VectorType &b, const PreconditionerType &preconditioner)
virtual ~SolverRichardson() override=default
virtual VectorType::value_type criterion(const VectorType &r, const VectorType &d) const
SolverRichardson(SolverControl &cn, const AdditionalData &data=AdditionalData())
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_CXX20_REQUIRES(condition)
#define DEAL_II_NAMESPACE_CLOSE
#define AssertThrow(cond, exc)
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
AdditionalData(const double omega=1, const bool use_preconditioned_residual=false)
bool use_preconditioned_residual