paralleliterativebackend.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  Copyright (C) 2008-2013 by Andreas Lauser
5  Copyright (C) 2011-2012 by Bernd Flemisch
6 
7  This file is part of the Open Porous Media project (OPM).
8 
9  OPM is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 2 of the License, or
12  (at your option) any later version.
13 
14  OPM is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with OPM. If not, see <http://www.gnu.org/licenses/>.
21 */
26 #ifndef EWOMS_PARALLEL_ITERATIVE_BACKEND_HH
27 #define EWOMS_PARALLEL_ITERATIVE_BACKEND_HH
28 
35 
38 
39 #include <ewoms/istl/solvers.hh>
40 
41 #include <dune/grid/io/file/vtk/vtkwriter.hh>
42 
43 #include <dune/istl/preconditioners.hh>
44 
45 #include <dune/common/shared_ptr.hh>
46 #include <dune/common/fvector.hh>
47 
48 #include <sstream>
49 #include <iostream>
50 
51 namespace Ewoms {
52 namespace Properties {
53 NEW_TYPE_TAG(ParallelIterativeLinearSolver);
54 
55 // forward declaration of the required property tags
56 NEW_PROP_TAG(Simulator);
57 NEW_PROP_TAG(Scalar);
58 NEW_PROP_TAG(JacobianMatrix);
59 NEW_PROP_TAG(GlobalEqVector);
60 NEW_PROP_TAG(VertexMapper);
61 NEW_PROP_TAG(GridView);
62 
63 NEW_PROP_TAG(BorderListCreator);
64 NEW_PROP_TAG(Overlap);
65 NEW_PROP_TAG(OverlappingVector);
66 NEW_PROP_TAG(OverlappingMatrix);
67 NEW_PROP_TAG(OverlappingScalarProduct);
68 NEW_PROP_TAG(OverlappingLinearOperator);
69 
71 NEW_PROP_TAG(LinearSolverBackend);
72 NEW_PROP_TAG(LinearSolverWrapper);
73 NEW_PROP_TAG(PreconditionerWrapper);
74 
82 NEW_PROP_TAG(LinearSolverOverlapSize);
83 
87 NEW_PROP_TAG(LinearSolverTolerance);
88 
96 NEW_PROP_TAG(LinearSolverVerbosity);
97 
99 NEW_PROP_TAG(LinearSolverMaxIterations);
100 
102 NEW_PROP_TAG(PreconditionerOrder);
103 
105 NEW_PROP_TAG(PreconditionerRelaxation);
106 
108 NEW_PROP_TAG(GMResRestart);
109 } // namespace Properties
110 } // namespace Ewoms
111 
112 namespace Ewoms {
113 namespace Linear {
161 template <class TypeTag>
163 {
164  typedef typename GET_PROP_TYPE(TypeTag, LinearSolverBackend) Implementation;
165 
166  typedef typename GET_PROP_TYPE(TypeTag, Simulator) Simulator;
167  typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
168  typedef typename GET_PROP_TYPE(TypeTag, JacobianMatrix) Matrix;
169  typedef typename GET_PROP_TYPE(TypeTag, GlobalEqVector) Vector;
170  typedef typename GET_PROP_TYPE(TypeTag, BorderListCreator) BorderListCreator;
171  typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
172 
173  typedef typename GET_PROP_TYPE(TypeTag, Overlap) Overlap;
174  typedef typename GET_PROP_TYPE(TypeTag, OverlappingVector) OverlappingVector;
175  typedef typename GET_PROP_TYPE(TypeTag, OverlappingMatrix) OverlappingMatrix;
176 
177  typedef typename GET_PROP_TYPE(TypeTag, PreconditionerWrapper) PreconditionerWrapper;
178  typedef typename PreconditionerWrapper::SequentialPreconditioner SequentialPreconditioner;
179 
180  typedef typename GET_PROP_TYPE(TypeTag, LinearSolverWrapper) LinearSolverWrapper;
181 
182  typedef Ewoms::Linear::OverlappingPreconditioner<SequentialPreconditioner,
183  Overlap> ParallelPreconditioner;
184  typedef Ewoms::Linear::OverlappingScalarProduct<OverlappingVector,
185  Overlap> ParallelScalarProduct;
186  typedef Ewoms::Linear::OverlappingOperator<OverlappingMatrix,
187  OverlappingVector,
188  OverlappingVector> ParallelOperator;
189 
190  enum { dimWorld = GridView::dimensionworld };
191 
192 public:
193  ParallelIterativeSolverBackend(const Simulator &simulator)
194  : simulator_(simulator)
195  {
196  overlappingMatrix_ = 0;
197  overlappingb_ = 0;
198  overlappingx_ = 0;
199  }
200 
202  { cleanup_(); }
203 
207  static void registerParameters()
208  {
209  EWOMS_REGISTER_PARAM(TypeTag, Scalar, LinearSolverTolerance,
210  "The maximum allowed error between of the linear solver");
211  EWOMS_REGISTER_PARAM(TypeTag, int, LinearSolverOverlapSize,
212  "The size of the algebraic overlap for the linear solver");
213  EWOMS_REGISTER_PARAM(TypeTag, int, LinearSolverMaxIterations,
214  "The maximum number of iterations of the linear solver");
215  EWOMS_REGISTER_PARAM(TypeTag, int, LinearSolverVerbosity,
216  "The verbosity level of the linear solver");
217 
218  LinearSolverWrapper::registerParameters();
219  PreconditionerWrapper::registerParameters();
220  }
221 
230  void setStructureMatrix(const Matrix &M)
231  {
232  cleanup_();
233  prepare_();
234  }
235 
241  bool solve(const Matrix &M, Vector &x, Vector &b)
242  {
243  Scalar oldSingularLimit = Dune::FMatrixPrecision<Scalar>::singular_limit();
244  Dune::FMatrixPrecision<Scalar>::set_singular_limit(1e-50);
245 
246  if (!overlappingMatrix_) {
247  // make sure that the overlapping matrix and block vectors
248  // have been created
249  prepare_(M);
250  }
251 
252  // copy the values of the non-overlapping linear system of
253  // equations to the overlapping one. On ther border, we add up
254  // the values of all processes (using the assignAdd() methods)
255  overlappingMatrix_->assignAdd(M);
256  overlappingb_->assignAddBorder(b);
257 
258  // copy the result back to the non-overlapping vector. This is
259  // necessary here as assignAddBorder() might modify the
260  // residual vector for the border entities and we need the
261  // "globalized" residual in b...
262  overlappingb_->assignTo(b);
263 
264  (*overlappingx_) = 0.0;
265 
266  int preconditionerIsReady = 1;
267  try {
268  // update sequential preconditioner
269  precWrapper_.prepare(*overlappingMatrix_);
270  }
271  catch (const Dune::Exception &e) {
272  std::cout << "Preconditioner threw exception \"" << e.what()
273  << " on rank " << overlappingMatrix_->overlap().myRank()
274  << "\n" << std::flush;
275  preconditionerIsReady = 0;
276  }
277 
278  // make sure that the preconditioner is also ready on all peer
279  // ranks.
280  preconditionerIsReady = simulator_.gridView().comm().min(preconditionerIsReady);
281  if (!preconditionerIsReady) {
282  Dune::FMatrixPrecision<Scalar>::set_singular_limit(oldSingularLimit);
283  return false;
284  }
285 
286  // create the parallel preconditioner
287  ParallelPreconditioner parPreCond(precWrapper_.get(),
288  overlappingMatrix_->overlap());
289 
290  // create the parallel scalar product and the parallel operator
291  ParallelScalarProduct parScalarProduct(overlappingMatrix_->overlap());
292  ParallelOperator parOperator(*overlappingMatrix_);
293 
294  // retrieve the linear solver
295  auto &solver = solverWrapper_.get(parOperator, parScalarProduct, parPreCond);
296 
298  // create a residual reduction convergence criterion
299 
300  // set the weighting of the residuals
301  OverlappingVector residWeightVec(*overlappingx_);
302  residWeightVec = 0.0;
303  const auto &overlap = overlappingMatrix_->overlap();
304  for (unsigned localIdx = 0; localIdx < unsigned(overlap.numLocal()); ++localIdx) {
305  int nativeIdx = overlap.domesticToNative(localIdx);
306  for (int eqIdx = 0; eqIdx < Vector::block_type::dimension; ++eqIdx) {
307  residWeightVec[localIdx][eqIdx] =
308  this->simulator_.model().eqWeight(nativeIdx, eqIdx);
309  }
310  }
311 
312  Scalar linearSolverTolerance = EWOMS_GET_PARAM(TypeTag, Scalar, LinearSolverTolerance);
313  Scalar linearSolverAbsTolerance = simulator_.model().newtonMethod().tolerance() / 100.0;
314  Scalar linearSolverFixPointTolerance = 100*std::numeric_limits<Scalar>::epsilon();
315  typedef typename GridView::CollectiveCommunication Comm;
316  auto *convCrit =
318  simulator_.gridView().comm(),
319  residWeightVec,
320  /*fixPointTolerance=*/linearSolverFixPointTolerance,
321  /*residualReductionTolerance=*/linearSolverTolerance,
322  /*absoluteResidualTolerance=*/linearSolverAbsTolerance);
323 
324  // done creating the convergence criterion
326 
327  // tell the linear solver to use it
329  solver.setConvergenceCriterion(std::shared_ptr<ConvergenceCriterion>(convCrit));
330 
331  // run the linear solver and have some fun
332  Dune::InverseOperatorResult result;
333  int solverSucceeded = 1;
334  try {
335  solver.apply(*overlappingx_, *overlappingb_, result);
336  solverSucceeded = simulator_.gridView().comm().min(solverSucceeded);
337  }
338  catch (const Dune::Exception &) {
339  solverSucceeded = 0;
340  solverSucceeded = simulator_.gridView().comm().min(solverSucceeded);
341  }
342 
343  // free the unneeded memory of the sequential preconditioner
344  // and the linear solver
345  solverWrapper_.cleanup();
346  precWrapper_.cleanup();
347 
348  if (!solverSucceeded) {
349  Dune::FMatrixPrecision<Scalar>::set_singular_limit(oldSingularLimit);
350  return false;
351  }
352 
353  // copy the result back to the non-overlapping vector
354  overlappingx_->assignTo(x);
355 
356  // reset the singularity limit to the same value as before the
357  // linear solver was invoked.
358  Dune::FMatrixPrecision<Scalar>::set_singular_limit(oldSingularLimit);
359 
360  // return the result of the solver
361  return result.converged;
362  }
363 
364 private:
365  Implementation &asImp_()
366  { return *static_cast<Implementation *>(this); }
367 
368  const Implementation &asImp_() const
369  { return *static_cast<const Implementation *>(this); }
370 
371  void prepare_(const Matrix &M)
372  {
373  BorderListCreator borderListCreator(simulator_.gridView(),
374  simulator_.model().dofMapper());
375 
376  // create the overlapping Jacobian matrix
377  int overlapSize = EWOMS_GET_PARAM(TypeTag, int, LinearSolverOverlapSize);
378  overlappingMatrix_ = new OverlappingMatrix(M,
379  borderListCreator.borderList(),
380  borderListCreator.blackList(),
381  overlapSize);
382 
383  // create the overlapping vectors for the residual and the
384  // solution
385  overlappingb_ = new OverlappingVector(overlappingMatrix_->overlap());
386  overlappingx_ = new OverlappingVector(*overlappingb_);
387 
388  // writeOverlapToVTK_();
389  }
390 
391  void cleanup_()
392  {
393  // create the overlapping Jacobian matrix and vectors
394  delete overlappingMatrix_;
395  delete overlappingb_;
396  delete overlappingx_;
397 
398  overlappingMatrix_ = 0;
399  overlappingb_ = 0;
400  overlappingx_ = 0;
401  }
402 
403  void writeOverlapToVTK_()
404  {
405  for (int lookedAtRank = 0;
406  lookedAtRank < simulator_.gridView().comm().size(); ++lookedAtRank) {
407  std::cout << "writing overlap for rank " << lookedAtRank << "\n" << std::flush;
408  typedef Dune::BlockVector<Dune::FieldVector<Scalar, 1> > VtkField;
409  int n = simulator_.gridView().size(/*codim=*/dimWorld);
410  VtkField isInOverlap(n);
411  VtkField rankField(n);
412  isInOverlap = 0.0;
413  rankField = 0.0;
414  assert(rankField.two_norm() == 0.0);
415  assert(isInOverlap.two_norm() == 0.0);
416  auto vIt = simulator_.gridView().template begin</*codim=*/dimWorld>();
417  const auto &vEndIt = simulator_.gridView().template end</*codim=*/dimWorld>();
418  const auto &overlap = overlappingMatrix_->overlap();
419  for (; vIt != vEndIt; ++vIt) {
420  int nativeIdx = simulator_.model().vertexMapper().map(*vIt);
421  int localIdx = overlap.foreignOverlap().nativeToLocal(nativeIdx);
422  if (localIdx < 0)
423  continue;
424  rankField[nativeIdx] = simulator_.gridView().comm().rank();
425  if (overlap.peerHasIndex(lookedAtRank, localIdx))
426  isInOverlap[nativeIdx] = 1.0;
427  }
428 
429  typedef Dune::VTKWriter<GridView> VtkWriter;
430  VtkWriter writer(simulator_.gridView(), Dune::VTK::conforming);
431  writer.addVertexData(isInOverlap, "overlap");
432  writer.addVertexData(rankField, "rank");
433 
434  std::ostringstream oss;
435  oss << "overlap_rank=" << lookedAtRank;
436  writer.write(oss.str().c_str(), Dune::VTK::ascii);
437  }
438  }
439 
440  const Simulator &simulator_;
441 
442  OverlappingMatrix *overlappingMatrix_;
443  OverlappingVector *overlappingb_;
444  OverlappingVector *overlappingx_;
445 
446  PreconditionerWrapper precWrapper_;
447  LinearSolverWrapper solverWrapper_;
448 };
449 
453 #define EWOMS_WRAP_ISTL_SOLVER(SOLVER_NAME, ISTL_SOLVER_NAME) \
454  template <class TypeTag> \
455  class SolverWrapper##SOLVER_NAME \
456  { \
457  typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; \
458  typedef typename GET_PROP_TYPE(TypeTag, \
459  OverlappingMatrix) OverlappingMatrix; \
460  typedef typename GET_PROP_TYPE(TypeTag, \
461  OverlappingVector) OverlappingVector; \
462  \
463  typedef ISTL_SOLVER_NAME<OverlappingVector> ParallelSolver; \
464  \
465  public: \
466  SolverWrapper##SOLVER_NAME() \
467  {} \
468  \
469  static void registerParameters() \
470  {} \
471  \
472  template <class LinearOperator, class ScalarProduct, class Preconditioner> \
473  ParallelSolver &get(LinearOperator &parOperator, \
474  ScalarProduct &parScalarProduct, \
475  Preconditioner &parPreCond) \
476  { \
477  Scalar tolerance = EWOMS_GET_PARAM(TypeTag, Scalar, \
478  LinearSolverTolerance); \
479  int maxIter = EWOMS_GET_PARAM(TypeTag, int, LinearSolverMaxIterations);\
480  \
481  int verbosity = 0; \
482  if (parOperator.overlap().myRank() == 0) \
483  verbosity = EWOMS_GET_PARAM(TypeTag, int, LinearSolverVerbosity); \
484  solver_ = new ParallelSolver(parOperator, parScalarProduct, \
485  parPreCond, tolerance, maxIter, \
486  verbosity); \
487  \
488  return *solver_; \
489  } \
490  \
491  void cleanup() \
492  { delete solver_; } \
493  \
494  private: \
495  ParallelSolver *solver_; \
496  };
497 
499 EWOMS_WRAP_ISTL_SOLVER(SteepestDescent, Ewoms::GradientSolver)
500 EWOMS_WRAP_ISTL_SOLVER(ConjugatedGradients, Ewoms::CGSolver)
501 EWOMS_WRAP_ISTL_SOLVER(BiCGStab, Ewoms::BiCGSTABSolver)
502 EWOMS_WRAP_ISTL_SOLVER(MinRes, Ewoms::MINRESSolver)
503 EWOMS_WRAP_ISTL_SOLVER(RestartedGMRes, Ewoms::RestartedGMResSolver)
504 
505 #undef EWOMS_WRAP_ISTL_SOLVER
506 #undef EWOMS_ISTL_SOLVER_TYPDEF
507 
508 #define EWOMS_WRAP_ISTL_PRECONDITIONER(PREC_NAME, ISTL_PREC_TYPE) \
509  template <class TypeTag> \
510  class PreconditionerWrapper##PREC_NAME \
511  { \
512  typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; \
513  typedef typename GET_PROP_TYPE(TypeTag, JacobianMatrix) JacobianMatrix; \
514  typedef typename GET_PROP_TYPE(TypeTag, \
515  OverlappingVector) OverlappingVector; \
516  \
517  public: \
518  typedef ISTL_PREC_TYPE<JacobianMatrix, OverlappingVector, \
519  OverlappingVector> SequentialPreconditioner; \
520  PreconditionerWrapper##PREC_NAME() \
521  {} \
522  \
523  static void registerParameters() \
524  { \
525  EWOMS_REGISTER_PARAM(TypeTag, int, PreconditionerOrder, \
526  "The order of the preconditioner"); \
527  EWOMS_REGISTER_PARAM(TypeTag, Scalar, PreconditionerRelaxation, \
528  "The relaxation factor of the " \
529  "preconditioner"); \
530  } \
531  \
532  void prepare(JacobianMatrix &matrix) \
533  { \
534  int order = EWOMS_GET_PARAM(TypeTag, int, PreconditionerOrder); \
535  Scalar relaxationFactor = EWOMS_GET_PARAM(TypeTag, Scalar, PreconditionerRelaxation); \
536  seqPreCond_ = new SequentialPreconditioner(matrix, order, \
537  relaxationFactor); \
538  } \
539  \
540  SequentialPreconditioner &get() \
541  { return *seqPreCond_; } \
542  \
543  void cleanup() \
544  { delete seqPreCond_; } \
545  \
546  private: \
547  SequentialPreconditioner *seqPreCond_; \
548  };
549 
550 // the same as the EWOMS_WRAP_ISTL_PRECONDITIONER macro, but without
551 // an 'order' argument for the preconditioner's constructor
552 #define EWOMS_WRAP_ISTL_SIMPLE_PRECONDITIONER(PREC_NAME, ISTL_PREC_TYPE) \
553  template <class TypeTag> \
554  class PreconditionerWrapper##PREC_NAME \
555  { \
556  typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; \
557  typedef typename GET_PROP_TYPE(TypeTag, JacobianMatrix) JacobianMatrix; \
558  typedef typename GET_PROP_TYPE(TypeTag, \
559  OverlappingVector) OverlappingVector; \
560  \
561  public: \
562  typedef ISTL_PREC_TYPE<JacobianMatrix, OverlappingVector, \
563  OverlappingVector> SequentialPreconditioner; \
564  PreconditionerWrapper##PREC_NAME() \
565  {} \
566  \
567  static void registerParameters() \
568  { \
569  EWOMS_REGISTER_PARAM(TypeTag, Scalar, PreconditionerRelaxation, \
570  "The relaxation factor of the " \
571  "preconditioner"); \
572  } \
573  \
574  void prepare(JacobianMatrix &matrix) \
575  { \
576  Scalar relaxationFactor= EWOMS_GET_PARAM(TypeTag, Scalar, PreconditionerRelaxation);\
577  seqPreCond_ = new SequentialPreconditioner(matrix, \
578  relaxationFactor); \
579  } \
580  \
581  SequentialPreconditioner &get() \
582  { return *seqPreCond_; } \
583  \
584  void cleanup() \
585  { delete seqPreCond_; } \
586  \
587  private: \
588  SequentialPreconditioner *seqPreCond_; \
589  };
590 
591 EWOMS_WRAP_ISTL_PRECONDITIONER(Jacobi, Dune::SeqJac)
592 // EWOMS_WRAP_ISTL_PRECONDITIONER(Richardson, Dune::Richardson)
593 EWOMS_WRAP_ISTL_PRECONDITIONER(GaussSeidel, Dune::SeqGS)
595 EWOMS_WRAP_ISTL_PRECONDITIONER(SSOR, Dune::SeqSSOR)
597 EWOMS_WRAP_ISTL_PRECONDITIONER(ILUm, Dune::SeqILUn)
598 EWOMS_WRAP_ISTL_PRECONDITIONER(Solver, Ewoms::Linear::SolverPreconditioner)
599 
600 #undef EWOMS_WRAP_ISTL_PRECONDITIONER
601 } // namespace Linear
602 } // namespace Ewoms
603 
604 namespace Ewoms {
605 namespace Properties {
607 SET_INT_PROP(ParallelIterativeLinearSolver, LinearSolverVerbosity, 0);
608 
610 SET_SCALAR_PROP(ParallelIterativeLinearSolver, PreconditionerRelaxation, 1.0);
611 
613 SET_INT_PROP(ParallelIterativeLinearSolver, PreconditionerOrder, 0);
614 
616 SET_INT_PROP(ParallelIterativeLinearSolver, GMResRestart, 10);
617 
618 SET_TYPE_PROP(ParallelIterativeLinearSolver, OverlappingMatrix,
620  TypeTag, JacobianMatrix)>);
621 SET_TYPE_PROP(ParallelIterativeLinearSolver, Overlap,
622  typename GET_PROP_TYPE(TypeTag, OverlappingMatrix)::Overlap);
623 SET_PROP(ParallelIterativeLinearSolver, OverlappingVector)
624 {
625  typedef typename GET_PROP_TYPE(TypeTag, GlobalEqVector) Vector;
626  typedef typename GET_PROP_TYPE(TypeTag, Overlap) Overlap;
627  typedef Ewoms::Linear::OverlappingBlockVector<typename Vector::block_type,
628  Overlap> type;
629 };
630 SET_PROP(ParallelIterativeLinearSolver, OverlappingScalarProduct)
631 {
632  typedef typename GET_PROP_TYPE(TypeTag, OverlappingVector) OverlappingVector;
633  typedef typename GET_PROP_TYPE(TypeTag, Overlap) Overlap;
635 };
636 SET_PROP(ParallelIterativeLinearSolver, OverlappingLinearOperator)
637 {
638  typedef typename GET_PROP_TYPE(TypeTag, OverlappingMatrix) OverlappingMatrix;
639  typedef typename GET_PROP_TYPE(TypeTag, OverlappingVector) OverlappingVector;
640  typedef Ewoms::Linear::OverlappingOperator<OverlappingMatrix, OverlappingVector,
641  OverlappingVector> type;
642 };
643 
644 SET_TYPE_PROP(ParallelIterativeLinearSolver, LinearSolverBackend,
646 SET_TYPE_PROP(ParallelIterativeLinearSolver, LinearSolverWrapper,
647  Ewoms::Linear::SolverWrapperBiCGStab<TypeTag>);
648 SET_TYPE_PROP(ParallelIterativeLinearSolver, PreconditionerWrapper,
649  Ewoms::Linear::PreconditionerWrapperILU0<TypeTag>);
650 
652 SET_SCALAR_PROP(ParallelIterativeLinearSolver, LinearSolverOverlapSize, 2);
653 
655 SET_INT_PROP(ParallelIterativeLinearSolver, LinearSolverMaxIterations, 250);
656 } // namespace Properties
657 } // namespace Ewoms
658 
659 #endif
#define EWOMS_WRAP_ISTL_SIMPLE_PRECONDITIONER(PREC_NAME, ISTL_PREC_TYPE)
Definition: paralleliterativebackend.hh:552
An overlap aware ISTL scalar product.
Definition: overlappingscalarproduct.hh:42
An ISTL preconditioner that solves the linear system of equations locally on each rank...
An overlap aware block-compressed row storage (BCRS) matrix.
An overlap aware linear operator usable by ISTL.
SET_SCALAR_PROP(NumericModel, EndTime,-1e100)
The default value for the simulation's end time.
Base class for all convergence criteria which only defines an virtual API.
Definition: convergencecriterion.hh:51
An overlap aware preconditioner for any ISTL linear solver.
Definition: overlappingpreconditioner.hh:42
Copy of dune-istl's linear solvers with added support for pluggable convergence criteria.
An overlap aware block-compressed row storage (BCRS) matrix.
Definition: overlappingbcrsmatrix.hh:52
void setStructureMatrix(const Matrix &M)
Set the structure of the linear system of equations to be solved.
Definition: paralleliterativebackend.hh:230
An overlap aware block vector.
Definition: overlappingblockvector.hh:47
#define EWOMS_WRAP_ISTL_SOLVER(SOLVER_NAME, ISTL_SOLVER_NAME)
Macro to create a wrapper around an ISTL solver.
Definition: paralleliterativebackend.hh:453
#define GET_PROP_TYPE(TypeTag, PropTagName)
Access the type attribute of a property for a type tag.
Definition: propertysystem.hh:485
ParallelIterativeSolverBackend(const Simulator &simulator)
Definition: paralleliterativebackend.hh:193
SET_PROP(NumericModel, ParameterTree)
Set the ParameterTree property.
Definition: basicproperties.hh:117
An overlap aware ISTL scalar product.
SET_INT_PROP(NumericModel, GridGlobalRefinements, 0)
Convergence criterion which looks at the weighted absolute value of the residual. ...
Definition: weightedresidreductioncriterion.hh:54
Definition: cartesianindexmapper.hh:31
NEW_PROP_TAG(Grid)
The type of the DUNE grid.
bool solve(const Matrix &M, Vector &x, Vector &b)
Actually solve the linear system of equations.
Definition: paralleliterativebackend.hh:241
This file provides the infrastructure to retrieve run-time parameters.
SET_TYPE_PROP(NumericModel, Scalar, double)
Set the default type of scalar values to double.
Manages the initializing and running of time dependent problems.
Definition: simulator.hh:73
Definition: baseauxiliarymodule.hh:35
Preconditioned loop solver.
Definition: solvers.hh:167
Implements a generic linear solver abstraction.
Definition: paralleliterativebackend.hh:162
#define EWOMS_REGISTER_PARAM(TypeTag, ParamType, ParamName, Description)
Register a run-time parameter.
Definition: parametersystem.hh:64
Model & model()
Return the physical model used in the simulation.
Definition: simulator.hh:176
~ParallelIterativeSolverBackend()
Definition: paralleliterativebackend.hh:201
static void registerParameters()
Register all run-time parameters for the linear solver.
Definition: paralleliterativebackend.hh:207
GridView & gridView()
Return the grid view for which the simulation is done.
Definition: simulator.hh:164
NEW_TYPE_TAG(AuxModule)
Provides the magic behind the eWoms property system.
An overlap aware block vector.
#define EWOMS_WRAP_ISTL_PRECONDITIONER(PREC_NAME, ISTL_PREC_TYPE)
Definition: paralleliterativebackend.hh:508
An overlap aware preconditioner for any ISTL linear solver.
#define EWOMS_GET_PARAM(TypeTag, ParamType, ParamName)
Retrieve a runtime parameter.
Definition: parametersystem.hh:95
An overlap aware linear operator usable by ISTL.
Definition: overlappingoperator.hh:37