make the build work if UMFPACK is not available

this was caused by the recent work on multisegmented wells. If UMFPack
is available, it compiled.
This commit is contained in:
Andreas Lauser 2017-10-24 19:12:39 +02:00
parent 35ff3aded3
commit 720dc636e8
2 changed files with 24 additions and 1 deletions

View File

@ -24,14 +24,16 @@
#include <opm/common/ErrorMacros.hpp> #include <opm/common/ErrorMacros.hpp>
#include <dune/istl/solvers.hh> #include <dune/istl/solvers.hh>
#if HAVE_UMFPACK
#include <dune/istl/umfpack.hh> #include <dune/istl/umfpack.hh>
#endif // HAVE_UMFPACK
#include <cmath> #include <cmath>
namespace Opm { namespace Opm {
namespace mswellhelpers namespace mswellhelpers
{ {
#if HAVE_UMFPACK
// obtain y = D^-1 * x with a direct solver // obtain y = D^-1 * x with a direct solver
template <typename MatrixType, typename VectorType> template <typename MatrixType, typename VectorType>
VectorType VectorType
@ -60,6 +62,7 @@ namespace mswellhelpers
return y; return y;
} }
#endif // HAVE_UMFPACK

View File

@ -494,7 +494,11 @@ namespace Opm
duneB_.mv(x, Bx); duneB_.mv(x, Bx);
// invDBx = duneD^-1 * Bx_ // invDBx = duneD^-1 * Bx_
#if HAVE_UMFPACK
const BVectorWell invDBx = mswellhelpers::invDXDirect(duneD_, Bx); const BVectorWell invDBx = mswellhelpers::invDXDirect(duneD_, Bx);
#else
const BVectorWell invDBx = mswellhelpers::invDX(duneD_, Bx);
#endif
// Ax = Ax - duneC_^T * invDBx // Ax = Ax - duneC_^T * invDBx
duneC_.mmtv(invDBx,Ax); duneC_.mmtv(invDBx,Ax);
@ -510,7 +514,11 @@ namespace Opm
apply(BVector& r) const apply(BVector& r) const
{ {
// invDrw_ = duneD^-1 * resWell_ // invDrw_ = duneD^-1 * resWell_
#if HAVE_UMFPACK
const BVectorWell invDrw = mswellhelpers::invDXDirect(duneD_, resWell_); const BVectorWell invDrw = mswellhelpers::invDXDirect(duneD_, resWell_);
#else
const BVectorWell invDrw = mswellhelpers::invDX(duneD_, resWell_);
#endif // HAVE_UMFPACK
// r = r - duneC_^T * invDrw // r = r - duneC_^T * invDrw
duneC_.mmtv(invDrw, r); duneC_.mmtv(invDrw, r);
} }
@ -628,7 +636,11 @@ namespace Opm
// resWell = resWell - B * x // resWell = resWell - B * x
duneB_.mmv(x, resWell); duneB_.mmv(x, resWell);
// xw = D^-1 * resWell // xw = D^-1 * resWell
#if HAVE_UMFPACK
xw = mswellhelpers::invDXDirect(duneD_, resWell); xw = mswellhelpers::invDXDirect(duneD_, resWell);
#else
xw = mswellhelpers::invDX(duneD_, resWell);
#endif // HAVE_UMFPACK
} }
@ -640,9 +652,13 @@ namespace Opm
MultisegmentWell<TypeTag>:: MultisegmentWell<TypeTag>::
solveEqAndUpdateWellState(WellState& well_state) solveEqAndUpdateWellState(WellState& well_state)
{ {
#if HAVE_UMFPACK
// We assemble the well equations, then we check the convergence, // We assemble the well equations, then we check the convergence,
// which is why we do not put the assembleWellEq here. // which is why we do not put the assembleWellEq here.
const BVectorWell dx_well = mswellhelpers::invDXDirect(duneD_, resWell_); const BVectorWell dx_well = mswellhelpers::invDXDirect(duneD_, resWell_);
#else
const BVectorWell dx_well = mswellhelpers::invDX(duneD_, resWell_);
#endif
updateWellState(dx_well, false, well_state); updateWellState(dx_well, false, well_state);
} }
@ -1744,7 +1760,11 @@ namespace Opm
assembleWellEqWithoutIteration(ebosSimulator, dt, well_state, true); assembleWellEqWithoutIteration(ebosSimulator, dt, well_state, true);
#if HAVE_UMFPACK
const BVectorWell dx_well = mswellhelpers::invDXDirect(duneD_, resWell_); const BVectorWell dx_well = mswellhelpers::invDXDirect(duneD_, resWell_);
#else
const BVectorWell dx_well = mswellhelpers::invDX(duneD_, resWell_);
#endif
// TODO: use these small values for now, not intend to reach the convergence // TODO: use these small values for now, not intend to reach the convergence
// in this stage, but, should we? // in this stage, but, should we?