fixing bug in Opm::EclIO::ESmry constructor

- changed behaviour when opening summary file from restart run
 - will now work with loadBaseRunData=false and original base run folder
   not found.
This commit is contained in:
Torbjørn Skille 2021-09-07 20:07:07 +02:00
parent 9cff0dae26
commit c900462edb
6 changed files with 5 additions and 23 deletions

View File

@ -544,6 +544,7 @@ if(ENABLE_ECL_INPUT)
tests/SPE1CASE1A.UNSMRY
tests/SPE1CASE1_RST60.SMSPEC
tests/SPE1CASE1_RST60.UNSMRY
tests/SPE1CASE1_RST60.ESMRY
tests/MODEL2_RESTART.DATA
tests/restart/MODEL2.UNRST
tests/UDQ_WCONPROD.DATA

Binary file not shown.

View File

@ -144,7 +144,6 @@ class TestEclFile(unittest.TestCase):
self.assertEqual(time0[0], 1.0)
rst_smry1 = ESmry(test_path("data/SPE1CASE1_RST60.SMSPEC"))
rst_smry1.make_esmry_file()
rst_ext_smry1 = ESmry(test_path("data/SPE1CASE1_RST60.ESMRY"))

View File

@ -193,7 +193,10 @@ ESmry::ESmry(const std::string &filename, bool loadBaseRunData) :
keywordListSpecFile.push_back(combindKeyList);
getRstString(restartArray, pathRstFile, rstRootN);
if (rstRootN.string() != ""){
if ((rstRootN.string() != "") && (loadBaseRunData)){
if (! Opm::filesystem::exists(pathRstFile))
OPM_THROW(std::runtime_error, "path to restart file not found, '" + pathRstFile.string() + "'");
auto abs_rst_file = Opm::filesystem::canonical(pathRstFile) / rstRootN;
Opm::filesystem::path rel_path;

BIN
tests/SPE1CASE1_RST60.ESMRY Normal file

Binary file not shown.

View File

@ -218,7 +218,6 @@ BOOST_AUTO_TEST_CASE(TestExtESmry_1) {
Opm::filesystem::remove("SPE1CASE1.ESMRY");
}
BOOST_AUTO_TEST_CASE(TestExtESmry_2) {
// using a syntetic restart file.
@ -248,14 +247,8 @@ BOOST_AUTO_TEST_CASE(TestExtESmry_2) {
if (Opm::filesystem::exists("SPE1CASE1.ESMRY"))
Opm::filesystem::remove("SPE1CASE1.ESMRY");
if (Opm::filesystem::exists("SPE1CASE1_RST60.ESMRY"))
Opm::filesystem::remove("SPE1CASE1_RST60.ESMRY");
ESmry smry1("SPE1CASE1.SMSPEC");
ESmry smry2("SPE1CASE1_RST60.SMSPEC");
smry1.make_esmry_file();
smry2.make_esmry_file();
ExtESmry esmry1("SPE1CASE1_RST60.ESMRY");
@ -313,12 +306,8 @@ BOOST_AUTO_TEST_CASE(TestExtESmry_2) {
if (Opm::filesystem::exists("SPE1CASE1.ESMRY"))
Opm::filesystem::remove("SPE1CASE1.ESMRY");
if (Opm::filesystem::exists("SPE1CASE1_RST60.ESMRY"))
Opm::filesystem::remove("SPE1CASE1_RST60.ESMRY");
}
BOOST_AUTO_TEST_CASE(TestESmry_3) {
// using a syntetic restart file.
@ -348,14 +337,8 @@ BOOST_AUTO_TEST_CASE(TestESmry_3) {
if (Opm::filesystem::exists("SPE1CASE1.ESMRY"))
Opm::filesystem::remove("SPE1CASE1.ESMRY");
if (Opm::filesystem::exists("SPE1CASE1_RST60.ESMRY"))
Opm::filesystem::remove("SPE1CASE1_RST60.ESMRY");
ESmry smry1("SPE1CASE1.SMSPEC");
ESmry smry2("SPE1CASE1_RST60.SMSPEC");
smry1.make_esmry_file();
smry2.make_esmry_file();
ExtESmry esmry1("SPE1CASE1_RST60.ESMRY", true);
@ -391,15 +374,11 @@ BOOST_AUTO_TEST_CASE(TestESmry_3) {
BOOST_REQUIRE_CLOSE (smryVect[i], bpr_111_ref[i], 0.01);
smryVect = esmry1.get("BPR:10,10,3");
for (unsigned int i=0;i< smryVect.size();i++)
BOOST_REQUIRE_CLOSE (smryVect[i], bpr_10103_ref[i], 0.01);
if (Opm::filesystem::exists("SPE1CASE1.ESMRY"))
Opm::filesystem::remove("SPE1CASE1.ESMRY");
if (Opm::filesystem::exists("SPE1CASE1_RST60.ESMRY"))
Opm::filesystem::remove("SPE1CASE1_RST60.ESMRY");
}