Commit 174b0445 authored by Markus Wolff's avatar Markus Wolff
Browse files

decoupled models now use linear solver-backends

   - So far backends for BiCGSTAB with different sequential
     preconditioners available in dumux/linear/seqsolverbackend.hh



git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@5726 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent 1d78cbdc
......@@ -38,6 +38,7 @@
//Dumux-includes
#include <dumux/decoupled/common/decoupledproperties.hh>
#include <dumux/linear/seqsolverbackend.hh>
namespace Dumux
{
......@@ -73,26 +74,9 @@ NEW_PROP_TAG( Fluid )
; //!< The fluid for one-phase models
//Properties for linear solvers
NEW_PROP_TAG(PressureCoefficientMatrix)
;//!< Type of the coefficient matrix given to the linear solver
NEW_PROP_TAG(PressureRHSVector)
;//!< Type of the right hand side vector given to the linear solver
NEW_PROP_TAG( PressurePreconditioner )
;//!< Type of the preconditioner
NEW_PROP_TAG( PressureSolver )
;//!< Type of the solver
NEW_PROP_TAG( SolverParameters )
;//!< Container for the solver parameters
NEW_PROP_TAG(ReductionSolver)
;//!< Reduction value for linear solver
NEW_PROP_TAG(MaxIterationNumberSolver)
;//!< Maximum iteration number for linear solver
NEW_PROP_TAG(IterationNumberPreconditioner)
;//!< Iteration number for preconditioner
NEW_PROP_TAG(VerboseLevelSolver)
;//!<Verbose level of linear solver and preconditioner
NEW_PROP_TAG(RelaxationPreconditioner)
;//!< Relaxation factor for preconditioner
NEW_PROP_TAG(PressureCoefficientMatrix);//!< Type of the coefficient matrix given to the linear solver
NEW_PROP_TAG(PressureRHSVector);//!< Type of the right hand side vector given to the linear solver
NEW_PROP_TAG( LinearSolver );//!< Type of linear solver
//////////////////////////////////////////////////////////////////
// Properties
......@@ -122,39 +106,8 @@ public:
typedef Dune::BlockVector<Dune::FieldVector<Scalar, 1> > type;
};
SET_PROP(DecoupledOneP, PressurePreconditioner)
{
private:
typedef typename GET_PROP_TYPE(TypeTag, PTAG(PressureCoefficientMatrix)) Matrix;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(PressureRHSVector)) Vector;
public:
typedef Dune::SeqILUn<Matrix, Vector, Vector> type;
};
SET_PROP(DecoupledOneP, PressureSolver)
{
private:
typedef typename GET_PROP_TYPE(TypeTag, PTAG(PressureCoefficientMatrix)) Matrix;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(PressureRHSVector)) Vector;
public:
typedef Dune::BiCGSTABSolver<Vector> type;
};
SET_SCALAR_PROP(DecoupledOneP, ReductionSolver, 1E-12);
SET_INT_PROP(DecoupledOneP, MaxIterationNumberSolver, 10000);
SET_INT_PROP(DecoupledOneP, IterationNumberPreconditioner, 0);
SET_INT_PROP(DecoupledOneP, VerboseLevelSolver, 1);
SET_SCALAR_PROP(DecoupledOneP, RelaxationPreconditioner, 1.0);
SET_PROP(DecoupledOneP, SolverParameters)
{
public:
//solver parameters
static constexpr double reductionSolver = GET_PROP_VALUE(TypeTag, PTAG(ReductionSolver));
static constexpr int maxIterationNumberSolver = GET_PROP_VALUE(TypeTag, PTAG(MaxIterationNumberSolver));
static constexpr int iterationNumberPreconditioner = GET_PROP_VALUE(TypeTag, PTAG(IterationNumberPreconditioner));
static constexpr int verboseLevelSolver = GET_PROP_VALUE(TypeTag, PTAG(VerboseLevelSolver));
static constexpr double relaxationPreconditioner = GET_PROP_VALUE(TypeTag, PTAG(RelaxationPreconditioner));
};
// use the stabilized BiCG solver preconditioned by the ILU-0 by default
SET_TYPE_PROP(DecoupledOneP, LinearSolver, Dumux::ILU0BiCGSTABBackend<TypeTag> );
}
}
#endif
......@@ -434,26 +434,15 @@ void FVPressure1P<TypeTag>::assemble(bool first)
template<class TypeTag>
void FVPressure1P<TypeTag>::solve()
{
typedef typename GET_PROP(TypeTag, PTAG(SolverParameters)) SolverParameters;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(PressurePreconditioner)) Preconditioner;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(PressureSolver)) Solver;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(LinearSolver)) Solver;
Dune::MatrixAdapter < Matrix, Vector, Vector > op(A_); // make linear operator from A_
Dune::InverseOperatorResult result;
double reduction = SolverParameters::reductionSolver;
int maxItSolver = SolverParameters::maxIterationNumberSolver;
int iterPreconditioner = SolverParameters::iterationNumberPreconditioner;
int verboseLevelSolver = SolverParameters::verboseLevelSolver;
double relaxation = SolverParameters::relaxationPreconditioner;
int verboseLevelSolver = GET_PROP_VALUE(TypeTag, PTAG(LSVerbosity));
if (verboseLevelSolver)
std::cout << "FVPressure1P: solve for pressure" << std::endl;
Preconditioner preconditioner(A_, iterPreconditioner, relaxation);
Solver solver(op, preconditioner, reduction, maxItSolver, verboseLevelSolver);
solver.apply(problem_.variables().pressure(), f_, result);
Solver solver(problem_);
solver.solve(A_, problem_.variables().pressure(), f_);
// printmatrix(std::cout, A_, "global stiffness matrix", "row", 11, 3);
// printvector(std::cout, f_, "right hand side", "row", 200, 1, 3);
// printvector(std::cout, (problem_.variables().pressure()), "pressure", "row", 200, 1, 3);
......
......@@ -34,11 +34,6 @@
#ifndef DUMUX_2PPROPERTIES_HH
#define DUMUX_2PPROPERTIES_HH
//Dune-includes
#include <dune/istl/operators.hh>
#include <dune/istl/solvers.hh>
#include <dune/istl/preconditioners.hh>
//Dumux-includes
#include <dumux/decoupled/common/impetproperties.hh>
#include <dumux/decoupled/2p/transport/transportproperties.hh>
......@@ -158,41 +153,6 @@ SET_TYPE_PROP(DecoupledTwoP, FluidSystem, FluidSystem2P<TypeTag>);
SET_TYPE_PROP(DecoupledTwoP, FluidState, TwoPFluidState<TypeTag>);
SET_PROP(DecoupledTwoP, PressureCoefficientMatrix)
{
private:
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
typedef Dune::FieldMatrix<Scalar, 1, 1> MB;
public:
typedef Dune::BCRSMatrix<MB> type;
};
SET_PROP(DecoupledTwoP, PressureRHSVector)
{
private:
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
public:
typedef Dune::BlockVector<Dune::FieldVector<Scalar, 1> > type;
};
SET_PROP(DecoupledTwoP, PressurePreconditioner)
{
private:
typedef typename GET_PROP_TYPE(TypeTag, PTAG(PressureCoefficientMatrix)) Matrix;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(PressureRHSVector)) Vector;
public:
typedef Dune::SeqILUn<Matrix, Vector, Vector> type;
};
SET_PROP(DecoupledTwoP, PressureSolver)
{
private:
typedef typename GET_PROP_TYPE(TypeTag, PTAG(PressureCoefficientMatrix)) Matrix;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(PressureRHSVector)) Vector;
public:
typedef Dune::BiCGSTABSolver<Vector> type;
// typedef Dune::CGSolver<Vector> type;
};
SET_PROP_DEFAULT(LocalStiffness)
{
private:
......@@ -204,24 +164,6 @@ private:
public:
typedef MimeticGroundwaterEquationLocalStiffness<GridView,Scalar,Variables, Problem> type;
};
//SET_INT_PROP(DecoupledTwoP, PressurePreconditioner, SolverIndices::seqILU0);
//SET_INT_PROP(DecoupledTwoP, PressureSolver, SolverIndices::biCGSTAB);
SET_SCALAR_PROP(DecoupledTwoP, ReductionSolver, 1E-12);
SET_INT_PROP(DecoupledTwoP, MaxIterationNumberSolver, 10000);
SET_INT_PROP(DecoupledTwoP, IterationNumberPreconditioner, 0);
SET_INT_PROP(DecoupledTwoP, VerboseLevelSolver, 1);
SET_SCALAR_PROP(DecoupledTwoP, RelaxationPreconditioner, 1.0);
SET_PROP(DecoupledTwoP, SolverParameters)
{
public:
//solver parameters
static constexpr double reductionSolver = GET_PROP_VALUE(TypeTag, PTAG(ReductionSolver));
static constexpr int maxIterationNumberSolver = GET_PROP_VALUE(TypeTag, PTAG(MaxIterationNumberSolver));
static constexpr int iterationNumberPreconditioner = GET_PROP_VALUE(TypeTag, PTAG(IterationNumberPreconditioner));
static constexpr int verboseLevelSolver = GET_PROP_VALUE(TypeTag, PTAG(VerboseLevelSolver));
static constexpr double relaxationPreconditioner = GET_PROP_VALUE(TypeTag, PTAG(RelaxationPreconditioner));
};
// \}
}
......
......@@ -806,25 +806,15 @@ void FVPressure2P<TypeTag>::assemble(bool first)
template<class TypeTag>
void FVPressure2P<TypeTag>::solve()
{
typedef typename GET_PROP(TypeTag, PTAG(SolverParameters)) SolverParameters;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(PressurePreconditioner)) Preconditioner;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(PressureSolver)) Solver;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(LinearSolver)) Solver;
Dune::MatrixAdapter<Matrix, Vector, Vector> op(A_); // make linear operator from A_
Dune::InverseOperatorResult result;
double reduction = SolverParameters::reductionSolver;
int maxItSolver = SolverParameters::maxIterationNumberSolver;
int iterPreconditioner = SolverParameters::iterationNumberPreconditioner;
int verboseLevelSolver = SolverParameters::verboseLevelSolver;
double relaxation = SolverParameters::relaxationPreconditioner;
int verboseLevelSolver = GET_PROP_VALUE(TypeTag, PTAG(LSVerbosity));
if (verboseLevelSolver)
std::cout << "FVPressure2P: solve for pressure" << std::endl;
Preconditioner preconditioner(A_, iterPreconditioner, relaxation);
Solver solver(op, preconditioner, reduction, maxItSolver, verboseLevelSolver);
solver.apply(problem_.variables().pressure(), f_, result);
Solver solver(problem_);
solver.solve(A_, problem_.variables().pressure(), f_);
// printmatrix(std::cout, A_, "global stiffness matrix", "row", 11, 3);
// printvector(std::cout, f_, "right hand side", "row", 200, 1, 3);
......
......@@ -2398,25 +2398,15 @@ void FVMPFAOPressure2P<TypeTag>::assemble()
template<class TypeTag>
void FVMPFAOPressure2P<TypeTag>::solve()
{
typedef typename GET_PROP(TypeTag, PTAG(SolverParameters)) SolverParameters;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(PressurePreconditioner)) Preconditioner;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(PressureSolver)) Solver;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(LinearSolver)) Solver;
Dune::MatrixAdapter<Matrix, Vector, Vector> op(A_); // make linear operator from A_
Dune::InverseOperatorResult result;
double reduction = SolverParameters::reductionSolver;
int maxItSolver = SolverParameters::maxIterationNumberSolver;
int iterPreconditioner = SolverParameters::iterationNumberPreconditioner;
int verboseLevelSolver = SolverParameters::verboseLevelSolver;
double relaxation = SolverParameters::relaxationPreconditioner;
int verboseLevelSolver = GET_PROP_VALUE(TypeTag, PTAG(LSVerbosity));
if (verboseLevelSolver)
std::cout << "FVMPFAOPressure2P: solve for pressure" << std::endl;
std::cout << "FVMPFAOPressure2P: solve for pressure" << std::endl;
Preconditioner preconditioner(A_, iterPreconditioner, relaxation);
Solver solver(op, preconditioner, reduction, maxItSolver, verboseLevelSolver);
solver.apply(problem_.variables().pressure(), f_, result);
Solver solver(problem_);
solver.solve(A_, problem_.variables().pressure(), f_);
// printmatrix(std::cout, A_, "global stiffness matrix", "row", 11, 3);
// printvector(std::cout, f_, "right hand side", "row", 200, 1, 3);
......
......@@ -231,30 +231,15 @@ protected:
template<class TypeTag>
void MimeticPressure2P<TypeTag>::solve()
{
typedef typename GET_PROP(TypeTag, PTAG(SolverParameters)) SolverParameters;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(PressurePreconditioner)) Preconditioner;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(PressureSolver)) Solver;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(LinearSolver)) Solver;
typedef TraceType Vector;
typedef typename CROperatorAssembler<Scalar,GridView>::RepresentationType Matrix;
typedef Dune::MatrixAdapter<Matrix,Vector,Vector> Operator;
Operator op(*A_);
Dune::InverseOperatorResult result;
double reduction = SolverParameters::reductionSolver;
int maxItSolver = SolverParameters::maxIterationNumberSolver;
int iterPreconditioner = SolverParameters::iterationNumberPreconditioner;
int verboseLevelSolver = SolverParameters::verboseLevelSolver;
double relaxation = SolverParameters::relaxationPreconditioner;
int verboseLevelSolver = GET_PROP_VALUE(TypeTag, PTAG(LSVerbosity));
if (verboseLevelSolver)
std::cout << "MimeticPressure2P: solve for pressure" << std::endl;
Preconditioner preconditioner(*A_, iterPreconditioner, relaxation);
Solver solver(op, preconditioner, reduction, maxItSolver, verboseLevelSolver);
solver.apply(pressTrace_, f_, result);
Solver solver(problem_);
solver.solve(A_, problem_.variables().pressure(), f_);
return;
}
......
......@@ -83,18 +83,6 @@ NEW_PROP_TAG( NumDensityTransport );
NEW_PROP_TAG( FluidSystem );
NEW_PROP_TAG( FluidState );
//Properties for linear solvers
NEW_PROP_TAG(PressureCoefficientMatrix);
NEW_PROP_TAG(PressureRHSVector);
NEW_PROP_TAG( PressurePreconditioner );
NEW_PROP_TAG( PressureSolver );
NEW_PROP_TAG( SolverParameters );
NEW_PROP_TAG(ReductionSolver);
NEW_PROP_TAG(MaxIterationNumberSolver);
NEW_PROP_TAG(IterationNumberPreconditioner);
NEW_PROP_TAG(VerboseLevelSolver);
NEW_PROP_TAG(RelaxationPreconditioner);
//////////////////////////////////////////////////////////////////
// Properties
//////////////////////////////////////////////////////////////////
......@@ -165,59 +153,6 @@ SET_TYPE_PROP(DecoupledTwoPTwoC, Variables, VariableClass2P2C<TypeTag>);
SET_TYPE_PROP(DecoupledTwoPTwoC, FluidState, DecTwoPTwoCFluidState<TypeTag>);
// solver stuff
SET_PROP(DecoupledTwoPTwoC, PressureCoefficientMatrix)
{
private:
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
typedef Dune::FieldMatrix<Scalar, 1, 1> MB;
public:
typedef Dune::BCRSMatrix<MB> type;
};
SET_PROP(DecoupledTwoPTwoC, PressureRHSVector)
{
private:
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
public:
typedef Dune::BlockVector<Dune::FieldVector<Scalar, 1> > type;
};
SET_PROP(DecoupledTwoPTwoC, PressurePreconditioner)
{
private:
typedef typename GET_PROP_TYPE(TypeTag, PTAG(PressureCoefficientMatrix)) Matrix;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(PressureRHSVector)) Vector;
public:
typedef Dune::SeqILUn<Matrix, Vector, Vector> type;
};
SET_PROP(DecoupledTwoPTwoC, PressureSolver)
{
private:
typedef typename GET_PROP_TYPE(TypeTag, PTAG(PressureCoefficientMatrix)) Matrix;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(PressureRHSVector)) Vector;
public:
typedef Dune::BiCGSTABSolver<Vector> type;
};
//SET_INT_PROP(DecoupledTwoPTwoC, PressurePreconditioner, SolverIndices::seqILU0);
//SET_INT_PROP(DecoupledTwoPTwoC, PressureSolver, SolverIndices::biCGSTAB);
SET_SCALAR_PROP(DecoupledTwoPTwoC, ReductionSolver, 1E-12);
SET_INT_PROP(DecoupledTwoPTwoC, MaxIterationNumberSolver, 10000);
SET_INT_PROP(DecoupledTwoPTwoC, IterationNumberPreconditioner, 0);
SET_INT_PROP(DecoupledTwoPTwoC, VerboseLevelSolver, 1);
SET_SCALAR_PROP(DecoupledTwoPTwoC, RelaxationPreconditioner, 1.0);
SET_PROP(DecoupledTwoPTwoC, SolverParameters)
{
public:
//solver parameters
static constexpr double reductionSolver = GET_PROP_VALUE(TypeTag, PTAG(ReductionSolver));
static constexpr int maxIterationNumberSolver = GET_PROP_VALUE(TypeTag, PTAG(MaxIterationNumberSolver));
static constexpr int iterationNumberPreconditioner = GET_PROP_VALUE(TypeTag, PTAG(IterationNumberPreconditioner));
static constexpr int verboseLevelSolver = GET_PROP_VALUE(TypeTag, PTAG(VerboseLevelSolver));
static constexpr double relaxationPreconditioner = GET_PROP_VALUE(TypeTag, PTAG(RelaxationPreconditioner));
};
}
/*!
......
......@@ -988,27 +988,15 @@ void FVPressure2P2C<TypeTag>::assemble(bool first)
template<class TypeTag>
void FVPressure2P2C<TypeTag>::solve()
{
typedef typename GET_PROP(TypeTag, PTAG(SolverParameters)) SolverParameters;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(PressurePreconditioner)) Preconditioner;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(PressureSolver)) Solver;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(LinearSolver)) Solver;
// printmatrix(std::cout, A_, "global stiffness matrix", "row", 11, 3);
// printvector(std::cout, f_, "right hand side", "row", 200, 1, 3);
Dune::MatrixAdapter<Matrix, RHSVector, RHSVector> op(A_); // make linear operator from A_
Dune::InverseOperatorResult result;
Scalar reduction = SolverParameters::reductionSolver;
int maxItSolver = SolverParameters::maxIterationNumberSolver;
int iterPreconditioner = SolverParameters::iterationNumberPreconditioner;
int verboseLevelSolver = SolverParameters::verboseLevelSolver;
Scalar relaxation = SolverParameters::relaxationPreconditioner;
int verboseLevelSolver = GET_PROP_VALUE(TypeTag, PTAG(LSVerbosity));
if (verboseLevelSolver)
std::cout << "FVPressure2P: solve for pressure" << std::endl;
std::cout << "FVPressure2P2C: solve for pressure" << std::endl;
Preconditioner preconditioner(A_, iterPreconditioner, relaxation);
Solver solver(op, preconditioner, reduction, maxItSolver, verboseLevelSolver);
solver.apply(problem_.variables().pressure(), f_, result);
Solver solver(problem_);
solver.solve(A_, problem_.variables().pressure(), f_);
return;
}
......
......@@ -1093,27 +1093,15 @@ void FVPressure2P2CMultiPhysics<TypeTag>::assemble(bool first)
template<class TypeTag>
void FVPressure2P2CMultiPhysics<TypeTag>::solve()
{
typedef typename GET_PROP(TypeTag, PTAG(SolverParameters)) SolverParameters;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(PressurePreconditioner)) Preconditioner;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(PressureSolver)) Solver;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(LinearSolver)) Solver;
// printmatrix(std::cout, A_, "global stiffness matrix", "row", 11, 3);
// printvector(std::cout, f_, "right hand side", "row", 200, 1, 3);
Dune::MatrixAdapter<Matrix, RHSVector, RHSVector> op(A_); // make linear operator from A_
Dune::InverseOperatorResult result;
Scalar reduction = SolverParameters::reductionSolver;
int maxItSolver = SolverParameters::maxIterationNumberSolver;
int iterPreconditioner = SolverParameters::iterationNumberPreconditioner;
int verboseLevelSolver = SolverParameters::verboseLevelSolver;
Scalar relaxation = SolverParameters::relaxationPreconditioner;
int verboseLevelSolver = GET_PROP_VALUE(TypeTag, PTAG(LSVerbosity));
if (verboseLevelSolver)
std::cout << "FVPressure2P: solve for pressure" << std::endl;
std::cout << "FVPressure2P2CMultiPhysics: solve for pressure" << std::endl;
Preconditioner preconditioner(A_, iterPreconditioner, relaxation);
Solver solver(op, preconditioner, reduction, maxItSolver, verboseLevelSolver);
solver.apply(problem_.variables().pressure(), f_, result);
Solver solver(problem_);
solver.solve(A_, problem_.variables().pressure(), f_);
return;
}
......
......@@ -269,7 +269,7 @@ public:
*/
bool shouldWriteOutput() const
{
if (this->timeManager().timeStepIndex() % outputInterval_ == 0 || this->timeManager().willBeFinished())
if (timeManager().timeStepIndex() % outputInterval_ == 0 || timeManager().willBeFinished() || timeManager().episodeWillBeOver())
{
return true;
}
......
......@@ -21,7 +21,14 @@
#ifndef DUMUX_IMPET_PROPERTIES_HH
#define DUMUX_IMPET_PROPERTIES_HH
//Dune-includes
#include <dune/istl/operators.hh>
#include <dune/istl/solvers.hh>
#include <dune/istl/preconditioners.hh>
#include <dumux/decoupled/common/decoupledproperties.hh>
#include <dumux/linear/seqsolverbackend.hh>
/*!
* \ingroup IMPET
* \ingroup Properties
......@@ -67,12 +74,39 @@ NEW_PROP_TAG(RelaxationFactor); //!< Used for IMPET iterations
SET_TYPE_PROP(IMPET, Model, IMPET<TypeTag>);
//Properties for linear solvers
NEW_PROP_TAG(PressureCoefficientMatrix);//!< Type of the coefficient matrix given to the linear solver
NEW_PROP_TAG(PressureRHSVector);//!< Type of the right hand side vector given to the linear solver
NEW_PROP_TAG( LinearSolver );//!< Type of the linear solver
//Set defaults
SET_SCALAR_PROP(IMPET, CFLFactor, 1);
SET_INT_PROP(IMPET, IterationFlag, 0); //!< 0 = no iterations, 1 = iterate IterationNumber iterations, 2 = iterate until converged or IterationNumber is reached
SET_INT_PROP(IMPET, IterationNumber, 2);
SET_SCALAR_PROP(IMPET, MaximumDefect, 1e-5);
SET_SCALAR_PROP(IMPET, RelaxationFactor, 1);//!< 1 = new solution is new solution, 0 = old solution is new solution
SET_PROP(IMPET, PressureCoefficientMatrix)
{
private:
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
typedef Dune::FieldMatrix<Scalar, 1, 1> MB;
public:
typedef Dune::BCRSMatrix<MB> type;
};
SET_PROP(IMPET, PressureRHSVector)
{
private:
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
public:
typedef Dune::BlockVector<Dune::FieldVector<Scalar, 1> > type;
};
// use the stabilized BiCG solver preconditioned by the ILU-0 by default
SET_TYPE_PROP(IMPET, LinearSolver, Dumux::ILU0BiCGSTABBackend<TypeTag> );
}
}
......
// $Id$
/****************************************************************************
* Copyright (C) 2011 by Bernd Flemisch *
* Institute of Hydraulic Engineering *
* University of Stuttgart, Germany *
* email: <givenname>.<name>@iws.uni-stuttgart.de *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
/*!
* \file
* \brief Dumux solver backend
*/
#ifndef DUMUX_SOLVER_BACKEND_HH
#define DUMUX_SOLVER_BACKEND_HH
#include <dune/istl/solvers.hh>
#include <dumux/common/propertysystem.hh>
namespace Dumux
{
namespace Properties
{
//! verbosity of the linear solver
NEW_PROP_TAG(LSVerbosity);
//! target reduction of the initial residual
// if the deflection of the newton method is large, we do not
// need to solve the linear approximation accurately. Assuming
// that the initial value for the delta vector u is quite
// close to the final value, a reduction of 6 orders of
// magnitude in the defect should be sufficient...
NEW_PROP_TAG(LSResidualReduction);
//! maximum number of iterations of solver
NEW_PROP_TAG(LSMaxIterations);
//! relaxation parameter for the preconditioner
NEW_PROP_TAG(PreconditionerRelaxation);
//! number of preconditioner iterations per solver iteration
NEW_PROP_TAG(PreconditionerIterations);
SET_PROP_DEFAULT(LSVerbosity)
{public:
static const int value = 0;
};
SET_PROP_DEFAULT(LSResidualReduction)
{public:
static const double value = 1e-6;
};
SET_PROP_DEFAULT(LSMaxIterations)
{public:
static const int value = 500;
};
SET_PROP_DEFAULT(PreconditionerRelaxation)
{public:
static const double value = 1.0;
};
SET_PROP_DEFAULT(PreconditionerIterations)
{public:
static const int value = 1;
};
}
template <class TypeTag>
class ILU0BiCGSTABBackend
{
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Problem)) Problem;
public:
ILU0BiCGSTABBackend(Problem& problem)
{}
template<class Matrix, class Vector>