Activate distributed standard wells.

We introduce a new parameter --enable-distributed-wells=<true|false>
for this. During startup we check that the model either only has
standard wells or that multisegement wells are actively interpreted
as standard wells (by way of passing --enable-multisegment-wells=false
as an option).
This commit is contained in:
Markus Blatt
2021-01-21 12:39:58 +01:00
parent 57d158bbbe
commit f464d93f15
3 changed files with 69 additions and 2 deletions

View File

@@ -51,6 +51,8 @@
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQConfig.hpp>
#include <opm/simulators/flow/BlackoilModelParametersEbos.hpp>
#include <opm/simulators/utils/readDeck.hpp>
#if HAVE_MPI
@@ -121,6 +123,11 @@ struct ZoltanImbalanceTol {
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag>
struct AllowDistributedWells {
using type = UndefinedProperty;
};
template<class TypeTag>
struct IgnoreKeywords<TypeTag, TTag::EclBaseVanguard> {
static constexpr auto value = "";
@@ -164,6 +171,10 @@ struct ZoltanImbalanceTol<TypeTag, TTag::EclBaseVanguard> {
static constexpr type value = 1.1;
};
template<class TypeTag>
struct AllowDistributedWells<TypeTag, TTag::EclBaseVanguard> {
static constexpr bool value = false;
};
} // namespace Opm::Properties
namespace Opm {
@@ -218,7 +229,9 @@ public:
EWOMS_REGISTER_PARAM(TypeTag, bool, SerialPartitioning,
"Perform partitioning for parallel runs on a single process.");
EWOMS_REGISTER_PARAM(TypeTag, Scalar, ZoltanImbalanceTol,
"Perform partitioning for parallel runs on a single process.");
"Tolerable imbalance of the loadbalancing provided by Zoltan (default: 1.1).");
EWOMS_REGISTER_PARAM(TypeTag, bool, AllowDistributedWells,
"Allow the perforations of a well to be distributed to interior of multiple processes");
}
@@ -354,6 +367,7 @@ public:
ownersFirst_ = EWOMS_GET_PARAM(TypeTag, bool, OwnerCellsFirst);
serialPartitioning_ = EWOMS_GET_PARAM(TypeTag, bool, SerialPartitioning);
zoltanImbalanceTol_ = EWOMS_GET_PARAM(TypeTag, Scalar, ZoltanImbalanceTol);
enableDistributedWells_ = EWOMS_GET_PARAM(TypeTag, bool, AllowDistributedWells);
// Make proper case name.
{
@@ -444,6 +458,45 @@ public:
parallelWells_.emplace_back(well.name(), true);
}
std::sort(parallelWells_.begin(), parallelWells_.end());
// Check whether allowing distribute wells makes sense
if (enableDistributedWells() )
{
int hasMsWell = false;
if (BlackoilModelParametersEbos<TypeTag>().use_multisegment_well_)
{
if (myRank == 0)
{
const auto& wells = this->schedule().getWellsatEnd();
for ( const auto& well: wells)
{
hasMsWell = hasMsWell || well.isMultiSegment();
}
}
}
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 7)
const auto& comm = Dune::MPIHelper::getCommunication();
#else
const auto& comm = Dune::MPIHelper::getCollectiveCommunication();
#endif
hasMsWell = comm.max(hasMsWell);
if (hasMsWell)
{
if (myRank == 0)
{
std::string message = std::string("Option --allow-distributed-wells=true is only allowed ")
+ "if model only has only standard wells."
+ "You need to provide option "
+ " with --enable-multisegement-wells=false to treat "
+ "existing multisegment wells as standard wells.";
OpmLog::error(message);
}
comm.barrier();
OPM_THROW(std::invalid_argument, "All wells need to be standard wells!");
}
}
}
/*!
@@ -560,6 +613,12 @@ public:
Scalar zoltanImbalanceTol() const
{ return zoltanImbalanceTol_; }
/*!
* \brief Whether perforations of a well might be distributed.
*/
bool enableDistributedWells() const
{ return enableDistributedWells_; }
/*!
* \brief Returns the name of the case.
*
@@ -813,6 +872,7 @@ private:
bool ownersFirst_;
bool serialPartitioning_;
Scalar zoltanImbalanceTol_;
bool enableDistributedWells_;
protected:
/*! \brief The cell centroids after loadbalance was called.