Merge pull request #4770 from akva2/eclproblem_cleanup_timestepping

EclProblem: cleanup time stepping related members
This commit is contained in:
Markus Blatt
2023-08-17 11:19:55 +02:00
committed by GitHub
8 changed files with 19 additions and 61 deletions

View File

@@ -263,19 +263,6 @@ public:
*/
Scalar porosity(unsigned globalSpaceIdx, unsigned timeIdx) const;
/*!
* \brief Returns the minimum allowable size of a time step.
*/
Scalar minTimeStepSize() const
{ return minTimeStepSize_; }
/*!
* \brief Returns the maximum number of subsequent failures for the time integration
* before giving up.
*/
unsigned maxTimeIntegrationFailures() const
{ return maxFails_; }
bool vapparsActive(int episodeIdx) const;
int numPressurePointsEquil() const
@@ -380,10 +367,6 @@ protected:
bool enableTuning_;
Scalar initialTimeStepSize_;
Scalar maxTimeStepAfterWellEvent_;
Scalar maxTimeStepSize_;
Scalar restartShrinkFactor_;
unsigned maxFails_;
Scalar minTimeStepSize_;
// equilibration parameters
int numPressurePointsEquil_;

View File

@@ -471,9 +471,6 @@ beginEpisode_(bool enableExperiments,
const auto& tuning = sched_state.tuning();
initialTimeStepSize_ = sched_state.max_next_tstep();
maxTimeStepAfterWellEvent_ = tuning.TMAXWC;
maxTimeStepSize_ = tuning.TSMAXZ;
restartShrinkFactor_ = 1./tuning.TSFCNV;
minTimeStepSize_ = tuning.TSMINZ;
return true;
}

View File

@@ -78,6 +78,7 @@
#include <opm/output/eclipse/EclipseIO.hpp>
#include <opm/simulators/flow/EclActionHandler.hpp>
#include <opm/simulators/timestepping/AdaptiveTimeSteppingEbos.hpp>
#include <opm/simulators/timestepping/SimulatorReport.hpp>
#include <opm/simulators/utils/DeferredLoggingErrorHelpers.hpp>
#include <opm/simulators/utils/ParallelSerialization.hpp>
@@ -190,8 +191,6 @@ public:
using EclGenericProblem<GridView,FluidSystem,Scalar>::helpPreamble;
using EclGenericProblem<GridView,FluidSystem,Scalar>::shouldWriteOutput;
using EclGenericProblem<GridView,FluidSystem,Scalar>::shouldWriteRestartFile;
using EclGenericProblem<GridView,FluidSystem,Scalar>::maxTimeIntegrationFailures;
using EclGenericProblem<GridView,FluidSystem,Scalar>::minTimeStepSize;
using EclGenericProblem<GridView,FluidSystem,Scalar>::rockCompressibility;
using EclGenericProblem<GridView,FluidSystem,Scalar>::rockReferencePressure;
using EclGenericProblem<GridView,FluidSystem,Scalar>::porosity;
@@ -224,10 +223,6 @@ public:
if constexpr (enableExperiments)
EWOMS_REGISTER_PARAM(TypeTag, bool, EclEnableAquifers,
"Enable analytic and numeric aquifer models");
EWOMS_REGISTER_PARAM(TypeTag, Scalar, EclMaxTimeStepSizeAfterWellEvent,
"Maximum time step size after an well event");
EWOMS_REGISTER_PARAM(TypeTag, Scalar, EclRestartShrinkFactor,
"Factor by which the time step is reduced after convergence failure");
EWOMS_REGISTER_PARAM(TypeTag, bool, EclEnableTuning,
"Honor some aspects of the TUNING keyword from the ECL deck.");
EWOMS_REGISTER_PARAM(TypeTag, std::string, OutputMode,
@@ -235,7 +230,6 @@ public:
EWOMS_REGISTER_PARAM(TypeTag, int, NumPressurePointsEquil,
"Number of pressure points (in each direction) in tables used for equilibration");
EWOMS_HIDE_PARAM(TypeTag, NumPressurePointsEquil); // Users will typically not need to modify this parameter..
}
@@ -309,11 +303,7 @@ public:
this->enableTuning_ = EWOMS_GET_PARAM(TypeTag, bool, EclEnableTuning);
this->initialTimeStepSize_ = EWOMS_GET_PARAM(TypeTag, Scalar, InitialTimeStepSize);
this->minTimeStepSize_ = EWOMS_GET_PARAM(TypeTag, Scalar, MinTimeStepSize);
this->maxTimeStepSize_ = EWOMS_GET_PARAM(TypeTag, Scalar, MaxTimeStepSize);
this->maxTimeStepAfterWellEvent_ = EWOMS_GET_PARAM(TypeTag, Scalar, EclMaxTimeStepSizeAfterWellEvent);
this->restartShrinkFactor_ = EWOMS_GET_PARAM(TypeTag, Scalar, EclRestartShrinkFactor);
this->maxFails_ = EWOMS_GET_PARAM(TypeTag, unsigned, MaxTimeStepDivisions);
this->maxTimeStepAfterWellEvent_ = EWOMS_GET_PARAM(TypeTag, double, TimeStepAfterEventInDays)*24*60*60;
// The value N for this parameter is defined in the following order of presedence:
// 1. Command line value (--num-pressure-points-equil=N)
@@ -367,9 +357,6 @@ public:
const auto& tuning = schedule[0].tuning();
this->initialTimeStepSize_ = tuning.TSINIT;
this->maxTimeStepAfterWellEvent_ = tuning.TMAXWC;
this->maxTimeStepSize_ = tuning.TSMAXZ;
this->restartShrinkFactor_ = 1./tuning.TSFCNV;
this->minTimeStepSize_ = tuning.TSMINZ;
}
this->initFluidSystem_();

View File

@@ -124,14 +124,6 @@ struct EclEnableAquifers {
// time stepping parameters
template<class TypeTag, class MyTypeTag>
struct EclMaxTimeStepSizeAfterWellEvent {
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag>
struct EclRestartShrinkFactor {
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag>
struct EclEnableTuning {
using type = UndefinedProperty;
};
@@ -534,16 +526,6 @@ struct EnableExperiments<TypeTag, TTag::EclBaseProblem> {
// set defaults for the time stepping parameters
template<class TypeTag>
struct EclMaxTimeStepSizeAfterWellEvent<TypeTag, TTag::EclBaseProblem> {
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 3600*24*365.25;
};
template<class TypeTag>
struct EclRestartShrinkFactor<TypeTag, TTag::EclBaseProblem> {
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 3;
};
template<class TypeTag>
struct EclEnableTuning<TypeTag, TTag::EclBaseProblem> {
static constexpr bool value = false;
};

View File

@@ -164,8 +164,6 @@ void handleExtraConvergenceOutput(SimulatorReport& report,
EWOMS_HIDE_PARAM(TypeTag, MinTimeStepSize);
EWOMS_HIDE_PARAM(TypeTag, PredeterminedTimeStepsFile);
EWOMS_HIDE_PARAM(TypeTag, EclMaxTimeStepSizeAfterWellEvent);
EWOMS_HIDE_PARAM(TypeTag, EclRestartShrinkFactor);
EWOMS_HIDE_PARAM(TypeTag, EclEnableTuning);
// flow also does not use the eWoms Newton method

View File

@@ -57,6 +57,14 @@
#include <algorithm>
namespace Opm::Properties {
namespace TTag {
struct TestRestartTypeTag {
using InheritsFrom = std::tuple<EbosTypeTag, FlowTimeSteppingParameters>;
};
}
}
template<class T>
std::tuple<T,int,int> PackUnpack(T& in)
{
@@ -427,11 +435,12 @@ namespace {
struct AquiferFixture {
AquiferFixture() {
using TT = Opm::Properties::TTag::EbosTypeTag;
using TT = Opm::Properties::TTag::TestRestartTypeTag;
const char* argv[] = {
"test_RestartSerialization",
"--ecl-deck-file-name=GLIFT1.DATA"
};
Opm::AdaptiveTimeSteppingEbos<TT>::registerParameters();
Opm::setupParameters_<TT>(2, argv, /*registerParams=*/true);
Opm::EclGenericVanguard::setCommunication(std::make_unique<Opm::Parallel::Communication>());
}
@@ -444,7 +453,7 @@ BOOST_GLOBAL_FIXTURE(AquiferFixture);
#define TEST_FOR_AQUIFER(TYPE) \
BOOST_AUTO_TEST_CASE(TYPE) \
{ \
using TT = Opm::Properties::TTag::EbosTypeTag; \
using TT = Opm::Properties::TTag::TestRestartTypeTag; \
Opm::EclGenericVanguard::readDeck("GLIFT1.DATA"); \
using Simulator = Opm::GetPropType<TT, Opm::Properties::Simulator>; \
Simulator sim; \
@@ -465,7 +474,7 @@ TEST_FOR_AQUIFER(AquiferFetkovich)
BOOST_AUTO_TEST_CASE(AquiferNumerical)
{
using TT = Opm::Properties::TTag::EbosTypeTag;
using TT = Opm::Properties::TTag::TestRestartTypeTag;
Opm::EclGenericVanguard::readDeck("GLIFT1.DATA");
using Simulator = Opm::GetPropType<TT, Opm::Properties::Simulator>;
Simulator sim;
@@ -483,7 +492,7 @@ BOOST_AUTO_TEST_CASE(AquiferNumerical)
BOOST_AUTO_TEST_CASE(AquiferConstantFlux)
{
using TT = Opm::Properties::TTag::EbosTypeTag;
using TT = Opm::Properties::TTag::TestRestartTypeTag;
Opm::EclGenericVanguard::readDeck("GLIFT1.DATA");
using Simulator = Opm::GetPropType<TT, Opm::Properties::Simulator>;
Simulator sim;

View File

@@ -82,7 +82,7 @@ namespace TTag {
struct TestEquilTypeTag {
using InheritsFrom = std::tuple<FlowModelParameters, EclBaseProblem, BlackOilModel>;
using InheritsFrom = std::tuple<FlowTimeSteppingParameters, FlowModelParameters, EclBaseProblem, BlackOilModel>;
};
struct TestEquilVapwatTypeTag {
using InheritsFrom = std::tuple<FlowModelParameters, EclBaseProblem, BlackOilModel>;
@@ -239,6 +239,7 @@ struct EquilFixture {
#endif
Opm::EclGenericVanguard::setCommunication(std::make_unique<Opm::Parallel::Communication>());
Opm::BlackoilModelParametersEbos<TypeTag>::registerParameters();
Opm::AdaptiveTimeSteppingEbos<TypeTag>::registerParameters();
Opm::Parameters::registerParam<TypeTag, bool>("EnableTerminalOutput",
"EnableTerminalOutput",
Opm::getPropValue<TypeTag, Opm::Properties::EnableTerminalOutput>(),

View File

@@ -67,7 +67,7 @@
namespace Opm::Properties {
namespace TTag {
struct TestGliftTypeTag {
using InheritsFrom = std::tuple<EbosTypeTag>;
using InheritsFrom = std::tuple<EbosTypeTag, FlowTimeSteppingParameters>;
};
}
}
@@ -86,6 +86,7 @@ initSimulator(const char *filename)
filename_arg.c_str()
};
Opm::AdaptiveTimeSteppingEbos<TypeTag>::registerParameters();
Opm::setupParameters_<TypeTag>(/*argc=*/sizeof(argv)/sizeof(argv[0]), argv, /*registerParams=*/true);
Opm::EclGenericVanguard::readDeck(filename);