2016-06-06 08:40:06 -05:00
|
|
|
/*
|
2020-05-07 09:13:39 -05:00
|
|
|
Copyright 2013, 2015, 2020 SINTEF Digital, Mathematics and Cybernetics.
|
2016-06-06 08:40:06 -05:00
|
|
|
Copyright 2015 Andreas Lauser
|
2017-11-21 04:12:16 -06:00
|
|
|
Copyright 2017 IRIS
|
2016-06-06 08:40:06 -05:00
|
|
|
|
|
|
|
This file is part of the Open Porous Media project (OPM).
|
|
|
|
|
|
|
|
OPM is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
OPM is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2018-06-26 06:42:57 -05:00
|
|
|
#ifndef OPM_SIMULATORFULLYIMPLICITBLACKOILEBOS_HEADER_INCLUDED
|
|
|
|
#define OPM_SIMULATORFULLYIMPLICITBLACKOILEBOS_HEADER_INCLUDED
|
2016-06-06 08:40:06 -05:00
|
|
|
|
2019-06-20 02:09:19 -05:00
|
|
|
#include <opm/simulators/flow/NonlinearSolverEbos.hpp>
|
|
|
|
#include <opm/simulators/flow/BlackoilModelEbos.hpp>
|
|
|
|
#include <opm/simulators/flow/BlackoilModelParametersEbos.hpp>
|
2021-05-20 06:32:18 -05:00
|
|
|
#include <opm/simulators/wells/WellState.hpp>
|
2019-05-07 06:06:02 -05:00
|
|
|
#include <opm/simulators/aquifers/BlackoilAquiferModel.hpp>
|
|
|
|
#include <opm/simulators/utils/moduleVersion.hpp>
|
2018-06-06 03:59:41 -05:00
|
|
|
#include <opm/simulators/timestepping/AdaptiveTimeSteppingEbos.hpp>
|
2018-02-09 06:42:16 -06:00
|
|
|
#include <opm/grid/utility/StopWatch.hpp>
|
2016-08-11 06:31:52 -05:00
|
|
|
|
2016-09-12 16:28:44 -05:00
|
|
|
#include <opm/common/ErrorMacros.hpp>
|
2016-06-06 08:40:06 -05:00
|
|
|
|
2020-08-21 06:42:08 -05:00
|
|
|
namespace Opm::Properties {
|
2018-06-21 05:14:17 -05:00
|
|
|
|
2020-08-27 04:38:38 -05:00
|
|
|
template<class TypeTag, class MyTypeTag>
|
|
|
|
struct EnableAdaptiveTimeStepping {
|
|
|
|
using type = UndefinedProperty;
|
|
|
|
};
|
|
|
|
template<class TypeTag, class MyTypeTag>
|
|
|
|
struct EnableTuning {
|
|
|
|
using type = UndefinedProperty;
|
|
|
|
};
|
2018-06-21 05:14:17 -05:00
|
|
|
|
2020-08-27 04:38:38 -05:00
|
|
|
template<class TypeTag>
|
|
|
|
struct EnableTerminalOutput<TypeTag, TTag::EclFlowProblem> {
|
|
|
|
static constexpr bool value = true;
|
|
|
|
};
|
|
|
|
template<class TypeTag>
|
|
|
|
struct EnableAdaptiveTimeStepping<TypeTag, TTag::EclFlowProblem> {
|
|
|
|
static constexpr bool value = true;
|
|
|
|
};
|
|
|
|
template<class TypeTag>
|
|
|
|
struct EnableTuning<TypeTag, TTag::EclFlowProblem> {
|
|
|
|
static constexpr bool value = false;
|
|
|
|
};
|
2018-06-21 05:14:17 -05:00
|
|
|
|
2020-08-21 06:42:08 -05:00
|
|
|
} // namespace Opm::Properties
|
2016-11-21 05:01:20 -06:00
|
|
|
|
2016-06-06 08:40:06 -05:00
|
|
|
namespace Opm {
|
|
|
|
|
2021-06-08 08:43:45 -05:00
|
|
|
void outputReportStep(const SimulatorTimer& timer);
|
|
|
|
void outputTimestampFIP(const SimulatorTimer& timer,
|
|
|
|
const std::string& title,
|
|
|
|
const std::string& version);
|
2016-06-06 08:40:06 -05:00
|
|
|
|
2016-07-12 11:47:52 -05:00
|
|
|
/// a simulator for the blackoil model
|
2017-06-07 02:29:31 -05:00
|
|
|
template<class TypeTag>
|
2016-07-12 11:47:52 -05:00
|
|
|
class SimulatorFullyImplicitBlackoilEbos
|
2016-06-06 08:40:06 -05:00
|
|
|
{
|
2016-07-12 11:47:52 -05:00
|
|
|
public:
|
2020-08-26 03:49:52 -05:00
|
|
|
using Simulator = GetPropType<TypeTag, Properties::Simulator>;
|
|
|
|
using Grid = GetPropType<TypeTag, Properties::Grid>;
|
|
|
|
using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
|
|
|
|
using ElementContext = GetPropType<TypeTag, Properties::ElementContext>;
|
|
|
|
using BlackoilIndices = GetPropType<TypeTag, Properties::Indices>;
|
|
|
|
using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>;
|
|
|
|
using MaterialLaw = GetPropType<TypeTag, Properties::MaterialLaw>;
|
|
|
|
using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>;
|
|
|
|
using MaterialLawParams = GetPropType<TypeTag, Properties::MaterialLawParams>;
|
2021-12-01 07:00:21 -06:00
|
|
|
using AquiferModel = GetPropType<TypeTag, Properties::EclAquiferModel>;
|
2017-04-06 07:21:59 -05:00
|
|
|
|
2018-06-21 05:14:17 -05:00
|
|
|
typedef AdaptiveTimeSteppingEbos<TypeTag> TimeStepper;
|
2021-05-05 04:22:44 -05:00
|
|
|
typedef BlackOilPolymerModule<TypeTag> PolymerModule;
|
2021-10-06 12:32:35 -05:00
|
|
|
typedef BlackOilMICPModule<TypeTag> MICPModule;
|
2016-08-23 02:45:37 -05:00
|
|
|
|
2017-06-07 02:29:31 -05:00
|
|
|
typedef BlackoilModelEbos<TypeTag> Model;
|
2018-06-21 05:14:17 -05:00
|
|
|
typedef NonlinearSolverEbos<TypeTag, Model> Solver;
|
|
|
|
typedef typename Model::ModelParameters ModelParameters;
|
|
|
|
typedef typename Solver::SolverParameters SolverParameters;
|
2017-09-26 03:52:05 -05:00
|
|
|
typedef BlackoilWellModel<TypeTag> WellModel;
|
2016-06-06 08:40:06 -05:00
|
|
|
|
2016-07-12 11:47:52 -05:00
|
|
|
|
|
|
|
/// Initialise from parameters and objects to observe.
|
|
|
|
/// \param[in] param parameters, this class accepts the following:
|
|
|
|
/// parameter (default) effect
|
|
|
|
/// -----------------------------------------------------------
|
|
|
|
/// output (true) write output to files?
|
|
|
|
/// output_dir ("output") output directoty
|
|
|
|
/// output_interval (1) output every nth step
|
|
|
|
/// nl_pressure_residual_tolerance (0.0) pressure solver residual tolerance (in Pascal)
|
|
|
|
/// nl_pressure_change_tolerance (1.0) pressure solver change tolerance (in Pascal)
|
|
|
|
/// nl_pressure_maxiter (10) max nonlinear iterations in pressure
|
|
|
|
/// nl_maxiter (30) max nonlinear iterations in transport
|
|
|
|
/// nl_tolerance (1e-9) transport solver absolute residual tolerance
|
|
|
|
/// num_transport_substeps (1) number of transport steps per pressure step
|
|
|
|
/// use_segregation_split (false) solve for gravity segregation (if false,
|
|
|
|
/// segregation is ignored).
|
|
|
|
///
|
|
|
|
/// \param[in] props fluid and rock properties
|
|
|
|
/// \param[in] linsolver linear solver
|
|
|
|
/// \param[in] eclipse_state the object which represents an internalized ECL deck
|
|
|
|
/// \param[in] output_writer
|
|
|
|
/// \param[in] threshold_pressures_by_face if nonempty, threshold pressures that inhibit flow
|
2018-11-12 04:03:54 -06:00
|
|
|
SimulatorFullyImplicitBlackoilEbos(Simulator& ebosSimulator)
|
2018-06-06 03:59:41 -05:00
|
|
|
: ebosSimulator_(ebosSimulator)
|
2016-07-12 11:47:52 -05:00
|
|
|
{
|
2018-06-21 05:14:17 -05:00
|
|
|
phaseUsage_ = phaseUsageFromDeck(eclState());
|
|
|
|
|
|
|
|
// Only rank 0 does print to std::cout
|
|
|
|
const auto& comm = grid().comm();
|
2018-08-06 08:59:35 -05:00
|
|
|
terminalOutput_ = EWOMS_GET_PARAM(TypeTag, bool, EnableTerminalOutput);
|
2018-06-21 05:14:17 -05:00
|
|
|
terminalOutput_ = terminalOutput_ && (comm.rank() == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void registerParameters()
|
|
|
|
{
|
|
|
|
ModelParameters::registerParameters();
|
|
|
|
SolverParameters::registerParameters();
|
|
|
|
TimeStepper::registerParameters();
|
|
|
|
|
2018-08-06 08:59:35 -05:00
|
|
|
EWOMS_REGISTER_PARAM(TypeTag, bool, EnableTerminalOutput,
|
2018-06-21 05:14:17 -05:00
|
|
|
"Print high-level information about the simulation's progress to the terminal");
|
2018-08-06 08:59:35 -05:00
|
|
|
EWOMS_REGISTER_PARAM(TypeTag, bool, EnableAdaptiveTimeStepping,
|
2018-06-21 05:14:17 -05:00
|
|
|
"Use adaptive time stepping between report steps");
|
2018-08-06 08:59:35 -05:00
|
|
|
EWOMS_REGISTER_PARAM(TypeTag, bool, EnableTuning,
|
2018-06-21 05:14:17 -05:00
|
|
|
"Honor some aspects of the TUNING keyword.");
|
2016-07-12 11:47:52 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/// Run the simulation.
|
|
|
|
/// This will run succesive timesteps until timer.done() is true. It will
|
|
|
|
/// modify the reservoir and well states.
|
|
|
|
/// \param[in,out] timer governs the requested reporting timesteps
|
|
|
|
/// \param[in,out] state state of reservoir: pressure, fluxes
|
|
|
|
/// \return simulation report, with timing data
|
2017-12-04 03:35:13 -06:00
|
|
|
SimulatorReport run(SimulatorTimer& timer)
|
Refactor SimulatorFullyImplicitBlackoilEbos.hpp
A resubmission of commit bb20804 in PR #2403 and PR #2442 to work with the
current master.
Continues the work in #2619 and #2631 to refactor main simulation loop in
flow to work with the Python bindings.
The run() method in SimulatorFullyImplicitBlackoilEbos.hpp is refactored
in preparation for the implementation of a Python step() function in a
later commit. Currently run() is called from runSimulatorInitOrRun() in
FlowMainEbos.hpp using the runSimulatorRunCallback_(). Later, there
will be other callbacks like runSimulatorStepInitCallback_(), and
runSimulatorStepCallback_(), that will need to call different parts of
the code in run(). The run() function is thus refactored into run(),
runInit(), runStep(), and runLastStep(). Also, some of the local
variables in run() have to be made persistent between calls to
runStep(), this applies to variables report, solverTimer, totalTimer,
and adaptiveTimeStepping, which are made private class variables.
2020-05-29 08:42:13 -05:00
|
|
|
{
|
2020-06-23 05:14:07 -05:00
|
|
|
init(timer);
|
Refactor SimulatorFullyImplicitBlackoilEbos.hpp
A resubmission of commit bb20804 in PR #2403 and PR #2442 to work with the
current master.
Continues the work in #2619 and #2631 to refactor main simulation loop in
flow to work with the Python bindings.
The run() method in SimulatorFullyImplicitBlackoilEbos.hpp is refactored
in preparation for the implementation of a Python step() function in a
later commit. Currently run() is called from runSimulatorInitOrRun() in
FlowMainEbos.hpp using the runSimulatorRunCallback_(). Later, there
will be other callbacks like runSimulatorStepInitCallback_(), and
runSimulatorStepCallback_(), that will need to call different parts of
the code in run(). The run() function is thus refactored into run(),
runInit(), runStep(), and runLastStep(). Also, some of the local
variables in run() have to be made persistent between calls to
runStep(), this applies to variables report, solverTimer, totalTimer,
and adaptiveTimeStepping, which are made private class variables.
2020-05-29 08:42:13 -05:00
|
|
|
// Main simulation loop.
|
|
|
|
while (!timer.done()) {
|
2020-06-23 05:14:07 -05:00
|
|
|
bool continue_looping = runStep(timer);
|
|
|
|
if (!continue_looping) break;
|
Refactor SimulatorFullyImplicitBlackoilEbos.hpp
A resubmission of commit bb20804 in PR #2403 and PR #2442 to work with the
current master.
Continues the work in #2619 and #2631 to refactor main simulation loop in
flow to work with the Python bindings.
The run() method in SimulatorFullyImplicitBlackoilEbos.hpp is refactored
in preparation for the implementation of a Python step() function in a
later commit. Currently run() is called from runSimulatorInitOrRun() in
FlowMainEbos.hpp using the runSimulatorRunCallback_(). Later, there
will be other callbacks like runSimulatorStepInitCallback_(), and
runSimulatorStepCallback_(), that will need to call different parts of
the code in run(). The run() function is thus refactored into run(),
runInit(), runStep(), and runLastStep(). Also, some of the local
variables in run() have to be made persistent between calls to
runStep(), this applies to variables report, solverTimer, totalTimer,
and adaptiveTimeStepping, which are made private class variables.
2020-05-29 08:42:13 -05:00
|
|
|
}
|
2020-06-23 05:14:07 -05:00
|
|
|
return finalize();
|
Refactor SimulatorFullyImplicitBlackoilEbos.hpp
A resubmission of commit bb20804 in PR #2403 and PR #2442 to work with the
current master.
Continues the work in #2619 and #2631 to refactor main simulation loop in
flow to work with the Python bindings.
The run() method in SimulatorFullyImplicitBlackoilEbos.hpp is refactored
in preparation for the implementation of a Python step() function in a
later commit. Currently run() is called from runSimulatorInitOrRun() in
FlowMainEbos.hpp using the runSimulatorRunCallback_(). Later, there
will be other callbacks like runSimulatorStepInitCallback_(), and
runSimulatorStepCallback_(), that will need to call different parts of
the code in run(). The run() function is thus refactored into run(),
runInit(), runStep(), and runLastStep(). Also, some of the local
variables in run() have to be made persistent between calls to
runStep(), this applies to variables report, solverTimer, totalTimer,
and adaptiveTimeStepping, which are made private class variables.
2020-05-29 08:42:13 -05:00
|
|
|
}
|
|
|
|
|
2020-06-23 05:14:07 -05:00
|
|
|
void init(SimulatorTimer &timer)
|
2016-07-12 11:47:52 -05:00
|
|
|
{
|
2019-04-03 10:26:57 -05:00
|
|
|
ebosSimulator_.setEpisodeIndex(-1);
|
|
|
|
|
2016-07-12 11:47:52 -05:00
|
|
|
// Create timers and file for writing timing info.
|
2021-05-05 04:22:44 -05:00
|
|
|
solverTimer_ = std::make_unique<time::StopWatch>();
|
|
|
|
totalTimer_ = std::make_unique<time::StopWatch>();
|
Refactor SimulatorFullyImplicitBlackoilEbos.hpp
A resubmission of commit bb20804 in PR #2403 and PR #2442 to work with the
current master.
Continues the work in #2619 and #2631 to refactor main simulation loop in
flow to work with the Python bindings.
The run() method in SimulatorFullyImplicitBlackoilEbos.hpp is refactored
in preparation for the implementation of a Python step() function in a
later commit. Currently run() is called from runSimulatorInitOrRun() in
FlowMainEbos.hpp using the runSimulatorRunCallback_(). Later, there
will be other callbacks like runSimulatorStepInitCallback_(), and
runSimulatorStepCallback_(), that will need to call different parts of
the code in run(). The run() function is thus refactored into run(),
runInit(), runStep(), and runLastStep(). Also, some of the local
variables in run() have to be made persistent between calls to
runStep(), this applies to variables report, solverTimer, totalTimer,
and adaptiveTimeStepping, which are made private class variables.
2020-05-29 08:42:13 -05:00
|
|
|
totalTimer_->start();
|
2016-07-12 11:47:52 -05:00
|
|
|
|
|
|
|
// adaptive time stepping
|
2018-08-06 08:59:35 -05:00
|
|
|
bool enableAdaptive = EWOMS_GET_PARAM(TypeTag, bool, EnableAdaptiveTimeStepping);
|
|
|
|
bool enableTUNING = EWOMS_GET_PARAM(TypeTag, bool, EnableTuning);
|
2018-06-21 05:14:17 -05:00
|
|
|
if (enableAdaptive) {
|
2021-05-05 04:22:44 -05:00
|
|
|
const UnitSystem& unitSystem = this->ebosSimulator_.vanguard().eclState().getUnits();
|
2018-06-21 05:14:17 -05:00
|
|
|
if (enableTUNING) {
|
2021-10-18 04:52:33 -05:00
|
|
|
const auto& sched_state = schedule()[timer.currentStepNum()];
|
|
|
|
auto max_next_tstep = sched_state.max_next_tstep();
|
|
|
|
adaptiveTimeStepping_ = std::make_unique<TimeStepper>(max_next_tstep,
|
|
|
|
sched_state.tuning(),
|
2021-02-17 04:30:57 -06:00
|
|
|
unitSystem, terminalOutput_);
|
2017-01-13 11:58:05 -06:00
|
|
|
}
|
2018-06-06 03:59:41 -05:00
|
|
|
else {
|
2021-02-17 04:30:57 -06:00
|
|
|
adaptiveTimeStepping_ = std::make_unique<TimeStepper>(unitSystem, terminalOutput_);
|
2018-06-06 03:59:41 -05:00
|
|
|
}
|
|
|
|
|
2018-06-06 03:59:41 -05:00
|
|
|
if (isRestart()) {
|
2019-10-01 07:30:11 -05:00
|
|
|
// For restarts the ebosSimulator may have gotten some information
|
|
|
|
// about the next timestep size from the OPMEXTRA field
|
Refactor SimulatorFullyImplicitBlackoilEbos.hpp
A resubmission of commit bb20804 in PR #2403 and PR #2442 to work with the
current master.
Continues the work in #2619 and #2631 to refactor main simulation loop in
flow to work with the Python bindings.
The run() method in SimulatorFullyImplicitBlackoilEbos.hpp is refactored
in preparation for the implementation of a Python step() function in a
later commit. Currently run() is called from runSimulatorInitOrRun() in
FlowMainEbos.hpp using the runSimulatorRunCallback_(). Later, there
will be other callbacks like runSimulatorStepInitCallback_(), and
runSimulatorStepCallback_(), that will need to call different parts of
the code in run(). The run() function is thus refactored into run(),
runInit(), runStep(), and runLastStep(). Also, some of the local
variables in run() have to be made persistent between calls to
runStep(), this applies to variables report, solverTimer, totalTimer,
and adaptiveTimeStepping, which are made private class variables.
2020-05-29 08:42:13 -05:00
|
|
|
adaptiveTimeStepping_->setSuggestedNextStep(ebosSimulator_.timeStepSize());
|
2017-02-24 07:52:12 -06:00
|
|
|
}
|
2016-07-12 11:47:52 -05:00
|
|
|
}
|
Refactor SimulatorFullyImplicitBlackoilEbos.hpp
A resubmission of commit bb20804 in PR #2403 and PR #2442 to work with the
current master.
Continues the work in #2619 and #2631 to refactor main simulation loop in
flow to work with the Python bindings.
The run() method in SimulatorFullyImplicitBlackoilEbos.hpp is refactored
in preparation for the implementation of a Python step() function in a
later commit. Currently run() is called from runSimulatorInitOrRun() in
FlowMainEbos.hpp using the runSimulatorRunCallback_(). Later, there
will be other callbacks like runSimulatorStepInitCallback_(), and
runSimulatorStepCallback_(), that will need to call different parts of
the code in run(). The run() function is thus refactored into run(),
runInit(), runStep(), and runLastStep(). Also, some of the local
variables in run() have to be made persistent between calls to
runStep(), this applies to variables report, solverTimer, totalTimer,
and adaptiveTimeStepping, which are made private class variables.
2020-05-29 08:42:13 -05:00
|
|
|
}
|
2016-07-12 11:47:52 -05:00
|
|
|
|
Refactor SimulatorFullyImplicitBlackoilEbos.hpp
A resubmission of commit bb20804 in PR #2403 and PR #2442 to work with the
current master.
Continues the work in #2619 and #2631 to refactor main simulation loop in
flow to work with the Python bindings.
The run() method in SimulatorFullyImplicitBlackoilEbos.hpp is refactored
in preparation for the implementation of a Python step() function in a
later commit. Currently run() is called from runSimulatorInitOrRun() in
FlowMainEbos.hpp using the runSimulatorRunCallback_(). Later, there
will be other callbacks like runSimulatorStepInitCallback_(), and
runSimulatorStepCallback_(), that will need to call different parts of
the code in run(). The run() function is thus refactored into run(),
runInit(), runStep(), and runLastStep(). Also, some of the local
variables in run() have to be made persistent between calls to
runStep(), this applies to variables report, solverTimer, totalTimer,
and adaptiveTimeStepping, which are made private class variables.
2020-05-29 08:42:13 -05:00
|
|
|
bool runStep(SimulatorTimer& timer)
|
|
|
|
{
|
|
|
|
if (schedule().exitStatus().has_value()) {
|
2018-06-06 03:59:41 -05:00
|
|
|
if (terminalOutput_) {
|
Refactor SimulatorFullyImplicitBlackoilEbos.hpp
A resubmission of commit bb20804 in PR #2403 and PR #2442 to work with the
current master.
Continues the work in #2619 and #2631 to refactor main simulation loop in
flow to work with the Python bindings.
The run() method in SimulatorFullyImplicitBlackoilEbos.hpp is refactored
in preparation for the implementation of a Python step() function in a
later commit. Currently run() is called from runSimulatorInitOrRun() in
FlowMainEbos.hpp using the runSimulatorRunCallback_(). Later, there
will be other callbacks like runSimulatorStepInitCallback_(), and
runSimulatorStepCallback_(), that will need to call different parts of
the code in run(). The run() function is thus refactored into run(),
runInit(), runStep(), and runLastStep(). Also, some of the local
variables in run() have to be made persistent between calls to
runStep(), this applies to variables report, solverTimer, totalTimer,
and adaptiveTimeStepping, which are made private class variables.
2020-05-29 08:42:13 -05:00
|
|
|
OpmLog::info("Stopping simulation since EXIT was triggered by an action keyword.");
|
2016-07-12 11:47:52 -05:00
|
|
|
}
|
Refactor SimulatorFullyImplicitBlackoilEbos.hpp
A resubmission of commit bb20804 in PR #2403 and PR #2442 to work with the
current master.
Continues the work in #2619 and #2631 to refactor main simulation loop in
flow to work with the Python bindings.
The run() method in SimulatorFullyImplicitBlackoilEbos.hpp is refactored
in preparation for the implementation of a Python step() function in a
later commit. Currently run() is called from runSimulatorInitOrRun() in
FlowMainEbos.hpp using the runSimulatorRunCallback_(). Later, there
will be other callbacks like runSimulatorStepInitCallback_(), and
runSimulatorStepCallback_(), that will need to call different parts of
the code in run(). The run() function is thus refactored into run(),
runInit(), runStep(), and runLastStep(). Also, some of the local
variables in run() have to be made persistent between calls to
runStep(), this applies to variables report, solverTimer, totalTimer,
and adaptiveTimeStepping, which are made private class variables.
2020-05-29 08:42:13 -05:00
|
|
|
report_.success.exit_status = schedule().exitStatus().value();
|
|
|
|
return false;
|
|
|
|
}
|
2016-07-12 11:47:52 -05:00
|
|
|
|
Refactor SimulatorFullyImplicitBlackoilEbos.hpp
A resubmission of commit bb20804 in PR #2403 and PR #2442 to work with the
current master.
Continues the work in #2619 and #2631 to refactor main simulation loop in
flow to work with the Python bindings.
The run() method in SimulatorFullyImplicitBlackoilEbos.hpp is refactored
in preparation for the implementation of a Python step() function in a
later commit. Currently run() is called from runSimulatorInitOrRun() in
FlowMainEbos.hpp using the runSimulatorRunCallback_(). Later, there
will be other callbacks like runSimulatorStepInitCallback_(), and
runSimulatorStepCallback_(), that will need to call different parts of
the code in run(). The run() function is thus refactored into run(),
runInit(), runStep(), and runLastStep(). Also, some of the local
variables in run() have to be made persistent between calls to
runStep(), this applies to variables report, solverTimer, totalTimer,
and adaptiveTimeStepping, which are made private class variables.
2020-05-29 08:42:13 -05:00
|
|
|
// Report timestep.
|
|
|
|
if (terminalOutput_) {
|
|
|
|
std::ostringstream ss;
|
|
|
|
timer.report(ss);
|
|
|
|
OpmLog::debug(ss.str());
|
|
|
|
}
|
2019-05-11 07:13:26 -05:00
|
|
|
|
Refactor SimulatorFullyImplicitBlackoilEbos.hpp
A resubmission of commit bb20804 in PR #2403 and PR #2442 to work with the
current master.
Continues the work in #2619 and #2631 to refactor main simulation loop in
flow to work with the Python bindings.
The run() method in SimulatorFullyImplicitBlackoilEbos.hpp is refactored
in preparation for the implementation of a Python step() function in a
later commit. Currently run() is called from runSimulatorInitOrRun() in
FlowMainEbos.hpp using the runSimulatorRunCallback_(). Later, there
will be other callbacks like runSimulatorStepInitCallback_(), and
runSimulatorStepCallback_(), that will need to call different parts of
the code in run(). The run() function is thus refactored into run(),
runInit(), runStep(), and runLastStep(). Also, some of the local
variables in run() have to be made persistent between calls to
runStep(), this applies to variables report, solverTimer, totalTimer,
and adaptiveTimeStepping, which are made private class variables.
2020-05-29 08:42:13 -05:00
|
|
|
if (terminalOutput_) {
|
2021-06-08 08:43:45 -05:00
|
|
|
outputReportStep(timer);
|
Refactor SimulatorFullyImplicitBlackoilEbos.hpp
A resubmission of commit bb20804 in PR #2403 and PR #2442 to work with the
current master.
Continues the work in #2619 and #2631 to refactor main simulation loop in
flow to work with the Python bindings.
The run() method in SimulatorFullyImplicitBlackoilEbos.hpp is refactored
in preparation for the implementation of a Python step() function in a
later commit. Currently run() is called from runSimulatorInitOrRun() in
FlowMainEbos.hpp using the runSimulatorRunCallback_(). Later, there
will be other callbacks like runSimulatorStepInitCallback_(), and
runSimulatorStepCallback_(), that will need to call different parts of
the code in run(). The run() function is thus refactored into run(),
runInit(), runStep(), and runLastStep(). Also, some of the local
variables in run() have to be made persistent between calls to
runStep(), this applies to variables report, solverTimer, totalTimer,
and adaptiveTimeStepping, which are made private class variables.
2020-05-29 08:42:13 -05:00
|
|
|
}
|
2016-11-14 03:16:57 -06:00
|
|
|
|
Refactor SimulatorFullyImplicitBlackoilEbos.hpp
A resubmission of commit bb20804 in PR #2403 and PR #2442 to work with the
current master.
Continues the work in #2619 and #2631 to refactor main simulation loop in
flow to work with the Python bindings.
The run() method in SimulatorFullyImplicitBlackoilEbos.hpp is refactored
in preparation for the implementation of a Python step() function in a
later commit. Currently run() is called from runSimulatorInitOrRun() in
FlowMainEbos.hpp using the runSimulatorRunCallback_(). Later, there
will be other callbacks like runSimulatorStepInitCallback_(), and
runSimulatorStepCallback_(), that will need to call different parts of
the code in run(). The run() function is thus refactored into run(),
runInit(), runStep(), and runLastStep(). Also, some of the local
variables in run() have to be made persistent between calls to
runStep(), this applies to variables report, solverTimer, totalTimer,
and adaptiveTimeStepping, which are made private class variables.
2020-05-29 08:42:13 -05:00
|
|
|
// write the inital state at the report stage
|
|
|
|
if (timer.initialStep()) {
|
|
|
|
Dune::Timer perfTimer;
|
|
|
|
perfTimer.start();
|
2019-04-03 10:26:57 -05:00
|
|
|
|
Refactor SimulatorFullyImplicitBlackoilEbos.hpp
A resubmission of commit bb20804 in PR #2403 and PR #2442 to work with the
current master.
Continues the work in #2619 and #2631 to refactor main simulation loop in
flow to work with the Python bindings.
The run() method in SimulatorFullyImplicitBlackoilEbos.hpp is refactored
in preparation for the implementation of a Python step() function in a
later commit. Currently run() is called from runSimulatorInitOrRun() in
FlowMainEbos.hpp using the runSimulatorRunCallback_(). Later, there
will be other callbacks like runSimulatorStepInitCallback_(), and
runSimulatorStepCallback_(), that will need to call different parts of
the code in run(). The run() function is thus refactored into run(),
runInit(), runStep(), and runLastStep(). Also, some of the local
variables in run() have to be made persistent between calls to
runStep(), this applies to variables report, solverTimer, totalTimer,
and adaptiveTimeStepping, which are made private class variables.
2020-05-29 08:42:13 -05:00
|
|
|
ebosSimulator_.setEpisodeIndex(-1);
|
|
|
|
ebosSimulator_.setEpisodeLength(0.0);
|
|
|
|
ebosSimulator_.setTimeStepSize(0.0);
|
2022-06-09 08:08:20 -05:00
|
|
|
// make cach upto date. no nead for updating it in elementCtx
|
|
|
|
ebosSimulator_.model().invalidateAndUpdateIntensiveQuantities(/*timeIdx=*/0);
|
Refactor SimulatorFullyImplicitBlackoilEbos.hpp
A resubmission of commit bb20804 in PR #2403 and PR #2442 to work with the
current master.
Continues the work in #2619 and #2631 to refactor main simulation loop in
flow to work with the Python bindings.
The run() method in SimulatorFullyImplicitBlackoilEbos.hpp is refactored
in preparation for the implementation of a Python step() function in a
later commit. Currently run() is called from runSimulatorInitOrRun() in
FlowMainEbos.hpp using the runSimulatorRunCallback_(). Later, there
will be other callbacks like runSimulatorStepInitCallback_(), and
runSimulatorStepCallback_(), that will need to call different parts of
the code in run(). The run() function is thus refactored into run(),
runInit(), runStep(), and runLastStep(). Also, some of the local
variables in run() have to be made persistent between calls to
runStep(), this applies to variables report, solverTimer, totalTimer,
and adaptiveTimeStepping, which are made private class variables.
2020-05-29 08:42:13 -05:00
|
|
|
wellModel_().beginReportStep(timer.currentStepNum());
|
|
|
|
ebosSimulator_.problem().writeOutput();
|
2016-11-14 03:16:57 -06:00
|
|
|
|
Refactor SimulatorFullyImplicitBlackoilEbos.hpp
A resubmission of commit bb20804 in PR #2403 and PR #2442 to work with the
current master.
Continues the work in #2619 and #2631 to refactor main simulation loop in
flow to work with the Python bindings.
The run() method in SimulatorFullyImplicitBlackoilEbos.hpp is refactored
in preparation for the implementation of a Python step() function in a
later commit. Currently run() is called from runSimulatorInitOrRun() in
FlowMainEbos.hpp using the runSimulatorRunCallback_(). Later, there
will be other callbacks like runSimulatorStepInitCallback_(), and
runSimulatorStepCallback_(), that will need to call different parts of
the code in run(). The run() function is thus refactored into run(),
runInit(), runStep(), and runLastStep(). Also, some of the local
variables in run() have to be made persistent between calls to
runStep(), this applies to variables report, solverTimer, totalTimer,
and adaptiveTimeStepping, which are made private class variables.
2020-05-29 08:42:13 -05:00
|
|
|
report_.success.output_write_time += perfTimer.stop();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Run a multiple steps of the solver depending on the time step control.
|
|
|
|
solverTimer_->start();
|
|
|
|
|
|
|
|
auto solver = createSolver(wellModel_());
|
|
|
|
|
|
|
|
ebosSimulator_.startNextEpisode(
|
|
|
|
ebosSimulator_.startTime()
|
2021-02-22 11:43:56 -06:00
|
|
|
+ schedule().seconds(timer.currentStepNum()),
|
Refactor SimulatorFullyImplicitBlackoilEbos.hpp
A resubmission of commit bb20804 in PR #2403 and PR #2442 to work with the
current master.
Continues the work in #2619 and #2631 to refactor main simulation loop in
flow to work with the Python bindings.
The run() method in SimulatorFullyImplicitBlackoilEbos.hpp is refactored
in preparation for the implementation of a Python step() function in a
later commit. Currently run() is called from runSimulatorInitOrRun() in
FlowMainEbos.hpp using the runSimulatorRunCallback_(). Later, there
will be other callbacks like runSimulatorStepInitCallback_(), and
runSimulatorStepCallback_(), that will need to call different parts of
the code in run(). The run() function is thus refactored into run(),
runInit(), runStep(), and runLastStep(). Also, some of the local
variables in run() have to be made persistent between calls to
runStep(), this applies to variables report, solverTimer, totalTimer,
and adaptiveTimeStepping, which are made private class variables.
2020-05-29 08:42:13 -05:00
|
|
|
timer.currentStepLength());
|
|
|
|
ebosSimulator_.setEpisodeIndex(timer.currentStepNum());
|
|
|
|
solver->model().beginReportStep();
|
|
|
|
bool enableTUNING = EWOMS_GET_PARAM(TypeTag, bool, EnableTuning);
|
2017-11-21 04:12:16 -06:00
|
|
|
|
Refactor SimulatorFullyImplicitBlackoilEbos.hpp
A resubmission of commit bb20804 in PR #2403 and PR #2442 to work with the
current master.
Continues the work in #2619 and #2631 to refactor main simulation loop in
flow to work with the Python bindings.
The run() method in SimulatorFullyImplicitBlackoilEbos.hpp is refactored
in preparation for the implementation of a Python step() function in a
later commit. Currently run() is called from runSimulatorInitOrRun() in
FlowMainEbos.hpp using the runSimulatorRunCallback_(). Later, there
will be other callbacks like runSimulatorStepInitCallback_(), and
runSimulatorStepCallback_(), that will need to call different parts of
the code in run(). The run() function is thus refactored into run(),
runInit(), runStep(), and runLastStep(). Also, some of the local
variables in run() have to be made persistent between calls to
runStep(), this applies to variables report, solverTimer, totalTimer,
and adaptiveTimeStepping, which are made private class variables.
2020-05-29 08:42:13 -05:00
|
|
|
// If sub stepping is enabled allow the solver to sub cycle
|
|
|
|
// in case the report steps are too large for the solver to converge
|
|
|
|
//
|
|
|
|
// \Note: The report steps are met in any case
|
|
|
|
// \Note: The sub stepping will require a copy of the state variables
|
|
|
|
if (adaptiveTimeStepping_) {
|
2021-01-10 14:46:45 -06:00
|
|
|
const auto& events = schedule()[timer.currentStepNum()].events();
|
Refactor SimulatorFullyImplicitBlackoilEbos.hpp
A resubmission of commit bb20804 in PR #2403 and PR #2442 to work with the
current master.
Continues the work in #2619 and #2631 to refactor main simulation loop in
flow to work with the Python bindings.
The run() method in SimulatorFullyImplicitBlackoilEbos.hpp is refactored
in preparation for the implementation of a Python step() function in a
later commit. Currently run() is called from runSimulatorInitOrRun() in
FlowMainEbos.hpp using the runSimulatorRunCallback_(). Later, there
will be other callbacks like runSimulatorStepInitCallback_(), and
runSimulatorStepCallback_(), that will need to call different parts of
the code in run(). The run() function is thus refactored into run(),
runInit(), runStep(), and runLastStep(). Also, some of the local
variables in run() have to be made persistent between calls to
runStep(), this applies to variables report, solverTimer, totalTimer,
and adaptiveTimeStepping, which are made private class variables.
2020-05-29 08:42:13 -05:00
|
|
|
if (enableTUNING) {
|
2021-01-10 14:46:45 -06:00
|
|
|
if (events.hasEvent(ScheduleEvents::TUNING_CHANGE)) {
|
2021-10-18 04:52:33 -05:00
|
|
|
const auto& sched_state = schedule()[timer.currentStepNum()];
|
|
|
|
const auto& tuning = sched_state.tuning();
|
|
|
|
const auto& max_next_tstep = sched_state.max_next_tstep();
|
|
|
|
adaptiveTimeStepping_->updateTUNING(max_next_tstep, tuning);
|
2016-08-14 14:44:47 -05:00
|
|
|
}
|
2016-07-12 11:47:52 -05:00
|
|
|
}
|
2021-01-10 14:46:45 -06:00
|
|
|
bool event = events.hasEvent(ScheduleEvents::NEW_WELL) ||
|
2021-04-16 06:38:56 -05:00
|
|
|
events.hasEvent(ScheduleEvents::INJECTION_TYPE_CHANGED) ||
|
|
|
|
events.hasEvent(ScheduleEvents::WELL_SWITCHED_INJECTOR_PRODUCER) ||
|
2021-01-10 14:46:45 -06:00
|
|
|
events.hasEvent(ScheduleEvents::WELL_STATUS_CHANGE);
|
Refactor SimulatorFullyImplicitBlackoilEbos.hpp
A resubmission of commit bb20804 in PR #2403 and PR #2442 to work with the
current master.
Continues the work in #2619 and #2631 to refactor main simulation loop in
flow to work with the Python bindings.
The run() method in SimulatorFullyImplicitBlackoilEbos.hpp is refactored
in preparation for the implementation of a Python step() function in a
later commit. Currently run() is called from runSimulatorInitOrRun() in
FlowMainEbos.hpp using the runSimulatorRunCallback_(). Later, there
will be other callbacks like runSimulatorStepInitCallback_(), and
runSimulatorStepCallback_(), that will need to call different parts of
the code in run(). The run() function is thus refactored into run(),
runInit(), runStep(), and runLastStep(). Also, some of the local
variables in run() have to be made persistent between calls to
runStep(), this applies to variables report, solverTimer, totalTimer,
and adaptiveTimeStepping, which are made private class variables.
2020-05-29 08:42:13 -05:00
|
|
|
auto stepReport = adaptiveTimeStepping_->step(timer, *solver, event, nullptr);
|
|
|
|
report_ += stepReport;
|
2022-02-03 04:58:09 -06:00
|
|
|
//Pass simulation report to eclwriter for summary output
|
|
|
|
ebosSimulator_.problem().setSimulationReport(report_);
|
Refactor SimulatorFullyImplicitBlackoilEbos.hpp
A resubmission of commit bb20804 in PR #2403 and PR #2442 to work with the
current master.
Continues the work in #2619 and #2631 to refactor main simulation loop in
flow to work with the Python bindings.
The run() method in SimulatorFullyImplicitBlackoilEbos.hpp is refactored
in preparation for the implementation of a Python step() function in a
later commit. Currently run() is called from runSimulatorInitOrRun() in
FlowMainEbos.hpp using the runSimulatorRunCallback_(). Later, there
will be other callbacks like runSimulatorStepInitCallback_(), and
runSimulatorStepCallback_(), that will need to call different parts of
the code in run(). The run() function is thus refactored into run(),
runInit(), runStep(), and runLastStep(). Also, some of the local
variables in run() have to be made persistent between calls to
runStep(), this applies to variables report, solverTimer, totalTimer,
and adaptiveTimeStepping, which are made private class variables.
2020-05-29 08:42:13 -05:00
|
|
|
} else {
|
|
|
|
// solve for complete report step
|
|
|
|
auto stepReport = solver->step(timer);
|
|
|
|
report_ += stepReport;
|
|
|
|
if (terminalOutput_) {
|
|
|
|
std::ostringstream ss;
|
|
|
|
stepReport.reportStep(ss);
|
|
|
|
OpmLog::info(ss.str());
|
|
|
|
}
|
|
|
|
}
|
2016-08-08 07:58:25 -05:00
|
|
|
|
Refactor SimulatorFullyImplicitBlackoilEbos.hpp
A resubmission of commit bb20804 in PR #2403 and PR #2442 to work with the
current master.
Continues the work in #2619 and #2631 to refactor main simulation loop in
flow to work with the Python bindings.
The run() method in SimulatorFullyImplicitBlackoilEbos.hpp is refactored
in preparation for the implementation of a Python step() function in a
later commit. Currently run() is called from runSimulatorInitOrRun() in
FlowMainEbos.hpp using the runSimulatorRunCallback_(). Later, there
will be other callbacks like runSimulatorStepInitCallback_(), and
runSimulatorStepCallback_(), that will need to call different parts of
the code in run(). The run() function is thus refactored into run(),
runInit(), runStep(), and runLastStep(). Also, some of the local
variables in run() have to be made persistent between calls to
runStep(), this applies to variables report, solverTimer, totalTimer,
and adaptiveTimeStepping, which are made private class variables.
2020-05-29 08:42:13 -05:00
|
|
|
// write simulation state at the report stage
|
|
|
|
Dune::Timer perfTimer;
|
|
|
|
perfTimer.start();
|
|
|
|
const double nextstep = adaptiveTimeStepping_ ? adaptiveTimeStepping_->suggestedNextStep() : -1.0;
|
|
|
|
ebosSimulator_.problem().setNextTimeStepSize(nextstep);
|
|
|
|
ebosSimulator_.problem().writeOutput();
|
|
|
|
report_.success.output_write_time += perfTimer.stop();
|
2016-07-12 11:47:52 -05:00
|
|
|
|
Refactor SimulatorFullyImplicitBlackoilEbos.hpp
A resubmission of commit bb20804 in PR #2403 and PR #2442 to work with the
current master.
Continues the work in #2619 and #2631 to refactor main simulation loop in
flow to work with the Python bindings.
The run() method in SimulatorFullyImplicitBlackoilEbos.hpp is refactored
in preparation for the implementation of a Python step() function in a
later commit. Currently run() is called from runSimulatorInitOrRun() in
FlowMainEbos.hpp using the runSimulatorRunCallback_(). Later, there
will be other callbacks like runSimulatorStepInitCallback_(), and
runSimulatorStepCallback_(), that will need to call different parts of
the code in run(). The run() function is thus refactored into run(),
runInit(), runStep(), and runLastStep(). Also, some of the local
variables in run() have to be made persistent between calls to
runStep(), this applies to variables report, solverTimer, totalTimer,
and adaptiveTimeStepping, which are made private class variables.
2020-05-29 08:42:13 -05:00
|
|
|
solver->model().endReportStep();
|
2016-07-12 11:47:52 -05:00
|
|
|
|
Refactor SimulatorFullyImplicitBlackoilEbos.hpp
A resubmission of commit bb20804 in PR #2403 and PR #2442 to work with the
current master.
Continues the work in #2619 and #2631 to refactor main simulation loop in
flow to work with the Python bindings.
The run() method in SimulatorFullyImplicitBlackoilEbos.hpp is refactored
in preparation for the implementation of a Python step() function in a
later commit. Currently run() is called from runSimulatorInitOrRun() in
FlowMainEbos.hpp using the runSimulatorRunCallback_(). Later, there
will be other callbacks like runSimulatorStepInitCallback_(), and
runSimulatorStepCallback_(), that will need to call different parts of
the code in run(). The run() function is thus refactored into run(),
runInit(), runStep(), and runLastStep(). Also, some of the local
variables in run() have to be made persistent between calls to
runStep(), this applies to variables report, solverTimer, totalTimer,
and adaptiveTimeStepping, which are made private class variables.
2020-05-29 08:42:13 -05:00
|
|
|
// take time that was used to solve system for this reportStep
|
|
|
|
solverTimer_->stop();
|
2017-03-13 11:48:19 -05:00
|
|
|
|
Refactor SimulatorFullyImplicitBlackoilEbos.hpp
A resubmission of commit bb20804 in PR #2403 and PR #2442 to work with the
current master.
Continues the work in #2619 and #2631 to refactor main simulation loop in
flow to work with the Python bindings.
The run() method in SimulatorFullyImplicitBlackoilEbos.hpp is refactored
in preparation for the implementation of a Python step() function in a
later commit. Currently run() is called from runSimulatorInitOrRun() in
FlowMainEbos.hpp using the runSimulatorRunCallback_(). Later, there
will be other callbacks like runSimulatorStepInitCallback_(), and
runSimulatorStepCallback_(), that will need to call different parts of
the code in run(). The run() function is thus refactored into run(),
runInit(), runStep(), and runLastStep(). Also, some of the local
variables in run() have to be made persistent between calls to
runStep(), this applies to variables report, solverTimer, totalTimer,
and adaptiveTimeStepping, which are made private class variables.
2020-05-29 08:42:13 -05:00
|
|
|
// update timing.
|
|
|
|
report_.success.solver_time += solverTimer_->secsSinceStart();
|
2016-12-22 06:45:31 -06:00
|
|
|
|
Refactor SimulatorFullyImplicitBlackoilEbos.hpp
A resubmission of commit bb20804 in PR #2403 and PR #2442 to work with the
current master.
Continues the work in #2619 and #2631 to refactor main simulation loop in
flow to work with the Python bindings.
The run() method in SimulatorFullyImplicitBlackoilEbos.hpp is refactored
in preparation for the implementation of a Python step() function in a
later commit. Currently run() is called from runSimulatorInitOrRun() in
FlowMainEbos.hpp using the runSimulatorRunCallback_(). Later, there
will be other callbacks like runSimulatorStepInitCallback_(), and
runSimulatorStepCallback_(), that will need to call different parts of
the code in run(). The run() function is thus refactored into run(),
runInit(), runStep(), and runLastStep(). Also, some of the local
variables in run() have to be made persistent between calls to
runStep(), this applies to variables report, solverTimer, totalTimer,
and adaptiveTimeStepping, which are made private class variables.
2020-05-29 08:42:13 -05:00
|
|
|
// Increment timer, remember well state.
|
|
|
|
++timer;
|
2016-07-12 11:47:52 -05:00
|
|
|
|
Refactor SimulatorFullyImplicitBlackoilEbos.hpp
A resubmission of commit bb20804 in PR #2403 and PR #2442 to work with the
current master.
Continues the work in #2619 and #2631 to refactor main simulation loop in
flow to work with the Python bindings.
The run() method in SimulatorFullyImplicitBlackoilEbos.hpp is refactored
in preparation for the implementation of a Python step() function in a
later commit. Currently run() is called from runSimulatorInitOrRun() in
FlowMainEbos.hpp using the runSimulatorRunCallback_(). Later, there
will be other callbacks like runSimulatorStepInitCallback_(), and
runSimulatorStepCallback_(), that will need to call different parts of
the code in run(). The run() function is thus refactored into run(),
runInit(), runStep(), and runLastStep(). Also, some of the local
variables in run() have to be made persistent between calls to
runStep(), this applies to variables report, solverTimer, totalTimer,
and adaptiveTimeStepping, which are made private class variables.
2020-05-29 08:42:13 -05:00
|
|
|
if (terminalOutput_) {
|
|
|
|
if (!timer.initialStep()) {
|
|
|
|
const std::string version = moduleVersionName();
|
2021-06-08 08:43:45 -05:00
|
|
|
outputTimestampFIP(timer, eclState().getTitle(), version);
|
2018-01-12 08:32:04 -06:00
|
|
|
}
|
Refactor SimulatorFullyImplicitBlackoilEbos.hpp
A resubmission of commit bb20804 in PR #2403 and PR #2442 to work with the
current master.
Continues the work in #2619 and #2631 to refactor main simulation loop in
flow to work with the Python bindings.
The run() method in SimulatorFullyImplicitBlackoilEbos.hpp is refactored
in preparation for the implementation of a Python step() function in a
later commit. Currently run() is called from runSimulatorInitOrRun() in
FlowMainEbos.hpp using the runSimulatorRunCallback_(). Later, there
will be other callbacks like runSimulatorStepInitCallback_(), and
runSimulatorStepCallback_(), that will need to call different parts of
the code in run(). The run() function is thus refactored into run(),
runInit(), runStep(), and runLastStep(). Also, some of the local
variables in run() have to be made persistent between calls to
runStep(), this applies to variables report, solverTimer, totalTimer,
and adaptiveTimeStepping, which are made private class variables.
2020-05-29 08:42:13 -05:00
|
|
|
}
|
2018-01-12 08:32:04 -06:00
|
|
|
|
Refactor SimulatorFullyImplicitBlackoilEbos.hpp
A resubmission of commit bb20804 in PR #2403 and PR #2442 to work with the
current master.
Continues the work in #2619 and #2631 to refactor main simulation loop in
flow to work with the Python bindings.
The run() method in SimulatorFullyImplicitBlackoilEbos.hpp is refactored
in preparation for the implementation of a Python step() function in a
later commit. Currently run() is called from runSimulatorInitOrRun() in
FlowMainEbos.hpp using the runSimulatorRunCallback_(). Later, there
will be other callbacks like runSimulatorStepInitCallback_(), and
runSimulatorStepCallback_(), that will need to call different parts of
the code in run(). The run() function is thus refactored into run(),
runInit(), runStep(), and runLastStep(). Also, some of the local
variables in run() have to be made persistent between calls to
runStep(), this applies to variables report, solverTimer, totalTimer,
and adaptiveTimeStepping, which are made private class variables.
2020-05-29 08:42:13 -05:00
|
|
|
if (terminalOutput_) {
|
|
|
|
std::string msg =
|
|
|
|
"Time step took " + std::to_string(solverTimer_->secsSinceStart()) + " seconds; "
|
|
|
|
"total solver time " + std::to_string(report_.success.solver_time) + " seconds.";
|
|
|
|
OpmLog::debug(msg);
|
2016-07-12 11:47:52 -05:00
|
|
|
}
|
Refactor SimulatorFullyImplicitBlackoilEbos.hpp
A resubmission of commit bb20804 in PR #2403 and PR #2442 to work with the
current master.
Continues the work in #2619 and #2631 to refactor main simulation loop in
flow to work with the Python bindings.
The run() method in SimulatorFullyImplicitBlackoilEbos.hpp is refactored
in preparation for the implementation of a Python step() function in a
later commit. Currently run() is called from runSimulatorInitOrRun() in
FlowMainEbos.hpp using the runSimulatorRunCallback_(). Later, there
will be other callbacks like runSimulatorStepInitCallback_(), and
runSimulatorStepCallback_(), that will need to call different parts of
the code in run(). The run() function is thus refactored into run(),
runInit(), runStep(), and runLastStep(). Also, some of the local
variables in run() have to be made persistent between calls to
runStep(), this applies to variables report, solverTimer, totalTimer,
and adaptiveTimeStepping, which are made private class variables.
2020-05-29 08:42:13 -05:00
|
|
|
return true;
|
|
|
|
}
|
2016-07-12 11:47:52 -05:00
|
|
|
|
2020-06-23 05:14:07 -05:00
|
|
|
SimulatorReport finalize()
|
Refactor SimulatorFullyImplicitBlackoilEbos.hpp
A resubmission of commit bb20804 in PR #2403 and PR #2442 to work with the
current master.
Continues the work in #2619 and #2631 to refactor main simulation loop in
flow to work with the Python bindings.
The run() method in SimulatorFullyImplicitBlackoilEbos.hpp is refactored
in preparation for the implementation of a Python step() function in a
later commit. Currently run() is called from runSimulatorInitOrRun() in
FlowMainEbos.hpp using the runSimulatorRunCallback_(). Later, there
will be other callbacks like runSimulatorStepInitCallback_(), and
runSimulatorStepCallback_(), that will need to call different parts of
the code in run(). The run() function is thus refactored into run(),
runInit(), runStep(), and runLastStep(). Also, some of the local
variables in run() have to be made persistent between calls to
runStep(), this applies to variables report, solverTimer, totalTimer,
and adaptiveTimeStepping, which are made private class variables.
2020-05-29 08:42:13 -05:00
|
|
|
{
|
2020-02-07 07:37:02 -06:00
|
|
|
// make sure all output is written to disk before run is finished
|
|
|
|
{
|
|
|
|
Dune::Timer finalOutputTimer;
|
|
|
|
finalOutputTimer.start();
|
|
|
|
|
|
|
|
ebosSimulator_.problem().finalizeOutput();
|
Refactor SimulatorFullyImplicitBlackoilEbos.hpp
A resubmission of commit bb20804 in PR #2403 and PR #2442 to work with the
current master.
Continues the work in #2619 and #2631 to refactor main simulation loop in
flow to work with the Python bindings.
The run() method in SimulatorFullyImplicitBlackoilEbos.hpp is refactored
in preparation for the implementation of a Python step() function in a
later commit. Currently run() is called from runSimulatorInitOrRun() in
FlowMainEbos.hpp using the runSimulatorRunCallback_(). Later, there
will be other callbacks like runSimulatorStepInitCallback_(), and
runSimulatorStepCallback_(), that will need to call different parts of
the code in run(). The run() function is thus refactored into run(),
runInit(), runStep(), and runLastStep(). Also, some of the local
variables in run() have to be made persistent between calls to
runStep(), this applies to variables report, solverTimer, totalTimer,
and adaptiveTimeStepping, which are made private class variables.
2020-05-29 08:42:13 -05:00
|
|
|
report_.success.output_write_time += finalOutputTimer.stop();
|
2020-02-07 07:37:02 -06:00
|
|
|
}
|
|
|
|
|
2016-07-12 11:47:52 -05:00
|
|
|
// Stop timer and create timing report
|
Refactor SimulatorFullyImplicitBlackoilEbos.hpp
A resubmission of commit bb20804 in PR #2403 and PR #2442 to work with the
current master.
Continues the work in #2619 and #2631 to refactor main simulation loop in
flow to work with the Python bindings.
The run() method in SimulatorFullyImplicitBlackoilEbos.hpp is refactored
in preparation for the implementation of a Python step() function in a
later commit. Currently run() is called from runSimulatorInitOrRun() in
FlowMainEbos.hpp using the runSimulatorRunCallback_(). Later, there
will be other callbacks like runSimulatorStepInitCallback_(), and
runSimulatorStepCallback_(), that will need to call different parts of
the code in run(). The run() function is thus refactored into run(),
runInit(), runStep(), and runLastStep(). Also, some of the local
variables in run() have to be made persistent between calls to
runStep(), this applies to variables report, solverTimer, totalTimer,
and adaptiveTimeStepping, which are made private class variables.
2020-05-29 08:42:13 -05:00
|
|
|
totalTimer_->stop();
|
|
|
|
report_.success.total_time = totalTimer_->secsSinceStart();
|
|
|
|
report_.success.converged = true;
|
2017-12-04 15:26:53 -06:00
|
|
|
|
Refactor SimulatorFullyImplicitBlackoilEbos.hpp
A resubmission of commit bb20804 in PR #2403 and PR #2442 to work with the
current master.
Continues the work in #2619 and #2631 to refactor main simulation loop in
flow to work with the Python bindings.
The run() method in SimulatorFullyImplicitBlackoilEbos.hpp is refactored
in preparation for the implementation of a Python step() function in a
later commit. Currently run() is called from runSimulatorInitOrRun() in
FlowMainEbos.hpp using the runSimulatorRunCallback_(). Later, there
will be other callbacks like runSimulatorStepInitCallback_(), and
runSimulatorStepCallback_(), that will need to call different parts of
the code in run(). The run() function is thus refactored into run(),
runInit(), runStep(), and runLastStep(). Also, some of the local
variables in run() have to be made persistent between calls to
runStep(), this applies to variables report, solverTimer, totalTimer,
and adaptiveTimeStepping, which are made private class variables.
2020-05-29 08:42:13 -05:00
|
|
|
return report_;
|
2016-07-12 11:47:52 -05:00
|
|
|
}
|
|
|
|
|
2016-08-08 08:12:51 -05:00
|
|
|
const Grid& grid() const
|
2018-02-01 09:27:42 -06:00
|
|
|
{ return ebosSimulator_.vanguard().grid(); }
|
2016-08-08 08:12:51 -05:00
|
|
|
|
2016-07-12 11:47:52 -05:00
|
|
|
protected:
|
|
|
|
|
2018-10-25 09:47:00 -05:00
|
|
|
std::unique_ptr<Solver> createSolver(WellModel& wellModel)
|
2016-07-12 11:47:52 -05:00
|
|
|
{
|
2020-09-02 08:35:39 -05:00
|
|
|
auto model = std::make_unique<Model>(ebosSimulator_,
|
|
|
|
modelParam_,
|
|
|
|
wellModel,
|
|
|
|
terminalOutput_);
|
2016-07-12 11:47:52 -05:00
|
|
|
|
2020-09-02 08:35:39 -05:00
|
|
|
return std::make_unique<Solver>(solverParam_, std::move(model));
|
2016-07-12 11:47:52 -05:00
|
|
|
}
|
|
|
|
|
2016-10-20 13:16:42 -05:00
|
|
|
const EclipseState& eclState() const
|
2018-02-01 09:27:42 -06:00
|
|
|
{ return ebosSimulator_.vanguard().eclState(); }
|
2016-07-12 11:47:52 -05:00
|
|
|
|
2017-10-29 15:06:19 -05:00
|
|
|
|
|
|
|
const Schedule& schedule() const
|
2018-02-01 09:27:42 -06:00
|
|
|
{ return ebosSimulator_.vanguard().schedule(); }
|
2017-10-29 15:06:19 -05:00
|
|
|
|
2018-06-06 03:59:41 -05:00
|
|
|
bool isRestart() const
|
|
|
|
{
|
|
|
|
const auto& initconfig = eclState().getInitConfig();
|
|
|
|
return initconfig.restartRequested();
|
|
|
|
}
|
2017-06-07 02:29:31 -05:00
|
|
|
|
2018-08-16 04:51:36 -05:00
|
|
|
WellModel& wellModel_()
|
|
|
|
{ return ebosSimulator_.problem().wellModel(); }
|
|
|
|
|
|
|
|
const WellModel& wellModel_() const
|
|
|
|
{ return ebosSimulator_.problem().wellModel(); }
|
|
|
|
|
2016-07-12 11:47:52 -05:00
|
|
|
// Data.
|
2016-08-08 08:26:09 -05:00
|
|
|
Simulator& ebosSimulator_;
|
2018-07-09 05:14:43 -05:00
|
|
|
std::unique_ptr<WellConnectionAuxiliaryModule<TypeTag>> wellAuxMod_;
|
2017-04-10 08:55:30 -05:00
|
|
|
|
2018-06-06 03:59:41 -05:00
|
|
|
ModelParameters modelParam_;
|
2018-06-21 05:14:17 -05:00
|
|
|
SolverParameters solverParam_;
|
2016-07-12 11:47:52 -05:00
|
|
|
|
|
|
|
// Observed objects.
|
2017-06-16 06:52:51 -05:00
|
|
|
PhaseUsage phaseUsage_;
|
2016-07-12 11:47:52 -05:00
|
|
|
// Misc. data
|
2018-06-21 05:14:17 -05:00
|
|
|
bool terminalOutput_;
|
Refactor SimulatorFullyImplicitBlackoilEbos.hpp
A resubmission of commit bb20804 in PR #2403 and PR #2442 to work with the
current master.
Continues the work in #2619 and #2631 to refactor main simulation loop in
flow to work with the Python bindings.
The run() method in SimulatorFullyImplicitBlackoilEbos.hpp is refactored
in preparation for the implementation of a Python step() function in a
later commit. Currently run() is called from runSimulatorInitOrRun() in
FlowMainEbos.hpp using the runSimulatorRunCallback_(). Later, there
will be other callbacks like runSimulatorStepInitCallback_(), and
runSimulatorStepCallback_(), that will need to call different parts of
the code in run(). The run() function is thus refactored into run(),
runInit(), runStep(), and runLastStep(). Also, some of the local
variables in run() have to be made persistent between calls to
runStep(), this applies to variables report, solverTimer, totalTimer,
and adaptiveTimeStepping, which are made private class variables.
2020-05-29 08:42:13 -05:00
|
|
|
|
|
|
|
SimulatorReport report_;
|
2021-05-05 04:22:44 -05:00
|
|
|
std::unique_ptr<time::StopWatch> solverTimer_;
|
|
|
|
std::unique_ptr<time::StopWatch> totalTimer_;
|
Refactor SimulatorFullyImplicitBlackoilEbos.hpp
A resubmission of commit bb20804 in PR #2403 and PR #2442 to work with the
current master.
Continues the work in #2619 and #2631 to refactor main simulation loop in
flow to work with the Python bindings.
The run() method in SimulatorFullyImplicitBlackoilEbos.hpp is refactored
in preparation for the implementation of a Python step() function in a
later commit. Currently run() is called from runSimulatorInitOrRun() in
FlowMainEbos.hpp using the runSimulatorRunCallback_(). Later, there
will be other callbacks like runSimulatorStepInitCallback_(), and
runSimulatorStepCallback_(), that will need to call different parts of
the code in run(). The run() function is thus refactored into run(),
runInit(), runStep(), and runLastStep(). Also, some of the local
variables in run() have to be made persistent between calls to
runStep(), this applies to variables report, solverTimer, totalTimer,
and adaptiveTimeStepping, which are made private class variables.
2020-05-29 08:42:13 -05:00
|
|
|
std::unique_ptr<TimeStepper> adaptiveTimeStepping_;
|
2016-06-06 08:40:06 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Opm
|
|
|
|
|
2018-06-21 05:14:17 -05:00
|
|
|
#endif // OPM_SIMULATOR_FULLY_IMPLICIT_BLACKOIL_EBOS_HPP
|