Merge pull request #4877 from GitPaean/bhp_lower_limit_below_1bar

reducing the bhp lower limit slightly to handle 1 bar bhp limit
This commit is contained in:
Bård Skaflestad 2023-09-19 18:44:37 +02:00 committed by GitHub
commit 40927cb173
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 3 deletions

View File

@ -23,6 +23,7 @@
#include <opm/simulators/wells/MultisegmentWellPrimaryVariables.hpp>
#include <opm/input/eclipse/Schedule/MSW/WellSegments.hpp>
#include <opm/input/eclipse/Units/Units.hpp>
#include <opm/material/fluidsystems/BlackOilDefaultIndexTraits.hpp>
#include <opm/material/fluidsystems/BlackOilFluidSystem.hpp>
@ -180,7 +181,12 @@ updateNewton(const BVectorWell& dwells,
{
const int sign = dwells[seg][SPres] > 0.? 1 : -1;
const double dx_limited = sign * std::min(std::abs(dwells[seg][SPres]) * relaxation_factor, max_pressure_change);
value_[seg][SPres] = std::max(old_primary_variables[seg][SPres] - dx_limited, 1e5);
// some cases might have defaulted bhp constraint of 1 bar, we use a slightly smaller value as the bhp lower limit for Newton update
// so that bhp constaint can be an active control when needed.
// TODO: we might need to distinguish SPres of the top segment from the SPres of the other segments, since only the top segment
// is involved in the well constraints/control checking
constexpr double spres_lower_limit = 1. * unit::barsa - 1. * unit::Pascal;
value_[seg][SPres] = std::max(old_primary_variables[seg][SPres] - dx_limited, spres_lower_limit);
}
// update the total rate // TODO: should we have a limitation of the total rate change?

View File

@ -23,6 +23,7 @@
#include <opm/simulators/wells/StandardWellPrimaryVariables.hpp>
#include <opm/common/Exceptions.hpp>
#include <opm/input/eclipse/Units/Units.hpp>
#include <dune/common/dynvector.hh>
#include <dune/istl/bvector.hh>
@ -277,8 +278,10 @@ updateNewton(const BVectorWell& dwells,
const int sign1 = dwells[0][Bhp] > 0 ? 1: -1;
const double dx1_limited = sign1 * std::min(std::abs(dwells[0][Bhp]),
std::abs(value_[Bhp]) * dBHPLimit);
// 1e5 to make sure bhp will not be below 1bar
value_[Bhp] = std::max(value_[Bhp] - dx1_limited, 1e5);
// some cases might have defaulted bhp constraint of 1 bar, we use a slightly smaller value as the bhp lower limit for Newton update
// so that bhp constaint can be an active control when needed.
constexpr double bhp_lower_limit = 1. * unit::barsa - 1. * unit::Pascal;
value_[Bhp] = std::max(value_[Bhp] - dx1_limited, bhp_lower_limit);
}
template<class FluidSystem, class Indices, class Scalar>