mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #101 from andlaus/sim_fibo_ad_use_new_wellmanager
sim_fibo_ad: convert to the new-style wells manager
This commit is contained in:
commit
f99b9b90a4
@ -200,7 +200,6 @@ try
|
|||||||
param.writeParam(output_dir + "/simulation.param");
|
param.writeParam(output_dir + "/simulation.param");
|
||||||
}
|
}
|
||||||
|
|
||||||
#warning "TODO: convert the well handling code to the new parser"
|
|
||||||
#if USE_NEW_PARSER
|
#if USE_NEW_PARSER
|
||||||
std::cout << "\n\n================ Starting main simulation loop ===============\n"
|
std::cout << "\n\n================ Starting main simulation loop ===============\n"
|
||||||
<< std::flush;
|
<< std::flush;
|
||||||
@ -208,38 +207,59 @@ try
|
|||||||
WellStateFullyImplicitBlackoil well_state;
|
WellStateFullyImplicitBlackoil well_state;
|
||||||
Opm::TimeMapPtr timeMap(new Opm::TimeMap(newParserDeck));
|
Opm::TimeMapPtr timeMap(new Opm::TimeMap(newParserDeck));
|
||||||
SimulatorTimer simtimer;
|
SimulatorTimer simtimer;
|
||||||
|
std::shared_ptr<EclipseState> eclipseState(new EclipseState(newParserDeck));
|
||||||
|
|
||||||
// Create new wells, well_state
|
// initialize variables
|
||||||
WellsManager wells(*deck, *grid->c_grid(), props->permeability());
|
simtimer.init(timeMap, /*beginReportStepIdx=*/0, /*endReportStepIdx=*/0);
|
||||||
// @@@ HACK: we should really make a new well state and
|
|
||||||
// properly transfer old well state to it every epoch,
|
|
||||||
// since number of wells may change etc.
|
|
||||||
well_state.init(wells.c_wells(), state);
|
|
||||||
|
|
||||||
// Create and run simulator.
|
SimulatorReport fullReport;
|
||||||
SimulatorFullyImplicitBlackoil simulator(param,
|
for (size_t episodeIdx = 0; episodeIdx < timeMap->numTimesteps(); ++episodeIdx) {
|
||||||
*grid->c_grid(),
|
WellsManager wells(eclipseState,
|
||||||
*new_props,
|
episodeIdx,
|
||||||
rock_comp->isActive() ? rock_comp.get() : 0,
|
*grid->c_grid(),
|
||||||
wells,
|
props->permeability());
|
||||||
linsolver,
|
|
||||||
grav,
|
|
||||||
outputWriter);
|
|
||||||
simtimer.init(timeMap);
|
|
||||||
SimulatorReport report = simulator.run(simtimer, state, well_state);
|
|
||||||
|
|
||||||
if (output) {
|
if (episodeIdx == 0) {
|
||||||
report.reportParam(outStream);
|
// @@@ HACK: we should really make a new well state and
|
||||||
warnIfUnusedParams(param);
|
// properly transfer old well state to it every epoch,
|
||||||
|
// since number of wells may change etc.
|
||||||
|
well_state.init(wells.c_wells(), state);
|
||||||
|
}
|
||||||
|
|
||||||
|
simtimer.init(timeMap,
|
||||||
|
/*beginReportStepIdx=*/episodeIdx,
|
||||||
|
/*endReportStepIdx=*/episodeIdx + 1);
|
||||||
|
|
||||||
|
if (episodeIdx == 0)
|
||||||
|
outputWriter.writeInit(simtimer, state, well_state.basicWellState());
|
||||||
|
|
||||||
|
// Create and run simulator.
|
||||||
|
SimulatorFullyImplicitBlackoil simulator(param,
|
||||||
|
*grid->c_grid(),
|
||||||
|
*new_props,
|
||||||
|
rock_comp->isActive() ? rock_comp.get() : 0,
|
||||||
|
wells,
|
||||||
|
linsolver,
|
||||||
|
grav,
|
||||||
|
outputWriter);
|
||||||
|
SimulatorReport episodeReport = simulator.run(simtimer, state, well_state);
|
||||||
|
|
||||||
|
outputWriter.writeTimeStep(simtimer, state, well_state.basicWellState());
|
||||||
|
fullReport += episodeReport;
|
||||||
|
|
||||||
|
if (output) {
|
||||||
|
episodeReport.reportParam(outStream);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "\n\n================ End of simulation ===============\n\n";
|
std::cout << "\n\n================ End of simulation ===============\n\n";
|
||||||
report.report(std::cout);
|
fullReport.report(std::cout);
|
||||||
|
|
||||||
if (output) {
|
if (output) {
|
||||||
std::string filename = output_dir + "/walltime.param";
|
std::string filename = output_dir + "/walltime.param";
|
||||||
std::fstream tot_os(filename.c_str(),std::fstream::trunc | std::fstream::out);
|
std::fstream tot_os(filename.c_str(),std::fstream::trunc | std::fstream::out);
|
||||||
report.reportParam(tot_os);
|
fullReport.reportParam(tot_os);
|
||||||
|
warnIfUnusedParams(param);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
std::cout << "\n\n================ Starting main simulation loop ===============\n"
|
std::cout << "\n\n================ Starting main simulation loop ===============\n"
|
||||||
@ -254,6 +274,7 @@ try
|
|||||||
// Use timer for last epoch to obtain total time.
|
// Use timer for last epoch to obtain total time.
|
||||||
deck->setCurrentEpoch(deck->numberOfEpochs() - 1);
|
deck->setCurrentEpoch(deck->numberOfEpochs() - 1);
|
||||||
simtimer.init(*deck);
|
simtimer.init(*deck);
|
||||||
|
|
||||||
const double total_time = simtimer.totalTime();
|
const double total_time = simtimer.totalTime();
|
||||||
for (int epoch = 0; epoch < deck->numberOfEpochs(); ++epoch) {
|
for (int epoch = 0; epoch < deck->numberOfEpochs(); ++epoch) {
|
||||||
// Set epoch index.
|
// Set epoch index.
|
||||||
@ -285,6 +306,9 @@ try
|
|||||||
well_state.init(wells.c_wells(), state);
|
well_state.init(wells.c_wells(), state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (epoch == 0)
|
||||||
|
outputWriter.writeInit(simtimer, state, well_state.basicWellState());
|
||||||
|
|
||||||
// Create and run simulator.
|
// Create and run simulator.
|
||||||
SimulatorFullyImplicitBlackoil simulator(param,
|
SimulatorFullyImplicitBlackoil simulator(param,
|
||||||
*grid->c_grid(),
|
*grid->c_grid(),
|
||||||
@ -294,6 +318,8 @@ try
|
|||||||
linsolver,
|
linsolver,
|
||||||
grav,
|
grav,
|
||||||
outputWriter);
|
outputWriter);
|
||||||
|
outputWriter.writeTimeStep(simtimer, state, well_state.basicWellState());
|
||||||
|
|
||||||
if (epoch == 0) {
|
if (epoch == 0) {
|
||||||
warnIfUnusedParams(param);
|
warnIfUnusedParams(param);
|
||||||
}
|
}
|
||||||
|
@ -314,9 +314,6 @@ namespace Opm
|
|||||||
BlackoilState& state,
|
BlackoilState& state,
|
||||||
WellStateFullyImplicitBlackoil& well_state)
|
WellStateFullyImplicitBlackoil& well_state)
|
||||||
{
|
{
|
||||||
eclipseWriter_.writeInit(timer, state, well_state.basicWellState());
|
|
||||||
eclipseWriter_.writeTimeStep(timer, state, well_state.basicWellState());
|
|
||||||
|
|
||||||
// Initialisation.
|
// Initialisation.
|
||||||
std::vector<double> porevol;
|
std::vector<double> porevol;
|
||||||
if (rock_comp_props_ && rock_comp_props_->isActive()) {
|
if (rock_comp_props_ && rock_comp_props_->isActive()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user