mirror of
https://github.com/OPM/opm-simulators.git
synced 2026-11-02 20:30:55 -06:00
Chase Group/Node Summary API Update
This is in preparation of adding support for outputting the network node pressure quantity, GPR, to the summary file. In particular, 'GroupValues' is renamed to 'GroupAndNetworkValues' and has new individual datamembers for the former group-level data and the new node-level data. Update BlackoilWellModel::groupData() and CollectToIORank accordingly and bring the parallel restart facility in line with the new layout.
This commit is contained in:
1 parent
6a592a8c55
commit
fde3c476c3
9 files changed
+121
-85
No files matched your search
@@ -207,6 +207,7 @@ std::size_t packSize(const std::array<T,N>& data, Dune::MPIHelper::MPICommunicat
|
||||
HANDLE_AS_POD(data::Connection)
|
||||
HANDLE_AS_POD(data::CurrentControl)
|
||||
HANDLE_AS_POD(data::GroupConstraints)
|
||||
HANDLE_AS_POD(data::NodeData)
|
||||
HANDLE_AS_POD(data::Rates)
|
||||
HANDLE_AS_POD(data::Segment)
|
||||
|
||||
@@ -260,11 +261,10 @@ std::size_t packSize(const data::Solution& data, Dune::MPIHelper::MPICommunicato
|
||||
return packSize(static_cast<const std::map< std::string, data::CellData>&>(data), comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const data::GroupValues& data, Dune::MPIHelper::MPICommunicator comm)
|
||||
std::size_t packSize(const data::GroupAndNetworkValues& data, Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
// Needs explicit conversion to a supported base type holding the data
|
||||
// to prevent throwing.
|
||||
return packSize(static_cast<const std::map<std::string, data::GroupData>&>(data), comm);
|
||||
return packSize(data.groupData, comm)
|
||||
+ packSize(data.nodeData, comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const data::WellRates& data, Dune::MPIHelper::MPICommunicator comm)
|
||||
@@ -278,7 +278,7 @@ std::size_t packSize(const RestartValue& data, Dune::MPIHelper::MPICommunicator
|
||||
{
|
||||
return packSize(data.solution, comm)
|
||||
+ packSize(data.wells, comm)
|
||||
+ packSize(data.groups, comm)
|
||||
+ packSize(data.grp_nwrk, comm)
|
||||
+ packSize(data.extra, comm);
|
||||
}
|
||||
|
||||
@@ -552,13 +552,11 @@ void pack(const data::WellRates& data, std::vector<char>& buffer, int& position,
|
||||
buffer, position, comm);
|
||||
}
|
||||
|
||||
void pack(const data::GroupValues& data, std::vector<char>& buffer, int& position,
|
||||
void pack(const data::GroupAndNetworkValues& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
// Needs explicit conversion to a supported base type holding the data
|
||||
// to prevent throwing.
|
||||
pack(static_cast<const std::map< std::string, data::GroupData>&>(data),
|
||||
buffer, position, comm);
|
||||
pack(data.groupData, buffer, position, comm);
|
||||
pack(data.nodeData, buffer, position, comm);
|
||||
}
|
||||
|
||||
void pack(const RestartValue& data, std::vector<char>& buffer, int& position,
|
||||
@@ -566,7 +564,7 @@ void pack(const RestartValue& data, std::vector<char>& buffer, int& position,
|
||||
{
|
||||
pack(data.solution, buffer, position, comm);
|
||||
pack(data.wells, buffer, position, comm);
|
||||
pack(data.groups, buffer, position, comm);
|
||||
pack(data.grp_nwrk, buffer, position, comm);
|
||||
pack(data.extra, buffer, position, comm);
|
||||
}
|
||||
|
||||
@@ -858,13 +856,11 @@ void unpack(data::WellRates& data, std::vector<char>& buffer, int& position,
|
||||
buffer, position, comm);
|
||||
}
|
||||
|
||||
void unpack(data::GroupValues& data, std::vector<char>& buffer, int& position,
|
||||
void unpack(data::GroupAndNetworkValues& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
// Needs explicit conversion to a supported base type holding the data
|
||||
// to prevent throwing.
|
||||
unpack(static_cast<std::map< std::string, data::GroupData>&>(data),
|
||||
buffer, position, comm);
|
||||
unpack(data.groupData, buffer, position, comm);
|
||||
unpack(data.nodeData, buffer, position, comm);
|
||||
}
|
||||
|
||||
void unpack(RestartValue& data, std::vector<char>& buffer, int& position,
|
||||
@@ -872,7 +868,7 @@ void unpack(RestartValue& data, std::vector<char>& buffer, int& position,
|
||||
{
|
||||
unpack(data.solution, buffer, position, comm);
|
||||
unpack(data.wells, buffer, position, comm);
|
||||
unpack(data.groups, buffer, position, comm);
|
||||
unpack(data.grp_nwrk, buffer, position, comm);
|
||||
unpack(data.extra, buffer, position, comm);
|
||||
}
|
||||
|
||||
@@ -951,8 +947,8 @@ RestartValue loadParallelRestart(const EclipseIO* eclIO, Action::State& actionSt
|
||||
#if HAVE_MPI
|
||||
data::Solution sol;
|
||||
data::Wells wells;
|
||||
data::GroupValues groups;
|
||||
RestartValue restartValues(sol, wells, groups);
|
||||
data::GroupAndNetworkValues grp_nwrk;
|
||||
RestartValue restartValues(sol, wells, grp_nwrk);
|
||||
|
||||
if (eclIO)
|
||||
{
|
||||
|
||||
@@ -310,7 +310,8 @@ ADD_PACK_PROTOTYPES(data::GuideRateValue)
|
||||
ADD_PACK_PROTOTYPES(data::GroupConstraints)
|
||||
ADD_PACK_PROTOTYPES(data::GroupGuideRates)
|
||||
ADD_PACK_PROTOTYPES(data::GroupData)
|
||||
ADD_PACK_PROTOTYPES(data::GroupValues)
|
||||
ADD_PACK_PROTOTYPES(data::NodeData)
|
||||
ADD_PACK_PROTOTYPES(data::GroupAndNetworkValues)
|
||||
ADD_PACK_PROTOTYPES(data::Well)
|
||||
ADD_PACK_PROTOTYPES(data::WellRates)
|
||||
ADD_PACK_PROTOTYPES(RestartKey)
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <opm/simulators/utils/ParallelSerialization.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/DynamicState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
||||
|
||||
@@ -191,23 +191,15 @@ namespace Opm {
|
||||
|
||||
void initFromRestartFile(const RestartValue& restartValues);
|
||||
|
||||
Opm::data::GroupValues
|
||||
groupData(const int reportStepIdx, const Opm::Schedule& sched) const
|
||||
Opm::data::GroupAndNetworkValues
|
||||
groupAndNetworkData(const int reportStepIdx, const Opm::Schedule& sched) const
|
||||
{
|
||||
auto gvalues = ::Opm::data::GroupValues{};
|
||||
auto grp_nwrk_values = ::Opm::data::GroupAndNetworkValues{};
|
||||
|
||||
const auto groupGuideRates =
|
||||
calculateAllGroupGuiderates(reportStepIdx, sched);
|
||||
this->assignGroupValues(reportStepIdx, sched,
|
||||
grp_nwrk_values.groupData);
|
||||
|
||||
for (const auto& gname : sched.groupNames(reportStepIdx)) {
|
||||
const auto& grup = sched.getGroup(gname, reportStepIdx);
|
||||
|
||||
auto& gdata = gvalues[gname];
|
||||
this->assignGroupControl(grup, gdata);
|
||||
this->assignGroupGuideRates(grup, groupGuideRates, gdata);
|
||||
}
|
||||
|
||||
return gvalues;
|
||||
return grp_nwrk_values;
|
||||
}
|
||||
|
||||
Opm::data::Wells wellData() const
|
||||
@@ -414,7 +406,7 @@ namespace Opm {
|
||||
|
||||
// convert well data from opm-common to well state from opm-core
|
||||
void wellsToState( const data::Wells& wells,
|
||||
const data::GroupValues& groupValues,
|
||||
const data::GroupAndNetworkValues& grpNwrkValues,
|
||||
const PhaseUsage& phases,
|
||||
const bool handle_ms_well,
|
||||
WellStateFullyImplicitBlackoil& state ) const;
|
||||
@@ -444,6 +436,10 @@ namespace Opm {
|
||||
|
||||
void setWsolvent(const Group& group, const Schedule& schedule, const int reportStepIdx, double wsolvent);
|
||||
|
||||
void assignGroupValues(const int reportStepIdx,
|
||||
const Schedule& sched,
|
||||
std::map<std::string, data::GroupData>& gvalues) const;
|
||||
|
||||
std::unordered_map<std::string, data::GroupGuideRates>
|
||||
calculateAllGroupGuiderates(const int reportStepIdx, const Schedule& sched) const;
|
||||
|
||||
|
||||
@@ -547,7 +547,7 @@ namespace Opm {
|
||||
const size_t numCells = Opm::UgGridHelpers::numCells(grid());
|
||||
const bool handle_ms_well = (param_.use_multisegment_well_ && anyMSWellOpenLocal());
|
||||
well_state_.resize(wells_ecl_, schedule(), handle_ms_well, numCells, phaseUsage, well_perf_data_, summaryState, globalNumWells); // Resize for restart step
|
||||
wellsToState(restartValues.wells, restartValues.groups, phaseUsage, handle_ms_well, well_state_);
|
||||
wellsToState(restartValues.wells, restartValues.grp_nwrk, phaseUsage, handle_ms_well, well_state_);
|
||||
}
|
||||
|
||||
previous_well_state_ = well_state_;
|
||||
@@ -1602,7 +1602,7 @@ namespace Opm {
|
||||
void
|
||||
BlackoilWellModel<TypeTag>::
|
||||
wellsToState( const data::Wells& wells,
|
||||
const data::GroupValues& groupValues,
|
||||
const data::GroupAndNetworkValues& grpNwrkValues,
|
||||
const PhaseUsage& phases,
|
||||
const bool handle_ms_well,
|
||||
WellStateFullyImplicitBlackoil& state) const
|
||||
@@ -1699,7 +1699,7 @@ namespace Opm {
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& [group, value] : groupValues) {
|
||||
for (const auto& [group, value] : grpNwrkValues.groupData) {
|
||||
const auto cpc = value.currentControl.currentProdConstraint;
|
||||
const auto cgi = value.currentControl.currentGasInjectionConstraint;
|
||||
const auto cwi = value.currentControl.currentWaterInjectionConstraint;
|
||||
@@ -2456,6 +2456,25 @@ namespace Opm {
|
||||
}
|
||||
}
|
||||
|
||||
template <typename TypeTag>
|
||||
void
|
||||
BlackoilWellModel<TypeTag>::
|
||||
assignGroupValues(const int reportStepIdx,
|
||||
const Schedule& sched,
|
||||
std::map<std::string, data::GroupData>& gvalues) const
|
||||
{
|
||||
const auto groupGuideRates =
|
||||
this->calculateAllGroupGuiderates(reportStepIdx, sched);
|
||||
|
||||
for (const auto& gname : sched.groupNames(reportStepIdx)) {
|
||||
const auto& grup = sched.getGroup(gname, reportStepIdx);
|
||||
|
||||
auto& gdata = gvalues[gname];
|
||||
this->assignGroupControl(grup, gdata);
|
||||
this->assignGroupGuideRates(grup, groupGuideRates, gdata);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename TypeTag>
|
||||
std::unordered_map<std::string, data::GroupGuideRates>
|
||||
BlackoilWellModel<TypeTag>::
|
||||
|
||||
Reference in new issue
Block a user