mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-01-15 20:11:55 -06:00
Merge pull request #2680 from atgeirr/minor-flexible-solver-improvements
Minor flexible solver improvements
This commit is contained in:
commit
3766f19de3
@ -156,6 +156,7 @@ list (APPEND PUBLIC_HEADER_FILES
|
||||
opm/simulators/linalg/CPRPreconditioner.hpp
|
||||
opm/simulators/linalg/ExtractParallelGridInformationToISTL.hpp
|
||||
opm/simulators/linalg/FlexibleSolver.hpp
|
||||
opm/simulators/linalg/FlexibleSolver_impl.hpp
|
||||
opm/simulators/linalg/FlowLinearSolverParameters.hpp
|
||||
opm/simulators/linalg/GraphColoring.hpp
|
||||
opm/simulators/linalg/ISTLSolverEbos.hpp
|
||||
|
@ -24,11 +24,7 @@
|
||||
|
||||
#include <opm/simulators/linalg/PreconditionerWithUpdate.hpp>
|
||||
|
||||
#include <dune/common/fmatrix.hh>
|
||||
#include <dune/istl/bcrsmatrix.hh>
|
||||
#include <dune/istl/solvers.hh>
|
||||
#include <dune/istl/umfpack.hh>
|
||||
#include <dune/istl/owneroverlapcopy.hh>
|
||||
#include <dune/istl/solver.hh>
|
||||
#include <dune/istl/paamg/pinfo.hh>
|
||||
|
||||
#include <boost/property_tree/ptree.hpp>
|
||||
|
@ -20,37 +20,5 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <opm/simulators/linalg/FlexibleSolver_impl.hpp>
|
||||
#include <opm/simulators/linalg/matrixblock.hh>
|
||||
|
||||
#include <dune/common/fmatrix.hh>
|
||||
#include <dune/istl/bcrsmatrix.hh>
|
||||
#include <dune/istl/solvers.hh>
|
||||
#include <dune/istl/umfpack.hh>
|
||||
#include <dune/istl/owneroverlapcopy.hh>
|
||||
#include <dune/istl/paamg/pinfo.hh>
|
||||
|
||||
// Explicit instantiations of FlexibleSolver
|
||||
|
||||
template <int N>
|
||||
using BV = Dune::BlockVector<Dune::FieldVector<double, N>>;
|
||||
template <int N>
|
||||
using BM = Dune::BCRSMatrix<Dune::FieldMatrix<double, N, N>>;
|
||||
template <int N>
|
||||
using OBM = Dune::BCRSMatrix<Opm::MatrixBlock<double, N, N>>;
|
||||
|
||||
// Variants using Dune::FieldMatrix blocks.
|
||||
template class Dune::FlexibleSolver<BM<1>, BV<1>>;
|
||||
|
||||
// Variants using Opm::MatrixBlock blocks.
|
||||
template class Dune::FlexibleSolver<OBM<1>, BV<1>>;
|
||||
|
||||
#if HAVE_MPI
|
||||
|
||||
using Comm = Dune::OwnerOverlapCopyCommunication<int, int>;
|
||||
|
||||
template Dune::FlexibleSolver<OBM<1>, BV<1>>::FlexibleSolver(const MatrixType& matrix,
|
||||
const Comm& comm,
|
||||
const boost::property_tree::ptree& prm,
|
||||
const std::function<BV<1>()>& weightsCalculator);
|
||||
|
||||
#endif // HAVE_MPI
|
||||
INSTANTIATE_FLEXIBLESOLVER(1);
|
||||
|
@ -20,37 +20,5 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <opm/simulators/linalg/FlexibleSolver_impl.hpp>
|
||||
#include <opm/simulators/linalg/matrixblock.hh>
|
||||
|
||||
#include <dune/common/fmatrix.hh>
|
||||
#include <dune/istl/bcrsmatrix.hh>
|
||||
#include <dune/istl/solvers.hh>
|
||||
#include <dune/istl/umfpack.hh>
|
||||
#include <dune/istl/owneroverlapcopy.hh>
|
||||
#include <dune/istl/paamg/pinfo.hh>
|
||||
|
||||
// Explicit instantiations of FlexibleSolver
|
||||
|
||||
template <int N>
|
||||
using BV = Dune::BlockVector<Dune::FieldVector<double, N>>;
|
||||
template <int N>
|
||||
using BM = Dune::BCRSMatrix<Dune::FieldMatrix<double, N, N>>;
|
||||
template <int N>
|
||||
using OBM = Dune::BCRSMatrix<Opm::MatrixBlock<double, N, N>>;
|
||||
|
||||
// Variants using Dune::FieldMatrix blocks.
|
||||
template class Dune::FlexibleSolver<BM<2>, BV<2>>;
|
||||
|
||||
// Variants using Opm::MatrixBlock blocks.
|
||||
template class Dune::FlexibleSolver<OBM<2>, BV<2>>;
|
||||
|
||||
#if HAVE_MPI
|
||||
|
||||
using Comm = Dune::OwnerOverlapCopyCommunication<int, int>;
|
||||
|
||||
template Dune::FlexibleSolver<OBM<2>, BV<2>>::FlexibleSolver(const MatrixType& matrix,
|
||||
const Comm& comm,
|
||||
const boost::property_tree::ptree& prm,
|
||||
const std::function<BV<2>()>& weightsCalculator);
|
||||
|
||||
#endif // HAVE_MPI
|
||||
INSTANTIATE_FLEXIBLESOLVER(2);
|
||||
|
@ -20,37 +20,5 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <opm/simulators/linalg/FlexibleSolver_impl.hpp>
|
||||
#include <opm/simulators/linalg/matrixblock.hh>
|
||||
|
||||
#include <dune/common/fmatrix.hh>
|
||||
#include <dune/istl/bcrsmatrix.hh>
|
||||
#include <dune/istl/solvers.hh>
|
||||
#include <dune/istl/umfpack.hh>
|
||||
#include <dune/istl/owneroverlapcopy.hh>
|
||||
#include <dune/istl/paamg/pinfo.hh>
|
||||
|
||||
// Explicit instantiations of FlexibleSolver
|
||||
|
||||
template <int N>
|
||||
using BV = Dune::BlockVector<Dune::FieldVector<double, N>>;
|
||||
template <int N>
|
||||
using BM = Dune::BCRSMatrix<Dune::FieldMatrix<double, N, N>>;
|
||||
template <int N>
|
||||
using OBM = Dune::BCRSMatrix<Opm::MatrixBlock<double, N, N>>;
|
||||
|
||||
// Variants using Dune::FieldMatrix blocks.
|
||||
template class Dune::FlexibleSolver<BM<3>, BV<3>>;
|
||||
|
||||
// Variants using Opm::MatrixBlock blocks.
|
||||
template class Dune::FlexibleSolver<OBM<3>, BV<3>>;
|
||||
|
||||
#if HAVE_MPI
|
||||
|
||||
using Comm = Dune::OwnerOverlapCopyCommunication<int, int>;
|
||||
|
||||
template Dune::FlexibleSolver<OBM<3>, BV<3>>::FlexibleSolver(const MatrixType& matrix,
|
||||
const Comm& comm,
|
||||
const boost::property_tree::ptree& prm,
|
||||
const std::function<BV<3>()>& weightsCalculator);
|
||||
|
||||
#endif // HAVE_MPI
|
||||
INSTANTIATE_FLEXIBLESOLVER(3);
|
||||
|
@ -20,37 +20,5 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <opm/simulators/linalg/FlexibleSolver_impl.hpp>
|
||||
#include <opm/simulators/linalg/matrixblock.hh>
|
||||
|
||||
#include <dune/common/fmatrix.hh>
|
||||
#include <dune/istl/bcrsmatrix.hh>
|
||||
#include <dune/istl/solvers.hh>
|
||||
#include <dune/istl/umfpack.hh>
|
||||
#include <dune/istl/owneroverlapcopy.hh>
|
||||
#include <dune/istl/paamg/pinfo.hh>
|
||||
|
||||
// Explicit instantiations of FlexibleSolver
|
||||
|
||||
template <int N>
|
||||
using BV = Dune::BlockVector<Dune::FieldVector<double, N>>;
|
||||
template <int N>
|
||||
using BM = Dune::BCRSMatrix<Dune::FieldMatrix<double, N, N>>;
|
||||
template <int N>
|
||||
using OBM = Dune::BCRSMatrix<Opm::MatrixBlock<double, N, N>>;
|
||||
|
||||
// Variants using Dune::FieldMatrix blocks.
|
||||
template class Dune::FlexibleSolver<BM<4>, BV<4>>;
|
||||
|
||||
// Variants using Opm::MatrixBlock blocks.
|
||||
template class Dune::FlexibleSolver<OBM<4>, BV<4>>;
|
||||
|
||||
#if HAVE_MPI
|
||||
|
||||
using Comm = Dune::OwnerOverlapCopyCommunication<int, int>;
|
||||
|
||||
template Dune::FlexibleSolver<OBM<4>, BV<4>>::FlexibleSolver(const MatrixType& matrix,
|
||||
const Comm& comm,
|
||||
const boost::property_tree::ptree& prm,
|
||||
const std::function<BV<4>()>& weightsCalculator);
|
||||
|
||||
#endif // HAVE_MPI
|
||||
INSTANTIATE_FLEXIBLESOLVER(4);
|
||||
|
@ -188,4 +188,38 @@ namespace Dune
|
||||
|
||||
} // namespace Dune
|
||||
|
||||
|
||||
// Macros to simplify explicit instantiation of FlexibleSolver for various block sizes.
|
||||
|
||||
template <int N>
|
||||
using BV = Dune::BlockVector<Dune::FieldVector<double, N>>;
|
||||
template <int N>
|
||||
using BM = Dune::BCRSMatrix<Dune::FieldMatrix<double, N, N>>;
|
||||
template <int N>
|
||||
using OBM = Dune::BCRSMatrix<Opm::MatrixBlock<double, N, N>>;
|
||||
|
||||
// INSTANTIATE_CONSTRUCTOR instantiates the constructor that is a template,
|
||||
// this is only needed in the MPI case, since otherwise the Comm type is
|
||||
// not a template argument but always SequentialInformation.
|
||||
#if HAVE_MPI
|
||||
using Comm = Dune::OwnerOverlapCopyCommunication<int, int>;
|
||||
#define INSTANTIATE_FLEXIBLESOLVER_CONSTRUCTOR(n) \
|
||||
template Dune::FlexibleSolver<OBM<n>, BV<n>>::FlexibleSolver(const MatrixType& matrix, \
|
||||
const Comm& comm, \
|
||||
const boost::property_tree::ptree& prm, \
|
||||
const std::function<BV<n>()>& weightsCalculator);
|
||||
#else
|
||||
#define INSTANTIATE_FLEXIBLESOLVER_CONSTRUCTOR(n)
|
||||
#endif
|
||||
|
||||
// INSTANTIATE instantiates the class including any templated constructors if necessary.
|
||||
#define INSTANTIATE_FLEXIBLESOLVER(n) \
|
||||
/* Variants using Dune::FieldMatrix blocks. */ \
|
||||
template class Dune::FlexibleSolver<BM<n>, BV<n>>; \
|
||||
/* Variants using Opm::MatrixBlock blocks. */ \
|
||||
template class Dune::FlexibleSolver<OBM<n>, BV<n>>; \
|
||||
INSTANTIATE_FLEXIBLESOLVER_CONSTRUCTOR(n)
|
||||
|
||||
|
||||
|
||||
#endif // OPM_FLEXIBLE_SOLVER_IMPL_HEADER_INCLUDED
|
||||
|
@ -61,13 +61,13 @@ namespace Amg
|
||||
: linsolver_()
|
||||
{
|
||||
assert(op.category() == Dune::SolverCategory::overlapping);
|
||||
linsolver_.reset(new Solver(op.getmat(), comm, prm, std::function<X()>()));
|
||||
linsolver_ = std::make_unique<Solver>(op.getmat(), comm, prm, std::function<X()>());
|
||||
}
|
||||
PressureInverseOperator(Operator& op, const boost::property_tree::ptree& prm, const SequentialInformation&)
|
||||
: linsolver_()
|
||||
{
|
||||
assert(op.category() != Dune::SolverCategory::overlapping);
|
||||
linsolver_.reset(new Solver(op.getmat(), prm, std::function<X()>()));
|
||||
linsolver_ = std::make_unique<Solver>(op.getmat(), prm, std::function<X()>());
|
||||
}
|
||||
|
||||
|
||||
@ -92,7 +92,7 @@ namespace Amg
|
||||
}
|
||||
|
||||
private:
|
||||
std::shared_ptr<Solver> linsolver_;
|
||||
std::unique_ptr<Solver> linsolver_;
|
||||
};
|
||||
|
||||
public:
|
||||
|
@ -20,6 +20,8 @@
|
||||
#ifndef OPM_GET_QUASI_IMPES_WEIGHTS_HEADER_INCLUDED
|
||||
#define OPM_GET_QUASI_IMPES_WEIGHTS_HEADER_INCLUDED
|
||||
|
||||
#include <dune/common/fvector.hh>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
|
@ -31,6 +31,10 @@
|
||||
#include <opm/simulators/linalg/FlexibleSolver.hpp>
|
||||
#include <opm/simulators/linalg/getQuasiImpesWeights.hpp>
|
||||
|
||||
#include <dune/common/fmatrix.hh>
|
||||
#include <dune/istl/bcrsmatrix.hh>
|
||||
#include <dune/istl/matrixmarket.hh>
|
||||
|
||||
#include <boost/property_tree/json_parser.hpp>
|
||||
#include <boost/property_tree/ptree.hpp>
|
||||
#include <fstream>
|
||||
|
Loading…
Reference in New Issue
Block a user