Use pressure for guiding coarsening in flow_ebos, too.

For flow_legacy the first component a block is used, which is the
oil pressure. As flow_ebos uses different indices this commit
explicitly uses BlackoilIndices::pressureSwitchIdx to tell the AMG
at which index the pressure is stored.
This commit is contained in:
Markus Blatt 2017-05-22 12:09:58 +02:00
parent 5a6ace9063
commit 79799a5c5c
3 changed files with 11 additions and 6 deletions

View File

@ -124,7 +124,7 @@ namespace Opm {
typedef Dune::BCRSMatrix <MatrixBlockType> Mat;
typedef Dune::BlockVector<VectorBlockType> BVector;
typedef ISTLSolver< MatrixBlockType, VectorBlockType > ISTLSolverType;
typedef ISTLSolver< MatrixBlockType, VectorBlockType, BlackoilIndices::pressureSwitchIdx > ISTLSolverType;
//typedef typename SolutionVector :: value_type PrimaryVariables ;
// For the conversion between the surface volume rate and resrevoir voidage rate

View File

@ -276,7 +276,7 @@ createEllipticPreconditionerPointer(const M& Ae, double relax,
/// \param relax The relaxation parameter for ILU0.
/// \param comm The object describing the parallelization information and communication.
// \param amgPtr The unique_ptr to be filled (return)
template <class Op, class P, class AMG >
template <class Op, class P, class AMG, int pressureIndex=0 >
inline void
createAMGPreconditionerPointer( Op& opA, const double relax, const P& comm, std::unique_ptr< AMG >& amgPtr )
{
@ -284,7 +284,7 @@ createAMGPreconditionerPointer( Op& opA, const double relax, const P& comm, std:
typedef typename Op::matrix_type M;
// The coupling metric used in the AMG
typedef Dune::Amg::FirstDiagonal CouplingMetric;
typedef Dune::Amg::Diagonal<pressureIndex> CouplingMetric;
// The coupling criterion used in the AMG
typedef Dune::Amg::SymmetricCriterion<M, CouplingMetric> CritBase;

View File

@ -174,7 +174,12 @@ namespace Opm
/// solving the reduced system (after eliminating well variables)
/// as a block-structured matrix (one block for all cell variables) for a fixed
/// number of cell variables np .
template < class MatrixBlockType, class VectorBlockType >
/// \tparam MatrixBlockType The type of the matrix block used.
/// \tparam VectorBlockType The type of the vector block used.
/// \tparam pressureIndex The index of the pressure component in the vector
/// vector block. It is used to guide the AMG coarsening.
/// Default is zero.
template < class MatrixBlockType, class VectorBlockType, int pressureIndex=0 >
class ISTLSolver : public NewtonIterationBlackoilInterface
{
typedef typename MatrixBlockType :: field_type Scalar;
@ -311,7 +316,7 @@ namespace Opm
void
constructAMGPrecond(LinearOperator& /* linearOperator */, const POrComm& comm, std::unique_ptr< AMG >& amg, std::unique_ptr< MatrixOperator >& opA, const double relax ) const
{
ISTLUtility::createAMGPreconditionerPointer( *opA, relax, comm, amg );
ISTLUtility::createAMGPreconditionerPointer<pressureIndex>( *opA, relax, comm, amg );
}
@ -319,7 +324,7 @@ namespace Opm
void
constructAMGPrecond(MatrixOperator& opA, const POrComm& comm, std::unique_ptr< AMG >& amg, std::unique_ptr< MatrixOperator >&, const double relax ) const
{
ISTLUtility::createAMGPreconditionerPointer( opA, relax, comm, amg );
ISTLUtility::createAMGPreconditionerPointer<pressureIndex>( opA, relax, comm, amg );
}
/// \brief Solve the system using the given preconditioner and scalar product.