changed: NewtonTolerance parameter moved to Opm::Parameters namespace

This commit is contained in:
Arne Morten Kvarving 2024-06-28 12:17:13 +02:00
parent 389ea1ef8b
commit 514eddc950
5 changed files with 66 additions and 49 deletions

View File

@ -28,15 +28,20 @@
#ifndef FLOW_EXP_HPP
#define FLOW_EXP_HPP
#include <opm/models/discretization/common/fvbaseproblem.hh>
#include <opm/models/utils/propertysystem.hh>
#include <opm/models/utils/start.hh>
#include <opm/simulators/aquifers/BlackoilAquiferModel.hpp>
#include <opm/simulators/flow/FlowProblem.hpp>
#include <opm/simulators/flow/FlowProblemProperties.hpp>
#include <opm/models/utils/start.hh>
#include <opm/models/discretization/common/fvbaseproblem.hh>
#include <opm/simulators/aquifers/BlackoilAquiferModel.hpp>
#include <opm/simulators/linalg/ISTLSolver.hpp>
#include <opm/simulators/timestepping/EclTimeSteppingParams.hpp>
#include <opm/simulators/wells/BlackoilWellModel.hpp>
namespace Opm {
@ -125,13 +130,6 @@ struct LinearSolverBackend<TTag::FlowExpTypeTag, TTag::FlowIstlSolverParams> {
using type = ISTLSolver<TTag::FlowExpTypeTag>;
};
// the default for the allowed volumetric error for oil per second
template<class TypeTag>
struct NewtonTolerance<TypeTag, TTag::FlowExpTypeTag> {
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 1e-1;
};
// set fraction of the pore volume where the volumetric residual may be violated during
// strict Newton iterations
template<class TypeTag>
@ -140,13 +138,6 @@ struct EclNewtonRelaxedVolumeFraction<TypeTag, TTag::FlowExpTypeTag> {
static constexpr type value = 0.05;
};
// 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*getPropValue<TypeTag, Properties::NewtonTolerance>();
};
// 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.
@ -199,8 +190,27 @@ template<class TypeTag>
struct ContinueOnConvergenceError<TypeTag, Properties::TTag::FlowExpTypeTag>
{ static constexpr bool value = true; };
// the default for the allowed volumetric error for oil per second
template<class TypeTag>
struct NewtonTolerance<TypeTag, Properties::TTag::FlowExpTypeTag>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1e-1;
};
} // namespace Opm::Parameters
namespace Opm::Properties {
// 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;
};
}
namespace Opm {
template <class TypeTag>
class FlowExpProblem : public FlowProblem<TypeTag> //, public FvBaseProblem<TypeTag>

View File

@ -21,6 +21,7 @@
#include "flowexp.hpp"
#include <opm/models/discretization/common/tpfalinearizer.hh>
#include <opm/models/utils/parametersystem.hh>
#include <opm/simulators/flow/Main.hpp>
#include <opm/simulators/flow/FlowProblem.hpp>
@ -61,14 +62,6 @@ struct EclNewtonSumTolerance<TypeTag, TTag::FlowExpProblemBlackOil>
static constexpr type value = 1e-5;
};
// the default for the allowed volumetric error for oil per second
template<class TypeTag>
struct NewtonTolerance<TypeTag, TTag::FlowExpProblemBlackOil>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 1e-2;
};
// set fraction of the pore volume where the volumetric residual may be violated during
// strict Newton iterations
template<class TypeTag>
@ -78,13 +71,6 @@ struct EclNewtonRelaxedVolumeFraction<TypeTag, TTag::FlowExpProblemBlackOil>
static constexpr type value = 0.0;
};
template<class TypeTag>
struct EclNewtonRelaxedTolerance<TypeTag, TTag::FlowExpProblemBlackOil>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 10*getPropValue<TypeTag, Properties::NewtonTolerance>();
};
template<class TypeTag>
struct EnableDiffusion<TypeTag, TTag::FlowExpProblemBlackOil>
{
@ -103,7 +89,7 @@ struct Simulator<TypeTag, TTag::FlowExpProblemBlackOil>
using type = Opm::Simulator<TypeTag>;
};
}
} // namespace Opm::Properties
namespace Opm::Parameters {
@ -115,8 +101,27 @@ template<class TypeTag>
struct ContinueOnConvergenceError<TypeTag, Properties::TTag::FlowExpProblemBlackOil>
{ static constexpr bool value = false; };
// the default for the allowed volumetric error for oil per second
template<class TypeTag>
struct NewtonTolerance<TypeTag, Properties::TTag::FlowExpProblemBlackOil>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1e-2;
};
} // namespace Opm::Parameters
namespace Opm::Properties {
template<class TypeTag>
struct EclNewtonRelaxedTolerance<TypeTag, TTag::FlowExpProblemBlackOil>
{
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 10 * Parameters::NewtonTolerance<TypeTag,TTag::FlowExpProblemBlackOil>::value;
};
} // namespace Opm::Properties
int main(int argc, char** argv)
{
using TypeTag = Opm::Properties::TTag::FlowExpProblemBlackOil;

View File

@ -152,7 +152,7 @@ namespace Opm {
// flow also does not use the eWoms Newton method
Parameters::hideParam<TypeTag, Properties::NewtonMaxError>();
Parameters::hideParam<TypeTag, Properties::NewtonTolerance>();
Parameters::hideParam<TypeTag, Parameters::NewtonTolerance>();
Parameters::hideParam<TypeTag, Properties::NewtonTargetIterations>();
Parameters::hideParam<TypeTag, Parameters::NewtonVerbose>();
Parameters::hideParam<TypeTag, Parameters::NewtonWriteConvergence>();

View File

@ -290,13 +290,6 @@ struct InitialTimeStepSize<TypeTag, TTag::FlowBaseProblem> {
static constexpr type value = 3600*24;
};
// the default for the allowed volumetric error for oil per second
template<class TypeTag>
struct NewtonTolerance<TypeTag, TTag::FlowBaseProblem> {
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 1e-2;
};
// ... but enable the ECL output by default
template<class TypeTag>
struct EnableEclOutput<TypeTag,TTag::FlowBaseProblem> {
@ -521,6 +514,14 @@ template<class TypeTag>
struct EnableStorageCache<TypeTag, Properties::TTag::FlowBaseProblem>
{ static constexpr bool value = true; };
// the default for the allowed volumetric error for oil per second
template<class TypeTag>
struct NewtonTolerance<TypeTag, Properties::TTag::FlowBaseProblem>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1e-2;
};
} // namespace Opm::Parameters
#endif // OPM_FLOW_PROBLEM_PROPERTIES_HPP

View File

@ -112,13 +112,6 @@ struct LinearSolverBackend<TTag::TestTypeTag, TTag::FlowIstlSolverParams> {
using type = ISTLSolver<TTag::TestTypeTag>;
};
// the default for the allowed volumetric error for oil per second
template<class TypeTag>
struct NewtonTolerance<TypeTag, TTag::TestTypeTag> {
using type = GetPropType<TypeTag, Scalar>;
static constexpr type value = 1e-1;
};
// set the maximum number of Newton iterations to 8 so that we fail quickly (albeit
// relatively often)
template<class TypeTag>
@ -144,6 +137,14 @@ template<class TypeTag>
struct ContinueOnConvergenceError<TypeTag, Properties::TTag::TestTypeTag>
{ static constexpr bool value = true; };
// the default for the allowed volumetric error for oil per second
template<class TypeTag>
struct NewtonTolerance<TypeTag, Properties::TTag::TestTypeTag>
{
using type = GetPropType<TypeTag, Properties::Scalar>;
static constexpr type value = 1e-1;
};
} // namespace Opm::Parameters
#endif // OPM_TEST_TYPETAG_HPP