cleaning up the implementation related to WINJMULT
This commit is contained in:
@@ -148,8 +148,9 @@ namespace RestartIO {
|
||||
double connectionLength() const;
|
||||
double skinFactor() const;
|
||||
CTFKind kind() const;
|
||||
InjMult injmult() const;
|
||||
const InjMult& injmult() const;
|
||||
void setInjMult(const InjMult& inj_mult);
|
||||
// remove the injMult setting and INJMULT is not active for this connection
|
||||
void clearInjMult();
|
||||
|
||||
void setState(State state);
|
||||
|
||||
@@ -83,7 +83,7 @@ public:
|
||||
NONE,
|
||||
};
|
||||
|
||||
static InjMultMode injMultModeFromString(const std::string& str);
|
||||
static InjMultMode injMultModeFromString(const std::string& str, const KeywordLocation& location);
|
||||
|
||||
/*
|
||||
The elements in this enum are used as bitmasks to keep track
|
||||
@@ -549,6 +549,7 @@ public:
|
||||
serializer(wvfpexp);
|
||||
serializer(m_pavg);
|
||||
serializer(well_temperature);
|
||||
serializer(inj_mult_mode);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -1786,6 +1786,25 @@ Well{0} entered with 'FIELD' parent group:
|
||||
}
|
||||
}
|
||||
|
||||
void Schedule::handleWINJMULT(Opm::Schedule::HandlerContext& handlerContext) {
|
||||
for (const auto& record : handlerContext.keyword) {
|
||||
const std::string& wellNamePattern = record.getItem("WELL_NAME").getTrimmedString(0);
|
||||
const auto well_names = wellNames(wellNamePattern);
|
||||
|
||||
for (const auto& well_name : well_names) {
|
||||
auto well = this->snapshots.back().wells( well_name );
|
||||
if (well.isProducer()) {
|
||||
const std::string reason = fmt::format("Keyword WINJMULT can only apply to injectors,"
|
||||
" but Well {} is a producer", well_name);
|
||||
throw OpmInputError(reason, handlerContext.keyword.location());
|
||||
}
|
||||
if (well.handleWINJMULT(record, handlerContext.keyword.location())) {
|
||||
this->snapshots.back().wells.update(std::move(well));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Schedule::handleWINJTEMP(HandlerContext& handlerContext) {
|
||||
// we do not support the "enthalpy" field yet. how to do this is a more difficult
|
||||
// question.
|
||||
@@ -1950,24 +1969,6 @@ Well{0} entered with 'FIELD' parent group:
|
||||
}
|
||||
}
|
||||
|
||||
void Schedule::handleWINJMULT(Opm::Schedule::HandlerContext& handlerContext) {
|
||||
for (const auto& record : handlerContext.keyword) {
|
||||
const std::string& wellNamePattern = record.getItem("WELL_NAME").getTrimmedString(0);
|
||||
const auto well_names = wellNames(wellNamePattern);
|
||||
|
||||
for (const auto& well_name : well_names) {
|
||||
auto well = this->snapshots.back().wells( well_name );
|
||||
if (well.isProducer()) {
|
||||
const std::string reason = fmt::format("Keyword WINJMULT can only apply to injectors,"
|
||||
" but Well {} is a producer", well_name);
|
||||
throw OpmInputError(reason, handlerContext.keyword.location());
|
||||
}
|
||||
if (well.handleWINJMULT(record, handlerContext.keyword.location()))
|
||||
this->snapshots.back().wells.update( std::move(well));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Schedule::handleWPMITAB(HandlerContext& handlerContext) {
|
||||
for (const auto& record : handlerContext.keyword) {
|
||||
const std::string& wellNamePattern = record.getItem("WELL").getTrimmedString(0);
|
||||
@@ -2486,6 +2487,7 @@ Well{0} entered with 'FIELD' parent group:
|
||||
{ "WFOAM" , &Schedule::handleWFOAM },
|
||||
{ "WGRUPCON", &Schedule::handleWGRUPCON },
|
||||
{ "WHISTCTL", &Schedule::handleWHISTCTL },
|
||||
{ "WINJMULT", &Schedule::handleWINJMULT },
|
||||
{ "WINJTEMP", &Schedule::handleWINJTEMP },
|
||||
{ "WLIFTOPT", &Schedule::handleWLIFTOPT },
|
||||
{ "WLIST" , &Schedule::handleWLIST },
|
||||
@@ -2496,7 +2498,6 @@ Well{0} entered with 'FIELD' parent group:
|
||||
{ "WVFPEXP" , &Schedule::handleWVFPEXP },
|
||||
{ "WWPAVE" , &Schedule::handleWWPAVE },
|
||||
{ "WPIMULT" , &Schedule::handleWPIMULT },
|
||||
{ "WINJMULT", &Schedule::handleWINJMULT },
|
||||
{ "WPMITAB" , &Schedule::handleWPMITAB },
|
||||
{ "WPOLYMER", &Schedule::handleWPOLYMER },
|
||||
{ "WRFT" , &Schedule::handleWRFT },
|
||||
|
||||
@@ -444,7 +444,7 @@ Connection::CTFKind Connection::kind() const {
|
||||
return m_ctfkind;
|
||||
}
|
||||
|
||||
Connection::InjMult Connection::injmult() const {
|
||||
const Connection::InjMult& Connection::injmult() const {
|
||||
return m_injmult;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
|
||||
#include <opm/input/eclipse/Units/Units.hpp>
|
||||
|
||||
#include <opm/common/utility/OpmInputError.hpp>
|
||||
#include <opm/common/utility/shmatch.hpp>
|
||||
|
||||
#include <opm/input/eclipse/Parser/ParserKeywords/S.hpp>
|
||||
@@ -564,7 +565,7 @@ bool Well::updateWellGuideRate(double guide_rate_arg) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Well::InjMultMode Well::injMultModeFromString(const std::string& str) {
|
||||
Well::InjMultMode Well::injMultModeFromString(const std::string& str, const KeywordLocation& location) {
|
||||
if (str == "WREV")
|
||||
return InjMultMode::WREV;
|
||||
else if (str == "CREV")
|
||||
@@ -572,7 +573,7 @@ Well::InjMultMode Well::injMultModeFromString(const std::string& str) {
|
||||
else if (str == "CIRR")
|
||||
return InjMultMode::CIRR;
|
||||
else
|
||||
throw std::invalid_argument("Unknow enum INJMultMode string: " + str);
|
||||
throw OpmInputError(fmt::format("Unknown mode {} is specified in WINJMULT keyword", str), location);
|
||||
}
|
||||
|
||||
|
||||
@@ -1311,9 +1312,13 @@ bool Well::handleWPIMULT(const DeckRecord& record) {
|
||||
}
|
||||
|
||||
|
||||
bool Well::handleWINJMULT(const Opm::DeckRecord& record, const KeywordLocation& /*location*/) {
|
||||
// TODO: the this keyword, defaulted means it <=0.
|
||||
// We need to check how the following works
|
||||
bool Well::handleWINJMULT(const Opm::DeckRecord& record, const KeywordLocation& location) {
|
||||
// for this keyword, the default for I, J, K will be negative
|
||||
// it is not totally clear how specifying 0 or a negative values will work
|
||||
// current match_eq function only treats 0 and default values for all connections,
|
||||
// we might need to revisit this part later when complication regarding this occurs.
|
||||
// it is possible that changing (item.get<int>(0) == 0); to (item.get<int>(0) <= 0) is solution to go
|
||||
// while it remains to be discussed.
|
||||
auto match = [=] ( const Connection& c) -> bool {
|
||||
if (!match_eq(c.getI() , record, "I", -1)) return false;
|
||||
if (!match_eq(c.getJ() , record, "J", -1)) return false;
|
||||
@@ -1323,14 +1328,13 @@ bool Well::handleWINJMULT(const Opm::DeckRecord& record, const KeywordLocation&
|
||||
};
|
||||
|
||||
// check whether it was under WREV previously.
|
||||
// if yes, we need to reset all the connections for injmult operation
|
||||
// if yes, we need to reset all the connections for INJMULT specification
|
||||
const bool is_prev_wrev = this->inj_mult_mode == InjMultMode::WREV;
|
||||
|
||||
// TODO: maybe location can be used in the string to mode function here
|
||||
const InjMultMode mode = injMultModeFromString(record.getItem("MODE").getTrimmedString(0));
|
||||
using Kw = ParserKeywords::WINJMULT;
|
||||
const InjMultMode mode = injMultModeFromString(record.getItem<Kw::MODE>().getTrimmedString(0), location);
|
||||
this->inj_mult_mode = mode;
|
||||
const double fracture_pressure = record.getItem("FRACTURING_PRESSURE").getSIDouble(0);
|
||||
const double multiple_gradient = record.getItem("MULTIPLIER_GRADIENT").getSIDouble(0);
|
||||
const double fracture_pressure = record.getItem<Kw::FRACTURING_PRESSURE>().getSIDouble(0);
|
||||
const double multiple_gradient = record.getItem<Kw::MULTIPLIER_GRADIENT>().getSIDouble(0);
|
||||
auto new_connections = std::make_shared<WellConnections>(this->connections->ordering(), this->headI, this->headJ);
|
||||
const Connection::InjMult inj_mult {true, fracture_pressure, multiple_gradient};
|
||||
|
||||
@@ -1627,6 +1631,7 @@ bool Well::operator==(const Well& data) const {
|
||||
&& (this->m_pavg == data.m_pavg)
|
||||
&& (this->getInjectionProperties() == data.getInjectionProperties())
|
||||
&& (this->well_temperature == data.well_temperature)
|
||||
&& (this->inj_mult_mode == data.inj_mult_mode)
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user