mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-27 09:40:59 -06:00
Merge pull request #3957 from totto82/regStw
regularize equation for problematic std wells
This commit is contained in:
commit
04b0c3515d
@ -141,7 +141,7 @@ struct RelaxedPressureTolMsw {
|
||||
using type = UndefinedProperty;
|
||||
};
|
||||
template<class TypeTag, class MyTypeTag>
|
||||
struct RegularizationFactorMsw {
|
||||
struct RegularizationFactorWells {
|
||||
using type = UndefinedProperty;
|
||||
};
|
||||
template<class TypeTag, class MyTypeTag>
|
||||
@ -282,7 +282,7 @@ struct StrictInnerIterWells<TypeTag, TTag::FlowModelParameters> {
|
||||
static constexpr int value = 40;
|
||||
};
|
||||
template<class TypeTag>
|
||||
struct RegularizationFactorMsw<TypeTag, TTag::FlowModelParameters> {
|
||||
struct RegularizationFactorWells<TypeTag, TTag::FlowModelParameters> {
|
||||
using type = GetPropType<TypeTag, Scalar>;
|
||||
static constexpr type value = 100;
|
||||
};
|
||||
@ -369,8 +369,8 @@ namespace Opm
|
||||
/// Newton iteration where wells are stricly convergent
|
||||
int strict_outer_iter_wells_;
|
||||
|
||||
/// Regularization factor for ms wells
|
||||
int regularization_factor_ms_wells_;
|
||||
/// Regularization factor for wells
|
||||
int regularization_factor_wells_;
|
||||
|
||||
/// Maximum newton iterations with inner well iterations
|
||||
int max_niter_inner_well_iter_;
|
||||
@ -444,7 +444,7 @@ namespace Opm
|
||||
max_inner_iter_ms_wells_ = EWOMS_GET_PARAM(TypeTag, int, MaxInnerIterMsWells);
|
||||
strict_inner_iter_wells_ = EWOMS_GET_PARAM(TypeTag, int, StrictInnerIterWells);
|
||||
strict_outer_iter_wells_ = EWOMS_GET_PARAM(TypeTag, int, StrictOuterIterWells);
|
||||
regularization_factor_ms_wells_ = EWOMS_GET_PARAM(TypeTag, Scalar, RegularizationFactorMsw);
|
||||
regularization_factor_wells_ = EWOMS_GET_PARAM(TypeTag, Scalar, RegularizationFactorWells);
|
||||
max_niter_inner_well_iter_ = EWOMS_GET_PARAM(TypeTag, int, MaxNewtonIterationsWithInnerWellIterations);
|
||||
shut_unsolvable_wells_ = EWOMS_GET_PARAM(TypeTag, bool, ShutUnsolvableWells);
|
||||
max_inner_iter_wells_ = EWOMS_GET_PARAM(TypeTag, int, MaxInnerIterWells);
|
||||
@ -485,7 +485,7 @@ namespace Opm
|
||||
EWOMS_REGISTER_PARAM(TypeTag, bool, ShutUnsolvableWells, "Shut unsolvable 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, Scalar, RegularizationFactorMsw, "Regularization factor for ms wells");
|
||||
EWOMS_REGISTER_PARAM(TypeTag, Scalar, RegularizationFactorWells, "Regularization factor for wells");
|
||||
EWOMS_REGISTER_PARAM(TypeTag, Scalar, MaxSinglePrecisionDays, "Maximum time step size where single precision floating point arithmetic can be used solving for the linear systems of equations");
|
||||
EWOMS_REGISTER_PARAM(TypeTag, int, MaxStrictIter, "Maximum number of Newton iterations before relaxed tolerances are used for the CNV convergence criterion");
|
||||
EWOMS_REGISTER_PARAM(TypeTag, bool, SolveWelleqInitially, "Fully solve the well equations before each iteration of the reservoir model");
|
||||
|
@ -1636,7 +1636,7 @@ namespace Opm
|
||||
// Add a regularization_factor to increase the accumulation term
|
||||
// This will make the system less stiff and help convergence for
|
||||
// difficult cases
|
||||
const Scalar regularization_factor = this->regularize_? this->param_.regularization_factor_ms_wells_ : 1.0;
|
||||
const Scalar regularization_factor = this->regularize_? this->param_.regularization_factor_wells_ : 1.0;
|
||||
// for each component
|
||||
for (int comp_idx = 0; comp_idx < this->num_components_; ++comp_idx) {
|
||||
const EvalWell accumulation_term = regularization_factor * (segment_surface_volume * this->surfaceVolumeFraction(seg, comp_idx)
|
||||
|
@ -250,6 +250,8 @@ namespace Opm
|
||||
|
||||
|
||||
protected:
|
||||
bool regularize_;
|
||||
|
||||
// xw = inv(D)*(rw - C*x)
|
||||
void recoverSolutionWell(const BVector& x, BVectorWell& xw) const;
|
||||
|
||||
|
@ -46,6 +46,7 @@ namespace Opm
|
||||
const std::vector<PerforationData>& perf_data)
|
||||
: Base(well, pw_info, time_step, param, rate_converter, pvtRegionIdx, num_components, num_phases, index_of_well, perf_data)
|
||||
, StdWellEval(static_cast<const WellInterfaceIndices<FluidSystem,Indices,Scalar>&>(*this))
|
||||
, regularize_(false)
|
||||
{
|
||||
assert(this->num_components_ == numWellConservationEq);
|
||||
}
|
||||
@ -449,9 +450,10 @@ namespace Opm
|
||||
const GroupState& group_state,
|
||||
DeferredLogger& deferred_logger)
|
||||
{
|
||||
// try to regularize equation if the well does not converge
|
||||
const Scalar regularization_factor = this->regularize_? this->param_.regularization_factor_wells_ : 1.0;
|
||||
const double volume = 0.1 * unit::cubic(unit::feet) * regularization_factor;
|
||||
|
||||
// TODO: it probably can be static member for StandardWell
|
||||
const double volume = 0.002831684659200; // 0.1 cu ft;
|
||||
auto& ws = well_state.well(this->index_of_well_);
|
||||
|
||||
ws.vaporized_oil_rate = 0;
|
||||
@ -2653,10 +2655,17 @@ namespace Opm
|
||||
const int max_iter = this->param_.max_inner_iter_wells_;
|
||||
int it = 0;
|
||||
bool converged;
|
||||
bool relax_convergence = false;
|
||||
this->regularize_ = false;
|
||||
do {
|
||||
assembleWellEqWithoutIteration(ebosSimulator, dt, inj_controls, prod_controls, well_state, group_state, deferred_logger);
|
||||
|
||||
auto report = getWellConvergence(well_state, Base::B_avg_, deferred_logger);
|
||||
if (it > this->param_.strict_inner_iter_wells_) {
|
||||
relax_convergence = true;
|
||||
this->regularize_ = true;
|
||||
}
|
||||
|
||||
auto report = getWellConvergence(well_state, Base::B_avg_, deferred_logger, relax_convergence);
|
||||
|
||||
converged = report.converged();
|
||||
if (converged) {
|
||||
|
Loading…
Reference in New Issue
Block a user