Merge pull request #3350 from totto82/maxNiWi

Change the inner iterations logic
This commit is contained in:
Tor Harald Sandve
2021-06-10 19:49:23 +02:00
committed by GitHub
7 changed files with 12 additions and 32 deletions

View File

@@ -1110,7 +1110,7 @@ endif()
FILENAME ACTIONX_M1 FILENAME ACTIONX_M1
SIMULATOR flow SIMULATOR flow
ABS_TOL ${abs_tol_parallel} ABS_TOL ${abs_tol_parallel}
REL_TOL ${rel_tol_parallel} REL_TOL ${coarse_rel_tol_parallel}
DIR udq_actionx DIR udq_actionx
TEST_ARGS --linear-solver-reduction=1e-7 --tolerance-cnv=5e-6 --tolerance-mb=1e-6) TEST_ARGS --linear-solver-reduction=1e-7 --tolerance-cnv=5e-6 --tolerance-mb=1e-6)
endif() endif()

View File

@@ -201,9 +201,8 @@ public:
EWOMS_HIDE_PARAM(TypeTag, UseMultisegmentWell); EWOMS_HIDE_PARAM(TypeTag, UseMultisegmentWell);
EWOMS_HIDE_PARAM(TypeTag, TolerancePressureMsWells); EWOMS_HIDE_PARAM(TypeTag, TolerancePressureMsWells);
EWOMS_HIDE_PARAM(TypeTag, MaxPressureChangeMsWells); EWOMS_HIDE_PARAM(TypeTag, MaxPressureChangeMsWells);
EWOMS_HIDE_PARAM(TypeTag, UseInnerIterationsMsWells);
EWOMS_HIDE_PARAM(TypeTag, MaxInnerIterMsWells); EWOMS_HIDE_PARAM(TypeTag, MaxInnerIterMsWells);
EWOMS_HIDE_PARAM(TypeTag, UseInnerIterationsWells); EWOMS_HIDE_PARAM(TypeTag, MaxNewtonIterationsWithInnerWellIterations);
EWOMS_HIDE_PARAM(TypeTag, MaxInnerIterWells); EWOMS_HIDE_PARAM(TypeTag, MaxInnerIterWells);
EWOMS_HIDE_PARAM(TypeTag, MaxSinglePrecisionDays); EWOMS_HIDE_PARAM(TypeTag, MaxSinglePrecisionDays);
EWOMS_HIDE_PARAM(TypeTag, MaxStrictIter); EWOMS_HIDE_PARAM(TypeTag, MaxStrictIter);

View File

@@ -118,10 +118,6 @@ struct MaxPressureChangeMsWells {
using type = UndefinedProperty; using type = UndefinedProperty;
}; };
template<class TypeTag, class MyTypeTag> template<class TypeTag, class MyTypeTag>
struct UseInnerIterationsMsWells {
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag>
struct MaxInnerIterMsWells { struct MaxInnerIterMsWells {
using type = UndefinedProperty; using type = UndefinedProperty;
}; };
@@ -142,7 +138,7 @@ struct RegularizationFactorMsw {
using type = UndefinedProperty; using type = UndefinedProperty;
}; };
template<class TypeTag, class MyTypeTag> template<class TypeTag, class MyTypeTag>
struct UseInnerIterationsWells { struct MaxNewtonIterationsWithInnerWellIterations {
using type = UndefinedProperty; using type = UndefinedProperty;
}; };
template<class TypeTag, class MyTypeTag> template<class TypeTag, class MyTypeTag>
@@ -243,18 +239,14 @@ struct MaxPressureChangeMsWells<TypeTag, TTag::FlowModelParameters> {
static constexpr type value = 10*1e5; static constexpr type value = 10*1e5;
}; };
template<class TypeTag> template<class TypeTag>
struct UseInnerIterationsMsWells<TypeTag, TTag::FlowModelParameters> { struct MaxNewtonIterationsWithInnerWellIterations<TypeTag, TTag::FlowModelParameters> {
static constexpr bool value = true; static constexpr int value = 3;
}; };
template<class TypeTag> template<class TypeTag>
struct MaxInnerIterMsWells<TypeTag, TTag::FlowModelParameters> { struct MaxInnerIterMsWells<TypeTag, TTag::FlowModelParameters> {
static constexpr int value = 100; static constexpr int value = 100;
}; };
template<class TypeTag> template<class TypeTag>
struct UseInnerIterationsWells<TypeTag, TTag::FlowModelParameters> {
static constexpr bool value = false;
};
template<class TypeTag>
struct MaxInnerIterWells<TypeTag, TTag::FlowModelParameters> { struct MaxInnerIterWells<TypeTag, TTag::FlowModelParameters> {
static constexpr int value = 50; static constexpr int value = 50;
}; };
@@ -337,9 +329,6 @@ namespace Opm
/// Maximum pressure change over an iteratio for ms wells /// Maximum pressure change over an iteratio for ms wells
double max_pressure_change_ms_wells_; double max_pressure_change_ms_wells_;
/// Whether to use inner iterations for ms wells
bool use_inner_iterations_ms_wells_;
/// Maximum inner iteration number for ms wells /// Maximum inner iteration number for ms wells
int max_inner_iter_ms_wells_; int max_inner_iter_ms_wells_;
@@ -349,8 +338,8 @@ namespace Opm
/// Regularization factor for ms wells /// Regularization factor for ms wells
int regularization_factor_ms_wells_; int regularization_factor_ms_wells_;
/// Whether to use inner iterations for standard wells /// Maximum newton iterations with inner well iterations
bool use_inner_iterations_wells_; int max_niter_inner_well_iter_;
/// Maximum inner iteration number for standard wells /// Maximum inner iteration number for standard wells
int max_inner_iter_wells_; int max_inner_iter_wells_;
@@ -405,11 +394,10 @@ namespace Opm
relaxed_inner_tolerance_flow_ms_well_ = EWOMS_GET_PARAM(TypeTag, Scalar, RelaxedFlowTolInnerIterMsw); relaxed_inner_tolerance_flow_ms_well_ = EWOMS_GET_PARAM(TypeTag, Scalar, RelaxedFlowTolInnerIterMsw);
relaxed_inner_tolerance_pressure_ms_well_ = EWOMS_GET_PARAM(TypeTag, Scalar, RelaxedPressureTolInnerIterMsw); relaxed_inner_tolerance_pressure_ms_well_ = EWOMS_GET_PARAM(TypeTag, Scalar, RelaxedPressureTolInnerIterMsw);
max_pressure_change_ms_wells_ = EWOMS_GET_PARAM(TypeTag, Scalar, MaxPressureChangeMsWells); max_pressure_change_ms_wells_ = EWOMS_GET_PARAM(TypeTag, Scalar, MaxPressureChangeMsWells);
use_inner_iterations_ms_wells_ = EWOMS_GET_PARAM(TypeTag, bool, UseInnerIterationsMsWells);
max_inner_iter_ms_wells_ = EWOMS_GET_PARAM(TypeTag, int, MaxInnerIterMsWells); max_inner_iter_ms_wells_ = EWOMS_GET_PARAM(TypeTag, int, MaxInnerIterMsWells);
strict_inner_iter_ms_wells_ = EWOMS_GET_PARAM(TypeTag, int, StrictInnerIterMsWells); strict_inner_iter_ms_wells_ = EWOMS_GET_PARAM(TypeTag, int, StrictInnerIterMsWells);
regularization_factor_ms_wells_ = EWOMS_GET_PARAM(TypeTag, Scalar, RegularizationFactorMsw); regularization_factor_ms_wells_ = EWOMS_GET_PARAM(TypeTag, Scalar, RegularizationFactorMsw);
use_inner_iterations_wells_ = EWOMS_GET_PARAM(TypeTag, bool, UseInnerIterationsWells); max_niter_inner_well_iter_ = EWOMS_GET_PARAM(TypeTag, bool, MaxNewtonIterationsWithInnerWellIterations);
max_inner_iter_wells_ = EWOMS_GET_PARAM(TypeTag, int, MaxInnerIterWells); max_inner_iter_wells_ = EWOMS_GET_PARAM(TypeTag, int, MaxInnerIterWells);
maxSinglePrecisionTimeStep_ = EWOMS_GET_PARAM(TypeTag, Scalar, MaxSinglePrecisionDays) *24*60*60; maxSinglePrecisionTimeStep_ = EWOMS_GET_PARAM(TypeTag, Scalar, MaxSinglePrecisionDays) *24*60*60;
max_strict_iter_ = EWOMS_GET_PARAM(TypeTag, int, MaxStrictIter); max_strict_iter_ = EWOMS_GET_PARAM(TypeTag, int, MaxStrictIter);
@@ -439,10 +427,9 @@ namespace Opm
EWOMS_REGISTER_PARAM(TypeTag, Scalar, RelaxedFlowTolInnerIterMsw, "Relaxed tolerance for the inner iteration for the MSW flow solution"); EWOMS_REGISTER_PARAM(TypeTag, Scalar, RelaxedFlowTolInnerIterMsw, "Relaxed tolerance for the inner iteration for the MSW flow solution");
EWOMS_REGISTER_PARAM(TypeTag, Scalar, RelaxedPressureTolInnerIterMsw, "Relaxed tolerance for the inner iteration for the MSW pressure solution"); EWOMS_REGISTER_PARAM(TypeTag, Scalar, RelaxedPressureTolInnerIterMsw, "Relaxed tolerance for the inner iteration for the MSW pressure solution");
EWOMS_REGISTER_PARAM(TypeTag, Scalar, MaxPressureChangeMsWells, "Maximum relative pressure change for a single iteration of the multi-segment well model"); EWOMS_REGISTER_PARAM(TypeTag, Scalar, MaxPressureChangeMsWells, "Maximum relative pressure change for a single iteration of the multi-segment well model");
EWOMS_REGISTER_PARAM(TypeTag, bool, UseInnerIterationsMsWells, "Use nested iterations for multi-segment wells");
EWOMS_REGISTER_PARAM(TypeTag, int, MaxInnerIterMsWells, "Maximum number of inner iterations for multi-segment wells"); EWOMS_REGISTER_PARAM(TypeTag, int, MaxInnerIterMsWells, "Maximum number of inner iterations for multi-segment wells");
EWOMS_REGISTER_PARAM(TypeTag, int, StrictInnerIterMsWells, "Number of inner iterations for multi-segment wells with strict tolerance"); EWOMS_REGISTER_PARAM(TypeTag, int, StrictInnerIterMsWells, "Number of inner iterations for multi-segment wells with strict tolerance");
EWOMS_REGISTER_PARAM(TypeTag, bool, UseInnerIterationsWells, "Use nested iterations for standard wells"); EWOMS_REGISTER_PARAM(TypeTag, int, MaxNewtonIterationsWithInnerWellIterations, "Maximum newton iterations with inner well iterations");
EWOMS_REGISTER_PARAM(TypeTag, int, MaxInnerIterWells, "Maximum number of inner iterations for standard wells"); EWOMS_REGISTER_PARAM(TypeTag, int, MaxInnerIterWells, "Maximum number of inner iterations for standard wells");
EWOMS_REGISTER_PARAM(TypeTag, bool, AlternativeWellRateInit, "Use alternative well rate initialization procedure"); EWOMS_REGISTER_PARAM(TypeTag, bool, AlternativeWellRateInit, "Use alternative well rate initialization procedure");
EWOMS_REGISTER_PARAM(TypeTag, Scalar, RegularizationFactorMsw, "Regularization factor for ms wells"); EWOMS_REGISTER_PARAM(TypeTag, Scalar, RegularizationFactorMsw, "Regularization factor for ms wells");

View File

@@ -171,9 +171,6 @@ namespace Opm
double* connII, double* connII,
DeferredLogger& deferred_logger) const; DeferredLogger& deferred_logger) const;
virtual bool useInnerIterations() const override {
return param_.use_inner_iterations_ms_wells_;
}
protected: protected:
int number_segments_; int number_segments_;

View File

@@ -280,9 +280,6 @@ namespace Opm
double* connII, double* connII,
DeferredLogger& deferred_logger) const; DeferredLogger& deferred_logger) const;
virtual bool useInnerIterations() const override {
return param_.use_inner_iterations_wells_;
}
protected: protected:
// protected functions from the Base class // protected functions from the Base class

View File

@@ -271,8 +271,6 @@ public:
const GroupState& group_state, const GroupState& group_state,
DeferredLogger& deferred_logger); DeferredLogger& deferred_logger);
virtual bool useInnerIterations() const = 0;
protected: protected:
// simulation parameters // simulation parameters

View File

@@ -366,7 +366,9 @@ namespace Opm
checkWellOperability(ebosSimulator, well_state, deferred_logger); checkWellOperability(ebosSimulator, well_state, deferred_logger);
if (this->useInnerIterations()) { // only use inner well iterations for the first newton iterations.
const int iteration_idx = ebosSimulator.model().newtonMethod().numIterations();
if (iteration_idx < param_.max_niter_inner_well_iter_) {
this->iterateWellEquations(ebosSimulator, dt, well_state, group_state, deferred_logger); this->iterateWellEquations(ebosSimulator, dt, well_state, group_state, deferred_logger);
} }