fix tests that relied on internal deck handling

This commit is contained in:
Arne Morten Kvarving 2022-06-14 14:25:46 +02:00
parent a4d254b749
commit 32eb467ead
5 changed files with 65 additions and 13 deletions

View File

@ -29,6 +29,7 @@
#include <opm/input/eclipse/Deck/Deck.hpp>
#include <opm/input/eclipse/EclipseState/Aquifer/NumericalAquifer/NumericalAquiferCell.hpp>
#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
#include <opm/input/eclipse/Parser/ErrorGuard.hpp>
#include <opm/input/eclipse/Schedule/Action/State.hpp>
#include <opm/input/eclipse/Schedule/OilVaporizationProperties.hpp>
#include <opm/input/eclipse/Schedule/Schedule.hpp>
@ -37,9 +38,11 @@
#include <opm/input/eclipse/Schedule/UDQ/UDQState.hpp>
#include <opm/input/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
#include <opm/input/eclipse/Python/Python.hpp>
#include <opm/simulators/utils/readDeck.hpp>
#include <dune/common/version.hh>
#include <dune/common/parallel/mpihelper.hh>
#include <dune/common/timer.hh>
#if HAVE_MPI
#include <mpi.h>
@ -86,6 +89,39 @@ void EclGenericVanguard::setParams(double setupTime,
EclGenericVanguard::eclSummaryConfig_ = std::move(summaryConfig);
}
void EclGenericVanguard::readDeck(const std::string& filename)
{
Dune::Timer setupTimer;
setupTimer.start();
std::shared_ptr<Opm::Deck> deck;
std::shared_ptr<Opm::EclipseState> eclipseState;
std::shared_ptr<Opm::Schedule> schedule;
std::unique_ptr<Opm::UDQState> udqState;
std::unique_ptr<Opm::Action::State> actionState;
std::unique_ptr<Opm::WellTestState> wtestState;
std::shared_ptr<Opm::SummaryConfig> summaryConfig;
auto parseContext =
std::make_unique<ParseContext>(std::vector<std::pair<std::string , InputError::Action>>
{{ParseContext::PARSE_RANDOM_SLASH, InputError::IGNORE},
{ParseContext::PARSE_MISSING_DIMS_KEYWORD, InputError::WARN},
{ParseContext::SUMMARY_UNKNOWN_WELL, InputError::WARN},
{ParseContext::SUMMARY_UNKNOWN_GROUP, InputError::WARN}});
Opm::readDeck(EclGenericVanguard::comm(),
filename, deck, eclipseState, schedule, udqState,
actionState, wtestState,
summaryConfig, nullptr, nullptr, std::move(parseContext),
false, false, {});
EclGenericVanguard::setParams(setupTimer.elapsed(),
deck, eclipseState, schedule,
std::move(udqState),
std::move(actionState),
std::move(wtestState), summaryConfig);
}
std::string EclGenericVanguard::canonicalDeckPath(const std::string& caseName)
{
const auto fileExists = [](const std::filesystem::path& f) -> bool

View File

@ -93,6 +93,12 @@ public:
static double setupTime()
{ return setupTime_; }
/*!
* \brief Read a deck.
* \param filename file to read
*/
static void readDeck(const std::string& filename);
/*!
* \brief Set the simulation configuration objects.
*/

View File

@ -26,22 +26,24 @@
#include <ebos/equil/equilibrationhelpers.hh>
#include <ebos/eclproblem.hh>
#include <opm/models/utils/start.hh>
#include <ebos/collecttoiorank.hh>
#include <ebos/ecloutputblackoilmodule.hh>
#include <ebos/eclwriter.hh>
#include <opm/grid/UnstructuredGrid.h>
#include <opm/grid/GridManager.hpp>
#include <opm/input/eclipse/Schedule/Action/State.hpp>
#include <opm/input/eclipse/Units/Units.hpp>
#include <opm/io/eclipse/ESmry.hpp>
#include <opm/models/utils/start.hh>
#include <opm/output/eclipse/Summary.hpp>
#include <ebos/collecttoiorank.hh>
#include <ebos/ecloutputblackoilmodule.hh>
#include <ebos/eclwriter.hh>
#include <opm/input/eclipse/Schedule/Action/State.hpp>
#include <opm/simulators/wells/BlackoilWellModel.hpp>
#include <opm/simulators/flow/BlackoilModelParametersEbos.hpp>
#include <opm/simulators/wells/BlackoilWellModel.hpp>
#if HAVE_DUNE_FEM
#include <dune/fem/misc/mpimanager.hh>
@ -133,7 +135,9 @@ initSimulator(const char *filename)
Opm::setupParameters_<TypeTag>(/*argc=*/sizeof(argv)/sizeof(argv[0]), argv, /*registerParams=*/false);
return std::unique_ptr<Simulator>(new Simulator);
Opm::EclGenericVanguard::readDeck(filename);
return std::make_unique<Simulator>();
}
struct EclOutputFixture {

View File

@ -26,16 +26,18 @@
#include <ebos/equil/equilibrationhelpers.hh>
#include <ebos/eclproblem.hh>
#include <opm/models/utils/start.hh>
#include <opm/simulators/wells/BlackoilWellModel.hpp>
#include <opm/simulators/flow/BlackoilModelParametersEbos.hpp>
#include <ebos/eclgenericvanguard.hh>
#include <opm/grid/UnstructuredGrid.h>
#include <opm/grid/GridManager.hpp>
#include <opm/input/eclipse/Units/Units.hpp>
#include <opm/models/utils/start.hh>
#include <opm/simulators/flow/BlackoilModelParametersEbos.hpp>
#include <opm/simulators/wells/BlackoilWellModel.hpp>
#if HAVE_DUNE_FEM
#include <dune/fem/misc/mpimanager.hh>
#else
@ -103,7 +105,9 @@ initSimulator(const char *filename)
Opm::setupParameters_<TypeTag>(/*argc=*/sizeof(argv)/sizeof(argv[0]), argv, /*registerParams=*/false);
return std::unique_ptr<Simulator>(new Simulator);
Opm::EclGenericVanguard::readDeck(filename);
return std::make_unique<Simulator>();
}
template <class GridView>

View File

@ -90,7 +90,9 @@ initSimulator(const char *filename)
Opm::setupParameters_<TypeTag>(/*argc=*/sizeof(argv)/sizeof(argv[0]), argv, /*registerParams=*/true);
return std::unique_ptr<Simulator>(new Simulator);
Opm::EclGenericVanguard::readDeck(filename);
return std::make_unique<Simulator>();
}