version 3.11-dev
Loading...
Searching...
No Matches
preconditioners.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3//
4// SPDX-FileCopyrightText: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
12#ifndef DUMUX_LINEAR_PRECONDITIONERS_HH
13#define DUMUX_LINEAR_PRECONDITIONERS_HH
14
15#include <dune/common/exceptions.hh>
16#include <dune/common/version.hh>
17#include <dune/common/float_cmp.hh>
18#include <dune/common/indices.hh>
19#include <dune/istl/preconditioners.hh>
20#include <dune/istl/paamg/amg.hh>
21#include <dune/istl/gsetc.hh>
22
23#if HAVE_UMFPACK
24#include <dune/istl/umfpack.hh>
25#endif
26
32
33namespace Dumux {
34
69template<class M, class X, class Y, int l = 1>
70class SeqUzawa : public Dune::Preconditioner<X,Y>
71{
72 static_assert(Dumux::isMultiTypeBlockMatrix<M>::value && M::M() == 2 && M::N() == 2, "SeqUzawa expects a 2x2 MultiTypeBlockMatrix.");
73 static_assert(l== 1, "SeqUzawa expects a block level of 1.");
74
75 using A = std::decay_t<decltype(std::declval<M>()[Dune::Indices::_0][Dune::Indices::_0])>;
76 using U = std::decay_t<decltype(std::declval<X>()[Dune::Indices::_0])>;
77
78 using Comm = Dune::Amg::SequentialInformation;
79 using LinearOperator = Dune::MatrixAdapter<A, U, U>;
80 using Smoother = Dune::SeqSSOR<A, U, U>;
81 using AMGSolverForA = Dune::Amg::AMG<LinearOperator, U, Smoother, Comm>;
82
83public:
85 using matrix_type = M;
87 using domain_type = X;
89 using range_type = Y;
91 using field_type = typename X::field_type;
93 using scalar_field_type = Dune::Simd::Scalar<field_type>;
94
101 SeqUzawa(const std::shared_ptr<const Dune::AssembledLinearOperator<M,X,Y>>& op, const Dune::ParameterTree& params)
102 : matrix_(op->getmat())
103 , numIterations_(params.get<std::size_t>("iterations"))
104 , relaxationFactor_(params.get<scalar_field_type>("relaxation"))
105 , verbosity_(params.get<int>("verbosity"))
106 , paramGroup_(params.get<std::string>("ParameterGroup"))
107 , useDirectVelocitySolverForA_(getParamFromGroup<bool>(paramGroup_, "LinearSolver.Preconditioner.DirectSolverForA", false))
108 {
109 const bool determineRelaxationFactor = getParamFromGroup<bool>(paramGroup_, "LinearSolver.Preconditioner.DetermineRelaxationFactor", true);
110
111 // AMG is needed for determination of omega
112 if (determineRelaxationFactor || !useDirectVelocitySolverForA_)
113 initAMG_(params);
114
115 if (useDirectVelocitySolverForA_)
116 initUMFPack_();
117
118 if (determineRelaxationFactor)
119 relaxationFactor_ = estimateOmega_();
120 }
121
125 virtual void pre(X& x, Y& b) {}
126
133 virtual void apply(X& update, const Y& currentDefect)
134 {
135 using namespace Dune::Indices;
136
137 auto& A = matrix_[_0][_0];
138 auto& B = matrix_[_0][_1];
139 auto& C = matrix_[_1][_0];
140 auto& D = matrix_[_1][_1];
141
142 const auto& f = currentDefect[_0];
143 const auto& g = currentDefect[_1];
144 auto& u = update[_0];
145 auto& p = update[_1];
146
147 // incorporate Dirichlet cell values
148 // TODO: pass Dirichlet constraint handler from outside
149 for (std::size_t i = 0; i < D.N(); ++i)
150 {
151 const auto& block = D[i][i];
152 for (auto rowIt = block.begin(); rowIt != block.end(); ++rowIt)
153 if (Dune::FloatCmp::eq<scalar_field_type>(rowIt->one_norm(), 1.0))
154 p[i][rowIt.index()] = g[i][rowIt.index()];
155 }
156
157 // the actual Uzawa iteration
158 for (std::size_t k = 0; k < numIterations_; ++k)
159 {
160 // u_k+1 = u_k + Q_A^−1*(f − (A*u_k + B*p_k)),
161 auto uRhs = f;
162 A.mmv(u, uRhs);
163 B.mmv(p, uRhs);
164 auto uIncrement = u;
165 applySolverForA_(uIncrement, uRhs);
166 u += uIncrement;
167
168 // p_k+1 = p_k + omega*(g - C*u_k+1 - D*p_k)
169 auto pIncrement = g;
170 C.mmv(u, pIncrement);
171 D.mmv(p, pIncrement);
172 pIncrement *= relaxationFactor_;
173 p += pIncrement;
174
175 if (verbosity_ > 1)
176 {
177 std::cout << "Uzawa iteration " << k
178 << ", residual: " << uRhs.two_norm() + pIncrement.two_norm()/relaxationFactor_ << std::endl;
179 }
180 }
181 }
182
186 virtual void post(X& x) {}
187
189 virtual Dune::SolverCategory::Category category() const
190 {
191 return Dune::SolverCategory::sequential;
192 }
193
194private:
195
196 void initAMG_(const Dune::ParameterTree& params)
197 {
198 using namespace Dune::Indices;
199 auto linearOperator = std::make_shared<LinearOperator>(matrix_[_0][_0]);
200 amgSolverForA_ = std::make_unique<AMGSolverForA>(linearOperator, params);
201 }
202
203 void initUMFPack_()
204 {
205#if HAVE_UMFPACK
206 using namespace Dune::Indices;
207 umfPackSolverForA_ = std::make_unique<Dune::UMFPack<A>>(matrix_[_0][_0]);
208#else
209 DUNE_THROW(Dune::InvalidStateException, "UMFPack not available. Use LinearSolver.Preconditioner.DirectVelocitySolver = false.");
210#endif
211 }
212
232 scalar_field_type estimateOmega_() const
233 {
234 using namespace Dune::Indices;
235 auto& A = matrix_[_0][_0];
236 auto& B = matrix_[_0][_1];
237 auto& C = matrix_[_1][_0];
238
239 U x(B.M());
240 x = 1.0;
241
242 scalar_field_type omega = 0.0;
243 scalar_field_type lambdaMax = 0.0;
244
245 static const auto iterations = Dumux::getParamFromGroup<std::size_t>(paramGroup_, "LinearSolver.Preconditioner.PowerLawIterations", 5);
246
247 // apply power iteration x_k+1 = M*x_k/|M*x_k| for the matrix M = -C*Ainv*B
248 for (std::size_t i = 0; i < iterations; ++i)
249 {
250 // bx = B*x
251 U bx(B.N());
252 B.mv(x, bx);
253
254 // ainvbx = Ainv*(B*x)
255 U ainvbx(A.M());
256 applySolverForA_(ainvbx, bx);
257
258 // v = M*x = -C*(Ainv*B*x)
259 U v(C.N());
260 C.mv(ainvbx, v);
261 v *= -1.0;
262
263 // eigenvalue lambdaMax = xt*M*x/(xt*x) = xt*v/(xt*x);
264 lambdaMax = x.dot(v)/(x.dot(x));
265
266 // relaxation factor omega = 1/lambda;
267 omega = 1.0/lambdaMax;
268
269 // new iterate x = M*x/|M*x| = v/|v|
270 x = v;
271 x /= v.two_norm();
272 }
273
274 if (verbosity_ > 0)
275 {
276 std::cout << "\n*** Uzawa Preconditioner ***" << std::endl;
277 std::cout << "Estimating relaxation factor based on Schur complement" << std::endl;
278 std::cout << "Largest estimated eigenvalue lambdaMax = " << lambdaMax << std::endl;
279 std::cout << "Relaxation factor omega = 1/lambdaMax = " << omega << std::endl;
280 }
281
282 return omega;
283 }
284
285 template<class Sol, class Rhs>
286 void applySolverForA_(Sol& sol, Rhs& rhs) const
287 {
288 if (useDirectVelocitySolverForA_)
289 {
290#if HAVE_UMFPACK
291 Dune::InverseOperatorResult res;
292 umfPackSolverForA_->apply(sol, rhs, res);
293#endif
294 }
295 else
296 {
297 amgSolverForA_->pre(sol, rhs);
298 amgSolverForA_->apply(sol, rhs);
299 amgSolverForA_->post(sol);
300 }
301 }
302
304 const M& matrix_;
306 const std::size_t numIterations_;
308 scalar_field_type relaxationFactor_;
310 const int verbosity_;
311
312 std::unique_ptr<AMGSolverForA> amgSolverForA_;
313#if HAVE_UMFPACK
314 std::unique_ptr<Dune::UMFPack<A>> umfPackSolverForA_;
315#endif
316 const std::string paramGroup_;
317 const bool useDirectVelocitySolverForA_;
318};
319
320#if DUNE_VERSION_LT(DUNE_ISTL,2,11)
321DUMUX_REGISTER_PRECONDITIONER("uzawa", Dumux::MultiTypeBlockMatrixPreconditionerTag, Dune::defaultPreconditionerBlockLevelCreator<Dumux::SeqUzawa, 1>());
322#else
323namespace Detail {
324
331{
332 return [](auto opInfo, const auto& linearOperator, const Dune::ParameterTree& config)
333 {
334 using OpInfo = std::decay_t<decltype(opInfo)>;
335 using Matrix = typename OpInfo::matrix_type;
336 using Domain = typename OpInfo::domain_type;
337 using Range = typename OpInfo::range_type;
338 std::shared_ptr<Dune::Preconditioner<Domain, Range>> preconditioner;
339 if constexpr (OpInfo::isAssembled)
340 preconditioner = std::make_shared<SeqUzawa<Matrix, Domain, Range>>(opInfo.getAssembledOpOrThrow(linearOperator), config);
341 else
342 DUNE_THROW(Dune::NoAssembledOperator, "The Uzawa preconditioner requires an assembled linear operator.");
343 return preconditioner;
344 };
345}
346
347} // end namespace Detail
348
349DUMUX_REGISTER_PRECONDITIONER("uzawa", Dumux::MultiTypeBlockMatrixPreconditionerTag, Dumux::Detail::uzawaPreconditionerCreator());
350#endif
351
352
360template<class M, class X, class Y, int l=1>
361class ParMTJac : public Dune::Preconditioner<X,Y>
362{
363public:
365 typedef M matrix_type;
367 typedef X domain_type;
369 typedef Y range_type;
371 typedef typename X::field_type field_type;
373 typedef Dune::Simd::Scalar<field_type> scalar_field_type;
375 typedef typename Dune::FieldTraits<scalar_field_type>::real_type real_field_type;
376
378 ParMTJac (const M& A, int n, real_field_type w)
379 : _A_(A), numSteps_(n), relaxationFactor_(w)
380 { Dune::CheckIfDiagonalPresent<M,l>::check(_A_); }
381
382 ParMTJac (const std::shared_ptr<const Dune::AssembledLinearOperator<M,X,Y>>& A, const Dune::ParameterTree& configuration)
383 : ParMTJac(A->getmat(), configuration)
384 {}
385
386 ParMTJac (const M& A, const Dune::ParameterTree& configuration)
387 : ParMTJac(A, configuration.get<int>("iterations",1), configuration.get<real_field_type>("relaxation",1.0))
388 {}
389
390 void pre (X&, Y&) override {}
391
392 void apply (X& update, const Y& defect) override
393 {
394 X xOld(update);
395 const auto& A = _A_;
396
397 for (int k=0; k<numSteps_; k++)
398 {
399 if (k > 0)
400 xOld = update;
401
402 Dumux::parallelFor(A.N(), [&](const std::size_t i)
403 {
404 auto& row = A[i];
405 auto v = update[i];
406 auto rhs = defect[i];
407 const auto endColIt = row.end();
408 auto colIt = row.begin();
409
410 for (; colIt.index()<i; ++colIt)
411 colIt->mmv(xOld[colIt.index()], rhs);
412 const auto diag = colIt;
413 for (; colIt != endColIt; ++colIt)
414 colIt->mmv(xOld[colIt.index()], rhs);
415
416 Dune::algmeta_itsteps<l-1, typename M::block_type>::dbjac(
417 *diag, v, rhs, relaxationFactor_
418 );
419
420 update[i].axpy(relaxationFactor_, v);
421 });
422 }
423 }
424
425 void post (X&) override {}
426
428 Dune::SolverCategory::Category category() const override
429 { return Dune::SolverCategory::sequential; }
430
431private:
432 const M& _A_;
433 int numSteps_;
434 real_field_type relaxationFactor_;
435};
436
437DUMUX_REGISTER_PRECONDITIONER("par_mt_jac", Dune::PreconditionerTag, Dune::defaultPreconditionerBlockLevelCreator<Dumux::ParMTJac>());
438
439
441
442// compute coloring for parallel sweep
443template<class M>
444void computeColorsForMatrixSweep_(const M& matrix, std::deque<std::vector<std::size_t>>& coloredIndices)
445{
446 // allocate some temporary memory
447 std::vector<int> colors(matrix.N(), -1);
448 std::vector<int> neighborColors; neighborColors.reserve(30);
449 std::vector<bool> colorUsed; colorUsed.reserve(30);
450
451 // a row that has my row index in their column set cannot have the same color
452 // TODO this assumes a symmetric matrix pattern
453 for (std::size_t i = 0; i < colors.size(); ++i)
454 {
455 neighborColors.clear();
456 auto& row = matrix[i];
457 const auto endColIt = row.end();
458 for (auto colIt = row.begin(); colIt != endColIt; ++colIt)
459 neighborColors.push_back(colors[colIt.index()]);
460
461 const auto c = Detail::smallestAvailableColor(neighborColors, colorUsed);
462 colors[i] = c;
463
464 // add element to the set of elements with the same color
465 if (c < coloredIndices.size())
466 coloredIndices[c].push_back(i);
467 else
468 coloredIndices.emplace_back(1, i);
469 }
470}
471
472// parallel SOR kernel (relaxed Gauss-Seidel)
473template<bool forward, int l, class M, class X, class Y, class K>
474void parallelBlockSOR_(const M& A, X& update, const Y& b, const K& relaxationFactor,
475 const std::deque<std::vector<std::size_t>>& coloredIndices)
476{
477 for (int color = 0; color < coloredIndices.size(); ++color)
478 {
479 const auto c = forward ? color : coloredIndices.size()-1-color;
480 const auto& rowIndices = coloredIndices[c];
481 Dumux::parallelFor(rowIndices.size(), [&](const std::size_t k)
482 {
483 const auto i = rowIndices[k];
484 auto& row = A[i];
485 auto v = update[i];
486 auto rhs = b[i];
487 const auto endColIt = row.end();
488 auto colIt = row.begin();
489
490 for (; colIt.index()<i; ++colIt)
491 colIt->mmv(update[colIt.index()], rhs);
492 const auto diag = colIt;
493 for (; colIt != endColIt; ++colIt)
494 colIt->mmv(update[colIt.index()], rhs);
495
496 if constexpr (forward)
497 Dune::algmeta_itsteps<l-1,typename M::block_type>::bsorf(
498 *diag, v, rhs, relaxationFactor
499 );
500 else
501 Dune::algmeta_itsteps<l-1,typename M::block_type>::bsorb(
502 *diag, v, rhs, relaxationFactor
503 );
504
505 update[i].axpy(relaxationFactor, v);
506 });
507 }
508}
509
510} // end namespace Detail
511
519template<class M, class X, class Y, int l=1>
520class ParMTSOR : public Dune::Preconditioner<X,Y>
521{
522public:
524 typedef M matrix_type;
526 typedef X domain_type;
528 typedef Y range_type;
530 typedef typename X::field_type field_type;
532 typedef Dune::Simd::Scalar<field_type> scalar_field_type;
534 typedef typename Dune::FieldTraits<scalar_field_type>::real_type real_field_type;
535
537 ParMTSOR (const M& A, int n, real_field_type w)
538 : _A_(A), numSteps_(n), relaxationFactor_(w)
539 {
540 Dune::CheckIfDiagonalPresent<M,l>::check(_A_);
542 }
543
544 ParMTSOR (const std::shared_ptr<const Dune::AssembledLinearOperator<M,X,Y>>& A, const Dune::ParameterTree& configuration)
545 : ParMTSOR(A->getmat(), configuration)
546 {}
547
548 ParMTSOR (const M& A, const Dune::ParameterTree& configuration)
549 : ParMTSOR(A, configuration.get<int>("iterations",1), configuration.get<real_field_type>("relaxation",1.0))
550 {}
551
552 void pre (X&, Y&) override {}
553
554 void apply (X& v, const Y& d) override
555 {
556 this->template apply<true>(v,d);
557 }
558
559 template<bool forward>
560 void apply(X& v, const Y& d)
561 {
562 for (int i=0; i<numSteps_; i++)
563 Detail::Preconditioners::parallelBlockSOR_<forward, l>(_A_, v, d, relaxationFactor_, colors_);
564 }
565
566 void post (X&) override {}
567
569 Dune::SolverCategory::Category category() const override
570 { return Dune::SolverCategory::sequential; }
571
572private:
573 const M& _A_;
574 int numSteps_;
575 real_field_type relaxationFactor_;
576
578 std::deque<std::vector<std::size_t>> colors_;
579};
580
581DUMUX_REGISTER_PRECONDITIONER("par_mt_sor", Dune::PreconditionerTag, Dune::defaultPreconditionerBlockLevelCreator<Dumux::ParMTSOR>());
582
583
591template<class M, class X, class Y, int l=1>
592class ParMTSSOR : public Dune::Preconditioner<X,Y>
593{
594public:
596 typedef M matrix_type;
598 typedef X domain_type;
600 typedef Y range_type;
602 typedef typename X::field_type field_type;
604 typedef Dune::Simd::Scalar<field_type> scalar_field_type;
606 typedef typename Dune::FieldTraits<scalar_field_type>::real_type real_field_type;
607
609 ParMTSSOR (const M& A, int n, real_field_type w)
610 : _A_(A), numSteps_(n), relaxationFactor_(w)
611 {
612 Dune::CheckIfDiagonalPresent<M,l>::check(_A_);
614 }
615
616 ParMTSSOR (const std::shared_ptr<const Dune::AssembledLinearOperator<M,X,Y>>& A, const Dune::ParameterTree& configuration)
617 : ParMTSSOR(A->getmat(), configuration)
618 {}
619
620 ParMTSSOR (const M& A, const Dune::ParameterTree& configuration)
621 : ParMTSSOR(A, configuration.get<int>("iterations",1), configuration.get<real_field_type>("relaxation",1.0))
622 {}
623
624 void pre (X&, Y&) override {}
625
626 void apply (X& v, const Y& d) override
627 {
628 for (int i=0; i<numSteps_; i++)
629 {
630 Detail::Preconditioners::parallelBlockSOR_<true, l>(_A_, v, d, relaxationFactor_, colors_);
631 Detail::Preconditioners::parallelBlockSOR_<false, l>(_A_, v, d, relaxationFactor_, colors_);
632 }
633 }
634
635 void post (X&) override {}
636
638 Dune::SolverCategory::Category category() const override
639 { return Dune::SolverCategory::sequential; }
640
641private:
642 const M& _A_;
643 int numSteps_;
644 real_field_type relaxationFactor_;
645
647 std::deque<std::vector<std::size_t>> colors_;
648};
649
650DUMUX_REGISTER_PRECONDITIONER("par_mt_ssor", Dune::PreconditionerTag, Dune::defaultPreconditionerBlockLevelCreator<Dumux::ParMTSSOR>());
651
652} // end namespace Dumux
653
654namespace Dune::Amg {
655
656// make it possible to use Dumux::ParMTJac as AMG smoother
657template<class M, class X, class Y, int l>
658struct ConstructionTraits<Dumux::ParMTJac<M,X,Y,l> >
659{
660 using Arguments = DefaultConstructionArgs<SeqJac<M,X,Y,l> >;
661 static inline std::shared_ptr<Dumux::ParMTJac<M,X,Y,l>> construct(Arguments& args)
662 {
663 return std::make_shared<Dumux::ParMTJac<M,X,Y,l>>(
664 args.getMatrix(), args.getArgs().iterations, args.getArgs().relaxationFactor
665 );
666 }
667};
668
669// make it possible to use Dumux::ParMTSOR as AMG smoother
670template<class M, class X, class Y, int l>
671struct ConstructionTraits<Dumux::ParMTSOR<M,X,Y,l> >
672{
673 using Arguments = DefaultConstructionArgs<SeqSOR<M,X,Y,l> >;
674 static inline std::shared_ptr<Dumux::ParMTSOR<M,X,Y,l>> construct(Arguments& args)
675 {
676 return std::make_shared<Dumux::ParMTSOR<M,X,Y,l>>(
677 args.getMatrix(), args.getArgs().iterations, args.getArgs().relaxationFactor
678 );
679 }
680};
681
682template<class M, class X, class Y, int l>
683struct SmootherApplier<Dumux::ParMTSOR<M,X,Y,l> >
684{
686 typedef typename Smoother::range_type Range;
688
689 static void preSmooth(Smoother& smoother, Domain& v, Range& d)
690 { smoother.template apply<true>(v,d); }
691
692 static void postSmooth(Smoother& smoother, Domain& v, Range& d)
693 { smoother.template apply<false>(v,d); }
694};
695
696// make it possible to use Dumux::ParMTSSOR as AMG smoother
697template<class M, class X, class Y, int l>
698struct ConstructionTraits<Dumux::ParMTSSOR<M,X,Y,l> >
699{
700 using Arguments = DefaultConstructionArgs<SeqSSOR<M,X,Y,l> >;
701 static inline std::shared_ptr<Dumux::ParMTSSOR<M,X,Y,l>> construct(Arguments& args)
702 {
703 return std::make_shared<Dumux::ParMTSSOR<M,X,Y,l>>(
704 args.getMatrix(), args.getArgs().iterations, args.getArgs().relaxationFactor
705 );
706 }
707};
708
709} // end namespace Dune::Amg
710
711#endif
ParMTJac(const M &A, const Dune::ParameterTree &configuration)
Definition preconditioners.hh:386
ParMTJac(const std::shared_ptr< const Dune::AssembledLinearOperator< M, X, Y > > &A, const Dune::ParameterTree &configuration)
Definition preconditioners.hh:382
ParMTJac(const M &A, int n, real_field_type w)
Constructor.
Definition preconditioners.hh:378
X::field_type field_type
The field type of the preconditioner.
Definition preconditioners.hh:371
void pre(X &, Y &) override
Definition preconditioners.hh:390
Dune::FieldTraits< scalar_field_type >::real_type real_field_type
real scalar type underlying the field_type
Definition preconditioners.hh:375
void post(X &) override
Definition preconditioners.hh:425
M matrix_type
The matrix type the preconditioner is for.
Definition preconditioners.hh:365
Dune::Simd::Scalar< field_type > scalar_field_type
scalar type underlying the field_type
Definition preconditioners.hh:373
Y range_type
The range type of the preconditioner.
Definition preconditioners.hh:369
X domain_type
The domain type of the preconditioner.
Definition preconditioners.hh:367
Dune::SolverCategory::Category category() const override
Category of the preconditioner (see SolverCategory::Category).
Definition preconditioners.hh:428
void apply(X &update, const Y &defect) override
Definition preconditioners.hh:392
Multi-threaded SOR preconditioner using coloring.
Definition preconditioners.hh:521
ParMTSOR(const M &A, const Dune::ParameterTree &configuration)
Definition preconditioners.hh:548
X domain_type
The domain type of the preconditioner.
Definition preconditioners.hh:526
M matrix_type
The matrix type the preconditioner is for.
Definition preconditioners.hh:524
void apply(X &v, const Y &d)
Definition preconditioners.hh:560
ParMTSOR(const M &A, int n, real_field_type w)
Constructor.
Definition preconditioners.hh:537
void apply(X &v, const Y &d) override
Definition preconditioners.hh:554
Dune::Simd::Scalar< field_type > scalar_field_type
scalar type underlying the field_type
Definition preconditioners.hh:532
void post(X &) override
Definition preconditioners.hh:566
Dune::SolverCategory::Category category() const override
Category of the preconditioner (see SolverCategory::Category).
Definition preconditioners.hh:569
Y range_type
The range type of the preconditioner.
Definition preconditioners.hh:528
void pre(X &, Y &) override
Definition preconditioners.hh:552
X::field_type field_type
The field type of the preconditioner.
Definition preconditioners.hh:530
ParMTSOR(const std::shared_ptr< const Dune::AssembledLinearOperator< M, X, Y > > &A, const Dune::ParameterTree &configuration)
Definition preconditioners.hh:544
Dune::FieldTraits< scalar_field_type >::real_type real_field_type
real scalar type underlying the field_type
Definition preconditioners.hh:534
ParMTSSOR(const M &A, int n, real_field_type w)
Constructor.
Definition preconditioners.hh:609
Dune::Simd::Scalar< field_type > scalar_field_type
scalar type underlying the field_type
Definition preconditioners.hh:604
ParMTSSOR(const std::shared_ptr< const Dune::AssembledLinearOperator< M, X, Y > > &A, const Dune::ParameterTree &configuration)
Definition preconditioners.hh:616
void pre(X &, Y &) override
Definition preconditioners.hh:624
Dune::SolverCategory::Category category() const override
Category of the preconditioner (see SolverCategory::Category).
Definition preconditioners.hh:638
void apply(X &v, const Y &d) override
Definition preconditioners.hh:626
X domain_type
The domain type of the preconditioner.
Definition preconditioners.hh:598
Dune::FieldTraits< scalar_field_type >::real_type real_field_type
real scalar type underlying the field_type
Definition preconditioners.hh:606
ParMTSSOR(const M &A, const Dune::ParameterTree &configuration)
Definition preconditioners.hh:620
M matrix_type
The matrix type the preconditioner is for.
Definition preconditioners.hh:596
Y range_type
The range type of the preconditioner.
Definition preconditioners.hh:600
void post(X &) override
Definition preconditioners.hh:635
X::field_type field_type
The field type of the preconditioner.
Definition preconditioners.hh:602
A preconditioner based on the Uzawa algorithm for saddle-point problems of the form ...
Definition preconditioners.hh:71
virtual Dune::SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category).
Definition preconditioners.hh:189
M matrix_type
The matrix type the preconditioner is for.
Definition preconditioners.hh:85
virtual void pre(X &x, Y &b)
Prepare the preconditioner.
Definition preconditioners.hh:125
SeqUzawa(const std::shared_ptr< const Dune::AssembledLinearOperator< M, X, Y > > &op, const Dune::ParameterTree &params)
Constructor.
Definition preconditioners.hh:101
virtual void post(X &x)
Clean up.
Definition preconditioners.hh:186
Dune::Simd::Scalar< field_type > scalar_field_type
Scalar type underlying the field_type.
Definition preconditioners.hh:93
typename X::field_type field_type
The field type of the preconditioner.
Definition preconditioners.hh:91
X domain_type
The domain type of the preconditioner.
Definition preconditioners.hh:87
Y range_type
The range type of the preconditioner.
Definition preconditioners.hh:89
virtual void apply(X &update, const Y &currentDefect)
Apply the preconditioner.
Definition preconditioners.hh:133
Coloring schemes for shared-memory-parallel assembly.
void parallelFor(const std::size_t count, const FunctorType &functor)
A parallel for loop (multithreading).
Definition parallel_for.hh:160
T getParamFromGroup(Args &&... args)
A free function to get a parameter from the parameter tree singleton with a model group.
Definition parameters.hh:165
The specialized Dumux macro and tag for the ISTL registry to choose the solver and preconditioner at ...
#define DUMUX_REGISTER_PRECONDITIONER(name, tag,...)
Register a Dumux preconditioner.
Definition istlsolverregistry.hh:31
Type traits to be used with matrix types.
Definition preconditioners.hh:440
void parallelBlockSOR_(const M &A, X &update, const Y &b, const K &relaxationFactor, const std::deque< std::vector< std::size_t > > &coloredIndices)
Definition preconditioners.hh:474
void computeColorsForMatrixSweep_(const M &matrix, std::deque< std::vector< std::size_t > > &coloredIndices)
Definition preconditioners.hh:444
Definition cvfelocalresidual.hh:25
auto uzawaPreconditionerCreator()
Creator of the Uzawa preconditioner for the solver factory.
Definition preconditioners.hh:330
Definition adapt.hh:17
const Scalar PengRobinsonMixture< Scalar, StaticParameters >::w
Definition pengrobinsonmixture.hh:140
const Scalar PengRobinsonMixture< Scalar, StaticParameters >::u
Definition pengrobinsonmixture.hh:138
Definition preconditioners.hh:654
Parallel for loop (multithreading).
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
Helper type to determine whether a given type is a Dune::MultiTypeBlockMatrix.
Definition matrix.hh:37
DefaultConstructionArgs< SeqJac< M, X, Y, l > > Arguments
Definition preconditioners.hh:660
static std::shared_ptr< Dumux::ParMTJac< M, X, Y, l > > construct(Arguments &args)
Definition preconditioners.hh:661
static std::shared_ptr< Dumux::ParMTSOR< M, X, Y, l > > construct(Arguments &args)
Definition preconditioners.hh:674
DefaultConstructionArgs< SeqSOR< M, X, Y, l > > Arguments
Definition preconditioners.hh:673
DefaultConstructionArgs< SeqSSOR< M, X, Y, l > > Arguments
Definition preconditioners.hh:700
static std::shared_ptr< Dumux::ParMTSSOR< M, X, Y, l > > construct(Arguments &args)
Definition preconditioners.hh:701
static void preSmooth(Smoother &smoother, Domain &v, Range &d)
Definition preconditioners.hh:689
Smoother::range_type Range
Definition preconditioners.hh:686
Dumux::ParMTSOR< M, X, Y, l > Smoother
Definition preconditioners.hh:685
Smoother::domain_type Domain
Definition preconditioners.hh:687
static void postSmooth(Smoother &smoother, Domain &v, Range &d)
Definition preconditioners.hh:692