Facilitate using network node pressures from restart

This commit is contained in:
Vegard Kippe 2023-10-30 23:15:56 +01:00
parent 5309471632
commit 9956ef1dfc
4 changed files with 22 additions and 0 deletions

View File

@ -23,6 +23,7 @@
#include <cstddef> #include <cstddef>
#include <memory> #include <memory>
#include <vector> #include <vector>
#include <optional>
#include <opm/input/eclipse/EclipseState/Aquifer/AquiferConfig.hpp> #include <opm/input/eclipse/EclipseState/Aquifer/AquiferConfig.hpp>
#include <opm/input/eclipse/EclipseState/EclipseConfig.hpp> #include <opm/input/eclipse/EclipseState/EclipseConfig.hpp>
@ -50,6 +51,7 @@ namespace Opm {
namespace Opm { namespace RestartIO { namespace Opm { namespace RestartIO {
class RstAquifer; class RstAquifer;
class RstNetwork;
}} // namespace Opm::RestartIO }} // namespace Opm::RestartIO
namespace Opm { namespace Opm {
@ -124,6 +126,9 @@ namespace Opm {
// When we know and decide to handle the same for AQUFETP and AQUCT, this part will be refactored // When we know and decide to handle the same for AQUFETP and AQUCT, this part will be refactored
void appendAqufluxSchedule(const std::unordered_set<int>& ids); void appendAqufluxSchedule(const std::unordered_set<int>& ids);
void loadRestartNetworkPressures(const RestartIO::RstNetwork& network);
const std::optional<std::map<std::string, double> >& getRestartNetworkPressures() const { return this->m_restart_network_pressures; }
template<class Serializer> template<class Serializer>
void serializeOp(Serializer& serializer) void serializeOp(Serializer& serializer)
{ {
@ -183,6 +188,8 @@ namespace Opm {
std::string m_title{}; std::string m_title{};
FaultCollection m_faults{}; FaultCollection m_faults{};
std::optional<std::map<std::string, double> > m_restart_network_pressures{std::nullopt};
}; };
} // namespace Opm } // namespace Opm

View File

@ -68,6 +68,9 @@ namespace Opm { namespace RestartIO {
/// Whether or not to include lift gas of subordinate wells as /// Whether or not to include lift gas of subordinate wells as
/// part of the produced gas entering the network at this node. /// part of the produced gas entering the network at this node.
bool add_lift_gas{false}; bool add_lift_gas{false};
/// Node pressure
double pressure{};
}; };
explicit RstNetwork(std::shared_ptr<EclIO::RestartFileView> rstView, explicit RstNetwork(std::shared_ptr<EclIO::RestartFileView> rstView,

View File

@ -29,6 +29,7 @@
#include <opm/common/utility/OpmInputError.hpp> #include <opm/common/utility/OpmInputError.hpp>
#include <opm/io/eclipse/rst/aquifer.hpp> #include <opm/io/eclipse/rst/aquifer.hpp>
#include <opm/io/eclipse/rst/network.hpp>
#include <opm/io/eclipse/ERst.hpp> #include <opm/io/eclipse/ERst.hpp>
#include <opm/input/eclipse/Deck/DeckSection.hpp> #include <opm/input/eclipse/Deck/DeckSection.hpp>
@ -315,6 +316,16 @@ namespace Opm {
this->aquifer_config.appendAqufluxSchedule(ids); this->aquifer_config.appendAqufluxSchedule(ids);
} }
void EclipseState::loadRestartNetworkPressures(const RestartIO::RstNetwork& network) {
if (!network.isActive()) return;
this->m_restart_network_pressures = std::map<std::string, double>{};
auto& node_pressures = this->m_restart_network_pressures.value();
for (const auto& node : network.nodes()) {
node_pressures[node.name] = node.pressure;
}
}
void EclipseState::assignRunTitle(const Deck& deck) void EclipseState::assignRunTitle(const Deck& deck)
{ {
if (! deck.hasKeyword<ParserKeywords::TITLE>()) { if (! deck.hasKeyword<ParserKeywords::TITLE>()) {

View File

@ -193,6 +193,7 @@ namespace {
usys.to_si(Opm::UnitSystem::measure::pressure, usys.to_si(Opm::UnitSystem::measure::pressure,
rnode[VI::RNode::index::PressureLimit]); rnode[VI::RNode::index::PressureLimit]);
} }
node.pressure = rnode[VI::RNode::index::NodePres];
return node; return node;
} }