Merge pull request #2392 from joakim-hove/welltype

Add serialization for WellType
This commit is contained in:
Joakim Hove
2020-03-09 16:40:35 +01:00
committed by GitHub
3 changed files with 44 additions and 12 deletions

View File

@@ -51,6 +51,7 @@
#include <opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp> #include <opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/RFTConfig.hpp> #include <opm/parser/eclipse/EclipseState/Schedule/RFTConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp> #include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleTypes.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp> #include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Tuning.hpp> #include <opm/parser/eclipse/EclipseState/Schedule/Tuning.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQASTNode.hpp> #include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQASTNode.hpp>
@@ -534,6 +535,12 @@ std::size_t packSize(const ThresholdPressure& data, Dune::MPIHelper::MPICommunic
packSize(data.pressureTable(), comm); packSize(data.pressureTable(), comm);
} }
std::size_t packSize(const WellType& data, Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.producer(), comm) +
packSize(data.preferred_phase(), comm);
}
std::size_t packSize(const DenT& data, Dune::MPIHelper::MPICommunicator comm) std::size_t packSize(const DenT& data, Dune::MPIHelper::MPICommunicator comm)
{ {
return packSize(data.records(), comm); return packSize(data.records(), comm);
@@ -1233,7 +1240,7 @@ std::size_t packSize(const Well& data,
packSize(data.getHeadI(), comm) + packSize(data.getHeadI(), comm) +
packSize(data.getHeadJ(), comm) + packSize(data.getHeadJ(), comm) +
packSize(data.getRefDepth(), comm) + packSize(data.getRefDepth(), comm) +
packSize(data.getPreferredPhase(), comm) + packSize(data.wellType(), comm) +
packSize(data.getWellConnectionOrdering(), comm) + packSize(data.getWellConnectionOrdering(), comm) +
packSize(data.units(), comm) + packSize(data.units(), comm) +
packSize(data.udqUndefined(), comm) + packSize(data.udqUndefined(), comm) +
@@ -1241,7 +1248,6 @@ std::size_t packSize(const Well& data,
packSize(data.getDrainageRadius(), comm) + packSize(data.getDrainageRadius(), comm) +
packSize(data.getAllowCrossFlow(), comm) + packSize(data.getAllowCrossFlow(), comm) +
packSize(data.getAutomaticShutIn(), comm) + packSize(data.getAutomaticShutIn(), comm) +
packSize(data.isProducer(), comm) +
packSize(data.wellGuideRate(), comm) + packSize(data.wellGuideRate(), comm) +
packSize(data.getEfficiencyFactor(), comm) + packSize(data.getEfficiencyFactor(), comm) +
packSize(data.getSolventFraction(), comm) + packSize(data.getSolventFraction(), comm) +
@@ -2196,6 +2202,12 @@ void pack(const Aquifetp::AQUFETP_data& data, std::vector<char>& buffer, int& po
pack(data.p0, buffer, position, comm); pack(data.p0, buffer, position, comm);
} }
void pack(const WellType& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm) {
pack(data.producer(), buffer, position, comm);
pack(data.preferred_phase(), buffer, position, comm);
}
void pack(const DenT& data, std::vector<char>& buffer, int& position, void pack(const DenT& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm) { Dune::MPIHelper::MPICommunicator comm) {
pack(data.records(), buffer, position, comm); pack(data.records(), buffer, position, comm);
@@ -2875,7 +2887,7 @@ void pack(const Well& data,
pack(data.getHeadI(), buffer, position, comm); pack(data.getHeadI(), buffer, position, comm);
pack(data.getHeadJ(), buffer, position, comm); pack(data.getHeadJ(), buffer, position, comm);
pack(data.getRefDepth(), buffer, position, comm); pack(data.getRefDepth(), buffer, position, comm);
pack(data.getPreferredPhase(), buffer, position, comm); pack(data.wellType(), buffer, position, comm);
pack(data.getWellConnectionOrdering(), buffer, position, comm); pack(data.getWellConnectionOrdering(), buffer, position, comm);
pack(data.units(), buffer, position, comm); pack(data.units(), buffer, position, comm);
pack(data.udqUndefined(), buffer, position, comm); pack(data.udqUndefined(), buffer, position, comm);
@@ -2883,7 +2895,6 @@ void pack(const Well& data,
pack(data.getDrainageRadius(), buffer, position, comm); pack(data.getDrainageRadius(), buffer, position, comm);
pack(data.getAllowCrossFlow(), buffer, position, comm); pack(data.getAllowCrossFlow(), buffer, position, comm);
pack(data.getAutomaticShutIn(), buffer, position, comm); pack(data.getAutomaticShutIn(), buffer, position, comm);
pack(data.isProducer(), buffer, position, comm);
pack(data.wellGuideRate(), buffer, position, comm); pack(data.wellGuideRate(), buffer, position, comm);
pack(data.getEfficiencyFactor(), buffer, position, comm); pack(data.getEfficiencyFactor(), buffer, position, comm);
pack(data.getSolventFraction(), buffer, position, comm); pack(data.getSolventFraction(), buffer, position, comm);
@@ -3946,6 +3957,17 @@ void unpack(AquiferCT::AQUCT_data& data, std::vector<char>& buffer, int& positio
} }
void unpack(WellType& data, std::vector<char>& buffer, int& position, Dune::MPIHelper::MPICommunicator comm)
{
Phase preferred_phase;
bool producer;
unpack(producer, buffer, position, comm);
unpack(preferred_phase, buffer, position, comm);
data = WellType( producer, preferred_phase );
}
void unpack(DenT& data, std::vector<char>& buffer, int& position, Dune::MPIHelper::MPICommunicator comm) void unpack(DenT& data, std::vector<char>& buffer, int& position, Dune::MPIHelper::MPICommunicator comm)
{ {
std::vector<DenT::entry> records; std::vector<DenT::entry> records;
@@ -4989,13 +5011,13 @@ void unpack(Well& data,
std::size_t firstTimeStep, seqIndex; std::size_t firstTimeStep, seqIndex;
int headI, headJ; int headI, headJ;
double ref_depth; double ref_depth;
Phase phase; WellType wtype;
Connection::Order ordering; Connection::Order ordering;
UnitSystem units; UnitSystem units;
double udq_undefined; double udq_undefined;
Well::Status status; Well::Status status;
double drainageRadius; double drainageRadius;
bool allowCrossFlow, automaticShutIn, isProducer; bool allowCrossFlow, automaticShutIn;
Well::WellGuideRate guideRate; Well::WellGuideRate guideRate;
double efficiencyFactor; double efficiencyFactor;
double solventFraction; double solventFraction;
@@ -5017,7 +5039,7 @@ void unpack(Well& data,
unpack(headI, buffer, position, comm); unpack(headI, buffer, position, comm);
unpack(headJ, buffer, position, comm); unpack(headJ, buffer, position, comm);
unpack(ref_depth, buffer, position, comm); unpack(ref_depth, buffer, position, comm);
unpack(phase, buffer, position, comm); unpack(wtype, buffer, position, comm);
unpack(ordering, buffer, position, comm); unpack(ordering, buffer, position, comm);
unpack(units, buffer, position, comm); unpack(units, buffer, position, comm);
unpack(udq_undefined, buffer, position, comm); unpack(udq_undefined, buffer, position, comm);
@@ -5025,7 +5047,6 @@ void unpack(Well& data,
unpack(drainageRadius, buffer, position, comm); unpack(drainageRadius, buffer, position, comm);
unpack(allowCrossFlow, buffer, position, comm); unpack(allowCrossFlow, buffer, position, comm);
unpack(automaticShutIn, buffer, position, comm); unpack(automaticShutIn, buffer, position, comm);
unpack(isProducer, buffer, position, comm);
unpack(guideRate, buffer, position, comm); unpack(guideRate, buffer, position, comm);
unpack(efficiencyFactor, buffer, position, comm); unpack(efficiencyFactor, buffer, position, comm);
unpack(solventFraction, buffer, position, comm); unpack(solventFraction, buffer, position, comm);
@@ -5045,8 +5066,8 @@ void unpack(Well& data,
unpack(*segments, buffer, position, comm); unpack(*segments, buffer, position, comm);
} }
data = Well(name, groupName, firstTimeStep, seqIndex, headI, headJ, data = Well(name, groupName, firstTimeStep, seqIndex, headI, headJ,
ref_depth, phase, ordering, units, udq_undefined, status, ref_depth, wtype, ordering, units, udq_undefined, status,
drainageRadius, allowCrossFlow, automaticShutIn, isProducer, drainageRadius, allowCrossFlow, automaticShutIn,
guideRate, efficiencyFactor, solventFraction, prediction_mode, guideRate, efficiencyFactor, solventFraction, prediction_mode,
econLimits, foamProperties, polymerProperties, brineProperties, econLimits, foamProperties, polymerProperties, brineProperties,
tracerProperties, connection, production, injection, segments); tracerProperties, connection, production, injection, segments);

View File

@@ -598,6 +598,7 @@ ADD_PACK_PROTOTYPES(ViscrefTable)
ADD_PACK_PROTOTYPES(WATDENTRecord) ADD_PACK_PROTOTYPES(WATDENTRecord)
ADD_PACK_PROTOTYPES(WatdentTable) ADD_PACK_PROTOTYPES(WatdentTable)
ADD_PACK_PROTOTYPES(Well) ADD_PACK_PROTOTYPES(Well)
ADD_PACK_PROTOTYPES(WellType)
ADD_PACK_PROTOTYPES(Well::WellGuideRate) ADD_PACK_PROTOTYPES(Well::WellGuideRate)
ADD_PACK_PROTOTYPES(Well::WellInjectionProperties) ADD_PACK_PROTOTYPES(Well::WellInjectionProperties)
ADD_PACK_PROTOTYPES(Well::WellProductionProperties) ADD_PACK_PROTOTYPES(Well::WellProductionProperties)

View File

@@ -61,6 +61,7 @@
#include <opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp> #include <opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/RFTConfig.hpp> #include <opm/parser/eclipse/EclipseState/Schedule/RFTConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp> #include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleTypes.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp> #include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Tuning.hpp> #include <opm/parser/eclipse/EclipseState/Schedule/Tuning.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQActive.hpp> #include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQActive.hpp>
@@ -327,9 +328,9 @@ Opm::Well getFullWell()
{ {
Opm::UnitSystem unitSystem; Opm::UnitSystem unitSystem;
return Opm::Well("test1", "test2", 1, 2, 3, 4, 5.0, return Opm::Well("test1", "test2", 1, 2, 3, 4, 5.0,
Opm::Phase::WATER, Opm::Connection::Order::DEPTH, Opm::WellType(Opm::Phase::WATER), Opm::Connection::Order::DEPTH,
unitSystem, 6.0, Opm::Well::Status::SHUT, unitSystem, 6.0, Opm::Well::Status::SHUT,
7.0, true, true, false, 7.0, true, false,
Opm::Well::WellGuideRate{true, 1.0, Opm::Well::GuideRateTarget::COMB, 2.0}, Opm::Well::WellGuideRate{true, 1.0, Opm::Well::GuideRateTarget::COMB, 2.0},
8.0, 9.0, false, 8.0, 9.0, false,
std::make_shared<Opm::WellEconProductionLimits>(), std::make_shared<Opm::WellEconProductionLimits>(),
@@ -2301,6 +2302,15 @@ BOOST_AUTO_TEST_CASE(Fault)
#endif #endif
} }
BOOST_AUTO_TEST_CASE(WellType)
{
#ifdef HAVE_MPI
Opm::WellType val1(true, Opm::Phase::OIL);
auto val2 = PackUnpack(val1);
DO_CHECKS(WellType)
#endif
}
BOOST_AUTO_TEST_CASE(DenT) BOOST_AUTO_TEST_CASE(DenT)
{ {
#ifdef HAVE_MPI #ifdef HAVE_MPI