mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-23 07:53:29 -06:00
Make solver object a member of SimulatorFullyImplicitBlackoilEbos.
This commit is contained in:
parent
ed591239a7
commit
7f3635145b
@ -1064,11 +1064,6 @@ namespace Opm {
|
|||||||
return convergence_reports_;
|
return convergence_reports_;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<StepReport> getStepReportsDestructively() const
|
|
||||||
{
|
|
||||||
return std::move(this->convergence_reports_);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// --------- Data members ---------
|
// --------- Data members ---------
|
||||||
|
|
||||||
|
@ -362,7 +362,9 @@ public:
|
|||||||
// Run a multiple steps of the solver depending on the time step control.
|
// Run a multiple steps of the solver depending on the time step control.
|
||||||
solverTimer_->start();
|
solverTimer_->start();
|
||||||
|
|
||||||
auto solver = createSolver(wellModel_());
|
if (!solver_) {
|
||||||
|
solver_ = createSolver(wellModel_());
|
||||||
|
}
|
||||||
|
|
||||||
ebosSimulator_.startNextEpisode(
|
ebosSimulator_.startNextEpisode(
|
||||||
ebosSimulator_.startTime()
|
ebosSimulator_.startTime()
|
||||||
@ -375,8 +377,7 @@ public:
|
|||||||
loadStep_ = -1;
|
loadStep_ = -1;
|
||||||
ebosSimulator_.model().invalidateAndUpdateIntensiveQuantities(/*timeIdx=*/0);
|
ebosSimulator_.model().invalidateAndUpdateIntensiveQuantities(/*timeIdx=*/0);
|
||||||
}
|
}
|
||||||
solver->model().beginReportStep();
|
solver_->model().beginReportStep();
|
||||||
|
|
||||||
bool enableTUNING = EWOMS_GET_PARAM(TypeTag, bool, EnableTuning);
|
bool enableTUNING = EWOMS_GET_PARAM(TypeTag, bool, EnableTuning);
|
||||||
|
|
||||||
// If sub stepping is enabled allow the solver to sub cycle
|
// If sub stepping is enabled allow the solver to sub cycle
|
||||||
@ -398,13 +399,13 @@ public:
|
|||||||
events.hasEvent(ScheduleEvents::INJECTION_TYPE_CHANGED) ||
|
events.hasEvent(ScheduleEvents::INJECTION_TYPE_CHANGED) ||
|
||||||
events.hasEvent(ScheduleEvents::WELL_SWITCHED_INJECTOR_PRODUCER) ||
|
events.hasEvent(ScheduleEvents::WELL_SWITCHED_INJECTOR_PRODUCER) ||
|
||||||
events.hasEvent(ScheduleEvents::WELL_STATUS_CHANGE);
|
events.hasEvent(ScheduleEvents::WELL_STATUS_CHANGE);
|
||||||
auto stepReport = adaptiveTimeStepping_->step(timer, *solver, event, nullptr);
|
auto stepReport = adaptiveTimeStepping_->step(timer, *solver_, event, nullptr);
|
||||||
report_ += stepReport;
|
report_ += stepReport;
|
||||||
//Pass simulation report to eclwriter for summary output
|
//Pass simulation report to eclwriter for summary output
|
||||||
ebosSimulator_.problem().setSimulationReport(report_);
|
ebosSimulator_.problem().setSimulationReport(report_);
|
||||||
} else {
|
} else {
|
||||||
// solve for complete report step
|
// solve for complete report step
|
||||||
auto stepReport = solver->step(timer);
|
auto stepReport = solver_->step(timer);
|
||||||
report_ += stepReport;
|
report_ += stepReport;
|
||||||
if (terminalOutput_) {
|
if (terminalOutput_) {
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
@ -421,7 +422,7 @@ public:
|
|||||||
ebosSimulator_.problem().writeOutput();
|
ebosSimulator_.problem().writeOutput();
|
||||||
report_.success.output_write_time += perfTimer.stop();
|
report_.success.output_write_time += perfTimer.stop();
|
||||||
|
|
||||||
solver->model().endReportStep();
|
solver_->model().endReportStep();
|
||||||
|
|
||||||
// take time that was used to solve system for this reportStep
|
// take time that was used to solve system for this reportStep
|
||||||
solverTimer_->stop();
|
solverTimer_->stop();
|
||||||
@ -430,10 +431,10 @@ public:
|
|||||||
report_.success.solver_time += solverTimer_->secsSinceStart();
|
report_.success.solver_time += solverTimer_->secsSinceStart();
|
||||||
|
|
||||||
if (this->grid().comm().rank() == 0) {
|
if (this->grid().comm().rank() == 0) {
|
||||||
// Destructively grab the step convergence reports. The solver
|
// Grab the step convergence reports that are new since last we were here.
|
||||||
// object and the model object contained therein are about to go
|
const auto& reps = solver_->model().stepReports();
|
||||||
// out of scope.
|
this->writeConvergenceOutput(std::vector<StepReport>{reps.begin() + already_reported_steps_, reps.end()});
|
||||||
this->writeConvergenceOutput(solver->model().getStepReportsDestructively());
|
already_reported_steps_ = reps.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Increment timer, remember well state.
|
// Increment timer, remember well state.
|
||||||
@ -486,6 +487,9 @@ public:
|
|||||||
serializer(adaptiveTimeStepping_);
|
serializer(adaptiveTimeStepping_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Model& model() const
|
||||||
|
{ return solver_->model(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
std::unique_ptr<Solver> createSolver(WellModel& wellModel)
|
std::unique_ptr<Solver> createSolver(WellModel& wellModel)
|
||||||
@ -702,12 +706,15 @@ protected:
|
|||||||
ModelParameters modelParam_;
|
ModelParameters modelParam_;
|
||||||
SolverParameters solverParam_;
|
SolverParameters solverParam_;
|
||||||
|
|
||||||
|
std::unique_ptr<Solver> solver_;
|
||||||
|
|
||||||
// Observed objects.
|
// Observed objects.
|
||||||
PhaseUsage phaseUsage_;
|
PhaseUsage phaseUsage_;
|
||||||
// Misc. data
|
// Misc. data
|
||||||
bool terminalOutput_;
|
bool terminalOutput_;
|
||||||
|
|
||||||
SimulatorReport report_;
|
SimulatorReport report_;
|
||||||
|
std::size_t already_reported_steps_ = 0;
|
||||||
std::unique_ptr<time::StopWatch> solverTimer_;
|
std::unique_ptr<time::StopWatch> solverTimer_;
|
||||||
std::unique_ptr<time::StopWatch> totalTimer_;
|
std::unique_ptr<time::StopWatch> totalTimer_;
|
||||||
std::unique_ptr<TimeStepper> adaptiveTimeStepping_;
|
std::unique_ptr<TimeStepper> adaptiveTimeStepping_;
|
||||||
|
Loading…
Reference in New Issue
Block a user