From 94cb4ba90888b80622d22ef0098b49380f53f6ca Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Wed, 24 Nov 2021 08:50:33 +0100 Subject: [PATCH] Make sure NETBALAN defaults have correct units --- .../eclipse/EclipseState/Schedule/Network/Balance.hpp | 2 ++ .../eclipse/EclipseState/Schedule/Network/Balance.cpp | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/opm/parser/eclipse/EclipseState/Schedule/Network/Balance.hpp b/opm/parser/eclipse/EclipseState/Schedule/Network/Balance.hpp index 0672e91ba..fb3120855 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Network/Balance.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Network/Balance.hpp @@ -27,6 +27,8 @@ namespace Opm { class DeckKeyword; struct Tuning; +class UnitSystem; + namespace Network { class Balance { diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Network/Balance.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Network/Balance.cpp index 0aca511d3..1ee9419d9 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Network/Balance.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Network/Balance.cpp @@ -22,6 +22,7 @@ #include #include #include +#include namespace Opm { namespace Network { @@ -64,11 +65,15 @@ Balance::Balance(const Tuning& tuning, const DeckKeyword& keyword) { Balance::Balance(bool network_active, const Tuning& tuning) : calc_mode(CalcMode::TimeStepStart) , calc_interval(0) - , m_thp_tolerance( NB::THP_CONVERGENCE_LIMIT::defaultValue ) + , m_thp_tolerance(NB::THP_CONVERGENCE_LIMIT::defaultValue) , m_thp_max_iter( NB::MAX_ITER_THP::defaultValue ) { + NB parser_keyword{}; + UnitSystem default_units(UnitSystem::UnitType::UNIT_TYPE_METRIC); + if (network_active) { - this->ptol = NB::PRESSURE_CONVERGENCE_LIMIT::defaultValue; + const auto& item = parser_keyword.getRecord(0).get(NB::PRESSURE_CONVERGENCE_LIMIT::itemName); + this->ptol = default_units.to_si( item.dimensions()[0], item.getDefault()); this->m_pressure_max_iter = NB::MAX_ITER::defaultValue; this->m_min_tstep = tuning.TSMINZ; } else {