diff --git a/ebos/ebos.hh b/ebos/ebos.hh index bf170393f..b46450aca 100644 --- a/ebos/ebos.hh +++ b/ebos/ebos.hh @@ -101,19 +101,35 @@ SET_TYPE_PROP(EbosTypeTag, EclAquiferModel, Opm::BlackoilAquiferModel); SET_TAG_PROP(EbosTypeTag, LinearSolverSplice, FlowIstlSolver); // the default for the allowed volumetric error for oil per second -SET_SCALAR_PROP(EbosTypeTag, NewtonTolerance, 1e-1); +template +struct NewtonTolerance { + using type = GetPropType; + static constexpr type value = 1e-1; +}; // set fraction of the pore volume where the volumetric residual may be violated during // strict Newton iterations -SET_SCALAR_PROP(EbosTypeTag, EclNewtonRelaxedVolumeFraction, 0.05); +template +struct EclNewtonRelaxedVolumeFraction { + using type = GetPropType; + static constexpr type value = 0.05; +}; // the maximum volumetric error of a cell in the relaxed region -SET_SCALAR_PROP(EbosTypeTag, EclNewtonRelaxedTolerance, 1e6*getPropValue()); +template +struct EclNewtonRelaxedTolerance { + using type = GetPropType; + static constexpr type value = 1e6*getPropValue(); +}; // 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. -SET_SCALAR_PROP(EbosTypeTag, EclNewtonSumTolerance, 1e-5); +template +struct EclNewtonSumTolerance { + using type = GetPropType; + static constexpr type value = 1e-5; +}; // 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" diff --git a/ebos/eclproblem.hh b/ebos/eclproblem.hh index d9585cfac..0fa8f6c32 100644 --- a/ebos/eclproblem.hh +++ b/ebos/eclproblem.hh @@ -276,22 +276,38 @@ struct EnableApiTracking { // By default, stop it after the universe will probably have stopped // to exist. (the ECL problem will finish the simulation explicitly // after it simulated the last episode specified in the deck.) -SET_SCALAR_PROP(EclBaseProblem, EndTime, 1e100); +template +struct EndTime { + using type = GetPropType; + static constexpr type value = 1e100; +}; // The default for the initial time step size of the simulation [s]. // // The chosen value means that the size of the first time step is the // one of the initial episode (if the length of the initial episode is // not millions of trillions of years, that is...) -SET_SCALAR_PROP(EclBaseProblem, InitialTimeStepSize, 3600*24); +template +struct InitialTimeStepSize { + using type = GetPropType; + static constexpr type value = 3600*24; +}; // the default for the allowed volumetric error for oil per second -SET_SCALAR_PROP(EclBaseProblem, NewtonTolerance, 1e-2); +template +struct NewtonTolerance { + using type = GetPropType; + static constexpr type value = 1e-2; +}; // 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. -SET_SCALAR_PROP(EclBaseProblem, EclNewtonSumTolerance, 1e-4); +template +struct EclNewtonSumTolerance { + using type = GetPropType; + static constexpr type value = 1e-4; +}; // set the exponent for the volume scaling of the sum tolerance: larger reservoirs can // tolerate a higher amount of mass lost per time step than smaller ones! since this is @@ -299,7 +315,11 @@ SET_SCALAR_PROP(EclBaseProblem, EclNewtonSumTolerance, 1e-4); // value specified by the NewtonSumTolerance parameter is the "incorrect" mass per // timestep for an reservoir that exhibits 1 m^3 of pore volume. A reservoir with a total // pore volume of 10^3 m^3 will tolerate 10 times as much. -SET_SCALAR_PROP(EclBaseProblem, EclNewtonSumToleranceExponent, 1.0/3.0); +template +struct EclNewtonSumToleranceExponent { + using type = GetPropType; + static constexpr type value = 1.0/3.0; +}; // set number of Newton iterations where the volumetric residual is considered for // convergence @@ -310,13 +330,25 @@ struct EclNewtonStrictIterations { // set fraction of the pore volume where the volumetric residual may be violated during // strict Newton iterations -SET_SCALAR_PROP(EclBaseProblem, EclNewtonRelaxedVolumeFraction, 0.03); +template +struct EclNewtonRelaxedVolumeFraction { + using type = GetPropType; + static constexpr type value = 0.03; +}; // the maximum volumetric error of a cell in the relaxed region -SET_SCALAR_PROP(EclBaseProblem, EclNewtonRelaxedTolerance, 1e9); +template +struct EclNewtonRelaxedTolerance { + using type = GetPropType; + static constexpr type value = 1e9; +}; // Ignore the maximum error mass for early termination of the newton method. -SET_SCALAR_PROP(EclBaseProblem, NewtonMaxError, 10e9); +template +struct NewtonMaxError { + using type = GetPropType; + static constexpr type value = 10e9; +}; // set the maximum number of Newton iterations to 14 because the likelyhood that a time // step succeeds at more than 14 Newton iteration is rather small @@ -451,8 +483,16 @@ struct EnableExperiments { }; // set defaults for the time stepping parameters -SET_SCALAR_PROP(EclBaseProblem, EclMaxTimeStepSizeAfterWellEvent, 3600*24*365.25); -SET_SCALAR_PROP(EclBaseProblem, EclRestartShrinkFactor, 3); +template +struct EclMaxTimeStepSizeAfterWellEvent { + using type = GetPropType; + static constexpr type value = 3600*24*365.25; +}; +template +struct EclRestartShrinkFactor { + using type = GetPropType; + static constexpr type value = 3; +}; template struct EclEnableTuning { static constexpr bool value = false; diff --git a/flow/flow_blackoil_dunecpr.cpp b/flow/flow_blackoil_dunecpr.cpp index 0dc589cb2..f04de82f5 100644 --- a/flow/flow_blackoil_dunecpr.cpp +++ b/flow/flow_blackoil_dunecpr.cpp @@ -40,7 +40,11 @@ namespace Opm { struct LinearSolverVerbosity { static constexpr int value = 0; }; - SET_SCALAR_PROP(EclFlowProblemSimple, LinearSolverReduction, 1e-2); + template + struct LinearSolverReduction { + using type = GetPropType; + static constexpr type value = 1e-2; + }; template struct LinearSolverMaxIter { static constexpr int value = 100; diff --git a/opm/simulators/flow/BlackoilModelParametersEbos.hpp b/opm/simulators/flow/BlackoilModelParametersEbos.hpp index 574205a4c..5c449e917 100644 --- a/opm/simulators/flow/BlackoilModelParametersEbos.hpp +++ b/opm/simulators/flow/BlackoilModelParametersEbos.hpp @@ -62,15 +62,51 @@ NEW_PROP_TAG(RegularizationFactorMsw); NEW_PROP_TAG(UseInnerIterationsWells); NEW_PROP_TAG(MaxInnerIterWells); -SET_SCALAR_PROP(FlowModelParameters, DbhpMaxRel, 1.0); -SET_SCALAR_PROP(FlowModelParameters, DwellFractionMax, 0.2); -SET_SCALAR_PROP(FlowModelParameters, MaxResidualAllowed, 1e7); -SET_SCALAR_PROP(FlowModelParameters, RelaxedMaxPvFraction, 1.0); -SET_SCALAR_PROP(FlowModelParameters, ToleranceMb, 1e-6); -SET_SCALAR_PROP(FlowModelParameters, ToleranceCnv,1e-2); -SET_SCALAR_PROP(FlowModelParameters, ToleranceCnvRelaxed, 1e9); -SET_SCALAR_PROP(FlowModelParameters, ToleranceWells, 1e-4); -SET_SCALAR_PROP(FlowModelParameters, ToleranceWellControl, 1e-7); +template +struct DbhpMaxRel { + using type = GetPropType; + static constexpr type value = 1.0; +}; +template +struct DwellFractionMax { + using type = GetPropType; + static constexpr type value = 0.2; +}; +template +struct MaxResidualAllowed { + using type = GetPropType; + static constexpr type value = 1e7; +}; +template +struct RelaxedMaxPvFraction { + using type = GetPropType; + static constexpr type value = 1.0; +}; +template +struct ToleranceMb { + using type = GetPropType; + static constexpr type value = 1e-6; +}; +template +struct ToleranceCnv { + using type = GetPropType; + static constexpr type value = 1e-2; +}; +template +struct ToleranceCnvRelaxed { + using type = GetPropType; + static constexpr type value = 1e9; +}; +template +struct ToleranceWells { + using type = GetPropType; + static constexpr type value = 1e-4; +}; +template +struct ToleranceWellControl { + using type = GetPropType; + static constexpr type value = 1e-7; +}; template struct MaxWelleqIter { static constexpr int value = 30; @@ -79,7 +115,11 @@ template struct UseMultisegmentWell { static constexpr bool value = true; }; -SET_SCALAR_PROP(FlowModelParameters, MaxSinglePrecisionDays, 20.0); +template +struct MaxSinglePrecisionDays { + using type = GetPropType; + static constexpr type value = 20.0; +}; template struct MaxStrictIter { static constexpr int value = 8; @@ -100,8 +140,16 @@ template struct MatrixAddWellContributions { static constexpr bool value = false; }; -SET_SCALAR_PROP(FlowModelParameters, TolerancePressureMsWells, 0.01*1e5); -SET_SCALAR_PROP(FlowModelParameters, MaxPressureChangeMsWells, 10*1e5); +template +struct TolerancePressureMsWells { + using type = GetPropType; + static constexpr type value = 0.01*1e5; +}; +template +struct MaxPressureChangeMsWells { + using type = GetPropType; + static constexpr type value = 10*1e5; +}; template struct UseInnerIterationsMsWells { static constexpr bool value = true; @@ -122,14 +170,25 @@ template struct StrictInnerIterMsWells { static constexpr int value = 40; }; -SET_SCALAR_PROP(FlowModelParameters, RegularizationFactorMsw, 1); +template +struct RegularizationFactorMsw { + using type = GetPropType; + static constexpr type value = 1; +}; template struct EnableWellOperabilityCheck { static constexpr bool value = true; }; - -SET_SCALAR_PROP(FlowModelParameters, RelaxedFlowTolInnerIterMsw, 1); -SET_SCALAR_PROP(FlowModelParameters, RelaxedPressureTolInnerIterMsw, 0.5e5); +template +struct RelaxedFlowTolInnerIterMsw { + using type = GetPropType; + static constexpr type value = 1; +}; +template +struct RelaxedPressureTolInnerIterMsw { + using type = GetPropType; + static constexpr type value = 0.5e5; +}; // if openMP is available, determine the number threads per process automatically. #if _OPENMP diff --git a/opm/simulators/flow/NonlinearSolverEbos.hpp b/opm/simulators/flow/NonlinearSolverEbos.hpp index 3ad44fc1c..c7de830e6 100644 --- a/opm/simulators/flow/NonlinearSolverEbos.hpp +++ b/opm/simulators/flow/NonlinearSolverEbos.hpp @@ -45,7 +45,11 @@ NEW_PROP_TAG(FlowNewtonMaxIterations); NEW_PROP_TAG(FlowNewtonMinIterations); NEW_PROP_TAG(NewtonRelaxationType); -SET_SCALAR_PROP(FlowNonLinearSolver, NewtonMaxRelax, 0.5); +template +struct NewtonMaxRelax { + using type = GetPropType; + static constexpr type value = 0.5; +}; template struct FlowNewtonMaxIterations { static constexpr int value = 20; diff --git a/opm/simulators/linalg/FlowLinearSolverParameters.hpp b/opm/simulators/linalg/FlowLinearSolverParameters.hpp index 63004f083..d1423da67 100644 --- a/opm/simulators/linalg/FlowLinearSolverParameters.hpp +++ b/opm/simulators/linalg/FlowLinearSolverParameters.hpp @@ -73,8 +73,16 @@ NEW_PROP_TAG(GpuMode); NEW_PROP_TAG(BdaDeviceId); NEW_PROP_TAG(OpenclPlatformId); -SET_SCALAR_PROP(FlowIstlSolverParams, LinearSolverReduction, 1e-2); -SET_SCALAR_PROP(FlowIstlSolverParams, IluRelaxation, 0.9); +template +struct LinearSolverReduction { + using type = GetPropType; + static constexpr type value = 1e-2; +}; +template +struct IluRelaxation { + using type = GetPropType; + static constexpr type value = 0.9; +}; template struct LinearSolverMaxIter { static constexpr int value = 200; diff --git a/opm/simulators/timestepping/AdaptiveTimeSteppingEbos.hpp b/opm/simulators/timestepping/AdaptiveTimeSteppingEbos.hpp index f7c995dc6..e15fc76a1 100644 --- a/opm/simulators/timestepping/AdaptiveTimeSteppingEbos.hpp +++ b/opm/simulators/timestepping/AdaptiveTimeSteppingEbos.hpp @@ -43,11 +43,31 @@ NEW_PROP_TAG(TimeStepControlGrowthRate); NEW_PROP_TAG(TimeStepControlFileName); NEW_PROP_TAG(MinTimeStepBeforeShuttingProblematicWellsInDays); -SET_SCALAR_PROP(FlowTimeSteppingParameters, SolverRestartFactor, 0.33); -SET_SCALAR_PROP(FlowTimeSteppingParameters, SolverGrowthFactor, 2.0); -SET_SCALAR_PROP(FlowTimeSteppingParameters, SolverMaxGrowth, 3.0); -SET_SCALAR_PROP(FlowTimeSteppingParameters, SolverMaxTimeStepInDays, 365.0); -SET_SCALAR_PROP(FlowTimeSteppingParameters, SolverMinTimeStep, 0.0); +template +struct SolverRestartFactor { + using type = GetPropType; + static constexpr type value = 0.33; +}; +template +struct SolverGrowthFactor { + using type = GetPropType; + static constexpr type value = 2.0; +}; +template +struct SolverMaxGrowth { + using type = GetPropType; + static constexpr type value = 3.0; +}; +template +struct SolverMaxTimeStepInDays { + using type = GetPropType; + static constexpr type value = 365.0; +}; +template +struct SolverMinTimeStep { + using type = GetPropType; + static constexpr type value = 0.0; +}; template struct SolverMaxRestarts { static constexpr int value = 10; @@ -60,17 +80,29 @@ template struct TimeStepVerbosity { static constexpr int value = 1; }; -SET_SCALAR_PROP(FlowTimeSteppingParameters, InitialTimeStepInDays, 1.0); +template +struct InitialTimeStepInDays { + using type = GetPropType; + static constexpr type value = 1.0; +}; template struct FullTimeStepInitially { static constexpr bool value = false; }; -SET_SCALAR_PROP(FlowTimeSteppingParameters, TimeStepAfterEventInDays, -1.0); +template +struct TimeStepAfterEventInDays { + using type = GetPropType; + static constexpr type value = -1.0; +}; template struct TimeStepControl { static constexpr auto value = "pid"; }; -SET_SCALAR_PROP(FlowTimeSteppingParameters, TimeStepControlTolerance, 1e-1); +template +struct TimeStepControlTolerance { + using type = GetPropType; + static constexpr type value = 1e-1; +}; template struct TimeStepControlTargetIterations { static constexpr int value = 30; @@ -79,13 +111,25 @@ template struct TimeStepControlTargetNewtonIterations { static constexpr int value = 8; }; -SET_SCALAR_PROP(FlowTimeSteppingParameters, TimeStepControlDecayRate, 0.75); -SET_SCALAR_PROP(FlowTimeSteppingParameters, TimeStepControlGrowthRate, 1.25); +template +struct TimeStepControlDecayRate { + using type = GetPropType; + static constexpr type value = 0.75; +}; +template +struct TimeStepControlGrowthRate { + using type = GetPropType; + static constexpr type value = 1.25; +}; template struct TimeStepControlFileName { static constexpr auto value = "timesteps"; }; -SET_SCALAR_PROP(FlowTimeSteppingParameters, MinTimeStepBeforeShuttingProblematicWellsInDays, 0.001); +template +struct MinTimeStepBeforeShuttingProblematicWellsInDays { + using type = GetPropType; + static constexpr type value = 0.001; +}; } // namespace Opm::Properties