Merge pull request #5533 from akva2/typetag_free_params3

Move parameters to typetag free parameter system: Last batch
This commit is contained in:
Bård Skaflestad 2024-08-16 16:28:15 +02:00 committed by GitHub
commit 2d4522b0c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
31 changed files with 681 additions and 1780 deletions

View File

@ -36,22 +36,30 @@
namespace Opm::Parameters {
template<class TypeTag, class MyTypeTag>
struct EclNewtonSumTolerance { using type = Properties::UndefinedProperty; };
// the tolerated amount of "incorrect" amount of oil per time step for the complete
// reservoir. this is scaled by the pore volume of the reservoir, i.e., larger reservoirs
// will tolerate larger residuals.
template<class Scalar>
struct EclNewtonSumTolerance { static constexpr Scalar value = 1e-5; };
template<class TypeTag, class MyTypeTag>
struct EclNewtonStrictIterations { using type = Properties::UndefinedProperty; };
// make all Newton iterations strict, i.e., the volumetric Newton tolerance must be
// always be upheld in the majority of the spatial domain. In this context, "majority"
// means 1 - EclNewtonRelaxedVolumeFraction.
struct EclNewtonStrictIterations { static constexpr int value = 100; };
template<class TypeTag, class MyTypeTag>
struct EclNewtonRelaxedVolumeFraction { using type = Properties::UndefinedProperty; };
// set fraction of the pore volume where the volumetric residual may be violated during
// strict Newton iterations
template<class Scalar>
struct EclNewtonRelaxedVolumeFraction { static constexpr Scalar value = 0.05; };
template<class TypeTag, class MyTypeTag>
struct EclNewtonSumToleranceExponent { using type = Properties::UndefinedProperty; };
template<class Scalar>
struct EclNewtonSumToleranceExponent { static constexpr Scalar value = 1.0 / 3.0; };
template<class TypeTag, class MyTypeTag>
struct EclNewtonRelaxedTolerance { using type = Properties::UndefinedProperty; };
// the maximum volumetric error of a cell in the relaxed region
template<class Scalar>
struct EclNewtonRelaxedTolerance { static constexpr Scalar value = NewtonTolerance<Scalar>::value * 1e6; };
} // namespace Opm::Properties
} // namespace Opm::Parameters
namespace Opm {
@ -89,12 +97,12 @@ public:
explicit FlowExpNewtonMethod(Simulator& simulator) : ParentType(simulator)
{
errorPvFraction_ = 1.0;
relaxedMaxPvFraction_ = Parameters::get<TypeTag, Parameters::EclNewtonRelaxedVolumeFraction>();
relaxedMaxPvFraction_ = Parameters::Get<Parameters::EclNewtonRelaxedVolumeFraction<Scalar>>();
sumTolerance_ = 0.0; // this gets determined in the error calculation proceedure
relaxedTolerance_ = Parameters::get<TypeTag, Parameters::EclNewtonRelaxedTolerance>();
relaxedTolerance_ = Parameters::Get<Parameters::EclNewtonRelaxedTolerance<Scalar>>();
numStrictIterations_ = Parameters::get<TypeTag, Parameters::EclNewtonStrictIterations>();
numStrictIterations_ = Parameters::Get<Parameters::EclNewtonStrictIterations>();
}
/*!
@ -104,19 +112,19 @@ public:
{
ParentType::registerParameters();
Parameters::registerParam<TypeTag, Parameters::EclNewtonSumTolerance>
Parameters::Register<Parameters::EclNewtonSumTolerance<Scalar>>
("The maximum error tolerated by the Newton "
"method for considering a solution to be converged");
Parameters::registerParam<TypeTag, Parameters::EclNewtonStrictIterations>
Parameters::Register<Parameters::EclNewtonStrictIterations>
("The number of Newton iterations where the "
"volumetric error is considered.");
Parameters::registerParam<TypeTag, Parameters::EclNewtonRelaxedVolumeFraction>
Parameters::Register<Parameters::EclNewtonRelaxedVolumeFraction<Scalar>>
("The fraction of the pore volume of the reservoir "
"where the volumetric error may be violated during strict Newton iterations.");
Parameters::registerParam<TypeTag, Parameters::EclNewtonSumToleranceExponent>
Parameters::Register<Parameters::EclNewtonSumToleranceExponent<Scalar>>
("The the exponent used to scale the sum tolerance by "
"the total pore volume of the reservoir.");
Parameters::registerParam<TypeTag, Parameters::EclNewtonRelaxedTolerance>
Parameters::Register<Parameters::EclNewtonRelaxedTolerance<Scalar>>
("The maximum error which the volumetric residual "
"may exhibit if it is in a 'relaxed' region during a strict iteration.");
}
@ -219,8 +227,8 @@ public:
// scale the tolerance for the total error with the pore volume. by default, the
// exponent is 1/3, i.e., cubic root.
Scalar x = Parameters::get<TypeTag, Parameters::EclNewtonSumTolerance>();
Scalar y = Parameters::get<TypeTag, Parameters::EclNewtonSumToleranceExponent>();
Scalar x = Parameters::Get<Parameters::EclNewtonSumTolerance<Scalar>>();
Scalar y = Parameters::Get<Parameters::EclNewtonSumToleranceExponent<Scalar>>();
sumTolerance_ = x*std::pow(sumPv, y);
this->endIterMsg() << " (max: " << this->tolerance_

View File

@ -54,9 +54,12 @@ class FlowExpProblem;
namespace Opm::Properties {
namespace TTag {
struct FlowExpTypeTag {
using InheritsFrom = std::tuple<FlowModelParameters, FlowBaseProblem, BlackOilModel, EclTimeSteppingParameters>;
struct FlowExpTypeTag
{
using InheritsFrom = std::tuple<FlowBaseProblem, BlackOilModel>;
};
}
// Set the problem class
@ -120,36 +123,6 @@ struct LinearSolverBackend<TypeTag, TTag::FlowExpTypeTag> {
} // namespace Opm::Properties
namespace Opm::Parameters {
template<class TypeTag>
struct EnableTerminalOutput<TypeTag, Properties::TTag::FlowExpTypeTag>
{ static constexpr bool value = false; };
// the maximum volumetric error of a cell in the relaxed region
template<class TypeTag>
struct EclNewtonRelaxedTolerance<TypeTag, Properties::TTag::FlowExpTypeTag>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr auto baseValue =
Parameters::NewtonTolerance<type>::value;
static constexpr type value = 1e6 * baseValue;
};
// currently, flowexp uses the non-multisegment well model by default to avoid
// regressions. the --use-multisegment-well=true|false command line parameter is still
// available in flowexp, but hidden from view.
template<class TypeTag>
struct UseMultisegmentWell<TypeTag, Properties::TTag::FlowExpTypeTag>
{ static constexpr bool value = false; };
// set some properties that are only required by the well model
template<class TypeTag>
struct MatrixAddWellContributions<TypeTag, Properties::TTag::FlowExpTypeTag>
{ static constexpr bool value = false; };
} // namespace Opm::Parameters
namespace Opm {
template <class TypeTag>
class FlowExpProblem : public FlowProblem<TypeTag> //, public FvBaseProblem<TypeTag>
@ -164,7 +137,7 @@ public:
OPM_TIMEBLOCK(problemWriteOutput);
// use the generic code to prepare the output fields and to
// write the desired VTK files.
if (Parameters::get<TypeTag, Parameters::EnableWriteAllSolutions>() ||
if (Parameters::Get<Parameters::EnableWriteAllSolutions>() ||
this->simulator().episodeWillBeOver())
{
// \Note: the SimulatorTimer does not carry any useful information, so PRT file (if it gets output) will contain wrong
@ -178,34 +151,34 @@ public:
ParentType::registerParameters();
BlackoilModelParameters<TypeTag>::registerParameters();
Parameters::registerParam<TypeTag, Parameters::EnableTerminalOutput>("Do *NOT* use!");
Parameters::hideParam<TypeTag, Parameters::DbhpMaxRel>();
Parameters::hideParam<TypeTag, Parameters::DwellFractionMax>();
Parameters::hideParam<TypeTag, Parameters::MaxResidualAllowed>();
Parameters::hideParam<TypeTag, Parameters::ToleranceMb>();
Parameters::hideParam<TypeTag, Parameters::ToleranceMbRelaxed>();
Parameters::hideParam<TypeTag, Parameters::ToleranceCnv>();
Parameters::hideParam<TypeTag, Parameters::ToleranceCnvRelaxed>();
Parameters::hideParam<TypeTag, Parameters::ToleranceWells>();
Parameters::hideParam<TypeTag, Parameters::ToleranceWellControl>();
Parameters::hideParam<TypeTag, Parameters::MaxWelleqIter>();
Parameters::hideParam<TypeTag, Parameters::UseMultisegmentWell>();
Parameters::hideParam<TypeTag, Parameters::TolerancePressureMsWells>();
Parameters::hideParam<TypeTag, Parameters::MaxPressureChangeMsWells>();
Parameters::hideParam<TypeTag, Parameters::MaxInnerIterMsWells>();
Parameters::hideParam<TypeTag, Parameters::MaxNewtonIterationsWithInnerWellIterations>();
Parameters::hideParam<TypeTag, Parameters::MaxInnerIterWells>();
Parameters::hideParam<TypeTag, Parameters::MaxSinglePrecisionDays>();
Parameters::hideParam<TypeTag, Parameters::MinStrictCnvIter>();
Parameters::hideParam<TypeTag, Parameters::MinStrictMbIter>();
Parameters::hideParam<TypeTag, Parameters::SolveWelleqInitially>();
Parameters::hideParam<TypeTag, Parameters::UpdateEquationsScaling>();
Parameters::hideParam<TypeTag, Parameters::UseUpdateStabilization>();
Parameters::hideParam<TypeTag, Parameters::MatrixAddWellContributions>();
Parameters::hideParam<TypeTag, Parameters::EnableTerminalOutput>();
Parameters::Register<Parameters::EnableTerminalOutput>("Do *NOT* use!");
Parameters::Hide<Parameters::DbhpMaxRel<Scalar>>();
Parameters::Hide<Parameters::DwellFractionMax<Scalar>>();
Parameters::Hide<Parameters::MaxResidualAllowed<Scalar>>();
Parameters::Hide<Parameters::ToleranceMb<Scalar>>();
Parameters::Hide<Parameters::ToleranceMbRelaxed<Scalar>>();
Parameters::Hide<Parameters::ToleranceCnv<Scalar>>();
Parameters::Hide<Parameters::ToleranceCnvRelaxed<Scalar>>();
Parameters::Hide<Parameters::ToleranceWells<Scalar>>();
Parameters::Hide<Parameters::ToleranceWellControl<Scalar>>();
Parameters::Hide<Parameters::MaxWelleqIter>();
Parameters::Hide<Parameters::UseMultisegmentWell>();
Parameters::Hide<Parameters::TolerancePressureMsWells<Scalar>>();
Parameters::Hide<Parameters::MaxPressureChangeMsWells<Scalar>>();
Parameters::Hide<Parameters::MaxInnerIterMsWells>();
Parameters::Hide<Parameters::MaxNewtonIterationsWithInnerWellIterations>();
Parameters::Hide<Parameters::MaxInnerIterWells>();
Parameters::Hide<Parameters::MaxSinglePrecisionDays<Scalar>>();
Parameters::Hide<Parameters::MinStrictCnvIter>();
Parameters::Hide<Parameters::MinStrictMbIter>();
Parameters::Hide<Parameters::SolveWelleqInitially>();
Parameters::Hide<Parameters::UpdateEquationsScaling>();
Parameters::Hide<Parameters::UseUpdateStabilization>();
Parameters::Hide<Parameters::MatrixAddWellContributions>();
Parameters::Hide<Parameters::EnableTerminalOutput>();
// if openMP is available, set the default the number of threads per process for the main
// simulation to 2 (instead of grabbing everything that is available).
// simulation to 1 (instead of grabbing everything that is available).
#if _OPENMP
Parameters::SetDefault<Parameters::ThreadsPerProcess>(2);
#endif
@ -216,6 +189,16 @@ public:
Parameters::SetDefault<Parameters::NewtonMaxIterations>(8);
Parameters::SetDefault<Parameters::NewtonTolerance<Scalar>>(1e-2);
Parameters::SetDefault<Parameters::EclNewtonRelaxedTolerance<Scalar>>(1e-1);
Parameters::SetDefault<Parameters::EclNewtonRelaxedVolumeFraction<Scalar>>(0.0);
Parameters::SetDefault<Parameters::EclNewtonSumTolerance<Scalar>>(1e-5);
Parameters::SetDefault<Parameters::EnableTerminalOutput>(false);
// currently, flowexp uses the non-multisegment well model by default to avoid
// regressions. the --use-multisegment-well=true|false command line parameter is still
// available in flowexp, but hidden from view.
Parameters::SetDefault<Parameters::UseMultisegmentWell>(false);
Parameters::SetDefault<Parameters::MatrixAddWellContributions>(false);
}
// inherit the constructors

View File

@ -75,49 +75,9 @@ struct Simulator<TypeTag, TTag::FlowExpProblemBlackOil>
} // namespace Opm::Properties
namespace Opm::Parameters {
template<class TypeTag>
struct EclNewtonRelaxedTolerance<TypeTag, Properties::TTag::FlowExpProblemBlackOil>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr auto baseValue =
Parameters::NewtonTolerance<type>::value;
static constexpr type value = 10 * baseValue;
};
// set fraction of the pore volume where the volumetric residual may be violated during
// strict Newton iterations
template<class TypeTag>
struct EclNewtonRelaxedVolumeFraction<TypeTag, Properties::TTag::FlowExpProblemBlackOil>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 0.0;
};
template<class TypeTag>
struct EclNewtonSumTolerance<TypeTag, Properties::TTag::FlowExpProblemBlackOil>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1e-5;
};
template<class TypeTag>
struct EclNewtonSumToleranceExponent<TypeTag, Properties::TTag::FlowExpProblemBlackOil>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1.0 / 3.0;;
};
template<class TypeTag>
struct EclNewtonStrictIterations<TypeTag, Properties::TTag::FlowExpProblemBlackOil>
{ static constexpr int value = 100; };
} // namespace Opm::Parameters
int main(int argc, char** argv)
{
using TypeTag = Opm::Properties::TTag::FlowExpProblemBlackOil;
Opm::registerEclTimeSteppingParameters<TypeTag>();
Opm::registerEclTimeSteppingParameters<double>();
return Opm::start<TypeTag>(argc, argv);
}

View File

@ -74,11 +74,11 @@
namespace Opm::Properties {
namespace TTag {
struct FlowProblem {
using InheritsFrom = std::tuple<FlowTimeSteppingParameters, FlowModelParameters,
FlowNonLinearSolver, FlowBaseProblem, BlackOilModel>;
};
struct FlowProblem { using InheritsFrom = std::tuple<FlowBaseProblem, BlackOilModel>; };
}
// default in flow is to formulate the equations in surface volumes
template<class TypeTag>
struct BlackoilConserveSurfaceVolume<TypeTag, TTag::FlowProblem>
@ -142,15 +142,11 @@ template<class TypeTag>
struct LinearSolverSplice<TypeTag, TTag::FlowProblem>
{ using type = TTag::FlowIstlSolver; };
} // namespace Opm::Properties
namespace Opm::Parameters {
template<class TypeTag>
struct EnableDebuggingChecks<TypeTag, Properties::TTag::FlowProblem>
struct EnableDebuggingChecks<TypeTag, TTag::FlowProblem>
{ static constexpr bool value = false; };
}
} // namespace Opm::Properties
namespace Opm {
@ -1314,6 +1310,7 @@ namespace Opm {
public:
std::vector<bool> wasSwitched_;
};
} // namespace Opm
#endif // OPM_BLACKOILMODEL_HEADER_INCLUDED

View File

@ -160,7 +160,7 @@ public:
// only. This must be addressed before going parallel.
const auto& eclState = model_.simulator().vanguard().eclState();
FlowLinearSolverParameters loc_param;
loc_param.template init<TypeTag>(eclState.getSimulationConfig().useCPR());
loc_param.init(eclState.getSimulationConfig().useCPR());
// Override solver type with umfpack if small domain.
// Otherwise hardcode to ILU0
if (domains_[index].cells.size() < 200) {

View File

@ -25,7 +25,6 @@
#include <opm/models/utils/basicproperties.hh>
#include <opm/models/utils/parametersystem.hh>
#include <opm/models/utils/propertysystem.hh>
#include <opm/simulators/flow/SubDomain.hpp>
@ -33,427 +32,106 @@
#include <stdexcept>
#include <string>
namespace Opm::Properties::TTag {
struct FlowModelParameters {};
}
namespace Opm::Parameters {
template<class TypeTag, class MyTypeTag>
struct EclDeckFileName { using type = Properties::UndefinedProperty; };
template<class Scalar>
struct DbhpMaxRel { static constexpr Scalar value = 1.0; };
template<class TypeTag, class MyTypeTag>
struct DbhpMaxRel { using type = Properties::UndefinedProperty; };
template<class Scalar>
struct DwellFractionMax { static constexpr Scalar value = 0.2; };
template<class TypeTag, class MyTypeTag>
struct DwellFractionMax { using type = Properties::UndefinedProperty; };
struct EclDeckFileName { static constexpr auto value = ""; };
template<class TypeTag, class MyTypeTag>
struct MaxResidualAllowed { using type = Properties::UndefinedProperty; };
template<class Scalar>
struct MaxResidualAllowed { static constexpr Scalar value = 1e7; };
template<class TypeTag, class MyTypeTag>
struct RelaxedMaxPvFraction { using type = Properties::UndefinedProperty; };
template<class Scalar>
struct RelaxedMaxPvFraction { static constexpr Scalar value = 0.03; };
template<class TypeTag, class MyTypeTag>
struct ToleranceMb { using type = Properties::UndefinedProperty; };
template<class Scalar>
struct ToleranceMb { static constexpr Scalar value = 1e-7; };
template<class TypeTag, class MyTypeTag>
struct ToleranceMbRelaxed { using type = Properties::UndefinedProperty; };
template<class Scalar>
struct ToleranceMbRelaxed { static constexpr Scalar value = 1e-6; };
template<class TypeTag, class MyTypeTag>
struct ToleranceCnv { using type = Properties::UndefinedProperty; };
template<class Scalar>
struct ToleranceCnv { static constexpr Scalar value = 1e-2; };
template<class TypeTag, class MyTypeTag>
struct ToleranceCnvRelaxed { using type = Properties::UndefinedProperty; };
template<class Scalar>
struct ToleranceCnvRelaxed { static constexpr Scalar value = 1.0; };
template<class TypeTag, class MyTypeTag>
struct ToleranceWells { using type = Properties::UndefinedProperty; };
template<class Scalar>
struct ToleranceWells { static constexpr Scalar value = 1e-4; };
template<class TypeTag, class MyTypeTag>
struct ToleranceWellControl { using type = Properties::UndefinedProperty; };
template<class Scalar>
struct ToleranceWellControl { static constexpr Scalar value = 1e-7; };
template<class TypeTag, class MyTypeTag>
struct MaxWelleqIter { using type = Properties::UndefinedProperty; };
struct MaxWelleqIter { static constexpr int value = 30; };
template<class TypeTag, class MyTypeTag>
struct UseMultisegmentWell { using type = Properties::UndefinedProperty; };
template<class Scalar>
struct MaxSinglePrecisionDays { static constexpr Scalar value = 20.0; };
template<class TypeTag, class MyTypeTag>
struct MaxSinglePrecisionDays { using type = Properties::UndefinedProperty; };
struct MinStrictCnvIter { static constexpr int value = -1; };
struct MinStrictMbIter { static constexpr int value = -1; };
struct SolveWelleqInitially { static constexpr bool value = true; };
struct UpdateEquationsScaling { static constexpr bool value = false; };
struct UseUpdateStabilization { static constexpr bool value = true; };
struct MatrixAddWellContributions { static constexpr bool value = false; };
template<class TypeTag, class MyTypeTag>
struct MinStrictCnvIter { using type = Properties::UndefinedProperty; };
struct UseMultisegmentWell { static constexpr bool value = true; };
template<class TypeTag, class MyTypeTag>
struct MinStrictMbIter { using type = Properties::UndefinedProperty; };
template<class Scalar>
struct TolerancePressureMsWells { static constexpr Scalar value = 0.01*1e5; };
template<class TypeTag, class MyTypeTag>
struct SolveWelleqInitially { using type = Properties::UndefinedProperty; };
template<class Scalar>
struct MaxPressureChangeMsWells { static constexpr Scalar value = 10*1e5; };
template<class TypeTag, class MyTypeTag>
struct UpdateEquationsScaling { using type = Properties::UndefinedProperty; };
struct MaxNewtonIterationsWithInnerWellIterations { static constexpr int value = 8; };
struct MaxInnerIterMsWells { static constexpr int value = 100; };
struct MaxInnerIterWells { static constexpr int value = 50; };
struct ShutUnsolvableWells { static constexpr bool value = true; };
struct AlternativeWellRateInit { static constexpr bool value = true; };
struct StrictOuterIterWells { static constexpr int value = 6; };
struct StrictInnerIterWells { static constexpr int value = 40; };
template<class TypeTag, class MyTypeTag>
struct UseUpdateStabilization { using type = Properties::UndefinedProperty; };
template<class Scalar>
struct RegularizationFactorWells { static constexpr Scalar value = 100.0; };
template<class TypeTag, class MyTypeTag>
struct MatrixAddWellContributions { using type = Properties::UndefinedProperty; };
struct EnableWellOperabilityCheck { static constexpr bool value = true; };
struct EnableWellOperabilityCheckIter { static constexpr bool value = false; };
struct DebugEmitCellPartition { static constexpr bool value = false; };
template<class TypeTag, class MyTypeTag>
struct EnableWellOperabilityCheck { using type = Properties::UndefinedProperty; };
template<class Scalar>
struct RelaxedWellFlowTol { static constexpr Scalar value = 1e-3; };
template<class TypeTag, class MyTypeTag>
struct EnableWellOperabilityCheckIter { using type = Properties::UndefinedProperty; };
template<class Scalar>
struct RelaxedPressureTolMsw { static constexpr Scalar value = 1e4; };
template<class TypeTag, class MyTypeTag>
struct DebugEmitCellPartition { using type = Properties::UndefinedProperty; };
// parameters for multisegment wells
template<class TypeTag, class MyTypeTag>
struct TolerancePressureMsWells { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct MaxPressureChangeMsWells { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct MaxInnerIterMsWells { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct StrictInnerIterWells { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct RelaxedWellFlowTol { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct StrictOuterIterWells { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct RelaxedPressureTolMsw { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct RegularizationFactorWells { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct MaxNewtonIterationsWithInnerWellIterations { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct ShutUnsolvableWells { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct MaxInnerIterWells { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct AlternativeWellRateInit { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct MaximumNumberOfWellSwitches { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct UseAverageDensityMsWells { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct LocalWellSolveControlSwitching { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct UseImplicitIpr { using type = Properties::UndefinedProperty; };
struct MaximumNumberOfWellSwitches { static constexpr int value = 3; };
struct UseAverageDensityMsWells { static constexpr bool value = false; };
struct LocalWellSolveControlSwitching { static constexpr bool value = true; };
struct UseImplicitIpr { static constexpr bool value = true; };
// Network solver parameters
template<class TypeTag, class MyTypeTag>
struct NetworkMaxStrictIterations { using type = Properties::UndefinedProperty; };
struct NetworkMaxStrictIterations { static constexpr int value = 100; };
struct NetworkMaxIterations { static constexpr int value = 200; };
struct NonlinearSolver { static constexpr auto value = "newton"; };
struct LocalSolveApproach { static constexpr auto value = "gauss-seidel"; };
struct MaxLocalSolveIterations { static constexpr int value = 20; };
template<class TypeTag, class MyTypeTag>
struct NetworkMaxIterations { using type = Properties::UndefinedProperty; };
template<class Scalar>
struct LocalToleranceScalingMb { static constexpr Scalar value = 1.0; };
template<class TypeTag, class MyTypeTag>
struct NonlinearSolver { using type = Properties::UndefinedProperty; };
template<class Scalar>
struct LocalToleranceScalingCnv { static constexpr Scalar value = 0.1; };
struct NlddNumInitialNewtonIter { static constexpr int value = 1; };
struct NumLocalDomains { static constexpr int value = 0; };
template<class TypeTag, class MyTypeTag>
struct LocalSolveApproach { using type = Properties::UndefinedProperty; };
template<class Scalar>
struct LocalDomainsPartitioningImbalance { static constexpr Scalar value = 1.03; };
template<class TypeTag, class MyTypeTag>
struct MaxLocalSolveIterations { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct LocalToleranceScalingMb { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct LocalToleranceScalingCnv { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct NlddNumInitialNewtonIter { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct NumLocalDomains { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct LocalDomainsPartitioningImbalance { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct LocalDomainsPartitioningMethod { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct LocalDomainsOrderingMeasure { using type = Properties::UndefinedProperty; };
template<class TypeTag>
struct DbhpMaxRel<TypeTag, Properties::TTag::FlowModelParameters>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1.0;
};
template<class TypeTag>
struct DwellFractionMax<TypeTag, Properties::TTag::FlowModelParameters>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 0.2;
};
template<class TypeTag>
struct MaxResidualAllowed<TypeTag, Properties::TTag::FlowModelParameters>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1e7;
};
template<class TypeTag>
struct RelaxedMaxPvFraction<TypeTag, Properties::TTag::FlowModelParameters>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 0.03;
};
template<class TypeTag>
struct ToleranceMb<TypeTag, Properties::TTag::FlowModelParameters>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1e-7;
};
template<class TypeTag>
struct ToleranceMbRelaxed<TypeTag, Properties::TTag::FlowModelParameters>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1e-6;
};
template<class TypeTag>
struct ToleranceCnv<TypeTag, Properties::TTag::FlowModelParameters>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1e-2;
};
template<class TypeTag>
struct ToleranceCnvRelaxed<TypeTag, Properties::TTag::FlowModelParameters>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1;
};
template<class TypeTag>
struct ToleranceWells<TypeTag, Properties::TTag::FlowModelParameters>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1e-4;
};
template<class TypeTag>
struct ToleranceWellControl<TypeTag, Properties::TTag::FlowModelParameters>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1e-7;
};
template<class TypeTag>
struct MaxWelleqIter<TypeTag, Properties::TTag::FlowModelParameters>
{ static constexpr int value = 30; };
template<class TypeTag>
struct UseMultisegmentWell<TypeTag, Properties::TTag::FlowModelParameters>
{ static constexpr bool value = true; };
template<class TypeTag>
struct MaxSinglePrecisionDays<TypeTag, Properties::TTag::FlowModelParameters>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 20.0;
};
template<class TypeTag>
struct MinStrictCnvIter<TypeTag, Properties::TTag::FlowModelParameters>
{ static constexpr int value = -1; };
template<class TypeTag>
struct MinStrictMbIter<TypeTag, Properties::TTag::FlowModelParameters>
{ static constexpr int value = -1; };
template<class TypeTag>
struct SolveWelleqInitially<TypeTag, Properties::TTag::FlowModelParameters>
{ static constexpr bool value = true; };
template<class TypeTag>
struct UpdateEquationsScaling<TypeTag, Properties::TTag::FlowModelParameters>
{ static constexpr bool value = false; };
template<class TypeTag>
struct UseUpdateStabilization<TypeTag, Properties::TTag::FlowModelParameters>
{ static constexpr bool value = true; };
template<class TypeTag>
struct MatrixAddWellContributions<TypeTag, Properties::TTag::FlowModelParameters>
{ static constexpr bool value = false; };
template<class TypeTag>
struct TolerancePressureMsWells<TypeTag, Properties::TTag::FlowModelParameters>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 0.01*1e5;
};
template<class TypeTag>
struct MaxPressureChangeMsWells<TypeTag, Properties::TTag::FlowModelParameters>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 10*1e5;
};
template<class TypeTag>
struct MaxNewtonIterationsWithInnerWellIterations<TypeTag, Properties::TTag::FlowModelParameters>
{ static constexpr int value = 8; };
template<class TypeTag>
struct MaxInnerIterMsWells<TypeTag, Properties::TTag::FlowModelParameters>
{ static constexpr int value = 100; };
template<class TypeTag>
struct MaxInnerIterWells<TypeTag, Properties::TTag::FlowModelParameters>
{ static constexpr int value = 50; };
template<class TypeTag>
struct ShutUnsolvableWells<TypeTag, Properties::TTag::FlowModelParameters>
{ static constexpr bool value = true; };
template<class TypeTag>
struct AlternativeWellRateInit<TypeTag, Properties::TTag::FlowModelParameters>
{ static constexpr bool value = true; };
template<class TypeTag>
struct StrictOuterIterWells<TypeTag, Properties::TTag::FlowModelParameters>
{ static constexpr int value = 6; };
template<class TypeTag>
struct StrictInnerIterWells<TypeTag, Properties::TTag::FlowModelParameters>
{ static constexpr int value = 40; };
template<class TypeTag>
struct RegularizationFactorWells<TypeTag, Properties::TTag::FlowModelParameters>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 100;
};
template<class TypeTag>
struct EnableWellOperabilityCheck<TypeTag, Properties::TTag::FlowModelParameters>
{ static constexpr bool value = true; };
template<class TypeTag>
struct EnableWellOperabilityCheckIter<TypeTag, Properties::TTag::FlowModelParameters>
{ static constexpr bool value = false; };
template<class TypeTag>
struct DebugEmitCellPartition<TypeTag, Properties::TTag::FlowModelParameters>
{ static constexpr bool value = false; };
template<class TypeTag>
struct RelaxedWellFlowTol<TypeTag, Properties::TTag::FlowModelParameters>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1e-3;
};
template<class TypeTag>
struct RelaxedPressureTolMsw<TypeTag, Properties::TTag::FlowModelParameters>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1.0e4;
};
template<class TypeTag>
struct MaximumNumberOfWellSwitches<TypeTag, Properties::TTag::FlowModelParameters>
{ static constexpr int value = 3; };
template<class TypeTag>
struct UseAverageDensityMsWells<TypeTag, Properties::TTag::FlowModelParameters>
{ static constexpr bool value = false; };
template<class TypeTag>
struct LocalWellSolveControlSwitching<TypeTag, Properties::TTag::FlowModelParameters>
{ static constexpr bool value = true; };
template<class TypeTag>
struct UseImplicitIpr<TypeTag, Properties::TTag::FlowModelParameters>
{ static constexpr bool value = true; };
// Network solver parameters
template<class TypeTag>
struct NetworkMaxStrictIterations<TypeTag, Properties::TTag::FlowModelParameters>
{ static constexpr int value = 100; };
template<class TypeTag>
struct NetworkMaxIterations<TypeTag, Properties::TTag::FlowModelParameters>
{ static constexpr int value = 200; };
template<class TypeTag>
struct NonlinearSolver<TypeTag, Properties::TTag::FlowModelParameters>
{ static constexpr auto value = "newton"; };
template<class TypeTag>
struct LocalSolveApproach<TypeTag, Properties::TTag::FlowModelParameters>
{ static constexpr auto value = "gauss-seidel"; };
template<class TypeTag>
struct MaxLocalSolveIterations<TypeTag, Properties::TTag::FlowModelParameters>
{ static constexpr int value = 20; };
template<class TypeTag>
struct LocalToleranceScalingMb<TypeTag, Properties::TTag::FlowModelParameters>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1.0;
};
template<class TypeTag>
struct LocalToleranceScalingCnv<TypeTag, Properties::TTag::FlowModelParameters>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 0.1;
};
template<class TypeTag>
struct NlddNumInitialNewtonIter<TypeTag, Properties::TTag::FlowModelParameters>
{ static constexpr int value = 1;
};
template<class TypeTag>
struct NumLocalDomains<TypeTag, Properties::TTag::FlowModelParameters>
{ static constexpr int value = 0; };
template<class TypeTag>
struct LocalDomainsPartitioningImbalance<TypeTag, Properties::TTag::FlowModelParameters>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr auto value = type{1.03};
};
template<class TypeTag>
struct LocalDomainsPartitioningMethod<TypeTag, Properties::TTag::FlowModelParameters>
{ static constexpr auto value = "zoltan"; };
template<class TypeTag>
struct LocalDomainsOrderingMeasure<TypeTag, Properties::TTag::FlowModelParameters>
{ static constexpr auto value = "maxpressure"; };
struct LocalDomainsPartitioningMethod { static constexpr auto value = "zoltan"; };
struct LocalDomainsOrderingMeasure { static constexpr auto value = "maxpressure"; };
} // namespace Opm::Parameters
@ -600,44 +278,44 @@ public:
/// Construct from user parameters or defaults.
BlackoilModelParameters()
{
dbhp_max_rel_= Parameters::get<TypeTag, Parameters::DbhpMaxRel>();
dwell_fraction_max_ = Parameters::get<TypeTag, Parameters::DwellFractionMax>();
max_residual_allowed_ = Parameters::get<TypeTag, Parameters::MaxResidualAllowed>();
relaxed_max_pv_fraction_ = Parameters::get<TypeTag, Parameters::RelaxedMaxPvFraction>();
tolerance_mb_ = Parameters::get<TypeTag, Parameters::ToleranceMb>();
tolerance_mb_relaxed_ = std::max(tolerance_mb_, Parameters::get<TypeTag, Parameters::ToleranceMbRelaxed>());
tolerance_cnv_ = Parameters::get<TypeTag, Parameters::ToleranceCnv>();
tolerance_cnv_relaxed_ = std::max(tolerance_cnv_, Parameters::get<TypeTag, Parameters::ToleranceCnvRelaxed>());
tolerance_wells_ = Parameters::get<TypeTag, Parameters::ToleranceWells>();
tolerance_well_control_ = Parameters::get<TypeTag, Parameters::ToleranceWellControl>();
max_welleq_iter_ = Parameters::get<TypeTag, Parameters::MaxWelleqIter>();
use_multisegment_well_ = Parameters::get<TypeTag, Parameters::UseMultisegmentWell>();
tolerance_pressure_ms_wells_ = Parameters::get<TypeTag, Parameters::TolerancePressureMsWells>();
relaxed_tolerance_flow_well_ = Parameters::get<TypeTag, Parameters::RelaxedWellFlowTol>();
relaxed_tolerance_pressure_ms_well_ = Parameters::get<TypeTag, Parameters::RelaxedPressureTolMsw>();
max_pressure_change_ms_wells_ = Parameters::get<TypeTag, Parameters::MaxPressureChangeMsWells>();
max_inner_iter_ms_wells_ = Parameters::get<TypeTag, Parameters::MaxInnerIterMsWells>();
strict_inner_iter_wells_ = Parameters::get<TypeTag, Parameters::StrictInnerIterWells>();
strict_outer_iter_wells_ = Parameters::get<TypeTag, Parameters::StrictOuterIterWells>();
regularization_factor_wells_ = Parameters::get<TypeTag, Parameters::RegularizationFactorWells>();
max_niter_inner_well_iter_ = Parameters::get<TypeTag, Parameters::MaxNewtonIterationsWithInnerWellIterations>();
shut_unsolvable_wells_ = Parameters::get<TypeTag, Parameters::ShutUnsolvableWells>();
max_inner_iter_wells_ = Parameters::get<TypeTag, Parameters::MaxInnerIterWells>();
maxSinglePrecisionTimeStep_ = Parameters::get<TypeTag, Parameters::MaxSinglePrecisionDays>() * 24 * 60 * 60;
min_strict_cnv_iter_ = Parameters::get<TypeTag, Parameters::MinStrictCnvIter>();
min_strict_mb_iter_ = Parameters::get<TypeTag, Parameters::MinStrictMbIter>();
solve_welleq_initially_ = Parameters::get<TypeTag, Parameters::SolveWelleqInitially>();
update_equations_scaling_ = Parameters::get<TypeTag, Parameters::UpdateEquationsScaling>();
use_update_stabilization_ = Parameters::get<TypeTag, Parameters::UseUpdateStabilization>();
matrix_add_well_contributions_ = Parameters::get<TypeTag, Parameters::MatrixAddWellContributions>();
check_well_operability_ = Parameters::get<TypeTag, Parameters::EnableWellOperabilityCheck>();
check_well_operability_iter_ = Parameters::get<TypeTag, Parameters::EnableWellOperabilityCheckIter>();
max_number_of_well_switches_ = Parameters::get<TypeTag, Parameters::MaximumNumberOfWellSwitches>();
use_average_density_ms_wells_ = Parameters::get<TypeTag, Parameters::UseAverageDensityMsWells>();
local_well_solver_control_switching_ = Parameters::get<TypeTag, Parameters::LocalWellSolveControlSwitching>();
use_implicit_ipr_ = Parameters::get<TypeTag, Parameters::UseImplicitIpr>();
nonlinear_solver_ = Parameters::get<TypeTag, Parameters::NonlinearSolver>();
const auto approach = Parameters::get<TypeTag, Parameters::LocalSolveApproach>();
dbhp_max_rel_ = Parameters::Get<Parameters::DbhpMaxRel<Scalar>>();
dwell_fraction_max_ = Parameters::Get<Parameters::DwellFractionMax<Scalar>>();
max_residual_allowed_ = Parameters::Get<Parameters::MaxResidualAllowed<Scalar>>();
relaxed_max_pv_fraction_ = Parameters::Get<Parameters::RelaxedMaxPvFraction<Scalar>>();
tolerance_mb_ = Parameters::Get<Parameters::ToleranceMb<Scalar>>();
tolerance_mb_relaxed_ = std::max(tolerance_mb_, Parameters::Get<Parameters::ToleranceMbRelaxed<Scalar>>());
tolerance_cnv_ = Parameters::Get<Parameters::ToleranceCnv<Scalar>>();
tolerance_cnv_relaxed_ = std::max(tolerance_cnv_, Parameters::Get<Parameters::ToleranceCnvRelaxed<Scalar>>());
tolerance_wells_ = Parameters::Get<Parameters::ToleranceWells<Scalar>>();
tolerance_well_control_ = Parameters::Get<Parameters::ToleranceWellControl<Scalar>>();
max_welleq_iter_ = Parameters::Get<Parameters::MaxWelleqIter>();
use_multisegment_well_ = Parameters::Get<Parameters::UseMultisegmentWell>();
tolerance_pressure_ms_wells_ = Parameters::Get<Parameters::TolerancePressureMsWells<Scalar>>();
relaxed_tolerance_flow_well_ = Parameters::Get<Parameters::RelaxedWellFlowTol<Scalar>>();
relaxed_tolerance_pressure_ms_well_ = Parameters::Get<Parameters::RelaxedPressureTolMsw<Scalar>>();
max_pressure_change_ms_wells_ = Parameters::Get<Parameters::MaxPressureChangeMsWells<Scalar>>();
max_inner_iter_ms_wells_ = Parameters::Get<Parameters::MaxInnerIterMsWells>();
strict_inner_iter_wells_ = Parameters::Get<Parameters::StrictInnerIterWells>();
strict_outer_iter_wells_ = Parameters::Get<Parameters::StrictOuterIterWells>();
regularization_factor_wells_ = Parameters::Get<Parameters::RegularizationFactorWells<Scalar>>();
max_niter_inner_well_iter_ = Parameters::Get<Parameters::MaxNewtonIterationsWithInnerWellIterations>();
shut_unsolvable_wells_ = Parameters::Get<Parameters::ShutUnsolvableWells>();
max_inner_iter_wells_ = Parameters::Get<Parameters::MaxInnerIterWells>();
maxSinglePrecisionTimeStep_ = Parameters::Get<Parameters::MaxSinglePrecisionDays<Scalar>>() * 24 * 60 * 60;
min_strict_cnv_iter_ = Parameters::Get<Parameters::MinStrictCnvIter>();
min_strict_mb_iter_ = Parameters::Get<Parameters::MinStrictMbIter>();
solve_welleq_initially_ = Parameters::Get<Parameters::SolveWelleqInitially>();
update_equations_scaling_ = Parameters::Get<Parameters::UpdateEquationsScaling>();
use_update_stabilization_ = Parameters::Get<Parameters::UseUpdateStabilization>();
matrix_add_well_contributions_ = Parameters::Get<Parameters::MatrixAddWellContributions>();
check_well_operability_ = Parameters::Get<Parameters::EnableWellOperabilityCheck>();
check_well_operability_iter_ = Parameters::Get<Parameters::EnableWellOperabilityCheckIter>();
max_number_of_well_switches_ = Parameters::Get<Parameters::MaximumNumberOfWellSwitches>();
use_average_density_ms_wells_ = Parameters::Get<Parameters::UseAverageDensityMsWells>();
local_well_solver_control_switching_ = Parameters::Get<Parameters::LocalWellSolveControlSwitching>();
use_implicit_ipr_ = Parameters::Get<Parameters::UseImplicitIpr>();
nonlinear_solver_ = Parameters::Get<Parameters::NonlinearSolver>();
const auto approach = Parameters::Get<Parameters::LocalSolveApproach>();
if (approach == "jacobi") {
local_solve_approach_ = DomainSolveApproach::Jacobi;
} else if (approach == "gauss-seidel") {
@ -646,143 +324,143 @@ public:
throw std::runtime_error("Invalid domain solver approach '" + approach + "' specified.");
}
max_local_solve_iterations_ = Parameters::get<TypeTag, Parameters::MaxLocalSolveIterations>();
local_tolerance_scaling_mb_ = Parameters::get<TypeTag, Parameters::LocalToleranceScalingMb>();
local_tolerance_scaling_cnv_ = Parameters::get<TypeTag, Parameters::LocalToleranceScalingCnv>();
nldd_num_initial_newton_iter_ = Parameters::get<TypeTag, Parameters::NlddNumInitialNewtonIter>();
num_local_domains_ = Parameters::get<TypeTag, Parameters::NumLocalDomains>();
local_domain_partition_imbalance_ = std::max(Scalar{1.0}, Parameters::get<TypeTag, Parameters::LocalDomainsPartitioningImbalance>());
local_domain_partition_method_ = Parameters::get<TypeTag, Parameters::LocalDomainsPartitioningMethod>();
deck_file_name_ = Parameters::get<TypeTag, Parameters::EclDeckFileName>();
network_max_strict_iterations_ = Parameters::get<TypeTag, Parameters::NetworkMaxStrictIterations>();
network_max_iterations_ = Parameters::get<TypeTag, Parameters::NetworkMaxIterations>();
local_domain_ordering_ = domainOrderingMeasureFromString(Parameters::get<TypeTag, Parameters::LocalDomainsOrderingMeasure>());
write_partitions_ = Parameters::get<TypeTag, Parameters::DebugEmitCellPartition>();
max_local_solve_iterations_ = Parameters::Get<Parameters::MaxLocalSolveIterations>();
local_tolerance_scaling_mb_ = Parameters::Get<Parameters::LocalToleranceScalingMb<Scalar>>();
local_tolerance_scaling_cnv_ = Parameters::Get<Parameters::LocalToleranceScalingCnv<Scalar>>();
nldd_num_initial_newton_iter_ = Parameters::Get<Parameters::NlddNumInitialNewtonIter>();
num_local_domains_ = Parameters::Get<Parameters::NumLocalDomains>();
local_domain_partition_imbalance_ = std::max(Scalar{1.0}, Parameters::Get<Parameters::LocalDomainsPartitioningImbalance<Scalar>>());
local_domain_partition_method_ = Parameters::Get<Parameters::LocalDomainsPartitioningMethod>();
deck_file_name_ = Parameters::Get<Parameters::EclDeckFileName>();
network_max_strict_iterations_ = Parameters::Get<Parameters::NetworkMaxStrictIterations>();
network_max_iterations_ = Parameters::Get<Parameters::NetworkMaxIterations>();
local_domain_ordering_ = domainOrderingMeasureFromString(Parameters::Get<Parameters::LocalDomainsOrderingMeasure>());
write_partitions_ = Parameters::Get<Parameters::DebugEmitCellPartition>();
}
static void registerParameters()
{
Parameters::registerParam<TypeTag, Parameters::DbhpMaxRel>
Parameters::Register<Parameters::DbhpMaxRel<Scalar>>
("Maximum relative change of the bottom-hole pressure in a single iteration");
Parameters::registerParam<TypeTag, Parameters::DwellFractionMax>
Parameters::Register<Parameters::DwellFractionMax<Scalar>>
("Maximum absolute change of a well's volume fraction in a single iteration");
Parameters::registerParam<TypeTag, Parameters::MaxResidualAllowed>
Parameters::Register<Parameters::MaxResidualAllowed<Scalar>>
("Absolute maximum tolerated for residuals without cutting the time step size");
Parameters::registerParam<TypeTag, Parameters::RelaxedMaxPvFraction>
Parameters::Register<Parameters::RelaxedMaxPvFraction<Scalar>>
("The fraction of the pore volume of the reservoir "
"where the volumetric error (CNV) may be voilated "
"during strict Newton iterations.");
Parameters::registerParam<TypeTag, Parameters::ToleranceMb>
Parameters::Register<Parameters::ToleranceMb<Scalar>>
("Tolerated mass balance error relative to total mass present");
Parameters::registerParam<TypeTag, Parameters::ToleranceMbRelaxed>
Parameters::Register<Parameters::ToleranceMbRelaxed<Scalar>>
("Relaxed tolerated mass balance error that applies for iterations "
"after the iterations with the strict tolerance");
Parameters::registerParam<TypeTag, Parameters::ToleranceCnv>
Parameters::Register<Parameters::ToleranceCnv<Scalar>>
("Local convergence tolerance (Maximum of local saturation errors)");
Parameters::registerParam<TypeTag, Parameters::ToleranceCnvRelaxed>
Parameters::Register<Parameters::ToleranceCnvRelaxed<Scalar>>
("Relaxed local convergence tolerance that applies for iterations "
"after the iterations with the strict tolerance");
Parameters::registerParam<TypeTag, Parameters::ToleranceWells>
Parameters::Register<Parameters::ToleranceWells<Scalar>>
("Well convergence tolerance");
Parameters::registerParam<TypeTag, Parameters::ToleranceWellControl>
Parameters::Register<Parameters::ToleranceWellControl<Scalar>>
("Tolerance for the well control equations");
Parameters::registerParam<TypeTag, Parameters::MaxWelleqIter>
Parameters::Register<Parameters::MaxWelleqIter>
("Maximum number of iterations to determine solution the well equations");
Parameters::registerParam<TypeTag, Parameters::UseMultisegmentWell>
Parameters::Register<Parameters::UseMultisegmentWell>
("Use the well model for multi-segment wells instead of the "
"one for single-segment wells");
Parameters::registerParam<TypeTag, Parameters::TolerancePressureMsWells>
Parameters::Register<Parameters::TolerancePressureMsWells<Scalar>>
("Tolerance for the pressure equations for multi-segment wells");
Parameters::registerParam<TypeTag, Parameters::RelaxedWellFlowTol>
Parameters::Register<Parameters::RelaxedWellFlowTol<Scalar>>
("Relaxed tolerance for the well flow residual");
Parameters::registerParam<TypeTag, Parameters::RelaxedPressureTolMsw>
Parameters::Register<Parameters::RelaxedPressureTolMsw<Scalar>>
("Relaxed tolerance for the MSW pressure solution");
Parameters::registerParam<TypeTag, Parameters::MaxPressureChangeMsWells>
Parameters::Register<Parameters::MaxPressureChangeMsWells<Scalar>>
("Maximum relative pressure change for a single iteration "
"of the multi-segment well model");
Parameters::registerParam<TypeTag, Parameters::MaxInnerIterMsWells>
Parameters::Register<Parameters::MaxInnerIterMsWells>
("Maximum number of inner iterations for multi-segment wells");
Parameters::registerParam<TypeTag, Parameters::StrictInnerIterWells>
Parameters::Register<Parameters::StrictInnerIterWells>
("Number of inner well iterations with strict tolerance");
Parameters::registerParam<TypeTag, Parameters::StrictOuterIterWells>
Parameters::Register<Parameters::StrictOuterIterWells>
("Number of newton iterations for which wells are checked with strict tolerance");
Parameters::registerParam<TypeTag, Parameters::MaxNewtonIterationsWithInnerWellIterations>
Parameters::Register<Parameters::MaxNewtonIterationsWithInnerWellIterations>
("Maximum newton iterations with inner well iterations");
Parameters::registerParam<TypeTag, Parameters::ShutUnsolvableWells>
Parameters::Register<Parameters::ShutUnsolvableWells>
("Shut unsolvable wells");
Parameters::registerParam<TypeTag, Parameters::MaxInnerIterWells>
Parameters::Register<Parameters::MaxInnerIterWells>
("Maximum number of inner iterations for standard wells");
Parameters::registerParam<TypeTag, Parameters::AlternativeWellRateInit>
Parameters::Register<Parameters::AlternativeWellRateInit>
("Use alternative well rate initialization procedure");
Parameters::registerParam<TypeTag, Parameters::RegularizationFactorWells>
Parameters::Register<Parameters::RegularizationFactorWells<Scalar>>
("Regularization factor for wells");
Parameters::registerParam<TypeTag, Parameters::MaxSinglePrecisionDays>
Parameters::Register<Parameters::MaxSinglePrecisionDays<Scalar>>
("Maximum time step size where single precision floating point "
"arithmetic can be used solving for the linear systems of equations");
Parameters::registerParam<TypeTag, Parameters::MinStrictCnvIter>
Parameters::Register<Parameters::MinStrictCnvIter>
("Minimum number of Newton iterations before relaxed tolerances "
"can be used for the CNV convergence criterion");
Parameters::registerParam<TypeTag, Parameters::MinStrictMbIter>
Parameters::Register<Parameters::MinStrictMbIter>
("Minimum number of Newton iterations before relaxed tolerances "
"can be used for the MB convergence criterion. "
"Default -1 means that the relaxed tolerance is used when maximum "
"number of Newton iterations are reached.");
Parameters::registerParam<TypeTag, Parameters::SolveWelleqInitially>
Parameters::Register<Parameters::SolveWelleqInitially>
("Fully solve the well equations before each iteration of the reservoir model");
Parameters::registerParam<TypeTag, Parameters::UpdateEquationsScaling>
Parameters::Register<Parameters::UpdateEquationsScaling>
("Update scaling factors for mass balance equations during the run");
Parameters::registerParam<TypeTag, Parameters::UseUpdateStabilization>
Parameters::Register<Parameters::UseUpdateStabilization>
("Try to detect and correct oscillations or stagnation during the Newton method");
Parameters::registerParam<TypeTag, Parameters::MatrixAddWellContributions>
Parameters::Register<Parameters::MatrixAddWellContributions>
("Explicitly specify the influences of wells between cells in "
"the Jacobian and preconditioner matrices");
Parameters::registerParam<TypeTag, Parameters::EnableWellOperabilityCheck>
Parameters::Register<Parameters::EnableWellOperabilityCheck>
("Enable the well operability checking");
Parameters::registerParam<TypeTag, Parameters::EnableWellOperabilityCheckIter>
Parameters::Register<Parameters::EnableWellOperabilityCheckIter>
("Enable the well operability checking during iterations");
Parameters::registerParam<TypeTag, Parameters::MaximumNumberOfWellSwitches>
Parameters::Register<Parameters::MaximumNumberOfWellSwitches>
("Maximum number of times a well can switch to the same control");
Parameters::registerParam<TypeTag, Parameters::UseAverageDensityMsWells>
Parameters::Register<Parameters::UseAverageDensityMsWells>
("Approximate segment densitities by averaging over segment and its outlet");
Parameters::registerParam<TypeTag, Parameters::LocalWellSolveControlSwitching>
Parameters::Register<Parameters::LocalWellSolveControlSwitching>
("Allow control switching during local well solutions");
Parameters::registerParam<TypeTag, Parameters::UseImplicitIpr>
Parameters::Register<Parameters::UseImplicitIpr>
("Compute implict IPR for stability checks and stable solution search");
Parameters::registerParam<TypeTag, Parameters::NetworkMaxStrictIterations>
Parameters::Register<Parameters::NetworkMaxStrictIterations>
("Maximum iterations in network solver before relaxing tolerance");
Parameters::registerParam<TypeTag, Parameters::NetworkMaxIterations>
Parameters::Register<Parameters::NetworkMaxIterations>
("Maximum number of iterations in the network solver before giving up");
Parameters::registerParam<TypeTag, Parameters::NonlinearSolver>
Parameters::Register<Parameters::NonlinearSolver>
("Choose nonlinear solver. Valid choices are newton or nldd.");
Parameters::registerParam<TypeTag, Parameters::LocalSolveApproach>
Parameters::Register<Parameters::LocalSolveApproach>
("Choose local solve approach. Valid choices are jacobi and gauss-seidel");
Parameters::registerParam<TypeTag, Parameters::MaxLocalSolveIterations>
Parameters::Register<Parameters::MaxLocalSolveIterations>
("Max iterations for local solves with NLDD nonlinear solver.");
Parameters::registerParam<TypeTag, Parameters::LocalToleranceScalingMb>
Parameters::Register<Parameters::LocalToleranceScalingMb<Scalar>>
("Set lower than 1.0 to use stricter convergence tolerance for local solves.");
Parameters::registerParam<TypeTag, Parameters::LocalToleranceScalingCnv>
Parameters::Register<Parameters::LocalToleranceScalingCnv<Scalar>>
("Set lower than 1.0 to use stricter convergence tolerance for local solves.");
Parameters::registerParam<TypeTag, Parameters::NlddNumInitialNewtonIter>
Parameters::Register<Parameters::NlddNumInitialNewtonIter>
("Number of initial global Newton iterations when running the NLDD nonlinear solver.");
Parameters::registerParam<TypeTag, Parameters::NumLocalDomains>
Parameters::Register<Parameters::NumLocalDomains>
("Number of local domains for NLDD nonlinear solver.");
Parameters::registerParam<TypeTag, Parameters::LocalDomainsPartitioningImbalance>
Parameters::Register<Parameters::LocalDomainsPartitioningImbalance<Scalar>>
("Subdomain partitioning imbalance tolerance. 1.03 is 3 percent imbalance.");
Parameters::registerParam<TypeTag, Parameters::LocalDomainsPartitioningMethod>
Parameters::Register<Parameters::LocalDomainsPartitioningMethod>
("Subdomain partitioning method. Allowed values are "
"'zoltan', "
"'simple', "
"and the name of a partition file ending with '.partition'.");
Parameters::registerParam<TypeTag, Parameters::LocalDomainsOrderingMeasure>
Parameters::Register<Parameters::LocalDomainsOrderingMeasure>
("Subdomain ordering measure. Allowed values are "
"'maxpressure', "
"'averagepressure' "
"and 'residual'.");
Parameters::registerParam<TypeTag, Parameters::DebugEmitCellPartition>
Parameters::Register<Parameters::DebugEmitCellPartition>
("Whether or not to emit cell partitions as a debugging aid.");
Parameters::hideParam<TypeTag, Parameters::DebugEmitCellPartition>();
Parameters::Hide<Parameters::DebugEmitCellPartition>();
// if openMP is available, determine the number threads per process automatically.
#if _OPENMP

View File

@ -31,51 +31,22 @@
#ifndef OPM_DAMARIS_PARAMETERS_HPP
#define OPM_DAMARIS_PARAMETERS_HPP
#include <opm/models/utils/propertysystem.hh>
namespace Opm::Parameters {
template<class TypeTag, class MyTypeTag>
struct EnableDamarisOutput { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct DamarisOutputHdfCollective { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct DamarisSaveMeshToHdf { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct DamarisSaveToHdf { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct DamarisPythonScript { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct DamarisPythonParaviewScript { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct DamarisSimName { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct DamarisDedicatedCores { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct DamarisDedicatedNodes { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct DamarisSharedMemoryName { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct DamarisSharedMemorySizeBytes { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct DamarisLogLevel { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct DamarisDaskFile { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct DamarisLimitVariables { using type = Properties::UndefinedProperty; };
struct EnableDamarisOutput { static constexpr bool value = false; };
struct DamarisOutputHdfCollective { static constexpr bool value = true; };
struct DamarisSaveMeshToHdf { static constexpr bool value = false; };
struct DamarisSaveToHdf { static constexpr bool value = true; };
struct DamarisPythonScript { static constexpr auto value = ""; };
struct DamarisPythonParaviewScript { static constexpr auto value = ""; };
struct DamarisSimName { static constexpr auto value = ""; };
struct DamarisDedicatedCores { static constexpr int value = 1; };
struct DamarisDedicatedNodes { static constexpr int value = 0; };
struct DamarisSharedMemoryName { static constexpr auto value = "" ; };
struct DamarisSharedMemorySizeBytes { static constexpr long value = 536870912; }; // 512 MB
struct DamarisLogLevel { static constexpr auto value = "info"; };
struct DamarisDaskFile { static constexpr auto value = ""; };
struct DamarisLimitVariables { static constexpr auto value = ""; };
} // namespace Opm::Parameters

View File

@ -105,58 +105,58 @@ class DamarisWriter : public EclGenericWriter<GetPropType<TypeTag, Properties::G
public:
static void registerParameters()
{
Parameters::registerParam<TypeTag, Parameters::DamarisOutputHdfCollective>
Parameters::Register<Parameters::DamarisOutputHdfCollective>
("Write output via Damaris using parallel HDF5 to "
"get single file and dataset per timestep instead "
"of one per Damaris core with multiple datasets.");
Parameters::registerParam<TypeTag, Parameters::DamarisSaveToHdf>
Parameters::Register<Parameters::DamarisSaveToHdf>
("Set to false to prevent output to HDF5. "
"Uses collective output by default or "
"set --enable-damaris-collective=false to"
"use file per core (file per Damaris server).");
Parameters::registerParam<TypeTag, Parameters::DamarisSaveMeshToHdf>
Parameters::Register<Parameters::DamarisSaveMeshToHdf>
("Saves the mesh data to the HDF5 file (1st iteration only). "
"Will set --damaris-output-hdf-collective to false "
"so will use file per core (file per Damaris server) output "
"(global sizes and offset values of mesh variables are not being provided as yet).");
Parameters::registerParam<TypeTag, Parameters::DamarisPythonScript>
Parameters::Register<Parameters::DamarisPythonScript>
("Set to the path and filename of a Python script to run on "
"Damaris server resources with access to OPM flow data.");
Parameters::registerParam<TypeTag, Parameters::DamarisPythonParaviewScript>
Parameters::Register<Parameters::DamarisPythonParaviewScript>
("Set to the path and filename of a Paraview Python script "
"to run on Paraview Catalyst (1 or 2) on Damaris server "
"resources with access to OPM flow data.");
Parameters::registerParam<TypeTag, Parameters::DamarisSimName>
Parameters::Register<Parameters::DamarisSimName>
("The name of the simulation to be used by Damaris. "
"If empty (the default) then Damaris uses \"opm-sim-<random-number>\". "
"This name is used for the Damaris HDF5 file name prefix. "
"Make unique if writing to the same output directory.");
Parameters::registerParam<TypeTag, Parameters::DamarisLogLevel>
Parameters::Register<Parameters::DamarisLogLevel>
("The log level for the Damaris logging system (boost log based). "
"Levels are: [trace, debug, info, warning, error, fatal]. "
"Currently debug and info are useful. ");
Parameters::registerParam<TypeTag, Parameters::DamarisDaskFile>
Parameters::Register<Parameters::DamarisDaskFile>
("The name of a Dask json configuration file (if using Dask for processing).");
Parameters::registerParam<TypeTag, Parameters::DamarisDedicatedCores>
Parameters::Register<Parameters::DamarisDedicatedCores>
("Set the number of dedicated cores (MPI processes) "
"that should be used for Damaris processing (per node). "
"Must divide evenly into the number of simulation ranks (client ranks).");
Parameters::registerParam<TypeTag, Parameters::DamarisDedicatedNodes>
Parameters::Register<Parameters::DamarisDedicatedNodes>
("Set the number of dedicated nodes (full nodes) "
"that should be used for Damaris processing (per simulation). "
"Must divide evenly into the number of simulation nodes.");
Parameters::registerParam<TypeTag, Parameters::DamarisSharedMemorySizeBytes>
Parameters::Register<Parameters::DamarisSharedMemorySizeBytes>
("Set the size of the shared memory buffer used for IPC "
"between the simulation and the Damaris resources. "
"Needs to hold all the variables published, possibly over "
"multiple simulation iterations.");
Parameters::registerParam<TypeTag, Parameters::DamarisSharedMemoryName>
Parameters::Register<Parameters::DamarisSharedMemoryName>
("The name of the shared memory area to be used by Damaris for the current. "
"If empty (the default) then Damaris uses \"opm-damaris-<random-string>\". "
"This name should be unique if multiple simulations are running on "
"the same node/server as it is used for the Damaris shmem name and by "
"the Python Dask library to locate sections of variables.");
Parameters::registerParam<TypeTag, Parameters::DamarisLimitVariables>
Parameters::Register<Parameters::DamarisLimitVariables>
("A comma separated list of variable names that a user wants to pass "
"through via DamarisOutput::DamarisWriter::writeOutput)() to the "
"damaris_write() call. This can be used to limit the number of "
@ -351,7 +351,8 @@ private:
static bool enableDamarisOutput_()
{
return Parameters::get<TypeTag, Parameters::EnableDamarisOutput>();
static bool enable = Parameters::Get<Parameters::EnableDamarisOutput>();
return enable;
}
void setGlobalIndexForDamaris ()

View File

@ -52,22 +52,21 @@
namespace Opm::Parameters {
template<class TypeTag, class MyTypeTag>
struct EnableEclOutput { using type = Properties::UndefinedProperty; };
// enable the ECL output by default
struct EnableEclOutput { static constexpr bool value = true; };
template<class TypeTag, class MyTypeTag>
struct EnableAsyncEclOutput { using type = Properties::UndefinedProperty; };
// If available, write the ECL output in a non-blocking manner
struct EnableAsyncEclOutput { static constexpr bool value = true; };
template<class TypeTag, class MyTypeTag>
struct EclOutputDoublePrecision { using type = Properties::UndefinedProperty; };
// By default, use single precision for the ECL formated results
struct EclOutputDoublePrecision { static constexpr bool value = false; };
// Write all solutions for visualization, not just the ones for the
// report steps...
template<class TypeTag, class MyTypeTag>
struct EnableWriteAllSolutions { using type = Properties::UndefinedProperty; };
struct EnableWriteAllSolutions { static constexpr bool value = false; };
template<class TypeTag, class MyTypeTag>
struct EnableEsmry { using type = Properties::UndefinedProperty; };
// Write ESMRY file for fast loading of summary data
struct EnableEsmry { static constexpr bool value = false; };
} // namespace Opm::Parameters
@ -125,10 +124,10 @@ public:
{
OutputBlackOilModule<TypeTag>::registerParameters();
Parameters::registerParam<TypeTag, Parameters::EnableAsyncEclOutput>
Parameters::Register<Parameters::EnableAsyncEclOutput>
("Write the ECL-formated results in a non-blocking way "
"(i.e., using a separate thread).");
Parameters::registerParam<TypeTag, Parameters::EnableEsmry>
Parameters::Register<Parameters::EnableEsmry>
("Write ESMRY file for fast loading of summary data.");
}
@ -148,8 +147,8 @@ public:
((simulator.vanguard().grid().comm().rank() == 0)
? &simulator.vanguard().equilCartesianIndexMapper()
: nullptr),
Parameters::get<TypeTag, Parameters::EnableAsyncEclOutput>(),
Parameters::get<TypeTag, Parameters::EnableEsmry>())
Parameters::Get<Parameters::EnableAsyncEclOutput>(),
Parameters::Get<Parameters::EnableEsmry>())
, simulator_(simulator)
{
#if HAVE_MPI
@ -399,7 +398,7 @@ public:
auto floresn = this->outputModule_->getFloresn();
// data::Solution localCellData = {};
if (! isSubStep || Parameters::get<TypeTag, Parameters::EnableWriteAllSolutions>()) {
if (! isSubStep || Parameters::Get<Parameters::EnableWriteAllSolutions>()) {
auto rstep = timer.reportStepNum();
@ -455,7 +454,7 @@ public:
const Scalar curTime = simulator_.time() + simulator_.timeStepSize();
const Scalar nextStepSize = simulator_.problem().nextTimeStepSize();
std::optional<int> timeStepIdx;
if (Parameters::get<TypeTag, Parameters::EnableWriteAllSolutions>()) {
if (Parameters::Get<Parameters::EnableWriteAllSolutions>()) {
timeStepIdx = simulator_.timeStepIndex();
}
this->doWriteOutput(reportStepNum, timeStepIdx, isSubStep,
@ -469,7 +468,7 @@ public:
this->summaryState(),
this->simulator_.problem().thresholdPressure().getRestartVector(),
curTime, nextStepSize,
Parameters::get<TypeTag, Parameters::EclOutputDoublePrecision>(),
Parameters::Get<Parameters::EclOutputDoublePrecision>(),
isFlowsn, std::move(flowsn),
isFloresn, std::move(floresn));
}
@ -484,7 +483,7 @@ public:
bool gasActive = FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx);
bool waterActive = FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx);
bool enableSwatinit = simulator_.vanguard().eclState().fieldProps().has_double("SWATINIT");
bool opm_rst_file = Parameters::get<TypeTag, Parameters::EnableOpmRstFile>();
bool opm_rst_file = Parameters::Get<Parameters::EnableOpmRstFile>();
bool read_temp = enableEnergy || (opm_rst_file && enableTemperature);
std::vector<RestartKey> solutionKeys{
{"PRESSURE", UnitSystem::measure::pressure},
@ -604,7 +603,10 @@ public:
private:
static bool enableEclOutput_()
{ return Parameters::get<TypeTag, Parameters::EnableEclOutput>(); }
{
static bool enable = Parameters::Get<Parameters::EnableEclOutput>();
return enable;
}
const EclipseState& eclState() const
{ return simulator_.vanguard().eclState(); }
@ -637,7 +639,8 @@ private:
countLocalInteriorCellsGridView(gridView);
this->outputModule_->
allocBuffers(num_interior, reportStepNum,
isSubStep && !Parameters::get<TypeTag, Parameters::EnableWriteAllSolutions>(), log, /*isRestart*/ false);
isSubStep && !Parameters::Get<Parameters::EnableWriteAllSolutions>(),
log, /*isRestart*/ false);
ElementContext elemCtx(simulator_);

View File

@ -27,6 +27,8 @@
#ifndef OPM_FLOW_BASE_VANGUARD_HPP
#define OPM_FLOW_BASE_VANGUARD_HPP
#include <dune/grid/common/partitionset.hh>
#include <opm/grid/common/GridEnums.hpp>
#include <opm/grid/common/CartesianIndexMapper.hpp>
#include <opm/grid/LookUpCellCentroid.hh>
@ -69,146 +71,37 @@ struct EquilGrid { using type = UndefinedProperty; };
namespace Opm::Parameters {
template<class TypeTag>
struct EclDeckFileName<TypeTag, Properties::TTag::FlowBaseVanguard>
{ static constexpr auto value = ""; };
struct AllowDistributedWells { static constexpr bool value = false; };
struct EclOutputInterval { static constexpr int value = -1; };
struct EdgeWeightsMethod { static constexpr int value = 1; };
struct EnableDryRun { static constexpr auto value = "auto"; };
struct EnableOpmRstFile { static constexpr bool value = false; };
struct ExternalPartition { static constexpr auto* value = ""; };
// TODO: enumeration parameters. we use strings for now.
template<class TypeTag, class MyTypeTag>
struct EnableDryRun { using type = Properties::UndefinedProperty; };
template<class Scalar>
struct ImbalanceTol { static constexpr Scalar value = 1.1; };
template<class TypeTag, class MyTypeTag>
struct EnableOpmRstFile { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct ParsingStrictness { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct InputSkipMode { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct SchedRestart { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct EclOutputInterval { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct IgnoreKeywords { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct EdgeWeightsMethod { using type = Properties::UndefinedProperty; };
struct IgnoreKeywords { static constexpr auto value = ""; };
struct InputSkipMode { static constexpr auto value = "100"; };
struct MetisParams { static constexpr auto value = "default"; };
#if HAVE_OPENCL || HAVE_ROCSPARSE || HAVE_CUDA
template<class TypeTag, class MyTypeTag>
struct NumJacobiBlocks { using type = Properties::UndefinedProperty; };
struct NumJacobiBlocks { static constexpr int value = 0; };
#endif
template<class TypeTag, class MyTypeTag>
struct OwnerCellsFirst { using type = Properties::UndefinedProperty; };
struct OwnerCellsFirst { static constexpr bool value = true; };
struct ParsingStrictness { static constexpr auto value = "normal"; };
template<class TypeTag, class MyTypeTag>
struct ImbalanceTol { using type = Properties::UndefinedProperty; };
// 0: simple, 1: Zoltan, 2: METIS, see GridEnums.hpp
struct PartitionMethod { static constexpr int value = 1; };
template<class TypeTag, class MyTypeTag>
struct PartitionMethod { using type = Properties::UndefinedProperty; };
struct SchedRestart{ static constexpr bool value = false; };
struct SerialPartitioning{ static constexpr bool value = false; };
template<class TypeTag, class MyTypeTag>
struct SerialPartitioning { using type = Properties::UndefinedProperty; };
template<class Scalar>
struct ZoltanImbalanceTol { static constexpr Scalar value = 1.1; };
// Same as in BlackoilModelParameters.hpp but for here.
template<class TypeTag>
struct UseMultisegmentWell<TypeTag, Properties::TTag::FlowBaseVanguard>
{ static constexpr bool value = true; };
template<class TypeTag, class MyTypeTag>
struct ZoltanImbalanceTol { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct ZoltanParams { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct MetisParams { using type = Properties::UndefinedProperty; };
template <class TypeTag, class MyTypeTag>
struct ExternalPartition { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct AllowDistributedWells { using type = Properties::UndefinedProperty; };
template<class TypeTag>
struct IgnoreKeywords<TypeTag, Properties::TTag::FlowBaseVanguard>
{ static constexpr auto value = ""; };
template<class TypeTag>
struct EclOutputInterval<TypeTag, Properties::TTag::FlowBaseVanguard>
{ static constexpr int value = -1; };
// TODO: enumeration parameters. we use strings for now.
template<class TypeTag>
struct EnableDryRun<TypeTag, Properties::TTag::FlowBaseVanguard>
{ static constexpr auto value = "auto"; };
template<class TypeTag>
struct EnableOpmRstFile<TypeTag, Properties::TTag::FlowBaseVanguard>
{ static constexpr bool value = false; };
template<class TypeTag>
struct ParsingStrictness<TypeTag, Properties::TTag::FlowBaseVanguard>
{ static constexpr auto value = "normal"; };
template<class TypeTag>
struct InputSkipMode<TypeTag, Properties::TTag::FlowBaseVanguard>
{ static constexpr auto value = "100"; };
template<class TypeTag>
struct SchedRestart<TypeTag, Properties::TTag::FlowBaseVanguard>
{ static constexpr bool value = false; };
template<class TypeTag>
struct EdgeWeightsMethod<TypeTag, Properties::TTag::FlowBaseVanguard>
{ static constexpr int value = 1; };
template<class TypeTag>
struct ImbalanceTol<TypeTag, Properties::TTag::FlowBaseVanguard>
{ static constexpr double value = 1.1; };
#if HAVE_OPENCL || HAVE_ROCSPARSE || HAVE_CUDA
template<class TypeTag>
struct NumJacobiBlocks<TypeTag, Properties::TTag::FlowBaseVanguard>
{ static constexpr int value = 0; };
#endif
template<class TypeTag>
struct OwnerCellsFirst<TypeTag, Properties::TTag::FlowBaseVanguard>
{ static constexpr bool value = true; };
template<class TypeTag>
struct PartitionMethod<TypeTag, Properties::TTag::FlowBaseVanguard>
{ static constexpr int value = 1; }; // 0: simple, 1: Zoltan, 2: METIS, see GridEnums.hpp
template<class TypeTag>
struct SerialPartitioning<TypeTag, Properties::TTag::FlowBaseVanguard>
{ static constexpr bool value = false; };
template<class TypeTag>
struct ZoltanImbalanceTol<TypeTag, Properties::TTag::FlowBaseVanguard>
{ static constexpr double value = 1.1; };
template<class TypeTag>
struct ZoltanParams<TypeTag,Properties::TTag::FlowBaseVanguard>
{ static constexpr auto value = "graph"; };
template<class TypeTag>
struct MetisParams<TypeTag,Properties::TTag::FlowBaseVanguard>
{ static constexpr auto value = "default"; };
template <class TypeTag>
struct ExternalPartition<TypeTag, Properties::TTag::FlowBaseVanguard>
{ static constexpr auto* value = ""; };
template<class TypeTag>
struct AllowDistributedWells<TypeTag, Properties::TTag::FlowBaseVanguard>
{ static constexpr bool value = false; };
struct ZoltanParams { static constexpr auto value = "graph"; };
} // namespace Opm::Parameters
@ -247,76 +140,76 @@ public:
*/
static void registerParameters()
{
Parameters::registerParam<TypeTag, Parameters::EclDeckFileName>
Parameters::Register<Parameters::EclDeckFileName>
("The name of the file which contains the ECL deck to be simulated");
Parameters::registerParam<TypeTag, Parameters::EclOutputInterval>
Parameters::Register<Parameters::EclOutputInterval>
("The number of report steps that ought to be skipped between two writes of ECL results");
Parameters::registerParam<TypeTag, Parameters::EnableDryRun>
Parameters::Register<Parameters::EnableDryRun>
("Specify if the simulation ought to be actually run, or just pretended to be");
Parameters::registerParam<TypeTag, Parameters::EnableOpmRstFile>
Parameters::Register<Parameters::EnableOpmRstFile>
("Include OPM-specific keywords in the ECL restart file to "
"enable restart of OPM simulators from these files");
Parameters::registerParam<TypeTag, Parameters::IgnoreKeywords>
Parameters::Register<Parameters::IgnoreKeywords>
("List of Eclipse keywords which should be ignored. As a ':' separated string.");
Parameters::registerParam<TypeTag, Parameters::ParsingStrictness>
Parameters::Register<Parameters::ParsingStrictness>
("Set strictness of parsing process. Available options are "
"normal (stop for critical errors), "
"high (stop for all errors) and "
"low (as normal, except do not stop due to unsupported "
"keywords even if marked critical");
Parameters::registerParam<TypeTag, Parameters::InputSkipMode>
Parameters::Register<Parameters::InputSkipMode>
("Set compatibility mode for the SKIP100/SKIP300 keywords. Options are "
"100 (skip SKIP100..ENDSKIP, keep SKIP300..ENDSKIP) [default], "
"300 (skip SKIP300..ENDSKIP, keep SKIP100..ENDSKIP) and "
"all (skip both SKIP100..ENDSKIP and SKIP300..ENDSKIP) ");
Parameters::registerParam<TypeTag, Parameters::SchedRestart>
Parameters::Register<Parameters::SchedRestart>
("When restarting: should we try to initialize wells and "
"groups from historical SCHEDULE section.");
Parameters::registerParam<TypeTag, Parameters::EdgeWeightsMethod>
Parameters::Register<Parameters::EdgeWeightsMethod>
("Choose edge-weighing strategy: 0=uniform, 1=trans, 2=log(trans).");
#if HAVE_OPENCL || HAVE_ROCSPARSE || HAVE_CUDA
Parameters::registerParam<TypeTag, Parameters::NumJacobiBlocks>
Parameters::Register<Parameters::NumJacobiBlocks>
("Number of blocks to be created for the Block-Jacobi preconditioner.");
#endif
Parameters::registerParam<TypeTag, Parameters::OwnerCellsFirst>
Parameters::Register<Parameters::OwnerCellsFirst>
("Order cells owned by rank before ghost/overlap cells.");
#if HAVE_MPI
Parameters::registerParam<TypeTag, Parameters::PartitionMethod>
Parameters::Register<Parameters::PartitionMethod>
("Choose partitioning strategy: 0=simple, 1=Zoltan, 2=METIS.");
Parameters::registerParam<TypeTag, Parameters::SerialPartitioning>
Parameters::Register<Parameters::SerialPartitioning>
("Perform partitioning for parallel runs on a single process.");
Parameters::registerParam<TypeTag, Parameters::ZoltanImbalanceTol>
Parameters::Register<Parameters::ZoltanImbalanceTol<Scalar>>
("Tolerable imbalance of the loadbalancing provided by Zoltan. DEPRECATED: Use --imbalance-tol instead");
Parameters::hideParam<TypeTag, Parameters::ZoltanImbalanceTol>();
Parameters::registerParam<TypeTag, Parameters::ZoltanParams>
Parameters::Hide<Parameters::ZoltanImbalanceTol<Scalar>>();
Parameters::Register<Parameters::ZoltanParams>
("Configuration of Zoltan partitioner. "
"Valid options are: graph, hypergraph or scotch. "
"Alternatively, you can request a configuration to be read "
"from a JSON file by giving the filename here, ending with '.json.' "
"See https://sandialabs.github.io/Zoltan/ug_html/ug.html "
"for available Zoltan options.");
Parameters::hideParam<TypeTag, Parameters::ZoltanParams>();
Parameters::registerParam<TypeTag, Parameters::ImbalanceTol>
Parameters::Hide<Parameters::ZoltanParams>();
Parameters::Register<Parameters::ImbalanceTol<Scalar>>
("Tolerable imbalance of the loadbalancing (default: 1.1).");
Parameters::registerParam<TypeTag, Parameters::MetisParams>
Parameters::Register<Parameters::MetisParams>
("Configuration of Metis partitioner. "
"You can request a configuration to be read "
"from a JSON file by giving the filename here, ending with '.json.' "
"See http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/manual.pdf"
"for available METIS options.");
Parameters::registerParam<TypeTag, Parameters::ExternalPartition>
Parameters::Register<Parameters::ExternalPartition>
("Name of file from which to load an externally generated "
"partitioning of the model's active cells for MPI "
"distribution purposes. If empty, the built-in partitioning "
"method will be employed.");
Parameters::hideParam<TypeTag, Parameters::ExternalPartition>();
Parameters::Hide<Parameters::ExternalPartition>();
#endif
Parameters::registerParam<TypeTag, Parameters::AllowDistributedWells>
Parameters::Register<Parameters::AllowDistributedWells>
("Allow the perforations of a well to be distributed to interior of multiple processes");
// register here for the use in the tests without BlackoilModelParameters
Parameters::registerParam<TypeTag, Parameters::UseMultisegmentWell>
Parameters::Register<Parameters::UseMultisegmentWell>
("Use the well model for multi-segment wells instead of the one for single-segment wells");
}
@ -329,33 +222,33 @@ public:
FlowBaseVanguard(Simulator& simulator)
: ParentType(simulator)
{
fileName_ = Parameters::get<TypeTag, Parameters::EclDeckFileName>();
edgeWeightsMethod_ = Dune::EdgeWeightMethod(Parameters::get<TypeTag, Parameters::EdgeWeightsMethod>());
fileName_ = Parameters::Get<Parameters::EclDeckFileName>();
edgeWeightsMethod_ = Dune::EdgeWeightMethod(Parameters::Get<Parameters::EdgeWeightsMethod>());
#if HAVE_OPENCL || HAVE_ROCSPARSE || HAVE_CUDA
numJacobiBlocks_ = Parameters::get<TypeTag, Parameters::NumJacobiBlocks>();
numJacobiBlocks_ = Parameters::Get<Parameters::NumJacobiBlocks>();
#endif
ownersFirst_ = Parameters::get<TypeTag, Parameters::OwnerCellsFirst>();
ownersFirst_ = Parameters::Get<Parameters::OwnerCellsFirst>();
#if HAVE_MPI
partitionMethod_ = Dune::PartitionMethod(Parameters::get<TypeTag, Parameters::PartitionMethod>());
serialPartitioning_ = Parameters::get<TypeTag, Parameters::SerialPartitioning>();
imbalanceTol_ = Parameters::get<TypeTag, Parameters::ImbalanceTol>();
partitionMethod_ = Dune::PartitionMethod(Parameters::Get<Parameters::PartitionMethod>());
serialPartitioning_ = Parameters::Get<Parameters::SerialPartitioning>();
imbalanceTol_ = Parameters::Get<Parameters::ImbalanceTol<Scalar>>();
zoltanImbalanceTolSet_ = Parameters::isSet<TypeTag, Parameters::ZoltanImbalanceTol>();
zoltanImbalanceTol_ = Parameters::get<TypeTag, Parameters::ZoltanImbalanceTol>();
zoltanParams_ = Parameters::get<TypeTag, Parameters::ZoltanParams>();
zoltanImbalanceTolSet_ = Parameters::IsSet<Parameters::ZoltanImbalanceTol<Scalar>>();
zoltanImbalanceTol_ = Parameters::Get<Parameters::ZoltanImbalanceTol<Scalar>>();
zoltanParams_ = Parameters::Get<Parameters::ZoltanParams>();
metisParams_ = Parameters::get<TypeTag, Parameters::MetisParams>();
metisParams_ = Parameters::Get<Parameters::MetisParams>();
externalPartitionFile_ = Parameters::get<TypeTag, Parameters::ExternalPartition>();
externalPartitionFile_ = Parameters::Get<Parameters::ExternalPartition>();
#endif
enableDistributedWells_ = Parameters::get<TypeTag, Parameters::AllowDistributedWells>();
ignoredKeywords_ = Parameters::get<TypeTag, Parameters::IgnoreKeywords>();
int output_param = Parameters::get<TypeTag, Parameters::EclOutputInterval>();
enableDistributedWells_ = Parameters::Get<Parameters::AllowDistributedWells>();
ignoredKeywords_ = Parameters::Get<Parameters::IgnoreKeywords>();
int output_param = Parameters::Get<Parameters::EclOutputInterval>();
if (output_param >= 0)
outputInterval_ = output_param;
useMultisegmentWell_ = Parameters::get<TypeTag, Parameters::UseMultisegmentWell>();
useMultisegmentWell_ = Parameters::Get<Parameters::UseMultisegmentWell>();
enableExperiments_ = enableExperiments;
init();
@ -552,9 +445,9 @@ protected:
asImp_().createGrids_();
asImp_().filterConnections_();
std::string outputDir = Parameters::Get<Parameters::OutputDir>();
bool enableEclCompatFile = !Parameters::get<TypeTag, Parameters::EnableOpmRstFile>();
bool enableEclCompatFile = !Parameters::Get<Parameters::EnableOpmRstFile>();
asImp_().updateOutputDir_(outputDir, enableEclCompatFile);
const std::string& dryRunString = Parameters::get<TypeTag, Parameters::EnableDryRun>();
const std::string& dryRunString = Parameters::Get<Parameters::EnableDryRun>();
asImp_().updateNOSIM_(dryRunString);
asImp_().finalizeInit_();
}

View File

@ -44,20 +44,10 @@
namespace Opm::Parameters {
template<class TypeTag, class MyTypeTag>
struct OutputInterval { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct EnableLoggingFalloutWarning { using type = Properties::UndefinedProperty; };
// Do not merge parallel output files or warn about them
template<class TypeTag>
struct EnableLoggingFalloutWarning<TypeTag, Properties::TTag::FlowProblem>
{ static constexpr bool value = false; };
struct EnableLoggingFalloutWarning { static constexpr bool value = false; };
template<class TypeTag>
struct OutputInterval<TypeTag, Properties::TTag::FlowProblem>
{ static constexpr int value = 1; };
struct OutputInterval { static constexpr int value = 1; };
} // namespace Opm::Parameters
@ -101,9 +91,9 @@ namespace Opm {
return EXIT_SUCCESS;
}
// register the flow specific parameters
Parameters::registerParam<TypeTag, Parameters::OutputInterval>
Parameters::Register<Parameters::OutputInterval>
("Specify the number of report steps between two consecutive writes of restart data");
Parameters::registerParam<TypeTag, Parameters::EnableLoggingFalloutWarning>
Parameters::Register<Parameters::EnableLoggingFalloutWarning>
("Developer option to see whether logging was on non-root processors. "
"In that case it will be appended to the *.DBG or *.PRT files");
@ -145,9 +135,9 @@ namespace Opm {
// the default eWoms checkpoint/restart mechanism does not work with flow
Parameters::Hide<Parameters::RestartTime<Scalar>>();
Parameters::hideParam<TypeTag, Parameters::RestartWritingInterval>();
Parameters::Hide<Parameters::RestartWritingInterval>();
// hide all vtk related it is not currently possible to do this dependet on if the vtk writing is used
//if(not(Parameters::get<TypeTag,Properties::EnableVtkOutput>())){
//if(not(Parameters::Get<Parameters::EnableVtkOutput>())){
Parameters::Hide<Parameters::VtkWriteOilFormationVolumeFactor>();
Parameters::Hide<Parameters::VtkWriteOilSaturationPressure>();
Parameters::Hide<Parameters::VtkWriteOilVaporizationFactor>();
@ -169,7 +159,7 @@ namespace Opm {
Parameters::Hide<Parameters::VtkWriteGasFormationVolumeFactor>();
Parameters::Hide<Parameters::VtkWriteGasSaturationPressure>();
Parameters::Hide<Parameters::VtkWriteIntrinsicPermeabilities>();
Parameters::hideParam<TypeTag, Parameters::VtkWriteTracerConcentration>();
Parameters::Hide<Parameters::VtkWriteTracerConcentration>();
Parameters::Hide<Parameters::VtkWriteExtrusionFactor>();
Parameters::Hide<Parameters::VtkWriteFilterVelocities>();
Parameters::Hide<Parameters::VtkWriteDensities>();
@ -190,7 +180,7 @@ namespace Opm {
Parameters::Hide<Parameters::VtkWriteEffectiveDiffusionCoefficients>();
// hide average density option
Parameters::hideParam<TypeTag, Parameters::UseAverageDensityMsWells>();
Parameters::Hide<Parameters::UseAverageDensityMsWells>();
Parameters::endRegistration();
@ -402,8 +392,8 @@ namespace Opm {
}
detail::mergeParallelLogFiles(eclState().getIOConfig().getOutputDir(),
Parameters::get<TypeTag, Parameters::EclDeckFileName>(),
Parameters::get<TypeTag, Parameters::EnableLoggingFalloutWarning>());
Parameters::Get<Parameters::EclDeckFileName>(),
Parameters::Get<Parameters::EnableLoggingFalloutWarning>());
}
void setupModelSimulator()
@ -466,7 +456,7 @@ namespace Opm {
printFlowTrailer(mpi_size_, threads, total_setup_time_, deck_read_time_, report, simulator_->model().localAccumulatedReports());
detail::handleExtraConvergenceOutput(report,
Parameters::get<TypeTag, Parameters::OutputExtraConvergenceInfo>(),
Parameters::Get<Parameters::OutputExtraConvergenceInfo>(),
R"(OutputExtraConvergenceInfo (--output-extra-convergence-info))",
eclState().getIOConfig().getOutputDir(),
eclState().getIOConfig().getBaseName());

View File

@ -221,32 +221,32 @@ public:
VtkTracerModule<TypeTag>::registerParameters();
Parameters::registerParam<TypeTag, Parameters::EnableWriteAllSolutions>
Parameters::Register<Parameters::EnableWriteAllSolutions>
("Write all solutions to disk instead of only the ones for the "
"report steps");
Parameters::registerParam<TypeTag, Parameters::EnableEclOutput>
Parameters::Register<Parameters::EnableEclOutput>
("Write binary output which is compatible with the commercial "
"Eclipse simulator");
#if HAVE_DAMARIS
Parameters::registerParam<TypeTag, Parameters::EnableDamarisOutput>
Parameters::Register<Parameters::EnableDamarisOutput>
("Write a specific variable using Damaris in a separate core");
#endif
Parameters::registerParam<TypeTag, Parameters::EclOutputDoublePrecision>
Parameters::Register<Parameters::EclOutputDoublePrecision>
("Tell the output writer to use double precision. Useful for 'perfect' restarts");
Parameters::registerParam<TypeTag, Parameters::RestartWritingInterval>
Parameters::Register<Parameters::RestartWritingInterval>
("The frequencies of which time steps are serialized to disk");
Parameters::registerParam<TypeTag, Parameters::EnableDriftCompensation>
Parameters::Register<Parameters::EnableDriftCompensation>
("Enable partial compensation of systematic mass losses via "
"the source term of the next time step");
Parameters::registerParam<TypeTag, Parameters::OutputMode>
Parameters::Register<Parameters::OutputMode>
("Specify which messages are going to be printed. "
"Valid values are: none, log, all (default)");
Parameters::registerParam<TypeTag, Parameters::NumPressurePointsEquil>
Parameters::Register<Parameters::NumPressurePointsEquil>
("Number of pressure points (in each direction) in tables used for equilibration");
Parameters::hideParam<TypeTag, Parameters::NumPressurePointsEquil>(); // Users will typically not need to modify this parameter..
Parameters::registerParam<TypeTag, Parameters::ExplicitRockCompaction>
Parameters::Hide<Parameters::NumPressurePointsEquil>(); // Users will typically not need to modify this parameter..
Parameters::Register<Parameters::ExplicitRockCompaction>
("Use pressure from end of the last time step when evaluating rock compaction");
Parameters::hideParam<TypeTag, Parameters::ExplicitRockCompaction>(); // Users will typically not need to modify this parameter..
Parameters::Hide<Parameters::ExplicitRockCompaction>(); // Users will typically not need to modify this parameter..
// By default, stop it after the universe will probably have stopped
// to exist. (the ECL problem will finish the simulation explicitly
@ -331,29 +331,29 @@ public:
#if HAVE_DAMARIS
// create Damaris writer
damarisWriter_ = std::make_unique<DamarisWriterType>(simulator);
enableDamarisOutput_ = Parameters::get<TypeTag, Parameters::EnableDamarisOutput>();
enableDamarisOutput_ = Parameters::Get<Parameters::EnableDamarisOutput>();
#endif
enableDriftCompensation_ = Parameters::get<TypeTag, Parameters::EnableDriftCompensation>();
enableDriftCompensation_ = Parameters::Get<Parameters::EnableDriftCompensation>();
enableEclOutput_ = Parameters::get<TypeTag, Parameters::EnableEclOutput>();
enableEclOutput_ = Parameters::Get<Parameters::EnableEclOutput>();
enableVtkOutput_ = Parameters::Get<Parameters::EnableVtkOutput>();
this->enableTuning_ = Parameters::get<TypeTag, Parameters::EnableTuning>();
this->enableTuning_ = Parameters::Get<Parameters::EnableTuning>();
this->initialTimeStepSize_ = Parameters::Get<Parameters::InitialTimeStepSize<Scalar>>();
this->maxTimeStepAfterWellEvent_ = Parameters::get<TypeTag, Parameters::TimeStepAfterEventInDays>() * 24 * 60 * 60;
this->maxTimeStepAfterWellEvent_ = Parameters::Get<Parameters::TimeStepAfterEventInDays<Scalar>>() * 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)
// 2. EQLDIMS item 2
// Default value is defined in opm-common/src/opm/input/eclipse/share/keywords/000_Eclipse100/E/EQLDIMS
if (Parameters::isSet<TypeTag, Parameters::NumPressurePointsEquil>())
if (Parameters::IsSet<Parameters::NumPressurePointsEquil>())
{
this->numPressurePointsEquil_ = Parameters::get<TypeTag, Parameters::NumPressurePointsEquil>();
this->numPressurePointsEquil_ = Parameters::Get<Parameters::NumPressurePointsEquil>();
} else {
this->numPressurePointsEquil_ = simulator.vanguard().eclState().getTableManager().getEqldims().getNumDepthNodesP();
}
explicitRockCompaction_ = Parameters::get<TypeTag, Parameters::ExplicitRockCompaction>();
explicitRockCompaction_ = Parameters::Get<Parameters::ExplicitRockCompaction>();
RelpermDiagnostics relpermDiagnostics;
@ -679,7 +679,7 @@ public:
OPM_TIMEBLOCK(endTimeStep);
#ifndef NDEBUG
if constexpr (getPropValue<TypeTag, Parameters::EnableDebuggingChecks>()) {
if constexpr (getPropValue<TypeTag, Properties::EnableDebuggingChecks>()) {
// in debug mode, we don't care about performance, so we check
// if the model does the right thing (i.e., the mass change
// inside the whole reservoir must be equivalent to the fluxes
@ -810,7 +810,7 @@ public:
OPM_TIMEBLOCK(problemWriteOutput);
// use the generic code to prepare the output fields and to
// write the desired VTK files.
if (Parameters::get<TypeTag, Parameters::EnableWriteAllSolutions>() ||
if (Parameters::Get<Parameters::EnableWriteAllSolutions>() ||
this->simulator().episodeWillBeOver()) {
ParentType::writeOutput(verbose);
}
@ -2723,7 +2723,7 @@ private:
int episodeIdx = simulator.episodeIndex();
// first thing in the morning, limit the time step size to the maximum size
Scalar maxTimeStepSize = Parameters::get<TypeTag, Parameters::SolverMaxTimeStepInDays>() * 24 * 60 * 60;
Scalar maxTimeStepSize = Parameters::Get<Parameters::SolverMaxTimeStepInDays<Scalar>>() * 24 * 60 * 60;
int reportStepIdx = std::max(episodeIdx, 0);
if (this->enableTuning_) {
const auto& tuning = schedule[reportStepIdx].tuning();

View File

@ -28,35 +28,27 @@
#ifndef OPM_FLOW_PROBLEM_PARAMETERS_HPP
#define OPM_FLOW_PROBLEM_PARAMETERS_HPP
#include <opm/models/utils/propertysystem.hh>
#include <opm/input/eclipse/Parser/ParserKeywords/E.hpp>
namespace Opm::Parameters {
// Enable the additional checks even if compiled in debug mode (i.e., with the NDEBUG
// macro undefined). Next to a slightly better performance, this also eliminates some
// print statements in debug mode.
template<class TypeTag, class MyTypeTag>
struct EnableDebuggingChecks { using type = Properties::UndefinedProperty; };
// Enable partial compensation of systematic mass losses via the source term of the next time
// step
template<class TypeTag, class MyTypeTag>
struct EnableDriftCompensation { using type = Properties::UndefinedProperty; };
// Enable partial compensation of systematic mass losses via
// the source term of the next time step
struct EnableDriftCompensation { static constexpr bool value = false; };
// implicit or explicit pressure in rock compaction
template<class TypeTag, class MyTypeTag>
struct ExplicitRockCompaction { using type = Properties::UndefinedProperty; };
struct ExplicitRockCompaction { static constexpr bool value = false; };
// Parameterize equilibration accuracy
template<class TypeTag, class MyTypeTag>
struct NumPressurePointsEquil { using type = Properties::UndefinedProperty; };
struct NumPressurePointsEquil
{ static constexpr int value = ParserKeywords::EQLDIMS::DEPTH_NODES_P::defaultValue; };
template<class TypeTag, class MyTypeTag>
struct OutputMode { using type = Properties::UndefinedProperty; };
struct OutputMode { static constexpr auto value = "all"; };
// The number of time steps skipped between writing two consequtive restart files
template<class TypeTag, class MyTypeTag>
struct RestartWritingInterval { using type = Properties::UndefinedProperty; };
// The frequency of writing restart (*.ers) files. This is the number of time steps
// between writing restart files
struct RestartWritingInterval { static constexpr int value = 0xffffff; }; // disable
} // namespace Opm::Parameters

View File

@ -28,8 +28,6 @@
#ifndef OPM_FLOW_PROBLEM_PROPERTIES_HPP
#define OPM_FLOW_PROBLEM_PROPERTIES_HPP
#include <opm/input/eclipse/Parser/ParserKeywords/E.hpp>
#include <opm/material/fluidmatrixinteractions/EclMaterialLawManager.hpp>
#include <opm/material/thermal/EclThermalLawManager.hpp>
@ -62,7 +60,7 @@ namespace Opm::Properties {
namespace TTag {
struct FlowBaseProblem {
using InheritsFrom = std::tuple<VtkTracer, OutputBlackOil, CpGridVanguard>;
using InheritsFrom = std::tuple<CpGridVanguard>;
};
}
@ -76,6 +74,12 @@ struct AquiferModel { using type = UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct EnableApiTracking { using type = UndefinedProperty; };
// Enable the additional checks even if compiled in debug mode (i.e., with the NDEBUG
// macro undefined). Next to a slightly better performance, this also eliminates some
// print statements in debug mode.
template<class TypeTag, class MyTypeTag>
struct EnableDebuggingChecks { using type = Properties::UndefinedProperty; };
// if thermal flux boundaries are enabled an effort is made to preserve the initial
// thermal gradient specified via the TEMPVD keyword
template<class TypeTag, class MyTypeTag>
@ -264,150 +268,11 @@ template<class TypeTag>
struct EnableExperiments<TypeTag, TTag::FlowBaseProblem>
{ static constexpr bool value = false; };
} // namespace Opm::Properties
namespace Opm::Parameters {
#ifdef HAVE_DAMARIS
//! Disable the Damaris HDF5 output by default
template<class TypeTag>
struct EnableDamarisOutput<TypeTag, Properties::TTag::FlowBaseProblem>
{ static constexpr bool value = false; };
// If Damaris is available, write specific variable output in parallel
template<class TypeTag>
struct DamarisOutputHdfCollective<TypeTag, Properties::TTag::FlowBaseProblem>
{ static constexpr bool value = true; };
// Save the reservoir model mesh data to the HDF5 file
// (even if field data HDF5 output is disabled)
template<class TypeTag>
struct DamarisSaveMeshToHdf<TypeTag, Properties::TTag::FlowBaseProblem>
{ static constexpr bool value = false; };
// Save the simulation fields (currently only PRESSURE) variables to HDF5 file
template<class TypeTag>
struct DamarisSaveToHdf<TypeTag, Properties::TTag::FlowBaseProblem>
{ static constexpr bool value = true; };
// Specify path and filename of a Python script to run on each end of iteration output
template<class TypeTag>
struct DamarisPythonScript<TypeTag, Properties::TTag::FlowBaseProblem>
{ static constexpr auto value = ""; };
// Specifiy a Paraview Catalyst in situ visualisation script
// (if Paraview is enabled in Damaris)
template<class TypeTag>
struct DamarisPythonParaviewScript<TypeTag, Properties::TTag::FlowBaseProblem>
{ static constexpr auto value = ""; };
// Specify a unique name for the Damaris simulation (used as prefix to HDF5 filenames)
template<class TypeTag>
struct DamarisSimName<TypeTag, Properties::TTag::FlowBaseProblem>
{ static constexpr auto value = ""; };
// Specify the number of Damaris cores (dc) to create (per-node).
// Must divide into the remaining ranks
// equally, e.g. mpirun -np 16 ... -> (if running on one node)
// The following are allowed:
// 1 dc + 15 sim ranks
// or 2 dc + 14 sim
// or 4 dc + 12 sim
// *not* 3 dc + 13 sim ranks
template<class TypeTag>
struct DamarisDedicatedCores<TypeTag, Properties::TTag::FlowBaseProblem>
{ static constexpr int value = 1; };
// Specify the number of Damaris nodes to create
template<class TypeTag>
struct DamarisDedicatedNodes<TypeTag, Properties::TTag::FlowBaseProblem>
{ static constexpr int value = 0; };
// Specify a name for the Damaris shared memory file
// (a unique name will be created by default)
template<class TypeTag>
struct DamarisSharedMemoryName<TypeTag, Properties::TTag::FlowBaseProblem>
{ static constexpr auto value = "" ; };
// Specify the shared memory file size
template<class TypeTag>
struct DamarisSharedMemorySizeBytes<TypeTag, Properties::TTag::FlowBaseProblem>
{ static constexpr long value = 536870912; }; // 512 MB
// Specify the Damaris log level - if set to debug then log is flushed regularly
template<class TypeTag>
struct DamarisLogLevel<TypeTag, Properties::TTag::FlowBaseProblem>
{ static constexpr auto value = "info"; };
// Specify the dask file jason file that specifies the Dask scheduler etc.
template<class TypeTag>
struct DamarisDaskFile<TypeTag, Properties::TTag::FlowBaseProblem>
{ static constexpr auto value = ""; };
// Specify the the exact variables to be passed through
// to Damaris (must exist in the XML file / intiDamarisXmlFile.cpp)
template<class TypeTag>
struct DamarisLimitVariables<TypeTag, Properties::TTag::FlowBaseProblem>
{ static constexpr auto value = ""; };
#endif
// By default, use single precision for the ECL formated results
template<class TypeTag>
struct EclOutputDoublePrecision<TypeTag, Properties::TTag::FlowBaseProblem>
{ static constexpr bool value = false; };
// If available, write the ECL output in a non-blocking manner
template<class TypeTag>
struct EnableAsyncEclOutput<TypeTag, Properties::TTag::FlowBaseProblem>
{ static constexpr bool value = true; };
// By default, we enable the debugging checks if we're compiled in debug mode
template<class TypeTag>
struct EnableDebuggingChecks<TypeTag, Properties::TTag::FlowBaseProblem>
struct EnableDebuggingChecks<TypeTag, TTag::FlowBaseProblem>
{ static constexpr bool value = true; };
// Drift compensation is an experimental feature, i.e., systematic errors in the
// conservation quantities are only compensated for
// as default if experimental mode is enabled.
template<class TypeTag>
struct EnableDriftCompensation<TypeTag, Properties::TTag::FlowBaseProblem>
{ static constexpr bool value = false; };
// enable the ECL output by default
template<class TypeTag>
struct EnableEclOutput<TypeTag,Properties::TTag::FlowBaseProblem>
{ static constexpr bool value = true; };
// Write ESMRY file for fast loading of summary data
template<class TypeTag>
struct EnableEsmry<TypeTag, Properties::TTag::FlowBaseProblem>
{ static constexpr bool value = false; };
// only write the solutions for the report steps to disk
template<class TypeTag>
struct EnableWriteAllSolutions<TypeTag, Properties::TTag::FlowBaseProblem>
{ static constexpr bool value = false; };
// By default, use implicit pressure in rock compaction
template<class TypeTag>
struct ExplicitRockCompaction<TypeTag, Properties::TTag::FlowBaseProblem>
{ static constexpr bool value = false; };
// Parameterize equilibration accuracy
template<class TypeTag>
struct NumPressurePointsEquil<TypeTag, Properties::TTag::FlowBaseProblem>
{ static constexpr int value = ParserKeywords::EQLDIMS::DEPTH_NODES_P::defaultValue; };
template<class TypeTag>
struct OutputMode<TypeTag, Properties::TTag::FlowBaseProblem>
{ static constexpr auto value = "all"; };
// The frequency of writing restart (*.ers) files. This is the number of time steps
// between writing restart files
template<class TypeTag>
struct RestartWritingInterval<TypeTag, Properties::TTag::FlowBaseProblem>
{ static constexpr int value = 0xffffff; }; // disable
} // namespace Opm::Parameters
} // namespace Opm::Properties
#endif // OPM_FLOW_PROBLEM_PROPERTIES_HPP

View File

@ -337,12 +337,12 @@ private:
outputDir = eclipseState_->getIOConfig().getOutputDir();
}
else {
deckFilename = Parameters::get<PreTypeTag, Parameters::EclDeckFileName>();
deckFilename = Parameters::Get<Parameters::EclDeckFileName>();
outputDir = Parameters::Get<Parameters::OutputDir>();
}
#if HAVE_DAMARIS
enableDamarisOutput_ = Parameters::get<PreTypeTag, Parameters::EnableDamarisOutput>();
enableDamarisOutput_ = Parameters::Get<Parameters::EnableDamarisOutput>();
// Reset to false as we cannot use Damaris if there is only one rank.
if ((enableDamarisOutput_ == true) && (FlowGenericVanguard::comm().size() == 1)) {
@ -378,7 +378,7 @@ private:
int mpiRank = FlowGenericVanguard::comm().rank();
outputCout_ = false;
if (mpiRank == 0)
outputCout_ = Parameters::get<PreTypeTag, Parameters::EnableTerminalOutput>();
outputCout_ = Parameters::Get<Parameters::EnableTerminalOutput>();
if (deckFilename.empty()) {
if (mpiRank == 0) {
@ -406,7 +406,7 @@ private:
std::string cmdline_params;
if (outputCout_) {
printFlowBanner(FlowGenericVanguard::comm().size(),
getNumThreads<PreTypeTag>(),
getNumThreads(),
Opm::moduleVersionName());
std::ostringstream str;
Parameters::printValues(str);
@ -417,13 +417,13 @@ private:
try {
this->readDeck(deckFilename,
outputDir,
Parameters::get<PreTypeTag, Parameters::OutputMode>(),
!Parameters::get<PreTypeTag, Parameters::SchedRestart>(),
Parameters::get<PreTypeTag, Parameters::EnableLoggingFalloutWarning>(),
Parameters::get<PreTypeTag, Parameters::ParsingStrictness>(),
Parameters::get<PreTypeTag, Parameters::InputSkipMode>(),
getNumThreads<PreTypeTag>(),
Parameters::get<PreTypeTag, Parameters::EclOutputInterval>(),
Parameters::Get<Parameters::OutputMode>(),
!Parameters::Get<Parameters::SchedRestart>(),
Parameters::Get<Parameters::EnableLoggingFalloutWarning>(),
Parameters::Get<Parameters::ParsingStrictness>(),
Parameters::Get<Parameters::InputSkipMode>(),
getNumThreads(),
Parameters::Get<Parameters::EclOutputInterval>(),
cmdline_params,
Opm::moduleVersion(),
Opm::compileTimestamp());
@ -705,7 +705,6 @@ private:
void setupVanguard();
template<class TypeTag>
static int getNumThreads()
{

View File

@ -39,40 +39,13 @@
#include <memory>
namespace Opm::Properties::TTag {
struct FlowNonLinearSolver {};
}
namespace Opm::Parameters {
template<class TypeTag, class MyTypeTag>
struct NewtonMaxRelax { using type = Properties::UndefinedProperty; };
template<class Scalar>
struct NewtonMaxRelax { static constexpr Scalar value = 0.5; };
// we are reusing NewtonMaxIterations from opm-models
// See opm/models/nonlinear/newtonmethodproperties.hh
template<class TypeTag, class MyTypeTag>
struct NewtonMinIterations { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct NewtonRelaxationType { using type = Properties::UndefinedProperty; };
template<class TypeTag>
struct NewtonMaxRelax<TypeTag, Properties::TTag::FlowNonLinearSolver>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 0.5;
};
template<class TypeTag>
struct NewtonMinIterations<TypeTag, Properties::TTag::FlowNonLinearSolver>
{ static constexpr int value = 2; };
template<class TypeTag>
struct NewtonRelaxationType<TypeTag, Properties::TTag::FlowNonLinearSolver>
{ static constexpr auto value = "dampen"; };
struct NewtonMinIterations { static constexpr int value = 2; };
struct NewtonRelaxationType { static constexpr auto value = "dampen"; };
} // namespace Opm::Parameters
@ -125,11 +98,11 @@ void stabilizeNonlinearUpdate(BVector& dx, BVector& dxOld,
reset();
// overload with given parameters
relaxMax_ = Parameters::get<TypeTag, Parameters::NewtonMaxRelax>();
relaxMax_ = Parameters::Get<Parameters::NewtonMaxRelax<Scalar>>();
maxIter_ = Parameters::Get<Parameters::NewtonMaxIterations>();
minIter_ = Parameters::get<TypeTag, Parameters::NewtonMinIterations>();
minIter_ = Parameters::Get<Parameters::NewtonMinIterations>();
const auto& relaxationTypeString = Parameters::get<TypeTag, Parameters::NewtonRelaxationType>();
const auto& relaxationTypeString = Parameters::Get<Parameters::NewtonRelaxationType>();
if (relaxationTypeString == "dampen") {
relaxType_ = NonlinearRelaxType::Dampen;
} else if (relaxationTypeString == "sor") {
@ -142,13 +115,13 @@ void stabilizeNonlinearUpdate(BVector& dx, BVector& dxOld,
static void registerParameters()
{
Parameters::registerParam<TypeTag, Parameters::NewtonMaxRelax>
Parameters::Register<Parameters::NewtonMaxRelax<Scalar>>
("The maximum relaxation factor of a Newton iteration");
Parameters::Register<Parameters::NewtonMaxIterations>
("The maximum number of Newton iterations per time step");
Parameters::registerParam<TypeTag, Parameters::NewtonMinIterations>
Parameters::Register<Parameters::NewtonMinIterations>
("The minimum number of Newton iterations per time step");
Parameters::registerParam<TypeTag, Parameters::NewtonRelaxationType>
Parameters::Register<Parameters::NewtonRelaxationType>
("The type of relaxation used by Newton method");
Parameters::SetDefault<Parameters::NewtonMaxIterations>(20);

View File

@ -65,28 +65,10 @@
#include <utility>
#include <vector>
namespace Opm::Properties::TTag {
// create new type tag for the Ecl-output
struct OutputBlackOil {};
} // namespace Opm::Properties::TTag
namespace Opm::Parameters {
template <class TypeTag, class MyTypeTag>
struct ForceDisableFluidInPlaceOutput { using type = Properties::UndefinedProperty; };
template <class TypeTag, class MyTypeTag>
struct ForceDisableResvFluidInPlaceOutput { using type = Properties::UndefinedProperty; };
template <class TypeTag>
struct ForceDisableFluidInPlaceOutput<TypeTag, Properties::TTag::OutputBlackOil>
{ static constexpr bool value = false; };
template <class TypeTag>
struct ForceDisableResvFluidInPlaceOutput<TypeTag, Properties::TTag::OutputBlackOil>
{ static constexpr bool value = false; };
struct ForceDisableFluidInPlaceOutput { static constexpr bool value = false; };
struct ForceDisableResvFluidInPlaceOutput { static constexpr bool value = false; };
} // namespace Opm::Parameters
@ -165,12 +147,12 @@ public:
this->setupBlockData(isCartIdxOnThisRank);
this->forceDisableFipOutput_ =
Parameters::get<TypeTag, Parameters::ForceDisableFluidInPlaceOutput>();
Parameters::Get<Parameters::ForceDisableFluidInPlaceOutput>();
this->forceDisableFipresvOutput_ =
Parameters::get<TypeTag, Parameters::ForceDisableResvFluidInPlaceOutput>();
Parameters::Get<Parameters::ForceDisableResvFluidInPlaceOutput>();
if (! Parameters::get<TypeTag, Parameters::OwnerCellsFirst>()) {
if (! Parameters::Get<Parameters::OwnerCellsFirst>()) {
const std::string msg = "The output code does not support --owner-cells-first=false.";
if (collectToIORank.isIORank()) {
OpmLog::error(msg);
@ -199,10 +181,10 @@ public:
*/
static void registerParameters()
{
Parameters::registerParam<TypeTag, Parameters::ForceDisableFluidInPlaceOutput>
Parameters::Register<Parameters::ForceDisableFluidInPlaceOutput>
("Do not print fluid-in-place values after each report step "
"even if requested by the deck.");
Parameters::registerParam<TypeTag, Parameters::ForceDisableResvFluidInPlaceOutput>
Parameters::Register<Parameters::ForceDisableResvFluidInPlaceOutput>
("Do not print reservoir volumes values after each report step "
"even if requested by the deck.");
}

View File

@ -59,51 +59,12 @@
namespace Opm::Parameters {
template<class TypeTag, class MyTypeTag>
struct EnableAdaptiveTimeStepping { using type = Properties::UndefinedProperty; };
template <class TypeTag, class MyTypeTag>
struct OutputExtraConvergenceInfo { using type = Properties::UndefinedProperty; };
template <class TypeTag, class MyTypeTag>
struct SaveStep { using type = Properties::UndefinedProperty; };
template <class TypeTag, class MyTypeTag>
struct LoadStep { using type = Properties::UndefinedProperty; };
template <class TypeTag, class MyTypeTag>
struct SaveFile { using type = Properties::UndefinedProperty; };
template <class TypeTag, class MyTypeTag>
struct LoadFile { using type = Properties::UndefinedProperty; };
template<class TypeTag>
struct EnableAdaptiveTimeStepping<TypeTag, Properties::TTag::FlowProblem>
{ static constexpr bool value = true; };
template <class TypeTag>
struct OutputExtraConvergenceInfo<TypeTag, Properties::TTag::FlowProblem>
{ static constexpr auto* value = "none"; };
template<class TypeTag>
struct EnableTerminalOutput<TypeTag, Properties::TTag::FlowProblem>
{ static constexpr bool value = true; };
template <class TypeTag>
struct SaveStep<TypeTag, Properties::TTag::FlowProblem>
{ static constexpr auto* value = ""; };
template <class TypeTag>
struct SaveFile<TypeTag, Properties::TTag::FlowProblem>
{ static constexpr auto* value = ""; };
template <class TypeTag>
struct LoadFile<TypeTag, Properties::TTag::FlowProblem>
{ static constexpr auto* value = ""; };
template <class TypeTag>
struct LoadStep<TypeTag, Properties::TTag::FlowProblem>
{ static constexpr int value = -1; };
struct EnableAdaptiveTimeStepping { static constexpr bool value = true; };
struct OutputExtraConvergenceInfo { static constexpr auto* value = "none"; };
struct SaveStep { static constexpr auto* value = ""; };
struct SaveFile { static constexpr auto* value = ""; };
struct LoadFile { static constexpr auto* value = ""; };
struct LoadStep { static constexpr int value = -1; };
} // namespace Opm::Parameters
@ -161,19 +122,19 @@ public:
, serializer_(*this,
FlowGenericVanguard::comm(),
simulator_.vanguard().eclState().getIOConfig(),
Parameters::get<TypeTag, Parameters::SaveStep>(),
Parameters::get<TypeTag, Parameters::LoadStep>(),
Parameters::get<TypeTag, Parameters::SaveFile>(),
Parameters::get<TypeTag, Parameters::LoadFile>())
Parameters::Get<Parameters::SaveStep>(),
Parameters::Get<Parameters::LoadStep>(),
Parameters::Get<Parameters::SaveFile>(),
Parameters::Get<Parameters::LoadFile>())
{
phaseUsage_ = phaseUsageFromDeck(eclState());
// Only rank 0 does print to std::cout, and only if specifically requested.
this->terminalOutput_ = false;
if (this->grid().comm().rank() == 0) {
this->terminalOutput_ = Parameters::get<TypeTag, Parameters::EnableTerminalOutput>();
this->terminalOutput_ = Parameters::Get<Parameters::EnableTerminalOutput>();
this->startConvergenceOutputThread(Parameters::get<TypeTag, Parameters::OutputExtraConvergenceInfo>(),
this->startConvergenceOutputThread(Parameters::Get<Parameters::OutputExtraConvergenceInfo>(),
R"(OutputExtraConvergenceInfo (--output-extra-convergence-info))");
}
}
@ -190,11 +151,11 @@ public:
SolverParameters::registerParameters();
TimeStepper::registerParameters();
Parameters::registerParam<TypeTag, Parameters::EnableTerminalOutput>
Parameters::Register<Parameters::EnableTerminalOutput>
("Print high-level information about the simulation's progress to the terminal");
Parameters::registerParam<TypeTag, Parameters::EnableAdaptiveTimeStepping>
Parameters::Register<Parameters::EnableAdaptiveTimeStepping>
("Use adaptive time stepping between report steps");
Parameters::registerParam<TypeTag, Parameters::OutputExtraConvergenceInfo>
Parameters::Register<Parameters::OutputExtraConvergenceInfo>
("Provide additional convergence output "
"files for diagnostic purposes. "
"\"none\" gives no extra output and "
@ -203,25 +164,25 @@ public:
"\"iterations\" generates an INFOITER file. "
"Combine options with commas, e.g., "
"\"steps,iterations\" for multiple outputs.");
Parameters::registerParam<TypeTag, Parameters::SaveStep>
Parameters::Register<Parameters::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."
"Use negative values of \"x\" to keep only the last "
"written step, or \"last\" to save every step, keeping "
"only the last.");
Parameters::registerParam<TypeTag, Parameters::LoadStep>
Parameters::Register<Parameters::LoadStep>
("Load serialized state from .OPMRST file. "
"Either a specific report step, or 0 to load last "
"stored report step.");
Parameters::registerParam<TypeTag, Parameters::SaveFile>
Parameters::Register<Parameters::SaveFile>
("FileName for .OPMRST file used for saving serialized state. "
"If empty, CASENAME.OPMRST is used.");
Parameters::hideParam<TypeTag, Parameters::SaveFile>();
Parameters::registerParam<TypeTag, Parameters::LoadFile>
Parameters::Hide<Parameters::SaveFile>();
Parameters::Register<Parameters::LoadFile>
("FileName for .OPMRST file used to load serialized state. "
"If empty, CASENAME.OPMRST is used.");
Parameters::hideParam<TypeTag, Parameters::LoadFile>();
Parameters::Hide<Parameters::LoadFile>();
}
/// Run the simulation.
@ -253,8 +214,8 @@ public:
totalTimer_->start();
// adaptive time stepping
bool enableAdaptive = Parameters::get<TypeTag, Parameters::EnableAdaptiveTimeStepping>();
bool enableTUNING = Parameters::get<TypeTag, Parameters::EnableTuning>();
bool enableAdaptive = Parameters::Get<Parameters::EnableAdaptiveTimeStepping>();
bool enableTUNING = Parameters::Get<Parameters::EnableTuning>();
if (enableAdaptive) {
const UnitSystem& unitSystem = this->simulator_.vanguard().eclState().getUnits();
const auto& sched_state = schedule()[timer.currentStepNum()];
@ -344,7 +305,7 @@ public:
this->solver_->model().beginReportStep();
const bool enableTUNING = Parameters::get<TypeTag, Parameters::EnableTuning>();
const bool enableTUNING = Parameters::Get<Parameters::EnableTuning>();
// If sub stepping is enabled allow the solver to sub cycle
// in case the report steps are too large for the solver to converge

View File

@ -39,23 +39,10 @@
#include <string>
#include <vector>
namespace Opm::Properties::TTag {
// create new type tag for the VTK tracer output
struct VtkTracer {};
}
namespace Opm::Parameters {
// create the property tags needed for the tracer model
template<class TypeTag, class MyTypeTag>
struct VtkWriteTracerConcentration { using type = Properties::UndefinedProperty; };
// set default values for what quantities to output
template<class TypeTag>
struct VtkWriteTracerConcentration<TypeTag, Properties::TTag::VtkTracer>
{ static constexpr bool value = false; };
struct VtkWriteTracerConcentration { static constexpr bool value = false; };
} // namespace Opm::Parameters
@ -95,7 +82,7 @@ namespace Opm {
*/
static void registerParameters()
{
Parameters::registerParam<TypeTag, Parameters::VtkWriteTracerConcentration>
Parameters::Register<Parameters::VtkWriteTracerConcentration>
("Include the tracer concentration in the VTK output files");
}
@ -178,7 +165,7 @@ namespace Opm {
private:
static bool eclTracerConcentrationOutput_()
{
static bool val = Parameters::get<TypeTag, Parameters::VtkWriteTracerConcentration>();
static bool val = Parameters::Get<Parameters::VtkWriteTracerConcentration>();
return val;
}

View File

@ -63,154 +63,26 @@ struct LinearSolverBackend<TypeTag, TTag::FlowIstlSolverParams>
namespace Opm::Parameters {
template<class TypeTag, class MyTypeTag>
struct LinearSolverReduction { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct RelaxedLinearSolverReduction { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct LinearSolverMaxIter { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct LinearSolverRestart { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct IluRelaxation { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct IluFillinLevel { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct MiluVariant { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct IluRedblack { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct IluReorderSpheres { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct UseGmres { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct LinearSolverIgnoreConvergenceFailure { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct ScaleLinearSystem { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct LinearSolver { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct LinearSolverPrintJsonDefinition { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct CprReuseSetup { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct CprReuseInterval { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct AcceleratorMode { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct BdaDeviceId { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct OpenclPlatformId { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct OpenclIluParallel { using type = Properties::UndefinedProperty; };
template<class TypeTag>
struct LinearSolverReduction<TypeTag, Properties::TTag::FlowIstlSolverParams>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1e-2;
};
template<class TypeTag>
struct RelaxedLinearSolverReduction<TypeTag, Properties::TTag::FlowIstlSolverParams>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1e-2;
};
template<class TypeTag>
struct LinearSolverMaxIter<TypeTag, Properties::TTag::FlowIstlSolverParams>
{ static constexpr int value = 200; };
template<class TypeTag>
struct LinearSolverRestart<TypeTag, Properties::TTag::FlowIstlSolverParams>
{ static constexpr int value = 40; };
template<class TypeTag>
struct IluRelaxation<TypeTag, Properties::TTag::FlowIstlSolverParams>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 0.9;
};
template<class TypeTag>
struct IluFillinLevel<TypeTag, Properties::TTag::FlowIstlSolverParams>
{ static constexpr int value = 0; };
template<class TypeTag>
struct MiluVariant<TypeTag, Properties::TTag::FlowIstlSolverParams>
{ static constexpr auto value = "ILU"; };
template<class TypeTag>
struct IluRedblack<TypeTag, Properties::TTag::FlowIstlSolverParams>
{ static constexpr bool value = false; };
template<class TypeTag>
struct IluReorderSpheres<TypeTag, Properties::TTag::FlowIstlSolverParams>
{ static constexpr bool value = false; };
template<class TypeTag>
struct UseGmres<TypeTag, Properties::TTag::FlowIstlSolverParams>
{ static constexpr bool value = false; };
template<class TypeTag>
struct LinearSolverIgnoreConvergenceFailure<TypeTag, Properties::TTag::FlowIstlSolverParams>
{ static constexpr bool value = false; };
template<class TypeTag>
struct ScaleLinearSystem<TypeTag, Properties::TTag::FlowIstlSolverParams>
{ static constexpr bool value = false; };
template<class TypeTag>
struct LinearSolver<TypeTag, Properties::TTag::FlowIstlSolverParams>
{ static constexpr auto value = "cprw"; };
template<class TypeTag>
struct LinearSolverPrintJsonDefinition<TypeTag, Properties::TTag::FlowIstlSolverParams>
{ static constexpr auto value = true; };
template<class TypeTag>
struct CprReuseSetup<TypeTag, Properties::TTag::FlowIstlSolverParams>
{ static constexpr int value = 4; };
template<class TypeTag>
struct CprReuseInterval<TypeTag, Properties::TTag::FlowIstlSolverParams>
{ static constexpr int value = 30; };
template<class TypeTag>
struct AcceleratorMode<TypeTag, Properties::TTag::FlowIstlSolverParams>
{ static constexpr auto value = "none"; };
template<class TypeTag>
struct BdaDeviceId<TypeTag, Properties::TTag::FlowIstlSolverParams>
{ static constexpr int value = 0; };
template<class TypeTag>
struct OpenclPlatformId<TypeTag, Properties::TTag::FlowIstlSolverParams>
{ static constexpr int value = 0; };
template<class TypeTag>
struct OpenclIluParallel<TypeTag, Properties::TTag::FlowIstlSolverParams>
{ static constexpr bool value = true; }; // note: false should only be used in debug
struct LinearSolverReduction { static constexpr double value = 1e-2; };
struct RelaxedLinearSolverReduction { static constexpr double value = 1e-2; };
struct IluRelaxation { static constexpr double value = 0.9; };
struct LinearSolverMaxIter { static constexpr int value = 200; };
struct LinearSolverRestart { static constexpr int value = 40; };
struct IluFillinLevel { static constexpr int value = 0; };
struct MiluVariant { static constexpr auto value = "ILU"; };
struct IluRedblack { static constexpr bool value = false; };
struct IluReorderSpheres { static constexpr bool value = false; };
struct UseGmres { static constexpr bool value = false; };
struct LinearSolverIgnoreConvergenceFailure { static constexpr bool value = false; };
struct ScaleLinearSystem { static constexpr bool value = false; };
struct LinearSolver { static constexpr auto value = "cprw"; };
struct LinearSolverPrintJsonDefinition { static constexpr auto value = true; };
struct CprReuseSetup { static constexpr int value = 4; };
struct CprReuseInterval { static constexpr int value = 30; };
struct AcceleratorMode { static constexpr auto value = "none"; };
struct BdaDeviceId { static constexpr int value = 0; };
struct OpenclPlatformId { static constexpr int value = 0; };
struct OpenclIluParallel { static constexpr bool value = true; }; // note: false should only be used in debug
} // namespace Opm::Parameters
@ -241,109 +113,107 @@ struct FlowLinearSolverParameters
int opencl_platform_id_;
bool opencl_ilu_parallel_;
template <class TypeTag>
void init(bool cprRequestedInDataFile)
{
// TODO: these parameters have undocumented non-trivial dependencies
linear_solver_reduction_ = Parameters::get<TypeTag, Parameters::LinearSolverReduction>();
relaxed_linear_solver_reduction_ = Parameters::get<TypeTag, Parameters::RelaxedLinearSolverReduction>();
linear_solver_maxiter_ = Parameters::get<TypeTag, Parameters::LinearSolverMaxIter>();
linear_solver_restart_ = Parameters::get<TypeTag, Parameters::LinearSolverRestart>();
linear_solver_reduction_ = Parameters::Get<Parameters::LinearSolverReduction>();
relaxed_linear_solver_reduction_ = Parameters::Get<Parameters::RelaxedLinearSolverReduction>();
linear_solver_maxiter_ = Parameters::Get<Parameters::LinearSolverMaxIter>();
linear_solver_restart_ = Parameters::Get<Parameters::LinearSolverRestart>();
linear_solver_verbosity_ = Parameters::Get<Parameters::LinearSolverVerbosity>();
ilu_relaxation_ = Parameters::get<TypeTag, Parameters::IluRelaxation>();
ilu_fillin_level_ = Parameters::get<TypeTag, Parameters::IluFillinLevel>();
ilu_milu_ = convertString2Milu(Parameters::get<TypeTag, Parameters::MiluVariant>());
ilu_redblack_ = Parameters::get<TypeTag, Parameters::IluRedblack>();
ilu_reorder_sphere_ = Parameters::get<TypeTag, Parameters::IluReorderSpheres>();
newton_use_gmres_ = Parameters::get<TypeTag, Parameters::UseGmres>();
ignoreConvergenceFailure_ = Parameters::get<TypeTag, Parameters::LinearSolverIgnoreConvergenceFailure>();
scale_linear_system_ = Parameters::get<TypeTag, Parameters::ScaleLinearSystem>();
linsolver_ = Parameters::get<TypeTag, Parameters::LinearSolver>();
linear_solver_print_json_definition_ = Parameters::get<TypeTag, Parameters::LinearSolverPrintJsonDefinition>();
cpr_reuse_setup_ = Parameters::get<TypeTag, Parameters::CprReuseSetup>();
cpr_reuse_interval_ = Parameters::get<TypeTag, Parameters::CprReuseInterval>();
ilu_relaxation_ = Parameters::Get<Parameters::IluRelaxation>();
ilu_fillin_level_ = Parameters::Get<Parameters::IluFillinLevel>();
ilu_milu_ = convertString2Milu(Parameters::Get<Parameters::MiluVariant>());
ilu_redblack_ = Parameters::Get<Parameters::IluRedblack>();
ilu_reorder_sphere_ = Parameters::Get<Parameters::IluReorderSpheres>();
newton_use_gmres_ = Parameters::Get<Parameters::UseGmres>();
ignoreConvergenceFailure_ = Parameters::Get<Parameters::LinearSolverIgnoreConvergenceFailure>();
scale_linear_system_ = Parameters::Get<Parameters::ScaleLinearSystem>();
linsolver_ = Parameters::Get<Parameters::LinearSolver>();
linear_solver_print_json_definition_ = Parameters::Get<Parameters::LinearSolverPrintJsonDefinition>();
cpr_reuse_setup_ = Parameters::Get<Parameters::CprReuseSetup>();
cpr_reuse_interval_ = Parameters::Get<Parameters::CprReuseInterval>();
if (!Parameters::isSet<TypeTag, Parameters::LinearSolver>() && cprRequestedInDataFile) {
if (!Parameters::IsSet<Parameters::LinearSolver>() && cprRequestedInDataFile) {
linsolver_ = "cpr";
} else {
linsolver_ = Parameters::get<TypeTag, Parameters::LinearSolver>();
linsolver_ = Parameters::Get<Parameters::LinearSolver>();
}
accelerator_mode_ = Parameters::get<TypeTag, Parameters::AcceleratorMode>();
bda_device_id_ = Parameters::get<TypeTag, Parameters::BdaDeviceId>();
opencl_platform_id_ = Parameters::get<TypeTag, Parameters::OpenclPlatformId>();
opencl_ilu_parallel_ = Parameters::get<TypeTag, Parameters::OpenclIluParallel>();
accelerator_mode_ = Parameters::Get<Parameters::AcceleratorMode>();
bda_device_id_ = Parameters::Get<Parameters::BdaDeviceId>();
opencl_platform_id_ = Parameters::Get<Parameters::OpenclPlatformId>();
opencl_ilu_parallel_ = Parameters::Get<Parameters::OpenclIluParallel>();
}
template <class TypeTag>
static void registerParameters()
{
Parameters::registerParam<TypeTag, Parameters::LinearSolverReduction>
Parameters::Register<Parameters::LinearSolverReduction>
("The minimum reduction of the residual which the linear solver must achieve");
Parameters::registerParam<TypeTag, Parameters::RelaxedLinearSolverReduction>
Parameters::Register<Parameters::RelaxedLinearSolverReduction>
("The minimum reduction of the residual which the linear solver need to "
"achieve for the solution to be accepted");
Parameters::registerParam<TypeTag, Parameters::LinearSolverMaxIter>
Parameters::Register<Parameters::LinearSolverMaxIter>
("The maximum number of iterations of the linear solver");
Parameters::registerParam<TypeTag, Parameters::LinearSolverRestart>
Parameters::Register<Parameters::LinearSolverRestart>
("The number of iterations after which GMRES is restarted");
Parameters::Register<Parameters::LinearSolverVerbosity>
("The verbosity level of the linear solver (0: off, 2: all)");
Parameters::registerParam<TypeTag, Parameters::IluRelaxation>
Parameters::Register<Parameters::IluRelaxation>
("The relaxation factor of the linear solver's ILU preconditioner");
Parameters::registerParam<TypeTag, Parameters::IluFillinLevel>
Parameters::Register<Parameters::IluFillinLevel>
("The fill-in level of the linear solver's ILU preconditioner");
Parameters::registerParam<TypeTag, Parameters::MiluVariant>
Parameters::Register<Parameters::MiluVariant>
("Specify which variant of the modified-ILU preconditioner ought to be used. "
"Possible variants are: ILU (default, plain ILU), "
"MILU_1 (lump diagonal with dropped row entries), "
"MILU_2 (lump diagonal with the sum of the absolute values of the dropped row entries), "
"MILU_3 (if diagonal is positive add sum of dropped row entries, otherwise subtract them), "
"MILU_4 (if diagonal is positive add sum of dropped row entries, otherwise do nothing");
Parameters::registerParam<TypeTag, Parameters::IluRedblack>
Parameters::Register<Parameters::IluRedblack>
("Use red-black partitioning for the ILU preconditioner");
Parameters::registerParam<TypeTag, Parameters::IluReorderSpheres>
Parameters::Register<Parameters::IluReorderSpheres>
("Whether to reorder the entries of the matrix in the red-black "
"ILU preconditioner in spheres starting at an edge. "
"If false the original ordering is preserved in each color. "
"Otherwise why try to ensure D4 ordering (in a 2D structured grid, "
"the diagonal elements are consecutive).");
Parameters::registerParam<TypeTag, Parameters::UseGmres>
Parameters::Register<Parameters::UseGmres>
("Use GMRES as the linear solver");
Parameters::registerParam<TypeTag, Parameters::LinearSolverIgnoreConvergenceFailure>
Parameters::Register<Parameters::LinearSolverIgnoreConvergenceFailure>
("Continue with the simulation like nothing happened "
"after the linear solver did not converge");
Parameters::registerParam<TypeTag, Parameters::ScaleLinearSystem>
Parameters::Register<Parameters::ScaleLinearSystem>
("Scale linear system according to equation scale and primary variable types");
Parameters::registerParam<TypeTag, Parameters::LinearSolver>
Parameters::Register<Parameters::LinearSolver>
("Configuration of solver. Valid options are: ilu0 (default), "
"dilu, cprw, cpr (an alias for cprw), cpr_quasiimpes, "
"cpr_trueimpes, cpr_trueimpesanalytic, amg or hybrid (experimental). "
"Alternatively, you can request a configuration to be read from a "
"JSON file by giving the filename here, ending with '.json.'");
Parameters::registerParam<TypeTag, Parameters::LinearSolverPrintJsonDefinition>
Parameters::Register<Parameters::LinearSolverPrintJsonDefinition>
("Write the JSON definition of the linear solver setup to the DBG file.");
Parameters::registerParam<TypeTag, Parameters::CprReuseSetup>
Parameters::Register<Parameters::CprReuseSetup>
("Reuse preconditioner setup. Valid options are "
"0: recreate the preconditioner for every linear solve, "
"1: recreate once every timestep, "
"2: recreate if last linear solve took more than 10 iterations, "
"3: never recreate, "
"4: recreated every CprReuseInterval");
Parameters::registerParam<TypeTag, Parameters::CprReuseInterval>
Parameters::Register<Parameters::CprReuseInterval>
("Reuse preconditioner interval. Used when CprReuseSetup is set to 4, "
"then the preconditioner will be fully recreated instead of reused "
"every N linear solve, where N is this parameter.");
Parameters::registerParam<TypeTag, Parameters::AcceleratorMode>
Parameters::Register<Parameters::AcceleratorMode>
("Choose a linear solver, usage: "
"'--accelerator-mode=[none|cusparse|opencl|amgcl|rocalution|rocsparse]'");
Parameters::registerParam<TypeTag, Parameters::BdaDeviceId>
Parameters::Register<Parameters::BdaDeviceId>
("Choose device ID for cusparseSolver or openclSolver, "
"use 'nvidia-smi' or 'clinfo' to determine valid IDs");
Parameters::registerParam<TypeTag, Parameters::OpenclPlatformId>
Parameters::Register<Parameters::OpenclPlatformId>
("Choose platform ID for openclSolver, use 'clinfo' "
"to determine valid platform IDs");
Parameters::registerParam<TypeTag, Parameters::OpenclIluParallel>
Parameters::Register<Parameters::OpenclIluParallel>
("Parallelize ILU decomposition and application on GPU");
Parameters::SetDefault<Parameters::LinearSolverVerbosity>(0);

View File

@ -170,7 +170,7 @@ std::unique_ptr<Matrix> blockJacobiAdjacency(const Grid& grid,
static void registerParameters()
{
FlowLinearSolverParameters::registerParameters<TypeTag>();
FlowLinearSolverParameters::registerParameters();
}
/// Construct a system solver.
@ -203,7 +203,7 @@ std::unique_ptr<Matrix> blockJacobiAdjacency(const Grid& grid,
matrix_(nullptr)
{
parameters_.resize(1);
parameters_[0].template init<TypeTag>(simulator_.vanguard().eclState().getSimulationConfig().useCPR());
parameters_[0].init(simulator_.vanguard().eclState().getSimulationConfig().useCPR());
initialize();
}
@ -220,21 +220,21 @@ std::unique_ptr<Matrix> blockJacobiAdjacency(const Grid& grid,
parameters_.clear();
{
FlowLinearSolverParameters para;
para.init<TypeTag>(false);
para.init(false);
para.linsolver_ = "cprw";
parameters_.push_back(para);
prm_.push_back(setupPropertyTree(parameters_[0],
Parameters::isSet<TypeTag, Parameters::LinearSolverMaxIter>(),
Parameters::isSet<TypeTag, Parameters::LinearSolverReduction>()));
Parameters::IsSet<Parameters::LinearSolverMaxIter>(),
Parameters::IsSet<Parameters::LinearSolverReduction>()));
}
{
FlowLinearSolverParameters para;
para.init<TypeTag>(false);
para.init(false);
para.linsolver_ = "ilu0";
parameters_.push_back(para);
prm_.push_back(setupPropertyTree(parameters_[1],
Parameters::isSet<TypeTag, Parameters::LinearSolverMaxIter>(),
Parameters::isSet<TypeTag, Parameters::LinearSolverReduction>()));
Parameters::IsSet<Parameters::LinearSolverMaxIter>(),
Parameters::IsSet<Parameters::LinearSolverReduction>()));
}
// ------------
} else {
@ -242,8 +242,8 @@ std::unique_ptr<Matrix> blockJacobiAdjacency(const Grid& grid,
assert(parameters_.size() == 1);
assert(prm_.empty());
prm_.push_back(setupPropertyTree(parameters_[0],
Parameters::isSet<TypeTag, Parameters::LinearSolverMaxIter>(),
Parameters::isSet<TypeTag, Parameters::LinearSolverReduction>()));
Parameters::IsSet<Parameters::LinearSolverMaxIter>(),
Parameters::IsSet<Parameters::LinearSolverReduction>()));
}
flexibleSolver_.resize(prm_.size());
@ -258,8 +258,8 @@ std::unique_ptr<Matrix> blockJacobiAdjacency(const Grid& grid,
// Set it up manually
ElementMapper elemMapper(simulator_.vanguard().gridView(), Dune::mcmgElementLayout());
detail::findOverlapAndInterior(simulator_.vanguard().grid(), elemMapper, overlapRows_, interiorRows_);
useWellConn_ = Parameters::get<TypeTag, Parameters::MatrixAddWellContributions>();
const bool ownersFirst = Parameters::get<TypeTag, Parameters::OwnerCellsFirst>();
useWellConn_ = Parameters::Get<Parameters::MatrixAddWellContributions>();
const bool ownersFirst = Parameters::Get<Parameters::OwnerCellsFirst>();
if (!ownersFirst) {
const std::string msg = "The linear solver no longer supports --owner-cells-first=false.";
if (on_io_rank) {
@ -324,7 +324,7 @@ std::unique_ptr<Matrix> blockJacobiAdjacency(const Grid& grid,
// Outch! We need to be able to scale the linear system! Hence const_cast
matrix_ = const_cast<Matrix*>(&M);
useWellConn_ = Parameters::get<TypeTag, Parameters::MatrixAddWellContributions>();
useWellConn_ = Parameters::Get<Parameters::MatrixAddWellContributions>();
// setup sparsity pattern for jacobi matrix for preconditioner (only used for openclSolver)
} else {
// Pointers should not change

View File

@ -152,7 +152,7 @@ public:
{
OPM_TIMEBLOCK(initializeBda);
std::string accelerator_mode = Parameters::get<TypeTag, Parameters::AcceleratorMode>();
std::string accelerator_mode = Parameters::Get<Parameters::AcceleratorMode>();
// Force accelerator mode to none if using MPI.
if ((this->simulator_.vanguard().grid().comm().size() > 1) && (accelerator_mode != "none")) {
const bool on_io_rank = (this->simulator_.gridView().comm().rank() == 0);
@ -167,13 +167,13 @@ public:
}
// Initialize the BdaBridge
const int platformID = Parameters::get<TypeTag, Parameters::OpenclPlatformId>();
const int deviceID = Parameters::get<TypeTag, Parameters::BdaDeviceId>();
const int maxit = Parameters::get<TypeTag, Parameters::LinearSolverMaxIter>();
const double tolerance = Parameters::get<TypeTag, Parameters::LinearSolverReduction>();
const bool opencl_ilu_parallel = Parameters::get<TypeTag, Parameters::OpenclIluParallel>();
const int platformID = Parameters::Get<Parameters::OpenclPlatformId>();
const int deviceID = Parameters::Get<Parameters::BdaDeviceId>();
const int maxit = Parameters::Get<Parameters::LinearSolverMaxIter>();
const double tolerance = Parameters::Get<Parameters::LinearSolverReduction>();
const bool opencl_ilu_parallel = Parameters::Get<Parameters::OpenclIluParallel>();
const int linear_solver_verbosity = this->parameters_[0].linear_solver_verbosity_;
std::string linsolver = Parameters::get<TypeTag, Parameters::LinearSolver>();
std::string linsolver = Parameters::Get<Parameters::LinearSolver>();
bdaBridge_ = std::make_unique<detail::BdaSolverInfo<Matrix,Vector>>(accelerator_mode,
linear_solver_verbosity,
maxit,
@ -204,7 +204,7 @@ public:
// to the original one with a deleter that does nothing.
// Outch! We need to be able to scale the linear system! Hence const_cast
// setup sparsity pattern for jacobi matrix for preconditioner (only used for openclSolver)
bdaBridge_->numJacobiBlocks_ = Parameters::get<TypeTag, Parameters::NumJacobiBlocks>();
bdaBridge_->numJacobiBlocks_ = Parameters::Get<Parameters::NumJacobiBlocks>();
bdaBridge_->prepare(this->simulator_.vanguard().grid(),
this->simulator_.vanguard().cartesianIndexMapper(),
this->simulator_.vanguard().schedule().getWellsatEnd(),

View File

@ -47,158 +47,25 @@
#include <string>
#include <vector>
namespace Opm::Properties::TTag {
struct FlowTimeSteppingParameters {
using InheritsFrom = std::tuple<EclTimeSteppingParameters>;
};
}
namespace Opm::Parameters {
template<class TypeTag, class MyTypeTag>
struct SolverContinueOnConvergenceFailure { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct SolverMaxRestarts { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct SolverVerbosity { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct TimeStepVerbosity { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct InitialTimeStepInDays { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct FullTimeStepInitially { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct TimeStepControl { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct TimeStepControlTolerance { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct TimeStepControlTargetIterations { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct TimeStepControlTargetNewtonIterations { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct TimeStepControlDecayRate { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct TimeStepControlGrowthRate { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct TimeStepControlDecayDampingFactor { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct TimeStepControlGrowthDampingFactor { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct TimeStepControlFileName { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct MinTimeStepBeforeShuttingProblematicWellsInDays { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct MinTimeStepBasedOnNewtonIterations { using type = Properties::UndefinedProperty; };
template<class TypeTag>
struct SolverContinueOnConvergenceFailure<TypeTag, Properties::TTag::FlowTimeSteppingParameters>
{ static constexpr bool value = false; };
template<class TypeTag>
struct SolverMaxRestarts<TypeTag, Properties::TTag::FlowTimeSteppingParameters>
{ static constexpr int value = 10; };
template<class TypeTag>
struct SolverVerbosity<TypeTag, Properties::TTag::FlowTimeSteppingParameters>
{ static constexpr int value = 1; };
template<class TypeTag>
struct TimeStepVerbosity<TypeTag, Properties::TTag::FlowTimeSteppingParameters>
{ static constexpr int value = 1; };
template<class TypeTag>
struct InitialTimeStepInDays<TypeTag, Properties::TTag::FlowTimeSteppingParameters>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1.0;
};
template<class TypeTag>
struct FullTimeStepInitially<TypeTag, Properties::TTag::FlowTimeSteppingParameters>
{ static constexpr bool value = false; };
template<class TypeTag>
struct TimeStepControl<TypeTag, Properties::TTag::FlowTimeSteppingParameters>
{ static constexpr auto value = "pid+newtoniteration"; };
template<class TypeTag>
struct TimeStepControlTolerance<TypeTag, Properties::TTag::FlowTimeSteppingParameters>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1e-1;
};
template<class TypeTag>
struct TimeStepControlTargetIterations<TypeTag, Properties::TTag::FlowTimeSteppingParameters>
{ static constexpr int value = 30; };
template<class TypeTag>
struct TimeStepControlTargetNewtonIterations<TypeTag, Properties::TTag::FlowTimeSteppingParameters>
{ static constexpr int value = 8; };
template<class TypeTag>
struct TimeStepControlDecayRate<TypeTag, Properties::TTag::FlowTimeSteppingParameters>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 0.75;
};
template<class TypeTag>
struct TimeStepControlGrowthRate<TypeTag, Properties::TTag::FlowTimeSteppingParameters>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1.25;
};
template<class TypeTag>
struct TimeStepControlDecayDampingFactor<TypeTag, Properties::TTag::FlowTimeSteppingParameters>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1.0;
};
template<class TypeTag>
struct TimeStepControlGrowthDampingFactor<TypeTag, Properties::TTag::FlowTimeSteppingParameters>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 3.2;
};
template<class TypeTag>
struct TimeStepControlFileName<TypeTag, Properties::TTag::FlowTimeSteppingParameters>
{ static constexpr auto value = "timesteps"; };
template<class TypeTag>
struct MinTimeStepBeforeShuttingProblematicWellsInDays<TypeTag, Properties::TTag::FlowTimeSteppingParameters>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 0.01;
};
template<class TypeTag>
struct MinTimeStepBasedOnNewtonIterations<TypeTag, Properties::TTag::FlowTimeSteppingParameters>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 0.0;
};
struct SolverContinueOnConvergenceFailure { static constexpr bool value = false; };
struct SolverMaxRestarts { static constexpr int value = 10; };
struct SolverVerbosity { static constexpr int value = 1; };
struct TimeStepVerbosity { static constexpr int value = 1; };
struct InitialTimeStepInDays { static constexpr double value = 1.0; };
struct FullTimeStepInitially { static constexpr bool value = false; };
struct TimeStepControl { static constexpr auto value = "pid+newtoniteration"; };
struct TimeStepControlTolerance { static constexpr double value = 1e-1; };
struct TimeStepControlTargetIterations { static constexpr int value = 30; };
struct TimeStepControlTargetNewtonIterations { static constexpr int value = 8; };
struct TimeStepControlDecayRate { static constexpr double value = 0.75; };
struct TimeStepControlGrowthRate { static constexpr double value = 1.25; };
struct TimeStepControlDecayDampingFactor { static constexpr double value = 1.0; };
struct TimeStepControlGrowthDampingFactor { static constexpr double value = 3.2; };
struct TimeStepControlFileName { static constexpr auto value = "timesteps"; };
struct MinTimeStepBeforeShuttingProblematicWellsInDays { static constexpr double value = 0.01; };
struct MinTimeStepBasedOnNewtonIterations { static constexpr double value = 0.0; };
} // namespace Opm::Parameters
@ -219,6 +86,7 @@ std::set<std::string> consistentlyFailingWells(const std::vector<StepReport>& sr
template<class TypeTag>
class AdaptiveTimeStepping
{
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
template <class Solver>
class SolutionTimeErrorSolverWrapper : public RelativeChangeInterface
{
@ -252,20 +120,20 @@ std::set<std::string> consistentlyFailingWells(const std::vector<StepReport>& sr
const double max_next_tstep = -1.0,
const bool terminalOutput = true)
: timeStepControl_()
, restartFactor_(Parameters::get<TypeTag, Parameters::SolverRestartFactor>()) // 0.33
, growthFactor_(Parameters::get<TypeTag, Parameters::SolverGrowthFactor>()) // 2.0
, maxGrowth_(Parameters::get<TypeTag, Parameters::SolverMaxGrowth>()) // 3.0
, maxTimeStep_(Parameters::get<TypeTag, Parameters::SolverMaxTimeStepInDays>() * 24 * 60 * 60) // 365.25
, minTimeStep_(unitSystem.to_si(UnitSystem::measure::time, Parameters::get<TypeTag, Parameters::SolverMinTimeStep>())) // 1e-12;
, ignoreConvergenceFailure_(Parameters::get<TypeTag, Parameters::SolverContinueOnConvergenceFailure>()) // false;
, solverRestartMax_(Parameters::get<TypeTag, Parameters::SolverMaxRestarts>()) // 10
, solverVerbose_(Parameters::get<TypeTag, Parameters::SolverVerbosity>() > 0 && terminalOutput) // 2
, timestepVerbose_(Parameters::get<TypeTag, Parameters::TimeStepVerbosity>() > 0 && terminalOutput) // 2
, suggestedNextTimestep_((max_next_tstep <= 0 ? Parameters::get<TypeTag, Parameters::InitialTimeStepInDays>() : max_next_tstep) * 24 * 60 * 60) // 1.0
, fullTimestepInitially_(Parameters::get<TypeTag, Parameters::FullTimeStepInitially>()) // false
, timestepAfterEvent_(Parameters::get<TypeTag, Parameters::TimeStepAfterEventInDays>() * 24 * 60 * 60) // 1e30
, restartFactor_(Parameters::Get<Parameters::SolverRestartFactor<Scalar>>()) // 0.33
, growthFactor_(Parameters::Get<Parameters::SolverGrowthFactor<Scalar>>()) // 2.0
, maxGrowth_(Parameters::Get<Parameters::SolverMaxGrowth<Scalar>>()) // 3.0
, maxTimeStep_(Parameters::Get<Parameters::SolverMaxTimeStepInDays<Scalar>>() * 24 * 60 * 60) // 365.25
, minTimeStep_(unitSystem.to_si(UnitSystem::measure::time, Parameters::Get<Parameters::SolverMinTimeStep<Scalar>>())) // 1e-12;
, ignoreConvergenceFailure_(Parameters::Get<Parameters::SolverContinueOnConvergenceFailure>()) // false;
, solverRestartMax_(Parameters::Get<Parameters::SolverMaxRestarts>()) // 10
, solverVerbose_(Parameters::Get<Parameters::SolverVerbosity>() > 0 && terminalOutput) // 2
, timestepVerbose_(Parameters::Get<Parameters::TimeStepVerbosity>() > 0 && terminalOutput) // 2
, suggestedNextTimestep_((max_next_tstep <= 0 ? Parameters::Get<Parameters::InitialTimeStepInDays>() : max_next_tstep) * 24 * 60 * 60) // 1.0
, fullTimestepInitially_(Parameters::Get<Parameters::FullTimeStepInitially>()) // false
, timestepAfterEvent_(Parameters::Get<Parameters::TimeStepAfterEventInDays<Scalar>>() * 24 * 60 * 60) // 1e30
, useNewtonIteration_(false)
, minTimeStepBeforeShuttingProblematicWells_(Parameters::get<TypeTag, Parameters::MinTimeStepBeforeShuttingProblematicWellsInDays>() * unit::day)
, minTimeStepBeforeShuttingProblematicWells_(Parameters::Get<Parameters::MinTimeStepBeforeShuttingProblematicWellsInDays>() * unit::day)
{
init_(unitSystem);
@ -287,36 +155,36 @@ std::set<std::string> consistentlyFailingWells(const std::vector<StepReport>& sr
, maxTimeStep_(tuning.TSMAXZ) // 365.25
, minTimeStep_(tuning.TSFMIN) // 0.1;
, ignoreConvergenceFailure_(true)
, solverRestartMax_(Parameters::get<TypeTag, Parameters::SolverMaxRestarts>()) // 10
, solverVerbose_(Parameters::get<TypeTag, Parameters::SolverVerbosity>() > 0 && terminalOutput) // 2
, timestepVerbose_(Parameters::get<TypeTag, Parameters::TimeStepVerbosity>() > 0 && terminalOutput) // 2
, suggestedNextTimestep_(max_next_tstep <= 0 ? Parameters::get<TypeTag, Parameters::InitialTimeStepInDays>() * 24 * 60 * 60 : max_next_tstep) // 1.0
, fullTimestepInitially_(Parameters::get<TypeTag, Parameters::FullTimeStepInitially>()) // false
, solverRestartMax_(Parameters::Get<Parameters::SolverMaxRestarts>()) // 10
, solverVerbose_(Parameters::Get<Parameters::SolverVerbosity>() > 0 && terminalOutput) // 2
, timestepVerbose_(Parameters::Get<Parameters::TimeStepVerbosity>() > 0 && terminalOutput) // 2
, suggestedNextTimestep_(max_next_tstep <= 0 ? Parameters::Get<Parameters::InitialTimeStepInDays>() * 24 * 60 * 60 : max_next_tstep) // 1.0
, fullTimestepInitially_(Parameters::Get<Parameters::FullTimeStepInitially>()) // false
, timestepAfterEvent_(tuning.TMAXWC) // 1e30
, useNewtonIteration_(false)
, minTimeStepBeforeShuttingProblematicWells_(Parameters::get<TypeTag, Parameters::MinTimeStepBeforeShuttingProblematicWellsInDays>() * unit::day)
, minTimeStepBeforeShuttingProblematicWells_(Parameters::Get<Parameters::MinTimeStepBeforeShuttingProblematicWellsInDays>() * unit::day)
{
init_(unitSystem);
}
static void registerParameters()
{
registerEclTimeSteppingParameters<TypeTag>();
registerEclTimeSteppingParameters<Scalar>();
// TODO: make sure the help messages are correct (and useful)
Parameters::registerParam<TypeTag, Parameters::SolverContinueOnConvergenceFailure>
Parameters::Register<Parameters::SolverContinueOnConvergenceFailure>
("Continue instead of stop when minimum solver time step is reached");
Parameters::registerParam<TypeTag, Parameters::SolverMaxRestarts>
Parameters::Register<Parameters::SolverMaxRestarts>
("The maximum number of breakdowns before a substep is given up and "
"the simulator is terminated");
Parameters::registerParam<TypeTag, Parameters::SolverVerbosity>
Parameters::Register<Parameters::SolverVerbosity>
("Specify the \"chattiness\" of the non-linear solver itself");
Parameters::registerParam<TypeTag, Parameters::TimeStepVerbosity>
Parameters::Register<Parameters::TimeStepVerbosity>
("Specify the \"chattiness\" during the time integration");
Parameters::registerParam<TypeTag, Parameters::InitialTimeStepInDays>
Parameters::Register<Parameters::InitialTimeStepInDays>
("The size of the initial time step in days");
Parameters::registerParam<TypeTag, Parameters::FullTimeStepInitially>
Parameters::Register<Parameters::FullTimeStepInitially>
("Always attempt to finish a report step using a single substep");
Parameters::registerParam<TypeTag, Parameters::TimeStepControl>
Parameters::Register<Parameters::TimeStepControl>
("The algorithm used to determine time-step sizes. "
"Valid options are: "
"'pid' (default), "
@ -325,31 +193,31 @@ std::set<std::string> consistentlyFailingWells(const std::vector<StepReport>& sr
"'iterationcount', "
"'newtoniterationcount' "
"and 'hardcoded'");
Parameters::registerParam<TypeTag, Parameters::TimeStepControlTolerance>
Parameters::Register<Parameters::TimeStepControlTolerance>
("The tolerance used by the time step size control algorithm");
Parameters::registerParam<TypeTag, Parameters::TimeStepControlTargetIterations>
Parameters::Register<Parameters::TimeStepControlTargetIterations>
("The number of linear iterations which the time step control scheme "
"should aim for (if applicable)");
Parameters::registerParam<TypeTag, Parameters::TimeStepControlTargetNewtonIterations>
Parameters::Register<Parameters::TimeStepControlTargetNewtonIterations>
("The number of Newton iterations which the time step control scheme "
"should aim for (if applicable)");
Parameters::registerParam<TypeTag, Parameters::TimeStepControlDecayRate>
Parameters::Register<Parameters::TimeStepControlDecayRate>
("The decay rate of the time step size of the number of "
"target iterations is exceeded");
Parameters::registerParam<TypeTag, Parameters::TimeStepControlGrowthRate>
Parameters::Register<Parameters::TimeStepControlGrowthRate>
("The growth rate of the time step size of the number of "
"target iterations is undercut");
Parameters::registerParam<TypeTag, Parameters::TimeStepControlDecayDampingFactor>
Parameters::Register<Parameters::TimeStepControlDecayDampingFactor>
("The decay rate of the time step decrease when the "
"target iterations is exceeded");
Parameters::registerParam<TypeTag, Parameters::TimeStepControlGrowthDampingFactor>
Parameters::Register<Parameters::TimeStepControlGrowthDampingFactor>
("The growth rate of the time step increase when the "
"target iterations is undercut");
Parameters::registerParam<TypeTag, Parameters::TimeStepControlFileName>
Parameters::Register<Parameters::TimeStepControlFileName>
("The name of the file which contains the hardcoded time steps sizes");
Parameters::registerParam<TypeTag, Parameters::MinTimeStepBeforeShuttingProblematicWellsInDays>
Parameters::Register<Parameters::MinTimeStepBeforeShuttingProblematicWellsInDays>
("The minimum time step size in days for which problematic wells are not shut");
Parameters::registerParam<TypeTag, Parameters::MinTimeStepBasedOnNewtonIterations>
Parameters::Register<Parameters::MinTimeStepBasedOnNewtonIterations>
("The minimum time step size (in days for field and metric unit and hours for lab unit) "
"can be reduced to based on newton iteration counts");
}
@ -813,25 +681,25 @@ std::set<std::string> consistentlyFailingWells(const std::vector<StepReport>& sr
void init_(const UnitSystem& unitSystem)
{
// valid are "pid" and "pid+iteration"
std::string control = Parameters::get<TypeTag, Parameters::TimeStepControl>(); // "pid"
std::string control = Parameters::Get<Parameters::TimeStepControl>(); // "pid"
const double tol = Parameters::get<TypeTag, Parameters::TimeStepControlTolerance>(); // 1e-1
const double tol = Parameters::Get<Parameters::TimeStepControlTolerance>(); // 1e-1
if (control == "pid") {
timeStepControl_ = std::make_unique<PIDTimeStepControl>(tol);
timeStepControlType_ = TimeStepControlType::PID;
}
else if (control == "pid+iteration") {
const int iterations = Parameters::get<TypeTag, Parameters::TimeStepControlTargetIterations>(); // 30
const double decayDampingFactor = Parameters::get<TypeTag, Parameters::TimeStepControlDecayDampingFactor>(); // 1.0
const double growthDampingFactor = Parameters::get<TypeTag, Parameters::TimeStepControlGrowthDampingFactor>(); // 3.2
const int iterations = Parameters::Get<Parameters::TimeStepControlTargetIterations>(); // 30
const double decayDampingFactor = Parameters::Get<Parameters::TimeStepControlDecayDampingFactor>(); // 1.0
const double growthDampingFactor = Parameters::Get<Parameters::TimeStepControlGrowthDampingFactor>(); // 3.2
timeStepControl_ = std::make_unique<PIDAndIterationCountTimeStepControl>(iterations, decayDampingFactor, growthDampingFactor, tol);
timeStepControlType_ = TimeStepControlType::PIDAndIterationCount;
}
else if (control == "pid+newtoniteration") {
const int iterations = Parameters::get<TypeTag, Parameters::TimeStepControlTargetNewtonIterations>(); // 8
const double decayDampingFactor = Parameters::get<TypeTag, Parameters::TimeStepControlDecayDampingFactor>(); // 1.0
const double growthDampingFactor = Parameters::get<TypeTag, Parameters::TimeStepControlGrowthDampingFactor>(); // 3.2
const double nonDimensionalMinTimeStepIterations = Parameters::get<TypeTag, Parameters::MinTimeStepBasedOnNewtonIterations>(); // 0.0 by default
const int iterations = Parameters::Get<Parameters::TimeStepControlTargetNewtonIterations>(); // 8
const double decayDampingFactor = Parameters::Get<Parameters::TimeStepControlDecayDampingFactor>(); // 1.0
const double growthDampingFactor = Parameters::Get<Parameters::TimeStepControlGrowthDampingFactor>(); // 3.2
const double nonDimensionalMinTimeStepIterations = Parameters::Get<Parameters::MinTimeStepBasedOnNewtonIterations>(); // 0.0 by default
// the min time step can be reduced by the newton iteration numbers
double minTimeStepReducedByIterations = unitSystem.to_si(UnitSystem::measure::time, nonDimensionalMinTimeStepIterations);
timeStepControl_ = std::make_unique<PIDAndIterationCountTimeStepControl>(iterations, decayDampingFactor,
@ -840,22 +708,22 @@ std::set<std::string> consistentlyFailingWells(const std::vector<StepReport>& sr
useNewtonIteration_ = true;
}
else if (control == "iterationcount") {
const int iterations = Parameters::get<TypeTag, Parameters::TimeStepControlTargetIterations>(); // 30
const double decayrate = Parameters::get<TypeTag, Parameters::TimeStepControlDecayRate>(); // 0.75
const double growthrate = Parameters::get<TypeTag, Parameters::TimeStepControlGrowthRate>(); // 1.25
const int iterations = Parameters::Get<Parameters::TimeStepControlTargetIterations>(); // 30
const double decayrate = Parameters::Get<Parameters::TimeStepControlDecayRate>(); // 0.75
const double growthrate = Parameters::Get<Parameters::TimeStepControlGrowthRate>(); // 1.25
timeStepControl_ = std::make_unique<SimpleIterationCountTimeStepControl>(iterations, decayrate, growthrate);
timeStepControlType_ = TimeStepControlType::SimpleIterationCount;
}
else if (control == "newtoniterationcount") {
const int iterations = Parameters::get<TypeTag, Parameters::TimeStepControlTargetNewtonIterations>(); // 8
const double decayrate = Parameters::get<TypeTag, Parameters::TimeStepControlDecayRate>(); // 0.75
const double growthrate = Parameters::get<TypeTag, Parameters::TimeStepControlGrowthRate>(); // 1.25
const int iterations = Parameters::Get<Parameters::TimeStepControlTargetNewtonIterations>(); // 8
const double decayrate = Parameters::Get<Parameters::TimeStepControlDecayRate>(); // 0.75
const double growthrate = Parameters::Get<Parameters::TimeStepControlGrowthRate>(); // 1.25
timeStepControl_ = std::make_unique<SimpleIterationCountTimeStepControl>(iterations, decayrate, growthrate);
useNewtonIteration_ = true;
timeStepControlType_ = TimeStepControlType::SimpleIterationCount;
}
else if (control == "hardcoded") {
const std::string filename = Parameters::get<TypeTag, Parameters::TimeStepControlFileName>(); // "timesteps"
const std::string filename = Parameters::Get<Parameters::TimeStepControlFileName>(); // "timesteps"
timeStepControl_ = std::make_unique<HardcodedTimeStepControl>(filename);
timeStepControlType_ = TimeStepControlType::HardCodedTimeStep;
}

View File

@ -26,104 +26,49 @@
#include <opm/models/utils/basicproperties.hh>
#include <opm/models/utils/propertysystem.hh>
namespace Opm::Properties::TTag {
struct EclTimeSteppingParameters {};
}
namespace Opm::Parameters {
template<class TypeTag, class MyTypeTag>
struct EnableTuning { using type = Properties::UndefinedProperty; };
struct EnableTuning { static constexpr bool value = false; };
template<class Scalar>
struct SolverGrowthFactor { static constexpr Scalar value = 2.0; };
template<class TypeTag, class MyTypeTag>
struct SolverGrowthFactor { using type = Properties::UndefinedProperty; };
template<class Scalar>
struct SolverMaxGrowth { static constexpr Scalar value = 3.0; };
template<class TypeTag, class MyTypeTag>
struct SolverMaxGrowth { using type = Properties::UndefinedProperty; };
template<class Scalar>
struct SolverMinTimeStep { static constexpr Scalar value = 1e-12; };
template<class TypeTag, class MyTypeTag>
struct SolverMaxTimeStepInDays { using type = Properties::UndefinedProperty; };
template<class Scalar>
struct SolverMaxTimeStepInDays { static constexpr Scalar value = 365.0; };
template<class TypeTag, class MyTypeTag>
struct SolverMinTimeStep { using type = Properties::UndefinedProperty; };
template<class Scalar>
struct SolverRestartFactor { static constexpr Scalar value = 0.33; };
template<class TypeTag, class MyTypeTag>
struct SolverRestartFactor { using type = Properties::UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct TimeStepAfterEventInDays { using type = Properties::UndefinedProperty; };
template<class TypeTag>
struct EnableTuning<TypeTag, Properties::TTag::EclTimeSteppingParameters>
{ static constexpr bool value = false; };
template<class TypeTag>
struct SolverGrowthFactor<TypeTag, Properties::TTag::EclTimeSteppingParameters>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 2.0;
};
template<class TypeTag>
struct SolverMaxGrowth<TypeTag, Properties::TTag::EclTimeSteppingParameters>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 3.0;
};
template<class TypeTag>
struct SolverMinTimeStep<TypeTag, Properties::TTag::EclTimeSteppingParameters>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1.0e-12;
};
template<class TypeTag>
struct SolverMaxTimeStepInDays<TypeTag, Properties::TTag::EclTimeSteppingParameters>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 365.0;
};
template<class TypeTag>
struct SolverRestartFactor<TypeTag, Properties::TTag::EclTimeSteppingParameters>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 0.33;
};
template<class TypeTag>
struct TimeStepAfterEventInDays<TypeTag, Properties::TTag::EclTimeSteppingParameters>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = -1.0;
};
template<class Scalar>
struct TimeStepAfterEventInDays { static constexpr Scalar value = -1.0; };
} // namespace Opm::Properties
namespace Opm {
template<class TypeTag>
template<class Scalar>
void registerEclTimeSteppingParameters()
{
Parameters::registerParam<TypeTag, Parameters::EnableTuning>
Parameters::Register<Parameters::EnableTuning>
("Honor some aspects of the TUNING keyword.");
Parameters::registerParam<TypeTag, Parameters::SolverGrowthFactor>
Parameters::Register<Parameters::SolverGrowthFactor<Scalar>>
("The factor time steps are elongated after a successful substep");
Parameters::registerParam<TypeTag, Parameters::SolverMaxGrowth>
Parameters::Register<Parameters::SolverMaxGrowth<Scalar>>
("The maximum factor time steps are elongated after a report step");
Parameters::registerParam<TypeTag, Parameters::SolverMaxTimeStepInDays>
Parameters::Register<Parameters::SolverMaxTimeStepInDays<Scalar>>
("The maximum size of a time step in days");
Parameters::registerParam<TypeTag, Parameters::SolverMinTimeStep>
Parameters::Register<Parameters::SolverMinTimeStep<Scalar>>
("The minimum size of a time step in days for field and "
"metric and hours for lab. If a step cannot converge without "
"getting cut below this step size the simulator will stop");
Parameters::registerParam<TypeTag, Parameters::SolverRestartFactor>
Parameters::Register<Parameters::SolverRestartFactor<Scalar>>
("The factor time steps are elongated after restarts");
Parameters::registerParam<TypeTag, Parameters::TimeStepAfterEventInDays>
Parameters::Register<Parameters::TimeStepAfterEventInDays<Scalar>>
("Time step size of the first time step after an event "
"occurs during the simulation in days");
}

View File

@ -97,18 +97,18 @@ getDamarisKeywords(const Parallel::Communication& comm, const std::string& Outpu
// which is used in simulators/flow/Main.hpp)
// These command line arguments are defined in opm/simulators/flow/DamarisWriter.hpp and
// defaults are set in opm/simulators/flow/FlowProblemProperties.hpp
settings.enableDamarisOutputCollective_ = Parameters::get<TypeTag, Parameters::DamarisOutputHdfCollective>();
settings.saveMeshToHDF5_ = Parameters::get<TypeTag, Parameters::DamarisSaveMeshToHdf>();
settings.saveToDamarisHDF5_ = Parameters::get<TypeTag, Parameters::DamarisSaveToHdf>();
settings.pythonFilename_ = Parameters::get<TypeTag, Parameters::DamarisPythonScript>();
settings.paraviewPythonFilename_ = Parameters::get<TypeTag, Parameters::DamarisPythonParaviewScript>();
settings.damarisSimName_ = Parameters::get<TypeTag, Parameters::DamarisSimName>();
settings.nDamarisCores_ = Parameters::get<TypeTag, Parameters::DamarisDedicatedCores>();
settings.nDamarisNodes_ = Parameters::get<TypeTag, Parameters::DamarisDedicatedNodes>();
settings.shmemSizeBytes_ = Parameters::get<TypeTag, Parameters::DamarisSharedMemorySizeBytes>();
settings.shmemName_ = Parameters::get<TypeTag, Parameters::DamarisSharedMemoryName>();
settings.damarisLogLevel_ = Parameters::get<TypeTag, Parameters::DamarisLogLevel>();
settings.damarisDaskFile_ = Parameters::get<TypeTag, Parameters::DamarisDaskFile>();
settings.enableDamarisOutputCollective_ = Parameters::Get<Parameters::DamarisOutputHdfCollective>();
settings.saveMeshToHDF5_ = Parameters::Get<Parameters::DamarisSaveMeshToHdf>();
settings.saveToDamarisHDF5_ = Parameters::Get<Parameters::DamarisSaveToHdf>();
settings.pythonFilename_ = Parameters::Get<Parameters::DamarisPythonScript>();
settings.paraviewPythonFilename_ = Parameters::Get<Parameters::DamarisPythonParaviewScript>();
settings.damarisSimName_ = Parameters::Get<Parameters::DamarisSimName>();
settings.nDamarisCores_ = Parameters::Get<Parameters::DamarisDedicatedCores>();
settings.nDamarisNodes_ = Parameters::Get<Parameters::DamarisDedicatedNodes>();
settings.shmemSizeBytes_ = Parameters::Get<Parameters::DamarisSharedMemorySizeBytes>();
settings.shmemName_ = Parameters::Get<Parameters::DamarisSharedMemoryName>();
settings.damarisLogLevel_ = Parameters::Get<Parameters::DamarisLogLevel>();
settings.damarisDaskFile_ = Parameters::Get<Parameters::DamarisDaskFile>();
return settings.getKeywords(comm, OutputDir);
}
@ -120,7 +120,7 @@ getSetOfIncludedVariables(void)
std::unordered_set<std::string> resuset ;
std::string tstr;
// The --damaris-limit-variables command line option (defaults to empty string)
std::string damarisLimitVars = Parameters::get<TypeTag, Parameters::DamarisLimitVariables>();
std::string damarisLimitVars = Parameters::Get<Parameters::DamarisLimitVariables>();
std::stringstream ss(damarisLimitVars);
// Use while loop to check the getline() function condition.

View File

@ -80,8 +80,7 @@
namespace Opm::Parameters {
template<class TypeTag, class MyTypeTag>
struct EnableTerminalOutput { using type = Properties::UndefinedProperty; };
struct EnableTerminalOutput { static constexpr bool value = true; };
} // namespace Opm::Parameters

View File

@ -77,7 +77,7 @@ namespace Opm {
, simulator_(simulator)
{
this->terminal_output_ = ((simulator.gridView().comm().rank() == 0) &&
Parameters::get<TypeTag, Parameters::EnableTerminalOutput>());
Parameters::Get<Parameters::EnableTerminalOutput>());
local_num_cells_ = simulator_.gridView().size(0);
@ -94,7 +94,7 @@ namespace Opm {
}
this->alternative_well_rate_init_ =
Parameters::get<TypeTag, Parameters::AlternativeWellRateInit>();
Parameters::Get<Parameters::AlternativeWellRateInit>();
using SourceDataSpan =
typename PAvgDynamicSourceData<Scalar>::template SourceDataSpan<Scalar>;

View File

@ -39,9 +39,13 @@
namespace Opm::Properties {
namespace TTag {
struct TestTypeTag {
using InheritsFrom = std::tuple<FlowModelParameters, FlowBaseProblem, BlackOilModel, EclTimeSteppingParameters>;
struct TestTypeTag
{
using InheritsFrom = std::tuple<FlowBaseProblem,
BlackOilModel>;
};
}
// Set the problem class
@ -95,24 +99,4 @@ struct LinearSolverBackend<TTag::TestTypeTag, TTag::FlowIstlSolverParams> {
} // namespace Opm::Properties
namespace Opm::Parameters {
template<class TypeTag>
struct EnableTerminalOutput<TypeTag, Properties::TTag::TestTypeTag>
{ static constexpr bool value = false; };
// set some parameters that are only required by the well model
template<class TypeTag>
struct MatrixAddWellContributions<TypeTag, Properties::TTag::TestTypeTag>
{ static constexpr bool value = true; };
// currently, ebos uses the non-multisegment well model by default to avoid
// regressions. the --use-multisegment-well=true|false command line parameter is still
// available in ebos, but hidden from view.
template<class TypeTag>
struct UseMultisegmentWell<TypeTag, Properties::TTag::TestTypeTag>
{ static constexpr bool value = false; };
} // namespace Opm::Parameters
#endif // OPM_TEST_TYPETAG_HPP

View File

@ -62,7 +62,7 @@
namespace Opm::Properties {
namespace TTag {
struct TestRestartTypeTag {
using InheritsFrom = std::tuple<TestTypeTag, FlowTimeSteppingParameters>;
using InheritsFrom = std::tuple<TestTypeTag>;
};
}
@ -514,7 +514,7 @@ struct AquiferFixture {
Opm::ThreadManager<TT>::registerParameters();
AdaptiveTimeStepping<TT>::registerParameters();
BlackoilModelParameters<TT>::registerParameters();
Parameters::registerParam<TT, Parameters::EnableTerminalOutput>("Do *NOT* use!");
Parameters::Register<Parameters::EnableTerminalOutput>("Do *NOT* use!");
setupParameters_<TT>(2, argv, /*registerParams=*/true);
Opm::FlowGenericVanguard::setCommunication(std::make_unique<Opm::Parallel::Communication>());
}

View File

@ -72,10 +72,12 @@ namespace TTag {
struct TestEquilTypeTag {
using InheritsFrom = std::tuple<FlowTimeSteppingParameters, FlowModelParameters, FlowBaseProblem, BlackOilModel>;
using InheritsFrom = std::tuple<FlowBaseProblem,
BlackOilModel>;
};
struct TestEquilVapwatTypeTag {
using InheritsFrom = std::tuple<FlowModelParameters, FlowBaseProblem, BlackOilModel>;
using InheritsFrom = std::tuple<FlowBaseProblem,
BlackOilModel>;
};
}
@ -98,15 +100,6 @@ struct EnableVapwat<TypeTag, TTag::TestEquilVapwatTypeTag> {
} // namespace Opm::Properties
namespace Opm::Parameters {
template<class TypeTag>
struct EnableTerminalOutput<TypeTag, Properties::TTag::FlowBaseProblem> {
static constexpr bool value = true;
};
} // namespace Opm::Parameters
template <class TypeTag>
std::unique_ptr<Opm::GetPropType<TypeTag, Opm::Properties::Simulator>>
initSimulator(const char *filename)
@ -242,8 +235,7 @@ struct EquilFixture {
Opm::ThreadManager<TypeTag>::registerParameters();
BlackoilModelParameters<TypeTag>::registerParameters();
AdaptiveTimeStepping<TypeTag>::registerParameters();
Parameters::registerParam<TypeTag,
Parameters::EnableTerminalOutput>("Dummy added for the well model to compile.");
Parameters::Register<Parameters::EnableTerminalOutput>("Dummy added for the well model to compile.");
registerAllParameters_<TypeTag>();
}

View File

@ -87,9 +87,9 @@ initSimulator(const char *filename)
Parameters::reset();
registerAllParameters_<TypeTag>(false);
registerEclTimeSteppingParameters<TypeTag>();
registerEclTimeSteppingParameters<double>();
BlackoilModelParameters<TypeTag>::registerParameters();
Parameters::registerParam<TypeTag, Parameters::EnableTerminalOutput>("Do *NOT* use!");
Parameters::Register<Parameters::EnableTerminalOutput>("Do *NOT* use!");
Opm::Parameters::SetDefault<Opm::Parameters::ThreadsPerProcess>(2);
Parameters::endRegistration();
setupParameters_<TypeTag>(/*argc=*/sizeof(argv) / sizeof(argv[0]),