Merge pull request #2870 from joakim-hove/default-units-bug
Make sure units are correct for default initialized NETBALAN
This commit is contained in:
commit
e250f83c1d
@ -27,6 +27,8 @@
|
|||||||
namespace Opm {
|
namespace Opm {
|
||||||
class DeckKeyword;
|
class DeckKeyword;
|
||||||
struct Tuning;
|
struct Tuning;
|
||||||
|
class UnitSystem;
|
||||||
|
|
||||||
namespace Network {
|
namespace Network {
|
||||||
|
|
||||||
class Balance {
|
class Balance {
|
||||||
|
@ -110,6 +110,8 @@ namespace Opm {
|
|||||||
|
|
||||||
Dimension parse(const std::string& dimension) const;
|
Dimension parse(const std::string& dimension) const;
|
||||||
|
|
||||||
|
double from_si( const std::string& dimension, double );
|
||||||
|
double to_si( const std::string& dimension, double );
|
||||||
double from_si( measure, double ) const;
|
double from_si( measure, double ) const;
|
||||||
double to_si( measure, double ) const;
|
double to_si( measure, double ) const;
|
||||||
void from_si( measure, std::vector<double>& ) const;
|
void from_si( measure, std::vector<double>& ) const;
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include <opm/parser/eclipse/EclipseState/Schedule/Network/Balance.hpp>
|
#include <opm/parser/eclipse/EclipseState/Schedule/Network/Balance.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Schedule/Tuning.hpp>
|
#include <opm/parser/eclipse/EclipseState/Schedule/Tuning.hpp>
|
||||||
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
|
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
|
||||||
|
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
|
||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
namespace Network {
|
namespace Network {
|
||||||
@ -64,11 +65,15 @@ Balance::Balance(const Tuning& tuning, const DeckKeyword& keyword) {
|
|||||||
Balance::Balance(bool network_active, const Tuning& tuning)
|
Balance::Balance(bool network_active, const Tuning& tuning)
|
||||||
: calc_mode(CalcMode::TimeStepStart)
|
: calc_mode(CalcMode::TimeStepStart)
|
||||||
, calc_interval(0)
|
, 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 )
|
, m_thp_max_iter( NB::MAX_ITER_THP::defaultValue )
|
||||||
{
|
{
|
||||||
|
NB parser_keyword{};
|
||||||
|
UnitSystem default_units(UnitSystem::UnitType::UNIT_TYPE_METRIC);
|
||||||
|
|
||||||
if (network_active) {
|
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<double>());
|
||||||
this->m_pressure_max_iter = NB::MAX_ITER::defaultValue;
|
this->m_pressure_max_iter = NB::MAX_ITER::defaultValue;
|
||||||
this->m_min_tstep = tuning.TSMINZ;
|
this->m_min_tstep = tuning.TSMINZ;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1437,6 +1437,16 @@ namespace {
|
|||||||
+ this->measure_table_to_si_offset[ static_cast< int >( m ) ];
|
+ this->measure_table_to_si_offset[ static_cast< int >( m ) ];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double UnitSystem::from_si( const std::string& dimension, double value) {
|
||||||
|
const auto& dim = this->parse(dimension);
|
||||||
|
return dim.convertSiToRaw(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
double UnitSystem::to_si( const std::string& dimension, double value) {
|
||||||
|
const auto& dim = this->parse(dimension);
|
||||||
|
return dim.convertRawToSi(value);
|
||||||
|
}
|
||||||
|
|
||||||
void UnitSystem::from_si( measure m, std::vector<double>& data ) const {
|
void UnitSystem::from_si( measure m, std::vector<double>& data ) const {
|
||||||
double factor = this->measure_table_from_si[ static_cast< int >( m ) ];
|
double factor = this->measure_table_from_si[ static_cast< int >( m ) ];
|
||||||
double offset = this->measure_table_to_si_offset[ static_cast< int >( m ) ];
|
double offset = this->measure_table_to_si_offset[ static_cast< int >( m ) ];
|
||||||
|
Loading…
Reference in New Issue
Block a user