From 702859c5e3fac4dfb7152858891e1820c5907643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Mon, 3 Nov 2014 11:12:27 +0100 Subject: [PATCH 1/2] Bugfix: avoid using TimeMap without deck. This made the simulator crash when there is no deck involved. --- examples/sim_2p_incomp.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/examples/sim_2p_incomp.cpp b/examples/sim_2p_incomp.cpp index 5712b987..97c253f4 100644 --- a/examples/sim_2p_incomp.cpp +++ b/examples/sim_2p_incomp.cpp @@ -214,14 +214,10 @@ try param.writeParam(output_dir + "/simulation.param"); } - Opm::TimeMapPtr timeMap(new Opm::TimeMap(deck)); - - std::cout << "\n\n================ Starting main simulation loop ===============\n" - << " (number of report steps: " - << (use_deck ? timeMap->numTimesteps() : 1) << ")\n\n" << std::flush; - SimulatorReport rep; if (!use_deck) { + std::cout << "\n\n================ Starting main simulation loop ===============\n" + << " (number of report steps: 1)\n\n" << std::flush; // Simple simulation without a deck. WellsManager wells; // no wells. SimulatorIncompTwophase simulator(param, @@ -241,6 +237,11 @@ try rep = simulator.run(simtimer, state, well_state); } else { // With a deck, we may have more epochs etc. + Opm::TimeMapPtr timeMap(new Opm::TimeMap(deck)); + + std::cout << "\n\n================ Starting main simulation loop ===============\n" + << " (number of report steps: " + << timeMap->numTimesteps() << ")\n\n" << std::flush; WellState well_state; int step = 0; SimulatorTimer simtimer; From 495699fde6366f8bde01b0ea374e81b58fd198dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Mon, 3 Nov 2014 13:33:30 +0100 Subject: [PATCH 2/2] Use existing TimeMap, instead of creating new. --- examples/sim_2p_incomp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/sim_2p_incomp.cpp b/examples/sim_2p_incomp.cpp index 97c253f4..b17f4242 100644 --- a/examples/sim_2p_incomp.cpp +++ b/examples/sim_2p_incomp.cpp @@ -237,7 +237,7 @@ try rep = simulator.run(simtimer, state, well_state); } else { // With a deck, we may have more epochs etc. - Opm::TimeMapPtr timeMap(new Opm::TimeMap(deck)); + Opm::TimeMapConstPtr timeMap = eclipseState->getSchedule()->getTimeMap(); std::cout << "\n\n================ Starting main simulation loop ===============\n" << " (number of report steps: "