From ecbe713c9b53f2d34bc1eebfb64bfef993e4e4a7 Mon Sep 17 00:00:00 2001 From: Halvor M Nilsen Date: Fri, 14 Feb 2025 15:34:35 +0100 Subject: [PATCH] fixes due to review comments --- opm/simulators/flow/FlowMain.hpp | 2 +- .../timestepping/SimulatorTimer.cpp | 19 ++----------------- .../timestepping/SimulatorTimer.hpp | 2 +- 3 files changed, 4 insertions(+), 19 deletions(-) diff --git a/opm/simulators/flow/FlowMain.hpp b/opm/simulators/flow/FlowMain.hpp index e24994b0b..88e599d8a 100644 --- a/opm/simulators/flow/FlowMain.hpp +++ b/opm/simulators/flow/FlowMain.hpp @@ -423,7 +423,7 @@ namespace Opm { // initialize variables const auto& initConfig = eclState().getInitConfig(); - int end_step = Parameters::Get(); + int end_step = Parameters::Get(); simtimer_->init(schedule, static_cast(initConfig.getRestartStep()), end_step); if (this->output_cout_) { diff --git a/opm/simulators/timestepping/SimulatorTimer.cpp b/opm/simulators/timestepping/SimulatorTimer.cpp index d113d4086..81480abba 100644 --- a/opm/simulators/timestepping/SimulatorTimer.cpp +++ b/opm/simulators/timestepping/SimulatorTimer.cpp @@ -55,21 +55,6 @@ namespace Opm return res; } - /// Initialize from parameters. Accepts the following: - /// num_psteps (default 1) - /// stepsize_days (default 1) - void SimulatorTimer::init(const ParameterGroup& param) - { - const int num_psteps = param.getDefault("num_psteps", 1); - const int end_step = param.getDefault("end_step", 50000); - const double stepsize_days = param.getDefault("stepsize_days", 1.0); - const double stepsize = Opm::unit::convert::from(stepsize_days, Opm::unit::day); - timesteps_.clear(); - timesteps_.resize(num_psteps, stepsize); - end_step_ = end_step; - total_time_ = num_psteps*stepsize; - } - /// Use the SimulatorTimer as a shim around opm-parser's Opm::TimeMap void SimulatorTimer::init(const Schedule& schedule, std::size_t report_step, std::size_t end_step) { @@ -171,9 +156,9 @@ namespace Opm /// Return true if op++() has been called numSteps() times. bool SimulatorTimer::done() const { - if(current_step_ < end_step_){ + if (current_step_ < end_step_) { return int(timesteps_.size()) == current_step_; - }else{ + } else { return true; } } diff --git a/opm/simulators/timestepping/SimulatorTimer.hpp b/opm/simulators/timestepping/SimulatorTimer.hpp index 3fd4f4707..ed21bec29 100644 --- a/opm/simulators/timestepping/SimulatorTimer.hpp +++ b/opm/simulators/timestepping/SimulatorTimer.hpp @@ -53,7 +53,7 @@ namespace Opm void init(const ParameterGroup& param); /// Use the SimulatorTimer as a shim around opm-commons Schedule class - void init(const Schedule& schedule, std::size_t report_step, std::size_t end_step); + void init(const Schedule& schedule, std::size_t report_step, int end_step); /// Whether the current step is the first step. bool initialStep() const override;