mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge branch 'master' into frankenstein
* master: Update to shared_ptr-less parser interface.
This commit is contained in:
@@ -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 );
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user