diff --git a/examples/polymer_reorder.cpp b/examples/polymer_reorder.cpp index b4ab76061..0d701ec35 100644 --- a/examples/polymer_reorder.cpp +++ b/examples/polymer_reorder.cpp @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -213,6 +214,12 @@ main(int argc, char** argv) } // Main simulation loop. + Opm::time::StopWatch pressure_timer; + double ptime = 0.0; + Opm::time::StopWatch transport_timer; + double ttime = 0.0; + Opm::time::StopWatch total_timer; + total_timer.start(); std::cout << "\n\n================ Starting main simulation loop ===============" << std::endl; for (int pstep = 0; pstep < num_psteps; ++pstep) { std::cout << "\n\n--------------- Simulation step number " << pstep @@ -227,7 +234,12 @@ main(int argc, char** argv) } compute_totmob(*props, state.saturation(), totmob); + pressure_timer.start(); psolver.solve(grid->c_grid(), totmob, src, state); + pressure_timer.stop(); + double pt = pressure_timer.secsSinceStart(); + std::cout << "Pressure solver took: " << pt << " seconds." << std::endl; + ptime += pt; Opm::toWaterSat(state.saturation(), reorder_sat); // We must treat reorder_src here, @@ -238,6 +250,7 @@ main(int argc, char** argv) // Also, for anything but noflow boundaries, // boundary flows must be accumulated into // source term following the same convention. + transport_timer.start(); polymertransport(&porevol[0], &reorder_src[0], stepsize, @@ -248,9 +261,19 @@ main(int argc, char** argv) &reorder_sat[0], &state.concentration()[0]); Opm::toBothSat(reorder_sat, state.saturation()); + transport_timer.stop(); + double tt = transport_timer.secsSinceStart(); + std::cout << "Transport solver took: " << tt << " seconds." << std::endl; + ttime += tt; current_time += stepsize; } + total_timer.stop(); + + std::cout << "\n\n================ Starting main simulation loop ===============\n\n" + << "Total time taken: " << total_timer.secsSinceStart() + << "\n Pressure time: " << ptime + << "\n Transport time: " << ttime << std::endl; if (output) { outputState(grid->c_grid(), state, num_psteps, output_dir);