SimulatorTwophase::run() returns a timing report. Refined output.
This commit is contained in:
parent
294ce0b579
commit
f0aec74997
@ -68,9 +68,9 @@ namespace Opm
|
|||||||
LinearSolverInterface& linsolver,
|
LinearSolverInterface& linsolver,
|
||||||
const double* gravity);
|
const double* gravity);
|
||||||
|
|
||||||
void run(SimulatorTimer& timer,
|
SimulatorReport run(SimulatorTimer& timer,
|
||||||
TwophaseState& state,
|
TwophaseState& state,
|
||||||
WellState& well_state);
|
WellState& well_state);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Data.
|
// Data.
|
||||||
@ -120,11 +120,12 @@ namespace Opm
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void SimulatorTwophase::run(SimulatorTimer& timer,
|
SimulatorTwophase::SimulatorReport
|
||||||
TwophaseState& state,
|
SimulatorTwophase::run(SimulatorTimer& timer,
|
||||||
WellState& well_state)
|
TwophaseState& state,
|
||||||
|
WellState& well_state)
|
||||||
{
|
{
|
||||||
pimpl_->run(timer, state, well_state);
|
return pimpl_->run(timer, state, well_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -210,7 +211,7 @@ namespace Opm
|
|||||||
linsolver_(linsolver),
|
linsolver_(linsolver),
|
||||||
gravity_(gravity),
|
gravity_(gravity),
|
||||||
psolver_(grid, props, rock_comp, linsolver,
|
psolver_(grid, props, rock_comp, linsolver,
|
||||||
param.getDefault("nl_pressure_residual_tolerance", 1e-8),
|
param.getDefault("nl_pressure_residual_tolerance", 0.0),
|
||||||
param.getDefault("nl_pressure_change_tolerance", 1.0),
|
param.getDefault("nl_pressure_change_tolerance", 1.0),
|
||||||
param.getDefault("nl_pressure_maxiter", 10),
|
param.getDefault("nl_pressure_maxiter", 10),
|
||||||
gravity, wells, src, bcs),
|
gravity, wells, src, bcs),
|
||||||
@ -252,9 +253,10 @@ namespace Opm
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void SimulatorTwophase::Impl::run(SimulatorTimer& timer,
|
SimulatorTwophase::SimulatorReport
|
||||||
TwophaseState& state,
|
SimulatorTwophase::Impl::run(SimulatorTimer& timer,
|
||||||
WellState& well_state)
|
TwophaseState& state,
|
||||||
|
WellState& well_state)
|
||||||
{
|
{
|
||||||
std::vector<double> transport_src;
|
std::vector<double> transport_src;
|
||||||
|
|
||||||
@ -275,7 +277,6 @@ namespace Opm
|
|||||||
double ttime = 0.0;
|
double ttime = 0.0;
|
||||||
Opm::time::StopWatch total_timer;
|
Opm::time::StopWatch total_timer;
|
||||||
total_timer.start();
|
total_timer.start();
|
||||||
std::cout << "\n\n================ Starting main simulation loop ===============" << std::endl;
|
|
||||||
double init_satvol[2] = { 0.0 };
|
double init_satvol[2] = { 0.0 };
|
||||||
double satvol[2] = { 0.0 };
|
double satvol[2] = { 0.0 };
|
||||||
double injected[2] = { 0.0 };
|
double injected[2] = { 0.0 };
|
||||||
@ -377,12 +378,6 @@ namespace Opm
|
|||||||
well_state.bhp(), well_state.perfRates());
|
well_state.bhp(), well_state.perfRates());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
total_timer.stop();
|
|
||||||
|
|
||||||
std::cout << "\n\n================ End of simulation ===============\n"
|
|
||||||
<< "Total time taken: " << total_timer.secsSinceStart()
|
|
||||||
<< "\n Pressure time: " << ptime
|
|
||||||
<< "\n Transport time: " << ttime << std::endl;
|
|
||||||
|
|
||||||
if (output_) {
|
if (output_) {
|
||||||
outputState(grid_, state, timer.currentStepNum(), output_dir_);
|
outputState(grid_, state, timer.currentStepNum(), output_dir_);
|
||||||
@ -392,8 +387,39 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
total_timer.stop();
|
||||||
|
|
||||||
|
SimulatorReport report;
|
||||||
|
report.pressure_time = ptime;
|
||||||
|
report.transport_time = ttime;
|
||||||
|
report.total_time = total_timer.secsSinceStart();
|
||||||
|
return report;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Methods for SimulatorReport.
|
||||||
|
|
||||||
|
SimulatorTwophase::SimulatorReport::SimulatorReport()
|
||||||
|
: pressure_time(0.0),
|
||||||
|
transport_time(0.0),
|
||||||
|
total_time(0.0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void SimulatorTwophase::SimulatorReport::operator+=(const SimulatorReport& sr)
|
||||||
|
{
|
||||||
|
pressure_time += sr.pressure_time;
|
||||||
|
transport_time += sr.transport_time;
|
||||||
|
total_time += sr.total_time;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SimulatorTwophase::SimulatorReport::report(std::ostream& os)
|
||||||
|
{
|
||||||
|
os << "Total time taken: " << total_time
|
||||||
|
<< "\n Pressure time: " << pressure_time
|
||||||
|
<< "\n Transport time: " << total_time << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Opm
|
} // namespace Opm
|
||||||
|
@ -75,15 +75,27 @@ namespace Opm
|
|||||||
LinearSolverInterface& linsolver,
|
LinearSolverInterface& linsolver,
|
||||||
const double* gravity);
|
const double* gravity);
|
||||||
|
|
||||||
|
/// A struct for returning timing data to the client.
|
||||||
|
struct SimulatorReport
|
||||||
|
{
|
||||||
|
double pressure_time;
|
||||||
|
double transport_time;
|
||||||
|
double total_time;
|
||||||
|
SimulatorReport();
|
||||||
|
void operator+=(const SimulatorReport& sr);
|
||||||
|
void report(std::ostream& os);
|
||||||
|
};
|
||||||
|
|
||||||
/// Run the simulation.
|
/// Run the simulation.
|
||||||
/// This will run succesive timesteps until timer.done() is true. It will
|
/// This will run succesive timesteps until timer.done() is true. It will
|
||||||
/// modify the reservoir and well states.
|
/// modify the reservoir and well states.
|
||||||
/// \param[in,out] timer governs the requested reporting timesteps
|
/// \param[in,out] timer governs the requested reporting timesteps
|
||||||
/// \param[in,out] state state of reservoir: pressure, fluxes
|
/// \param[in,out] state state of reservoir: pressure, fluxes
|
||||||
/// \param[in,out] well_state state of wells: bhp, perforation rates
|
/// \param[in,out] well_state state of wells: bhp, perforation rates
|
||||||
void run(SimulatorTimer& timer,
|
/// \return simulation report, with timing data
|
||||||
TwophaseState& state,
|
SimulatorReport run(SimulatorTimer& timer,
|
||||||
WellState& well_state);
|
TwophaseState& state,
|
||||||
|
WellState& well_state);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class Impl;
|
class Impl;
|
||||||
|
Loading…
Reference in New Issue
Block a user