Normalises indentation and whitespace.
This commit is contained in:
parent
c17824cead
commit
6d6b10a9fa
@ -108,31 +108,31 @@ namespace {
|
||||
}
|
||||
|
||||
|
||||
void Schedule::handleBRANPROP(const HandlerContext& handlerContext, const ParseContext&, ErrorGuard&) {
|
||||
auto ext_network = std::make_shared<Network::ExtNetwork>(this->network(handlerContext.currentStep));
|
||||
void Schedule::handleBRANPROP(const HandlerContext& handlerContext, const ParseContext&, ErrorGuard&) {
|
||||
auto ext_network = std::make_shared<Network::ExtNetwork>(this->network(handlerContext.currentStep));
|
||||
|
||||
for (const auto& record : handlerContext.keyword) {
|
||||
const auto& downtree_node = record.getItem<ParserKeywords::BRANPROP::DOWNTREE_NODE>().get<std::string>(0);
|
||||
const auto& uptree_node = record.getItem<ParserKeywords::BRANPROP::UPTREE_NODE>().get<std::string>(0);
|
||||
for (const auto& record : handlerContext.keyword) {
|
||||
const auto& downtree_node = record.getItem<ParserKeywords::BRANPROP::DOWNTREE_NODE>().get<std::string>(0);
|
||||
const auto& uptree_node = record.getItem<ParserKeywords::BRANPROP::UPTREE_NODE>().get<std::string>(0);
|
||||
|
||||
const int vfp_table = record.getItem<ParserKeywords::BRANPROP::VFP_TABLE>().get<int>(0);
|
||||
const int vfp_table = record.getItem<ParserKeywords::BRANPROP::VFP_TABLE>().get<int>(0);
|
||||
|
||||
if (vfp_table == 0) {
|
||||
ext_network->drop_branch(uptree_node, downtree_node);
|
||||
} else {
|
||||
const auto alq_eq = Network::Branch::AlqEqfromString(record.getItem<ParserKeywords::BRANPROP::ALQ_SURFACE_DENSITY>().get<std::string>(0));
|
||||
|
||||
if (alq_eq == Network::Branch::AlqEQ::ALQ_INPUT) {
|
||||
double alq_value = record.getItem<ParserKeywords::BRANPROP::ALQ>().get<double>(0);
|
||||
ext_network->add_branch(Network::Branch(downtree_node, uptree_node, vfp_table, alq_value));
|
||||
if (vfp_table == 0) {
|
||||
ext_network->drop_branch(uptree_node, downtree_node);
|
||||
} else {
|
||||
ext_network->add_branch(Network::Branch(downtree_node, uptree_node, vfp_table, alq_eq));
|
||||
const auto alq_eq = Network::Branch::AlqEqfromString(record.getItem<ParserKeywords::BRANPROP::ALQ_SURFACE_DENSITY>().get<std::string>(0));
|
||||
|
||||
if (alq_eq == Network::Branch::AlqEQ::ALQ_INPUT) {
|
||||
double alq_value = record.getItem<ParserKeywords::BRANPROP::ALQ>().get<double>(0);
|
||||
ext_network->add_branch(Network::Branch(downtree_node, uptree_node, vfp_table, alq_value));
|
||||
} else {
|
||||
ext_network->add_branch(Network::Branch(downtree_node, uptree_node, vfp_table, alq_eq));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this->updateNetwork(ext_network, handlerContext.currentStep);
|
||||
}
|
||||
this->updateNetwork(ext_network, handlerContext.currentStep);
|
||||
}
|
||||
|
||||
void Schedule::handleCOMPDAT(const HandlerContext& handlerContext, const ParseContext& parseContext, ErrorGuard& errors) {
|
||||
for (const auto& record : handlerContext.keyword) {
|
||||
@ -466,37 +466,37 @@ void Schedule::handleBRANPROP(const HandlerContext& handlerContext, const ParseC
|
||||
}
|
||||
}
|
||||
|
||||
void Schedule::handleGLIFTOPT(const HandlerContext& handlerContext, const ParseContext& parseContext, ErrorGuard&errors) {
|
||||
auto glo = std::make_shared<GasLiftOpt>( this->glo(handlerContext.currentStep) );
|
||||
void Schedule::handleGLIFTOPT(const HandlerContext& handlerContext, const ParseContext& parseContext, ErrorGuard&errors) {
|
||||
auto glo = std::make_shared<GasLiftOpt>( this->glo(handlerContext.currentStep) );
|
||||
|
||||
for (const auto& record : handlerContext.keyword) {
|
||||
const std::string& groupNamePattern = record.getItem<ParserKeywords::GLIFTOPT::GROUP_NAME>().getTrimmedString(0);
|
||||
const auto group_names = this->groupNames(groupNamePattern);
|
||||
for (const auto& record : handlerContext.keyword) {
|
||||
const std::string& groupNamePattern = record.getItem<ParserKeywords::GLIFTOPT::GROUP_NAME>().getTrimmedString(0);
|
||||
const auto group_names = this->groupNames(groupNamePattern);
|
||||
|
||||
if (group_names.empty())
|
||||
invalidNamePattern(groupNamePattern, handlerContext.currentStep, parseContext, errors, handlerContext.keyword);
|
||||
if (group_names.empty())
|
||||
invalidNamePattern(groupNamePattern, handlerContext.currentStep, parseContext, errors, handlerContext.keyword);
|
||||
|
||||
const auto& max_gas_item = record.getItem<ParserKeywords::GLIFTOPT::MAX_LIFT_GAS_SUPPLY>();
|
||||
const double max_lift_gas_value = max_gas_item.hasValue(0)
|
||||
? max_gas_item.getSIDouble(0)
|
||||
: -1;
|
||||
const auto& max_gas_item = record.getItem<ParserKeywords::GLIFTOPT::MAX_LIFT_GAS_SUPPLY>();
|
||||
const double max_lift_gas_value = max_gas_item.hasValue(0)
|
||||
? max_gas_item.getSIDouble(0)
|
||||
: -1;
|
||||
|
||||
const auto& max_total_item = record.getItem<ParserKeywords::GLIFTOPT::MAX_TOTAL_GAS_RATE>();
|
||||
const double max_total_gas_value = max_total_item.hasValue(0)
|
||||
? max_total_item.getSIDouble(0)
|
||||
: -1;
|
||||
const auto& max_total_item = record.getItem<ParserKeywords::GLIFTOPT::MAX_TOTAL_GAS_RATE>();
|
||||
const double max_total_gas_value = max_total_item.hasValue(0)
|
||||
? max_total_item.getSIDouble(0)
|
||||
: -1;
|
||||
|
||||
for (const auto& gname : group_names) {
|
||||
auto group = GasLiftOpt::Group(gname);
|
||||
group.max_lift_gas(max_lift_gas_value);
|
||||
group.max_total_gas(max_total_gas_value);
|
||||
for (const auto& gname : group_names) {
|
||||
auto group = GasLiftOpt::Group(gname);
|
||||
group.max_lift_gas(max_lift_gas_value);
|
||||
group.max_total_gas(max_total_gas_value);
|
||||
|
||||
glo->add_group(group);
|
||||
glo->add_group(group);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this->m_glo.update(handlerContext.currentStep, std::move(glo));
|
||||
}
|
||||
this->m_glo.update(handlerContext.currentStep, std::move(glo));
|
||||
}
|
||||
|
||||
void Schedule::handleGPMAINT(const HandlerContext& handlerContext, const ParseContext& parseContext, ErrorGuard& errors) {
|
||||
for( const auto& record : handlerContext.keyword ) {
|
||||
@ -574,23 +574,23 @@ void Schedule::handleGLIFTOPT(const HandlerContext& handlerContext, const ParseC
|
||||
this->guide_rate_config.update( handlerContext.currentStep, new_config );
|
||||
}
|
||||
|
||||
void Schedule::handleLIFTOPT(const HandlerContext& handlerContext, const ParseContext&, ErrorGuard&) {
|
||||
auto glo = std::make_shared<GasLiftOpt>(this->glo(handlerContext.currentStep));
|
||||
void Schedule::handleLIFTOPT(const HandlerContext& handlerContext, const ParseContext&, ErrorGuard&) {
|
||||
auto glo = std::make_shared<GasLiftOpt>(this->glo(handlerContext.currentStep));
|
||||
|
||||
const auto& record = handlerContext.keyword.getRecord(0);
|
||||
const auto& record = handlerContext.keyword.getRecord(0);
|
||||
|
||||
const double gaslift_increment = record.getItem<ParserKeywords::LIFTOPT::INCREMENT_SIZE>().getSIDouble(0);
|
||||
const double min_eco_gradient = record.getItem<ParserKeywords::LIFTOPT::MIN_ECONOMIC_GRADIENT>().getSIDouble(0);
|
||||
const double min_wait = record.getItem<ParserKeywords::LIFTOPT::MIN_INTERVAL_BETWEEN_GAS_LIFT_OPTIMIZATIONS>().getSIDouble(0);
|
||||
const bool all_newton = DeckItem::to_bool( record.getItem<ParserKeywords::LIFTOPT::OPTIMISE_GAS_LIFT>().get<std::string>(0) );
|
||||
const double gaslift_increment = record.getItem<ParserKeywords::LIFTOPT::INCREMENT_SIZE>().getSIDouble(0);
|
||||
const double min_eco_gradient = record.getItem<ParserKeywords::LIFTOPT::MIN_ECONOMIC_GRADIENT>().getSIDouble(0);
|
||||
const double min_wait = record.getItem<ParserKeywords::LIFTOPT::MIN_INTERVAL_BETWEEN_GAS_LIFT_OPTIMIZATIONS>().getSIDouble(0);
|
||||
const bool all_newton = DeckItem::to_bool( record.getItem<ParserKeywords::LIFTOPT::OPTIMISE_GAS_LIFT>().get<std::string>(0) );
|
||||
|
||||
glo->gaslift_increment(gaslift_increment);
|
||||
glo->min_eco_gradient(min_eco_gradient);
|
||||
glo->min_wait(min_wait);
|
||||
glo->all_newton(all_newton);
|
||||
glo->gaslift_increment(gaslift_increment);
|
||||
glo->min_eco_gradient(min_eco_gradient);
|
||||
glo->min_wait(min_wait);
|
||||
glo->all_newton(all_newton);
|
||||
|
||||
this->m_glo.update(handlerContext.currentStep, std::move(glo));
|
||||
}
|
||||
this->m_glo.update(handlerContext.currentStep, std::move(glo));
|
||||
}
|
||||
|
||||
void Schedule::handleLINCOM(const HandlerContext& handlerContext, const ParseContext&, ErrorGuard&) {
|
||||
const auto& record = handlerContext.keyword.getRecord(0);
|
||||
@ -620,46 +620,46 @@ void Schedule::handleLIFTOPT(const HandlerContext& handlerContext, const ParseCo
|
||||
parseContext.handleError( ParseContext::UNSUPPORTED_SCHEDULE_GEO_MODIFIER , msg, errors );
|
||||
}
|
||||
|
||||
void Schedule::handleNODEPROP(const HandlerContext& handlerContext, const ParseContext&, ErrorGuard&) {
|
||||
auto ext_network = std::make_shared<Network::ExtNetwork>(this->network(handlerContext.currentStep));
|
||||
void Schedule::handleNODEPROP(const HandlerContext& handlerContext, const ParseContext&, ErrorGuard&) {
|
||||
auto ext_network = std::make_shared<Network::ExtNetwork>(this->network(handlerContext.currentStep));
|
||||
|
||||
for (const auto& record : handlerContext.keyword) {
|
||||
const auto& name = record.getItem<ParserKeywords::NODEPROP::NAME>().get<std::string>(0);
|
||||
const auto& pressure_item = record.getItem<ParserKeywords::NODEPROP::PRESSURE>();
|
||||
for (const auto& record : handlerContext.keyword) {
|
||||
const auto& name = record.getItem<ParserKeywords::NODEPROP::NAME>().get<std::string>(0);
|
||||
const auto& pressure_item = record.getItem<ParserKeywords::NODEPROP::PRESSURE>();
|
||||
|
||||
const bool as_choke = DeckItem::to_bool(record.getItem<ParserKeywords::NODEPROP::AS_CHOKE>().get<std::string>(0));
|
||||
const bool add_gas_lift_gas = DeckItem::to_bool(record.getItem<ParserKeywords::NODEPROP::ADD_GAS_LIFT_GAS>().get<std::string>(0));
|
||||
const bool as_choke = DeckItem::to_bool(record.getItem<ParserKeywords::NODEPROP::AS_CHOKE>().get<std::string>(0));
|
||||
const bool add_gas_lift_gas = DeckItem::to_bool(record.getItem<ParserKeywords::NODEPROP::ADD_GAS_LIFT_GAS>().get<std::string>(0));
|
||||
|
||||
Network::Node node { name };
|
||||
Network::Node node { name };
|
||||
|
||||
if (pressure_item.hasValue(0) && (pressure_item.get<double>(0) > 0))
|
||||
node.terminal_pressure(pressure_item.getSIDouble(0));
|
||||
if (pressure_item.hasValue(0) && (pressure_item.get<double>(0) > 0))
|
||||
node.terminal_pressure(pressure_item.getSIDouble(0));
|
||||
|
||||
if (as_choke) {
|
||||
std::string target_group = name;
|
||||
const auto& target_item = record.getItem<ParserKeywords::NODEPROP::CHOKE_GROUP>();
|
||||
if (as_choke) {
|
||||
std::string target_group = name;
|
||||
const auto& target_item = record.getItem<ParserKeywords::NODEPROP::CHOKE_GROUP>();
|
||||
|
||||
if (target_item.hasValue(0))
|
||||
target_group = target_item.get<std::string>(0);
|
||||
if (target_item.hasValue(0))
|
||||
target_group = target_item.get<std::string>(0);
|
||||
|
||||
if (target_group != name) {
|
||||
if (this->hasGroup(name, handlerContext.currentStep)) {
|
||||
const auto& group = this->getGroup(name, handlerContext.currentStep);
|
||||
if (group.numWells() > 0)
|
||||
throw std::invalid_argument("A manifold group must respond to its own target");
|
||||
if (target_group != name) {
|
||||
if (this->hasGroup(name, handlerContext.currentStep)) {
|
||||
const auto& group = this->getGroup(name, handlerContext.currentStep);
|
||||
if (group.numWells() > 0)
|
||||
throw std::invalid_argument("A manifold group must respond to its own target");
|
||||
}
|
||||
}
|
||||
|
||||
node.as_choke(target_group);
|
||||
}
|
||||
|
||||
node.as_choke(target_group);
|
||||
node.add_gas_lift_gas(add_gas_lift_gas);
|
||||
ext_network->add_node(node);
|
||||
}
|
||||
|
||||
node.add_gas_lift_gas(add_gas_lift_gas);
|
||||
ext_network->add_node(node);
|
||||
this->updateNetwork(ext_network, handlerContext.currentStep);
|
||||
}
|
||||
|
||||
this->updateNetwork(ext_network, handlerContext.currentStep);
|
||||
}
|
||||
|
||||
void Schedule::handleNUPCOL(const HandlerContext& handlerContext, const ParseContext&, ErrorGuard&) {
|
||||
int nupcol = handlerContext.keyword.getRecord(0).getItem("NUM_ITER").get<int>(0);
|
||||
if (handlerContext.keyword.getRecord(0).getItem("NUM_ITER").defaultApplied(0)) {
|
||||
@ -1346,39 +1346,39 @@ void Schedule::handleNODEPROP(const HandlerContext& handlerContext, const ParseC
|
||||
}
|
||||
}
|
||||
|
||||
void Schedule::handleWLIFTOPT(const HandlerContext& handlerContext, const ParseContext& parseContext, ErrorGuard& errors) {
|
||||
auto glo = std::make_shared<GasLiftOpt>(this->glo(handlerContext.currentStep));
|
||||
void Schedule::handleWLIFTOPT(const HandlerContext& handlerContext, const ParseContext& parseContext, ErrorGuard& errors) {
|
||||
auto glo = std::make_shared<GasLiftOpt>(this->glo(handlerContext.currentStep));
|
||||
|
||||
for (const auto& record : handlerContext.keyword) {
|
||||
const std::string& wellNamePattern = record.getItem<ParserKeywords::WLIFTOPT::WELL>().getTrimmedString(0);
|
||||
const bool use_glo = DeckItem::to_bool( record.getItem<ParserKeywords::WLIFTOPT::USE_OPTIMIZER>().get<std::string>(0));
|
||||
const bool alloc_extra_gas = DeckItem::to_bool( record.getItem<ParserKeywords::WLIFTOPT::ALLOCATE_EXTRA_LIFT_GAS>().get<std::string>(0));
|
||||
const double weight_factor = record.getItem<ParserKeywords::WLIFTOPT::WEIGHT_FACTOR>().get<double>(0);
|
||||
const double inc_weight_factor = record.getItem<ParserKeywords::WLIFTOPT::DELTA_GAS_RATE_WEIGHT_FACTOR>().get<double>(0);
|
||||
const double min_rate = record.getItem<ParserKeywords::WLIFTOPT::MIN_LIFT_GAS_RATE>().getSIDouble(0);
|
||||
const auto& max_rate_item = record.getItem<ParserKeywords::WLIFTOPT::MAX_LIFT_GAS_RATE>();
|
||||
for (const auto& record : handlerContext.keyword) {
|
||||
const std::string& wellNamePattern = record.getItem<ParserKeywords::WLIFTOPT::WELL>().getTrimmedString(0);
|
||||
const bool use_glo = DeckItem::to_bool( record.getItem<ParserKeywords::WLIFTOPT::USE_OPTIMIZER>().get<std::string>(0));
|
||||
const bool alloc_extra_gas = DeckItem::to_bool( record.getItem<ParserKeywords::WLIFTOPT::ALLOCATE_EXTRA_LIFT_GAS>().get<std::string>(0));
|
||||
const double weight_factor = record.getItem<ParserKeywords::WLIFTOPT::WEIGHT_FACTOR>().get<double>(0);
|
||||
const double inc_weight_factor = record.getItem<ParserKeywords::WLIFTOPT::DELTA_GAS_RATE_WEIGHT_FACTOR>().get<double>(0);
|
||||
const double min_rate = record.getItem<ParserKeywords::WLIFTOPT::MIN_LIFT_GAS_RATE>().getSIDouble(0);
|
||||
const auto& max_rate_item = record.getItem<ParserKeywords::WLIFTOPT::MAX_LIFT_GAS_RATE>();
|
||||
|
||||
const auto well_names = this->wellNames(wellNamePattern);
|
||||
if (well_names.empty())
|
||||
invalidNamePattern(wellNamePattern, handlerContext.currentStep, parseContext, errors, handlerContext.keyword);
|
||||
const auto well_names = this->wellNames(wellNamePattern);
|
||||
if (well_names.empty())
|
||||
invalidNamePattern(wellNamePattern, handlerContext.currentStep, parseContext, errors, handlerContext.keyword);
|
||||
|
||||
for (const auto& wname : well_names) {
|
||||
auto well = GasLiftOpt::Well(wname, use_glo);
|
||||
for (const auto& wname : well_names) {
|
||||
auto well = GasLiftOpt::Well(wname, use_glo);
|
||||
|
||||
if (max_rate_item.hasValue(0))
|
||||
well.max_rate( max_rate_item.getSIDouble(0) );
|
||||
if (max_rate_item.hasValue(0))
|
||||
well.max_rate( max_rate_item.getSIDouble(0) );
|
||||
|
||||
well.weight_factor(weight_factor);
|
||||
well.inc_weight_factor(inc_weight_factor);
|
||||
well.min_rate(min_rate);
|
||||
well.alloc_extra_gas(alloc_extra_gas);
|
||||
well.weight_factor(weight_factor);
|
||||
well.inc_weight_factor(inc_weight_factor);
|
||||
well.min_rate(min_rate);
|
||||
well.alloc_extra_gas(alloc_extra_gas);
|
||||
|
||||
glo->add_well(well);
|
||||
glo->add_well(well);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this->m_glo.update(handlerContext.currentStep, std::move(glo));
|
||||
}
|
||||
this->m_glo.update(handlerContext.currentStep, std::move(glo));
|
||||
}
|
||||
|
||||
void Schedule::handleWLIST(const HandlerContext& handlerContext, const ParseContext&, ErrorGuard&) {
|
||||
const std::string legal_actions = "NEW:ADD:DEL:MOV";
|
||||
|
@ -168,7 +168,7 @@ namespace {
|
||||
{}
|
||||
|
||||
|
||||
Schedule::Schedule(const Deck& deck, const EclipseState& es, const ParseContext& parse_context, ErrorGuard& errors, std::shared_ptr<const Python> python, const RestartIO::RstState * rst) :
|
||||
Schedule::Schedule(const Deck& deck, const EclipseState& es, const ParseContext& parse_context, ErrorGuard& errors, std::shared_ptr<const Python> python, const RestartIO::RstState * rst) :
|
||||
Schedule(deck,
|
||||
es.getInputGrid(),
|
||||
es.fieldProps(),
|
||||
@ -180,7 +180,6 @@ Schedule::Schedule(const Deck& deck, const EclipseState& es, const ParseContext&
|
||||
{}
|
||||
|
||||
|
||||
|
||||
template <typename T>
|
||||
Schedule::Schedule(const Deck& deck, const EclipseState& es, const ParseContext& parse_context, T&& errors, std::shared_ptr<const Python> python, const RestartIO::RstState * rst) :
|
||||
Schedule(deck,
|
||||
@ -618,7 +617,6 @@ Schedule::Schedule(const Deck& deck, const EclipseState& es, const ParseContext&
|
||||
return this->groupTree(root_node, report_step, 0, {});
|
||||
}
|
||||
|
||||
|
||||
GTNode Schedule::groupTree(std::size_t report_step) const {
|
||||
return this->groupTree("FIELD", report_step);
|
||||
}
|
||||
@ -683,7 +681,6 @@ Schedule::Schedule(const Deck& deck, const EclipseState& es, const ParseContext&
|
||||
unit_system);
|
||||
}
|
||||
|
||||
|
||||
void Schedule::addWell(Well well, size_t report_step) {
|
||||
const std::string wname = well.name();
|
||||
|
||||
@ -697,7 +694,6 @@ Schedule::Schedule(const Deck& deck, const EclipseState& es, const ParseContext&
|
||||
dynamic_well_state.update(report_step, std::make_shared<Well>(std::move(well)));
|
||||
}
|
||||
|
||||
|
||||
void Schedule::addWell(const std::string& wellName,
|
||||
const std::string& group,
|
||||
int headI,
|
||||
@ -770,7 +766,6 @@ Schedule::Schedule(const Deck& deck, const EclipseState& es, const ParseContext&
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::vector< Well > Schedule::getChildWells2(const std::string& group_name, size_t timeStep) const {
|
||||
if (!hasGroup(group_name))
|
||||
throw std::invalid_argument("No such group: '" + group_name + "'");
|
||||
@ -840,7 +835,6 @@ Schedule::Schedule(const Deck& deck, const EclipseState& es, const ParseContext&
|
||||
return this->getWells(this->m_timeMap.size() - 1);
|
||||
}
|
||||
|
||||
|
||||
const Well& Schedule::getWellatEnd(const std::string& well_name) const {
|
||||
return this->getWell(well_name, this->m_timeMap.size() - 1);
|
||||
}
|
||||
@ -1121,8 +1115,7 @@ Schedule::Schedule(const Deck& deck, const EclipseState& es, const ParseContext&
|
||||
group_ptr->addWell(well_name);
|
||||
this->updateGroup(group_ptr, timeStep);
|
||||
this->m_events.addEvent( ScheduleEvents::GROUP_CHANGE , timeStep);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
const Tuning& Schedule::getTuning(size_t timeStep) const {
|
||||
@ -1354,7 +1347,6 @@ Schedule::Schedule(const Deck& deck, const EclipseState& es, const ParseContext&
|
||||
return this->restart_config;
|
||||
}
|
||||
|
||||
|
||||
const RestartConfig& Schedule::restart() const {
|
||||
return this->restart_config;
|
||||
}
|
||||
@ -1363,7 +1355,7 @@ Schedule::Schedule(const Deck& deck, const EclipseState& es, const ParseContext&
|
||||
return this->m_nupcol.get(reportStep);
|
||||
}
|
||||
|
||||
bool Schedule::operator==(const Schedule& data) const {
|
||||
bool Schedule::operator==(const Schedule& data) const {
|
||||
auto&& comparePtr = [](const auto& t1, const auto& t2) {
|
||||
if ((t1 && !t2) || (!t1 && t2))
|
||||
return false;
|
||||
@ -1425,82 +1417,80 @@ Schedule::Schedule(const Deck& deck, const EclipseState& es, const ParseContext&
|
||||
}
|
||||
|
||||
namespace {
|
||||
// Duplicated from Well.cpp
|
||||
Connection::Order order_from_int(int int_value) {
|
||||
switch(int_value) {
|
||||
case 0:
|
||||
return Connection::Order::TRACK;
|
||||
case 1:
|
||||
return Connection::Order::DEPTH;
|
||||
case 2:
|
||||
return Connection::Order::INPUT;
|
||||
default:
|
||||
throw std::invalid_argument("Invalid integer value: " + std::to_string(int_value) + " encountered when determining connection ordering");
|
||||
|
||||
// Duplicated from Well.cpp
|
||||
Connection::Order order_from_int(int int_value) {
|
||||
switch(int_value) {
|
||||
case 0:
|
||||
return Connection::Order::TRACK;
|
||||
case 1:
|
||||
return Connection::Order::DEPTH;
|
||||
case 2:
|
||||
return Connection::Order::INPUT;
|
||||
default:
|
||||
throw std::invalid_argument("Invalid integer value: " + std::to_string(int_value) + " encountered when determining connection ordering");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Schedule::load_rst(const RestartIO::RstState& rst_state, const EclipseGrid& grid, const FieldPropsManager& fp, const UnitSystem& unit_system)
|
||||
{
|
||||
double udq_undefined = 0;
|
||||
const auto report_step = rst_state.header.report_step - 1;
|
||||
void Schedule::load_rst(const RestartIO::RstState& rst_state, const EclipseGrid& grid, const FieldPropsManager& fp, const UnitSystem& unit_system)
|
||||
{
|
||||
double udq_undefined = 0;
|
||||
const auto report_step = rst_state.header.report_step - 1;
|
||||
|
||||
for (const auto& rst_group : rst_state.groups)
|
||||
this->addGroup(rst_group.name, report_step, unit_system);
|
||||
for (const auto& rst_group : rst_state.groups)
|
||||
this->addGroup(rst_group.name, report_step, unit_system);
|
||||
|
||||
for (const auto& rst_well : rst_state.wells) {
|
||||
Opm::Well well(rst_well, report_step, unit_system, udq_undefined);
|
||||
std::vector<Opm::Connection> rst_connections;
|
||||
for (const auto& rst_well : rst_state.wells) {
|
||||
Opm::Well well(rst_well, report_step, unit_system, udq_undefined);
|
||||
std::vector<Opm::Connection> rst_connections;
|
||||
|
||||
for (const auto& rst_conn : rst_well.connections)
|
||||
rst_connections.emplace_back(rst_conn, grid, fp);
|
||||
for (const auto& rst_conn : rst_well.connections)
|
||||
rst_connections.emplace_back(rst_conn, grid, fp);
|
||||
|
||||
if (rst_well.segments.empty()) {
|
||||
Opm::WellConnections connections(order_from_int(rst_well.completion_ordering),
|
||||
rst_well.ij[0],
|
||||
rst_well.ij[1],
|
||||
rst_connections);
|
||||
well.updateConnections( std::make_shared<WellConnections>( std::move(connections) ), grid, fp.get_int("PVTNUM"));
|
||||
} else {
|
||||
std::unordered_map<int, Opm::Segment> rst_segments;
|
||||
for (const auto& rst_segment : rst_well.segments) {
|
||||
Opm::Segment segment(rst_segment);
|
||||
rst_segments.insert(std::make_pair(rst_segment.segment, std::move(segment)));
|
||||
if (rst_well.segments.empty()) {
|
||||
Opm::WellConnections connections(order_from_int(rst_well.completion_ordering),
|
||||
rst_well.ij[0],
|
||||
rst_well.ij[1],
|
||||
rst_connections);
|
||||
well.updateConnections( std::make_shared<WellConnections>( std::move(connections) ), grid, fp.get_int("PVTNUM"));
|
||||
} else {
|
||||
std::unordered_map<int, Opm::Segment> rst_segments;
|
||||
for (const auto& rst_segment : rst_well.segments) {
|
||||
Opm::Segment segment(rst_segment);
|
||||
rst_segments.insert(std::make_pair(rst_segment.segment, std::move(segment)));
|
||||
}
|
||||
|
||||
auto [connections, segments] = Compsegs::rstUpdate(rst_well, rst_connections, rst_segments);
|
||||
well.updateConnections( std::make_shared<WellConnections>(std::move(connections)), grid, fp.get_int("PVTNUM"));
|
||||
well.updateSegments( std::make_shared<WellSegments>(std::move(segments) ));
|
||||
}
|
||||
|
||||
auto [connections, segments] = Compsegs::rstUpdate(rst_well, rst_connections, rst_segments);
|
||||
well.updateConnections( std::make_shared<WellConnections>(std::move(connections)), grid, fp.get_int("PVTNUM"));
|
||||
well.updateSegments( std::make_shared<WellSegments>(std::move(segments) ));
|
||||
this->addWell(well, report_step);
|
||||
this->addWellToGroup(well.groupName(), well.name(), report_step);
|
||||
}
|
||||
|
||||
this->addWell(well, report_step);
|
||||
this->addWellToGroup(well.groupName(), well.name(), report_step);
|
||||
m_tuning.update(report_step, rst_state.tuning);
|
||||
m_events.addEvent( ScheduleEvents::TUNING_CHANGE , report_step);
|
||||
}
|
||||
|
||||
m_tuning.update(report_step, rst_state.tuning);
|
||||
m_events.addEvent( ScheduleEvents::TUNING_CHANGE , report_step);
|
||||
}
|
||||
|
||||
std::shared_ptr<const Python> Schedule::python() const
|
||||
{
|
||||
return this->python_handle;
|
||||
}
|
||||
std::shared_ptr<const Python> Schedule::python() const
|
||||
{
|
||||
return this->python_handle;
|
||||
}
|
||||
|
||||
|
||||
void Schedule::updateNetwork(std::shared_ptr<Network::ExtNetwork> network, std::size_t report_step) {
|
||||
this->m_network.update(report_step, std::move(network));
|
||||
}
|
||||
|
||||
const Network::ExtNetwork& Schedule::network(std::size_t report_step) const {
|
||||
return *this->m_network[report_step];
|
||||
}
|
||||
|
||||
|
||||
const GasLiftOpt& Schedule::glo(std::size_t report_step) const {
|
||||
return *this->m_glo[report_step];
|
||||
}
|
||||
void Schedule::updateNetwork(std::shared_ptr<Network::ExtNetwork> network, std::size_t report_step) {
|
||||
this->m_network.update(report_step, std::move(network));
|
||||
}
|
||||
|
||||
const Network::ExtNetwork& Schedule::network(std::size_t report_step) const {
|
||||
return *this->m_network[report_step];
|
||||
}
|
||||
|
||||
const GasLiftOpt& Schedule::glo(std::size_t report_step) const {
|
||||
return *this->m_glo[report_step];
|
||||
}
|
||||
|
||||
namespace {
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user