UDQContext.hpp: forward WellMatcher
make member a const reference to enable this
This commit is contained in:
parent
5860553dbd
commit
ba2ec8957f
@ -32,6 +32,7 @@
|
||||
#include <opm/input/eclipse/Schedule/Action/SimulatorUpdate.hpp>
|
||||
#include <opm/input/eclipse/Schedule/UDQ/UDQState.hpp>
|
||||
#include <opm/input/eclipse/Schedule/UDQ/UDQConfig.hpp>
|
||||
#include <opm/input/eclipse/Schedule/Well/WellMatcher.hpp>
|
||||
#include <opm/input/eclipse/Schedule/Well/WellTestState.hpp>
|
||||
#include <opm/input/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/input/eclipse/Parser/ParseContext.hpp>
|
||||
|
@ -28,15 +28,16 @@
|
||||
|
||||
|
||||
#include <opm/input/eclipse/Schedule/UDQ/UDQParams.hpp>
|
||||
#include <opm/input/eclipse/Schedule/Well/WellMatcher.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
class SummaryState;
|
||||
class UDQFunctionTable;
|
||||
class UDQSet;
|
||||
class UDQState;
|
||||
class WellMatcher;
|
||||
|
||||
class UDQContext{
|
||||
class UDQContext {
|
||||
public:
|
||||
UDQContext(const UDQFunctionTable& udqft, const WellMatcher& wm, SummaryState& summary_state, UDQState& udq_state);
|
||||
std::optional<double> get(const std::string& key) const;
|
||||
@ -51,7 +52,7 @@ namespace Opm {
|
||||
std::vector<std::string> groups() const;
|
||||
private:
|
||||
const UDQFunctionTable& udqft;
|
||||
WellMatcher well_matcher;
|
||||
const WellMatcher& well_matcher;
|
||||
SummaryState& summary_state;
|
||||
UDQState& udq_state;
|
||||
//std::unordered_map<std::string, UDQSet> udq_results;
|
||||
|
@ -59,6 +59,7 @@
|
||||
#include <opm/input/eclipse/Schedule/Well/WellBrineProperties.hpp>
|
||||
#include <opm/input/eclipse/Schedule/Well/WellConnections.hpp>
|
||||
#include <opm/input/eclipse/Schedule/Well/WellFoamProperties.hpp>
|
||||
#include <opm/input/eclipse/Schedule/Well/WellMatcher.hpp>
|
||||
#include <opm/input/eclipse/Schedule/Well/WellMICPProperties.hpp>
|
||||
#include <opm/input/eclipse/Schedule/Well/WellPolymerProperties.hpp>
|
||||
#include <opm/input/eclipse/Schedule/Well/WellTestConfig.hpp>
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <opm/input/eclipse/Schedule/RPTConfig.hpp>
|
||||
#include <opm/input/eclipse/Schedule/VFPProdTable.hpp>
|
||||
#include <opm/input/eclipse/Schedule/VFPInjTable.hpp>
|
||||
#include <opm/input/eclipse/Schedule/Well/WellMatcher.hpp>
|
||||
#include <opm/input/eclipse/Schedule/Well/WellTestConfig.hpp>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
@ -21,9 +21,9 @@
|
||||
#include <opm/input/eclipse/Schedule/SummaryState.hpp>
|
||||
#include <opm/input/eclipse/Schedule/UDQ/UDQContext.hpp>
|
||||
#include <opm/input/eclipse/Schedule/UDQ/UDQState.hpp>
|
||||
#include <opm/input/eclipse/Schedule/Well/WellMatcher.hpp>
|
||||
#include <opm/common/utility/TimeService.hpp>
|
||||
|
||||
|
||||
namespace Opm {
|
||||
|
||||
namespace {
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include <opm/input/eclipse/Schedule/Action/SimulatorUpdate.hpp>
|
||||
#include <opm/input/eclipse/Schedule/Action/State.hpp>
|
||||
#include <opm/input/eclipse/Schedule/Action/WGNames.hpp>
|
||||
#include <opm/input/eclipse/Schedule/Well/WellMatcher.hpp>
|
||||
#include <opm/input/eclipse/Schedule/Well/WList.hpp>
|
||||
#include <opm/input/eclipse/Schedule/Well/WListManager.hpp>
|
||||
#include <opm/input/eclipse/Deck/Deck.hpp>
|
||||
|
@ -128,7 +128,8 @@ BOOST_AUTO_TEST_CASE(SUBTRACT)
|
||||
|
||||
SummaryState st(TimeService::now());
|
||||
UDQState udq_state(udqp.undefinedValue());
|
||||
UDQContext context(udqft, WellMatcher(NameOrder({"P1"})), st, udq_state);
|
||||
WellMatcher wm(NameOrder({"P1"}));
|
||||
UDQContext context(udqft, wm, st, udq_state);
|
||||
|
||||
st.update_well_var("P1", "WOPR", 4);
|
||||
auto res = def.eval(context);
|
||||
@ -150,7 +151,8 @@ BOOST_AUTO_TEST_CASE(TEST)
|
||||
|
||||
SummaryState st(TimeService::now());
|
||||
UDQState udq_state(udqp.undefinedValue());
|
||||
UDQContext context(udqft, WellMatcher(NameOrder({"P1", "P2"})), st, udq_state);
|
||||
WellMatcher wm(NameOrder({"P1", "P2"}));
|
||||
UDQContext context(udqft, wm, st, udq_state);
|
||||
|
||||
st.update_group_var("MAU", "GOPR", 4);
|
||||
st.update_group_var("XXX", "GOPR", 5);
|
||||
@ -195,7 +197,8 @@ BOOST_AUTO_TEST_CASE(MIX_SCALAR) {
|
||||
UDQDefine def_add(udqp, "WU",0, location, {"WOPR", "+", "1"});
|
||||
SummaryState st(TimeService::now());
|
||||
UDQState udq_state(udqp.undefinedValue());
|
||||
UDQContext context(udqft, WellMatcher(NameOrder({"P1"})), st, udq_state);
|
||||
WellMatcher wm(NameOrder({"P1"}));
|
||||
UDQContext context(udqft, wm, st, udq_state);
|
||||
|
||||
st.update_well_var("P1", "WOPR", 1);
|
||||
|
||||
@ -219,7 +222,8 @@ BOOST_AUTO_TEST_CASE(UDQFieldSetTest) {
|
||||
UDQFunctionTable udqft(udqp);
|
||||
SummaryState st(TimeService::now());
|
||||
UDQState udq_state(udqp.undefinedValue());
|
||||
UDQContext context(udqft, WellMatcher(NameOrder({"P1", "P2", "P3", "P4"})), st, udq_state);
|
||||
WellMatcher wm(NameOrder({"P1", "P2", "P3", "P4"}));
|
||||
UDQContext context(udqft, wm, st, udq_state);
|
||||
|
||||
st.update_well_var("P1", "WOPR", 1.0);
|
||||
st.update_well_var("P2", "WOPR", 2.0);
|
||||
@ -345,7 +349,8 @@ BOOST_AUTO_TEST_CASE(UDQ_DEFINETEST) {
|
||||
UDQDefine def(udqp, "WUBHP",0, location, {"WBHP"});
|
||||
SummaryState st(TimeService::now());
|
||||
UDQState udq_state(udqp.undefinedValue());
|
||||
UDQContext context(udqft, WellMatcher(NameOrder({"W1", "W2", "W3"})), st, udq_state);
|
||||
WellMatcher wm(NameOrder({"W1", "W2", "W3"}));
|
||||
UDQContext context(udqft, wm, st, udq_state);
|
||||
|
||||
st.update_well_var("W1", "WBHP", 11);
|
||||
st.update_well_var("W2", "WBHP", 2);
|
||||
@ -364,7 +369,8 @@ BOOST_AUTO_TEST_CASE(UDQ_DEFINETEST) {
|
||||
UDQDefine def(udqp, "WUBHP",0, location, {"WBHP" , "'P*'"});
|
||||
SummaryState st(TimeService::now());
|
||||
UDQState udq_state(udqp.undefinedValue());
|
||||
UDQContext context(udqft, WellMatcher(NameOrder({"I1", "I2", "P1", "P2"})), st, udq_state);
|
||||
WellMatcher wm(NameOrder({"I1", "I2", "P1", "P2"}));
|
||||
UDQContext context(udqft, wm, st, udq_state);
|
||||
|
||||
|
||||
st.update_well_var("P1", "WBHP", 1);
|
||||
@ -382,7 +388,8 @@ BOOST_AUTO_TEST_CASE(UDQ_DEFINETEST) {
|
||||
UDQDefine def(udqp, "WUBHP",0, location, {"NINT" , "(", "WBHP", ")"});
|
||||
SummaryState st(TimeService::now());
|
||||
UDQState udq_state(udqp.undefinedValue());
|
||||
UDQContext context(udqft, WellMatcher(NameOrder({"P1", "P2", "I1", "I2"})), st, udq_state);
|
||||
WellMatcher wm(NameOrder({"P1", "P2", "I1", "I2"}));
|
||||
UDQContext context(udqft, wm, st, udq_state);
|
||||
st.update_well_var("P1", "WBHP", 4);
|
||||
st.update_well_var("P2", "WBHP", 3);
|
||||
st.update_well_var("I1", "WBHP", 2);
|
||||
@ -1010,7 +1017,8 @@ BOOST_AUTO_TEST_CASE(UDQ_POW_TEST) {
|
||||
SummaryState st(TimeService::now());
|
||||
UDQState udq_state(udqp.undefinedValue());
|
||||
NameOrder wo; wo.add("P1");
|
||||
UDQContext context(udqft, WellMatcher(wo), st, udq_state);
|
||||
WellMatcher wm(wo);
|
||||
UDQContext context(udqft, wm, st, udq_state);
|
||||
|
||||
st.update_well_var("P1", "WOPR", 1);
|
||||
st.update_well_var("P1", "WWPR", 2);
|
||||
@ -1031,7 +1039,8 @@ BOOST_AUTO_TEST_CASE(UDQ_CMP_TEST) {
|
||||
UDQDefine def_cmp(udqp, "WU",0, location, {"WOPR", ">", "WWPR", "+", "WGOR", "*", "WWIR"});
|
||||
SummaryState st(TimeService::now());
|
||||
UDQState udq_state(udqp.undefinedValue());
|
||||
UDQContext context(udqft, WellMatcher(NameOrder({"P1", "P2"})), st, udq_state);
|
||||
WellMatcher wm(NameOrder({"P1", "P2"}));
|
||||
UDQContext context(udqft, wm, st, udq_state);
|
||||
|
||||
st.update_well_var("P1", "WOPR", 0);
|
||||
st.update_well_var("P1", "WWPR", 10);
|
||||
@ -1060,7 +1069,8 @@ BOOST_AUTO_TEST_CASE(UDQ_SCALAR_SET) {
|
||||
UDQFunctionTable udqft;
|
||||
SummaryState st(TimeService::now());
|
||||
UDQState udq_state(udqp.undefinedValue());
|
||||
UDQContext context(udqft, WellMatcher(NameOrder({"PA1", "PB2", "PC3", "PD4"})), st, udq_state);
|
||||
WellMatcher wm(NameOrder({"PA1", "PB2", "PC3", "PD4"}));
|
||||
UDQContext context(udqft, wm, st, udq_state);
|
||||
|
||||
st.update_well_var("PA1", "WOPR", 1);
|
||||
st.update_well_var("PB2", "WOPR", 2);
|
||||
@ -1130,7 +1140,8 @@ BOOST_AUTO_TEST_CASE(UDQ_SORTD_NAN) {
|
||||
UDQDefine def_sort(udqp , "WUPR3",0, location, {"SORTD", "(", "WUPR1", ")" });
|
||||
SummaryState st(TimeService::now());
|
||||
UDQState udq_state(udqp.undefinedValue());
|
||||
UDQContext context(udqft, WellMatcher(NameOrder({"OP1", "OP2", "OP3", "OP4"})), st, udq_state);
|
||||
WellMatcher wm(NameOrder({"OP1", "OP2", "OP3", "OP4"}));
|
||||
UDQContext context(udqft, wm, st, udq_state);
|
||||
|
||||
st.update_well_var("OP1", "WWIR", 1.0);
|
||||
st.update_well_var("OP2", "WWIR", 2.0);
|
||||
@ -1176,7 +1187,8 @@ BOOST_AUTO_TEST_CASE(UDQ_SORTA) {
|
||||
UDQDefine def_sort(udqp , "WUPR3",0, location, {"SORTA", "(", "WUPR1", ")" });
|
||||
SummaryState st(TimeService::now());
|
||||
UDQState udq_state(udqp.undefinedValue());
|
||||
UDQContext context(udqft, WellMatcher(NameOrder({"OPL01", "OPL02", "OPU01", "OPU02"})), st, udq_state);
|
||||
WellMatcher wm(NameOrder({"OPL01", "OPL02", "OPU01", "OPU02"}));
|
||||
UDQContext context(udqft, wm, st, udq_state);
|
||||
|
||||
st.update_well_var("OPL01", "WWCT", 0.7);
|
||||
st.update_well_var("OPL02", "WWCT", 0.8);
|
||||
@ -1206,7 +1218,8 @@ BOOST_AUTO_TEST_CASE(UDQ_BASIC_MATH_TEST) {
|
||||
UDQDefine def_wuwct(udqp , "WUWCT",0, location, {"WWPR", "/", "(", "WOPR", "+", "WWPR", ")"});
|
||||
SummaryState st(TimeService::now());
|
||||
UDQState udq_state(udqp.undefinedValue());
|
||||
UDQContext context(udqft, WellMatcher(NameOrder({"P1", "P2", "P3", "P4"})), st, udq_state);
|
||||
WellMatcher wm(NameOrder({"P1", "P2", "P3", "P4"}));
|
||||
UDQContext context(udqft, wm, st, udq_state);
|
||||
|
||||
st.update_well_var("P1", "WOPR", 1);
|
||||
st.update_well_var("P2", "WOPR", 2);
|
||||
@ -1268,7 +1281,8 @@ BOOST_AUTO_TEST_CASE(DECK_TEST) {
|
||||
UDQDefine def(udqp, "WUOPRL",0, location, {"(", "WOPR", "OP1", "-", "150", ")", "*", "0.90"});
|
||||
SummaryState st(TimeService::now());
|
||||
UDQState udq_state(udqp.undefinedValue());
|
||||
UDQContext context(udqft, WellMatcher(NameOrder({"OP1", "OP2", "OP3"})), st, udq_state);
|
||||
WellMatcher wm(NameOrder({"OP1", "OP2", "OP3"}));
|
||||
UDQContext context(udqft, wm, st, udq_state);
|
||||
|
||||
st.update_well_var("OP1", "WOPR", 300);
|
||||
st.update_well_var("OP2", "WOPR", 3000);
|
||||
@ -1323,7 +1337,8 @@ BOOST_AUTO_TEST_CASE(UDQ_PARSE_ERROR) {
|
||||
SummaryState st(TimeService::now());
|
||||
UDQFunctionTable udqft(udqp);
|
||||
UDQState udq_state(udqp.undefinedValue());
|
||||
UDQContext context(udqft, WellMatcher(NameOrder({"P1"})), st, udq_state);
|
||||
WellMatcher wm(NameOrder({"P1"}));
|
||||
UDQContext context(udqft, wm, st, udq_state);
|
||||
st.update_well_var("P1", "WBHP", 1);
|
||||
|
||||
auto res = def1.eval(context);
|
||||
@ -1349,7 +1364,8 @@ BOOST_AUTO_TEST_CASE(UDQ_TYPE_ERROR) {
|
||||
SummaryState st(TimeService::now());
|
||||
UDQFunctionTable udqft(udqp);
|
||||
UDQState udq_state(udqp.undefinedValue());
|
||||
UDQContext context(udqft, WellMatcher(NameOrder({"P1", "P2"})), st, udq_state);
|
||||
WellMatcher wm(NameOrder({"P1", "P2"}));
|
||||
UDQContext context(udqft, wm, st, udq_state);
|
||||
st.update_well_var("P1", "WBHP", 1);
|
||||
st.update_well_var("P2", "WBHP", 2);
|
||||
|
||||
@ -1882,7 +1898,8 @@ UDQ
|
||||
SummaryState st(TimeService::now());
|
||||
UDQFunctionTable udqft(udqp);
|
||||
UDQState udq_state(udqp.undefinedValue());
|
||||
UDQContext context(udqft, WellMatcher(NameOrder({"W1", "W2", "W3"})), st, udq_state);
|
||||
WellMatcher wm(NameOrder({"W1", "W2", "W3"}));
|
||||
UDQContext context(udqft, wm, st, udq_state);
|
||||
st.update_well_var("W1", "WOPR", 1);
|
||||
st.update_well_var("W2", "WOPR", 2);
|
||||
st.update_well_var("W3", "WOPR", 3);
|
||||
@ -2080,7 +2097,8 @@ DEFINE WUGASRA 750000 - WGLIR '*' /
|
||||
st.update_well_var("W3", "WGLIR", 3);
|
||||
|
||||
NameOrder wo({"W1", "W2", "W3"});
|
||||
udq.eval(0, WellMatcher(wo), st, udq_state);
|
||||
WellMatcher wm(wo);
|
||||
udq.eval(0, wm, st, udq_state);
|
||||
{
|
||||
std::unordered_set<std::string> required_keys;
|
||||
udq.required_summary(required_keys);
|
||||
@ -2640,7 +2658,8 @@ UDQ
|
||||
UDQState udq_state(0);
|
||||
SummaryState st(TimeService::now());
|
||||
UDQFunctionTable udqft;
|
||||
UDQContext context(udqft, WellMatcher(NameOrder({"W1", "W2", "W3"})), st, udq_state);
|
||||
WellMatcher wm(NameOrder({"W1", "W2", "W3"}));
|
||||
UDQContext context(udqft, wm, st, udq_state);
|
||||
st.update_well_var("W1", "WBHP", 400);
|
||||
st.update_well_var("W2", "WBHP", 300);
|
||||
st.update_well_var("W3", "WBHP", 200);
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <opm/input/eclipse/Schedule/UDQ/UDQState.hpp>
|
||||
#include <opm/input/eclipse/Schedule/UDQ/UDQSet.hpp>
|
||||
#include <opm/input/eclipse/Schedule/UDQ/UDQEnums.hpp>
|
||||
#include <opm/input/eclipse/Schedule/Well/WellMatcher.hpp>
|
||||
#include <opm/input/eclipse/Schedule/Well/WellTestState.hpp>
|
||||
|
||||
#include <opm/input/eclipse/Units/UnitSystem.hpp>
|
||||
@ -865,8 +866,9 @@ BOOST_AUTO_TEST_CASE (Declared_UDQ_data)
|
||||
const std::vector<std::string>& wells = {"PROD1", "PROD2", "WINJ1", "WINJ2"};
|
||||
Opm::UDQState rst_udq_state(udq_params.undefinedValue());
|
||||
Opm::UDQFunctionTable udqft(udq_params);
|
||||
Opm::UDQContext input_context(udqft, Opm::WellMatcher(wells), st, udq_state);
|
||||
Opm::UDQContext rst_context(udqft, Opm::WellMatcher(wells), st, rst_udq_state);
|
||||
auto wm = Opm::WellMatcher(wells);
|
||||
Opm::UDQContext input_context(udqft, wm, st, udq_state);
|
||||
Opm::UDQContext rst_context(udqft, wm, st, rst_udq_state);
|
||||
|
||||
rst_udq_state.load_rst(rst_state);
|
||||
for (const auto& input_def : input_config.definitions()) {
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include <opm/input/eclipse/Schedule/UDQ/UDQConfig.hpp>
|
||||
#include <opm/input/eclipse/Schedule/UDQ/UDQEnums.hpp>
|
||||
#include <opm/input/eclipse/Schedule/UDQ/UDQState.hpp>
|
||||
#include <opm/input/eclipse/Schedule/Well/WellMatcher.hpp>
|
||||
#include <opm/input/eclipse/Schedule/Well/WellTestState.hpp>
|
||||
|
||||
#include <opm/io/eclipse/OutputStream.hpp>
|
||||
|
Loading…
Reference in New Issue
Block a user