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 <memory>
#include <vector>
#include <optional>
#include <opm/input/eclipse/EclipseState/Aquifer/AquiferConfig.hpp>
#include <opm/input/eclipse/EclipseState/EclipseConfig.hpp>
@ -50,6 +51,7 @@ namespace Opm {
namespace Opm { namespace RestartIO {
class RstAquifer;
class RstNetwork;
}} // namespace Opm::RestartIO
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
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>
void serializeOp(Serializer& serializer)
{
@ -183,6 +188,8 @@ namespace Opm {
std::string m_title{};
FaultCollection m_faults{};
std::optional<std::map<std::string, double> > m_restart_network_pressures{std::nullopt};
};
} // namespace Opm

View File

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

View File

@ -29,6 +29,7 @@
#include <opm/common/utility/OpmInputError.hpp>
#include <opm/io/eclipse/rst/aquifer.hpp>
#include <opm/io/eclipse/rst/network.hpp>
#include <opm/io/eclipse/ERst.hpp>
#include <opm/input/eclipse/Deck/DeckSection.hpp>
@ -315,6 +316,16 @@ namespace Opm {
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)
{
if (! deck.hasKeyword<ParserKeywords::TITLE>()) {

View File

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