diff --git a/opm/autodiff/BlackoilModelEbos.hpp b/opm/autodiff/BlackoilModelEbos.hpp index 92f562672..570bc652b 100644 --- a/opm/autodiff/BlackoilModelEbos.hpp +++ b/opm/autodiff/BlackoilModelEbos.hpp @@ -297,13 +297,15 @@ namespace Opm { // equations wellModel().linearize(ebosSimulator().model().linearizer().jacobian(), ebosSimulator().model().linearizer().residual()); - + linear_solve_setup_time_ = 0.0; try { solveJacobianSystem(x); + report.linear_solve_setup_time += linear_solve_setup_time_; report.linear_solve_time += perfTimer.stop(); report.total_linear_iterations += linearIterationsLastSolve(); } catch (...) { + report.linear_solve_setup_time += linear_solve_setup_time_; report.linear_solve_time += perfTimer.stop(); report.total_linear_iterations += linearIterationsLastSolve(); @@ -473,7 +475,10 @@ namespace Opm { x = 0.0; auto& ebosSolver = ebosSimulator_.model().newtonMethod().linearSolver(); + Dune::Timer perfTimer; + perfTimer.start(); ebosSolver.prepare(ebosJac, ebosResid); + linear_solve_setup_time_ = perfTimer.stop(); ebosSolver.setResidual(ebosResid); // actually, the error needs to be calculated after setResidual in order to // account for parallelization properly. since the residual of ECFV @@ -906,7 +911,7 @@ namespace Opm { double dsMax() const { return param_.ds_max_; } double drMaxRel() const { return param_.dr_max_rel_; } double maxResidualAllowed() const { return param_.max_residual_allowed_; } - + double linear_solve_setup_time_; public: std::vector wasSwitched_; }; diff --git a/opm/core/simulator/SimulatorReport.cpp b/opm/core/simulator/SimulatorReport.cpp index 83854ac4a..83878f7a3 100644 --- a/opm/core/simulator/SimulatorReport.cpp +++ b/opm/core/simulator/SimulatorReport.cpp @@ -33,6 +33,7 @@ namespace Opm total_time(0.0), solver_time(0.0), assemble_time(0.0), + linear_solve_setup_time(0.0), linear_solve_time(0.0), update_time(0.0), output_write_time(0.0), @@ -49,6 +50,7 @@ namespace Opm { pressure_time += sr.pressure_time; transport_time += sr.transport_time; + linear_solve_setup_time += sr.linear_solve_setup_time; linear_solve_time += sr.linear_solve_time; solver_time += sr.solver_time; assemble_time += sr.assemble_time; @@ -119,6 +121,14 @@ namespace Opm } os << std::endl; + t = linear_solve_setup_time + (failureReport ? failureReport->linear_solve_setup_time : 0.0); + os << " Linear solve setup time (seconds): " << t; + if (failureReport) { + os << " (Failed: " << failureReport->linear_solve_setup_time << "; " + << 100*failureReport->linear_solve_setup_time/t << "%)"; + } + os << std::endl; + t = update_time + (failureReport ? failureReport->update_time : 0.0); os << " Update time (seconds): " << t; if (failureReport) { diff --git a/opm/core/simulator/SimulatorReport.hpp b/opm/core/simulator/SimulatorReport.hpp index e86f4e7ef..e1ffae61a 100644 --- a/opm/core/simulator/SimulatorReport.hpp +++ b/opm/core/simulator/SimulatorReport.hpp @@ -33,6 +33,7 @@ namespace Opm double total_time; double solver_time; double assemble_time; + double linear_solve_setup_time; double linear_solve_time; double update_time; double output_write_time;