Merge pull request #1942 from andrthu/edge-weights-method

Allow for different methods of specifying the edge weights when load balancing.
This commit is contained in:
Markus Blatt 2019-07-23 12:36:07 +02:00 committed by GitHub
commit 0823cdc5dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View File

@ -75,12 +75,14 @@ NEW_PROP_TAG(EclStrictParsing);
NEW_PROP_TAG(EclOutputInterval); NEW_PROP_TAG(EclOutputInterval);
NEW_PROP_TAG(IgnoreKeywords); NEW_PROP_TAG(IgnoreKeywords);
NEW_PROP_TAG(EnableExperiments); NEW_PROP_TAG(EnableExperiments);
NEW_PROP_TAG(EdgeWeightsMethod);
SET_STRING_PROP(EclBaseVanguard, IgnoreKeywords, ""); SET_STRING_PROP(EclBaseVanguard, IgnoreKeywords, "");
SET_STRING_PROP(EclBaseVanguard, EclDeckFileName, ""); SET_STRING_PROP(EclBaseVanguard, EclDeckFileName, "");
SET_INT_PROP(EclBaseVanguard, EclOutputInterval, -1); // use the deck-provided value SET_INT_PROP(EclBaseVanguard, EclOutputInterval, -1); // use the deck-provided value
SET_BOOL_PROP(EclBaseVanguard, EnableOpmRstFile, false); SET_BOOL_PROP(EclBaseVanguard, EnableOpmRstFile, false);
SET_BOOL_PROP(EclBaseVanguard, EclStrictParsing, false); SET_BOOL_PROP(EclBaseVanguard, EclStrictParsing, false);
SET_INT_PROP(EclBaseVanguard, EdgeWeightsMethod, 1);
END_PROPERTIES END_PROPERTIES
@ -124,6 +126,8 @@ public:
"List of Eclipse keywords which should be ignored. As a ':' separated string."); "List of Eclipse keywords which should be ignored. As a ':' separated string.");
EWOMS_REGISTER_PARAM(TypeTag, bool, EclStrictParsing, EWOMS_REGISTER_PARAM(TypeTag, bool, EclStrictParsing,
"Use strict mode for parsing - all errors are collected before the applicaton exists."); "Use strict mode for parsing - all errors are collected before the applicaton exists.");
EWOMS_REGISTER_PARAM(TypeTag, int, EdgeWeightsMethod,
"Choose edge-weighing strategy: 0=uniform, 1=trans, 2=log(trans).");
} }
/*! /*!
@ -255,6 +259,7 @@ public:
#endif #endif
std::string fileName = EWOMS_GET_PARAM(TypeTag, std::string, EclDeckFileName); std::string fileName = EWOMS_GET_PARAM(TypeTag, std::string, EclDeckFileName);
edgeWeightsMethod_ = Dune::EdgeWeightMethod(EWOMS_GET_PARAM(TypeTag, int, EdgeWeightsMethod));
if (fileName == "") if (fileName == "")
throw std::runtime_error("No input deck file has been specified as a command line argument," throw std::runtime_error("No input deck file has been specified as a command line argument,"
@ -443,6 +448,12 @@ public:
const Opm::SummaryState& summaryState() const const Opm::SummaryState& summaryState() const
{ return summaryState_; } { return summaryState_; }
/*!
* \brief Parameter deciding the edge-weight strategy of the load balancer.
*/
Dune::EdgeWeightMethod edgeWeightsMethod() const
{ return edgeWeightsMethod_; }
/*! /*!
* \brief Returns the name of the case. * \brief Returns the name of the case.
* *
@ -589,6 +600,7 @@ private:
Opm::SummaryState summaryState_; Opm::SummaryState summaryState_;
Dune::EdgeWeightMethod edgeWeightsMethod_;
}; };
template <class TypeTag> template <class TypeTag>

View File

@ -157,6 +157,8 @@ public:
globalTrans_ = new EclTransmissibility<TypeTag>(*this); globalTrans_ = new EclTransmissibility<TypeTag>(*this);
globalTrans_->update(); globalTrans_->update();
Dune::EdgeWeightMethod edgeWeightsMethod = this->edgeWeightsMethod();
// convert to transmissibility for faces // convert to transmissibility for faces
// TODO: grid_->numFaces() is not generic. use grid_->size(1) instead? (might // TODO: grid_->numFaces() is not generic. use grid_->size(1) instead? (might
// not work) // not work)
@ -192,7 +194,7 @@ public:
//distribute the grid and switch to the distributed view. //distribute the grid and switch to the distributed view.
{ {
const auto wells = this->schedule().getWells2atEnd(); const auto wells = this->schedule().getWells2atEnd();
defunctWellNames_ = std::get<1>(grid_->loadBalance(&wells, faceTrans.data())); defunctWellNames_ = std::get<1>(grid_->loadBalance(edgeWeightsMethod, &wells, faceTrans.data()));
} }
grid_->switchToDistributedView(); grid_->switchToDistributedView();