Ensure units are applied with the MINVALUE and MAXVALUE keywords

This commit is contained in:
Joakim Hove
2019-01-29 20:58:39 +01:00
parent 2b2d4901d1
commit ed9827bfcf
2 changed files with 19 additions and 2 deletions

View File

@@ -278,7 +278,7 @@ namespace Opm {
if (hasKeyword( field )) {
GridProperty<T>& property = getKeyword( field );
T value = convertInputValue( record.getItem("value").get< double >(0) );
T value = convertInputValue( property, record.getItem("value").get< double >(0) );
setKeywordBox(record, boxManager);
property.maxvalue( value , boxManager.getActiveBox() );
} else
@@ -291,7 +291,7 @@ namespace Opm {
if (hasKeyword( field )) {
GridProperty<T>& property = getKeyword( field );
T value = convertInputValue( record.getItem("value").get< double >(0) );
T value = convertInputValue( property, record.getItem("value").get< double >(0) );
setKeywordBox(record, boxManager);
property.minvalue( value , boxManager.getActiveBox() );
} else

View File

@@ -30,6 +30,7 @@
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
#include <opm/parser/eclipse/Deck/Section.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
@@ -258,6 +259,14 @@ BOOST_AUTO_TEST_CASE(GridPropertyInitialization) {
"\n"
"GRID\n"
"\n"
"PERMX\n"
" 27*1000 /\n"
"MAXVALUE\n"
" PERMX 100 4* 1 1/\n"
"/\n"
"MINVALUE\n"
" PERMX 10000 4* 3 3/\n"
"/\n"
"ACTNUM\n"
" 0 8*1 0 8*1 0 8*1 /\n"
"DXV\n"
@@ -441,6 +450,14 @@ BOOST_AUTO_TEST_CASE(GridPropertyInitialization) {
double_props.assertKeyword("NTG");
BOOST_CHECK( double_props.hasKeyword( "NTG" ));
}
{
const auto& double_props = props.getDoubleProperties( );
const auto& units = deck.getActiveUnitSystem();
const auto& permx = double_props.getKeyword("PERMX");
BOOST_CHECK_EQUAL(permx.iget(0,0,0), units.to_si(Opm::UnitSystem::measure::permeability, 100));
BOOST_CHECK_EQUAL(permx.iget(0,0,1), units.to_si(Opm::UnitSystem::measure::permeability, 1000));
BOOST_CHECK_EQUAL(permx.iget(0,0,2), units.to_si(Opm::UnitSystem::measure::permeability, 10000));
}
}