Implement Proper Record Copying Behaviour for ROCK

This commit adds the expected behaviour for all-defaulted records in
ROCK, provided the all-defaulted records are not the first of the
keyword.  Similarly to, e.g. PVTW, all-defaulted records are treated as
copies of the immediately preceding record.

In other words, given

    ROCK
    -- REF. PRES   COMPRESSIBILITY
       280.000        5.6E-5 /
    /

the second record is supposed to be a copy of the first.
This commit is contained in:
Bård Skaflestad
2023-02-09 18:55:20 +01:00
parent 8beebd49e3
commit 5cdeb6137b
6 changed files with 310 additions and 194 deletions

View File

@@ -17,19 +17,18 @@
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#define BOOST_TEST_MODULE SimulationConfigTests
#include <boost/test/unit_test.hpp>
#include <opm/input/eclipse/EclipseState/SimulationConfig/RockConfig.hpp>
#include <opm/common/utility/OpmInputError.hpp>
#include <opm/input/eclipse/EclipseState/Runspec.hpp>
#include <opm/input/eclipse/EclipseState/Grid/FieldPropsManager.hpp>
#include <opm/input/eclipse/EclipseState/Grid/EclipseGrid.hpp>
#include <opm/input/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp>
#include <opm/input/eclipse/EclipseState/SimulationConfig/RockConfig.hpp>
#include <opm/input/eclipse/EclipseState/Tables/TableManager.hpp>
#include <opm/input/eclipse/Parser/Parser.hpp>
@@ -38,6 +37,9 @@
#include <opm/input/eclipse/Deck/Deck.hpp>
#include <opm/input/eclipse/Deck/DeckSection.hpp>
#include <cstddef>
#include <string>
using namespace Opm;
const std::string& inputStr = "RUNSPEC\n"
@@ -280,7 +282,8 @@ BOOST_AUTO_TEST_CASE(SimulationConfig_TEMP_THERMAL)
}
BOOST_AUTO_TEST_CASE(TESTRockConfig) {
BOOST_AUTO_TEST_CASE(TESTRockConfig_Standard)
{
const std::string deck_string = R"(
RUNSPEC
@@ -310,3 +313,45 @@ ROCKOPTS
const auto& comp = rc.comp();
BOOST_CHECK_EQUAL(comp.size(), 3U);
}
BOOST_AUTO_TEST_CASE(TESTRockConfig_Default)
{
const auto deck = Parser{}.parseString(R"(
RUNSPEC
TABDIMS
3 / -- NTSFUN = 3
PROPS
ROCKOPTS
1* 1* SATNUM /
ROCK
123.4 0.40E-05 /
/
271.8 1.61e-05 /
)");
const auto grid = EclipseGrid { 10, 10, 10 };
const auto fp = FieldPropsManager {
deck, Phases{true, true, true}, grid, TableManager()
};
const auto rc = RockConfig { deck, fp };
BOOST_CHECK_EQUAL(rc.rocknum_property(), "SATNUM");
const auto& comp = rc.comp();
BOOST_REQUIRE_EQUAL(comp.size(), std::size_t{3});
BOOST_CHECK_CLOSE(comp[0].pref, 123.4*1.0e5, 1.0e-8);
BOOST_CHECK_CLOSE(comp[0].compressibility, 0.4e-5/1.0e5, 1.0e-8);
BOOST_CHECK_CLOSE(comp[1].pref, 123.4*1.0e5, 1.0e-8);
BOOST_CHECK_CLOSE(comp[1].compressibility, 0.4e-5/1.0e5, 1.0e-8);
BOOST_CHECK_CLOSE(comp[2].pref, 271.8*1.0e5, 1.0e-8);
BOOST_CHECK_CLOSE(comp[2].compressibility, 1.61e-5/1.0e5, 1.0e-8);
}

View File

@@ -2398,6 +2398,28 @@ BOOST_AUTO_TEST_CASE( TestParseROCK ) {
BOOST_CHECK_EQUAL( 8U , tables.numFIPRegions( ));
}
BOOST_AUTO_TEST_CASE( TestParseROCK_WithDefault )
{
const auto deck = Opm::Parser{}.parseString(R"(RUNSPEC
TABDIMS
1* 2 /
PROPS
ROCK
1.1 1.2 /
/ -- Copy from region 1
)");
const auto tables = Opm::TableManager { deck };
const auto& rock = tables.getRockTable();
BOOST_CHECK_EQUAL(rock.size(), std::size_t{2});
BOOST_CHECK_CLOSE(1.1e5, rock[0].reference_pressure, 1.0e-8);
BOOST_CHECK_CLOSE(1.2e-5, rock[0].compressibility, 1.0e-8);
BOOST_CHECK_CLOSE(1.1e5, rock[1].reference_pressure, 1.0e-8);
BOOST_CHECK_CLOSE(1.2e-5, rock[1].compressibility, 1.0e-8);
}
BOOST_AUTO_TEST_CASE( TestParsePVCDO ) {
const std::string data = R"(
TABDIMS