regularize equation for std wells

This commit is contained in:
Tor Harald Sandve 2022-06-23 15:14:36 +02:00
parent 5b2d1ca5ec
commit eef455106d
2 changed files with 14 additions and 3 deletions

View File

@ -250,6 +250,8 @@ namespace Opm
protected:
bool regularize_;
// xw = inv(D)*(rw - C*x)
void recoverSolutionWell(const BVector& x, BVectorWell& xw) const;

View File

@ -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_ms_wells_ : 1.0;
const double volume = 0.002831684659200 * regularization_factor; // 0.1 cu ft;
// 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) {