diff --git a/ebos/eclproblem.hh b/ebos/eclproblem.hh index 5cafddcc6..3cfb4562d 100644 --- a/ebos/eclproblem.hh +++ b/ebos/eclproblem.hh @@ -99,7 +99,6 @@ #include #include #include -#include #include @@ -920,7 +919,28 @@ public: } if (enableExperiments) - checkDeckCompatibility_(); + { + int success = 1; + const auto& cc = simulator.vanguard().grid().comm(); + + try + { + checkDeckCompatibility_(); + } + catch(const std::exception& e) + { + success = 0; + success = cc.min(success); + throw; + } + + success = cc.min(success); + + if (!success) + { + throw std::runtime_error("Checking deck compatibility failed"); + } + } // write the static output files (EGRID, INIT, SMSPEC, etc.) if (enableEclOutput_) @@ -2125,7 +2145,6 @@ private: void checkDeckCompatibility_() const { const auto& comm = this->simulator().gridView().comm(); - Dune::MPIGuard guard; if (comm.rank() == 0) { @@ -2181,8 +2200,6 @@ private: throw std::runtime_error("The deck enables water, but this simulator cannot handle it."); // the opposite cases should be fine (albeit a bit slower than what's possible) } - // throws an expeption on all processes if rank 0 had a problem - guard.finalize(); } bool drsdtActive_() const diff --git a/opm/simulators/linalg/bda/MultisegmentWellContribution.cpp b/opm/simulators/linalg/bda/MultisegmentWellContribution.cpp index 15b3d3768..0e6cb2e47 100644 --- a/opm/simulators/linalg/bda/MultisegmentWellContribution.cpp +++ b/opm/simulators/linalg/bda/MultisegmentWellContribution.cpp @@ -32,7 +32,7 @@ namespace Opm MultisegmentWellContribution::MultisegmentWellContribution(unsigned int dim_, unsigned int dim_wells_, unsigned int Nb_, unsigned int Mb_, unsigned int BnumBlocks_, std::vector &Bvalues, std::vector &BcolIndices, std::vector &BrowPointers, - unsigned int DnumBlocks_, double *Dvalues, int *DcolPointers, int *DrowIndices, + unsigned int DnumBlocks_, double *Dvalues, UMFPackIndex *DcolPointers, UMFPackIndex *DrowIndices, std::vector &Cvalues) : dim(dim_), // size of blockvectors in vectors x and y, equal to MultisegmentWell::numEq diff --git a/opm/simulators/linalg/bda/MultisegmentWellContribution.hpp b/opm/simulators/linalg/bda/MultisegmentWellContribution.hpp index 4ea7e327b..403ae93fd 100644 --- a/opm/simulators/linalg/bda/MultisegmentWellContribution.hpp +++ b/opm/simulators/linalg/bda/MultisegmentWellContribution.hpp @@ -26,6 +26,9 @@ #include #endif +#include +#include + namespace Opm { @@ -75,6 +78,13 @@ private: public: +#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 7) + using UMFPackIndex = + typename Dune::UMFPack>>::UMFPackMatrix::Index; +#else + using UMFPackIndex = int; +#endif + #if HAVE_CUDA /// Set a cudaStream to be used /// \param[in] stream the cudaStream that is used @@ -100,8 +110,8 @@ public: MultisegmentWellContribution(unsigned int dim, unsigned int dim_wells, unsigned int Nb, unsigned int Mb, unsigned int BnumBlocks, std::vector &Bvalues, std::vector &BcolIndices, std::vector &BrowPointers, - unsigned int DnumBlocks, double *Dvalues, int *DcolPointers, int *DrowIndices, - std::vector &Cvalues); + unsigned int DnumBlocks, double *Dvalues, UMFPackIndex *DcolPointers, + UMFPackIndex *DrowIndices, std::vector &Cvalues); /// Destroy a MultisegmentWellContribution, and free memory ~MultisegmentWellContribution(); diff --git a/opm/simulators/linalg/bda/WellContributions.cpp b/opm/simulators/linalg/bda/WellContributions.cpp index f8226232e..cc32fb7d1 100644 --- a/opm/simulators/linalg/bda/WellContributions.cpp +++ b/opm/simulators/linalg/bda/WellContributions.cpp @@ -137,7 +137,7 @@ void WellContributions::alloc() void WellContributions::addMultisegmentWellContribution(unsigned int dim_, unsigned int dim_wells_, unsigned int Nb, unsigned int Mb, unsigned int BnumBlocks, std::vector &Bvalues, std::vector &BcolIndices, std::vector &BrowPointers, - unsigned int DnumBlocks, double *Dvalues, int *DcolPointers, int *DrowIndices, + unsigned int DnumBlocks, double *Dvalues, UMFPackIndex *DcolPointers, UMFPackIndex *DrowIndices, std::vector &Cvalues) { assert(dim==dim_); diff --git a/opm/simulators/linalg/bda/WellContributions.hpp b/opm/simulators/linalg/bda/WellContributions.hpp index 60142f014..e3281241d 100644 --- a/opm/simulators/linalg/bda/WellContributions.hpp +++ b/opm/simulators/linalg/bda/WellContributions.hpp @@ -31,7 +31,8 @@ #include #include - +#include +#include namespace Opm { @@ -56,6 +57,12 @@ namespace Opm class WellContributions { public: +#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 7) + using UMFPackIndex = + typename Dune::UMFPack>>::UMFPackMatrix::Index; +#else + using UMFPackIndex = int; +#endif /// StandardWell has C, D and B matrices that need to be copied enum class MatrixType { C, @@ -184,7 +191,8 @@ public: void addMultisegmentWellContribution(unsigned int dim, unsigned int dim_wells, unsigned int Nb, unsigned int Mb, unsigned int BnumBlocks, std::vector &Bvalues, std::vector &BcolIndices, std::vector &BrowPointers, - unsigned int DnumBlocks, double *Dvalues, int *DcolPointers, int *DrowIndices, + unsigned int DnumBlocks, double *Dvalues, + UMFPackIndex *DcolPointers, UMFPackIndex *DrowIndices, std::vector &Cvalues); /// If the rows of the matrix are reordered, the columnindices of the matrixdata are incorrect diff --git a/opm/simulators/wells/MultisegmentWell_impl.hpp b/opm/simulators/wells/MultisegmentWell_impl.hpp index 47b4dc322..352d42ccb 100644 --- a/opm/simulators/wells/MultisegmentWell_impl.hpp +++ b/opm/simulators/wells/MultisegmentWell_impl.hpp @@ -677,8 +677,8 @@ namespace Opm // duneD Dune::UMFPack umfpackMatrix(duneD_, 0); double *Dvals = umfpackMatrix.getInternalMatrix().getValues(); - int *Dcols = umfpackMatrix.getInternalMatrix().getColStart(); - int *Drows = umfpackMatrix.getInternalMatrix().getRowIndex(); + auto *Dcols = umfpackMatrix.getInternalMatrix().getColStart(); + auto *Drows = umfpackMatrix.getInternalMatrix().getRowIndex(); // duneB std::vector Bcols;