mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
changed: FlowExpNewton parameters moved to Opm::Parameters namespace
This commit is contained in:
parent
51e8bb7191
commit
04a9b0893e
@ -34,37 +34,22 @@
|
||||
#include <opm/models/blackoil/blackoilnewtonmethod.hh>
|
||||
#include <opm/models/utils/signum.hh>
|
||||
|
||||
namespace Opm::Properties {
|
||||
namespace Opm::Parameters {
|
||||
|
||||
template<class TypeTag, class MyTypeTag>
|
||||
struct EclNewtonSumTolerance
|
||||
{
|
||||
using type = UndefinedProperty;
|
||||
};
|
||||
struct EclNewtonSumTolerance { using type = Properties::UndefinedProperty; };
|
||||
|
||||
template<class TypeTag, class MyTypeTag>
|
||||
struct EclNewtonStrictIterations
|
||||
{
|
||||
using type = UndefinedProperty;
|
||||
};
|
||||
struct EclNewtonStrictIterations { using type = Properties::UndefinedProperty; };
|
||||
|
||||
template<class TypeTag, class MyTypeTag>
|
||||
struct EclNewtonRelaxedVolumeFraction
|
||||
{
|
||||
using type = UndefinedProperty;
|
||||
};
|
||||
struct EclNewtonRelaxedVolumeFraction { using type = Properties::UndefinedProperty; };
|
||||
|
||||
template<class TypeTag, class MyTypeTag>
|
||||
struct EclNewtonSumToleranceExponent
|
||||
{
|
||||
using type = UndefinedProperty;
|
||||
};
|
||||
struct EclNewtonSumToleranceExponent { using type = Properties::UndefinedProperty; };
|
||||
|
||||
template<class TypeTag, class MyTypeTag>
|
||||
struct EclNewtonRelaxedTolerance
|
||||
{
|
||||
using type = UndefinedProperty;
|
||||
};
|
||||
struct EclNewtonRelaxedTolerance { using type = Properties::UndefinedProperty; };
|
||||
|
||||
} // namespace Opm::Properties
|
||||
|
||||
@ -104,12 +89,12 @@ public:
|
||||
explicit FlowExpNewtonMethod(Simulator& simulator) : ParentType(simulator)
|
||||
{
|
||||
errorPvFraction_ = 1.0;
|
||||
relaxedMaxPvFraction_ = Parameters::get<TypeTag, Properties::EclNewtonRelaxedVolumeFraction>();
|
||||
relaxedMaxPvFraction_ = Parameters::get<TypeTag, Parameters::EclNewtonRelaxedVolumeFraction>();
|
||||
|
||||
sumTolerance_ = 0.0; // this gets determined in the error calculation proceedure
|
||||
relaxedTolerance_ = Parameters::get<TypeTag, Properties::EclNewtonRelaxedTolerance>();
|
||||
relaxedTolerance_ = Parameters::get<TypeTag, Parameters::EclNewtonRelaxedTolerance>();
|
||||
|
||||
numStrictIterations_ = Parameters::get<TypeTag, Properties::EclNewtonStrictIterations>();
|
||||
numStrictIterations_ = Parameters::get<TypeTag, Parameters::EclNewtonStrictIterations>();
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -119,19 +104,19 @@ public:
|
||||
{
|
||||
ParentType::registerParameters();
|
||||
|
||||
Parameters::registerParam<TypeTag, Properties::EclNewtonSumTolerance>
|
||||
Parameters::registerParam<TypeTag, Parameters::EclNewtonSumTolerance>
|
||||
("The maximum error tolerated by the Newton "
|
||||
"method for considering a solution to be converged");
|
||||
Parameters::registerParam<TypeTag, Properties::EclNewtonStrictIterations>
|
||||
Parameters::registerParam<TypeTag, Parameters::EclNewtonStrictIterations>
|
||||
("The number of Newton iterations where the "
|
||||
"volumetric error is considered.");
|
||||
Parameters::registerParam<TypeTag, Properties::EclNewtonRelaxedVolumeFraction>
|
||||
Parameters::registerParam<TypeTag, Parameters::EclNewtonRelaxedVolumeFraction>
|
||||
("The fraction of the pore volume of the reservoir "
|
||||
"where the volumetric error may be violated during strict Newton iterations.");
|
||||
Parameters::registerParam<TypeTag, Properties::EclNewtonSumToleranceExponent>
|
||||
Parameters::registerParam<TypeTag, Parameters::EclNewtonSumToleranceExponent>
|
||||
("The the exponent used to scale the sum tolerance by "
|
||||
"the total pore volume of the reservoir.");
|
||||
Parameters::registerParam<TypeTag, Properties::EclNewtonRelaxedTolerance>
|
||||
Parameters::registerParam<TypeTag, Parameters::EclNewtonRelaxedTolerance>
|
||||
("The maximum error which the volumetric residual "
|
||||
"may exhibit if it is in a 'relaxed' region during a strict iteration.");
|
||||
}
|
||||
@ -234,8 +219,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, Properties::EclNewtonSumTolerance>();
|
||||
Scalar y = Parameters::get<TypeTag, Properties::EclNewtonSumToleranceExponent>();
|
||||
Scalar x = Parameters::get<TypeTag, Parameters::EclNewtonSumTolerance>();
|
||||
Scalar y = Parameters::get<TypeTag, Parameters::EclNewtonSumToleranceExponent>();
|
||||
sumTolerance_ = x*std::pow(sumPv, y);
|
||||
|
||||
this->endIterMsg() << " (max: " << this->tolerance_
|
||||
|
@ -130,36 +130,6 @@ struct LinearSolverBackend<TTag::FlowExpTypeTag, TTag::FlowIstlSolverParams> {
|
||||
using type = ISTLSolver<TTag::FlowExpTypeTag>;
|
||||
};
|
||||
|
||||
// set fraction of the pore volume where the volumetric residual may be violated during
|
||||
// strict Newton iterations
|
||||
template<class TypeTag>
|
||||
struct EclNewtonRelaxedVolumeFraction<TypeTag, TTag::FlowExpTypeTag> {
|
||||
using type = GetPropType<TypeTag, Scalar>;
|
||||
static constexpr type value = 0.05;
|
||||
};
|
||||
|
||||
// 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 TypeTag>
|
||||
struct EclNewtonSumTolerance<TypeTag, TTag::FlowExpTypeTag> {
|
||||
using type = GetPropType<TypeTag, Scalar>;
|
||||
static constexpr type value = 1e-5;
|
||||
};
|
||||
|
||||
template<class TypeTag>
|
||||
struct EclNewtonSumToleranceExponent<TypeTag, TTag::FlowExpTypeTag> {
|
||||
using type = GetPropType<TypeTag, Scalar>;
|
||||
static constexpr type value = 1./3.;
|
||||
};
|
||||
// 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.
|
||||
template<class TypeTag>
|
||||
struct EclNewtonStrictIterations<TypeTag, TTag::FlowExpTypeTag> {
|
||||
static constexpr int value = 100;
|
||||
};
|
||||
|
||||
template<class TypeTag>
|
||||
struct LinearSolverBackend<TypeTag, TTag::FlowExpTypeTag> {
|
||||
using type = ISTLSolver<TypeTag>;
|
||||
@ -199,13 +169,16 @@ struct NewtonMaxIterations<TypeTag, Properties::TTag::FlowExpTypeTag>
|
||||
|
||||
} // namespace Opm::Parameters
|
||||
|
||||
namespace Opm::Properties {
|
||||
namespace Opm::Parameters {
|
||||
|
||||
// the maximum volumetric error of a cell in the relaxed region
|
||||
template<class TypeTag>
|
||||
struct EclNewtonRelaxedTolerance<TypeTag, TTag::FlowExpTypeTag> {
|
||||
using type = GetPropType<TypeTag, Scalar>;
|
||||
static constexpr type value = 1e6*Parameters::NewtonTolerance<TypeTag, TTag::FlowExpTypeTag>::value;
|
||||
struct EclNewtonRelaxedTolerance<TypeTag, Properties::TTag::FlowExpTypeTag> {
|
||||
using type = GetPropType<TypeTag, Properties::Scalar>;
|
||||
static constexpr auto baseValue =
|
||||
Parameters::NewtonTolerance<TypeTag,
|
||||
Properties::TTag::FlowExpTypeTag>::value;
|
||||
static constexpr type value = 1e6 * baseValue;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -55,22 +55,6 @@ struct Problem<TypeTag, TTag::FlowExpProblemBlackOil>
|
||||
using type = FlowExpProblem<TypeTag>;
|
||||
};
|
||||
|
||||
template<class TypeTag>
|
||||
struct EclNewtonSumTolerance<TypeTag, TTag::FlowExpProblemBlackOil>
|
||||
{
|
||||
using type = GetPropType<TypeTag, Scalar>;
|
||||
static constexpr type value = 1e-5;
|
||||
};
|
||||
|
||||
// set fraction of the pore volume where the volumetric residual may be violated during
|
||||
// strict Newton iterations
|
||||
template<class TypeTag>
|
||||
struct EclNewtonRelaxedVolumeFraction<TypeTag, TTag::FlowExpProblemBlackOil>
|
||||
{
|
||||
using type = GetPropType<TypeTag, Scalar>;
|
||||
static constexpr type value = 0.0;
|
||||
};
|
||||
|
||||
template<class TypeTag>
|
||||
struct EnableDiffusion<TypeTag, TTag::FlowExpProblemBlackOil>
|
||||
{
|
||||
@ -93,14 +77,42 @@ struct Simulator<TypeTag, TTag::FlowExpProblemBlackOil>
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
template<class TypeTag>
|
||||
struct ThreadsPerProcess<TypeTag, Properties::TTag::FlowExpProblemBlackOil>
|
||||
{ static constexpr int value = 1; };
|
||||
|
||||
template<class TypeTag>
|
||||
struct ContinueOnConvergenceError<TypeTag, Properties::TTag::FlowExpProblemBlackOil>
|
||||
{ static constexpr bool value = false; };
|
||||
|
||||
template<class TypeTag>
|
||||
struct EclNewtonRelaxedTolerance<TypeTag, Properties::TTag::FlowExpProblemBlackOil>
|
||||
{
|
||||
using type = GetPropType<TypeTag, Properties::Scalar>;
|
||||
static constexpr auto baseValue =
|
||||
Parameters::NewtonTolerance<TypeTag, Properties::TTag::FlowExpProblemBlackOil>::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;;
|
||||
};
|
||||
|
||||
// the default for the allowed volumetric error for oil per second
|
||||
template<class TypeTag>
|
||||
struct NewtonTolerance<TypeTag, Properties::TTag::FlowExpProblemBlackOil>
|
||||
@ -109,18 +121,15 @@ struct NewtonTolerance<TypeTag, Properties::TTag::FlowExpProblemBlackOil>
|
||||
static constexpr type value = 1e-2;
|
||||
};
|
||||
|
||||
} // namespace Opm::Parameters
|
||||
|
||||
namespace Opm::Properties {
|
||||
template<class TypeTag>
|
||||
struct ThreadsPerProcess<TypeTag, Properties::TTag::FlowExpProblemBlackOil>
|
||||
{ static constexpr int value = 1; };
|
||||
|
||||
template<class TypeTag>
|
||||
struct EclNewtonRelaxedTolerance<TypeTag, TTag::FlowExpProblemBlackOil>
|
||||
{
|
||||
using type = GetPropType<TypeTag, Scalar>;
|
||||
static constexpr type value = 10 * Parameters::NewtonTolerance<TypeTag,TTag::FlowExpProblemBlackOil>::value;
|
||||
};
|
||||
struct EclNewtonStrictIterations<TypeTag, Properties::TTag::FlowExpProblemBlackOil>
|
||||
{ static constexpr int value = 100; };
|
||||
|
||||
} // namespace Opm::Properties
|
||||
} // namespace Opm::Parameters
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user