Introduce class SchduleGrid to be used as grid by Schedule class

This commit is contained in:
Williham Williham Totland
2021-10-05 11:39:14 +02:00
committed by Joakim Hove
parent 798e93e4a8
commit 4134b98701
22 changed files with 543 additions and 89 deletions

View File

@@ -34,6 +34,8 @@
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/TableManager.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/FieldPropsManager.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/CompletedCells.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleGrid.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/common/OpmLog/KeywordLocation.hpp>
@@ -55,8 +57,9 @@ Opm::WellConnections loadCOMPDAT(const std::string& compdat_keyword) {
Opm::FieldPropsManager field_props(deck, Opm::Phases{true, true, true}, grid, Opm::TableManager());
const auto& keyword = deck.getKeyword("COMPDAT", 0);
Opm::WellConnections connections(Opm::Connection::Order::TRACK, 10,10);
Opm::CompletedCells cells(grid);
for (const auto& rec : keyword)
connections.loadCOMPDAT(rec, grid, field_props, "WELL", {});
connections.loadCOMPDAT(rec, Opm::ScheduleGrid(grid, cells), field_props, "WELL", {});
return connections;
}

View File

@@ -40,6 +40,9 @@
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.hpp>
#include "src/opm/parser/eclipse/EclipseState/Schedule/MSW/Compsegs.hpp"
#include <opm/parser/eclipse/EclipseState/Schedule/CompletedCells.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleGrid.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
@@ -105,7 +108,8 @@ WSEGAICD
Opm::ParseContext parseContext;
parseContext.update(Opm::ParseContext::SCHEDULE_COMPSEGS_INVALID, Opm::InputError::THROW_EXCEPTION);
parseContext.update(Opm::ParseContext::SCHEDULE_COMPSEGS_NOT_SUPPORTED, Opm::InputError::THROW_EXCEPTION);
const auto& [new_connection_set, new_segment_set] = Opm::Compsegs::processCOMPSEGS(compsegs, connection_set, segment_set, grid, parseContext, errorGuard);
Opm::CompletedCells cells(grid);
const auto& [new_connection_set, new_segment_set] = Opm::Compsegs::processCOMPSEGS(compsegs, connection_set, segment_set, Opm::ScheduleGrid(grid, cells), parseContext, errorGuard);
// checking the ICD segment
const Opm::DeckKeyword wsegaicd = deck.getKeyword("WSEGAICD");
@@ -247,9 +251,10 @@ WSEGSICD
Opm::ErrorGuard errorGuard;
Opm::ParseContext parseContext;
Opm::CompletedCells cells(grid);
parseContext.update(Opm::ParseContext::SCHEDULE_COMPSEGS_INVALID, Opm::InputError::THROW_EXCEPTION);
parseContext.update(Opm::ParseContext::SCHEDULE_COMPSEGS_NOT_SUPPORTED, Opm::InputError::THROW_EXCEPTION);
const auto& [new_connection_set, new_segment_set] = Opm::Compsegs::processCOMPSEGS(compsegs, connection_set, segment_set, grid, parseContext, errorGuard);
const auto& [new_connection_set, new_segment_set] = Opm::Compsegs::processCOMPSEGS(compsegs, connection_set, segment_set, Opm::ScheduleGrid(grid, cells), parseContext, errorGuard);
// checking the ICD segment
const Opm::DeckKeyword wsegsicd = deck.getKeyword("WSEGSICD");
@@ -394,11 +399,12 @@ BOOST_AUTO_TEST_CASE(WrongDistanceCOMPSEGS) {
Opm::ErrorGuard errorGuard;
Opm::ParseContext parseContext;
Opm::CompletedCells cells(grid);
parseContext.update(Opm::ParseContext::SCHEDULE_COMPSEGS_INVALID, Opm::InputError::THROW_EXCEPTION);
BOOST_CHECK_THROW(Opm::Compsegs::processCOMPSEGS(compsegs, connection_set, segment_set, grid, parseContext, errorGuard), Opm::OpmInputError);
BOOST_CHECK_THROW(Opm::Compsegs::processCOMPSEGS(compsegs, connection_set, segment_set, Opm::ScheduleGrid(grid, cells), parseContext, errorGuard), Opm::OpmInputError);
parseContext.update(Opm::ParseContext::SCHEDULE_COMPSEGS_INVALID, Opm::InputError::IGNORE);
BOOST_CHECK_NO_THROW(Opm::Compsegs::processCOMPSEGS(compsegs, connection_set, segment_set, grid, parseContext, errorGuard));
BOOST_CHECK_NO_THROW(Opm::Compsegs::processCOMPSEGS(compsegs, connection_set, segment_set, Opm::ScheduleGrid(grid, cells), parseContext, errorGuard));
}
BOOST_AUTO_TEST_CASE(NegativeDepthCOMPSEGS) {
@@ -451,11 +457,12 @@ BOOST_AUTO_TEST_CASE(NegativeDepthCOMPSEGS) {
Opm::ErrorGuard errorGuard;
Opm::ParseContext parseContext;
Opm::CompletedCells cells(grid);
parseContext.update(Opm::ParseContext::SCHEDULE_COMPSEGS_NOT_SUPPORTED, Opm::InputError::THROW_EXCEPTION);
BOOST_CHECK_THROW(Opm::Compsegs::processCOMPSEGS(compsegs, connection_set, segment_set, grid, parseContext, errorGuard), Opm::OpmInputError);
BOOST_CHECK_THROW(Opm::Compsegs::processCOMPSEGS(compsegs, connection_set, segment_set, Opm::ScheduleGrid(grid, cells), parseContext, errorGuard), Opm::OpmInputError);
parseContext.update(Opm::ParseContext::SCHEDULE_COMPSEGS_NOT_SUPPORTED, Opm::InputError::IGNORE);
BOOST_CHECK_NO_THROW( Opm::Compsegs::processCOMPSEGS(compsegs, connection_set, segment_set, grid, parseContext, errorGuard) );
BOOST_CHECK_NO_THROW( Opm::Compsegs::processCOMPSEGS(compsegs, connection_set, segment_set, Opm::ScheduleGrid(grid, cells), parseContext, errorGuard) );
}
BOOST_AUTO_TEST_CASE(testwsegvalv) {
@@ -514,9 +521,10 @@ BOOST_AUTO_TEST_CASE(testwsegvalv) {
Opm::ErrorGuard errorGuard;
Opm::ParseContext parseContext;
Opm::CompletedCells cells(grid);
parseContext.update(Opm::ParseContext::SCHEDULE_COMPSEGS_INVALID, Opm::InputError::THROW_EXCEPTION);
parseContext.update(Opm::ParseContext::SCHEDULE_COMPSEGS_NOT_SUPPORTED, Opm::InputError::THROW_EXCEPTION);
BOOST_CHECK_NO_THROW( Opm::Compsegs::processCOMPSEGS(compsegs, connection_set, segment_set, grid, parseContext, errorGuard));
BOOST_CHECK_NO_THROW( Opm::Compsegs::processCOMPSEGS(compsegs, connection_set, segment_set, Opm::ScheduleGrid(grid, cells), parseContext, errorGuard));
// checking the WSEGVALV segment
const Opm::DeckKeyword wsegvalv = deck.getKeyword("WSEGVALV");

View File

@@ -67,6 +67,9 @@
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Group/GuideRateConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Group/GuideRate.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/CompletedCells.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleGrid.hpp>
using namespace Opm;
@@ -4801,3 +4804,22 @@ END
BOOST_CHECK_MESSAGE(! sched[3].rptonly(),
R"("RPTONLY" must NOT be configured on report step 4)");
}
BOOST_AUTO_TEST_CASE(TestScheduleGrid) {
EclipseGrid grid(10,10,10);
CompletedCells cells(grid);
{
ScheduleGrid sched_grid(grid, cells);
auto depth = sched_grid.getCellDepth(1,1,1);
BOOST_CHECK_EQUAL(depth, 1.50);
}
{
ScheduleGrid sched_grid(cells);
auto depth = sched_grid.getCellDepth(1,1,1);
BOOST_CHECK_EQUAL(depth, 1.50);
BOOST_CHECK_THROW(sched_grid.getCellDepth(2,2,2), std::exception);
}
}