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
|
|
|
|
2023-02-10 06:29:58 -06:00
|
|
|
#include <dune/common/hash.hh>
|
2023-05-03 06:17:20 -05:00
|
|
|
#include <fmt/format.h>
|
2023-02-10 06:29:58 -06:00
|
|
|
|
2019-06-20 02:09:19 -05:00
|
|
|
#include <opm/simulators/flow/BlackoilModelEbos.hpp>
|
|
|
|
#include <opm/simulators/flow/BlackoilModelParametersEbos.hpp>
|
Output Non-Linear Convergence to Separate File if Requested
This commit enables outputting non-linear convergence metrics, i.e.,
the MB and CNV values, per phase, for each non-linear iteration in
each timestep. If the user passes the option value "iterations" to
the --extra-convergence-output command line option, this commit will
create a new output file, CASE.INFOITER, that holds
* report step
* time step within that report step
* elapsed time
* MB and CNV values per phase
* well convergence status
for each non-linear iteration.
We use an asynchronous file writing procedure and confer ownership
of the report step's unprocessed convergence reports to this
procedure just before the end of
SimulatorFullyImplicitBlackoilEbos::runStep()
At that point, the convergence reports are about to go out of scope.
The asynchronous protocol uses a dedicated queue of output requests,
class ConvergenceReportQueue, into which the producer-i.e., member
function runStep()-inserts new convergence reports and from which
the output thread, ConvergenceOutputThread::writeASynchronous(),
retrieves those requests before writing the file data.
2022-12-13 08:14:05 -06:00
|
|
|
#include <opm/simulators/flow/ConvergenceOutputConfiguration.hpp>
|
|
|
|
#include <opm/simulators/flow/ExtraConvergenceOutputThread.hpp>
|
|
|
|
#include <opm/simulators/flow/NonlinearSolverEbos.hpp>
|
2019-05-07 06:06:02 -05:00
|
|
|
#include <opm/simulators/aquifers/BlackoilAquiferModel.hpp>
|
2018-06-06 03:59:41 -05:00
|
|
|
#include <opm/simulators/timestepping/AdaptiveTimeSteppingEbos.hpp>
|
2023-03-01 06:40:54 -06:00
|
|
|
#include <opm/simulators/timestepping/ConvergenceReport.hpp>
|
Output Non-Linear Convergence to Separate File if Requested
This commit enables outputting non-linear convergence metrics, i.e.,
the MB and CNV values, per phase, for each non-linear iteration in
each timestep. If the user passes the option value "iterations" to
the --extra-convergence-output command line option, this commit will
create a new output file, CASE.INFOITER, that holds
* report step
* time step within that report step
* elapsed time
* MB and CNV values per phase
* well convergence status
for each non-linear iteration.
We use an asynchronous file writing procedure and confer ownership
of the report step's unprocessed convergence reports to this
procedure just before the end of
SimulatorFullyImplicitBlackoilEbos::runStep()
At that point, the convergence reports are about to go out of scope.
The asynchronous protocol uses a dedicated queue of output requests,
class ConvergenceReportQueue, into which the producer-i.e., member
function runStep()-inserts new convergence reports and from which
the output thread, ConvergenceOutputThread::writeASynchronous(),
retrieves those requests before writing the file data.
2022-12-13 08:14:05 -06:00
|
|
|
#include <opm/simulators/utils/moduleVersion.hpp>
|
|
|
|
#include <opm/simulators/wells/WellState.hpp>
|
|
|
|
|
2018-02-09 06:42:16 -06:00
|
|
|
#include <opm/grid/utility/StopWatch.hpp>
|
2016-08-11 06:31:52 -05:00
|
|
|
|
Output Non-Linear Convergence to Separate File if Requested
This commit enables outputting non-linear convergence metrics, i.e.,
the MB and CNV values, per phase, for each non-linear iteration in
each timestep. If the user passes the option value "iterations" to
the --extra-convergence-output command line option, this commit will
create a new output file, CASE.INFOITER, that holds
* report step
* time step within that report step
* elapsed time
* MB and CNV values per phase
* well convergence status
for each non-linear iteration.
We use an asynchronous file writing procedure and confer ownership
of the report step's unprocessed convergence reports to this
procedure just before the end of
SimulatorFullyImplicitBlackoilEbos::runStep()
At that point, the convergence reports are about to go out of scope.
The asynchronous protocol uses a dedicated queue of output requests,
class ConvergenceReportQueue, into which the producer-i.e., member
function runStep()-inserts new convergence reports and from which
the output thread, ConvergenceOutputThread::writeASynchronous(),
retrieves those requests before writing the file data.
2022-12-13 08:14:05 -06:00
|
|
|
#include <opm/input/eclipse/Units/UnitSystem.hpp>
|
|
|
|
|
2016-09-12 16:28:44 -05:00
|
|
|
#include <opm/common/ErrorMacros.hpp>
|
2016-06-06 08:40:06 -05:00
|
|
|
|
2023-02-09 05:50:46 -06:00
|
|
|
#include <boost/date_time/gregorian/gregorian.hpp>
|
|
|
|
|
Output Non-Linear Convergence to Separate File if Requested
This commit enables outputting non-linear convergence metrics, i.e.,
the MB and CNV values, per phase, for each non-linear iteration in
each timestep. If the user passes the option value "iterations" to
the --extra-convergence-output command line option, this commit will
create a new output file, CASE.INFOITER, that holds
* report step
* time step within that report step
* elapsed time
* MB and CNV values per phase
* well convergence status
for each non-linear iteration.
We use an asynchronous file writing procedure and confer ownership
of the report step's unprocessed convergence reports to this
procedure just before the end of
SimulatorFullyImplicitBlackoilEbos::runStep()
At that point, the convergence reports are about to go out of scope.
The asynchronous protocol uses a dedicated queue of output requests,
class ConvergenceReportQueue, into which the producer-i.e., member
function runStep()-inserts new convergence reports and from which
the output thread, ConvergenceOutputThread::writeASynchronous(),
retrieves those requests before writing the file data.
2022-12-13 08:14:05 -06:00
|
|
|
#include <memory>
|
|
|
|
#include <optional>
|
|
|
|
#include <string>
|
|
|
|
#include <string_view>
|
|
|
|
#include <thread>
|
|
|
|
#include <utility>
|
|
|
|
#include <vector>
|
|
|
|
|
2023-02-09 05:50:46 -06:00
|
|
|
#if HAVE_HDF5
|
|
|
|
#include <ebos/hdf5serializer.hh>
|
|
|
|
#endif
|
|
|
|
|
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
|
|
|
|
2022-12-13 07:05:17 -06:00
|
|
|
template <class TypeTag, class MyTypeTag>
|
2022-12-16 07:49:28 -06:00
|
|
|
struct OutputExtraConvergenceInfo
|
2022-12-13 07:05:17 -06:00
|
|
|
{
|
|
|
|
using type = UndefinedProperty;
|
|
|
|
};
|
|
|
|
|
2023-02-09 05:50:46 -06:00
|
|
|
template <class TypeTag, class MyTypeTag>
|
|
|
|
struct SaveStep
|
|
|
|
{
|
|
|
|
using type = UndefinedProperty;
|
|
|
|
};
|
|
|
|
|
2023-02-09 05:50:46 -06:00
|
|
|
template <class TypeTag, class MyTypeTag>
|
|
|
|
struct LoadStep
|
|
|
|
{
|
|
|
|
using type = UndefinedProperty;
|
|
|
|
};
|
|
|
|
|
2023-02-09 07:45:06 -06:00
|
|
|
template <class TypeTag, class MyTypeTag>
|
|
|
|
struct SaveFile
|
|
|
|
{
|
|
|
|
using type = UndefinedProperty;
|
|
|
|
};
|
|
|
|
|
2023-08-22 07:16:20 -05:00
|
|
|
template <class TypeTag, class MyTypeTag>
|
|
|
|
struct LoadFile
|
|
|
|
{
|
|
|
|
using type = UndefinedProperty;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
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
|
|
|
|
2022-12-13 07:05:17 -06:00
|
|
|
template <class TypeTag>
|
2022-12-16 07:49:28 -06:00
|
|
|
struct OutputExtraConvergenceInfo<TypeTag, TTag::EclFlowProblem>
|
2022-12-13 07:05:17 -06:00
|
|
|
{
|
|
|
|
static constexpr auto* value = "none";
|
|
|
|
};
|
|
|
|
|
2023-02-09 05:50:46 -06:00
|
|
|
template <class TypeTag>
|
|
|
|
struct SaveStep<TypeTag, TTag::EclFlowProblem>
|
|
|
|
{
|
|
|
|
static constexpr auto* value = "";
|
|
|
|
};
|
|
|
|
|
2023-02-09 07:45:06 -06:00
|
|
|
template <class TypeTag>
|
|
|
|
struct SaveFile<TypeTag, TTag::EclFlowProblem>
|
|
|
|
{
|
|
|
|
static constexpr auto* value = "";
|
|
|
|
};
|
|
|
|
|
2023-08-22 07:16:20 -05:00
|
|
|
template <class TypeTag>
|
|
|
|
struct LoadFile<TypeTag, TTag::EclFlowProblem>
|
|
|
|
{
|
|
|
|
static constexpr auto* value = "";
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2023-02-09 05:50:46 -06:00
|
|
|
template <class TypeTag>
|
|
|
|
struct LoadStep<TypeTag, TTag::EclFlowProblem>
|
|
|
|
{
|
|
|
|
static constexpr int value = -1;
|
|
|
|
};
|
|
|
|
|
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);
|
2023-04-25 08:08:49 -05:00
|
|
|
void checkSerializedCmdLine(const std::string& current,
|
|
|
|
const std::string& stored);
|
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());
|
|
|
|
|
Output Non-Linear Convergence to Separate File if Requested
This commit enables outputting non-linear convergence metrics, i.e.,
the MB and CNV values, per phase, for each non-linear iteration in
each timestep. If the user passes the option value "iterations" to
the --extra-convergence-output command line option, this commit will
create a new output file, CASE.INFOITER, that holds
* report step
* time step within that report step
* elapsed time
* MB and CNV values per phase
* well convergence status
for each non-linear iteration.
We use an asynchronous file writing procedure and confer ownership
of the report step's unprocessed convergence reports to this
procedure just before the end of
SimulatorFullyImplicitBlackoilEbos::runStep()
At that point, the convergence reports are about to go out of scope.
The asynchronous protocol uses a dedicated queue of output requests,
class ConvergenceReportQueue, into which the producer-i.e., member
function runStep()-inserts new convergence reports and from which
the output thread, ConvergenceOutputThread::writeASynchronous(),
retrieves those requests before writing the file data.
2022-12-13 08:14:05 -06:00
|
|
|
// Only rank 0 does print to std::cout, and only if specifically requested.
|
|
|
|
this->terminalOutput_ = false;
|
|
|
|
if (this->grid().comm().rank() == 0) {
|
|
|
|
this->terminalOutput_ = EWOMS_GET_PARAM(TypeTag, bool, EnableTerminalOutput);
|
|
|
|
|
|
|
|
this->startConvergenceOutputThread(EWOMS_GET_PARAM(TypeTag, std::string,
|
2022-12-16 07:49:28 -06:00
|
|
|
OutputExtraConvergenceInfo),
|
|
|
|
R"(OutputExtraConvergenceInfo (--output-extra-convergence-info))");
|
Output Non-Linear Convergence to Separate File if Requested
This commit enables outputting non-linear convergence metrics, i.e.,
the MB and CNV values, per phase, for each non-linear iteration in
each timestep. If the user passes the option value "iterations" to
the --extra-convergence-output command line option, this commit will
create a new output file, CASE.INFOITER, that holds
* report step
* time step within that report step
* elapsed time
* MB and CNV values per phase
* well convergence status
for each non-linear iteration.
We use an asynchronous file writing procedure and confer ownership
of the report step's unprocessed convergence reports to this
procedure just before the end of
SimulatorFullyImplicitBlackoilEbos::runStep()
At that point, the convergence reports are about to go out of scope.
The asynchronous protocol uses a dedicated queue of output requests,
class ConvergenceReportQueue, into which the producer-i.e., member
function runStep()-inserts new convergence reports and from which
the output thread, ConvergenceOutputThread::writeASynchronous(),
retrieves those requests before writing the file data.
2022-12-13 08:14:05 -06:00
|
|
|
}
|
2023-02-09 05:50:46 -06:00
|
|
|
|
|
|
|
const std::string saveSpec = EWOMS_GET_PARAM(TypeTag, std::string, SaveStep);
|
|
|
|
if (saveSpec == "all") {
|
|
|
|
saveStride_ = 1;
|
2023-08-22 07:16:20 -05:00
|
|
|
} else if (saveSpec == "last") {
|
|
|
|
saveStride_ = -1;
|
2023-02-09 05:50:46 -06:00
|
|
|
} else if (!saveSpec.empty() && saveSpec[0] == ':') {
|
|
|
|
saveStride_ = std::atoi(saveSpec.c_str()+1);
|
|
|
|
} else if (!saveSpec.empty()) {
|
|
|
|
saveStep_ = std::atoi(saveSpec.c_str());
|
|
|
|
}
|
2023-02-09 05:50:46 -06:00
|
|
|
|
|
|
|
loadStep_ = EWOMS_GET_PARAM(TypeTag, int, LoadStep);
|
2023-02-09 07:45:06 -06:00
|
|
|
|
|
|
|
saveFile_ = EWOMS_GET_PARAM(TypeTag, std::string, SaveFile);
|
2023-08-22 07:16:20 -05:00
|
|
|
loadFile_ = EWOMS_GET_PARAM(TypeTag, std::string, LoadFile);
|
|
|
|
|
|
|
|
if (loadFile_.empty() || saveFile_.empty()) {
|
2023-02-22 06:58:23 -06:00
|
|
|
const auto& ioconfig = ebosSimulator_.vanguard().eclState().getIOConfig();
|
2023-08-22 07:16:20 -05:00
|
|
|
if (saveFile_.empty()) saveFile_ = ioconfig.fullBasePath() + ".OPMRST";
|
|
|
|
if (loadFile_.empty()) loadFile_ = saveFile_;
|
|
|
|
if (loadStep_ != -1 && !std::filesystem::exists(loadFile_)) {
|
2023-02-27 05:15:08 -06:00
|
|
|
std::filesystem::path path(ioconfig.getInputDir() + "/");
|
|
|
|
path.replace_filename(ioconfig.getBaseName() + ".OPMRST");
|
2023-08-22 07:16:20 -05:00
|
|
|
loadFile_ = path;
|
|
|
|
if (!std::filesystem::exists(loadFile_)) {
|
2023-02-22 06:58:23 -06:00
|
|
|
OPM_THROW(std::runtime_error, "Error locating serialized restart file");
|
|
|
|
}
|
|
|
|
}
|
2023-02-09 07:45:06 -06:00
|
|
|
}
|
Output Non-Linear Convergence to Separate File if Requested
This commit enables outputting non-linear convergence metrics, i.e.,
the MB and CNV values, per phase, for each non-linear iteration in
each timestep. If the user passes the option value "iterations" to
the --extra-convergence-output command line option, this commit will
create a new output file, CASE.INFOITER, that holds
* report step
* time step within that report step
* elapsed time
* MB and CNV values per phase
* well convergence status
for each non-linear iteration.
We use an asynchronous file writing procedure and confer ownership
of the report step's unprocessed convergence reports to this
procedure just before the end of
SimulatorFullyImplicitBlackoilEbos::runStep()
At that point, the convergence reports are about to go out of scope.
The asynchronous protocol uses a dedicated queue of output requests,
class ConvergenceReportQueue, into which the producer-i.e., member
function runStep()-inserts new convergence reports and from which
the output thread, ConvergenceOutputThread::writeASynchronous(),
retrieves those requests before writing the file data.
2022-12-13 08:14:05 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
~SimulatorFullyImplicitBlackoilEbos()
|
|
|
|
{
|
|
|
|
// Safe to call on all ranks, not just the I/O rank.
|
|
|
|
this->endConvergenceOutputThread();
|
2018-06-21 05:14:17 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
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.");
|
2022-12-16 07:49:28 -06:00
|
|
|
EWOMS_REGISTER_PARAM(TypeTag, std::string, OutputExtraConvergenceInfo,
|
2022-12-13 07:05:17 -06:00
|
|
|
"Provide additional convergence output "
|
|
|
|
"files for diagnostic purposes. "
|
|
|
|
"\"none\" gives no extra output and "
|
|
|
|
"overrides all other options, "
|
|
|
|
"\"steps\" generates an INFOSTEP file, "
|
|
|
|
"\"iterations\" generates an INFOITER file. "
|
|
|
|
"Combine options with commas, e.g., "
|
|
|
|
"\"steps,iterations\" for multiple outputs.");
|
2023-02-09 05:50:46 -06:00
|
|
|
EWOMS_REGISTER_PARAM(TypeTag, std::string, SaveStep,
|
|
|
|
"Save serialized state to .OPMRST file. "
|
|
|
|
"Either a specific report step, \"all\" to save "
|
|
|
|
"all report steps or \":x\" to save every x'th step.");
|
2023-02-09 05:50:46 -06:00
|
|
|
EWOMS_REGISTER_PARAM(TypeTag, int, LoadStep,
|
|
|
|
"Load serialized state from .OPMRST file. "
|
|
|
|
"Either a specific report step, or 0 to load last "
|
|
|
|
"stored report step.");
|
2023-02-09 07:45:06 -06:00
|
|
|
EWOMS_REGISTER_PARAM(TypeTag, std::string, SaveFile,
|
2023-08-22 07:16:20 -05:00
|
|
|
"FileName for .OPMRST file used for saving serialized state. "
|
2023-02-09 07:45:06 -06:00
|
|
|
"If empty, CASENAME.OPMRST is used.");
|
|
|
|
EWOMS_HIDE_PARAM(TypeTag, SaveFile);
|
2023-08-22 07:16:20 -05:00
|
|
|
EWOMS_REGISTER_PARAM(TypeTag, std::string, LoadFile,
|
|
|
|
"FileName for .OPMRST file used to load serialized state. "
|
|
|
|
"If empty, CASENAME.OPMRST is used.");
|
|
|
|
EWOMS_HIDE_PARAM(TypeTag, LoadFile);
|
|
|
|
|
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);
|
2022-08-25 03:32:35 -05:00
|
|
|
// Make cache up to date. No need 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
|
|
|
// 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
|
|
|
|
2023-05-03 06:17:20 -05:00
|
|
|
void updateTUNING(const Tuning& tuning) {
|
2023-05-12 06:09:32 -05:00
|
|
|
modelParam_.tolerance_mb_ = tuning.XXXMBE;
|
|
|
|
if (terminalOutput_) {
|
2023-05-03 06:17:20 -05:00
|
|
|
OpmLog::debug(fmt::format("Setting SimulatorFullyImplicitBlackoilEbos mass balance limit (XXXMBE) to {:.2e}", tuning.XXXMBE));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2023-02-09 05:50:46 -06:00
|
|
|
if (loadStep_ > -1) {
|
|
|
|
loadTimerInfo(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
|
|
|
// 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);
|
|
|
|
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();
|
|
|
|
|
2023-06-14 02:20:25 -05:00
|
|
|
if (!solver_) {
|
|
|
|
solver_ = createSolver(wellModel_());
|
|
|
|
}
|
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_.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());
|
2023-02-09 05:50:46 -06:00
|
|
|
if (loadStep_> -1) {
|
|
|
|
wellModel_().prepareDeserialize(loadStep_ - 1);
|
|
|
|
loadSimulatorState();
|
|
|
|
loadStep_ = -1;
|
|
|
|
ebosSimulator_.model().invalidateAndUpdateIntensiveQuantities(/*timeIdx=*/0);
|
|
|
|
}
|
2023-06-14 02:20:25 -05:00
|
|
|
solver_->model().beginReportStep();
|
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 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);
|
2023-05-03 06:17:20 -05:00
|
|
|
// \Note: Assumes TUNING is only used with adaptive time-stepping
|
|
|
|
// \Note: Need to update both solver (model) and simulator since solver is re-created each report step.
|
2023-06-29 08:20:38 -05:00
|
|
|
solver_->model().updateTUNING(tuning);
|
2023-05-03 06:17:20 -05:00
|
|
|
this->updateTUNING(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);
|
2023-06-14 02:20:25 -05:00
|
|
|
auto stepReport = adaptiveTimeStepping_->step(timer, *solver_, event, nullptr);
|
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_ += 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
|
2023-06-14 02:20:25 -05:00
|
|
|
auto stepReport = solver_->step(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
|
|
|
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
|
|
|
|
2023-06-14 02:20:25 -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
|
|
|
|
Output Non-Linear Convergence to Separate File if Requested
This commit enables outputting non-linear convergence metrics, i.e.,
the MB and CNV values, per phase, for each non-linear iteration in
each timestep. If the user passes the option value "iterations" to
the --extra-convergence-output command line option, this commit will
create a new output file, CASE.INFOITER, that holds
* report step
* time step within that report step
* elapsed time
* MB and CNV values per phase
* well convergence status
for each non-linear iteration.
We use an asynchronous file writing procedure and confer ownership
of the report step's unprocessed convergence reports to this
procedure just before the end of
SimulatorFullyImplicitBlackoilEbos::runStep()
At that point, the convergence reports are about to go out of scope.
The asynchronous protocol uses a dedicated queue of output requests,
class ConvergenceReportQueue, into which the producer-i.e., member
function runStep()-inserts new convergence reports and from which
the output thread, ConvergenceOutputThread::writeASynchronous(),
retrieves those requests before writing the file data.
2022-12-13 08:14:05 -06:00
|
|
|
if (this->grid().comm().rank() == 0) {
|
2023-06-14 02:20:25 -05:00
|
|
|
// Grab the step convergence reports that are new since last we were here.
|
|
|
|
const auto& reps = solver_->model().stepReports();
|
|
|
|
this->writeConvergenceOutput(std::vector<StepReport>{reps.begin() + already_reported_steps_, reps.end()});
|
|
|
|
already_reported_steps_ = reps.size();
|
Output Non-Linear Convergence to Separate File if Requested
This commit enables outputting non-linear convergence metrics, i.e.,
the MB and CNV values, per phase, for each non-linear iteration in
each timestep. If the user passes the option value "iterations" to
the --extra-convergence-output command line option, this commit will
create a new output file, CASE.INFOITER, that holds
* report step
* time step within that report step
* elapsed time
* MB and CNV values per phase
* well convergence status
for each non-linear iteration.
We use an asynchronous file writing procedure and confer ownership
of the report step's unprocessed convergence reports to this
procedure just before the end of
SimulatorFullyImplicitBlackoilEbos::runStep()
At that point, the convergence reports are about to go out of scope.
The asynchronous protocol uses a dedicated queue of output requests,
class ConvergenceReportQueue, into which the producer-i.e., member
function runStep()-inserts new convergence reports and from which
the output thread, ConvergenceOutputThread::writeASynchronous(),
retrieves those requests before writing the file data.
2022-12-13 08:14:05 -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
|
|
|
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
|
|
|
}
|
Output Non-Linear Convergence to Separate File if Requested
This commit enables outputting non-linear convergence metrics, i.e.,
the MB and CNV values, per phase, for each non-linear iteration in
each timestep. If the user passes the option value "iterations" to
the --extra-convergence-output command line option, this commit will
create a new output file, CASE.INFOITER, that holds
* report step
* time step within that report step
* elapsed time
* MB and CNV values per phase
* well convergence status
for each non-linear iteration.
We use an asynchronous file writing procedure and confer ownership
of the report step's unprocessed convergence reports to this
procedure just before the end of
SimulatorFullyImplicitBlackoilEbos::runStep()
At that point, the convergence reports are about to go out of scope.
The asynchronous protocol uses a dedicated queue of output requests,
class ConvergenceReportQueue, into which the producer-i.e., member
function runStep()-inserts new convergence reports and from which
the output thread, ConvergenceOutputThread::writeASynchronous(),
retrieves those requests before writing the file data.
2022-12-13 08:14:05 -06:00
|
|
|
|
2023-02-09 05:50:46 -06:00
|
|
|
handleSave(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
|
|
|
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
|
|
|
|
2023-02-09 04:17:28 -06:00
|
|
|
template<class Serializer>
|
|
|
|
void serializeOp(Serializer& serializer)
|
|
|
|
{
|
|
|
|
serializer(ebosSimulator_);
|
|
|
|
serializer(report_);
|
|
|
|
serializer(adaptiveTimeStepping_);
|
|
|
|
}
|
|
|
|
|
2023-06-14 02:20:25 -05:00
|
|
|
const Model& model() const
|
|
|
|
{ return solver_->model(); }
|
|
|
|
|
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(); }
|
|
|
|
|
Output Non-Linear Convergence to Separate File if Requested
This commit enables outputting non-linear convergence metrics, i.e.,
the MB and CNV values, per phase, for each non-linear iteration in
each timestep. If the user passes the option value "iterations" to
the --extra-convergence-output command line option, this commit will
create a new output file, CASE.INFOITER, that holds
* report step
* time step within that report step
* elapsed time
* MB and CNV values per phase
* well convergence status
for each non-linear iteration.
We use an asynchronous file writing procedure and confer ownership
of the report step's unprocessed convergence reports to this
procedure just before the end of
SimulatorFullyImplicitBlackoilEbos::runStep()
At that point, the convergence reports are about to go out of scope.
The asynchronous protocol uses a dedicated queue of output requests,
class ConvergenceReportQueue, into which the producer-i.e., member
function runStep()-inserts new convergence reports and from which
the output thread, ConvergenceOutputThread::writeASynchronous(),
retrieves those requests before writing the file data.
2022-12-13 08:14:05 -06:00
|
|
|
void startConvergenceOutputThread(std::string_view convOutputOptions,
|
|
|
|
std::string_view optionName)
|
|
|
|
{
|
|
|
|
const auto config = ConvergenceOutputConfiguration {
|
|
|
|
convOutputOptions, optionName
|
|
|
|
};
|
|
|
|
if (! config.want(ConvergenceOutputConfiguration::Option::Iterations)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto getPhaseName = ConvergenceOutputThread::ComponentToPhaseName {
|
|
|
|
[compNames = typename Model::ComponentName{}](const int compIdx)
|
|
|
|
{ return std::string_view { compNames.name(compIdx) }; }
|
|
|
|
};
|
|
|
|
|
|
|
|
auto convertTime = ConvergenceOutputThread::ConvertToTimeUnits {
|
|
|
|
[usys = this->eclState().getUnits()](const double time)
|
|
|
|
{ return usys.from_si(UnitSystem::measure::time, time); }
|
|
|
|
};
|
|
|
|
|
|
|
|
this->convergenceOutputQueue_.emplace();
|
|
|
|
this->convergenceOutputObject_.emplace
|
|
|
|
(this->eclState().getIOConfig().getOutputDir(),
|
|
|
|
this->eclState().getIOConfig().getBaseName(),
|
|
|
|
std::move(getPhaseName),
|
|
|
|
std::move(convertTime),
|
|
|
|
config, *this->convergenceOutputQueue_);
|
|
|
|
|
|
|
|
this->convergenceOutputThread_
|
|
|
|
.emplace(&ConvergenceOutputThread::writeASynchronous,
|
|
|
|
&this->convergenceOutputObject_.value());
|
|
|
|
}
|
|
|
|
|
2023-03-01 06:40:54 -06:00
|
|
|
void writeConvergenceOutput(std::vector<StepReport>&& reports)
|
Output Non-Linear Convergence to Separate File if Requested
This commit enables outputting non-linear convergence metrics, i.e.,
the MB and CNV values, per phase, for each non-linear iteration in
each timestep. If the user passes the option value "iterations" to
the --extra-convergence-output command line option, this commit will
create a new output file, CASE.INFOITER, that holds
* report step
* time step within that report step
* elapsed time
* MB and CNV values per phase
* well convergence status
for each non-linear iteration.
We use an asynchronous file writing procedure and confer ownership
of the report step's unprocessed convergence reports to this
procedure just before the end of
SimulatorFullyImplicitBlackoilEbos::runStep()
At that point, the convergence reports are about to go out of scope.
The asynchronous protocol uses a dedicated queue of output requests,
class ConvergenceReportQueue, into which the producer-i.e., member
function runStep()-inserts new convergence reports and from which
the output thread, ConvergenceOutputThread::writeASynchronous(),
retrieves those requests before writing the file data.
2022-12-13 08:14:05 -06:00
|
|
|
{
|
|
|
|
if (! this->convergenceOutputThread_.has_value()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto requests = std::vector<ConvergenceReportQueue::OutputRequest>{};
|
|
|
|
requests.reserve(reports.size());
|
|
|
|
|
|
|
|
for (auto&& report : reports) {
|
|
|
|
requests.push_back({ report.report_step, report.current_step, std::move(report.report) });
|
|
|
|
}
|
|
|
|
|
|
|
|
this->convergenceOutputQueue_->enqueue(std::move(requests));
|
|
|
|
}
|
|
|
|
|
|
|
|
void endConvergenceOutputThread()
|
|
|
|
{
|
|
|
|
if (! this->convergenceOutputThread_.has_value()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
this->convergenceOutputQueue_->signalLastOutputRequest();
|
|
|
|
this->convergenceOutputThread_->join();
|
|
|
|
}
|
|
|
|
|
2023-02-09 05:50:46 -06:00
|
|
|
//! \brief Serialization of simulator data to .OPMRST files at end of report steps.
|
|
|
|
void handleSave(SimulatorTimer& timer)
|
|
|
|
{
|
2023-08-22 07:16:20 -05:00
|
|
|
if (saveStride_ == 0 && saveStep_ == -1) {
|
2023-02-09 05:50:46 -06:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-02-09 16:30:02 -06:00
|
|
|
OPM_BEGIN_PARALLEL_TRY_CATCH();
|
2023-02-09 05:50:46 -06:00
|
|
|
|
2023-02-09 16:30:02 -06:00
|
|
|
int nextStep = timer.currentStepNum();
|
2023-02-09 05:50:46 -06:00
|
|
|
if ((saveStep_ != -1 && nextStep == saveStep_) ||
|
2023-08-22 07:16:20 -05:00
|
|
|
(saveStride_ != 0 && (nextStep % saveStride_) == 0)) {
|
2023-02-09 05:50:46 -06:00
|
|
|
#if !HAVE_HDF5
|
|
|
|
OpmLog::error("Saving of serialized state requested, but no HDF5 support available.");
|
|
|
|
#else
|
|
|
|
const std::string groupName = "/report_step/" + std::to_string(nextStep);
|
2023-08-22 07:16:20 -05:00
|
|
|
if (saveStride_ < 0 || nextStep == saveStride_ || nextStep == saveStep_) {
|
2023-02-09 07:45:06 -06:00
|
|
|
std::filesystem::remove(saveFile_);
|
2023-02-09 05:50:46 -06:00
|
|
|
}
|
2023-02-09 16:30:02 -06:00
|
|
|
HDF5Serializer writer(saveFile_,
|
|
|
|
HDF5File::OpenMode::APPEND,
|
|
|
|
EclGenericVanguard::comm());
|
2023-08-22 07:16:20 -05:00
|
|
|
if (saveStride_ < 0 || nextStep == saveStride_ || nextStep == saveStep_) {
|
2023-02-09 05:50:46 -06:00
|
|
|
std::ostringstream str;
|
|
|
|
Parameters::printValues<TypeTag>(str);
|
|
|
|
writer.writeHeader("OPM Flow",
|
|
|
|
moduleVersion(),
|
|
|
|
compileTimestamp(),
|
|
|
|
ebosSimulator_.vanguard().caseName(),
|
|
|
|
str.str(),
|
|
|
|
EclGenericVanguard::comm().size());
|
2023-02-10 06:29:58 -06:00
|
|
|
|
|
|
|
if (EclGenericVanguard::comm().size() > 1) {
|
|
|
|
const auto& cellMapping = ebosSimulator_.vanguard().globalCell();
|
|
|
|
std::size_t hash = Dune::hash_range(cellMapping.begin(), cellMapping.end());
|
|
|
|
writer.write(hash, "/", "grid_checksum");
|
|
|
|
}
|
2023-02-09 05:50:46 -06:00
|
|
|
}
|
|
|
|
writer.write(*this, groupName, "simulator_data");
|
2023-02-09 16:30:02 -06:00
|
|
|
writer.write(timer, groupName, "simulator_timer",
|
|
|
|
HDF5File::DataSetMode::ROOT_ONLY);
|
2023-02-09 05:50:46 -06:00
|
|
|
OpmLog::info("Serialized state written for report step " + std::to_string(nextStep));
|
|
|
|
#endif
|
|
|
|
}
|
2023-02-09 16:30:02 -06:00
|
|
|
|
|
|
|
OPM_END_PARALLEL_TRY_CATCH("Error saving serialized state: ",
|
|
|
|
EclGenericVanguard::comm());
|
2023-02-09 05:50:46 -06:00
|
|
|
}
|
|
|
|
|
2023-02-09 05:50:46 -06:00
|
|
|
//! \brief Load timer info from serialized state.
|
|
|
|
void loadTimerInfo([[maybe_unused]] SimulatorTimer& timer)
|
|
|
|
{
|
|
|
|
#if !HAVE_HDF5
|
|
|
|
OpmLog::error("Loading of serialized state requested, but no HDF5 support available.");
|
|
|
|
loadStep_ = -1;
|
|
|
|
#else
|
2023-02-09 16:30:02 -06:00
|
|
|
OPM_BEGIN_PARALLEL_TRY_CATCH();
|
|
|
|
|
2023-08-22 07:16:20 -05:00
|
|
|
HDF5Serializer reader(loadFile_,
|
2023-02-09 16:30:02 -06:00
|
|
|
HDF5File::OpenMode::READ,
|
|
|
|
EclGenericVanguard::comm());
|
|
|
|
|
|
|
|
if (loadStep_ == 0) {
|
2023-02-09 05:50:46 -06:00
|
|
|
loadStep_ = reader.lastReportStep();
|
2023-02-09 16:30:02 -06:00
|
|
|
}
|
2023-02-09 05:50:46 -06:00
|
|
|
|
|
|
|
OpmLog::info("Loading serialized state for report step " + std::to_string(loadStep_));
|
|
|
|
const std::string groupName = "/report_step/" + std::to_string(loadStep_);
|
2023-02-09 16:30:02 -06:00
|
|
|
reader.read(timer, groupName, "simulator_timer", HDF5File::DataSetMode::ROOT_ONLY);
|
|
|
|
|
2023-04-25 08:07:58 -05:00
|
|
|
std::tuple<std::array<std::string,5>,int> header;
|
|
|
|
reader.read(header, "/", "simulator_info", HDF5File::DataSetMode::ROOT_ONLY);
|
|
|
|
const auto& [strings, procs] = header;
|
|
|
|
|
|
|
|
if (EclGenericVanguard::comm().size() != procs) {
|
|
|
|
throw std::runtime_error("Number of processes (procs=" +
|
|
|
|
std::to_string(EclGenericVanguard::comm().size()) +
|
|
|
|
") does not match .OPMRST file (procs=" +
|
|
|
|
std::to_string(procs) + ")");
|
|
|
|
}
|
|
|
|
|
2023-02-10 06:29:58 -06:00
|
|
|
if (EclGenericVanguard::comm().size() > 1) {
|
|
|
|
std::size_t stored_hash;
|
|
|
|
reader.read(stored_hash, "/", "grid_checksum");
|
|
|
|
const auto& cellMapping = ebosSimulator_.vanguard().globalCell();
|
|
|
|
std::size_t hash = Dune::hash_range(cellMapping.begin(), cellMapping.end());
|
|
|
|
if (hash != stored_hash) {
|
2023-04-25 08:07:31 -05:00
|
|
|
throw std::runtime_error("Grid hash mismatch, .OPMRST file cannot be used");
|
2023-02-10 06:29:58 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-25 08:08:49 -05:00
|
|
|
if (EclGenericVanguard::comm().rank() == 0) {
|
|
|
|
std::ostringstream str;
|
|
|
|
Parameters::printValues<TypeTag>(str);
|
|
|
|
checkSerializedCmdLine(str.str(), strings[4]);
|
|
|
|
}
|
|
|
|
|
2023-02-09 16:30:02 -06:00
|
|
|
OPM_END_PARALLEL_TRY_CATCH("Error loading serialized state: ",
|
|
|
|
EclGenericVanguard::comm());
|
2023-02-09 05:50:46 -06:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
//! \brief Load simulator state from serialized state.
|
|
|
|
void loadSimulatorState()
|
|
|
|
{
|
|
|
|
#if HAVE_HDF5
|
2023-02-09 16:30:02 -06:00
|
|
|
OPM_BEGIN_PARALLEL_TRY_CATCH();
|
|
|
|
|
2023-08-22 07:16:20 -05:00
|
|
|
HDF5Serializer reader(loadFile_,
|
2023-02-09 16:30:02 -06:00
|
|
|
HDF5File::OpenMode::READ,
|
|
|
|
EclGenericVanguard::comm());
|
2023-02-09 05:50:46 -06:00
|
|
|
const std::string groupName = "/report_step/" + std::to_string(loadStep_);
|
|
|
|
reader.read(*this, groupName, "simulator_data");
|
2023-02-09 16:30:02 -06:00
|
|
|
|
|
|
|
OPM_END_PARALLEL_TRY_CATCH("Error loading serialized state: ",
|
|
|
|
EclGenericVanguard::comm());
|
2023-02-09 05:50:46 -06:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2016-07-12 11:47:52 -05:00
|
|
|
// Data.
|
2016-08-08 08:26:09 -05:00
|
|
|
Simulator& ebosSimulator_;
|
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
|
|
|
|
2023-06-14 02:20:25 -05:00
|
|
|
std::unique_ptr<Solver> solver_;
|
|
|
|
|
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_;
|
2023-06-14 02:20:25 -05:00
|
|
|
std::size_t already_reported_steps_ = 0;
|
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_;
|
Output Non-Linear Convergence to Separate File if Requested
This commit enables outputting non-linear convergence metrics, i.e.,
the MB and CNV values, per phase, for each non-linear iteration in
each timestep. If the user passes the option value "iterations" to
the --extra-convergence-output command line option, this commit will
create a new output file, CASE.INFOITER, that holds
* report step
* time step within that report step
* elapsed time
* MB and CNV values per phase
* well convergence status
for each non-linear iteration.
We use an asynchronous file writing procedure and confer ownership
of the report step's unprocessed convergence reports to this
procedure just before the end of
SimulatorFullyImplicitBlackoilEbos::runStep()
At that point, the convergence reports are about to go out of scope.
The asynchronous protocol uses a dedicated queue of output requests,
class ConvergenceReportQueue, into which the producer-i.e., member
function runStep()-inserts new convergence reports and from which
the output thread, ConvergenceOutputThread::writeASynchronous(),
retrieves those requests before writing the file data.
2022-12-13 08:14:05 -06:00
|
|
|
|
|
|
|
std::optional<ConvergenceReportQueue> convergenceOutputQueue_{};
|
|
|
|
std::optional<ConvergenceOutputThread> convergenceOutputObject_{};
|
|
|
|
std::optional<std::thread> convergenceOutputThread_{};
|
2023-02-09 05:50:46 -06:00
|
|
|
|
2023-08-22 07:16:20 -05:00
|
|
|
int saveStride_ = 0; //!< Stride to save serialized state at, negative to only keep last
|
2023-02-09 05:50:46 -06:00
|
|
|
int saveStep_ = -1; //!< Specific step to save serialized state at
|
2023-02-09 05:50:46 -06:00
|
|
|
int loadStep_ = -1; //!< Step to load serialized state from
|
2023-08-22 07:16:20 -05:00
|
|
|
std::string saveFile_; //!< File to save serialized state to
|
|
|
|
std::string loadFile_; //!< File to load serialized state from
|
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
|