dune-pdelab  2.5-dev
novlpistlsolverbackend.hh
Go to the documentation of this file.
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_NOVLPISTLSOLVERBACKEND_HH
4 #define DUNE_PDELAB_BACKEND_ISTL_NOVLPISTLSOLVERBACKEND_HH
5 
6 // this is here for backwards compatibility and deprecation warnings, remove after 2.5.0
7 #include "ensureistlinclude.hh"
8 
9 #include <cstddef>
10 
11 #include <dune/common/deprecated.hh>
12 #include <dune/common/parallel/mpihelper.hh>
13 
14 #include <dune/grid/common/gridenums.hh>
15 
16 #include <dune/istl/io.hh>
17 #include <dune/istl/operators.hh>
18 #include <dune/istl/owneroverlapcopy.hh>
19 #include <dune/istl/paamg/amg.hh>
20 #include <dune/istl/paamg/pinfo.hh>
21 #include <dune/istl/preconditioners.hh>
22 #include <dune/istl/scalarproducts.hh>
23 #include <dune/istl/solvercategory.hh>
24 #include <dune/istl/solvers.hh>
25 #include <dune/istl/superlu.hh>
26 
34 
35 namespace Dune {
36  namespace PDELab {
37 
41 
42  //========================================================
43  // Generic support for nonoverlapping grids
44  //========================================================
45 
47 
55  template<typename GFS, typename M, typename X, typename Y>
57  : public Dune::AssembledLinearOperator<M,X,Y>
58  {
59  public:
67  typedef typename X::field_type field_type;
68 
69  //redefine the category, that is the only difference
70  enum {category=Dune::SolverCategory::nonoverlapping};
71 
73 
83  NonoverlappingOperator (const GFS& gfs_, const M& A)
84  : gfs(gfs_), _A_(A)
85  { }
86 
88 
93  virtual void apply (const X& x, Y& y) const
94  {
95  using Backend::native;
96  // apply local operator; now we have sum y_p = sequential y
97  native(_A_).mv(native(x),native(y));
98 
99  // accumulate y on border
101  if (gfs.gridView().comm().size()>1)
102  gfs.gridView().communicate(adddh,Dune::InteriorBorder_InteriorBorder_Interface,Dune::ForwardCommunication);
103  }
104 
106 
111  virtual void applyscaleadd (field_type alpha, const X& x, Y& y) const
112  {
113  using Backend::native;
114  // apply local operator; now we have sum y_p = sequential y
115  native(_A_).usmv(alpha,native(x),native(y));
116 
117  // accumulate y on border
119  if (gfs.gridView().comm().size()>1)
120  gfs.gridView().communicate(adddh,Dune::InteriorBorder_InteriorBorder_Interface,Dune::ForwardCommunication);
121  }
122 
124  virtual const M& getmat () const
125  {
126  return _A_;
127  }
128 
129  private:
130  const GFS& gfs;
131  const M& _A_;
132  };
133 
134  // parallel scalar product assuming no overlap
135  template<class GFS, class X>
136  class NonoverlappingScalarProduct : public Dune::ScalarProduct<X>
137  {
138  public:
140  typedef X domain_type;
141  typedef typename X::ElementType field_type;
142 
144  enum {category=Dune::SolverCategory::nonoverlapping};
145 
148  NonoverlappingScalarProduct (const GFS& gfs_, const ISTL::ParallelHelper<GFS>& helper_)
149  : gfs(gfs_), helper(helper_)
150  {}
151 
156  virtual field_type dot (const X& x, const X& y)
157  {
158  // do local scalar product on unique partition
159  field_type sum = helper.disjointDot(x,y);
160 
161  // do global communication
162  return gfs.gridView().comm().sum(sum);
163  }
164 
168  virtual double norm (const X& x)
169  {
170  return sqrt(static_cast<double>(this->dot(x,x)));
171  }
172 
175  void make_consistent (X& x) const
176  {
178  if (gfs.gridView().comm().size()>1)
179  gfs.gridView().communicate(adddh,Dune::InteriorBorder_InteriorBorder_Interface,Dune::ForwardCommunication);
180  }
181 
182  private:
183  const GFS& gfs;
184  const ISTL::ParallelHelper<GFS>& helper;
185  };
186 
187  // parallel Richardson preconditioner
188  template<class GFS, class X, class Y>
189  class NonoverlappingRichardson : public Dune::Preconditioner<X,Y>
190  {
191  public:
193  typedef X domain_type;
195  typedef Y range_type;
197  typedef typename X::ElementType field_type;
198 
199  // define the category
200  enum {
202  category=Dune::SolverCategory::nonoverlapping
203  };
204 
206  NonoverlappingRichardson (const GFS& gfs_, const ISTL::ParallelHelper<GFS>& helper_)
207  : gfs(gfs_), helper(helper_)
208  {
209  }
210 
214  virtual void pre (X& x, Y& b) {}
215 
219  virtual void apply (X& v, const Y& d)
220  {
221  v = d;
222  }
223 
227  virtual void post (X& x) {}
228 
229  private:
230  const GFS& gfs;
231  const ISTL::ParallelHelper<GFS>& helper;
232  };
233 
235 
247  template<typename A, typename X, typename Y>
249  : public Dune::Preconditioner<X,Y>
250  {
251 
253 
254  Diagonal _inverse_diagonal;
255 
256  public:
258 
262  typedef X domain_type;
264 
268  typedef Y range_type;
270  typedef typename X::ElementType field_type;
271 
272  enum {
274  category=Dune::SolverCategory::nonoverlapping
275  };
276 
278 
289  template<typename GFS>
290  NonoverlappingJacobi(const GFS& gfs, const A &m)
291  : _inverse_diagonal(m)
292  {
293  // make the diagonal consistent...
294  typename ISTL::BlockMatrixDiagonal<A>::template AddMatrixElementVectorDataHandle<GFS> addDH(gfs, _inverse_diagonal);
295  gfs.gridView().communicate(addDH,
296  InteriorBorder_InteriorBorder_Interface,
297  ForwardCommunication);
298 
299  // ... and then invert it
300  _inverse_diagonal.invert();
301 
302  }
303 
305  virtual void pre (X& x, Y& b) {}
306 
308  /*
309  * For this preconditioner, this method works with both consistent and
310  * inconsistent vectors: if d is consistent, v will be consistent, if d
311  * is inconsistent, v will be inconsistent.
312  */
313  virtual void apply (X& v, const Y& d)
314  {
315  _inverse_diagonal.mv(d,v);
316  }
317 
319  virtual void post (X& x) {}
320  };
321 
324 
326  template<class GFS>
328  {
330 
331  public:
338  explicit ISTLBackend_NOVLP_CG_NOPREC (const GFS& gfs_,
339  unsigned maxiter_=5000,
340  int verbose_=1)
341  : gfs(gfs_), phelper(gfs,verbose_), maxiter(maxiter_), verbose(verbose_)
342  {}
343 
348  template<class V>
349  typename V::ElementType norm (const V& v) const
350  {
351  V x(v); // make a copy because it has to be made consistent
353  PSP psp(gfs,phelper);
354  psp.make_consistent(x);
355  return psp.norm(x);
356  }
357 
365  template<class M, class V, class W>
366  void apply(M& A, V& z, W& r, typename Dune::template FieldTraits<typename V::ElementType >::real_type reduction)
367  {
369  POP pop(gfs,A);
371  PSP psp(gfs,phelper);
373  PRICH prich(gfs,phelper);
374  int verb=0;
375  if (gfs.gridView().comm().rank()==0) verb=verbose;
376  Dune::CGSolver<V> solver(pop,psp,prich,reduction,maxiter,verb);
377  Dune::InverseOperatorResult stat;
378  solver.apply(z,r,stat);
379  res.converged = stat.converged;
380  res.iterations = stat.iterations;
381  res.elapsed = stat.elapsed;
382  res.reduction = stat.reduction;
383  res.conv_rate = stat.conv_rate;
384  }
385 
388  {
389  return res;
390  }
391 
392  private:
393  const GFS& gfs;
394  PHELPER phelper;
396  unsigned maxiter;
397  int verbose;
398  };
399 
401  template<class GFS>
403  {
405 
406  const GFS& gfs;
407  PHELPER phelper;
409  unsigned maxiter;
410  int verbose;
411 
412  public:
414 
419  explicit ISTLBackend_NOVLP_CG_Jacobi(const GFS& gfs_,
420  unsigned maxiter_ = 5000,
421  int verbose_ = 1) :
422  gfs(gfs_), phelper(gfs,verbose_), maxiter(maxiter_), verbose(verbose_)
423  {}
424 
426 
431  template<class V>
432  typename V::ElementType norm (const V& v) const
433  {
434  V x(v); // make a copy because it has to be made consistent
436  PSP psp(gfs,phelper);
437  psp.make_consistent(x);
438  return psp.norm(x);
439  }
440 
442 
454  template<class M, class V, class W>
455  void apply(M& A, V& z, W& r, typename Dune::template FieldTraits<typename V::ElementType >::real_type reduction)
456  {
458  POP pop(gfs,A);
460  PSP psp(gfs,phelper);
461 
462  typedef NonoverlappingJacobi<M,V,W> PPre;
463  PPre ppre(gfs,Backend::native(A));
464 
465  int verb=0;
466  if (gfs.gridView().comm().rank()==0) verb=verbose;
467  CGSolver<V> solver(pop,psp,ppre,reduction,maxiter,verb);
468  InverseOperatorResult stat;
469  solver.apply(z,r,stat);
470  res.converged = stat.converged;
471  res.iterations = stat.iterations;
472  res.elapsed = stat.elapsed;
473  res.reduction = stat.reduction;
474  res.conv_rate = stat.conv_rate;
475  }
476 
479  { return res; }
480  };
481 
483  template<class GFS>
485  {
487 
488  public:
495  explicit ISTLBackend_NOVLP_BCGS_NOPREC (const GFS& gfs_, unsigned maxiter_=5000, int verbose_=1)
496  : gfs(gfs_), phelper(gfs,verbose_), maxiter(maxiter_), verbose(verbose_)
497  {}
498 
503  template<class V>
504  typename V::ElementType norm (const V& v) const
505  {
506  V x(v); // make a copy because it has to be made consistent
508  PSP psp(gfs,phelper);
509  psp.make_consistent(x);
510  return psp.norm(x);
511  }
512 
520  template<class M, class V, class W>
521  void apply(M& A, V& z, W& r, typename Dune::template FieldTraits<typename V::ElementType >::real_type reduction)
522  {
524  POP pop(gfs,A);
526  PSP psp(gfs,phelper);
528  PRICH prich(gfs,phelper);
529  int verb=0;
530  if (gfs.gridView().comm().rank()==0) verb=verbose;
531  Dune::BiCGSTABSolver<V> solver(pop,psp,prich,reduction,maxiter,verb);
532  Dune::InverseOperatorResult stat;
533  solver.apply(z,r,stat);
534  res.converged = stat.converged;
535  res.iterations = stat.iterations;
536  res.elapsed = stat.elapsed;
537  res.reduction = stat.reduction;
538  res.conv_rate = stat.conv_rate;
539  }
540 
543  {
544  return res;
545  }
546 
547  private:
548  const GFS& gfs;
549  PHELPER phelper;
551  unsigned maxiter;
552  int verbose;
553  };
554 
555 
557  template<class GFS>
559  {
561 
562  public:
569  explicit ISTLBackend_NOVLP_BCGS_Jacobi (const GFS& gfs_, unsigned maxiter_=5000, int verbose_=1)
570  : gfs(gfs_), phelper(gfs,verbose_), maxiter(maxiter_), verbose(verbose_)
571  {}
572 
577  template<class V>
578  typename V::ElementType norm (const V& v) const
579  {
580  V x(v); // make a copy because it has to be made consistent
582  PSP psp(gfs,phelper);
583  psp.make_consistent(x);
584  return psp.norm(x);
585  }
586 
594  template<class M, class V, class W>
595  void apply(M& A, V& z, W& r, typename Dune::template FieldTraits<typename V::ElementType >::real_type reduction)
596  {
598  POP pop(gfs,A);
600  PSP psp(gfs,phelper);
601 
602  typedef NonoverlappingJacobi<M,V,W> PPre;
603  PPre ppre(gfs,A);
604 
605  int verb=0;
606  if (gfs.gridView().comm().rank()==0) verb=verbose;
607  Dune::BiCGSTABSolver<V> solver(pop,psp,ppre,reduction,maxiter,verb);
608  Dune::InverseOperatorResult stat;
609  solver.apply(z,r,stat);
610  res.converged = stat.converged;
611  res.iterations = stat.iterations;
612  res.elapsed = stat.elapsed;
613  res.reduction = stat.reduction;
614  res.conv_rate = stat.conv_rate;
615  }
616 
619  {
620  return res;
621  }
622 
623  private:
624  const GFS& gfs;
625  PHELPER phelper;
627  unsigned maxiter;
628  int verbose;
629  };
630 
632  template<typename GFS>
634  {
636 
637  const GFS& gfs;
638  PHELPER phelper;
640 
641  public:
647  explicit ISTLBackend_NOVLP_ExplicitDiagonal(const GFS& gfs_)
648  : gfs(gfs_), phelper(gfs)
649  {}
650 
655  template<class V>
656  typename V::ElementType norm (const V& v) const
657  {
659  V x(v); // make a copy because it has to be made consistent
660  PSP psp(gfs,phelper);
661  psp.make_consistent(x);
662  return psp.norm(x);
663  }
664 
672  template<class M, class V, class W>
673  void apply(M& A, V& z, W& r, typename Dune::template FieldTraits<typename W::ElementType >::real_type reduction)
674  {
675  Dune::SeqJac<M,V,W> jac(A,1,1.0);
676  jac.pre(z,r);
677  jac.apply(z,r);
678  jac.post(z);
679  if (gfs.gridView().comm().size()>1)
680  {
682  gfs.gridView().communicate(adddh,Dune::InteriorBorder_InteriorBorder_Interface,Dune::ForwardCommunication);
683  }
684  res.converged = true;
685  res.iterations = 1;
686  res.elapsed = 0.0;
687  res.reduction = reduction;
688  res.conv_rate = reduction; // pow(reduction,1.0/1)
689  }
690 
693  {
694  return res;
695  }
696  };
698 
699 
700  template<class GO,
701  template<class,class,class,int> class Preconditioner,
702  template<class> class Solver>
704  {
705  typedef typename GO::Traits::TrialGridFunctionSpace GFS;
707 
708  public:
716  explicit ISTLBackend_NOVLP_BASE_PREC (const GO& grid_operator, unsigned maxiter_ = 5000, unsigned steps_ = 5, int verbose_ = 1)
717  : _grid_operator(grid_operator)
718  , gfs(grid_operator.trialGridFunctionSpace())
719  , phelper(gfs,verbose_)
720  , maxiter(maxiter_)
721  , steps(steps_)
722  , verbose(verbose_)
723  {}
724 
729  template<class Vector>
730  typename Vector::ElementType norm (const Vector& v) const
731  {
732  Vector x(v); // make a copy because it has to be made consistent
734  PSP psp(gfs,phelper);
735  psp.make_consistent(x);
736  return psp.norm(x);
737  }
738 
746  template<class M, class V, class W>
747  void apply(M& A, V& z, W& r, typename V::ElementType reduction)
748  {
749  using MatrixType = Backend::Native<M>;
750  MatrixType& mat = Backend::native(A);
751  using VectorType = Backend::Native<W>;
752 #if HAVE_MPI
754  _grid_operator.make_consistent(A);
755  ISTL::assertParallelUG(gfs.gridView().comm());
756  Comm oocc(gfs.gridView().comm(),Dune::SolverCategory::nonoverlapping);
757  phelper.createIndexSetAndProjectForAMG(mat, oocc);
758  typedef Preconditioner<MatrixType,VectorType,VectorType,1> Smoother;
759  Smoother smoother(mat, steps, 1.0);
760  typedef Dune::NonoverlappingSchwarzScalarProduct<VectorType,Comm> PSP;
761  PSP psp(oocc);
762  typedef Dune::NonoverlappingSchwarzOperator<MatrixType,VectorType,VectorType,Comm> Operator;
763  Operator oop(mat,oocc);
764  typedef Dune::NonoverlappingBlockPreconditioner<Comm, Smoother> ParSmoother;
765  ParSmoother parsmoother(smoother, oocc);
766 #else
767  typedef Preconditioner<MatrixType,VectorType,VectorType,1> ParSmoother;
768  ParSmoother parsmoother(mat, steps, 1.0);
769  typedef Dune::SeqScalarProduct<VectorType> PSP;
770  PSP psp;
771  typedef Dune::MatrixAdapter<MatrixType,VectorType,VectorType> Operator;
772  Operator oop(mat);
773 #endif
774  int verb=0;
775  if (gfs.gridView().comm().rank()==0) verb=verbose;
776  Solver<VectorType> solver(oop,psp,parsmoother,reduction,maxiter,verb);
777  Dune::InverseOperatorResult stat;
778  //make r consistent
779  if (gfs.gridView().comm().size()>1){
781  gfs.gridView().communicate(adddh,
782  Dune::InteriorBorder_InteriorBorder_Interface,
783  Dune::ForwardCommunication);
784  }
785 
786  solver.apply(z,r,stat);
787  res.converged = stat.converged;
788  res.iterations = stat.iterations;
789  res.elapsed = stat.elapsed;
790  res.reduction = stat.reduction;
791  res.conv_rate = stat.conv_rate;
792  }
793 
796  {
797  return res;
798  }
799 
800  private:
801  const GO& _grid_operator;
802  const GFS& gfs;
803  PHELPER phelper;
805  unsigned maxiter;
806  unsigned steps;
807  int verbose;
808  };
809 
812 
824  template<class GO>
826  : public ISTLBackend_NOVLP_BASE_PREC<GO,Dune::SeqSSOR, Dune::BiCGSTABSolver>
827  {
828 
829  public:
837  explicit ISTLBackend_NOVLP_BCGS_SSORk (const GO& grid_operator, unsigned maxiter_=5000,
838  int steps_=5, int verbose_=1)
839  : ISTLBackend_NOVLP_BASE_PREC<GO,Dune::SeqSSOR, Dune::BiCGSTABSolver>(grid_operator, maxiter_, steps_, verbose_)
840  {}
841  };
842 
846  template<class GO>
848  : public ISTLBackend_NOVLP_BASE_PREC<GO,Dune::SeqSSOR, Dune::CGSolver>
849  {
850 
851  public:
859  explicit ISTLBackend_NOVLP_CG_SSORk (const GO& grid_operator, unsigned maxiter_=5000,
860  int steps_=5, int verbose_=1)
861  : ISTLBackend_NOVLP_BASE_PREC<GO,Dune::SeqSSOR, Dune::CGSolver>(grid_operator, maxiter_, steps_, verbose_)
862  {}
863  };
866 
867  template<class GO,int s, template<class,class,class,int> class Preconditioner,
868  template<class> class Solver>
870  {
871  typedef typename GO::Traits::TrialGridFunctionSpace GFS;
872  typedef typename ISTL::ParallelHelper<GFS> PHELPER;
873  typedef typename GO::Traits::Jacobian M;
874  typedef Backend::Native<M> MatrixType;
875  typedef typename GO::Traits::Domain V;
876  typedef Backend::Native<V> VectorType;
878 #if HAVE_MPI
879  typedef Preconditioner<MatrixType,VectorType,VectorType,1> Smoother;
880  typedef Dune::NonoverlappingBlockPreconditioner<Comm,Smoother> ParSmoother;
881  typedef Dune::NonoverlappingSchwarzOperator<MatrixType,VectorType,VectorType,Comm> Operator;
882 #else
883  typedef Preconditioner<MatrixType,VectorType,VectorType,1> ParSmoother;
884  typedef Dune::MatrixAdapter<MatrixType,VectorType,VectorType> Operator;
885 #endif
886  typedef typename Dune::Amg::SmootherTraits<ParSmoother>::Arguments SmootherArgs;
887  typedef Dune::Amg::AMG<Operator,VectorType,ParSmoother,Comm> AMG;
888  typedef Dune::Amg::Parameters Parameters;
889 
890  public:
891  ISTLBackend_AMG_NOVLP(const GO& grid_operator, unsigned maxiter_=5000,
892  int verbose_=1, bool reuse_=false,
893  bool usesuperlu_=true)
894  : _grid_operator(grid_operator)
895  , gfs(grid_operator.trialGridFunctionSpace())
896  , phelper(gfs,verbose_)
897  , maxiter(maxiter_)
898  , params(15,2000,1.2,1.6,Dune::Amg::atOnceAccu)
899  , verbose(verbose_)
900  , reuse(reuse_)
901  , firstapply(true)
902  , usesuperlu(usesuperlu_)
903  {
904  params.setDefaultValuesIsotropic(GFS::Traits::GridViewType::Traits::Grid::dimension);
905  params.setDebugLevel(verbose_);
906 #if !HAVE_SUPERLU
907  if (phelper.rank() == 0 && usesuperlu == true)
908  {
909  std::cout << "WARNING: You are using AMG without SuperLU!"
910  << " Please consider installing SuperLU,"
911  << " or set the usesuperlu flag to false"
912  << " to suppress this warning." << std::endl;
913  }
914 #endif
915  }
916 
921  void setParameters(const Parameters& params_)
922  {
923  params = params_;
924  }
925 
933  const Parameters& parameters() const
934  {
935  return params;
936  }
937 
942  typename V::ElementType norm (const V& v) const
943  {
944  V x(v); // make a copy because it has to be made consistent
946  PSP psp(gfs,phelper);
947  psp.make_consistent(x);
948  return psp.norm(x);
949  }
950 
951  void apply(M& A, V& z, V& r, typename Dune::template FieldTraits<typename V::ElementType >::real_type reduction)
952  {
953  Timer watch;
954  MatrixType& mat = Backend::native(A);
955  typedef Dune::Amg::CoarsenCriterion<Dune::Amg::SymmetricCriterion<MatrixType,
956  Dune::Amg::FirstDiagonal> > Criterion;
957 #if HAVE_MPI
958  Comm oocc(gfs.gridView().comm(),Dune::SolverCategory::nonoverlapping);
959  _grid_operator.make_consistent(A);
960  phelper.createIndexSetAndProjectForAMG(A, oocc);
961  Dune::NonoverlappingSchwarzScalarProduct<VectorType,Comm> sp(oocc);
962  Operator oop(mat, oocc);
963 #else
964  Comm oocc(gfs.gridView().comm());
965  Operator oop(mat);
966  Dune::SeqScalarProduct<VectorType> sp;
967 #endif
968  SmootherArgs smootherArgs;
969  smootherArgs.iterations = 1;
970  smootherArgs.relaxationFactor = 1;
971  //use noAccu or atOnceAccu
972  Criterion criterion(params);
973  stats.tprepare=watch.elapsed();
974  watch.reset();
975 
976  int verb=0;
977  if (gfs.gridView().comm().rank()==0) verb=verbose;
978  //only construct a new AMG if the matrix changes
979  if (reuse==false || firstapply==true){
980  amg.reset(new AMG(oop, criterion, smootherArgs, oocc));
981  firstapply = false;
982  stats.tsetup = watch.elapsed();
983  stats.levels = amg->maxlevels();
984  stats.directCoarseLevelSolver=amg->usesDirectCoarseLevelSolver();
985  }
986 
987  Dune::InverseOperatorResult stat;
988  // make r consistent
989  if (gfs.gridView().comm().size()>1) {
991  gfs.gridView().communicate(adddh,
992  Dune::InteriorBorder_InteriorBorder_Interface,
993  Dune::ForwardCommunication);
994  }
995  watch.reset();
996  Solver<VectorType> solver(oop,sp,*amg,reduction,maxiter,verb);
997  solver.apply(Backend::native(z),Backend::native(r),stat);
998  stats.tsolve= watch.elapsed();
999  res.converged = stat.converged;
1000  res.iterations = stat.iterations;
1001  res.elapsed = stat.elapsed;
1002  res.reduction = stat.reduction;
1003  res.conv_rate = stat.conv_rate;
1004  }
1005 
1011  {
1012  return stats;
1013  }
1014 
1015  private:
1016  const GO& _grid_operator;
1017  const GFS& gfs;
1018  PHELPER phelper;
1019  unsigned maxiter;
1020  Parameters params;
1021  int verbose;
1022  bool reuse;
1023  bool firstapply;
1024  bool usesuperlu;
1025  std::shared_ptr<AMG> amg;
1026  ISTLAMGStatistics stats;
1027  };
1028 
1031 
1044  template<class GO, int s=96>
1046  : public ISTLBackend_AMG_NOVLP<GO, s, Dune::SeqSSOR, Dune::CGSolver>
1047  {
1048 
1049  public:
1050  ISTLBackend_NOVLP_CG_AMG_SSOR(const GO& grid_operator, unsigned maxiter_=5000,
1051  int verbose_=1, bool reuse_=false,
1052  bool usesuperlu_=true)
1053  : ISTLBackend_AMG_NOVLP<GO, s, Dune::SeqSSOR, Dune::CGSolver>(grid_operator, maxiter_,verbose_,reuse_,usesuperlu_)
1054  {}
1055  };
1056 
1069  template<class GO, int s=96>
1071  : public ISTLBackend_AMG_NOVLP<GO, s, Dune::SeqSSOR, Dune::BiCGSTABSolver>
1072  {
1073 
1074  public:
1075  ISTLBackend_NOVLP_BCGS_AMG_SSOR(const GO& grid_operator, unsigned maxiter_=5000,
1076  int verbose_=1, bool reuse_=false,
1077  bool usesuperlu_=true)
1078  : ISTLBackend_AMG_NOVLP<GO, s, Dune::SeqSSOR, Dune::BiCGSTABSolver>(grid_operator, maxiter_,verbose_,reuse_,usesuperlu_)
1079  {}
1080  };
1081 
1094  template<class GO, int s=96>
1096  : public ISTLBackend_AMG_NOVLP<GO, s, Dune::SeqSSOR, Dune::LoopSolver>
1097  {
1098 
1099  public:
1100  ISTLBackend_NOVLP_LS_AMG_SSOR(const GO& grid_operator, unsigned maxiter_=5000,
1101  int verbose_=1, bool reuse_=false,
1102  bool usesuperlu_=true)
1103  : ISTLBackend_AMG_NOVLP<GO, s, Dune::SeqSSOR, Dune::LoopSolver>(grid_operator, maxiter_,verbose_,reuse_,usesuperlu_)
1104  {}
1105  };
1108 
1109  } // namespace PDELab
1110 } // namespace Dune
1111 
1112 #endif // DUNE_PDELAB_BACKEND_ISTL_NOVLPISTLSOLVERBACKEND_HH
virtual void post(X &x)
Clean up.
Definition: novlpistlsolverbackend.hh:319
RFType conv_rate
Definition: solver.hh:36
ISTLBackend_NOVLP_BASE_PREC(const GO &grid_operator, unsigned maxiter_=5000, unsigned steps_=5, int verbose_=1)
Constructor.
Definition: novlpistlsolverbackend.hh:716
virtual void apply(X &v, const Y &d)
Apply the precondioner.
Definition: novlpistlsolverbackend.hh:313
V::ElementType norm(const V &v) const
compute global norm of a vector
Definition: novlpistlsolverbackend.hh:942
virtual double norm(const X &x)
Norm of a right-hand side vector. The vector must be consistent on the interior+border partition...
Definition: novlpistlsolverbackend.hh:168
NonoverlappingRichardson(const GFS &gfs_, const ISTL::ParallelHelper< GFS > &helper_)
Constructor.
Definition: novlpistlsolverbackend.hh:206
void setParameters(const Parameters &params_)
set AMG parameters
Definition: novlpistlsolverbackend.hh:921
Nonoverlapping parallel CG solver preconditioned with AMG smoothed by SSOR.
Definition: novlpistlsolverbackend.hh:1045
ISTLBackend_NOVLP_CG_AMG_SSOR(const GO &grid_operator, unsigned maxiter_=5000, int verbose_=1, bool reuse_=false, bool usesuperlu_=true)
Definition: novlpistlsolverbackend.hh:1050
typename impl::BackendVectorSelector< GridFunctionSpace, FieldType >::Type Vector
alias of the return type of BackendVectorSelector
Definition: backend/interface.hh:106
Backend::Native< X > domain_type
export type of vectors the matrix is applied to
Definition: novlpistlsolverbackend.hh:63
X::ElementType field_type
The field type of the preconditioner.
Definition: novlpistlsolverbackend.hh:270
V::ElementType norm(const V &v) const
compute global norm of a vector
Definition: novlpistlsolverbackend.hh:578
typename native_type< T >::type Native
Alias of the native container type associated with T or T itself if it is not a backend wrapper...
Definition: backend/interface.hh:176
NonoverlappingJacobi(const GFS &gfs, const A &m)
Constructor.
Definition: novlpistlsolverbackend.hh:290
Class providing some statistics of the AMG solver.
Definition: seqistlsolverbackend.hh:544
Definition: blockmatrixdiagonal.hh:217
Nonoverlapping parallel LoopSolver preconditioned with AMG smoothed by SSOR.
Definition: novlpistlsolverbackend.hh:1095
const Dune::PDELab::LinearSolverResult< double > & result() const
Return access to result data.
Definition: novlpistlsolverbackend.hh:692
X domain_type
export types
Definition: novlpistlsolverbackend.hh:140
bool converged
Definition: solver.hh:32
Definition: solver.hh:42
Definition: parallelhelper.hh:53
ISTLBackend_NOVLP_BCGS_NOPREC(const GFS &gfs_, unsigned maxiter_=5000, int verbose_=1)
make a linear solver object
Definition: novlpistlsolverbackend.hh:495
const std::string s
Definition: function.hh:1101
void apply(M &A, V &z, W &r, typename Dune::template FieldTraits< typename V::ElementType >::real_type reduction)
solve the given linear system
Definition: novlpistlsolverbackend.hh:595
void mv(const X &x, Y &y) const
Definition: blockmatrixdiagonal.hh:242
X domain_type
The domain type of the operator.
Definition: novlpistlsolverbackend.hh:262
parallel non-overlapping Jacobi preconditioner
Definition: novlpistlsolverbackend.hh:248
For backward compatibility – Do not use this!
Definition: adaptivity.hh:27
const Dune::PDELab::LinearSolverResult< double > & result() const
Return access to result data.
Definition: novlpistlsolverbackend.hh:795
Operator for the non-overlapping parallel case.
Definition: novlpistlsolverbackend.hh:56
Y range_type
The range type of the preconditioner.
Definition: novlpistlsolverbackend.hh:195
Definition: genericdatahandle.hh:622
Vector::ElementType norm(const Vector &v) const
Compute global norm of a vector.
Definition: novlpistlsolverbackend.hh:730
X::ElementType field_type
The field type of the preconditioner.
Definition: novlpistlsolverbackend.hh:197
void apply(M &A, V &z, W &r, typename Dune::template FieldTraits< typename V::ElementType >::real_type reduction)
solve the given linear system
Definition: novlpistlsolverbackend.hh:455
ISTLBackend_NOVLP_BCGS_Jacobi(const GFS &gfs_, unsigned maxiter_=5000, int verbose_=1)
make a linear solver object
Definition: novlpistlsolverbackend.hh:569
const Dune::PDELab::LinearSolverResult< double > & result() const
Return access to result data.
Definition: novlpistlsolverbackend.hh:387
virtual const M & getmat() const
extract the matrix
Definition: novlpistlsolverbackend.hh:124
ISTLBackend_NOVLP_LS_AMG_SSOR(const GO &grid_operator, unsigned maxiter_=5000, int verbose_=1, bool reuse_=false, bool usesuperlu_=true)
Definition: novlpistlsolverbackend.hh:1100
virtual void apply(const X &x, Y &y) const
apply operator
Definition: novlpistlsolverbackend.hh:93
Solver to be used for explicit time-steppers with (block-)diagonal mass matrix.
Definition: novlpistlsolverbackend.hh:633
void make_consistent(X &x) const
make additive vector consistent
Definition: novlpistlsolverbackend.hh:175
Nonoverlapping parallel CG solver with Jacobi preconditioner.
Definition: novlpistlsolverbackend.hh:402
Nonoverlapping parallel BiCGStab solver preconditioned with AMG smoothed by SSOR. ...
Definition: novlpistlsolverbackend.hh:1070
unsigned int iterations
Definition: solver.hh:33
void apply(M &A, V &z, V &r, typename Dune::template FieldTraits< typename V::ElementType >::real_type reduction)
Definition: novlpistlsolverbackend.hh:951
ISTLBackend_AMG_NOVLP(const GO &grid_operator, unsigned maxiter_=5000, int verbose_=1, bool reuse_=false, bool usesuperlu_=true)
Definition: novlpistlsolverbackend.hh:891
double elapsed
Definition: solver.hh:34
void apply(M &A, V &z, W &r, typename Dune::template FieldTraits< typename W::ElementType >::real_type reduction)
solve the given linear system
Definition: novlpistlsolverbackend.hh:673
virtual void pre(X &x, Y &b)
Prepare the preconditioner.
Definition: novlpistlsolverbackend.hh:214
ISTLBackend_NOVLP_CG_Jacobi(const GFS &gfs_, unsigned maxiter_=5000, int verbose_=1)
make a linear solver object
Definition: novlpistlsolverbackend.hh:419
virtual void pre(X &x, Y &b)
Prepare the preconditioner.
Definition: novlpistlsolverbackend.hh:305
Nonoverlapping parallel BiCGSTAB solver preconditioned by block SSOR.
Definition: novlpistlsolverbackend.hh:825
virtual void applyscaleadd(field_type alpha, const X &x, Y &y) const
apply operator to x, scale and add:
Definition: novlpistlsolverbackend.hh:111
virtual void apply(X &v, const Y &d)
Apply the precondioner.
Definition: novlpistlsolverbackend.hh:219
const ISTLAMGStatistics & statistics() const
Get statistics of the AMG solver (no of levels, timings).
Definition: novlpistlsolverbackend.hh:1010
Definition: novlpistlsolverbackend.hh:189
const Dune::PDELab::LinearSolverResult< double > & result() const
Return access to result data.
Definition: novlpistlsolverbackend.hh:618
V::ElementType norm(const V &v) const
compute global norm of a vector
Definition: novlpistlsolverbackend.hh:504
ISTLBackend_NOVLP_ExplicitDiagonal(const GFS &gfs_)
make a linear solver object
Definition: novlpistlsolverbackend.hh:647
const LinearSolverResult< double > & result() const
Return access to result data.
Definition: novlpistlsolverbackend.hh:478
ISTLBackend_NOVLP_CG_SSORk(const GO &grid_operator, unsigned maxiter_=5000, int steps_=5, int verbose_=1)
make a linear solver object
Definition: novlpistlsolverbackend.hh:859
Nonoverlapping parallel BiCGStab solver with Jacobi preconditioner.
Definition: novlpistlsolverbackend.hh:558
virtual void post(X &x)
Clean up.
Definition: novlpistlsolverbackend.hh:227
Backend::Native< Y > range_type
export type of result vectors
Definition: novlpistlsolverbackend.hh:65
ISTLBackend_NOVLP_CG_NOPREC(const GFS &gfs_, unsigned maxiter_=5000, int verbose_=1)
make a linear solver object
Definition: novlpistlsolverbackend.hh:338
Definition: novlpistlsolverbackend.hh:70
Nonoverlapping parallel CG solver without preconditioner.
Definition: novlpistlsolverbackend.hh:327
virtual field_type dot(const X &x, const X &y)
Dot product of two vectors. It is assumed that the vectors are consistent on the interior+border part...
Definition: novlpistlsolverbackend.hh:156
Definition: novlpistlsolverbackend.hh:136
V::ElementType norm(const V &v) const
compute global norm of a vector
Definition: novlpistlsolverbackend.hh:656
V::ElementType norm(const V &v) const
compute global norm of a vector
Definition: novlpistlsolverbackend.hh:349
X domain_type
The domain type of the preconditioner.
Definition: novlpistlsolverbackend.hh:193
ISTLBackend_NOVLP_BCGS_SSORk(const GO &grid_operator, unsigned maxiter_=5000, int steps_=5, int verbose_=1)
make a linear solver object
Definition: novlpistlsolverbackend.hh:837
void apply(M &A, V &z, W &r, typename V::ElementType reduction)
Solve the given linear system.
Definition: novlpistlsolverbackend.hh:747
NonoverlappingOperator(const GFS &gfs_, const M &A)
Construct a non-overlapping operator.
Definition: novlpistlsolverbackend.hh:83
Dune::Amg::SequentialInformation type
Definition: parallelhelper.hh:417
Definition: novlpistlsolverbackend.hh:869
ISTLBackend_NOVLP_BCGS_AMG_SSOR(const GO &grid_operator, unsigned maxiter_=5000, int verbose_=1, bool reuse_=false, bool usesuperlu_=true)
Definition: novlpistlsolverbackend.hh:1075
void invert()
Definition: blockmatrixdiagonal.hh:236
Definition: novlpistlsolverbackend.hh:703
std::enable_if< std::is_base_of< impl::WrapperBase, T >::value, Native< T > &>::type native(T &t)
Definition: backend/interface.hh:192
Nonoverlapping parallel BiCGStab solver without preconditioner.
Definition: novlpistlsolverbackend.hh:484
X::ElementType field_type
Definition: novlpistlsolverbackend.hh:141
V::ElementType norm(const V &v) const
compute global norm of a vector
Definition: novlpistlsolverbackend.hh:432
const Dune::PDELab::LinearSolverResult< double > & result() const
Return access to result data.
Definition: novlpistlsolverbackend.hh:542
Y range_type
The range type of the operator.
Definition: novlpistlsolverbackend.hh:268
X::field_type field_type
export type of the entries for x
Definition: novlpistlsolverbackend.hh:67
const Parameters & parameters() const
Get the parameters describing the behaviuour of AMG.
Definition: novlpistlsolverbackend.hh:933
RFType reduction
Definition: solver.hh:35
void apply(M &A, V &z, W &r, typename Dune::template FieldTraits< typename V::ElementType >::real_type reduction)
solve the given linear system
Definition: novlpistlsolverbackend.hh:521
void assertParallelUG(T comm)
Definition: parallelhelper.hh:433
NonoverlappingScalarProduct(const GFS &gfs_, const ISTL::ParallelHelper< GFS > &helper_)
Constructor needs to know the grid function space.
Definition: novlpistlsolverbackend.hh:148
Backend::Native< M > matrix_type
export type of matrix
Definition: novlpistlsolverbackend.hh:61
Nonoverlapping parallel CG solver preconditioned by block SSOR.
Definition: novlpistlsolverbackend.hh:847
void apply(M &A, V &z, W &r, typename Dune::template FieldTraits< typename V::ElementType >::real_type reduction)
solve the given linear system
Definition: novlpistlsolverbackend.hh:366