15#ifndef dealii_solver_qmrs_h
16#define dealii_solver_qmrs_h
93template <
typename VectorType = Vector<
double>>
131 const double solver_tolerance = 1.e-9,
132 const bool breakdown_testing =
true,
133 const double breakdown_threshold = 1.e-16)
134 : left_preconditioning(left_preconditioning)
135 , solver_tolerance(solver_tolerance)
136 , breakdown_testing(breakdown_testing)
137 , breakdown_threshold(breakdown_threshold)
178 template <
typename MatrixType,
typename PreconditionerType>
182 void solve(const MatrixType &A,
185 const PreconditionerType &preconditioner);
193 print_vectors(const
unsigned int step,
196 const VectorType &d) const;
215 const double last_residual);
222 template <
typename MatrixType,
typename PreconditionerType>
227 const PreconditionerType &preconditioner,
246template <
typename VectorType>
250 const double last_residual)
252 , last_residual(last_residual)
257template <
typename VectorType>
261 const AdditionalData &
data)
263 , additional_data(
data)
269template <
typename VectorType>
272 const AdditionalData &
data)
274 , additional_data(
data)
280template <
typename VectorType>
285 const VectorType &)
const
290template <
typename VectorType>
292template <
typename MatrixType,
typename PreconditionerType>
299 const PreconditionerType &preconditioner)
329 deallog <<
"Restart step " << step << std::endl;
330 state = iterate(A, x, b, preconditioner, *Vr, *Vu, *Vq, *Vt, *Vd);
343template <
typename VectorType>
345template <
typename MatrixType,
typename PreconditionerType>
350 const PreconditionerType &preconditioner,
361 double tau, rho, theta = 0;
369 if (additional_data.left_preconditioning)
372 preconditioner.vmult(t, r);
379 preconditioner.vmult(q, t);
398 const double sigma = q * t;
401 if (additional_data.breakdown_testing ==
true &&
402 std::fabs(sigma) < additional_data.breakdown_threshold)
405 const double alpha = rho / sigma;
411 const double theta_old = theta;
414 if (additional_data.left_preconditioning)
417 preconditioner.vmult(t, r);
427 const double psi = 1. / (1. + theta);
431 d.sadd(psi * theta_old, psi * alpha, q);
434 print_vectors(step, x, r, d);
442 if (res < additional_data.solver_tolerance)
448 state = this->iteration_status(step, res, x);
451 return IterationResult(state, res);
456 if (additional_data.breakdown_testing ==
true &&
457 std::fabs(sigma) < additional_data.breakdown_threshold)
460 const double rho_old = rho;
463 if (additional_data.left_preconditioning)
471 preconditioner.vmult(u, t);
476 const double beta = rho / rho_old;
@ iterate
Continue iteration.
@ success
Stop iteration, goal reached.
@ failure
Stop iteration, goal not reached.
virtual void print_vectors(const unsigned int step, const VectorType &x, const VectorType &r, const VectorType &d) const
IterationResult iterate(const MatrixType &A, VectorType &x, const VectorType &b, const PreconditionerType &preconditioner, VectorType &r, VectorType &u, VectorType &q, VectorType &t, VectorType &d)
void solve(const MatrixType &A, VectorType &x, const VectorType &b, const PreconditionerType &preconditioner)
SolverQMRS(SolverControl &cn, VectorMemory< VectorType > &mem, const AdditionalData &data=AdditionalData())
SolverQMRS(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)
std::vector< index_type > data
Tpetra::Vector< Number, LO, GO, NodeType< MemorySpace > > VectorType
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
::VectorizedArray< Number, width > sqrt(const ::VectorizedArray< Number, width > &)
double breakdown_threshold
AdditionalData(const bool left_preconditioning=false, const double solver_tolerance=1.e-9, const bool breakdown_testing=true, const double breakdown_threshold=1.e-16)
bool left_preconditioning
SolverControl::State state
IterationResult(const SolverControl::State state, const double last_residual)