mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-11-21 08:54:08 -06:00
move NewtonTolerance to TypeTag-free parameter system
This commit is contained in:
parent
6d649be5db
commit
73344cfb60
@ -75,21 +75,11 @@ struct Scalar<TypeTag, TTag::Co2InjectionFlashEcfvProblem>
|
||||
|
||||
} // namespace Opm::Properties
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
#if ! HAVE_QUAD
|
||||
template<class TypeTag>
|
||||
struct NewtonTolerance<TypeTag, Properties::TTag::Co2InjectionFlashEcfvProblem>
|
||||
{
|
||||
using type = GetPropType<TypeTag, Properties::Scalar>;
|
||||
static constexpr type value = 1e-5;
|
||||
};
|
||||
#endif
|
||||
|
||||
} // namespace Opm::Parameters
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
using EcfvProblemTypeTag = Opm::Properties::TTag::Co2InjectionFlashEcfvProblem;
|
||||
#if ! HAVE_QUAD
|
||||
Opm::Co2InjectionTolerance = 1e-5;
|
||||
#endif
|
||||
return Opm::start<EcfvProblemTypeTag>(argc, argv);
|
||||
}
|
||||
|
@ -77,21 +77,11 @@ struct Scalar<TypeTag, TTag::Co2InjectionFlashNiEcfvProblem>
|
||||
|
||||
} // namespace Opm::Properties
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
#if ! HAVE_QUAD
|
||||
template<class TypeTag>
|
||||
struct NewtonTolerance<TypeTag, Properties::TTag::Co2InjectionFlashNiEcfvProblem>
|
||||
{
|
||||
using type = GetPropType<TypeTag, Properties::Scalar>;
|
||||
static constexpr type value = 1e-5;
|
||||
};
|
||||
#endif
|
||||
|
||||
} // namespace Opm::Parameters
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
using EcfvProblemTypeTag = Opm::Properties::TTag::Co2InjectionFlashNiEcfvProblem;
|
||||
#if ! HAVE_QUAD
|
||||
Opm::Co2InjectionTolerance = 1e-5;
|
||||
#endif
|
||||
return Opm::start<EcfvProblemTypeTag>(argc, argv);
|
||||
}
|
||||
|
@ -73,21 +73,11 @@ struct Scalar<TypeTag, TTag::Co2InjectionFlashNiVcfvProblem>
|
||||
|
||||
} // namespace Opm::Properties
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
#if ! HAVE_QUAD
|
||||
template<class TypeTag>
|
||||
struct NewtonTolerance<TypeTag, Properties::TTag::Co2InjectionFlashNiVcfvProblem>
|
||||
{
|
||||
using type = GetPropType<TypeTag, Properties::Scalar>;
|
||||
static constexpr type value = 1e-5;
|
||||
};
|
||||
#endif
|
||||
|
||||
} // namespace Opm::Parameters
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
using VcfvProblemTypeTag = Opm::Properties::TTag::Co2InjectionFlashNiVcfvProblem;
|
||||
#if ! HAVE_QUAD
|
||||
Opm::Co2InjectionTolerance = 1e-5;
|
||||
#endif
|
||||
return Opm::start<VcfvProblemTypeTag>(argc, argv);
|
||||
}
|
||||
|
@ -69,21 +69,11 @@ struct Scalar<TypeTag, TTag::Co2InjectionFlashVcfvProblem>
|
||||
|
||||
} // namespace Opm::Properties
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
#if ! HAVE_QUAD
|
||||
template<class TypeTag>
|
||||
struct NewtonTolerance<TypeTag, Properties::TTag::Co2InjectionFlashVcfvProblem>
|
||||
{
|
||||
using type = GetPropType<TypeTag, Properties::Scalar>;
|
||||
static constexpr type value = 1e-5;
|
||||
};
|
||||
#endif
|
||||
|
||||
} // namespace Opm::Parameters
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
using VcfvProblemTypeTag = Opm::Properties::TTag::Co2InjectionFlashVcfvProblem;
|
||||
#if ! HAVE_QUAD
|
||||
Opm::Co2InjectionTolerance = 1e-5;
|
||||
#endif
|
||||
return Opm::start<VcfvProblemTypeTag>(argc, argv);
|
||||
}
|
||||
|
@ -231,6 +231,9 @@ struct Temperature<TypeTag, Properties::TTag::Co2InjectionBaseProblem>
|
||||
} // namespace Opm::Parameters
|
||||
|
||||
namespace Opm {
|
||||
|
||||
double Co2InjectionTolerance = 1e-8;
|
||||
|
||||
/*!
|
||||
* \ingroup TestProblems
|
||||
*
|
||||
@ -393,6 +396,8 @@ public:
|
||||
Parameters::SetDefault<Parameters::GridFile>("data/co2injection.dgf");
|
||||
Parameters::SetDefault<Parameters::EndTime<Scalar>>(1e4);
|
||||
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(250);
|
||||
|
||||
Parameters::SetDefault<Parameters::NewtonTolerance<Scalar>>(Scalar{Co2InjectionTolerance});
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -190,13 +190,6 @@ struct LinearSolverTolerance<TypeTag, Properties::TTag::CO2PTBaseProblem>
|
||||
static constexpr type value = 1e-3;
|
||||
};
|
||||
|
||||
template <class TypeTag>
|
||||
struct NewtonTolerance<TypeTag, Properties::TTag::CO2PTBaseProblem>
|
||||
{
|
||||
using type = GetPropType<TypeTag, Properties::Scalar>;
|
||||
static constexpr type value = 1e-3;
|
||||
};
|
||||
|
||||
template <class TypeTag>
|
||||
struct NewtonTargetIterations<TypeTag, Properties::TTag::CO2PTBaseProblem>
|
||||
{
|
||||
@ -380,6 +373,7 @@ public:
|
||||
|
||||
Parameters::SetDefault<Parameters::EndTime<Scalar>>(60. * 60.);
|
||||
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(0.1 * 60. * 60.);
|
||||
Parameters::SetDefault<Parameters::NewtonTolerance<Scalar>>(1e-3);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -148,14 +148,6 @@ struct MaxDepth<TypeTag, Properties::TTag::ReservoirBaseProblem>
|
||||
static constexpr type value = 2500;
|
||||
};
|
||||
|
||||
// increase the tolerance for this problem to get larger time steps
|
||||
template<class TypeTag>
|
||||
struct NewtonTolerance<TypeTag, Properties::TTag::ReservoirBaseProblem>
|
||||
{
|
||||
using type = GetPropType<TypeTag, Properties::Scalar>;
|
||||
static constexpr type value = 1e-6;
|
||||
};
|
||||
|
||||
template<class TypeTag>
|
||||
struct Temperature<TypeTag, Properties::TTag::ReservoirBaseProblem>
|
||||
{
|
||||
@ -431,6 +423,8 @@ public:
|
||||
Parameters::SetDefault<Parameters::EnableStorageCache>(true);
|
||||
Parameters::SetDefault<Parameters::GridFile>("data/reservoir.dgf");
|
||||
Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(100e3);
|
||||
// increase the tolerance for this problem to get larger time steps
|
||||
Parameters::SetDefault<Parameters::NewtonTolerance<Scalar>>(1e-6);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -81,13 +81,6 @@ struct NewtonConvergenceWriter<TypeTag, TTag::NewtonMethod> { using type = NullC
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
template<class TypeTag>
|
||||
struct NewtonTolerance<TypeTag, Properties::TTag::NewtonMethod>
|
||||
{
|
||||
using type = GetPropType<TypeTag, Properties::Scalar>;
|
||||
static constexpr type value = 1e-8;
|
||||
};
|
||||
|
||||
// set the abortion tolerance to some very large value. if not
|
||||
// overwritten at run-time this basically disables abortions
|
||||
template<class TypeTag>
|
||||
@ -146,7 +139,7 @@ public:
|
||||
{
|
||||
lastError_ = 1e100;
|
||||
error_ = 1e100;
|
||||
tolerance_ = Parameters::get<TypeTag, Parameters::NewtonTolerance>();
|
||||
tolerance_ = Parameters::Get<Parameters::NewtonTolerance<Scalar>>();
|
||||
|
||||
numIterations_ = 0;
|
||||
}
|
||||
@ -168,7 +161,7 @@ public:
|
||||
("The 'optimum' number of Newton iterations per time step");
|
||||
Parameters::registerParam<TypeTag, Parameters::NewtonMaxIterations>
|
||||
("The maximum number of Newton iterations per time step");
|
||||
Parameters::registerParam<TypeTag, Parameters::NewtonTolerance>
|
||||
Parameters::Register<Parameters::NewtonTolerance<Scalar>>
|
||||
("The maximum raw error tolerated by the Newton"
|
||||
"method for considering a solution to be converged");
|
||||
Parameters::registerParam<TypeTag, Parameters::NewtonMaxError>
|
||||
|
@ -27,21 +27,21 @@
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
//! Specifies whether the Newton method should print messages or not
|
||||
struct NewtonVerbose { static constexpr bool value = true; };
|
||||
|
||||
//! Specifies whether the convergence rate and the global residual
|
||||
//! gets written out to disk for every Newton iteration
|
||||
struct NewtonWriteConvergence { static constexpr bool value = false; };
|
||||
|
||||
/*!
|
||||
* \brief The value for the error below which convergence is declared
|
||||
*
|
||||
* This value can (and for the porous media models will) be changed to account for grid
|
||||
* scaling and other effects.
|
||||
*/
|
||||
template<class TypeTag, class MyTypeTag>
|
||||
struct NewtonTolerance { using type = Properties::UndefinedProperty; };
|
||||
template<class Scalar>
|
||||
struct NewtonTolerance { static constexpr Scalar value = 1e-8; };
|
||||
|
||||
//! Specifies whether the Newton method should print messages or not
|
||||
struct NewtonVerbose { static constexpr bool value = true; };
|
||||
|
||||
//! Specifies whether the convergence rate and the global residual
|
||||
//! gets written out to disk for every Newton iteration
|
||||
struct NewtonWriteConvergence { static constexpr bool value = false; };
|
||||
|
||||
//! The maximum error which may occur in a simulation before the
|
||||
//! Newton method for the time step is aborted
|
||||
|
Loading…
Reference in New Issue
Block a user