Update to shared_ptr-less parser interface.

This commit is contained in:
Jørgen Kvalsvik 2016-10-14 09:23:26 +02:00
parent 93ffb318cd
commit 1c6a4b34da
54 changed files with 410 additions and 425 deletions

View File

@ -207,9 +207,9 @@ public:
/*****************************************************************/
void initOPMTrans(TransGraph& opmTrans, DeckConstPtr deck, std::shared_ptr<const EclipseState> eclipseState) {
std::shared_ptr<GridManager> grid = std::make_shared<GridManager>( *eclipseState->getInputGrid(),
eclipseState->get3DProperties().getDoubleGridProperty( "PORV" ).getData() );
void initOPMTrans(TransGraph& opmTrans, const Deck& deck, const EclipseState& eclipseState) {
std::shared_ptr<GridManager> grid = std::make_shared<GridManager>( eclipseState.getInputGrid(),
eclipseState.get3DProperties().getDoubleGridProperty( "PORV" ).getData() );
const struct UnstructuredGrid * cGrid = grid->c_grid();
std::shared_ptr<BlackoilPropsAdInterface> props;
@ -317,7 +317,7 @@ void initEclipseTrans(TransGraph& eclipseTrans , const ecl_grid_type * ecl_grid
void dump_transGraph( DeckConstPtr deck , std::shared_ptr<const EclipseState> eclipseState , const ecl_grid_type * ecl_grid , const ecl_file_type * ecl_init) {
void dump_transGraph( const Deck& deck , const EclipseState& eclipseState , const ecl_grid_type * ecl_grid , const ecl_file_type * ecl_init) {
int nx = ecl_grid_get_nx( ecl_grid );
int ny = ecl_grid_get_ny( ecl_grid );
int nz = ecl_grid_get_nz( ecl_grid );
@ -344,12 +344,12 @@ int main(int argc, char** argv) {
std::string init_file = argv[2];
std::string grid_file = argv[3];
ParserPtr parser(new Parser());
Parser parser;
ParseContext parseContext;
std::cout << "Parsing input file ............: " << input_file << std::endl;
DeckConstPtr deck = parser->parseFile(input_file, parseContext);
std::shared_ptr<EclipseState> state = std::make_shared<EclipseState>( *deck , parseContext );
const Deck& deck = parser.parseFile(input_file, parseContext);
EclipseState state( deck , parseContext );
std::cout << "Loading eclipse INIT file .....: " << init_file << std::endl;
ecl_file_type * ecl_init = ecl_file_open( init_file.c_str() , 0 );

View File

@ -86,15 +86,15 @@ try
// If we have a "deck_filename", grid and props will be read from that.
bool use_deck = param.has("deck_filename");
EclipseStateConstPtr eclipseState;
std::shared_ptr< EclipseState > eclipseState;
std::unique_ptr<GridManager> grid;
std::unique_ptr<BlackoilPropertiesInterface> props;
std::unique_ptr<RockCompressibility> rock_comp;
std::unique_ptr<BlackoilState> state;
ParserPtr parser(new Opm::Parser());
Opm::DeckConstPtr deck;
Parser parser;
std::shared_ptr< Deck > deck;
// bool check_well_controls = false;
// int max_well_control_iterations = 0;
@ -102,27 +102,27 @@ try
if (use_deck) {
ParseContext parseContext;
std::string deck_filename = param.get<std::string>("deck_filename");
deck = parser->parseFile(deck_filename , parseContext);
*deck = parser.parseFile(deck_filename , parseContext);
eclipseState.reset(new EclipseState(*deck, parseContext));
// Grid init
grid.reset(new GridManager(*eclipseState->getInputGrid()));
grid.reset(new GridManager(eclipseState->getInputGrid()));
{
const UnstructuredGrid& ug_grid = *(grid->c_grid());
state.reset( new BlackoilState( UgGridHelpers::numCells( ug_grid ) , UgGridHelpers::numFaces( ug_grid ) ,2));
// Rock and fluid init
props.reset(new BlackoilPropertiesFromDeck(deck, eclipseState, ug_grid, param));
props.reset(new BlackoilPropertiesFromDeck(*deck, *eclipseState, ug_grid, param));
// check_well_controls = param.getDefault("check_well_controls", false);
// max_well_control_iterations = param.getDefault("max_well_control_iterations", 10);
// Rock compressibility.
rock_comp.reset(new RockCompressibility(deck, eclipseState));
rock_comp.reset(new RockCompressibility(*deck, *eclipseState));
// Gravity.
gravity[2] = deck->hasKeyword("NOGRAV") ? 0.0 : unit::gravity;
// Init state variables (saturation and pressure).
if (param.has("init_saturation")) {
initStateBasic(ug_grid, *props, param, gravity[2], *state);
} else {
initStateFromDeck(ug_grid, *props, deck, gravity[2], *state);
initStateFromDeck(ug_grid, *props, *deck, gravity[2], *state);
}
initBlackoilSurfvol(ug_grid, *props, *state);
}
@ -240,10 +240,10 @@ try
int step = 0;
SimulatorTimer simtimer;
// Use timer for last epoch to obtain total time.
Opm::TimeMapPtr timeMap(new Opm::TimeMap(deck));
Opm::TimeMap timeMap(*deck);
simtimer.init(timeMap);
const double total_time = simtimer.totalTime();
for (size_t reportStepIdx = 0; reportStepIdx < timeMap->numTimesteps(); ++reportStepIdx) {
for (size_t reportStepIdx = 0; reportStepIdx < timeMap.numTimesteps(); ++reportStepIdx) {
simtimer.setCurrentStepNum(step);
simtimer.setTotalTime(total_time);
@ -253,7 +253,7 @@ try
<< simtimer.numSteps() - step << ")\n\n" << std::flush;
// Create new wells, well_state
WellsManager wells(eclipseState , reportStepIdx , *grid->c_grid(), props->permeability());
WellsManager wells(*eclipseState , reportStepIdx , *grid->c_grid(), props->permeability());
// @@@ HACK: we should really make a new well state and
// properly transfer old well state to it every report step,
// since number of wells may change etc.

View File

@ -99,9 +99,9 @@ try
// If we have a "deck_filename", grid and props will be read from that.
bool use_deck = param.has("deck_filename");
EclipseStateConstPtr eclipseState;
std::shared_ptr< EclipseState > eclipseState;
Opm::DeckConstPtr deck;
std::shared_ptr< Deck > deck;
std::unique_ptr<GridManager> grid;
std::unique_ptr<IncompPropertiesInterface> props;
std::unique_ptr<RockCompressibility> rock_comp;
@ -110,30 +110,30 @@ try
// int max_well_control_iterations = 0;
double gravity[3] = { 0.0 };
if (use_deck) {
ParserPtr parser(new Opm::Parser());
Parser parser;
ParseContext parseContext;
std::string deck_filename = param.get<std::string>("deck_filename");
deck = parser->parseFile(deck_filename , parseContext);
*deck = parser.parseFile(deck_filename , parseContext);
eclipseState.reset( new EclipseState(*deck, parseContext));
// Grid init
grid.reset(new GridManager(*eclipseState->getInputGrid()));
grid.reset(new GridManager(eclipseState->getInputGrid()));
{
const UnstructuredGrid& ug_grid = *(grid->c_grid());
// Rock and fluid init
props.reset(new IncompPropertiesFromDeck(deck, eclipseState, ug_grid));
props.reset(new IncompPropertiesFromDeck(*deck, *eclipseState, ug_grid));
state.reset( new TwophaseState( UgGridHelpers::numCells( ug_grid ) , UgGridHelpers::numFaces( ug_grid )));
// Rock compressibility.
rock_comp.reset(new RockCompressibility(deck, eclipseState));
rock_comp.reset(new RockCompressibility(*deck, *eclipseState));
// Gravity.
gravity[2] = deck->hasKeyword("NOGRAV") ? 0.0 : unit::gravity;
// Init state variables (saturation and pressure).
if (param.has("init_saturation")) {
initStateBasic(ug_grid, *props, param, gravity[2], *state);
} else {
initStateFromDeck(ug_grid, *props, deck, gravity[2], *state);
initStateFromDeck(ug_grid, *props, *deck, gravity[2], *state);
}
}
} else {
@ -249,11 +249,11 @@ try
rep = simulator.run(simtimer, *state, well_state);
} else {
// With a deck, we may have more epochs etc.
Opm::TimeMapConstPtr timeMap = eclipseState->getSchedule()->getTimeMap();
const auto& timeMap = eclipseState->getSchedule().getTimeMap();
std::cout << "\n\n================ Starting main simulation loop ===============\n"
<< " (number of report steps: "
<< timeMap->numTimesteps() << ")\n\n" << std::flush;
<< timeMap.numTimesteps() << ")\n\n" << std::flush;
WellState well_state;
int step = 0;
SimulatorTimer simtimer;
@ -273,7 +273,7 @@ try
// << simtimer.numSteps() - step << ")\n\n" << std::flush;
// Create new wells, well_state
WellsManager wells(eclipseState , reportStepIdx , *grid->c_grid(), props->permeability());
WellsManager wells(*eclipseState , reportStepIdx , *grid->c_grid(), props->permeability());
// @@@ HACK: we should really make a new well state and
// properly transfer old well state to it every report step,
// since number of wells may change etc.

View File

@ -100,13 +100,13 @@ try
// If we have a "deck_filename", grid and props will be read from that.
bool use_deck = param.has("deck_filename");
Opm::ParserPtr parser(new Opm::Parser());
Opm::DeckConstPtr deck;
Opm::Parser parser;
std::shared_ptr< Opm::Deck > deck;
std::unique_ptr<GridManager> grid;
std::unique_ptr<IncompPropertiesInterface> props;
std::unique_ptr<RockCompressibility> rock_comp;
std::unique_ptr<TwophaseState> state;
EclipseStateConstPtr eclipseState;
std::shared_ptr< EclipseState > eclipseState;
// bool check_well_controls = false;
// int max_well_control_iterations = 0;
@ -114,29 +114,29 @@ try
if (use_deck) {
std::string deck_filename = param.get<std::string>("deck_filename");
Opm::ParseContext parseContext;
deck = parser->parseFile(deck_filename, parseContext);
*deck = parser.parseFile(deck_filename, parseContext);
eclipseState.reset(new EclipseState(*deck , parseContext));
// Grid init
grid.reset(new GridManager(*eclipseState->getInputGrid()));
grid.reset(new GridManager(eclipseState->getInputGrid()));
{
const UnstructuredGrid& ug_grid = *(grid->c_grid());
// Rock and fluid init
props.reset(new IncompPropertiesFromDeck(deck, eclipseState, ug_grid));
props.reset(new IncompPropertiesFromDeck(*deck, *eclipseState, ug_grid));
// check_well_controls = param.getDefault("check_well_controls", false);
// max_well_control_iterations = param.getDefault("max_well_control_iterations", 10);
state.reset( new TwophaseState( UgGridHelpers::numCells( ug_grid ) , UgGridHelpers::numFaces( ug_grid )));
// Rock compressibility.
rock_comp.reset(new RockCompressibility(deck, eclipseState));
rock_comp.reset(new RockCompressibility(*deck, *eclipseState));
// Gravity.
gravity[2] = deck->hasKeyword("NOGRAV") ? 0.0 : unit::gravity;
// Init state variables (saturation and pressure).
if (param.has("init_saturation")) {
initStateBasic(ug_grid, *props, param, gravity[2], *state);
} else {
initStateFromDeck(ug_grid, *props, deck, gravity[2], *state);
initStateFromDeck(ug_grid, *props, *deck, gravity[2], *state);
}
}
} else {
@ -254,16 +254,16 @@ try
} else {
// With a deck, we may have more report steps etc.
WellState well_state;
Opm::TimeMapPtr timeMap(new Opm::TimeMap(deck));
Opm::TimeMap timeMap(*deck);
SimulatorTimer simtimer;
for (size_t reportStepIdx = 0; reportStepIdx < timeMap->numTimesteps(); ++reportStepIdx) {
for (size_t reportStepIdx = 0; reportStepIdx < timeMap.numTimesteps(); ++reportStepIdx) {
// Report on start of report step.
std::cout << "\n\n-------------- Starting report step " << reportStepIdx << " --------------"
<< "\n (number of steps left: "
<< timeMap->numTimesteps() - reportStepIdx << ")\n\n" << std::flush;
<< timeMap.numTimesteps() - reportStepIdx << ")\n\n" << std::flush;
// Create new wells, well_state
WellsManager wells(eclipseState , reportStepIdx , *grid->c_grid(), props->permeability());
WellsManager wells(*eclipseState , reportStepIdx , *grid->c_grid(), props->permeability());
// @@@ HACK: we should really make a new well state and
// properly transfer old well state to it every report step,
// since number of wells may change etc.

View File

@ -90,35 +90,35 @@ try
boost::scoped_ptr<GridManager> grid;
boost::scoped_ptr<BlackoilPropertiesInterface> props;
boost::scoped_ptr<RockCompressibility> rock_comp;
Opm::DeckConstPtr deck;
EclipseStateConstPtr eclipseState;
std::unique_ptr<PolymerBlackoilState> state;
Opm::PolymerProperties poly_props;
Opm::Deck deck;
std::unique_ptr< EclipseState > eclipseState;
// bool check_well_controls = false;
// int max_well_control_iterations = 0;
double gravity[3] = { 0.0 };
if (use_deck) {
std::string deck_filename = param.get<std::string>("deck_filename");
ParserPtr parser(new Opm::Parser());
Parser parser;
Opm::ParseContext parseContext({{ ParseContext::PARSE_RANDOM_SLASH , InputError::IGNORE }});
deck = parser->parseFile(deck_filename , parseContext);
eclipseState.reset(new Opm::EclipseState(*deck , parseContext));
deck = parser.parseFile(deck_filename , parseContext);
eclipseState.reset( new EclipseState(deck , parseContext) );
// Grid init
grid.reset(new GridManager(*eclipseState->getInputGrid()));
grid.reset(new GridManager(eclipseState->getInputGrid()));
{
const UnstructuredGrid& ug_grid = *(grid->c_grid());
// Rock and fluid init
props.reset(new BlackoilPropertiesFromDeck(deck, eclipseState, ug_grid));
props.reset(new BlackoilPropertiesFromDeck(deck, *eclipseState, ug_grid));
// check_well_controls = param.getDefault("check_well_controls", false);
// max_well_control_iterations = param.getDefault("max_well_control_iterations", 10);
state.reset( new PolymerBlackoilState( UgGridHelpers::numCells( ug_grid ) , UgGridHelpers::numFaces( ug_grid ), 2));
// Rock compressibility.
rock_comp.reset(new RockCompressibility(deck, eclipseState));
rock_comp.reset(new RockCompressibility(deck, *eclipseState));
// Gravity.
gravity[2] = deck->hasKeyword("NOGRAV") ? 0.0 : unit::gravity;
gravity[2] = deck.hasKeyword("NOGRAV") ? 0.0 : unit::gravity;
// Init state variables (saturation and pressure).
if (param.has("init_saturation")) {
initStateBasic(ug_grid, *props, param, gravity[2], *state);
@ -127,7 +127,7 @@ try
}
initBlackoilSurfvol(ug_grid, *props, *state);
// Init polymer properties.
poly_props.readFromDeck(deck, eclipseState);
poly_props.readFromDeck(deck, *eclipseState);
}
} else {
// Grid init.
@ -264,19 +264,19 @@ try
// With a deck, we may have more epochs etc.
WellState well_state;
int step = 0;
Opm::TimeMapPtr timeMap(new Opm::TimeMap(deck));
Opm::TimeMap timeMap(deck);
SimulatorTimer simtimer;
simtimer.init(timeMap);
// Check for WPOLYMER presence in last report step to decide
// polymer injection control type.
const bool use_wpolymer = deck->hasKeyword("WPOLYMER");
const bool use_wpolymer = deck.hasKeyword("WPOLYMER");
if (use_wpolymer) {
if (param.has("poly_start_days")) {
OPM_MESSAGE("Warning: Using WPOLYMER to control injection since it was found in deck. "
"You seem to be trying to control it via parameter poly_start_days (etc.) as well.");
}
}
for (size_t reportStepIdx = 0; reportStepIdx < timeMap->numTimesteps(); ++reportStepIdx) {
for (size_t reportStepIdx = 0; reportStepIdx < timeMap.numTimesteps(); ++reportStepIdx) {
simtimer.setCurrentStepNum(reportStepIdx);
// Report on start of report step.
@ -285,13 +285,14 @@ try
<< simtimer.numSteps() - step << ")\n\n" << std::flush;
// Create new wells, polymer inflow controls.
WellsManager wells(eclipseState , reportStepIdx , *grid->c_grid(), props->permeability());
eclipseState.reset( new EclipseState( deck ) );
WellsManager wells(*eclipseState , reportStepIdx , *grid->c_grid(), props->permeability());
boost::scoped_ptr<PolymerInflowInterface> polymer_inflow;
if (use_wpolymer) {
if (wells.c_wells() == 0) {
OPM_THROW(std::runtime_error, "Cannot control polymer injection via WPOLYMER without wells.");
}
polymer_inflow.reset(new PolymerInflowFromDeck(eclipseState, *wells.c_wells(), props->numCells(), simtimer.currentStepNum()));
polymer_inflow.reset(new PolymerInflowFromDeck(*eclipseState, *wells.c_wells(), props->numCells(), simtimer.currentStepNum()));
} else {
polymer_inflow.reset(new PolymerInflowBasic(param.getDefault("poly_start_days", 300.0)*Opm::unit::day,
param.getDefault("poly_end_days", 800.0)*Opm::unit::day,

View File

@ -87,11 +87,11 @@ try
// If we have a "deck_filename", grid and props will be read from that.
bool use_deck = param.has("deck_filename");
Opm::DeckConstPtr deck;
std::shared_ptr< Deck > deck;
boost::scoped_ptr<GridManager> grid;
boost::scoped_ptr<IncompPropertiesInterface> props;
boost::scoped_ptr<RockCompressibility> rock_comp;
EclipseStateConstPtr eclipseState;
std::shared_ptr< EclipseState > eclipseState;
std::unique_ptr<PolymerState> state;
Opm::PolymerProperties poly_props;
// bool check_well_controls = false;
@ -100,33 +100,33 @@ try
if (use_deck) {
std::string deck_filename = param.get<std::string>("deck_filename");
Opm::ParseContext parseContext({{ ParseContext::PARSE_RANDOM_SLASH , InputError::IGNORE }});
ParserPtr parser(new Opm::Parser());
deck = parser->parseFile(deck_filename , parseContext);
Parser parser;
*deck = parser.parseFile(deck_filename , parseContext);
eclipseState.reset(new Opm::EclipseState(*deck , parseContext));
// Grid init
grid.reset(new GridManager(*eclipseState->getInputGrid()));
grid.reset(new GridManager(eclipseState->getInputGrid()));
{
const UnstructuredGrid& ug_grid = *(grid->c_grid());
// Rock and fluid init
props.reset(new IncompPropertiesFromDeck(deck, eclipseState, ug_grid ));
props.reset(new IncompPropertiesFromDeck(*deck, *eclipseState, ug_grid ));
// check_well_controls = param.getDefault("check_well_controls", false);
// max_well_control_iterations = param.getDefault("max_well_control_iterations", 10);
state.reset( new PolymerState( UgGridHelpers::numCells( ug_grid ) , UgGridHelpers::numFaces( ug_grid ), 2));
// Rock compressibility.
rock_comp.reset(new RockCompressibility(deck, eclipseState));
rock_comp.reset(new RockCompressibility(*deck, *eclipseState));
// Gravity.
gravity[2] = deck->hasKeyword("NOGRAV") ? 0.0 : unit::gravity;
// Init state variables (saturation and pressure).
if (param.has("init_saturation")) {
initStateBasic(ug_grid, *props, param, gravity[2], *state);
} else {
initStateFromDeck(ug_grid, *props, deck, gravity[2], *state);
initStateFromDeck(ug_grid, *props, *deck, gravity[2], *state);
}
// Init polymer properties.
poly_props.readFromDeck(deck, eclipseState);
poly_props.readFromDeck(*deck, *eclipseState);
}
} else {
// Grid init.
@ -299,7 +299,7 @@ try
WellState well_state;
int step = 0;
Opm::TimeMapPtr timeMap(new Opm::TimeMap(deck));
TimeMap timeMap(*deck);
SimulatorTimer simtimer;
simtimer.init(timeMap);
// Check for WPOLYMER presence in last epoch to decide
@ -311,7 +311,7 @@ try
"You seem to be trying to control it via parameter poly_start_days (etc.) as well.");
}
}
for (size_t reportStepIdx = 0; reportStepIdx < timeMap->numTimesteps(); ++reportStepIdx) {
for (size_t reportStepIdx = 0; reportStepIdx < timeMap.numTimesteps(); ++reportStepIdx) {
simtimer.setCurrentStepNum(reportStepIdx);
// Report on start of report step.
@ -320,13 +320,13 @@ try
<< simtimer.numSteps() - step << ")\n\n" << std::flush;
// Create new wells, polymer inflow controls.
WellsManager wells(eclipseState , reportStepIdx , *grid->c_grid(), props->permeability());
WellsManager wells(*eclipseState , reportStepIdx , *grid->c_grid(), props->permeability());
boost::scoped_ptr<PolymerInflowInterface> polymer_inflow;
if (use_wpolymer) {
if (wells.c_wells() == 0) {
OPM_THROW(std::runtime_error, "Cannot control polymer injection via WPOLYMER without wells.");
}
polymer_inflow.reset(new PolymerInflowFromDeck(eclipseState, *wells.c_wells(), props->numCells(), simtimer.currentStepNum()));
polymer_inflow.reset(new PolymerInflowFromDeck(*eclipseState, *wells.c_wells(), props->numCells(), simtimer.currentStepNum()));
} else {
polymer_inflow.reset(new PolymerInflowBasic(param.getDefault("poly_start_days", 300.0)*Opm::unit::day,
param.getDefault("poly_end_days", 800.0)*Opm::unit::day,

View File

@ -142,7 +142,7 @@ try
std::string logFile = output_dir + "/LOGFILE.txt";
Opm::ParseContext parseContext({{ ParseContext::PARSE_RANDOM_SLASH , InputError::IGNORE }});
Opm::ParserPtr parser(new Opm::Parser());
Opm::Parser parser;
{
std::shared_ptr<Opm::StreamLog> streamLog = std::make_shared<Opm::StreamLog>(logFile , Opm::Log::DefaultMessageTypes);
std::shared_ptr<Opm::CounterLog> counterLog = std::make_shared<Opm::CounterLog>(Opm::Log::DefaultMessageTypes);
@ -151,11 +151,11 @@ try
Opm::OpmLog::addBackend( "COUNTER" , counterLog );
}
Opm::DeckConstPtr deck;
std::shared_ptr< Deck > deck;
std::shared_ptr<EclipseState> eclipseState;
try {
deck = parser->parseFile(deck_filename , parseContext);
Opm::checkDeck(deck, parser);
*deck = parser.parseFile(deck_filename , parseContext);
Opm::checkDeck(*deck, parser);
eclipseState.reset(new Opm::EclipseState(*deck , parseContext));
}
catch (const std::invalid_argument& e) {
@ -168,12 +168,12 @@ try
if (eclipseState->get3DProperties().hasDeckDoubleGridProperty("PORV")) {
const auto& porv = eclipseState->get3DProperties().getDoubleGridProperty("PORV").getData();
grid.reset(new GridManager(*eclipseState->getInputGrid(), porv));
grid.reset(new GridManager(eclipseState->getInputGrid(), porv));
} else {
grid.reset(new GridManager(*eclipseState->getInputGrid()));
grid.reset(new GridManager(eclipseState->getInputGrid()));
}
auto &cGrid = *grid->c_grid();
const PhaseUsage pu = Opm::phaseUsageFromDeck(deck);
const PhaseUsage pu = Opm::phaseUsageFromDeck(*deck);
// Rock and fluid init
@ -182,21 +182,21 @@ try
typedef BlackoilPropsAdFromDeck::MaterialLawManager MaterialLawManager;
auto materialLawManager = std::make_shared<MaterialLawManager>();
materialLawManager->initFromDeck(deck, eclipseState, compressedToCartesianIdx);
materialLawManager->initFromDeck(*deck, *eclipseState, compressedToCartesianIdx);
props.reset(new BlackoilPropertiesFromDeck( deck, eclipseState, materialLawManager,
props.reset(new BlackoilPropertiesFromDeck( *deck, *eclipseState, materialLawManager,
Opm::UgGridHelpers::numCells(cGrid),
Opm::UgGridHelpers::globalCell(cGrid),
Opm::UgGridHelpers::cartDims(cGrid),
param));
state.reset( new PolymerBlackoilState( Opm::UgGridHelpers::numCells(cGrid), Opm::UgGridHelpers::numFaces(cGrid), 2));
new_props.reset(new BlackoilPropsAdFromDeck(deck, eclipseState, materialLawManager, cGrid));
PolymerProperties polymer_props(deck, eclipseState);
new_props.reset(new BlackoilPropsAdFromDeck(*deck, *eclipseState, materialLawManager, cGrid));
PolymerProperties polymer_props(*deck, *eclipseState);
PolymerPropsAd polymer_props_ad(polymer_props);
// Rock compressibility.
rock_comp.reset(new RockCompressibility(deck, eclipseState));
rock_comp.reset(new RockCompressibility(*deck, *eclipseState));
// Gravity.
gravity[2] = deck->hasKeyword("NOGRAV") ? 0.0 : unit::gravity;
@ -206,7 +206,7 @@ try
initStateBasic(*grid->c_grid(), *props, param, gravity[2], *state);
initBlackoilSurfvol(*grid->c_grid(), *props, *state);
} else {
initStateFromDeck(*grid->c_grid(), *props, deck, gravity[2], *state);
initStateFromDeck(*grid->c_grid(), *props, *deck, gravity[2], *state);
}
bool use_gravity = (gravity[0] != 0.0 || gravity[1] != 0.0 || gravity[2] != 0.0);
@ -219,7 +219,7 @@ try
fis_solver.reset(new NewtonIterationBlackoilSimple(param));
}
Opm::TimeMapConstPtr timeMap(eclipseState->getSchedule()->getTimeMap());
const auto timeMap = eclipseState->getSchedule().getTimeMap();
SimulatorTimer simtimer;
simtimer.init(timeMap);
@ -240,12 +240,12 @@ try
<< std::flush;
Opm::BlackoilOutputWriter
outputWriter(cGrid, param, eclipseState, pu,
outputWriter(cGrid, param, *eclipseState, pu,
new_props->permeability() );
SimulatorReport fullReport;
// Create and run simulator.
Opm::DerivedGeology geology(*grid->c_grid(), *new_props, eclipseState, grav);
Opm::DerivedGeology geology(*grid->c_grid(), *new_props, *eclipseState, grav);
SimulatorFullyImplicitCompressiblePolymer<UnstructuredGrid>
simulator(param,
*grid->c_grid(),

View File

@ -67,7 +67,7 @@ namespace Opm {
const RockCompressibility* rock_comp_props,
const StandardWells& std_wells,
const NewtonIterationBlackoilInterface& linsolver,
Opm::EclipseStateConstPtr eclState,
std::shared_ptr< const Opm::EclipseState > eclState,
const bool has_disgas,
const bool has_vapoil,
const bool terminal_output)

View File

@ -176,7 +176,7 @@ namespace Opm {
const RockCompressibility* rock_comp_props,
const WellModel& well_model,
const NewtonIterationBlackoilInterface& linsolver,
Opm::EclipseStateConstPtr eclState,
std::shared_ptr< const EclipseState > eclState,
const bool has_disgas,
const bool has_vapoil,
const bool terminal_output);

View File

@ -169,7 +169,7 @@ namespace detail {
const RockCompressibility* rock_comp_props,
const WellModel& well_model,
const NewtonIterationBlackoilInterface& linsolver,
Opm::EclipseStateConstPtr eclState,
std::shared_ptr< const Opm::EclipseState > eclState,
const bool has_disgas,
const bool has_vapoil,
const bool terminal_output)

View File

@ -88,7 +88,7 @@ namespace Opm {
const RockCompressibility* rock_comp_props,
const MultisegmentWells& well_model,
const NewtonIterationBlackoilInterface& linsolver,
Opm::EclipseStateConstPtr eclState,
std::shared_ptr< const EclipseState > eclState,
const bool has_disgas,
const bool has_vapoil,
const bool terminal_output);

View File

@ -64,7 +64,7 @@ namespace Opm {
const RockCompressibility* rock_comp_props,
const MultisegmentWells& well_model,
const NewtonIterationBlackoilInterface& linsolver,
Opm::EclipseStateConstPtr eclState,
std::shared_ptr< const EclipseState > eclState,
const bool has_disgas,
const bool has_vapoil,
const bool terminal_output)

View File

@ -71,7 +71,7 @@ namespace Opm {
const RockCompressibility* rock_comp_props,
const StandardWells& std_wells,
const NewtonIterationBlackoilInterface& linsolver,
Opm::EclipseStateConstPtr eclState,
std::shared_ptr< const EclipseState> eclState,
const bool has_disgas,
const bool has_vapoil,
const bool terminal_output)

View File

@ -44,8 +44,8 @@ namespace Opm
typedef Eigen::Array<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> Block;
/// Constructor wrapping an opm-core black oil interface.
BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(Opm::DeckConstPtr deck,
Opm::EclipseStateConstPtr eclState,
BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const Opm::Deck& deck,
const Opm::EclipseState& eclState,
std::shared_ptr<MaterialLawManager> materialLawManager,
const UnstructuredGrid& grid,
const bool init_rock)
@ -56,8 +56,8 @@ namespace Opm
#ifdef HAVE_OPM_GRID
/// Constructor wrapping an opm-core black oil interface.
BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(Opm::DeckConstPtr deck,
Opm::EclipseStateConstPtr eclState,
BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const Opm::Deck& deck,
const Opm::EclipseState& eclState,
const Dune::CpGrid& grid,
const bool init_rock )
{
@ -75,8 +75,8 @@ namespace Opm
#endif
/// Constructor wrapping an opm-core black oil interface.
BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(Opm::DeckConstPtr deck,
Opm::EclipseStateConstPtr eclState,
BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const Opm::Deck& deck,
const Opm::EclipseState& eclState,
const UnstructuredGrid& grid,
const bool init_rock)
{
@ -97,8 +97,8 @@ namespace Opm
#ifdef HAVE_OPM_GRID
/// Constructor wrapping an opm-core black oil interface.
BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(Opm::DeckConstPtr deck,
Opm::EclipseStateConstPtr eclState,
BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const Opm::Deck& deck,
const Opm::EclipseState& eclState,
std::shared_ptr<MaterialLawManager> materialLawManager,
const Dune::CpGrid& grid,
const bool init_rock )
@ -141,8 +141,8 @@ BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const BlackoilPropsAdFromDeck&
}
/// Initializes the properties.
void BlackoilPropsAdFromDeck::init(Opm::DeckConstPtr deck,
Opm::EclipseStateConstPtr eclState,
void BlackoilPropsAdFromDeck::init(const Opm::Deck& deck,
const Opm::EclipseState& eclState,
std::shared_ptr<MaterialLawManager> materialLawManager,
int number_of_cells,
const int* global_cell,
@ -170,9 +170,9 @@ BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const BlackoilPropsAdFromDeck&
waterPvt_->initFromDeck(deck, eclState);
// Surface densities. Accounting for different orders in eclipse and our code.
const auto& densityKeyword = deck->getKeyword("DENSITY");
const auto& densityKeyword = deck.getKeyword("DENSITY");
int numRegions = densityKeyword.size();
auto tables = eclState->getTableManager();
auto tables = eclState.getTableManager();
surfaceDensity_.resize(numRegions);
for (int regionIdx = 0; regionIdx < numRegions; ++regionIdx) {
@ -192,11 +192,11 @@ BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const BlackoilPropsAdFromDeck&
// Oil vaporization controls (kw VAPPARS)
vap1_ = vap2_ = 0.0;
if (deck->hasKeyword("VAPPARS") && deck->hasKeyword("VAPOIL") && deck->hasKeyword("DISGAS")) {
vap1_ = deck->getKeyword("VAPPARS").getRecord(0).getItem(0).get< double >(0);
vap2_ = deck->getKeyword("VAPPARS").getRecord(0).getItem(1).get< double >(0);
if (deck.hasKeyword("VAPPARS") && deck.hasKeyword("VAPOIL") && deck.hasKeyword("DISGAS")) {
vap1_ = deck.getKeyword("VAPPARS").getRecord(0).getItem(0).get< double >(0);
vap2_ = deck.getKeyword("VAPPARS").getRecord(0).getItem(1).get< double >(0);
satOilMax_.resize(number_of_cells, 0.0);
} else if (deck->hasKeyword("VAPPARS")) {
} else if (deck.hasKeyword("VAPPARS")) {
OPM_THROW(std::runtime_error, "Input has VAPPARS, but missing VAPOIL and/or DISGAS\n");
}

View File

@ -85,8 +85,8 @@ namespace Opm
/// \param grid The grid upon which the simulation is run on.
/// \param init_rock If true the rock properties (rock compressibility and
/// reference pressure) are read from the deck
BlackoilPropsAdFromDeck(Opm::DeckConstPtr deck,
Opm::EclipseStateConstPtr eclState,
BlackoilPropsAdFromDeck(const Opm::Deck& deck,
const Opm::EclipseState& eclState,
std::shared_ptr<MaterialLawManager> materialLawManager,
const UnstructuredGrid& grid,
const bool init_rock = true );
@ -106,8 +106,8 @@ namespace Opm
/// \param grid The grid upon which the simulation is run on.
/// \param init_rock If true the rock properties (rock compressibility and
/// reference pressure) are read from the deck
BlackoilPropsAdFromDeck(Opm::DeckConstPtr deck,
Opm::EclipseStateConstPtr eclState,
BlackoilPropsAdFromDeck(const Opm::Deck& deck,
const Opm::EclipseState& eclState,
std::shared_ptr<MaterialLawManager> materialLawManager,
const Dune::CpGrid& grid,
const bool init_rock = true );
@ -120,8 +120,8 @@ namespace Opm
/// \param grid The grid upon which the simulation is run on.
/// \param init_rock If true the rock properties (rock compressibility and
/// reference pressure) are read from the deck
BlackoilPropsAdFromDeck(Opm::DeckConstPtr deck,
Opm::EclipseStateConstPtr eclState,
BlackoilPropsAdFromDeck(const Opm::Deck& deck,
const Opm::EclipseState& eclState,
const UnstructuredGrid& grid,
const bool init_rock = true );
@ -133,8 +133,8 @@ namespace Opm
/// \param grid The grid upon which the simulation is run on.
/// \param init_rock If true the rock properties (rock compressibility and
/// reference pressure) are read from the deck
BlackoilPropsAdFromDeck(Opm::DeckConstPtr deck,
Opm::EclipseStateConstPtr eclState,
BlackoilPropsAdFromDeck(const Opm::Deck& deck,
const Opm::EclipseState& eclState,
const Dune::CpGrid& grid,
const bool init_rock = true );
#endif
@ -383,8 +383,8 @@ namespace Opm
private:
/// Initializes the properties.
void init(Opm::DeckConstPtr deck,
Opm::EclipseStateConstPtr eclState,
void init(const Opm::Deck& deck,
const Opm::EclipseState& eclState,
std::shared_ptr<MaterialLawManager> materialLawManager,
int number_of_cells,
const int* global_cell,

View File

@ -79,7 +79,7 @@ namespace Opm {
const RockCompressibility* rock_comp_props,
const WellModel well_model,
const NewtonIterationBlackoilInterface& linsolver,
Opm::EclipseStateConstPtr eclState,
std::shared_ptr< const EclipseState > eclState,
const bool has_disgas,
const bool has_vapoil,
const bool terminal_output)

View File

@ -73,7 +73,7 @@ namespace Opm {
const SolventPropsAdFromDeck& solvent_props,
const StandardWellsSolvent& well_model,
const NewtonIterationBlackoilInterface& linsolver,
const EclipseStateConstPtr eclState,
std::shared_ptr< const EclipseState > eclState,
const bool has_disgas,
const bool has_vapoil,
const bool terminal_output,

View File

@ -78,7 +78,7 @@ namespace Opm {
const SolventPropsAdFromDeck& solvent_props,
const StandardWellsSolvent& well_model,
const NewtonIterationBlackoilInterface& linsolver,
const EclipseStateConstPtr eclState,
std::shared_ptr< const EclipseState > eclState,
const bool has_disgas,
const bool has_vapoil,
const bool terminal_output,

View File

@ -64,7 +64,7 @@ namespace Opm {
const RockCompressibility* rock_comp_props,
const StandardWells& std_wells,
const NewtonIterationBlackoilInterface& linsolver,
Opm::EclipseStateConstPtr eclState,
std::shared_ptr<const EclipseState> eclState,
const bool has_disgas,
const bool has_vapoil,
const bool terminal_output)

View File

@ -204,7 +204,7 @@ namespace Opm
bool output_to_files_ = false;
std::string output_dir_ = std::string(".");
// readDeckInput()
std::shared_ptr<const Deck> deck_;
std::shared_ptr<Deck> deck_;
std::shared_ptr<EclipseState> eclipse_state_;
// setupGridAndProps()
std::unique_ptr<GridInit<Grid>> grid_init_;
@ -472,13 +472,13 @@ namespace Opm
std::string deck_filename = param_.get<std::string>("deck_filename");
// Create Parser
ParserPtr parser(new Parser());
Parser parser;
// Create Deck and EclipseState.
try {
ParseContext parseContext({{ ParseContext::PARSE_RANDOM_SLASH , InputError::IGNORE }});
deck_ = parser->parseFile(deck_filename, parseContext);
checkDeck(deck_, parser);
deck_ = std::make_shared< Deck >( parser.parseFile(deck_filename, parseContext) );
checkDeck(*deck_, parser);
if ( output_cout_)
{
@ -486,8 +486,8 @@ namespace Opm
}
eclipse_state_.reset(new EclipseState(*deck_, parseContext));
auto ioConfig = eclipse_state_->getIOConfig();
ioConfig->setOutputDir(output_dir_);
auto& ioConfig = eclipse_state_->getIOConfig();
ioConfig.setOutputDir(output_dir_);
}
catch (const std::invalid_argument& e) {
std::cerr << "Failed to create valid EclipseState object. See logfile: " << logFile_ << std::endl;
@ -504,8 +504,8 @@ namespace Opm
// Possible to force initialization only behavior (NOSIM).
if (param_.has("nosim")) {
const bool nosim = param_.get<bool>("nosim");
IOConfigPtr ioConfig = eclipse_state_->getIOConfig();
ioConfig->overrideNOSIM( nosim );
auto& ioConfig = eclipse_state_->getIOConfig();
ioConfig.overrideNOSIM( nosim );
}
}
@ -527,20 +527,20 @@ namespace Opm
// Create grid.
const std::vector<double>& porv =
eclipse_state_->get3DProperties().getDoubleGridProperty("PORV").getData();
grid_init_.reset(new GridInit<Grid>(eclipse_state_, porv));
grid_init_.reset(new GridInit<Grid>(*eclipse_state_, porv));
const Grid& grid = grid_init_->grid();
// Create material law manager.
std::vector<int> compressedToCartesianIdx;
Opm::createGlobalCellArray(grid, compressedToCartesianIdx);
material_law_manager_.reset(new MaterialLawManager());
material_law_manager_->initFromDeck(deck_, eclipse_state_, compressedToCartesianIdx);
material_law_manager_->initFromDeck(*deck_, *eclipse_state_, compressedToCartesianIdx);
// Rock and fluid properties.
fluidprops_.reset(new BlackoilPropsAdFromDeck(deck_, eclipse_state_, material_law_manager_, grid));
fluidprops_.reset(new BlackoilPropsAdFromDeck(*deck_, *eclipse_state_, material_law_manager_, grid));
// Rock compressibility.
rock_comp_.reset(new RockCompressibility(deck_, eclipse_state_));
rock_comp_.reset(new RockCompressibility(*deck_, *eclipse_state_));
// Gravity.
assert(UgGridHelpers::dimensions(grid) == 3);
@ -551,7 +551,7 @@ namespace Opm
// Geological properties
use_local_perm_ = param_.getDefault("use_local_perm", use_local_perm_);
geoprops_.reset(new DerivedGeology(grid, *fluidprops_, eclipse_state_, use_local_perm_, gravity_.data()));
geoprops_.reset(new DerivedGeology(grid, *fluidprops_, *eclipse_state_, use_local_perm_, gravity_.data()));
}
@ -565,11 +565,11 @@ namespace Opm
// fluidprops_ (if SWATINIT is used)
void setupState()
{
const PhaseUsage pu = Opm::phaseUsageFromDeck(deck_);
const PhaseUsage pu = Opm::phaseUsageFromDeck(*deck_);
const Grid& grid = grid_init_->grid();
// Need old-style fluid object for init purposes (only).
BlackoilPropertiesFromDeck props( deck_, eclipse_state_, material_law_manager_,
BlackoilPropertiesFromDeck props( *deck_, *eclipse_state_, material_law_manager_,
Opm::UgGridHelpers::numCells(grid),
Opm::UgGridHelpers::globalCell(grid),
Opm::UgGridHelpers::cartDims(grid),
@ -613,7 +613,7 @@ namespace Opm
Opm::UgGridHelpers::numFaces(grid),
props.numPhases()));
initStateEquil(grid, props, deck_, eclipse_state_, gravity_[2], *state_);
initStateEquil(grid, props, *deck_, *eclipse_state_, gravity_[2], *state_);
//state_.faceflux().resize(Opm::UgGridHelpers::numFaces(grid), 0.0);
} else {
state_.reset( new ReservoirState( Opm::UgGridHelpers::numCells(grid),
@ -626,14 +626,14 @@ namespace Opm
Opm::UgGridHelpers::beginFaceCentroids(grid),
Opm::UgGridHelpers::beginCellCentroids(grid),
Opm::UgGridHelpers::dimensions(grid),
props, deck_, gravity_[2], *state_);
props, *deck_, gravity_[2], *state_);
}
// Threshold pressures.
std::map<std::pair<int, int>, double> maxDp;
computeMaxDp(maxDp, deck_, eclipse_state_, grid_init_->grid(), *state_, props, gravity_[2]);
threshold_pressures_ = thresholdPressures(deck_, eclipse_state_, grid, maxDp);
std::vector<double> threshold_pressures_nnc = thresholdPressuresNNC(eclipse_state_, geoprops_->nnc(), maxDp);
computeMaxDp(maxDp, *deck_, *eclipse_state_, grid_init_->grid(), *state_, props, gravity_[2]);
threshold_pressures_ = thresholdPressures(*deck_, *eclipse_state_, grid, maxDp);
std::vector<double> threshold_pressures_nnc = thresholdPressuresNNC(*eclipse_state_, geoprops_->nnc(), maxDp);
threshold_pressures_.insert(threshold_pressures_.end(), threshold_pressures_nnc.begin(), threshold_pressures_nnc.end());
// The capillary pressure is scaled in fluidprops_ to match the scaled capillary pressure in props.
@ -669,7 +669,7 @@ namespace Opm
// and initilialize new properties and states for it.
if (must_distribute_) {
defunct_well_names_ =
distributeGridAndData(grid_init_->grid(), deck_, eclipse_state_,
distributeGridAndData(grid_init_->grid(), *deck_, *eclipse_state_,
*state_, *fluidprops_, *geoprops_,
material_law_manager_, threshold_pressures_,
parallel_information_, use_local_perm_);
@ -727,7 +727,7 @@ namespace Opm
// Run relperm diagnostics
RelpermDiagnostics diagnostic;
diagnostic.diagnosis(eclipse_state_, deck_, grid_init_->grid());
diagnostic.diagnosis(*eclipse_state_, *deck_, grid_init_->grid());
}
@ -738,8 +738,8 @@ namespace Opm
const Grid& grid = grid_init_->grid();
if( output && output_ecl && output_cout_)
{
const EclipseGrid& inputGrid = *eclipse_state_->getInputGrid();
EclipseWriter writer(eclipse_state_, UgGridHelpers::createEclipseGrid( grid , inputGrid ));
const EclipseGrid& inputGrid = eclipse_state_->getInputGrid();
EclipseWriter writer(*eclipse_state_, UgGridHelpers::createEclipseGrid( grid , inputGrid ));
writer.writeInitAndEgrid(geoprops_->simProps(grid),
geoprops_->nonCartesianConnections());
}
@ -756,8 +756,8 @@ namespace Opm
// the global view
output_writer_.reset(new BlackoilOutputWriter(grid_init_->grid(),
param_,
eclipse_state_,
Opm::phaseUsageFromDeck(deck_),
*eclipse_state_,
Opm::phaseUsageFromDeck(*deck_),
fluidprops_->permeability()));
}
@ -802,16 +802,16 @@ namespace Opm
// Returns EXIT_SUCCESS if it does not throw.
int runSimulator()
{
Opm::ScheduleConstPtr schedule = eclipse_state_->getSchedule();
Opm::TimeMapConstPtr timeMap(schedule->getTimeMap());
std::shared_ptr<IOConfig> ioConfig = eclipse_state_->getIOConfig();
const auto& schedule = eclipse_state_->getSchedule();
const auto& timeMap = schedule.getTimeMap();
auto& ioConfig = eclipse_state_->getIOConfig();
SimulatorTimer simtimer;
// initialize variables
const auto& initConfig = eclipse_state_->getInitConfig();
simtimer.init(timeMap, (size_t)initConfig.getRestartStep());
if (!ioConfig->initOnly()) {
if (!ioConfig.initOnly()) {
if (output_cout_) {
std::string msg;
msg = "\n\n================ Starting main simulation loop ===============\n";

View File

@ -84,7 +84,7 @@ namespace Opm
Base::setupGridAndProps();
if (Base::deck_->hasKeyword("POLYMER")) {
polymer_props_legacy_.reset(new PolymerProperties(Base::deck_, Base::eclipse_state_));
polymer_props_legacy_.reset(new PolymerProperties(*Base::deck_, *Base::eclipse_state_));
polymer_props_.reset(new PolymerPropsAd(*polymer_props_legacy_));
}
}

View File

@ -74,8 +74,8 @@ namespace Opm
Base::setupGridAndProps();
const Grid& grid = Base::grid_init_->grid();
solvent_props_.reset(new SolventPropsAdFromDeck(Base::deck_,
Base::eclipse_state_,
solvent_props_.reset(new SolventPropsAdFromDeck(*Base::deck_,
*Base::eclipse_state_,
UgGridHelpers::numCells(grid),
UgGridHelpers::globalCell(grid)));
}

View File

@ -66,7 +66,7 @@ namespace Opm
template <class Props, class Grid>
DerivedGeology(const Grid& grid,
const Props& props ,
Opm::EclipseStateConstPtr eclState,
const EclipseState& eclState,
const bool use_local_perm,
const double* grav = 0
@ -84,7 +84,7 @@ namespace Opm
template <class Props, class Grid>
void update(const Grid& grid,
const Props& props ,
Opm::EclipseStateConstPtr eclState,
const EclipseState& eclState,
const double* grav)
{
@ -98,7 +98,7 @@ namespace Opm
// get the pore volume multipliers from the EclipseState
std::vector<double> multpv(numCartesianCells, 1.0);
const auto& eclProps = eclState->get3DProperties();
const auto& eclProps = eclState.get3DProperties();
if (eclProps.hasDeckDoubleGridProperty("MULTPV")) {
multpv = eclProps.getDoubleGridProperty("MULTPV").getData();
}
@ -110,13 +110,13 @@ namespace Opm
}
// Get grid from parser.
EclipseGridConstPtr eclgrid = eclState->getInputGrid();
const auto& eclgrid = eclState.getInputGrid();
// update the pore volume of all active cells in the grid
computePoreVolume_(grid, eclState);
// Non-neighbour connections.
nnc_ = eclState->getInputNNC();
nnc_ = eclState.getInputNNC();
// Transmissibility
Vector htrans(AutoDiffGrid::numCellFaces(grid));
@ -134,7 +134,7 @@ namespace Opm
// for MINPV. Note that the change does not effect the pore volume calculations
// as the pore volume is currently defaulted to be comparable to ECLIPSE, but
// only the transmissibility calculations.
bool opmfil = eclgrid->getMinpvMode() == MinpvMode::ModeEnum::OpmFIL;
bool opmfil = eclgrid.getMinpvMode() == MinpvMode::ModeEnum::OpmFIL;
// opmfil is hardcoded to be true. i.e the volume weighting is always used
opmfil = true;
if (opmfil) {
@ -144,9 +144,9 @@ namespace Opm
std::vector<double> mult;
multiplyHalfIntersections_(grid, eclState, ntg, htrans, mult);
if (!opmfil && eclgrid->isPinchActive()) {
if (!opmfil && eclgrid.isPinchActive()) {
// opmfil is hardcoded to be true. i.e the pinch processor is never used
pinchProcess_(grid, *eclState, htrans, numCells);
pinchProcess_(grid, eclState, htrans, numCells);
}
// combine the half-face transmissibilites into the final face
@ -273,40 +273,40 @@ namespace Opm
private:
template <class Grid>
void multiplyHalfIntersections_(const Grid &grid,
Opm::EclipseStateConstPtr eclState,
const EclipseState& eclState,
const std::vector<double> &ntg,
Vector &halfIntersectTransmissibility,
std::vector<double> &intersectionTransMult);
template <class Grid>
void tpfa_loc_trans_compute_(const Grid &grid,
Opm::EclipseGridConstPtr eclGrid,
const EclipseGrid& eclGrid,
const double* perm,
Vector &hTrans);
template <class Grid>
void minPvFillProps_(const Grid &grid,
Opm::EclipseStateConstPtr eclState,
const EclipseState& eclState,
std::vector<double> &ntg);
template <class GridType>
void computePoreVolume_(const GridType &grid,
Opm::EclipseStateConstPtr eclState)
const EclipseState& eclState)
{
int numCells = Opm::AutoDiffGrid::numCells(grid);
const int* globalCell = Opm::UgGridHelpers::globalCell(grid);
EclipseGridConstPtr eclGrid = eclState->getInputGrid();
const int nx = eclGrid->getNX();
const int ny = eclGrid->getNY();
const auto& eclGrid = eclState.getInputGrid();
const int nx = eclGrid.getNX();
const int ny = eclGrid.getNY();
// the "raw" pore volume.
const std::vector<double>& porvData =
eclState->get3DProperties().getDoubleGridProperty("PORV").getData();
eclState.get3DProperties().getDoubleGridProperty("PORV").getData();
pvol_.resize(numCells);
// the "activation number" grid property
const std::vector<int>& actnumData =
eclState->get3DProperties().getIntGridProperty("ACTNUM").getData();
eclState.get3DProperties().getIntGridProperty("ACTNUM").getData();
for (int cellIdx = 0; cellIdx < numCells; ++cellIdx) {
@ -314,20 +314,20 @@ namespace Opm
double cellPoreVolume = porvData[cellCartIdx];
if (eclGrid->getMinpvMode() == MinpvMode::ModeEnum::OpmFIL) {
if (eclGrid.getMinpvMode() == MinpvMode::ModeEnum::OpmFIL) {
// Sum the pore volumes of the cells above which have been deactivated
// because their volume less is less than the MINPV threshold
for (int aboveCellCartIdx = cellCartIdx - nx*ny;
aboveCellCartIdx >= 0;
aboveCellCartIdx -= nx*ny)
{
if (porvData[aboveCellCartIdx] >= eclGrid->getMinpvValue()) {
if (porvData[aboveCellCartIdx] >= eclGrid.getMinpvValue()) {
// stop if we encounter a cell which has a pore volume which is
// at least as large as the minimum one
break;
}
const double aboveCellVolume = eclGrid->getCellVolume(aboveCellCartIdx);
const double aboveCellVolume = eclGrid.getCellVolume(aboveCellCartIdx);
if (actnumData[aboveCellCartIdx] == 0 && aboveCellVolume > 1e-6) {
// stop at explicitly disabled cells, but only if their volume is
// greater than 10^-6 m^3
@ -411,22 +411,22 @@ namespace Opm
template <class GridType>
inline void DerivedGeology::minPvFillProps_(const GridType &grid,
Opm::EclipseStateConstPtr eclState,
const EclipseState& eclState,
std::vector<double> &ntg)
{
int numCells = Opm::AutoDiffGrid::numCells(grid);
const int* global_cell = Opm::UgGridHelpers::globalCell(grid);
const int* cartdims = Opm::UgGridHelpers::cartDims(grid);
EclipseGridConstPtr eclgrid = eclState->getInputGrid();
const auto& porv = eclState->get3DProperties().getDoubleGridProperty("PORV").getData();
const auto& actnum = eclState->get3DProperties().getIntGridProperty("ACTNUM").getData();
const auto& eclgrid = eclState.getInputGrid();
const auto& porv = eclState.get3DProperties().getDoubleGridProperty("PORV").getData();
const auto& actnum = eclState.get3DProperties().getIntGridProperty("ACTNUM").getData();
for (int cellIdx = 0; cellIdx < numCells; ++cellIdx) {
const int nx = cartdims[0];
const int ny = cartdims[1];
const int cartesianCellIdx = global_cell[cellIdx];
const double cellVolume = eclgrid->getCellVolume(cartesianCellIdx);
const double cellVolume = eclgrid.getCellVolume(cartesianCellIdx);
ntg[cartesianCellIdx] *= cellVolume;
double totalCellVolume = cellVolume;
@ -435,10 +435,10 @@ namespace Opm
int cartesianCellIdxAbove = cartesianCellIdx - nx*ny;
while ( cartesianCellIdxAbove >= 0 &&
actnum[cartesianCellIdxAbove] > 0 &&
porv[cartesianCellIdxAbove] < eclgrid->getMinpvValue() ) {
porv[cartesianCellIdxAbove] < eclgrid.getMinpvValue() ) {
// Volume weighted arithmetic average of NTG
const double cellAboveVolume = eclgrid->getCellVolume(cartesianCellIdxAbove);
const double cellAboveVolume = eclgrid.getCellVolume(cartesianCellIdxAbove);
totalCellVolume += cellAboveVolume;
ntg[cartesianCellIdx] += ntg[cartesianCellIdxAbove]*cellAboveVolume;
cartesianCellIdxAbove -= nx*ny;
@ -460,17 +460,17 @@ namespace Opm
// opmfil being hardcoded to be true.
auto eclgrid = eclState.getInputGrid();
auto& eclProps = eclState.get3DProperties();
const double minpv = eclgrid->getMinpvValue();
const double thickness = eclgrid->getPinchThresholdThickness();
auto transMode = eclgrid->getPinchOption();
auto multzMode = eclgrid->getMultzOption();
const double minpv = eclgrid.getMinpvValue();
const double thickness = eclgrid.getPinchThresholdThickness();
auto transMode = eclgrid.getPinchOption();
auto multzMode = eclgrid.getMultzOption();
PinchProcessor<GridType> pinch(minpv, thickness, transMode, multzMode);
std::vector<double> htrans_copy(htrans.size());
std::copy_n(htrans.data(), htrans.size(), htrans_copy.begin());
std::vector<int> actnum;
eclgrid->exportACTNUM(actnum);
eclgrid.exportACTNUM(actnum);
const auto& transMult = eclState.getTransMult();
std::vector<double> multz(numCells, 0.0);
@ -490,7 +490,7 @@ namespace Opm
template <class GridType>
inline void DerivedGeology::multiplyHalfIntersections_(const GridType &grid,
Opm::EclipseStateConstPtr eclState,
const EclipseState& eclState,
const std::vector<double> &ntg,
Vector &halfIntersectTransmissibility,
std::vector<double> &intersectionTransMult)
@ -501,7 +501,7 @@ namespace Opm
intersectionTransMult.resize(numIntersections);
std::fill(intersectionTransMult.begin(), intersectionTransMult.end(), 1.0);
const TransMult& multipliers = eclState->getTransMult();
const TransMult& multipliers = eclState.getTransMult();
auto cell2Faces = Opm::UgGridHelpers::cell2Faces(grid);
auto faceCells = Opm::AutoDiffGrid::faceCells(grid);
const int* global_cell = Opm::UgGridHelpers::globalCell(grid);
@ -579,7 +579,7 @@ namespace Opm
template <class GridType>
inline void DerivedGeology::tpfa_loc_trans_compute_(const GridType& grid,
Opm::EclipseGridConstPtr eclGrid,
const EclipseGrid& eclGrid,
const double* perm,
Vector& hTrans){
@ -631,7 +631,7 @@ namespace Opm
#endif
int cartesianCellIdx = AutoDiffGrid::globalCell(grid)[cellIdx];
auto cellCenter = eclGrid->getCellCenter(cartesianCellIdx);
auto cellCenter = eclGrid.getCellCenter(cartesianCellIdx);
for (int indx = 0; indx < dim; ++indx) {
const double Ci = Opm::UgGridHelpers::faceCentroid(grid, faceIdx)[indx] - cellCenter[indx];
dist += Ci*Ci;

View File

@ -40,7 +40,7 @@ namespace Opm
{
public:
/// Initialize from a deck and/or an eclipse state and (logical cartesian) specified pore volumes.
GridInit(EclipseStateConstPtr, const std::vector<double>&)
GridInit(const EclipseState&, const std::vector<double>&)
{
OPM_THROW(std::logic_error, "Found no specialization for GridInit for the requested Grid class.");
}
@ -53,8 +53,8 @@ namespace Opm
{
public:
/// Initialize from a deck and/or an eclipse state and (logical cartesian) specified pore volumes.
GridInit(EclipseStateConstPtr eclipse_state, const std::vector<double>& porv)
: grid_manager_(*eclipse_state->getInputGrid(), porv)
GridInit(const EclipseState& eclipse_state, const std::vector<double>& porv)
: grid_manager_(eclipse_state.getInputGrid(), porv)
{
}
/// Access the created grid.
@ -74,9 +74,9 @@ namespace Opm
{
public:
/// Initialize from a deck and/or an eclipse state and (logical cartesian) specified pore volumes.
GridInit(EclipseStateConstPtr eclipse_state, const std::vector<double>& porv)
GridInit(const EclipseState& eclipse_state, const std::vector<double>& porv)
{
grid_.processEclipseFormat(*eclipse_state->getInputGrid(), false, false, false, porv);
grid_.processEclipseFormat(eclipse_state.getInputGrid(), false, false, false, porv);
}
/// Access the created grid. Note that mutable access may be required for load balancing.
Dune::CpGrid& grid()

View File

@ -73,7 +73,7 @@ namespace Opm
public:
ParallelDebugOutput ( const GridImpl& grid,
Opm::EclipseStateConstPtr /* eclipseState */,
const EclipseState& /* eclipseState */,
const int,
const double* )
: grid_( grid ) {}
@ -229,7 +229,7 @@ namespace Opm
enum { ioRank = 0 };
ParallelDebugOutput( const Dune::CpGrid& otherGrid,
Opm::EclipseStateConstPtr eclipseState,
const EclipseState& eclipseState,
const int numPhases,
const double* permeability )
: grid_(),
@ -593,7 +593,7 @@ namespace Opm
protected:
std::unique_ptr< Dune::CpGrid > grid_;
Opm::EclipseStateConstPtr eclipseState_;
const EclipseState& eclipseState_;
const double* permeability_;
P2PCommunicatorType toIORankComm_;
IndexMapType globalIndex_;

View File

@ -38,8 +38,8 @@ namespace Opm
template <class Grid>
inline std::unordered_set<std::string>
distributeGridAndData( Grid& ,
Opm::DeckConstPtr ,
EclipseStateConstPtr ,
const Opm::Deck& ,
const EclipseState& ,
BlackoilState& ,
BlackoilPropsAdFromDeck& ,
DerivedGeology&,
@ -420,8 +420,8 @@ private:
inline
std::unordered_set<std::string>
distributeGridAndData( Dune::CpGrid& grid,
Opm::DeckConstPtr deck,
EclipseStateConstPtr eclipseState,
const Opm::Deck& deck,
const EclipseState& eclipseState,
BlackoilState& state,
BlackoilPropsAdFromDeck& properties,
DerivedGeology& geology,
@ -435,7 +435,7 @@ distributeGridAndData( Dune::CpGrid& grid,
// distribute the grid and switch to the distributed view
using std::get;
auto my_defunct_wells = get<1>(grid.loadBalance(eclipseState,
auto my_defunct_wells = get<1>(grid.loadBalance(&eclipseState,
geology.transmissibility().data()));
grid.switchToDistributedView();
std::vector<int> compressedToCartesianIdx;

View File

@ -174,7 +174,7 @@ namespace Opm
std::vector<double>& well_potentials);
void updateListEconLimited(const std::unique_ptr<Solver>& solver,
ScheduleConstPtr schedule,
const Schedule& schedule,
const int current_step,
const Wells* wells,
const WellState& well_state,

View File

@ -105,7 +105,7 @@ namespace Opm
std::ofstream tstep_os(tstep_filename.c_str());
const auto& schedule = eclipse_state_->getSchedule();
const auto& events = schedule->getEvents();
const auto& events = schedule.getEvents();
// adaptive time stepping
std::unique_ptr< AdaptiveTimeStepping > adaptiveTimeStepping;
@ -113,7 +113,7 @@ namespace Opm
{
if (param_.getDefault("use_TUNING", false)) {
adaptiveTimeStepping.reset( new AdaptiveTimeStepping( schedule->getTuning(), timer.currentStepNum(), param_, terminal_output_ ) );
adaptiveTimeStepping.reset( new AdaptiveTimeStepping( schedule.getTuning(), timer.currentStepNum(), param_, terminal_output_ ) );
} else {
adaptiveTimeStepping.reset( new AdaptiveTimeStepping( param_, terminal_output_ ) );
}
@ -163,7 +163,7 @@ namespace Opm
}
// Create wells and well state.
WellsManager wells_manager(eclipse_state_,
WellsManager wells_manager(*eclipse_state_,
timer.currentStepNum(),
Opm::UgGridHelpers::numCells(grid_),
Opm::UgGridHelpers::globalCell(grid_),
@ -259,9 +259,9 @@ namespace Opm
// section
//
// TODO (?): handle the parallel case (maybe this works out of the box)
DeckConstPtr miniDeck = schedule->getModifierDeck(nextTimeStepIdx);
const auto& miniDeck = schedule.getModifierDeck(nextTimeStepIdx);
eclipse_state_->applyModifierDeck(*miniDeck);
geo_.update(grid_, props_, eclipse_state_, gravity_);
geo_.update(grid_, props_, *eclipse_state_, gravity_);
}
// take time that was used to solve system for this reportStep
@ -515,7 +515,7 @@ namespace Opm
{
typedef SimFIBODetails::WellMap WellMap;
const auto w_ecl = eclipse_state_->getSchedule()->getWells(step);
const auto w_ecl = eclipse_state_->getSchedule().getWells(step);
const WellMap& wmap = SimFIBODetails::mapWells(w_ecl);
const std::vector<int>& resv_wells = SimFIBODetails::resvWells(wells, step, wmap);
@ -802,7 +802,7 @@ namespace Opm
void
SimulatorBase<Implementation>::
updateListEconLimited(const std::unique_ptr<Solver>& solver,
ScheduleConstPtr schedule,
const Schedule& schedule,
const int current_step,
const Wells* wells,
const WellState& well_state,

View File

@ -98,7 +98,7 @@ namespace Opm
}
// Create wells and well state.
WellsManager wells_manager(eclipse_state_,
WellsManager wells_manager(*eclipse_state_,
timer.currentStepNum(),
Opm::UgGridHelpers::numCells(grid_),
Opm::UgGridHelpers::globalCell(grid_),
@ -119,7 +119,7 @@ namespace Opm
WellState well_state;
// well_state.init(wells, state, prev_well_state);
const auto wells_ecl = eclipse_state_->getSchedule()->getWells(timer.currentStepNum());
const auto wells_ecl = eclipse_state_->getSchedule().getWells(timer.currentStepNum());
const int current_time_step = timer.currentStepNum();
const WellModel well_model(wells, wells_ecl, current_time_step);

View File

@ -370,7 +370,7 @@ namespace Opm
// ECL output
if ( eclWriter_ )
{
const auto& initConfig = eclipseState_->getInitConfig();
const auto& initConfig = eclipseState_.getInitConfig();
if (initConfig.restartRequested() && ((initConfig.getRestartStep()) == (timer.currentStepNum()))) {
std::cout << "Skipping restart write in start of step " << timer.currentStepNum() << std::endl;
} else {
@ -486,7 +486,7 @@ namespace Opm
bool BlackoilOutputWriter::isRestart() const {
const auto& initconfig = eclipseState_->getInitConfig();
const auto& initconfig = eclipseState_.getInitConfig();
return initconfig.restartRequested();
}
}

View File

@ -213,7 +213,7 @@ namespace Opm
template <class Grid>
BlackoilOutputWriter(const Grid& grid,
const parameter::ParameterGroup& param,
Opm::EclipseStateConstPtr eclipseState,
const Opm::EclipseState& eclipseState,
const Opm::PhaseUsage &phaseUsage,
const double* permeability );
@ -311,7 +311,7 @@ namespace Opm
std::unique_ptr< BlackoilSubWriter > vtkWriter_;
std::unique_ptr< BlackoilSubWriter > matlabWriter_;
std::unique_ptr< EclipseWriter > eclWriter_;
EclipseStateConstPtr eclipseState_;
const EclipseState& eclipseState_;
std::unique_ptr< ThreadHandle > asyncOutput_;
};
@ -327,7 +327,7 @@ namespace Opm
BlackoilOutputWriter::
BlackoilOutputWriter(const Grid& grid,
const parameter::ParameterGroup& param,
Opm::EclipseStateConstPtr eclipseState,
const Opm::EclipseState& eclipseState,
const Opm::PhaseUsage &phaseUsage,
const double* permeability )
: output_( param.getDefault("output", true) ),
@ -343,7 +343,7 @@ namespace Opm
new BlackoilMatlabWriter< Grid >( grid, outputDir_ ) : 0 ),
eclWriter_( output_ && parallelOutput_->isIORank() &&
param.getDefault("output_ecl", true) ?
new EclipseWriter(eclipseState,UgGridHelpers::createEclipseGrid( grid , *eclipseState->getInputGrid()))
new EclipseWriter(eclipseState,UgGridHelpers::createEclipseGrid( grid , eclipseState.getInputGrid()))
: 0 ),
eclipseState_(eclipseState),
asyncOutput_()
@ -396,7 +396,7 @@ namespace Opm
// gives a dummy dynamic_list_econ_limited
DynamicListEconLimited dummy_list_econ_limited;
WellsManager wellsmanager(eclipseState_,
eclipseState_->getInitConfig().getRestartStep(),
eclipseState_.getInitConfig().getRestartStep(),
Opm::UgGridHelpers::numCells(grid),
Opm::UgGridHelpers::globalCell(grid),
Opm::UgGridHelpers::cartDims(grid),
@ -416,7 +416,7 @@ namespace Opm
const Wells* wells = wellsmanager.c_wells();
wellstate.resize(wells, simulatorstate); //Resize for restart step
auto restarted = Opm::init_from_restart_file(
*eclipseState_,
eclipseState_,
Opm::UgGridHelpers::numCells(grid) );
solutionToSim( restarted.first, phaseusage, simulatorstate );
@ -770,8 +770,8 @@ namespace Opm
const Model& physicalModel,
bool substep)
{
const RestartConfig& restartConfig = eclipseState_->getRestartConfig();
const SummaryConfig& summaryConfig = eclipseState_->getSummaryConfig();
const RestartConfig& restartConfig = eclipseState_.getRestartConfig();
const SummaryConfig& summaryConfig = eclipseState_.getSummaryConfig();
const int reportStepNum = timer.reportStepNum();
bool logMessages = output_ && parallelOutput_->isIORank();

View File

@ -121,7 +121,7 @@ namespace Opm
const bool vapoil,
std::shared_ptr<EclipseState> eclipse_state,
BlackoilOutputWriter& output_writer,
Opm::DeckConstPtr& deck,
std::shared_ptr< Deck > deck,
const std::vector<double>& threshold_pressures_by_face,
const bool solvent);
@ -134,7 +134,7 @@ namespace Opm
private:
bool has_solvent_;
DeckConstPtr deck_;
std::shared_ptr< Deck > deck_;
SolventPropsAdFromDeck solvent_props_;
bool is_miscible_;

View File

@ -36,7 +36,7 @@ namespace Opm
const bool has_vapoil,
std::shared_ptr<EclipseState> eclipse_state,
BlackoilOutputWriter& output_writer,
Opm::DeckConstPtr& deck,
std::shared_ptr< Deck > deck,
const std::vector<double>& threshold_pressures_by_face,
const bool has_solvent)
: BaseType(param,
@ -105,9 +105,9 @@ namespace Opm
std::vector<double> perfcells_fraction(wells->well_connpos[nw], 0.0);
size_t currentStep = timer.currentStepNum();
ScheduleConstPtr schedule = BaseType::eclipse_state_->getSchedule();
const auto& schedule = BaseType::eclipse_state_->getSchedule();
for (const auto& well_solvent : schedule->getWells( currentStep )) {
for (const auto& well_solvent : schedule.getWells( currentStep )) {
if (well_solvent->getStatus( currentStep ) == WellCommon::SHUT) {
continue;
}

View File

@ -39,20 +39,20 @@ typedef Eigen::DiagonalMatrix<double, Eigen::Dynamic> D;
typedef SolventPropsAdFromDeck::V V;
typedef Eigen::Array<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> Block;
SolventPropsAdFromDeck::SolventPropsAdFromDeck(DeckConstPtr deck,
EclipseStateConstPtr eclState,
SolventPropsAdFromDeck::SolventPropsAdFromDeck(const Deck& deck,
const EclipseState& eclState,
const int number_of_cells,
const int* global_cell)
{
if (deck->hasKeyword("SOLVENT")) {
if (deck.hasKeyword("SOLVENT")) {
// retrieve the cell specific PVT table index from the deck
// and using the grid...
extractPvtTableIndex(cellPvtRegionIdx_, eclState, number_of_cells, global_cell);
extractTableIndex("SATNUM", eclState, number_of_cells, global_cell, cellSatNumRegionIdx_);
// surface densities
if (deck->hasKeyword("SDENSITY")) {
const auto& densityKeyword = deck->getKeyword("SDENSITY");
if (deck.hasKeyword("SDENSITY")) {
const auto& densityKeyword = deck.getKeyword("SDENSITY");
int numRegions = densityKeyword.size();
solvent_surface_densities_.resize(numRegions);
for (int regionIdx = 0; regionIdx < numRegions; ++regionIdx) {
@ -63,7 +63,7 @@ SolventPropsAdFromDeck::SolventPropsAdFromDeck(DeckConstPtr deck,
OPM_THROW(std::runtime_error, "SDENSITY must be specified in SOLVENT runs\n");
}
const auto& tables = eclState->getTableManager();
const auto& tables = eclState.getTableManager();
// pvt
const TableContainer& pvdsTables = tables.getPvdsTables();
if (!pvdsTables.empty()) {
@ -123,7 +123,7 @@ SolventPropsAdFromDeck::SolventPropsAdFromDeck(DeckConstPtr deck,
}
if (deck->hasKeyword("MISCIBLE") ) {
if (deck.hasKeyword("MISCIBLE") ) {
// retrieve the cell specific Misc table index from the deck
@ -254,14 +254,14 @@ SolventPropsAdFromDeck::SolventPropsAdFromDeck(DeckConstPtr deck,
}
}
if (deck->hasKeyword("TLMIXPAR")) {
const int numRegions = deck->getKeyword("TLMIXPAR").size();
if (deck.hasKeyword("TLMIXPAR")) {
const int numRegions = deck.getKeyword("TLMIXPAR").size();
// resize the attributes of the object
mix_param_viscosity_.resize(numRegions);
mix_param_density_.resize(numRegions);
for (int regionIdx = 0; regionIdx < numRegions; ++regionIdx) {
const auto& tlmixparRecord = deck->getKeyword("TLMIXPAR").getRecord(regionIdx);
const auto& tlmixparRecord = deck.getKeyword("TLMIXPAR").getRecord(regionIdx);
const auto& mix_params_viscosity = tlmixparRecord.getItem("TL_VISCOSITY_PARAMETER").getSIDoubleData();
mix_param_viscosity_[regionIdx] = mix_params_viscosity[0];
const auto& mix_params_density = tlmixparRecord.getItem("TL_DENSITY_PARAMETER").getSIDoubleData();
@ -276,7 +276,7 @@ SolventPropsAdFromDeck::SolventPropsAdFromDeck(DeckConstPtr deck,
}
}
if (deck->hasKeyword("TLPMIXPA")) {
if (deck.hasKeyword("TLPMIXPA")) {
const TableContainer& tlpmixparTables = tables.getTlpmixpaTables();
if (!tlpmixparTables.empty()) {
@ -492,12 +492,12 @@ ADB SolventPropsAdFromDeck::pressureMixingParameter(const ADB& po,
}
void SolventPropsAdFromDeck::extractTableIndex(const std::string& keyword,
Opm::EclipseStateConstPtr eclState,
const Opm::EclipseState& eclState,
size_t numCompressed,
const int* compressedToCartesianCellIdx,
std::vector<int>& tableIdx) const {
//Get the Region data
const auto& regionData = eclState->get3DProperties().getIntGridProperty(keyword).getData();
const auto& regionData = eclState.get3DProperties().getIntGridProperty(keyword).getData();
// Convert this into an array of compressed cells
// Eclipse uses Fortran-style indices which start at 1
// instead of 0, we subtract 1.

View File

@ -37,8 +37,8 @@ namespace Opm
class SolventPropsAdFromDeck
{
public:
SolventPropsAdFromDeck(DeckConstPtr deck,
EclipseStateConstPtr eclipseState,
SolventPropsAdFromDeck(const Deck& deck,
const EclipseState& eclipseState,
const int number_of_cells,
const int* global_cell);
@ -170,7 +170,7 @@ private:
/// \param[in] compressedToCartesianCellIdx cartesianCellIdx for each cell in the grid
/// \param[out] tableIdx table index for each compressed cell
void extractTableIndex(const std::string& keyword,
Opm::EclipseStateConstPtr eclState,
const Opm::EclipseState& eclState,
size_t numCompressed,
const int* compressedToCartesianCellIdx,
std::vector<int>& tableIdx) const;

View File

@ -184,7 +184,7 @@ namespace Opm {
/// upate the dynamic lists related to economic limits
template<class WellState>
void
updateListEconLimited(ScheduleConstPtr schedule,
updateListEconLimited(const Schedule& schedule,
const int current_step,
const Wells* wells,
const WellState& well_state,

View File

@ -1254,7 +1254,7 @@ StandardWells::StandardWells(const Wells* wells_arg)
template<class WellState>
void
StandardWells::
updateListEconLimited(ScheduleConstPtr schedule,
updateListEconLimited(const Schedule& schedule,
const int current_step,
const Wells* wells_struct,
const WellState& well_state,
@ -1266,7 +1266,7 @@ StandardWells::StandardWells(const Wells* wells_arg)
// flag to check if the mim oil/gas rate limit is violated
bool rate_limit_violated = false;
const std::string& well_name = wells_struct->name[w];
const Well* well_ecl = schedule->getWell(well_name);
const Well* well_ecl = schedule.getWell(well_name);
const WellEconProductionLimits& econ_production_limits = well_ecl->getEconProductionLimits(current_step);
// economic limits only apply for production wells.

View File

@ -38,14 +38,14 @@ namespace Opm
void WellMultiSegment::initMultiSegmentWell(const Well* well, size_t time_step, const Wells* wells) {
CompletionSetConstPtr completion_set = well->getCompletions(time_step);
const auto& completion_set = well->getCompletions(time_step);
m_is_multi_segment_ = true;
SegmentSetConstPtr segment_set = well->getSegmentSet(time_step);
m_number_of_segments_ = segment_set->numberSegment();
m_number_of_perforations_ = completion_set->size();
m_comp_pressure_drop_ = segment_set->compPressureDrop();
m_multiphase_model_ = segment_set->multiPhaseModel();
const auto& segment_set = well->getSegmentSet(time_step);
m_number_of_segments_ = segment_set.numberSegment();
m_number_of_perforations_ = completion_set.size();
m_comp_pressure_drop_ = segment_set.compPressureDrop();
m_multiphase_model_ = segment_set.multiPhaseModel();
m_outlet_segment_.resize(m_number_of_segments_);
m_inlet_segments_.resize(m_number_of_segments_);
@ -60,13 +60,13 @@ namespace Opm
// we change the ID to location now for easier use later.
for (int i = 0; i < m_number_of_segments_; ++i) {
// The segment number for top segment is 0, the segment number of its outlet segment will be -1
m_outlet_segment_[i] = segment_set->numberToLocation((*segment_set)[i]->outletSegment());
m_segment_length_[i] = (*segment_set)[i]->totalLength();
m_segment_depth_[i] = (*segment_set)[i]->depth();
m_segment_internal_diameter_[i] = (*segment_set)[i]->internalDiameter();
m_segment_roughness_[i] = (*segment_set)[i]->roughness();
m_segment_cross_area_[i] = (*segment_set)[i]->crossArea();
m_segment_volume_[i] = (*segment_set)[i]->volume();
m_outlet_segment_[i] = segment_set.numberToLocation(segment_set[i].outletSegment());
m_segment_length_[i] = segment_set[i].totalLength();
m_segment_depth_[i] = segment_set[i].depth();
m_segment_internal_diameter_[i] = segment_set[i].internalDiameter();
m_segment_roughness_[i] = segment_set[i].roughness();
m_segment_cross_area_[i] = segment_set[i].crossArea();
m_segment_volume_[i] = segment_set[i].volume();
}
// update the completion related information
@ -107,13 +107,13 @@ namespace Opm
std::vector<double> temp_perf_depth;
temp_perf_depth.resize(m_number_of_perforations_);
for (int i = 0; i < (int)completion_set->size(); ++i) {
int i_segment = completion_set->get(i)->getSegmentNumber();
for (int i = 0; i < (int)completion_set.size(); ++i) {
int i_segment = completion_set.get(i).getSegmentNumber();
// using the location of the segment in the array as the segment number/id.
// TODO: it can be helpful for output or postprocessing if we can keep the original number.
i_segment = segment_set->numberToLocation(i_segment);
i_segment = segment_set.numberToLocation(i_segment);
m_segment_perforations_[i_segment].push_back(i);
temp_perf_depth[i] = completion_set->get(i)->getCenterDepth();
temp_perf_depth[i] = completion_set.get(i).getCenterDepth();
}
// reordering the perforation related informations
@ -171,7 +171,7 @@ namespace Opm
void WellMultiSegment::initNonMultiSegmentWell(const Well* well, size_t time_step, const Wells* wells) {
CompletionSetConstPtr completion_set = well->getCompletions(time_step);
const auto& completion_set = well->getCompletions(time_step);
m_is_multi_segment_ = false;
m_number_of_segments_ = 1;
@ -225,7 +225,7 @@ namespace Opm
for (int i = 0; i < m_number_of_perforations_; ++i) {
m_segment_perforations_[0][i] = i;
m_perf_depth_[i] = completion_set->get(i)->getCenterDepth();
m_perf_depth_[i] = completion_set.get(i).getCenterDepth();
}
m_inlet_segments_.resize(m_number_of_segments_);

View File

@ -68,11 +68,11 @@ namespace Opm
void
PolymerInflowFromDeck::setInflowValues(Opm::EclipseStateConstPtr eclipseState,
PolymerInflowFromDeck::setInflowValues(const Opm::EclipseState& eclipseState,
size_t currentStep)
{
ScheduleConstPtr schedule = eclipseState->getSchedule();
for (const auto& well : schedule->getWells(currentStep)) {
const auto& schedule = eclipseState.getSchedule();
for (const auto& well : schedule.getWells(currentStep)) {
WellInjectionProperties injection = well->getInjectionProperties(currentStep);
WellPolymerProperties polymer = well->getPolymerProperties(currentStep);
if (well->isInjector(currentStep)) {
@ -99,7 +99,7 @@ namespace Opm
/// Constructor.
/// @param[in] deck Input deck expected to contain WPOLYMER.
PolymerInflowFromDeck::PolymerInflowFromDeck(Opm::EclipseStateConstPtr eclipseState,
PolymerInflowFromDeck::PolymerInflowFromDeck(const Opm::EclipseState& eclipseState,
const Wells& wells,
const int num_cells,
size_t currentStep)

View File

@ -93,7 +93,7 @@ namespace Opm
/// \param[in] wells Wells structure.
/// \param[in] num_cells Number of cells in grid.
/// \param[in] currentStep Number of current simulation step.
PolymerInflowFromDeck(Opm::EclipseStateConstPtr eclipseState,
PolymerInflowFromDeck(const Opm::EclipseState& eclipseState,
const Wells& wells,
const int num_cells,
size_t currentStep);
@ -110,7 +110,7 @@ namespace Opm
SparseVector<double> sparse_inflow_;
std::unordered_map<std::string, double> wellPolymerRate_;
void setInflowValues(Opm::EclipseStateConstPtr eclipseState,
void setInflowValues(const Opm::EclipseState& eclipseState,
size_t currentStep);
};

View File

@ -92,7 +92,7 @@ namespace Opm
{
}
PolymerProperties(Opm::DeckConstPtr deck, Opm::EclipseStateConstPtr eclipseState)
PolymerProperties(const Opm::Deck& deck, const Opm::EclipseState& eclipseState)
{
readFromDeck(deck, eclipseState);
}
@ -127,12 +127,12 @@ namespace Opm
shear_vrf_vals_ = shear_vrf_vals;
}
void readFromDeck(Opm::DeckConstPtr deck, Opm::EclipseStateConstPtr eclipseState)
void readFromDeck(const Opm::Deck& deck, const Opm::EclipseState& eclipseState)
{
// We assume NTMISC=1
const auto& tables = eclipseState->getTableManager();
const auto& tables = eclipseState.getTableManager();
const auto& plymaxTable = tables.getPlymaxTables().getTable<PlymaxTable>(0);
const auto& plmixparRecord = deck->getKeyword("PLMIXPAR").getRecord(0);
const auto& plmixparRecord = deck.getKeyword("PLMIXPAR").getRecord(0);
// We also assume that each table has exactly one row...
assert(plymaxTable.numRows() == 1);
@ -165,8 +165,8 @@ namespace Opm
c_vals_ads_ = plyadsTable.getPolymerConcentrationColumn().vectorCopy( );
ads_vals_ = plyadsTable.getAdsorbedPolymerColumn().vectorCopy( );
has_plyshlog_ = deck->hasKeyword("PLYSHLOG");
has_shrate_ = deck->hasKeyword("SHRATE");
has_plyshlog_ = deck.hasKeyword("PLYSHLOG");
has_shrate_ = deck.hasKeyword("SHRATE");
if (has_plyshlog_) {
// Assuming NTPVT == 1 always
@ -176,11 +176,11 @@ namespace Opm
shear_vrf_vals_ = plyshlogTable.getShearMultiplierColumn().vectorCopy( );
// do the unit version here for the water_vel_vals_
Opm::UnitSystem unitSystem = deck->getActiveUnitSystem();
Opm::UnitSystem unitSystem = deck.getActiveUnitSystem();
double siFactor;
if (has_shrate_) {
siFactor = unitSystem.parse("1/Time")->getSIScaling();
const auto& shrateKeyword = deck->getKeyword("SHRATE");
siFactor = unitSystem.parse("1/Time").getSIScaling();
const auto& shrateKeyword = deck.getKeyword("SHRATE");
std::vector<double> shrate_readin = shrateKeyword.getSIDoubleData();
if (shrate_readin.size() == 1) {
shrate_ = shrate_readin[0];
@ -190,7 +190,7 @@ namespace Opm
OPM_THROW(std::logic_error, "Only NTPVT == 1 is allowed for SHRATE keyword now !\n");
}
} else {
siFactor = unitSystem.parse("Length/Time")->getSIScaling();
siFactor = unitSystem.parse("Length/Time").getSIScaling();
}
for (size_t i = 0; i < water_vel_vals_.size(); ++i) {

View File

@ -82,7 +82,7 @@ namespace Opm {
const PolymerPropsAd& polymer_props_ad,
const StandardWells& well_model,
const NewtonIterationBlackoilInterface& linsolver,
EclipseStateConstPtr eclipse_state,
std::shared_ptr< const EclipseState > eclipseState,
const bool has_disgas,
const bool has_vapoil,
const bool has_polymer,

View File

@ -82,7 +82,7 @@ namespace Opm {
const PolymerPropsAd& polymer_props_ad,
const StandardWells& well_model,
const NewtonIterationBlackoilInterface& linsolver,
EclipseStateConstPtr eclipse_state,
std::shared_ptr< const EclipseState > eclipse_state,
const bool has_disgas,
const bool has_vapoil,
const bool has_polymer,

View File

@ -124,7 +124,7 @@ namespace Opm
const bool shrate,
std::shared_ptr<EclipseState> eclipse_state,
BlackoilOutputWriter& output_writer,
Opm::DeckConstPtr& deck,
std::shared_ptr< Deck > deck,
const std::vector<double>& threshold_pressures_by_face);
std::unique_ptr<Solver> createSolver(const WellModel& well_model);
@ -143,7 +143,7 @@ namespace Opm
bool has_plyshlog_;
// flag for SHRATE keyword
bool has_shrate_;
DeckConstPtr deck_;
std::shared_ptr< Deck > deck_;
std::vector<double> wells_rep_radius_;
std::vector<double> wells_perf_length_;
@ -158,7 +158,7 @@ namespace Opm
// and store the wellbore diameters
// it will be used in the shear-thinning calcluation only.
void
computeRepRadiusPerfLength(const Opm::EclipseStateConstPtr eclipseState,
computeRepRadiusPerfLength(const EclipseState& eclipseState,
const size_t timeStep,
const GridT& grid,
std::vector<double>& wells_rep_radius,

View File

@ -38,7 +38,7 @@ namespace Opm
const bool has_shrate,
std::shared_ptr<EclipseState> eclipse_state,
BlackoilOutputWriter& output_writer,
Opm::DeckConstPtr& deck,
std::shared_ptr< Deck > deck,
const std::vector<double>& threshold_pressures_by_face)
: BaseType(param,
grid,
@ -112,7 +112,7 @@ namespace Opm
if (wells_manager.c_wells() == 0) {
OPM_THROW(std::runtime_error, "Cannot control polymer injection via WPOLYMER without wells.");
}
polymer_inflow_ptr.reset(new PolymerInflowFromDeck(BaseType::eclipse_state_, *wells, Opm::UgGridHelpers::numCells(BaseType::grid_), timer.currentStepNum()));
polymer_inflow_ptr.reset(new PolymerInflowFromDeck(*BaseType::eclipse_state_, *wells, Opm::UgGridHelpers::numCells(BaseType::grid_), timer.currentStepNum()));
} else {
OPM_MESSAGE("Warning: simulating with no WPOLYMER in deck (no polymer will be injected).");
polymer_inflow_ptr.reset(new PolymerInflowBasic(0.0*Opm::unit::day,
@ -126,7 +126,7 @@ namespace Opm
well_state.polymerInflow() = polymer_inflow_c;
if (has_plyshlog_) {
computeRepRadiusPerfLength(BaseType::eclipse_state_, timer.currentStepNum(), BaseType::grid_, wells_rep_radius_, wells_perf_length_, wells_bore_diameter_);
computeRepRadiusPerfLength(*BaseType::eclipse_state_, timer.currentStepNum(), BaseType::grid_, wells_rep_radius_, wells_perf_length_, wells_bore_diameter_);
}
}
@ -152,7 +152,7 @@ namespace Opm
template <class GridT>
void SimulatorFullyImplicitBlackoilPolymer<GridT>::
computeRepRadiusPerfLength(const Opm::EclipseStateConstPtr eclipseState,
computeRepRadiusPerfLength(const Opm::EclipseState& eclipseState,
const size_t timeStep,
const GridT& grid,
std::vector<double>& wells_rep_radius,
@ -168,7 +168,7 @@ namespace Opm
auto cell_to_faces = Opm::UgGridHelpers::cell2Faces(grid);
auto begin_face_centroids = Opm::UgGridHelpers::beginFaceCentroids(grid);
if (eclipseState->getSchedule()->numWells() == 0) {
if (eclipseState.getSchedule().numWells() == 0) {
OPM_MESSAGE("No wells specified in Schedule section, "
"initializing no wells");
return;
@ -189,8 +189,8 @@ namespace Opm
setupCompressedToCartesian(global_cell, number_of_cells,
cartesian_to_compressed);
ScheduleConstPtr schedule = eclipseState->getSchedule();
auto wells = schedule->getWells(timeStep);
const auto& schedule = eclipseState.getSchedule();
auto wells = schedule.getWells(timeStep);
int well_index = 0;
@ -201,13 +201,13 @@ namespace Opm
continue;
}
{ // COMPDAT handling
CompletionSetConstPtr completionSet = well->getCompletions(timeStep);
for (size_t c=0; c<completionSet->size(); c++) {
CompletionConstPtr completion = completionSet->get(c);
if (completion->getState() == WellCompletion::OPEN) {
int i = completion->getI();
int j = completion->getJ();
int k = completion->getK();
const auto& completionSet = well->getCompletions(timeStep);
for (size_t c=0; c<completionSet.size(); c++) {
const auto& completion = completionSet.get(c);
if (completion.getState() == WellCompletion::OPEN) {
int i = completion.getI();
int j = completion.getJ();
int k = completion.getK();
const int* cpgdim = cart_dims;
int cart_grid_indx = i + cpgdim[0]*(j + cpgdim[1]*k);
@ -219,7 +219,7 @@ namespace Opm
int cell = cgit->second;
{
double radius = 0.5*completion->getDiameter();
double radius = 0.5*completion.getDiameter();
if (radius <= 0.0) {
radius = 0.5*unit::feet;
OPM_MESSAGE("**** Warning: Well bore internal radius set to " << radius);
@ -228,7 +228,7 @@ namespace Opm
const std::array<double, 3> cubical =
WellsManagerDetail::getCubeDim<3>(cell_to_faces, begin_face_centroids, cell);
WellCompletion::DirectionEnum direction = completion->getDirection();
WellCompletion::DirectionEnum direction = completion.getDirection();
double re; // area equivalent radius of the grid block
double perf_length; // the length of the well perforation
@ -256,8 +256,8 @@ namespace Opm
wells_bore_diameter.push_back(2. * radius);
}
} else {
if (completion->getState() != WellCompletion::SHUT) {
OPM_THROW(std::runtime_error, "Completion state: " << WellCompletion::StateEnum2String( completion->getState() ) << " not handled");
if (completion.getState() != WellCompletion::SHUT) {
OPM_THROW(std::runtime_error, "Completion state: " << WellCompletion::StateEnum2String( completion.getState() ) << " not handled");
}
}

View File

@ -109,7 +109,7 @@ namespace Opm
const RockCompressibility* rock_comp_props,
std::shared_ptr<EclipseState> eclipse_state,
BlackoilOutputWriter& output_writer,
Opm::DeckConstPtr& deck,
std::shared_ptr< const Deck > deck,
NewtonIterationBlackoilInterface& linsolver,
const double* gravity);
@ -121,13 +121,13 @@ namespace Opm
const Wells* wells);
void updateListEconLimited(const std::unique_ptr<Solver>& solver,
ScheduleConstPtr schedule,
const Schedule& schedule,
const int current_step,
const Wells* wells,
const WellState& well_state,
DynamicListEconLimited& list_econ_limited) const;
private:
Opm::DeckConstPtr deck_;
std::shared_ptr< const Deck > deck_;
const PolymerPropsAd& polymer_props_;
};

View File

@ -34,7 +34,7 @@ SimulatorFullyImplicitCompressiblePolymer(const parameter::ParameterGroup& param
const RockCompressibility* rock_comp_props,
std::shared_ptr<EclipseState> eclipse_state,
BlackoilOutputWriter& output_writer,
Opm::DeckConstPtr& deck,
std::shared_ptr< const Deck > deck,
NewtonIterationBlackoilInterface& linsolver,
const double* gravity)
: BaseType(param,
@ -86,7 +86,7 @@ handleAdditionalWellInflow(SimulatorTimer& timer,
if (wells_manager.c_wells() == 0) {
OPM_THROW(std::runtime_error, "Cannot control polymer injection via WPOLYMER without wells.");
}
polymer_inflow_ptr.reset(new PolymerInflowFromDeck( BaseType::eclipse_state_, *wells, Opm::UgGridHelpers::numCells(BaseType::grid_), timer.currentStepNum()));
polymer_inflow_ptr.reset(new PolymerInflowFromDeck( *BaseType::eclipse_state_, *wells, Opm::UgGridHelpers::numCells(BaseType::grid_), timer.currentStepNum()));
} else {
polymer_inflow_ptr.reset(new PolymerInflowBasic(0.0*Opm::unit::day,
1.0*Opm::unit::day,
@ -107,7 +107,7 @@ template <class GridT>
void
SimulatorFullyImplicitCompressiblePolymer<GridT>::
updateListEconLimited(const std::unique_ptr<Solver>& /*solver*/,
ScheduleConstPtr /*schedule*/,
const Schedule& /*schedule*/,
const int /*current_step*/,
const Wells* /*wells*/,
const WellState& /*well_state*/,

View File

@ -45,8 +45,8 @@ namespace Opm
/// \param[in] gravity The gravity constant
template <class Grid>
void computeMaxDp(std::map<std::pair<int, int>, double>& maxDp,
const DeckConstPtr& deck,
EclipseStateConstPtr eclipseState,
const Deck& deck,
const EclipseState& eclipseState,
const Grid& grid,
const BlackoilState& initialState,
const BlackoilPropertiesFromDeck& props,
@ -55,12 +55,12 @@ void computeMaxDp(std::map<std::pair<int, int>, double>& maxDp,
const PhaseUsage& pu = props.phaseUsage();
const auto& eqlnum = eclipseState->get3DProperties().getIntGridProperty("EQLNUM");
const auto& eqlnum = eclipseState.get3DProperties().getIntGridProperty("EQLNUM");
const auto& eqlnumData = eqlnum.getData();
const int numPhases = initialState.numPhases();
const int numCells = UgGridHelpers::numCells(grid);
const int numPvtRegions = deck->getKeyword("TABDIMS").getRecord(0).getItem("NTPVT").get< int >(0);
const int numPvtRegions = deck.getKeyword("TABDIMS").getRecord(0).getItem("NTPVT").get< int >(0);
// retrieve the minimum (residual!?) and the maximum saturations for all cells
std::vector<double> minSat(numPhases*numCells);
@ -73,7 +73,7 @@ void computeMaxDp(std::map<std::pair<int, int>, double>& maxDp,
// retrieve the surface densities
std::vector<std::vector<double> > surfaceDensity(numPvtRegions);
const auto& densityKw = deck->getKeyword("DENSITY");
const auto& densityKw = deck.getKeyword("DENSITY");
for (int regionIdx = 0; regionIdx < numPvtRegions; ++regionIdx) {
surfaceDensity[regionIdx].resize(numPhases);
@ -100,7 +100,7 @@ void computeMaxDp(std::map<std::pair<int, int>, double>& maxDp,
// Fortran indices.
const int* gc = UgGridHelpers::globalCell(grid);
std::vector<int> pvtRegion(numCells);
const auto& cartPvtRegion = eclipseState->get3DProperties().getIntGridProperty("PVTNUM").getData();
const auto& cartPvtRegion = eclipseState.get3DProperties().getIntGridProperty("PVTNUM").getData();
for (int cellIdx = 0; cellIdx < numCells; ++cellIdx) {
const int cartCellIdx = gc ? gc[cellIdx] : cellIdx;
pvtRegion[cellIdx] = std::max(0, cartPvtRegion[cartCellIdx] - 1);
@ -318,16 +318,16 @@ void computeMaxDp(std::map<std::pair<int, int>, double>& maxDp,
template <class Grid>
std::vector<double> thresholdPressures(const DeckConstPtr& /* deck */,
EclipseStateConstPtr eclipseState,
std::vector<double> thresholdPressures(const Deck& /* deck */,
const EclipseState& eclipseState,
const Grid& grid,
const std::map<std::pair<int, int>, double>& maxDp)
{
const SimulationConfig& simulationConfig = eclipseState->getSimulationConfig();
const SimulationConfig& simulationConfig = eclipseState.getSimulationConfig();
std::vector<double> thpres_vals;
if (simulationConfig.hasThresholdPressure()) {
std::shared_ptr<const ThresholdPressure> thresholdPressure = simulationConfig.getThresholdPressure();
const auto& eqlnum = eclipseState->get3DProperties().getIntGridProperty("EQLNUM");
const ThresholdPressure& thresholdPressure = simulationConfig.getThresholdPressure();
const auto& eqlnum = eclipseState.get3DProperties().getIntGridProperty("EQLNUM");
const auto& eqlnumData = eqlnum.getData();
// Set threshold pressure values for each cell face.
@ -347,9 +347,9 @@ void computeMaxDp(std::map<std::pair<int, int>, double>& maxDp,
const int eq1 = eqlnumData[gc1];
const int eq2 = eqlnumData[gc2];
if (thresholdPressure->hasRegionBarrier(eq1,eq2)) {
if (thresholdPressure->hasThresholdPressure(eq1,eq2)) {
thpres_vals[face] = thresholdPressure->getThresholdPressure(eq1,eq2);
if (thresholdPressure.hasRegionBarrier(eq1,eq2)) {
if (thresholdPressure.hasThresholdPressure(eq1,eq2)) {
thpres_vals[face] = thresholdPressure.getThresholdPressure(eq1,eq2);
}
else {
// set the threshold pressure for faces of PVT regions where the third item
@ -380,15 +380,15 @@ void computeMaxDp(std::map<std::pair<int, int>, double>& maxDp,
/// particular connection. An empty vector is
/// returned if there is no THPRES
/// feature used in the deck.
std::vector<double> thresholdPressuresNNC(EclipseStateConstPtr eclipseState,
std::vector<double> thresholdPressuresNNC(const EclipseState& eclipseState,
const NNC& nnc,
const std::map<std::pair<int, int>, double>& maxDp)
{
const SimulationConfig& simulationConfig = eclipseState->getSimulationConfig();
const SimulationConfig& simulationConfig = eclipseState.getSimulationConfig();
std::vector<double> thpres_vals;
if (simulationConfig.hasThresholdPressure()) {
std::shared_ptr<const ThresholdPressure> thresholdPressure = simulationConfig.getThresholdPressure();
const auto& eqlnum = eclipseState->get3DProperties().getIntGridProperty("EQLNUM");
const ThresholdPressure& thresholdPressure = simulationConfig.getThresholdPressure();
const auto& eqlnum = eclipseState.get3DProperties().getIntGridProperty("EQLNUM");
const auto& eqlnumData = eqlnum.getData();
// Set values for each NNC
@ -400,9 +400,9 @@ void computeMaxDp(std::map<std::pair<int, int>, double>& maxDp,
const int eq1 = eqlnumData[gc1];
const int eq2 = eqlnumData[gc2];
if (thresholdPressure->hasRegionBarrier(eq1,eq2)) {
if (thresholdPressure->hasThresholdPressure(eq1,eq2)) {
thpres_vals[i] = thresholdPressure->getThresholdPressure(eq1,eq2);
if (thresholdPressure.hasRegionBarrier(eq1,eq2)) {
if (thresholdPressure.hasThresholdPressure(eq1,eq2)) {
thpres_vals[i] = thresholdPressure.getThresholdPressure(eq1,eq2);
} else {
// set the threshold pressure for NNC of PVT regions where the third item
// has been defaulted to the maximum pressure potential difference between

View File

@ -46,13 +46,10 @@
struct SetupSimple {
SetupSimple()
SetupSimple() :
deck( Opm::Parser{}.parseFile("fluid.data") ),
eclState( deck, Opm::ParseContext() )
{
Opm::ParseContext parseContext;
Opm::ParserPtr parser(new Opm::Parser());
deck = parser->parseFile("fluid.data", parseContext);
eclState.reset(new Opm::EclipseState(*deck , parseContext));
param.disableOutput();
param.insertParameter("init_rock" , "false" );
param.insertParameter("threephase_model", "simple");
@ -61,8 +58,8 @@ struct SetupSimple {
}
Opm::parameter::ParameterGroup param;
Opm::DeckConstPtr deck;
Opm::EclipseStateConstPtr eclState;
Opm::Deck deck;
Opm::EclipseState eclState;
};
@ -71,7 +68,7 @@ struct TestFixture : public Setup
{
TestFixture()
: Setup()
, grid (*eclState->getInputGrid())
, grid (eclState.getInputGrid())
, boprops_ad(deck, eclState, *grid.c_grid(), param.getDefault("init_rock", false))
{
}
@ -89,7 +86,7 @@ struct TestFixtureAd : public Setup
{
TestFixtureAd()
: Setup()
, grid (*eclState->getInputGrid())
, grid (eclState.getInputGrid())
, props(deck, eclState, *grid.c_grid(),
param.getDefault("init_rock", false))
{

View File

@ -72,13 +72,13 @@ struct SetupMSW {
SetupMSW()
{
Opm::ParseContext parse_context;
Opm::ParserPtr parser(new Opm::Parser());
Opm::DeckConstPtr deck = parser->parseFile("msw.data", parse_context);
Opm::EclipseStateConstPtr ecl_state(new Opm::EclipseState(*deck , parse_context));
Opm::Parser parser;
auto deck = parser.parseFile("msw.data", parse_context);
Opm::EclipseState ecl_state(deck , parse_context);
// Create grid.
const std::vector<double>& porv =
ecl_state->get3DProperties().getDoubleGridProperty("PORV").getData();
ecl_state.get3DProperties().getDoubleGridProperty("PORV").getData();
std::unique_ptr<GridInit> grid_init(new GridInit(ecl_state, porv));
const Grid& grid = grid_init->grid();
@ -117,7 +117,7 @@ struct SetupMSW {
std::unordered_set<std::string>());
const Wells* wells = wells_manager.c_wells();
const auto wells_ecl = ecl_state->getSchedule()->getWells(current_timestep);
const auto wells_ecl = ecl_state.getSchedule().getWells(current_timestep);
ms_wells.reset(new Opm::MultisegmentWells(wells, wells_ecl, current_timestep));
};

View File

@ -46,13 +46,10 @@
struct SetupSimple {
SetupSimple()
SetupSimple() :
deck( Opm::Parser{}.parseFile( "fluid.data" ) ),
eclState( deck, Opm::ParseContext() )
{
Opm::ParserPtr parser(new Opm::Parser());
Opm::ParseContext parseContext;
deck = parser->parseFile("fluid.data" , parseContext);
eclState.reset(new Opm::EclipseState(*deck , parseContext));
param.disableOutput();
param.insertParameter("init_rock" , "false" );
param.insertParameter("threephase_model", "simple");
@ -61,8 +58,8 @@ struct SetupSimple {
}
Opm::parameter::ParameterGroup param;
Opm::DeckConstPtr deck;
Opm::EclipseStateConstPtr eclState;
Opm::Deck deck;
Opm::EclipseState eclState;
};
@ -71,7 +68,7 @@ struct TestFixture : public Setup
{
TestFixture()
: Setup()
, grid (*eclState->getInputGrid())
, grid (eclState.getInputGrid())
, ad_props(deck, eclState, *grid.c_grid(), param.getDefault("init_rock", false))
{
}

View File

@ -91,10 +91,9 @@ SOF2 \n\
BOOST_AUTO_TEST_CASE(Construction)
{
Opm::ParseContext parseContext;
Opm::ParserPtr parser(new Opm::Parser());
Opm::DeckPtr deck = parser->parseString(deckData + solventData, parseContext);
Opm::EclipseStateConstPtr eclState;
eclState.reset(new Opm::EclipseState(*deck , parseContext));
Opm::Parser parser;
auto deck = parser.parseString(deckData + solventData, parseContext);
Opm::EclipseState eclState(deck , parseContext);
std::vector<int> global_ind = {0 , 1 , 2};
Opm::SolventPropsAdFromDeck solventprops(deck, eclState, 3, global_ind.data());
}
@ -102,10 +101,9 @@ BOOST_AUTO_TEST_CASE(Construction)
BOOST_AUTO_TEST_CASE(SolventData)
{
Opm::ParseContext parseContext;
Opm::ParserPtr parser(new Opm::Parser());
Opm::DeckPtr deck = parser->parseString(deckData + solventData, parseContext);
Opm::EclipseStateConstPtr eclState;
eclState.reset(new Opm::EclipseState(*deck , parseContext));
Opm::Parser parser;
auto deck = parser.parseString(deckData + solventData, parseContext);
Opm::EclipseState eclState(deck , parseContext);
std::vector<int> global_ind = {0 , 1 , 2};
Opm::SolventPropsAdFromDeck solventprops(deck, eclState, 3, global_ind.data());
@ -128,10 +126,9 @@ PMISC\n\
BOOST_AUTO_TEST_CASE(PMISC)
{
Opm::ParseContext parseContext;
Opm::ParserPtr parser(new Opm::Parser());
Opm::DeckPtr deck = parser->parseString(deckData + solventData + pmiscData, parseContext);
Opm::EclipseStateConstPtr eclState;
eclState.reset(new Opm::EclipseState(*deck , parseContext));
Opm::Parser parser;
auto deck = parser.parseString(deckData + solventData + pmiscData, parseContext);
Opm::EclipseState eclState(deck , parseContext);
const Opm::SolventPropsAdFromDeck::Cells cells(3, 0);
typedef Opm::SolventPropsAdFromDeck::V V;
std::vector<int> global_ind = {0 , 1 , 2};
@ -161,10 +158,9 @@ TLPMIXPA\n\
BOOST_AUTO_TEST_CASE(TLPMIXPA)
{
Opm::ParseContext parseContext;
Opm::ParserPtr parser(new Opm::Parser());
Opm::DeckPtr deck = parser->parseString(deckData + solventData + tlpmixpaData, parseContext);
Opm::EclipseStateConstPtr eclState;
eclState.reset(new Opm::EclipseState(*deck , parseContext));
Opm::Parser parser;
auto deck = parser.parseString(deckData + solventData + tlpmixpaData, parseContext);
Opm::EclipseState eclState(deck , parseContext);
const Opm::SolventPropsAdFromDeck::Cells cells(3, 0);
typedef Opm::SolventPropsAdFromDeck::V V;
const int* global_ind = new int[3] {0 , 1 , 2};
@ -185,11 +181,10 @@ BOOST_AUTO_TEST_CASE(TLPMIXPA)
BOOST_AUTO_TEST_CASE(TLPMIXPA_NOT_SPECIFIED)
{
Opm::ParseContext parseContext;
Opm::ParserPtr parser(new Opm::Parser());
Opm::Parser parser;
// no pmisc data and default tlpmixdata i.e it should throw
Opm::DeckPtr deck = parser->parseString(deckData + solventData, parseContext);
Opm::EclipseStateConstPtr eclState;
eclState.reset(new Opm::EclipseState(*deck , parseContext));
auto deck = parser.parseString(deckData + solventData, parseContext);
Opm::EclipseState eclState(deck , parseContext);
const Opm::SolventPropsAdFromDeck::Cells cells(3, 0);
const int* global_ind = new int[3] {0 , 1 , 2};
Opm::SolventPropsAdFromDeck solventprops(deck, eclState, 3, global_ind);
@ -215,10 +210,9 @@ TLPMIXPA\n\
BOOST_AUTO_TEST_CASE(TLPMIXPA_DEFAULT)
{
Opm::ParseContext parseContext;
Opm::ParserPtr parser(new Opm::Parser());
Opm::DeckPtr deck = parser->parseString(deckData + solventData + pmiscData + tlpmixpaDataDefault, parseContext);
Opm::EclipseStateConstPtr eclState;
eclState.reset(new Opm::EclipseState(*deck , parseContext));
Opm::Parser parser;
auto deck = parser.parseString(deckData + solventData + pmiscData + tlpmixpaDataDefault, parseContext);
Opm::EclipseState eclState(deck , parseContext);
const Opm::SolventPropsAdFromDeck::Cells cells(3, 0);
typedef Opm::SolventPropsAdFromDeck::V V;
const int* global_ind = new int[3] {0 , 1 , 2};
@ -239,11 +233,10 @@ BOOST_AUTO_TEST_CASE(TLPMIXPA_DEFAULT)
BOOST_AUTO_TEST_CASE(TLPMIXPA_DEFAULT_NOPMISC)
{
Opm::ParseContext parseContext;
Opm::ParserPtr parser(new Opm::Parser());
Opm::Parser parser;
// no pmisc data and default tlpmixdata i.e it should throw
Opm::DeckPtr deck = parser->parseString(deckData + solventData + tlpmixpaDataDefault, parseContext);
Opm::EclipseStateConstPtr eclState;
eclState.reset(new Opm::EclipseState(*deck , parseContext));
auto deck = parser.parseString(deckData + solventData + tlpmixpaDataDefault, parseContext);
Opm::EclipseState eclState(deck , parseContext);
const Opm::SolventPropsAdFromDeck::Cells cells(3, 0);
const int* global_ind = new int[3] {0 , 1 , 2};
BOOST_CHECK_THROW(Opm::SolventPropsAdFromDeck solventprops(deck, eclState, 3, global_ind), std::invalid_argument);

View File

@ -157,15 +157,15 @@ void checkTransmissibilityValues(const G& grid,
BOOST_AUTO_TEST_CASE(TransmissibilityMultipliersLegacyGridInterface)
{
Opm::parameter::ParameterGroup param;
Opm::ParserPtr parser(new Opm::Parser() );
Opm::Parser parser;
Opm::ParseContext parseContext;
/////
// create a DerivedGeology object without any multipliers involved
Opm::DeckConstPtr origDeck = parser->parseString(origDeckString, parseContext);
Opm::EclipseStateConstPtr origEclipseState(new Opm::EclipseState(*origDeck , parseContext));
auto origDeck = parser.parseString(origDeckString, parseContext);
Opm::EclipseState origEclipseState(origDeck , parseContext);
auto origGridManager = std::make_shared<Opm::GridManager>(*origEclipseState->getInputGrid());
auto origGridManager = std::make_shared<Opm::GridManager>(origEclipseState.getInputGrid());
auto origProps = std::make_shared<Opm::BlackoilPropsAdFromDeck>(origDeck, origEclipseState, *(origGridManager->c_grid()));
Opm::DerivedGeology origGeology(*(origGridManager->c_grid()), *origProps, origEclipseState, false);
@ -173,10 +173,10 @@ BOOST_AUTO_TEST_CASE(TransmissibilityMultipliersLegacyGridInterface)
/////
// create a DerivedGeology object _with_ transmissibility multipliers involved
Opm::DeckConstPtr multDeck = parser->parseString(multDeckString, parseContext);
Opm::EclipseStateConstPtr multEclipseState(new Opm::EclipseState(*multDeck, parseContext));
auto multDeck = parser.parseString(multDeckString, parseContext);
Opm::EclipseState multEclipseState(multDeck, parseContext);
auto multGridManager = std::make_shared<Opm::GridManager>(*multEclipseState->getInputGrid());
auto multGridManager = std::make_shared<Opm::GridManager>(multEclipseState.getInputGrid());
auto multProps = std::make_shared<Opm::BlackoilPropsAdFromDeck>(multDeck, multEclipseState, *(multGridManager->c_grid()));
Opm::DerivedGeology multGeology(*(multGridManager->c_grid()), *multProps, multEclipseState, false);
@ -185,10 +185,10 @@ BOOST_AUTO_TEST_CASE(TransmissibilityMultipliersLegacyGridInterface)
/////
// create a DerivedGeology object _with_ transmissibility multipliers involved for
// the negative faces
Opm::DeckConstPtr multMinusDeck = parser->parseString(multMinusDeckString, parseContext);
Opm::EclipseStateConstPtr multMinusEclipseState(new Opm::EclipseState(*multMinusDeck , parseContext));
auto multMinusDeck = parser.parseString(multMinusDeckString, parseContext);
Opm::EclipseState multMinusEclipseState(multMinusDeck , parseContext);
auto multMinusGridManager = std::make_shared<Opm::GridManager>(*multMinusEclipseState->getInputGrid());
auto multMinusGridManager = std::make_shared<Opm::GridManager>(multMinusEclipseState.getInputGrid());
auto multMinusProps = std::make_shared<Opm::BlackoilPropsAdFromDeck>(multMinusDeck, multMinusEclipseState, *(multMinusGridManager->c_grid()));
Opm::DerivedGeology multMinusGeology(*(multMinusGridManager->c_grid()), *multMinusProps, multMinusEclipseState, false);
@ -196,10 +196,10 @@ BOOST_AUTO_TEST_CASE(TransmissibilityMultipliersLegacyGridInterface)
/////
// create a DerivedGeology object with the NTG keyword involved
Opm::DeckConstPtr ntgDeck = parser->parseString(ntgDeckString, parseContext);
Opm::EclipseStateConstPtr ntgEclipseState(new Opm::EclipseState(*ntgDeck, parseContext));
auto ntgDeck = parser.parseString(ntgDeckString, parseContext);
Opm::EclipseState ntgEclipseState(ntgDeck, parseContext);
auto ntgGridManager = std::make_shared<Opm::GridManager>(*ntgEclipseState->getInputGrid());
auto ntgGridManager = std::make_shared<Opm::GridManager>(ntgEclipseState.getInputGrid());
auto ntgProps = std::make_shared<Opm::BlackoilPropsAdFromDeck>(ntgDeck, ntgEclipseState, *(ntgGridManager->c_grid()));
Opm::DerivedGeology ntgGeology(*(ntgGridManager->c_grid()), *ntgProps, ntgEclipseState, false);
@ -272,16 +272,16 @@ BOOST_AUTO_TEST_CASE(TransmissibilityMultipliersCpGrid)
Dune::MPIHelper::instance(argc, argv);
Opm::parameter::ParameterGroup param;
Opm::ParserPtr parser(new Opm::Parser() );
Opm::Parser parser;
Opm::ParseContext parseContext;
/////
// create a DerivedGeology object without any multipliers involved
Opm::DeckConstPtr origDeck = parser->parseString(origDeckString , parseContext);
Opm::EclipseStateConstPtr origEclipseState(new Opm::EclipseState(*origDeck , parseContext));
auto origDeck = parser.parseString(origDeckString , parseContext);
Opm::EclipseState origEclipseState(origDeck , parseContext);
auto origGrid = std::make_shared<Dune::CpGrid>();
origGrid->processEclipseFormat(*origEclipseState->getInputGrid(), 0.0, false);
origGrid->processEclipseFormat(origEclipseState.getInputGrid(), 0.0, false);
auto origProps = std::make_shared<Opm::BlackoilPropsAdFromDeck>(origDeck,
origEclipseState,
@ -292,11 +292,11 @@ BOOST_AUTO_TEST_CASE(TransmissibilityMultipliersCpGrid)
/////
// create a DerivedGeology object _with_ transmissibility multipliers involved
Opm::DeckConstPtr multDeck = parser->parseString(multDeckString,parseContext);
Opm::EclipseStateConstPtr multEclipseState(new Opm::EclipseState(*multDeck, parseContext));
auto multDeck = parser.parseString(multDeckString,parseContext);
Opm::EclipseState multEclipseState(multDeck, parseContext);
auto multGrid = std::make_shared<Dune::CpGrid>();
multGrid->processEclipseFormat(*multEclipseState->getInputGrid(), 0.0, false);
multGrid->processEclipseFormat(multEclipseState.getInputGrid(), 0.0, false);
auto multProps = std::make_shared<Opm::BlackoilPropsAdFromDeck>(multDeck, multEclipseState, *multGrid);
@ -306,11 +306,11 @@ BOOST_AUTO_TEST_CASE(TransmissibilityMultipliersCpGrid)
/////
// create a DerivedGeology object _with_ transmissibility multipliers involved for
// the negative faces
Opm::DeckConstPtr multMinusDeck = parser->parseString(multMinusDeckString , parseContext);
Opm::EclipseStateConstPtr multMinusEclipseState(new Opm::EclipseState(*multMinusDeck, parseContext));
const auto& multMinusDeck = parser.parseString(multMinusDeckString , parseContext);
Opm::EclipseState multMinusEclipseState(multMinusDeck, parseContext);
auto multMinusGrid = std::make_shared<Dune::CpGrid>();
multMinusGrid->processEclipseFormat(*multMinusEclipseState->getInputGrid(), 0.0, false);
multMinusGrid->processEclipseFormat(multMinusEclipseState.getInputGrid(), 0.0, false);
auto multMinusProps = std::make_shared<Opm::BlackoilPropsAdFromDeck>(multMinusDeck, multMinusEclipseState, *multMinusGrid);
@ -320,11 +320,11 @@ BOOST_AUTO_TEST_CASE(TransmissibilityMultipliersCpGrid)
/////
// create a DerivedGeology object with the NTG keyword involved
Opm::DeckConstPtr ntgDeck = parser->parseString(ntgDeckString, parseContext);
Opm::EclipseStateConstPtr ntgEclipseState(new Opm::EclipseState(*ntgDeck, parseContext));
auto ntgDeck = parser.parseString(ntgDeckString, parseContext);
Opm::EclipseState ntgEclipseState(ntgDeck, parseContext);
auto ntgGrid = std::make_shared<Dune::CpGrid>();
ntgGrid->processEclipseFormat(*ntgEclipseState->getInputGrid(), 0.0, false);
ntgGrid->processEclipseFormat(ntgEclipseState.getInputGrid(), 0.0, false);
auto ntgProps = std::make_shared<Opm::BlackoilPropsAdFromDeck>(ntgDeck, ntgEclipseState, *ntgGrid);

View File

@ -1043,18 +1043,16 @@ VFPPROD \n\
2 1 1 1 1.0 / \n\
";
Opm::DeckConstPtr deck;
std::shared_ptr<Opm::UnitSystem> units(Opm::UnitSystem::newFIELD());
Opm::ParserPtr parser(new Opm::Parser());
auto units = Opm::UnitSystem::newFIELD();
Opm::Parser parser;
Opm::ParseContext parse_mode;
deck = parser->parseString(table_str, parse_mode);
auto deck = parser.parseString(table_str, parse_mode);
BOOST_REQUIRE(deck->hasKeyword("VFPPROD"));
BOOST_CHECK_EQUAL(deck->count("VFPPROD"), 1);
BOOST_REQUIRE(deck.hasKeyword("VFPPROD"));
BOOST_CHECK_EQUAL(deck.count("VFPPROD"), 1);
Opm::VFPProdTable table;
table.init(deck->getKeyword("VFPPROD", 0), *units);
table.init(deck.getKeyword("VFPPROD", 0), units);
Opm::VFPProdProperties properties(&table);
@ -1104,21 +1102,20 @@ VFPPROD \n\
*/
BOOST_AUTO_TEST_CASE(ParseInterpolateRealisticVFPPROD)
{
Opm::DeckConstPtr deck;
std::shared_ptr<Opm::UnitSystem> units(Opm::UnitSystem::newMETRIC());
auto units = Opm::UnitSystem::newMETRIC();
Opm::ParserPtr parser(new Opm::Parser());
Opm::Parser parser;
Opm::ParseContext parse_mode;
boost::filesystem::path file("VFPPROD2");
deck = parser->parseFile(file.string(), parse_mode);
auto deck = parser.parseFile(file.string(), parse_mode);
Opm::checkDeck(deck, parser);
BOOST_REQUIRE(deck->hasKeyword("VFPPROD"));
BOOST_CHECK_EQUAL(deck->count("VFPPROD"), 1);
BOOST_REQUIRE(deck.hasKeyword("VFPPROD"));
BOOST_CHECK_EQUAL(deck.count("VFPPROD"), 1);
Opm::VFPProdTable table;
table.init(deck->getKeyword("VFPPROD", 0), *units);
table.init(deck.getKeyword("VFPPROD", 0), units);
Opm::VFPProdProperties properties(&table);