DUNE PDELab (git)

seqistlsolverbackend.hh
1// -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=8 sw=2 sts=2:
3#ifndef DUNE_PDELAB_BACKEND_ISTL_SEQISTLSOLVERBACKEND_HH
4#define DUNE_PDELAB_BACKEND_ISTL_SEQISTLSOLVERBACKEND_HH
5
8
10#include <dune/istl/solvercategory.hh>
12#include <dune/istl/solvers.hh>
16#include <dune/istl/paamg/pinfo.hh>
17#include <dune/istl/io.hh>
18#include <dune/istl/superlu.hh>
19#include <dune/istl/umfpack.hh>
20
21#include <dune/pdelab/constraints/common/constraints.hh>
22#include <dune/pdelab/gridfunctionspace/genericdatahandle.hh>
23#include <dune/pdelab/backend/solver.hh>
24#include <dune/pdelab/backend/istl/vector.hh>
25#include <dune/pdelab/backend/istl/bcrsmatrix.hh>
26
27namespace Dune {
28 namespace PDELab {
29
33
34
44 template<typename X, typename Y, typename GO>
46 {
47 public:
48 typedef X domain_type;
49 typedef Y range_type;
50 typedef typename X::field_type field_type;
51 static constexpr bool isLinear = GO::LocalAssembler::isLinear();
52
53
54 OnTheFlyOperator (const GO& go_)
55 : go(go_)
56 , u_(nullptr)
57 {}
58
61 void setLinearizationPoint(const X& u)
62 {
63 u_ = &u;
64 }
65
66 virtual void apply (const X& x, Y& y) const override
67 {
68 y = 0.0;
69 if (isLinear)
70 go.jacobian_apply(x,y);
71 else {
72 if (u_ == nullptr)
73 DUNE_THROW(Dune::InvalidStateException, "You seem to apply a nonlinear operator without setting the linearization point first!");
74 go.jacobian_apply(*u_, x, y);
75 }
76 }
77
78 virtual void applyscaleadd (field_type alpha, const X& x, Y& y) const override
79 {
80 Y temp(y);
81 temp = 0.0;
82 if (isLinear)
83 go.jacobian_apply(x,temp);
84 else {
85 if (u_ == nullptr)
86 DUNE_THROW(Dune::InvalidStateException, "You seem to apply a nonlinear operator without setting the linearization point first!");
87 go.jacobian_apply(*u_, x, temp);
88 }
89 y.axpy(alpha,temp);
90 }
91
93 {
95 }
96
97 private:
98 const GO& go;
99 const X* u_;
100 };
101
102 //==============================================================================
103 // Here we add some standard linear solvers conforming to the linear solver
104 // interface required to solve linear and nonlinear problems.
105 //==============================================================================
106
107 //=====================================================================
108 // First we add some base classes where the preconditioner is specified
109 //=====================================================================
110
111 template<template<class> class Solver>
112 class ISTLBackend_SEQ_Richardson
113 : public SequentialNorm, public LinearResultStorage
114 {
115 public:
121 explicit ISTLBackend_SEQ_Richardson(unsigned maxiter_=5000, int verbose_=1)
122 : maxiter(maxiter_), verbose(verbose_)
123 {}
124
132 template<class M, class V, class W>
133 void apply(M& A, V& z, W& r, typename Dune::template FieldTraits<typename W::ElementType >::real_type reduction)
134 {
135 using Backend::Native;
136 using Backend::native;
137
139 Native<V>,
140 Native<W>> opa(native(A));
141 Dune::Richardson<Native<V>,Native<W> > prec(0.7);
142 Solver<Native<V> > solver(opa, prec, reduction, maxiter, verbose);
144 solver.apply(native(z), native(r), stat);
145 res.converged = stat.converged;
146 res.iterations = stat.iterations;
147 res.elapsed = stat.elapsed;
148 res.reduction = stat.reduction;
149 res.conv_rate = stat.conv_rate;
150 }
151
152 private:
153 unsigned maxiter;
154 int verbose;
155 };
156
157 template<class GO, template<class> class Solver>
158 class ISTLBackend_SEQ_MatrixFree_Richardson
159 : public SequentialNorm, public LinearResultStorage
160 {
161 using V = typename GO::Traits::Domain;
162 using W = typename GO::Traits::Range;
163 public:
169 explicit ISTLBackend_SEQ_MatrixFree_Richardson(const GO& go, unsigned maxiter=5000, int verbose=1)
170 : opa_(go)
171 , maxiter_(maxiter)
172 , verbose_(verbose)
173 {}
174
182 void apply(V& z, W& r, typename Dune::template FieldTraits<typename W::ElementType >::real_type reduction)
183 {
184 Dune::Richardson<V,W> prec(1.0);
185 Solver<V> solver(opa_, prec, reduction, maxiter_, verbose_);
187 solver.apply(z, r, stat);
188 res.converged = stat.converged;
189 res.iterations = stat.iterations;
190 res.elapsed = stat.elapsed;
191 res.reduction = stat.reduction;
192 res.conv_rate = stat.conv_rate;
193 }
194
196 void setLinearizationPoint(const V& u)
197 {
198 opa_.setLinearizationPoint(u);
199 }
200
201 private:
203 unsigned maxiter_;
204 int verbose_;
205 };
206
207 template<template<class,class,class,int> class Preconditioner,
208 template<class> class Solver>
209 class ISTLBackend_SEQ_Base
210 : public SequentialNorm, public LinearResultStorage
211 {
212 public:
218 explicit ISTLBackend_SEQ_Base(unsigned maxiter_=5000, int verbose_=1, unsigned preconditioner_steps_=1)
219 : maxiter(maxiter_), verbose(verbose_), preconditioner_steps(preconditioner_steps_)
220 {}
221
222
223
231 template<class M, class V, class W>
232 void apply(M& A, V& z, W& r, typename Dune::template FieldTraits<typename W::ElementType >::real_type reduction)
233 {
234 using Backend::Native;
235 using Backend::native;
236
238 Native<V>,
239 Native<W>> opa(native(A));
240 Preconditioner<Native<M>,
241 Native<V>,
242 Native<W>,
243 1> prec(native(A), preconditioner_steps, 1.0);
244 Solver<Native<V>> solver(opa, prec, reduction, maxiter, verbose);
246 solver.apply(native(z), native(r), stat);
247 res.converged = stat.converged;
248 res.iterations = stat.iterations;
249 res.elapsed = stat.elapsed;
250 res.reduction = stat.reduction;
251 res.conv_rate = stat.conv_rate;
252 }
253
254 private:
255 unsigned maxiter;
256 int verbose;
257 unsigned preconditioner_steps;
258 };
259
260 template<template<typename> class Solver>
261 class ISTLBackend_SEQ_ILU0
262 : public SequentialNorm, public LinearResultStorage
263 {
264 public:
270 explicit ISTLBackend_SEQ_ILU0 (unsigned maxiter_=5000, int verbose_=1)
271 : maxiter(maxiter_), verbose(verbose_)
272 {}
280 template<class M, class V, class W>
281 void apply(M& A, V& z, W& r, typename Dune::template FieldTraits<typename W::ElementType >::real_type reduction)
282 {
283 using Backend::Native;
284 using Backend::native;
286 Native<V>,
287 Native<W>> opa(native(A));
289 Native<V>,
290 Native<W>
291 > ilu0(native(A), 1.0);
292 Solver<Native<V>> solver(opa, ilu0, reduction, maxiter, verbose);
294 solver.apply(native(z), native(r), stat);
295 res.converged = stat.converged;
296 res.iterations = stat.iterations;
297 res.elapsed = stat.elapsed;
298 res.reduction = stat.reduction;
299 res.conv_rate = stat.conv_rate;
300 }
301 private:
302 unsigned maxiter;
303 int verbose;
304 };
305
306 template<template<typename> class Solver>
307 class ISTLBackend_SEQ_ILUn
308 : public SequentialNorm, public LinearResultStorage
309 {
310 public:
317 ISTLBackend_SEQ_ILUn (int n, double w, unsigned maxiter_=5000, int verbose_=1)
318 : n_(n), w_(w), maxiter(maxiter_), verbose(verbose_)
319 {}
327 template<class M, class V, class W>
328 void apply(M& A, V& z, W& r, typename Dune::template FieldTraits<typename W::ElementType >::real_type reduction)
329 {
330 using Backend::Native;
331 using Backend::native;
333 Native<V>,
334 Native<W>
335 > opa(native(A));
337 Native<V>,
338 Native<W>
339 > ilun(native(A), n_, w_, false);
340 Solver<Native<V>> solver(opa, ilun, reduction, maxiter, verbose);
342 solver.apply(native(z), native(r), stat);
343 res.converged = stat.converged;
344 res.iterations = stat.iterations;
345 res.elapsed = stat.elapsed;
346 res.reduction = stat.reduction;
347 res.conv_rate = stat.conv_rate;
348 }
349 private:
350 int n_;
351 double w_;
352
353 unsigned maxiter;
354 int verbose;
355 };
356
357 //========================================
358 // Start with matrix based solver backends
359 //========================================
360
363
368 : public ISTLBackend_SEQ_Base<Dune::SeqJac, Dune::LoopSolver>
369 {
370 public:
375 explicit ISTLBackend_SEQ_LOOP_Jac (unsigned maxiter_=5000, int verbose_=1, unsigned preconditioner_steps_=1)
376 : ISTLBackend_SEQ_Base<Dune::SeqJac, Dune::LoopSolver>(maxiter_, verbose_, preconditioner_steps_)
377 {}
378 };
379
386 : public ISTLBackend_SEQ_Richardson<Dune::BiCGSTABSolver>
387 {
388 public:
393 explicit ISTLBackend_SEQ_BCGS_Richardson (unsigned maxiter_=5000, int verbose_=1)
394 : ISTLBackend_SEQ_Richardson<Dune::BiCGSTABSolver>(maxiter_, verbose_)
395 {}
396 };
397
402 : public ISTLBackend_SEQ_Base<Dune::SeqJac, Dune::BiCGSTABSolver>
403 {
404 public:
409 explicit ISTLBackend_SEQ_BCGS_Jac (unsigned maxiter_=5000, int verbose_=1, unsigned preconditioner_steps_=1)
410 : ISTLBackend_SEQ_Base<Dune::SeqJac, Dune::BiCGSTABSolver>(maxiter_, verbose_, preconditioner_steps_)
411 {}
412 };
413
418 : public ISTLBackend_SEQ_Base<Dune::SeqSSOR, Dune::BiCGSTABSolver>
419 {
420 public:
426 explicit ISTLBackend_SEQ_BCGS_SSOR (unsigned maxiter_=5000, int verbose_=1, unsigned preconditioner_steps_=1)
427 : ISTLBackend_SEQ_Base<Dune::SeqSSOR, Dune::BiCGSTABSolver>(maxiter_, verbose_, preconditioner_steps_)
428 {}
429 };
430
435 : public ISTLBackend_SEQ_ILU0<Dune::BiCGSTABSolver>
436 {
437 public:
443 explicit ISTLBackend_SEQ_BCGS_ILU0 (unsigned maxiter_=5000, int verbose_=1)
444 : ISTLBackend_SEQ_ILU0<Dune::BiCGSTABSolver>(maxiter_, verbose_)
445 {}
446 };
447
452 : public ISTLBackend_SEQ_ILU0<Dune::CGSolver>
453 {
454 public:
460 explicit ISTLBackend_SEQ_CG_ILU0 (unsigned maxiter_=5000, int verbose_=1)
461 : ISTLBackend_SEQ_ILU0<Dune::CGSolver>(maxiter_, verbose_)
462 {}
463 };
464
467 : public ISTLBackend_SEQ_ILUn<Dune::BiCGSTABSolver>
468 {
469 public:
478 explicit ISTLBackend_SEQ_BCGS_ILUn (int n_, double w_=1.0, unsigned maxiter_=5000, int verbose_=1)
479 : ISTLBackend_SEQ_ILUn<Dune::BiCGSTABSolver>(n_, w_, maxiter_, verbose_)
480 {}
481 };
482
485 : public ISTLBackend_SEQ_ILUn<Dune::CGSolver>
486 {
487 public:
496 explicit ISTLBackend_SEQ_CG_ILUn (int n_, double w_=1.0, unsigned maxiter_=5000, int verbose_=1)
497 : ISTLBackend_SEQ_ILUn<Dune::CGSolver>(n_, w_, maxiter_, verbose_)
498 {}
499 };
500
505 : public ISTLBackend_SEQ_Base<Dune::SeqSSOR, Dune::CGSolver>
506 {
507 public:
513 explicit ISTLBackend_SEQ_CG_SSOR (unsigned maxiter_=5000, int verbose_=1, unsigned preconditioner_steps_=1)
514 : ISTLBackend_SEQ_Base<Dune::SeqSSOR, Dune::CGSolver>(maxiter_, verbose_, preconditioner_steps_)
515 {}
516 };
517
522 : public ISTLBackend_SEQ_Base<Dune::SeqSSOR, Dune::MINRESSolver>
523 {
524 public:
530 explicit ISTLBackend_SEQ_MINRES_SSOR (unsigned maxiter_=5000, int verbose_=1, unsigned preconditioner_steps_=1)
531 : ISTLBackend_SEQ_Base<Dune::SeqSSOR, Dune::MINRESSolver>(maxiter_, verbose_, preconditioner_steps_)
532 {}
533 };
534
539 : public ISTLBackend_SEQ_Base<Dune::SeqJac, Dune::CGSolver>
540 {
541 public:
546 explicit ISTLBackend_SEQ_CG_Jac (unsigned maxiter_=5000, int verbose_=1, unsigned preconditioner_steps_=1)
547 : ISTLBackend_SEQ_Base<Dune::SeqJac, Dune::CGSolver>(maxiter_, verbose_, preconditioner_steps_)
548 {}
549 };
550
551#if HAVE_SUPERLU || DOXYGEN
556 : public SequentialNorm, public LinearResultStorage
557 {
558 public:
563 explicit ISTLBackend_SEQ_SuperLU (int verbose_=1)
564 : verbose(verbose_)
565 {}
566
567
573 ISTLBackend_SEQ_SuperLU (int maxiter, int verbose_)
574 : verbose(verbose_)
575 {}
576
584 template<class M, class V, class W>
585 void apply(M& A, V& z, W& r, typename Dune::template FieldTraits<typename W::ElementType >::real_type reduction)
586 {
587 using Backend::Native;
588 using Backend::native;
589 using ISTLM = Native<M>;
590 Dune::SuperLU<ISTLM> solver(native(A), verbose);
592 solver.apply(native(z), native(r), stat);
593 res.converged = stat.converged;
594 res.iterations = stat.iterations;
595 res.elapsed = stat.elapsed;
596 res.reduction = stat.reduction;
597 res.conv_rate = stat.conv_rate;
598 }
599
600 private:
601 int verbose;
602 };
603#endif // HAVE_SUPERLU || DOXYGEN
604
605#if HAVE_SUITESPARSE_UMFPACK || DOXYGEN
610 : public SequentialNorm, public LinearResultStorage
611 {
612 public:
617 explicit ISTLBackend_SEQ_UMFPack (int verbose_=1)
618 : verbose(verbose_)
619 {}
620
621
627 ISTLBackend_SEQ_UMFPack (int maxiter, int verbose_)
628 : verbose(verbose_)
629 {}
630
638 template<class M, class V, class W>
639 void apply(M& A, V& z, W& r, typename Dune::template FieldTraits<typename W::ElementType >::real_type reduction)
640 {
641 using Backend::native;
642 using ISTLM = Backend::Native<M>;
643 Dune::UMFPack<ISTLM> solver(native(A), verbose);
645 solver.apply(native(z), native(r), stat);
646 res.converged = stat.converged;
647 res.iterations = stat.iterations;
648 res.elapsed = stat.elapsed;
649 res.reduction = stat.reduction;
650 res.conv_rate = stat.conv_rate;
651 }
652
653 private:
654 int verbose;
655 };
656#endif // HAVE_SUITESPARSE_UMFPACK || DOXYGEN
657
660 : public SequentialNorm, public LinearResultStorage
661 {
662 public:
666 {}
667
675 template<class M, class V, class W>
676 void apply(M& A, V& z, W& r, typename Dune::template FieldTraits<typename W::ElementType >::real_type reduction)
677 {
678 using Backend::Native;
680 Native<V>,
681 Native<W>
682 > jac(Backend::native(A),1,1.0);
683 jac.pre(z,r);
684 jac.apply(z,r);
685 jac.post(z);
686 res.converged = true;
687 res.iterations = 1;
688 res.elapsed = 0.0;
689 res.reduction = reduction;
690 res.conv_rate = reduction; // pow(reduction,1.0/1)
691 }
692 };
693
695
701 {
706 double tprepare;
710 double tsolve;
712 double tsetup;
717 };
718
719 template<class GO, template<class,class,class,int> class Preconditioner, template<class> class Solver,
720 bool skipBlocksizeCheck = false>
721 class ISTLBackend_SEQ_AMG : public LinearResultStorage
722 {
723 typedef typename GO::Traits::TrialGridFunctionSpace GFS;
724 typedef typename GO::Traits::Jacobian M;
725 typedef Backend::Native<M> MatrixType;
726 typedef typename GO::Traits::Domain V;
727 typedef Backend::Native<V> VectorType;
730 typedef typename Dune::Amg::SmootherTraits<Smoother>::Arguments SmootherArgs;
733
734 public:
735 ISTLBackend_SEQ_AMG(unsigned maxiter_=5000, int verbose_=1,
736 bool reuse_=false, bool usesuperlu_=true)
737 : maxiter(maxiter_), params(15,2000), verbose(verbose_),
738 reuse(reuse_), firstapply(true), usesuperlu(usesuperlu_)
739 {
740 params.setDefaultValuesIsotropic(GFS::Traits::GridViewType::Traits::Grid::dimension);
741 params.setDebugLevel(verbose_);
742#if !HAVE_SUPERLU
743 if (usesuperlu == true)
744 {
745 std::cout << "WARNING: You are using AMG without SuperLU!"
746 << " Please consider installing SuperLU,"
747 << " or set the usesuperlu flag to false"
748 << " to suppress this warning." << std::endl;
749 }
750#endif
751 }
752
757 void setparams(Parameters params_)
758 {
759 params = params_;
760 }
761
763 void setReuse(bool reuse_)
764 {
765 reuse = reuse_;
766 }
767
769 bool getReuse() const
770 {
771 return reuse;
772 }
773
778 typename V::ElementType norm (const V& v) const
779 {
780 return Backend::native(v).two_norm();
781 }
782
790 void apply(M& A, V& z, V& r, typename Dune::template FieldTraits<typename V::ElementType >::real_type reduction)
791 {
792 Timer watch;
793 MatrixType& mat = Backend::native(A);
795 Dune::Amg::FirstDiagonal> > Criterion;
796 SmootherArgs smootherArgs;
797 smootherArgs.iterations = 1;
798 smootherArgs.relaxationFactor = 1;
799
800 Criterion criterion(params);
801 //only construct a new AMG if the matrix changes
802 if (reuse==false || firstapply==true){
803 oop.reset(new Operator(mat));
804 amg.reset(new AMG(*oop, criterion, smootherArgs));
805 firstapply = false;
806 stats.tsetup = watch.elapsed();
807 stats.levels = amg->maxlevels();
808 stats.directCoarseLevelSolver=amg->usesDirectCoarseLevelSolver();
809 }
810 watch.reset();
812
813 Solver<VectorType> solver(*oop,*amg,reduction,maxiter,verbose);
814 solver.apply(Backend::native(z),Backend::native(r),stat);
815 stats.tsolve= watch.elapsed();
816 res.converged = stat.converged;
817 res.iterations = stat.iterations;
818 res.elapsed = stat.elapsed;
819 res.reduction = stat.reduction;
820 res.conv_rate = stat.conv_rate;
821 }
822
823
828 const ISTLAMGStatistics& statistics() const
829 {
830 return stats;
831 }
832
833 private:
834 unsigned maxiter;
835 Parameters params;
836 int verbose;
837 bool reuse;
838 bool firstapply;
839 bool usesuperlu;
840 std::shared_ptr<Operator> oop;
841 std::shared_ptr<AMG> amg;
842 ISTLAMGStatistics stats;
843 };
844
847
853 template<class GO>
855 : public ISTLBackend_SEQ_AMG<GO, Dune::SeqSSOR, Dune::CGSolver>
856 {
857
858 public:
867 ISTLBackend_SEQ_CG_AMG_SSOR(unsigned maxiter_=5000, int verbose_=1,
868 bool reuse_=false, bool usesuperlu_=true)
869 : ISTLBackend_SEQ_AMG<GO, Dune::SeqSSOR, Dune::CGSolver>
870 (maxiter_, verbose_, reuse_, usesuperlu_)
871 {}
872 };
873
879 template<class GO>
881 : public ISTLBackend_SEQ_AMG<GO, Dune::SeqSSOR, Dune::BiCGSTABSolver>
882 {
883
884 public:
893 ISTLBackend_SEQ_BCGS_AMG_SSOR(unsigned maxiter_=5000, int verbose_=1,
894 bool reuse_=false, bool usesuperlu_=true)
895 : ISTLBackend_SEQ_AMG<GO, Dune::SeqSSOR, Dune::BiCGSTABSolver>
896 (maxiter_, verbose_, reuse_, usesuperlu_)
897 {}
898 };
899
905 template<class GO>
907 : public ISTLBackend_SEQ_AMG<GO, Dune::SeqSOR, Dune::BiCGSTABSolver>
908 {
909
910 public:
919 ISTLBackend_SEQ_BCGS_AMG_SOR(unsigned maxiter_=5000, int verbose_=1,
920 bool reuse_=false, bool usesuperlu_=true)
921 : ISTLBackend_SEQ_AMG<GO, Dune::SeqSOR, Dune::BiCGSTABSolver>
922 (maxiter_, verbose_, reuse_, usesuperlu_)
923 {}
924 };
925
931 template<class GO>
933 : public ISTLBackend_SEQ_AMG<GO, Dune::SeqSSOR, Dune::LoopSolver>
934 {
935
936 public:
945 ISTLBackend_SEQ_LS_AMG_SSOR(unsigned maxiter_=5000, int verbose_=1,
946 bool reuse_=false, bool usesuperlu_=true)
947 : ISTLBackend_SEQ_AMG<GO, Dune::SeqSSOR, Dune::LoopSolver>
948 (maxiter_, verbose_, reuse_, usesuperlu_)
949 {}
950 };
951
957 template<class GO>
959 : public ISTLBackend_SEQ_AMG<GO, Dune::SeqSOR, Dune::LoopSolver>
960 {
961
962 public:
971 ISTLBackend_SEQ_LS_AMG_SOR(unsigned maxiter_=5000, int verbose_=1,
972 bool reuse_=false, bool usesuperlu_=true)
973 : ISTLBackend_SEQ_AMG<GO, Dune::SeqSOR, Dune::LoopSolver>
974 (maxiter_, verbose_, reuse_, usesuperlu_)
975 {}
976 };
977
984 : public SequentialNorm, public LinearResultStorage
985 {
986 public :
987
994 explicit ISTLBackend_SEQ_GMRES_ILU0(int restart_ = 200, int maxiter_ = 5000, int verbose_ = 1)
995 : restart(restart_), maxiter(maxiter_), verbose(verbose_)
996 {}
997
1005 template<class M, class V, class W>
1006 void apply(M& A, V& z, W& r, typename Dune::template FieldTraits<typename W::ElementType>::real_type reduction)
1007 {
1008 using Backend::Native;
1009 using Backend::native;
1011 Native<M>,
1012 Native<V>,
1013 Native<W>
1014 > opa(native(A));
1016 Native<M>,
1017 Native<V>,
1018 Native<W>
1019 > ilu0(native(A), 1.0);
1020 Dune::RestartedGMResSolver<Native<V>> solver(opa,ilu0,reduction,restart,maxiter,verbose);
1022 solver.apply(native(z), native(r), stat);
1023 res.converged = stat.converged;
1024 res.iterations = stat.iterations;
1025 res.elapsed = stat.elapsed;
1026 res.reduction = stat.reduction;
1027 res.conv_rate = stat.conv_rate;
1028 }
1029
1030 private :
1031 int restart, maxiter, verbose;
1032 };
1033
1034 //============================
1035 // Matrix free solver backends
1036 //============================
1037
1038 template <class GO>
1039 class ISTLBackend_SEQ_MatrixFree_BCGS_Richardson
1040 : public ISTLBackend_SEQ_MatrixFree_Richardson<GO, Dune::BiCGSTABSolver>
1041 {
1042 public:
1048 explicit ISTLBackend_SEQ_MatrixFree_BCGS_Richardson (const GO& go_, unsigned maxiter_=5000, int verbose_=1)
1049 : ISTLBackend_SEQ_MatrixFree_Richardson<GO, Dune::BiCGSTABSolver>(go_, maxiter_, verbose_)
1050 {}
1051 };
1052
1053
1056
1057 } // namespace PDELab
1058} // namespace Dune
1059
1060#endif // DUNE_PDELAB_BACKEND_ISTL_SEQISTLSOLVERBACKEND_HH
The AMG preconditioner.
Parallel algebraic multigrid based on agglomeration.
Definition: amg.hh:66
The criterion describing the stop criteria for the coarsening process.
Definition: matrixhierarchy.hh:283
Norm that uses only the [0][0] entry of the block to determine couplings.
Definition: aggregates.hh:455
All parameters for AMG.
Definition: parameters.hh:416
Criterion taking advantage of symmetric matrices.
Definition: aggregates.hh:519
Bi-conjugate Gradient Stabilized (BiCG-STAB)
Definition: solvers.hh:419
conjugate gradient method
Definition: solvers.hh:193
Default exception if a function was called while the object is not in a valid state for that function...
Definition: exceptions.hh:281
A linear operator.
Definition: operators.hh:68
X::field_type field_type
The field type of the operator.
Definition: operators.hh:75
Y range_type
The type of the range of the operator.
Definition: operators.hh:73
X domain_type
The type of the domain of the operator.
Definition: operators.hh:71
Preconditioned loop solver.
Definition: solvers.hh:59
Minimal Residual Method (MINRES)
Definition: solvers.hh:609
Adapter to turn a matrix into a linear operator.
Definition: operators.hh:135
Sequential BiCGSTAB solver preconditioned with AMG smoothed by SOR.
Definition: seqistlsolverbackend.hh:908
ISTLBackend_SEQ_BCGS_AMG_SOR(unsigned maxiter_=5000, int verbose_=1, bool reuse_=false, bool usesuperlu_=true)
Constructor.
Definition: seqistlsolverbackend.hh:919
Sequential BiCGStab solver preconditioned with AMG smoothed by SSOR.
Definition: seqistlsolverbackend.hh:882
ISTLBackend_SEQ_BCGS_AMG_SSOR(unsigned maxiter_=5000, int verbose_=1, bool reuse_=false, bool usesuperlu_=true)
Constructor.
Definition: seqistlsolverbackend.hh:893
Backend for sequential BiCGSTAB solver with ILU0 preconditioner.
Definition: seqistlsolverbackend.hh:436
ISTLBackend_SEQ_BCGS_ILU0(unsigned maxiter_=5000, int verbose_=1)
make a linear solver object
Definition: seqistlsolverbackend.hh:443
Sequential BiCGStab solver with ILU0 preconditioner.
Definition: seqistlsolverbackend.hh:468
ISTLBackend_SEQ_BCGS_ILUn(int n_, double w_=1.0, unsigned maxiter_=5000, int verbose_=1)
make a linear solver object
Definition: seqistlsolverbackend.hh:478
Backend for sequential BiCGSTAB solver with Jacobi preconditioner.
Definition: seqistlsolverbackend.hh:403
ISTLBackend_SEQ_BCGS_Jac(unsigned maxiter_=5000, int verbose_=1, unsigned preconditioner_steps_=1)
make a linear solver object
Definition: seqistlsolverbackend.hh:409
Backend for sequential BiCGSTAB solver with Richardson precondition (equivalent to no preconditioner ...
Definition: seqistlsolverbackend.hh:387
ISTLBackend_SEQ_BCGS_Richardson(unsigned maxiter_=5000, int verbose_=1)
make a linear solver object
Definition: seqistlsolverbackend.hh:393
Backend for sequential BiCGSTAB solver with SSOR preconditioner.
Definition: seqistlsolverbackend.hh:419
ISTLBackend_SEQ_BCGS_SSOR(unsigned maxiter_=5000, int verbose_=1, unsigned preconditioner_steps_=1)
make a linear solver object
Definition: seqistlsolverbackend.hh:426
Sequential conjugate gradient solver preconditioned with AMG smoothed by SSOR.
Definition: seqistlsolverbackend.hh:856
ISTLBackend_SEQ_CG_AMG_SSOR(unsigned maxiter_=5000, int verbose_=1, bool reuse_=false, bool usesuperlu_=true)
Constructor.
Definition: seqistlsolverbackend.hh:867
Backend for sequential conjugate gradient solver with ILU0 preconditioner.
Definition: seqistlsolverbackend.hh:453
ISTLBackend_SEQ_CG_ILU0(unsigned maxiter_=5000, int verbose_=1)
make a linear solver object
Definition: seqistlsolverbackend.hh:460
Sequential congute gradient solver with ILU0 preconditioner.
Definition: seqistlsolverbackend.hh:486
ISTLBackend_SEQ_CG_ILUn(int n_, double w_=1.0, unsigned maxiter_=5000, int verbose_=1)
make a linear solver object
Definition: seqistlsolverbackend.hh:496
Backend for conjugate gradient solver with Jacobi preconditioner.
Definition: seqistlsolverbackend.hh:540
ISTLBackend_SEQ_CG_Jac(unsigned maxiter_=5000, int verbose_=1, unsigned preconditioner_steps_=1)
make a linear solver object
Definition: seqistlsolverbackend.hh:546
Backend for sequential conjugate gradient solver with SSOR preconditioner.
Definition: seqistlsolverbackend.hh:506
ISTLBackend_SEQ_CG_SSOR(unsigned maxiter_=5000, int verbose_=1, unsigned preconditioner_steps_=1)
make a linear solver object
Definition: seqistlsolverbackend.hh:513
Solver to be used for explicit time-steppers with (block-)diagonal mass matrix.
Definition: seqistlsolverbackend.hh:661
ISTLBackend_SEQ_ExplicitDiagonal()
make a linear solver object
Definition: seqistlsolverbackend.hh:665
void apply(M &A, V &z, W &r, typename Dune::template FieldTraits< typename W::ElementType >::real_type reduction)
solve the given linear system
Definition: seqistlsolverbackend.hh:676
Linear solver backend for Restarted GMRes preconditioned with ILU(0)
Definition: seqistlsolverbackend.hh:985
ISTLBackend_SEQ_GMRES_ILU0(int restart_=200, int maxiter_=5000, int verbose_=1)
make linear solver object
Definition: seqistlsolverbackend.hh:994
void apply(M &A, V &z, W &r, typename Dune::template FieldTraits< typename W::ElementType >::real_type reduction)
solve the given linear system
Definition: seqistlsolverbackend.hh:1006
Backend for sequential loop solver with Jacobi preconditioner.
Definition: seqistlsolverbackend.hh:369
ISTLBackend_SEQ_LOOP_Jac(unsigned maxiter_=5000, int verbose_=1, unsigned preconditioner_steps_=1)
make a linear solver object
Definition: seqistlsolverbackend.hh:375
Sequential Loop solver preconditioned with AMG smoothed by SOR.
Definition: seqistlsolverbackend.hh:960
ISTLBackend_SEQ_LS_AMG_SOR(unsigned maxiter_=5000, int verbose_=1, bool reuse_=false, bool usesuperlu_=true)
Constructor.
Definition: seqistlsolverbackend.hh:971
Sequential Loop solver preconditioned with AMG smoothed by SSOR.
Definition: seqistlsolverbackend.hh:934
ISTLBackend_SEQ_LS_AMG_SSOR(unsigned maxiter_=5000, int verbose_=1, bool reuse_=false, bool usesuperlu_=true)
Constructor.
Definition: seqistlsolverbackend.hh:945
Backend using a MINRes solver preconditioned by SSOR.
Definition: seqistlsolverbackend.hh:523
ISTLBackend_SEQ_MINRES_SSOR(unsigned maxiter_=5000, int verbose_=1, unsigned preconditioner_steps_=1)
make a linear solver object
Definition: seqistlsolverbackend.hh:530
Solver backend using SuperLU as a direct solver.
Definition: seqistlsolverbackend.hh:557
ISTLBackend_SEQ_SuperLU(int verbose_=1)
make a linear solver object
Definition: seqistlsolverbackend.hh:563
ISTLBackend_SEQ_SuperLU(int maxiter, int verbose_)
make a linear solver object
Definition: seqistlsolverbackend.hh:573
void apply(M &A, V &z, W &r, typename Dune::template FieldTraits< typename W::ElementType >::real_type reduction)
solve the given linear system
Definition: seqistlsolverbackend.hh:585
Solver backend using UMFPack as a direct solver.
Definition: seqistlsolverbackend.hh:611
ISTLBackend_SEQ_UMFPack(int verbose_=1)
make a linear solver object
Definition: seqistlsolverbackend.hh:617
void apply(M &A, V &z, W &r, typename Dune::template FieldTraits< typename W::ElementType >::real_type reduction)
solve the given linear system
Definition: seqistlsolverbackend.hh:639
ISTLBackend_SEQ_UMFPack(int maxiter, int verbose_)
make a linear solver object
Definition: seqistlsolverbackend.hh:627
Definition: seqistlsolverbackend.hh:46
virtual void apply(const X &x, Y &y) const override
apply operator to x: The input vector is consistent and the output must also be consistent on the in...
Definition: seqistlsolverbackend.hh:66
virtual void applyscaleadd(field_type alpha, const X &x, Y &y) const override
apply operator to x, scale and add:
Definition: seqistlsolverbackend.hh:78
void setLinearizationPoint(const X &u)
Definition: seqistlsolverbackend.hh:61
SolverCategory::Category category() const override
Category of the linear operator (see SolverCategory::Category)
Definition: seqistlsolverbackend.hh:92
Base class for matrix free definition of preconditioners.
Definition: preconditioner.hh:33
implements the Generalized Minimal Residual (GMRes) method
Definition: solvers.hh:827
void apply(X &x, Y &b, InverseOperatorResult &res) override
Apply inverse operator.
Definition: solvers.hh:910
Richardson preconditioner.
Definition: preconditioners.hh:878
Sequential ILU preconditioner.
Definition: preconditioners.hh:697
The sequential jacobian preconditioner.
Definition: preconditioners.hh:413
void apply(X &v, const Y &d) override
Apply the preconditioner.
Definition: preconditioners.hh:488
void pre(X &x, Y &b) override
Prepare the preconditioner.
Definition: preconditioners.hh:480
void post(X &x) override
Clean up.
Definition: preconditioners.hh:500
Sequential SOR preconditioner.
Definition: preconditioners.hh:262
Sequential SSOR preconditioner.
Definition: preconditioners.hh:142
Definition: recipe-operator-splitting.cc:108
Definition of the DUNE_NO_DEPRECATED_* macros.
Some generic functions for pretty printing vectors and matrices.
Implementations of the inverse operator interface.
#define DUNE_THROW(E, m)
Definition: exceptions.hh:218
void apply(domain_type &x, range_type &b, InverseOperatorResult &res) override
Apply inverse operator,.
Definition: superlu.hh:563
void apply(domain_type &x, range_type &b, InverseOperatorResult &res) override
Apply inverse operator,.
Definition: umfpack.hh:403
Helpers for dealing with MPI.
Dune namespace.
Definition: alignedallocator.hh:13
Define general, extensible interface for operators. The available implementation wraps a matrix.
Classes providing communication interfaces for overlapping Schwarz methods.
Define general preconditioner interface.
Define base class for scalar product and norm.
The default class for the smoother arguments.
Definition: smoother.hh:38
Statistics about the application of an inverse operator.
Definition: solver.hh:50
double elapsed
Elapsed time in seconds.
Definition: solver.hh:84
int iterations
Number of iterations.
Definition: solver.hh:69
double reduction
Reduction achieved: .
Definition: solver.hh:72
double conv_rate
Convergence rate (average reduction per step)
Definition: solver.hh:78
bool converged
True if convergence criterion has been met.
Definition: solver.hh:75
Class providing some statistics of the AMG solver.
Definition: seqistlsolverbackend.hh:701
double tprepare
The needed for computing the parallel information and for adapting the linear system.
Definition: seqistlsolverbackend.hh:706
double tsetup
The time needed for building the AMG hierarchy (coarsening).
Definition: seqistlsolverbackend.hh:712
int iterations
The number of iterations performed until convergence was reached.
Definition: seqistlsolverbackend.hh:714
double tsolve
The time spent in solving the system (without building the hierarchy.
Definition: seqistlsolverbackend.hh:710
bool directCoarseLevelSolver
True if a direct solver was used on the coarset level.
Definition: seqistlsolverbackend.hh:716
int levels
the number of levels in the AMG hierarchy.
Definition: seqistlsolverbackend.hh:708
Category
Definition: solvercategory.hh:23
@ sequential
Category for sequential solvers.
Definition: solvercategory.hh:25
Classes for using SuperLU with ISTL matrices.
Classes for using UMFPack with ISTL matrices.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 23, 23:29, 2024)