mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Update to shared_ptr-less parser interface.
This commit is contained in:
parent
ec0ac4869c
commit
2c30f9e534
@ -88,11 +88,11 @@ try
|
|||||||
std::cout << "--------------- Reading parameters ---------------" << std::endl;
|
std::cout << "--------------- Reading parameters ---------------" << std::endl;
|
||||||
const std::string deck_filename = param.get<std::string>("deck_filename");
|
const std::string deck_filename = param.get<std::string>("deck_filename");
|
||||||
Opm::ParseContext parseContext;
|
Opm::ParseContext parseContext;
|
||||||
Opm::ParserPtr parser(new Opm::Parser() );
|
Opm::Parser parser;
|
||||||
Opm::DeckConstPtr deck = parser->parseFile(deck_filename , parseContext);
|
const Opm::Deck& deck = parser.parseFile(deck_filename , parseContext);
|
||||||
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck, parseContext));
|
const Opm::EclipseState eclipseState(deck, parseContext);
|
||||||
const double grav = param.getDefault("gravity", unit::gravity);
|
const double grav = param.getDefault("gravity", unit::gravity);
|
||||||
GridManager gm(*eclipseState->getInputGrid());
|
GridManager gm(eclipseState.getInputGrid());
|
||||||
const UnstructuredGrid& grid = *gm.c_grid();
|
const UnstructuredGrid& grid = *gm.c_grid();
|
||||||
BlackoilPropertiesFromDeck props(deck, eclipseState, grid, param);
|
BlackoilPropertiesFromDeck props(deck, eclipseState, grid, param);
|
||||||
warnIfUnusedParams(param);
|
warnIfUnusedParams(param);
|
||||||
|
@ -72,8 +72,8 @@ namespace Opm
|
|||||||
template<class Grid>
|
template<class Grid>
|
||||||
void initStateEquil(const Grid& grid,
|
void initStateEquil(const Grid& grid,
|
||||||
const BlackoilPropertiesInterface& props,
|
const BlackoilPropertiesInterface& props,
|
||||||
const Opm::DeckConstPtr deck,
|
const Opm::Deck& deck,
|
||||||
const Opm::EclipseStateConstPtr eclipseState,
|
const Opm::EclipseState& eclipseState,
|
||||||
const double gravity,
|
const double gravity,
|
||||||
BlackoilState& state);
|
BlackoilState& state);
|
||||||
|
|
||||||
@ -213,16 +213,16 @@ namespace Opm
|
|||||||
template<class Grid>
|
template<class Grid>
|
||||||
inline
|
inline
|
||||||
std::vector<int>
|
std::vector<int>
|
||||||
equilnum(const Opm::DeckConstPtr deck,
|
equilnum(const Opm::Deck& deck,
|
||||||
const Opm::EclipseStateConstPtr eclipseState,
|
const Opm::EclipseState& eclipseState,
|
||||||
const Grid& G )
|
const Grid& G )
|
||||||
{
|
{
|
||||||
std::vector<int> eqlnum;
|
std::vector<int> eqlnum;
|
||||||
if (deck->hasKeyword("EQLNUM")) {
|
if (deck.hasKeyword("EQLNUM")) {
|
||||||
const int nc = UgGridHelpers::numCells(G);
|
const int nc = UgGridHelpers::numCells(G);
|
||||||
eqlnum.resize(nc);
|
eqlnum.resize(nc);
|
||||||
const std::vector<int>& e =
|
const std::vector<int>& e =
|
||||||
eclipseState->get3DProperties().getIntGridProperty("EQLNUM").getData();
|
eclipseState.get3DProperties().getIntGridProperty("EQLNUM").getData();
|
||||||
const int* gc = UgGridHelpers::globalCell(G);
|
const int* gc = UgGridHelpers::globalCell(G);
|
||||||
for (int cell = 0; cell < nc; ++cell) {
|
for (int cell = 0; cell < nc; ++cell) {
|
||||||
const int deck_pos = (gc == NULL) ? cell : gc[cell];
|
const int deck_pos = (gc == NULL) ? cell : gc[cell];
|
||||||
@ -243,8 +243,8 @@ namespace Opm
|
|||||||
public:
|
public:
|
||||||
template<class Grid>
|
template<class Grid>
|
||||||
InitialStateComputer(BlackoilPropertiesInterface& props,
|
InitialStateComputer(BlackoilPropertiesInterface& props,
|
||||||
const Opm::DeckConstPtr deck,
|
const Opm::Deck& deck,
|
||||||
const Opm::EclipseStateConstPtr eclipseState,
|
const Opm::EclipseState& eclipseState,
|
||||||
const Grid& G ,
|
const Grid& G ,
|
||||||
const double grav = unit::gravity)
|
const double grav = unit::gravity)
|
||||||
: pp_(props.numPhases(),
|
: pp_(props.numPhases(),
|
||||||
@ -255,14 +255,14 @@ namespace Opm
|
|||||||
rv_(UgGridHelpers::numCells(G))
|
rv_(UgGridHelpers::numCells(G))
|
||||||
{
|
{
|
||||||
// Get the equilibration records.
|
// Get the equilibration records.
|
||||||
const std::vector<EquilRecord> rec = getEquil(*eclipseState);
|
const std::vector<EquilRecord> rec = getEquil(eclipseState);
|
||||||
const auto& tables = eclipseState->getTableManager();
|
const auto& tables = eclipseState.getTableManager();
|
||||||
// Create (inverse) region mapping.
|
// Create (inverse) region mapping.
|
||||||
const RegionMapping<> eqlmap(equilnum(deck, eclipseState, G));
|
const RegionMapping<> eqlmap(equilnum(deck, eclipseState, G));
|
||||||
|
|
||||||
// Create Rs functions.
|
// Create Rs functions.
|
||||||
rs_func_.reserve(rec.size());
|
rs_func_.reserve(rec.size());
|
||||||
if (deck->hasKeyword("DISGAS")) {
|
if (deck.hasKeyword("DISGAS")) {
|
||||||
const TableContainer& rsvdTables = tables.getRsvdTables();
|
const TableContainer& rsvdTables = tables.getRsvdTables();
|
||||||
for (size_t i = 0; i < rec.size(); ++i) {
|
for (size_t i = 0; i < rec.size(); ++i) {
|
||||||
if (eqlmap.cells(i).empty())
|
if (eqlmap.cells(i).empty())
|
||||||
@ -300,7 +300,7 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
|
|
||||||
rv_func_.reserve(rec.size());
|
rv_func_.reserve(rec.size());
|
||||||
if (deck->hasKeyword("VAPOIL")) {
|
if (deck.hasKeyword("VAPOIL")) {
|
||||||
const TableContainer& rvvdTables = tables.getRvvdTables();
|
const TableContainer& rvvdTables = tables.getRvvdTables();
|
||||||
for (size_t i = 0; i < rec.size(); ++i) {
|
for (size_t i = 0; i < rec.size(); ++i) {
|
||||||
if (eqlmap.cells(i).empty())
|
if (eqlmap.cells(i).empty())
|
||||||
@ -342,8 +342,8 @@ namespace Opm
|
|||||||
|
|
||||||
|
|
||||||
// Check for presence of kw SWATINIT
|
// Check for presence of kw SWATINIT
|
||||||
if (deck->hasKeyword("SWATINIT")) {
|
if (deck.hasKeyword("SWATINIT")) {
|
||||||
const std::vector<double>& swat_init = eclipseState->
|
const std::vector<double>& swat_init = eclipseState.
|
||||||
get3DProperties().getDoubleGridProperty("SWATINIT").getData();
|
get3DProperties().getDoubleGridProperty("SWATINIT").getData();
|
||||||
const int nc = UgGridHelpers::numCells(G);
|
const int nc = UgGridHelpers::numCells(G);
|
||||||
swat_init_.resize(nc);
|
swat_init_.resize(nc);
|
||||||
|
@ -886,8 +886,8 @@ namespace Opm
|
|||||||
template<class Grid>
|
template<class Grid>
|
||||||
void initStateEquil(const Grid& grid,
|
void initStateEquil(const Grid& grid,
|
||||||
BlackoilPropertiesFromDeck& props,
|
BlackoilPropertiesFromDeck& props,
|
||||||
const Opm::DeckConstPtr deck,
|
const Opm::Deck& deck,
|
||||||
const Opm::EclipseStateConstPtr eclipseState,
|
const Opm::EclipseState& eclipseState,
|
||||||
const double gravity,
|
const double gravity,
|
||||||
BlackoilState& state)
|
BlackoilState& state)
|
||||||
{
|
{
|
||||||
|
@ -66,32 +66,32 @@ static Opm::EquilRecord mkEquilRecord( double datd, double datp,
|
|||||||
|
|
||||||
auto dd = DeckItem::make< double >( "datdep" );
|
auto dd = DeckItem::make< double >( "datdep" );
|
||||||
dd.push_back( datd );
|
dd.push_back( datd );
|
||||||
auto dd_dim = std::make_shared< Opm::Dimension >( "dddim", 1 );
|
Opm::Dimension dd_dim( "dddim", 1 );
|
||||||
dd.push_backDimension( dd_dim, dd_dim );
|
dd.push_backDimension( dd_dim, dd_dim );
|
||||||
|
|
||||||
auto dp = DeckItem::make< double >( "datps" );
|
auto dp = DeckItem::make< double >( "datps" );
|
||||||
dp.push_back( datp );
|
dp.push_back( datp );
|
||||||
auto dp_dim = std::make_shared< Opm::Dimension >( "dpdim", 1 );
|
Opm::Dimension dp_dim( "dpdim", 1 );
|
||||||
dp.push_backDimension( dp_dim, dp_dim );
|
dp.push_backDimension( dp_dim, dp_dim );
|
||||||
|
|
||||||
auto zw = DeckItem::make< double >( "zwoc" );
|
auto zw = DeckItem::make< double >( "zwoc" );
|
||||||
zw.push_back( zwoc );
|
zw.push_back( zwoc );
|
||||||
auto zw_dim = std::make_shared< Opm::Dimension >( "zwdim", 1 );
|
Opm::Dimension zw_dim( "zwdim", 1 );
|
||||||
zw.push_backDimension( zw_dim, zw_dim );
|
zw.push_backDimension( zw_dim, zw_dim );
|
||||||
|
|
||||||
auto pcow = DeckItem::make< double >( "pcow" );
|
auto pcow = DeckItem::make< double >( "pcow" );
|
||||||
pcow.push_back( pcow_woc );
|
pcow.push_back( pcow_woc );
|
||||||
auto pcow_dim = std::make_shared< Opm::Dimension >( "pcowdim", 1 );
|
Opm::Dimension pcow_dim( "pcowdim", 1 );
|
||||||
pcow.push_backDimension( pcow_dim, pcow_dim );
|
pcow.push_backDimension( pcow_dim, pcow_dim );
|
||||||
|
|
||||||
auto zg = DeckItem::make< double >( "zgoc" );
|
auto zg = DeckItem::make< double >( "zgoc" );
|
||||||
zg.push_back( zgoc );
|
zg.push_back( zgoc );
|
||||||
auto zg_dim = std::make_shared< Opm::Dimension >( "zgdim", 1 );
|
Opm::Dimension zg_dim( "zgdim", 1 );
|
||||||
zg.push_backDimension( zg_dim, zg_dim );
|
zg.push_backDimension( zg_dim, zg_dim );
|
||||||
|
|
||||||
auto pcgo = DeckItem::make< double >( "pcgo" );
|
auto pcgo = DeckItem::make< double >( "pcgo" );
|
||||||
pcgo.push_back( pcgo_goc );
|
pcgo.push_back( pcgo_goc );
|
||||||
auto pcgo_dim = std::make_shared< Opm::Dimension >( "pcgodim", 1 );
|
Opm::Dimension pcgo_dim( "pcgodim", 1 );
|
||||||
pcgo.push_backDimension( pcgo_dim, pcgo_dim );
|
pcgo.push_backDimension( pcgo_dim, pcgo_dim );
|
||||||
|
|
||||||
auto i1 = DeckItem::make< int >( "i1" );
|
auto i1 = DeckItem::make< int >( "i1" );
|
||||||
@ -364,9 +364,9 @@ BOOST_AUTO_TEST_CASE (DeckAllDead)
|
|||||||
std::shared_ptr<UnstructuredGrid>
|
std::shared_ptr<UnstructuredGrid>
|
||||||
grid(create_grid_cart3d(1, 1, 10), destroy_grid);
|
grid(create_grid_cart3d(1, 1, 10), destroy_grid);
|
||||||
Opm::ParseContext parseContext;
|
Opm::ParseContext parseContext;
|
||||||
Opm::ParserPtr parser(new Opm::Parser() );
|
Opm::Parser parser;
|
||||||
Opm::DeckConstPtr deck = parser->parseFile("deadfluids.DATA" , parseContext);
|
Opm::Deck deck = parser.parseFile("deadfluids.DATA" , parseContext);
|
||||||
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck, parseContext));
|
Opm::EclipseState eclipseState(deck, parseContext);
|
||||||
Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, *grid, false);
|
Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, *grid, false);
|
||||||
Opm::EQUIL::DeckDependent::InitialStateComputer comp(props, deck, eclipseState, *grid, 10.0);
|
Opm::EQUIL::DeckDependent::InitialStateComputer comp(props, deck, eclipseState, *grid, 10.0);
|
||||||
const auto& pressures = comp.press();
|
const auto& pressures = comp.press();
|
||||||
@ -391,10 +391,10 @@ BOOST_AUTO_TEST_CASE (CapillaryInversion)
|
|||||||
// Test setup.
|
// Test setup.
|
||||||
Opm::GridManager gm(1, 1, 40, 1.0, 1.0, 2.5);
|
Opm::GridManager gm(1, 1, 40, 1.0, 1.0, 2.5);
|
||||||
const UnstructuredGrid& grid = *(gm.c_grid());
|
const UnstructuredGrid& grid = *(gm.c_grid());
|
||||||
Opm::ParserPtr parser(new Opm::Parser() );
|
Opm::Parser parser;
|
||||||
Opm::ParseContext parseContext;
|
Opm::ParseContext parseContext;
|
||||||
Opm::DeckConstPtr deck = parser->parseFile("capillary.DATA" , parseContext);
|
Opm::Deck deck = parser.parseFile("capillary.DATA" , parseContext);
|
||||||
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck , parseContext));
|
Opm::EclipseState eclipseState(deck , parseContext);
|
||||||
Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, false);
|
Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, false);
|
||||||
|
|
||||||
// Test the capillary inversion for oil-water.
|
// Test the capillary inversion for oil-water.
|
||||||
@ -445,10 +445,10 @@ BOOST_AUTO_TEST_CASE (DeckWithCapillary)
|
|||||||
{
|
{
|
||||||
Opm::GridManager gm(1, 1, 20, 1.0, 1.0, 5.0);
|
Opm::GridManager gm(1, 1, 20, 1.0, 1.0, 5.0);
|
||||||
const UnstructuredGrid& grid = *(gm.c_grid());
|
const UnstructuredGrid& grid = *(gm.c_grid());
|
||||||
Opm::ParserPtr parser(new Opm::Parser() );
|
Opm::Parser parser;
|
||||||
Opm::ParseContext parseContext;
|
Opm::ParseContext parseContext;
|
||||||
Opm::DeckConstPtr deck = parser->parseFile("capillary.DATA" , parseContext);
|
Opm::Deck deck = parser.parseFile("capillary.DATA" , parseContext);
|
||||||
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck , parseContext));
|
Opm::EclipseState eclipseState(deck , parseContext);
|
||||||
Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, false);
|
Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, false);
|
||||||
|
|
||||||
Opm::EQUIL::DeckDependent::InitialStateComputer comp(props, deck, eclipseState, grid, 10.0);
|
Opm::EQUIL::DeckDependent::InitialStateComputer comp(props, deck, eclipseState, grid, 10.0);
|
||||||
@ -486,10 +486,10 @@ BOOST_AUTO_TEST_CASE (DeckWithCapillaryOverlap)
|
|||||||
{
|
{
|
||||||
Opm::GridManager gm(1, 1, 20, 1.0, 1.0, 5.0);
|
Opm::GridManager gm(1, 1, 20, 1.0, 1.0, 5.0);
|
||||||
const UnstructuredGrid& grid = *(gm.c_grid());
|
const UnstructuredGrid& grid = *(gm.c_grid());
|
||||||
Opm::ParserPtr parser(new Opm::Parser() );
|
Opm::Parser parser;
|
||||||
Opm::ParseContext parseContext;
|
Opm::ParseContext parseContext;
|
||||||
Opm::DeckConstPtr deck = parser->parseFile("capillary_overlap.DATA" , parseContext);
|
Opm::Deck deck = parser.parseFile("capillary_overlap.DATA" , parseContext);
|
||||||
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck , parseContext));
|
Opm::EclipseState eclipseState(deck , parseContext);
|
||||||
Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, false);
|
Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, false);
|
||||||
|
|
||||||
Opm::EQUIL::DeckDependent::InitialStateComputer comp(props, deck, eclipseState, grid, 9.80665);
|
Opm::EQUIL::DeckDependent::InitialStateComputer comp(props, deck, eclipseState, grid, 9.80665);
|
||||||
@ -549,10 +549,10 @@ BOOST_AUTO_TEST_CASE (DeckWithLiveOil)
|
|||||||
{
|
{
|
||||||
Opm::GridManager gm(1, 1, 20, 1.0, 1.0, 5.0);
|
Opm::GridManager gm(1, 1, 20, 1.0, 1.0, 5.0);
|
||||||
const UnstructuredGrid& grid = *(gm.c_grid());
|
const UnstructuredGrid& grid = *(gm.c_grid());
|
||||||
Opm::ParserPtr parser(new Opm::Parser() );
|
Opm::Parser parser;
|
||||||
Opm::ParseContext parseContext;
|
Opm::ParseContext parseContext;
|
||||||
Opm::DeckConstPtr deck = parser->parseFile("equil_liveoil.DATA" , parseContext);
|
Opm::Deck deck = parser.parseFile("equil_liveoil.DATA" , parseContext);
|
||||||
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck , parseContext));
|
Opm::EclipseState eclipseState(deck , parseContext);
|
||||||
Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, false);
|
Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, false);
|
||||||
|
|
||||||
Opm::EQUIL::DeckDependent::InitialStateComputer comp(props, deck, eclipseState, grid, 9.80665);
|
Opm::EQUIL::DeckDependent::InitialStateComputer comp(props, deck, eclipseState, grid, 9.80665);
|
||||||
@ -629,10 +629,10 @@ BOOST_AUTO_TEST_CASE (DeckWithLiveGas)
|
|||||||
{
|
{
|
||||||
Opm::GridManager gm(1, 1, 20, 1.0, 1.0, 5.0);
|
Opm::GridManager gm(1, 1, 20, 1.0, 1.0, 5.0);
|
||||||
const UnstructuredGrid& grid = *(gm.c_grid());
|
const UnstructuredGrid& grid = *(gm.c_grid());
|
||||||
Opm::ParserPtr parser(new Opm::Parser() );
|
Opm::Parser parser;
|
||||||
Opm::ParseContext parseContext;
|
Opm::ParseContext parseContext;
|
||||||
Opm::DeckConstPtr deck = parser->parseFile("equil_livegas.DATA" , parseContext);
|
Opm::Deck deck = parser.parseFile("equil_livegas.DATA" , parseContext);
|
||||||
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck , parseContext));
|
Opm::EclipseState eclipseState(deck , parseContext);
|
||||||
Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, false);
|
Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, false);
|
||||||
|
|
||||||
Opm::EQUIL::DeckDependent::InitialStateComputer comp(props, deck, eclipseState, grid, 9.80665);
|
Opm::EQUIL::DeckDependent::InitialStateComputer comp(props, deck, eclipseState, grid, 9.80665);
|
||||||
@ -712,10 +712,10 @@ BOOST_AUTO_TEST_CASE (DeckWithRSVDAndRVVD)
|
|||||||
{
|
{
|
||||||
Opm::GridManager gm(1, 1, 20, 1.0, 1.0, 5.0);
|
Opm::GridManager gm(1, 1, 20, 1.0, 1.0, 5.0);
|
||||||
const UnstructuredGrid& grid = *(gm.c_grid());
|
const UnstructuredGrid& grid = *(gm.c_grid());
|
||||||
Opm::ParserPtr parser(new Opm::Parser() );
|
|
||||||
Opm::ParseContext parseContext;
|
Opm::ParseContext parseContext;
|
||||||
Opm::DeckConstPtr deck = parser->parseFile("equil_rsvd_and_rvvd.DATA", parseContext);
|
Opm::Parser parser;
|
||||||
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck , parseContext));
|
Opm::Deck deck = parser.parseFile("equil_rsvd_and_rvvd.DATA", parseContext);
|
||||||
|
Opm::EclipseState eclipseState(deck , parseContext);
|
||||||
Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, false);
|
Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, false);
|
||||||
|
|
||||||
Opm::EQUIL::DeckDependent::InitialStateComputer comp(props, deck, eclipseState, grid, 9.80665);
|
Opm::EQUIL::DeckDependent::InitialStateComputer comp(props, deck, eclipseState, grid, 9.80665);
|
||||||
|
Loading…
Reference in New Issue
Block a user