Merge pull request #3738 from vkip/network_restart_use_node_pressures
Facilitate using network node pressures from restart
This commit is contained in:
commit
3ff7fffb04
@ -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
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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>()) {
|
||||
|
@ -223,7 +223,7 @@ Group::Group(const RestartIO::RstGroup& rst_group, std::size_t insert_index_arg,
|
||||
const auto gas_inj_limits = GasInjectionLimits { rst_group };
|
||||
const auto water_inj_limits = WaterInjectionLimits{ rst_group };
|
||||
|
||||
if ((rst_group.prod_cmode != 0) || has_active(prod_limits)) {
|
||||
if ((rst_group.prod_cmode != 0) || rst_group.exceed_action >0 || has_active(prod_limits)) {
|
||||
this->updateProduction(make_production_properties(rst_group, prod_limits, unit_system_arg));
|
||||
}
|
||||
|
||||
|
@ -60,11 +60,9 @@ namespace {
|
||||
doubhead[VI::doubhead::Netbalnpre]);
|
||||
}
|
||||
|
||||
double thpToleranceValue(const std::vector<double>& doubhead,
|
||||
const Opm::UnitSystem& usys)
|
||||
double thpToleranceValue(const std::vector<double>& doubhead)
|
||||
{
|
||||
return usys.to_si(Opm::UnitSystem::measure::pressure,
|
||||
doubhead[VI::doubhead::Netbalthpc]);
|
||||
return doubhead[VI::doubhead::Netbalthpc];
|
||||
}
|
||||
|
||||
bool is_finite_float(const double x)
|
||||
@ -112,7 +110,7 @@ Opm::RestartIO::RstNetbalan::RstNetbalan(const std::vector<int>& intehead,
|
||||
: calc_interval_ (calcInterval(doubhead, usys))
|
||||
, ptol_ (pressureToleranceValue(doubhead, usys))
|
||||
, pressure_max_iter_ (maxBalanceIter(intehead))
|
||||
, thp_tolerance_ (thpToleranceValue(doubhead, usys))
|
||||
, thp_tolerance_ (thpToleranceValue(doubhead))
|
||||
, thp_max_iter_ (maxTHPIter(intehead))
|
||||
, target_branch_balance_error_(targetBranchBalanceError(doubhead, usys))
|
||||
, max_branch_balance_error_ (maxBranchBalanceError(doubhead, usys))
|
||||
|
@ -193,6 +193,8 @@ namespace {
|
||||
usys.to_si(Opm::UnitSystem::measure::pressure,
|
||||
rnode[VI::RNode::index::PressureLimit]);
|
||||
}
|
||||
node.pressure = usys.to_si(Opm::UnitSystem::measure::pressure,
|
||||
rnode[VI::RNode::index::NodePres]);
|
||||
|
||||
return node;
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ BOOST_AUTO_TEST_CASE(No_Active_Network)
|
||||
BOOST_CHECK_CLOSE(netbalan.interval(), 0.0, 1.0e-7);
|
||||
BOOST_CHECK_CLOSE(netbalan.pressureTolerance(), 0.0*Opm::unit::barsa, 1.0e-7);
|
||||
BOOST_CHECK_EQUAL(netbalan.pressureMaxIter(), std::size_t{0});
|
||||
BOOST_CHECK_CLOSE(netbalan.thpTolerance(), 0.01*Opm::unit::barsa, 1.0e-7);
|
||||
BOOST_CHECK_CLOSE(netbalan.thpTolerance(), 0.01, 1.0e-7);
|
||||
BOOST_CHECK_EQUAL(netbalan.thpMaxIter(), std::size_t{10});
|
||||
|
||||
BOOST_CHECK_MESSAGE(! netbalan.targetBalanceError().has_value(),
|
||||
@ -155,7 +155,7 @@ BOOST_AUTO_TEST_CASE(Norne)
|
||||
BOOST_CHECK_CLOSE(netbalan.interval(), 0.0, 1.0e-7);
|
||||
BOOST_CHECK_CLOSE(netbalan.pressureTolerance(), 0.2*Opm::unit::barsa, 1.0e-7);
|
||||
BOOST_CHECK_EQUAL(netbalan.pressureMaxIter(), std::size_t{0});
|
||||
BOOST_CHECK_CLOSE(netbalan.thpTolerance(), 0.01*Opm::unit::barsa, 1.0e-7);
|
||||
BOOST_CHECK_CLOSE(netbalan.thpTolerance(), 0.01, 1.0e-7);
|
||||
BOOST_CHECK_EQUAL(netbalan.thpMaxIter(), std::size_t{10});
|
||||
|
||||
BOOST_CHECK_MESSAGE(! netbalan.targetBalanceError().has_value(),
|
||||
@ -178,7 +178,7 @@ BOOST_AUTO_TEST_CASE(Iota)
|
||||
BOOST_CHECK_CLOSE(netbalan.interval(), 1.0*Opm::unit::day, 1.0e-7);
|
||||
BOOST_CHECK_CLOSE(netbalan.pressureTolerance(), 2.0*Opm::unit::barsa, 1.0e-7);
|
||||
BOOST_CHECK_EQUAL(netbalan.pressureMaxIter(), std::size_t{3});
|
||||
BOOST_CHECK_CLOSE(netbalan.thpTolerance(), 4.0*Opm::unit::barsa, 1.0e-7);
|
||||
BOOST_CHECK_CLOSE(netbalan.thpTolerance(), 4.0, 1.0e-7);
|
||||
BOOST_CHECK_EQUAL(netbalan.thpMaxIter(), std::size_t{5});
|
||||
|
||||
BOOST_CHECK_MESSAGE(netbalan.targetBalanceError().has_value(),
|
||||
@ -226,7 +226,7 @@ BOOST_AUTO_TEST_CASE(No_Active_Network)
|
||||
BOOST_CHECK_CLOSE(netbalan.interval(), 0.0, 1.0e-7);
|
||||
BOOST_CHECK_CLOSE(netbalan.pressure_tolerance(), 0.0, 1.0e-7);
|
||||
BOOST_CHECK_EQUAL(netbalan.pressure_max_iter(), std::size_t{0});
|
||||
BOOST_CHECK_CLOSE(netbalan.thp_tolerance(), 0.01*Opm::unit::barsa, 1.0e-7);
|
||||
BOOST_CHECK_CLOSE(netbalan.thp_tolerance(), 0.01, 1.0e-7);
|
||||
BOOST_CHECK_EQUAL(netbalan.thp_max_iter(), std::size_t{10});
|
||||
|
||||
BOOST_CHECK_MESSAGE(! netbalan.target_balance_error().has_value(),
|
||||
@ -255,7 +255,7 @@ BOOST_AUTO_TEST_CASE(Norne)
|
||||
BOOST_CHECK_CLOSE(netbalan.interval(), 0.0, 1.0e-7);
|
||||
BOOST_CHECK_CLOSE(netbalan.pressure_tolerance(), 0.2*Opm::unit::barsa, 1.0e-7);
|
||||
BOOST_CHECK_EQUAL(netbalan.pressure_max_iter(), std::size_t{0});
|
||||
BOOST_CHECK_CLOSE(netbalan.thp_tolerance(), 0.01*Opm::unit::barsa, 1.0e-7);
|
||||
BOOST_CHECK_CLOSE(netbalan.thp_tolerance(), 0.01, 1.0e-7);
|
||||
BOOST_CHECK_EQUAL(netbalan.thp_max_iter(), std::size_t{10});
|
||||
|
||||
BOOST_CHECK_MESSAGE(! netbalan.target_balance_error().has_value(),
|
||||
@ -284,7 +284,7 @@ BOOST_AUTO_TEST_CASE(Iota)
|
||||
BOOST_CHECK_CLOSE(netbalan.interval(), 1.0*Opm::unit::day, 1.0e-7);
|
||||
BOOST_CHECK_CLOSE(netbalan.pressure_tolerance(), 2.0*Opm::unit::barsa, 1.0e-7);
|
||||
BOOST_CHECK_EQUAL(netbalan.pressure_max_iter(), std::size_t{3});
|
||||
BOOST_CHECK_CLOSE(netbalan.thp_tolerance(), 4.0*Opm::unit::barsa, 1.0e-7);
|
||||
BOOST_CHECK_CLOSE(netbalan.thp_tolerance(), 4.0, 1.0e-7);
|
||||
BOOST_CHECK_EQUAL(netbalan.thp_max_iter(), std::size_t{5});
|
||||
|
||||
BOOST_CHECK_MESSAGE(netbalan.target_balance_error().has_value(),
|
||||
|
Loading…
Reference in New Issue
Block a user