merge profiling branch.

This commit is contained in:
Xavier Raynaud 2012-06-14 13:39:12 +02:00
commit 5f4b68fe33
4 changed files with 39 additions and 27 deletions

View File

@ -6,8 +6,7 @@ LDFLAGS = $(BOOST_LDFLAGS)
LDADD = $(top_builddir)/libopmpolymer.la \ LDADD = $(top_builddir)/libopmpolymer.la \
$(BOOST_FILESYSTEM_LIB) \ $(BOOST_FILESYSTEM_LIB) \
$(BOOST_SYSTEM_LIB) \ $(BOOST_SYSTEM_LIB)
/usr/local/lib/libopmcore.la
noinst_PROGRAMS = \ noinst_PROGRAMS = \

View File

@ -84,8 +84,8 @@ namespace Opm
if (dkrds != 0) { if (dkrds != 0) {
dkrds[2*i] = krw_dsw(s[2*i]); dkrds[2*i] = krw_dsw(s[2*i]);
dkrds[2*i+3] = kro_dso(s[2*i+1]); dkrds[2*i+3] = kro_dso(s[2*i+1]);
dkrds[2*i+1] = -dkrds[2*i+3]; dkrds[2*i+1] = 0.0;
dkrds[2*i+2] = -dkrds[2*i]; dkrds[2*i+2] = 0.0;
} }
} }
} }

View File

@ -90,7 +90,7 @@ namespace Opm
LinearSolverInterface& linsolver, LinearSolverInterface& linsolver,
const double* gravity); const double* gravity);
void run(SimulatorTimer& timer, SimulatorReport run(SimulatorTimer& timer,
PolymerState& state, PolymerState& state,
WellState& well_state); WellState& well_state);
@ -144,12 +144,12 @@ namespace Opm
SimulatorPolymer::SimulatorReport
void SimulatorPolymer::run(SimulatorTimer& timer, SimulatorPolymer::run(SimulatorTimer& timer,
PolymerState& state, PolymerState& state,
WellState& well_state) WellState& well_state)
{ {
pimpl_->run(timer, state, well_state); return pimpl_->run(timer, state, well_state);
} }
@ -177,7 +177,7 @@ namespace Opm
linsolver_(linsolver), linsolver_(linsolver),
gravity_(gravity), gravity_(gravity),
psolver_(grid, props, rock_comp_props, poly_props, linsolver, psolver_(grid, props, rock_comp_props, poly_props, 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),
@ -231,8 +231,8 @@ namespace Opm
SimulatorPolymer::SimulatorReport
void SimulatorPolymer::Impl::run(SimulatorTimer& timer, SimulatorPolymer::Impl::run(SimulatorTimer& timer,
PolymerState& state, PolymerState& state,
WellState& well_state) WellState& well_state)
{ {
@ -255,7 +255,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 init_polymass = 0.0; double init_polymass = 0.0;
double satvol[2] = { 0.0 }; double satvol[2] = { 0.0 };
@ -393,12 +392,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_);
@ -407,6 +400,14 @@ namespace Opm
outputWellReport(wellreport, output_dir_); outputWellReport(wellreport, output_dir_);
} }
} }
total_timer.stop();
SimulatorReport report;
report.pressure_time = ptime;
report.transport_time = ttime;
report.total_time = total_timer.secsSinceStart();
return report;
} }

View File

@ -77,13 +77,25 @@ 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
SimulatorReport run(SimulatorTimer& timer,
PolymerState& state, PolymerState& state,
WellState& well_state); WellState& well_state);