diff --git a/opm/parser/eclipse/EclipseState/EndpointScaling.cpp b/opm/parser/eclipse/EclipseState/EndpointScaling.cpp index 476076c2d..a01ce54cc 100644 --- a/opm/parser/eclipse/EclipseState/EndpointScaling.cpp +++ b/opm/parser/eclipse/EclipseState/EndpointScaling.cpp @@ -96,17 +96,22 @@ bool endscale_revers( const DeckKeyword& kw ) { } EndpointScaling::EndpointScaling( const Deck& deck ) { - if( !deck.hasKeyword( "ENDSCALE" ) ) return; + if( deck.hasKeyword( "ENDSCALE" ) || deck.hasKeyword("SWATINIT")) { + const bool threep = threepoint_scaling( deck ); + bool direct = false; + bool reversible = true; - const auto& endscale = deck.getKeyword( "ENDSCALE" ); - const bool direct = !endscale_nodir( endscale ); - const bool revers = endscale_revers( endscale ); - const bool threep = threepoint_scaling( deck ); + if (deck.hasKeyword("ENDSCALE")) { + const auto& endscale = deck.getKeyword( "ENDSCALE" ); + direct = !endscale_nodir( endscale ); + reversible = endscale_revers( endscale ); + } - this->options.set( static_cast< ue >( option::any ), true ); - this->options.set( static_cast< ue >( option::directional ), direct ); - this->options.set( static_cast< ue >( option::reversible ), revers ); - this->options.set( static_cast< ue >( option::threepoint ), threep ); + this->options.set( static_cast< ue >( option::any ), true ); + this->options.set( static_cast< ue >( option::directional ), direct ); + this->options.set( static_cast< ue >( option::reversible ), reversible ); + this->options.set( static_cast< ue >( option::threepoint ), threep ); + } } } diff --git a/opm/parser/eclipse/EclipseState/tests/RunspecTests.cpp b/opm/parser/eclipse/EclipseState/tests/RunspecTests.cpp index 263b38374..5cc6eed63 100644 --- a/opm/parser/eclipse/EclipseState/tests/RunspecTests.cpp +++ b/opm/parser/eclipse/EclipseState/tests/RunspecTests.cpp @@ -125,6 +125,8 @@ BOOST_AUTO_TEST_CASE( EndpointScalingWithoutENDSCALE ) { BOOST_CHECK( !endscale.irreversible() ); } + + BOOST_AUTO_TEST_CASE( EndpointScalingDefaulted ) { const std::string input = R"( RUNSPEC @@ -264,7 +266,23 @@ BOOST_AUTO_TEST_CASE( endpoint_scaling_throw_invalid_argument ) { for( auto&& input : inputs ) { auto deck = Parser{}.parseString( input, ParseContext{} ); - std::cout << input << std::endl; BOOST_CHECK_THROW( Runspec{ deck }, std::invalid_argument ); } } + + +BOOST_AUTO_TEST_CASE( SWATINIT ) { + const std::string input = R"( + SWATINIT + 1000*0.25 / + )"; + + Runspec runspec( Parser{}.parseString( input, ParseContext{} ) ); + const auto& endscale = runspec.endpointScaling(); + BOOST_CHECK( endscale ); + BOOST_CHECK( !endscale.directional() ); + BOOST_CHECK( endscale.nondirectional() ); + BOOST_CHECK( endscale.reversible() ); + BOOST_CHECK( !endscale.irreversible() ); + +}