Simulation Config: Add Predicate for Thermal Simulations

This commit introduces a new predicate,

    bool SimulationConfig::isThermal() const

that determines whether or not either of the keywords

    TEMP or THERMAL

are specified in the RUNSPEC section of a simulation run.
This commit is contained in:
Bård Skaflestad
2018-09-27 12:52:28 +02:00
parent 056d6bccb4
commit 9df3bea857
5 changed files with 76 additions and 1 deletions

View File

@@ -104,6 +104,32 @@ const std::string& inputStr_vap_dis = "RUNSPEC\n"
"REGIONS\n"
"\n";
namespace {
std::string simDeckStringTEMP()
{
return R"(
RUNSPEC
TEMP
DIMENS
10 3 4 /
)";
}
std::string simDeckStringTHERMAL()
{
return R"(
RUNSPEC
THERMAL
DIMENS
10 3 4 /
)";
}
}
static Deck createDeck(const ParseContext& parseContext , const std::string& input) {
Opm::Parser parser;
return parser.parseString(input, parseContext);
@@ -211,3 +237,39 @@ BOOST_AUTO_TEST_CASE(SimulationConfig_VAPOIL_DISGAS) {
BOOST_CHECK_EQUAL( true , simulationConfig_vd.hasDISGAS());
BOOST_CHECK_EQUAL( true , simulationConfig_vd.hasVAPOIL());
}
BOOST_AUTO_TEST_CASE(SimulationConfig_TEMP_THERMAL)
{
const auto parseContext = Opm::ParseContext {};
{
const auto deck = createDeck(parseContext, inputStr);
const auto tm = Opm::TableManager(deck);
const auto eg = Opm::EclipseGrid(10, 3, 4);
const auto ep = Opm::Eclipse3DProperties(deck, tm, eg);
const auto simulationConfig = Opm::SimulationConfig(false, deck, ep);
BOOST_CHECK(! simulationConfig.isThermal());
}
{
const auto deck = createDeck(parseContext, simDeckStringTEMP());
const auto tm = Opm::TableManager(deck);
const auto eg = Opm::EclipseGrid(10, 3, 4);
const auto ep = Opm::Eclipse3DProperties(deck, tm, eg);
const auto simulationConfig = Opm::SimulationConfig(false, deck, ep);
BOOST_CHECK(simulationConfig.isThermal());
}
{
const auto deck = createDeck(parseContext, simDeckStringTHERMAL());
const auto tm = Opm::TableManager(deck);
const auto eg = Opm::EclipseGrid(10, 3, 4);
const auto ep = Opm::Eclipse3DProperties(deck, tm, eg);
const auto simulationConfig = Opm::SimulationConfig(false, deck, ep);
BOOST_CHECK(simulationConfig.isThermal());
}
}