Collect WellTestState on IORank

This commit is contained in:
Joakim Hove 2021-10-02 20:28:44 +02:00
parent fcbc9f8cf8
commit ac3748229a
4 changed files with 64 additions and 5 deletions

View File

@ -576,6 +576,41 @@ public:
}
};
class PackUnPackWellTestState : public P2PCommunicatorType::DataHandleInterface
{
public:
PackUnPackWellTestState(const WellTestState& localWTestState,
WellTestState& globalWTestState,
bool isIORank)
: local_(localWTestState)
, global_(globalWTestState)
{
if (isIORank) {
MessageBufferType buffer;
pack(0, buffer);
// pass a dummyLink to satisfy virtual class
int dummyLink = -1;
unpack(dummyLink, buffer);
}
}
void pack(int link, MessageBufferType& buffer) {
if (link != 0)
throw std::logic_error("link in method pack is not 0 as expected");
this->local_.pack(buffer);
}
void unpack(int, MessageBufferType& buffer) {
this->global_.unpack(buffer);
}
private:
const WellTestState& local_;
WellTestState& global_;
};
class PackUnPackAquiferData : public P2PCommunicatorType::DataHandleInterface
{
const data::Aquifers& localAquiferData_;
@ -842,7 +877,8 @@ collect(const data::Solution& localCellData,
const std::map<std::size_t, double>& localWBPData,
const data::Wells& localWellData,
const data::GroupAndNetworkValues& localGroupAndNetworkData,
const data::Aquifers& localAquiferData)
const data::Aquifers& localAquiferData,
const WellTestState& localWellTestState)
{
globalCellData_ = {};
globalBlockData_.clear();
@ -850,6 +886,7 @@ collect(const data::Solution& localCellData,
globalWellData_.clear();
globalGroupAndNetworkData_.clear();
globalAquiferData_.clear();
globalWellTestState_.clear();
// index maps only have to be build when reordering is needed
if(!needsReordering && !isParallel())
@ -900,12 +937,19 @@ collect(const data::Solution& localCellData,
this->isIORank()
};
PackUnPackWellTestState packUnpackWellTestState {
localWellTestState,
this->globalWellTestState_,
this->isIORank()
};
toIORankComm_.exchange(packUnpackCellData);
toIORankComm_.exchange(packUnpackWellData);
toIORankComm_.exchange(packUnpackGroupAndNetworkData);
toIORankComm_.exchange(packUnpackBlockData);
toIORankComm_.exchange(packUnpackWBPData);
toIORankComm_.exchange(packUnpackAquiferData);
toIORankComm_.exchange(packUnpackWellTestState);
#ifndef NDEBUG
// make sure every process is on the same page

View File

@ -28,6 +28,7 @@
#include <opm/output/data/Solution.hpp>
#include <opm/output/data/Wells.hpp>
#include <opm/output/data/Groups.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellTestState.hpp>
#include <opm/grid/common/p2pcommunicator.hh>
@ -69,7 +70,8 @@ public:
const std::map<std::size_t, double>& localWBPData,
const data::Wells& localWellData,
const data::GroupAndNetworkValues& localGroupAndNetworkData,
const data::Aquifers& localAquiferData);
const data::Aquifers& localAquiferData,
const WellTestState& localWellTestState);
const std::map<std::size_t, double>& globalWBPData() const
{ return this->globalWBPData_; }
@ -83,6 +85,9 @@ public:
const data::Wells& globalWellData() const
{ return globalWellData_; }
const WellTestState& globalWellTestState() const
{ return this->globalWellTestState_; }
const data::GroupAndNetworkValues& globalGroupAndNetworkData() const
{ return globalGroupAndNetworkData_; }
@ -117,6 +122,7 @@ protected:
data::Wells globalWellData_;
data::GroupAndNetworkValues globalGroupAndNetworkData_;
data::Aquifers globalAquiferData_;
WellTestState globalWellTestState_;
std::vector<int> localIdxToGlobalIdx_;
/// \brief sorted list of cartesian indices present-
///

View File

@ -646,6 +646,12 @@ public:
throw std::logic_error("commitWGState() method not implemented for class eclwellmanager");
}
WellTestState& wellTestState() {
throw std::logic_error("wellTestState() method not implemented for class eclwellmanager");
}
void resetWGState()
{
throw std::logic_error("resetWGState() method not implemented for class eclwellmanager");

View File

@ -182,7 +182,7 @@ public:
const auto localAquiferData = simulator_.problem().aquiferModel().aquiferData();
const auto localWellTestState = simulator_.problem().wellModel().wellTestState();
this->prepareLocalCellData(isSubStep, reportStepNum);
if (this->collectToIORank_.isParallel())
@ -191,7 +191,8 @@ public:
eclOutputModule_->getWBPData(),
localWellData,
localGroupAndNetworkData,
localAquiferData);
localAquiferData,
localWellTestState);
std::map<std::string, double> miscSummaryData;
@ -240,6 +241,7 @@ public:
.groupAndNetworkData(reportStepNum);
auto localAquiferData = simulator_.problem().aquiferModel().aquiferData();
auto localWellTestState = simulator_.problem().wellModel().wellTestState();
data::Solution localCellData = {};
if (! isSubStep) {
@ -255,7 +257,8 @@ public:
eclOutputModule_->getWBPData(),
localWellData,
localGroupAndNetworkData,
localAquiferData);
localAquiferData,
localWellTestState);
}
if (this->collectToIORank_.isIORank()) {