mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-27 09:40:59 -06:00
move checkConvergencePolyMW into WellConvergence
This commit is contained in:
parent
0f8ca0c529
commit
5d4c7f49a2
@ -393,47 +393,6 @@ computeBhpAtThpLimitInj(const std::function<std::vector<double>(const double)>&
|
||||
}
|
||||
}
|
||||
|
||||
template<class Scalar>
|
||||
void
|
||||
StandardWellGeneric<Scalar>::
|
||||
checkConvergencePolyMW(const std::vector<double>& res,
|
||||
ConvergenceReport& report,
|
||||
const double maxResidualAllowed) const
|
||||
{
|
||||
if (baseif_.isInjector()) {
|
||||
// checking the convergence of the perforation rates
|
||||
const double wat_vel_tol = 1.e-8;
|
||||
const int dummy_component = -1;
|
||||
using CR = ConvergenceReport;
|
||||
const auto wat_vel_failure_type = CR::WellFailure::Type::MassBalance;
|
||||
for (int perf = 0; perf < baseif_.numPerfs(); ++perf) {
|
||||
const double wat_vel_residual = res[Bhp_ + 1 + perf];
|
||||
if (std::isnan(wat_vel_residual)) {
|
||||
report.setWellFailed({wat_vel_failure_type, CR::Severity::NotANumber, dummy_component, baseif_.name()});
|
||||
} else if (wat_vel_residual > maxResidualAllowed * 10.) {
|
||||
report.setWellFailed({wat_vel_failure_type, CR::Severity::TooLarge, dummy_component, baseif_.name()});
|
||||
} else if (wat_vel_residual > wat_vel_tol) {
|
||||
report.setWellFailed({wat_vel_failure_type, CR::Severity::Normal, dummy_component, baseif_.name()});
|
||||
}
|
||||
}
|
||||
|
||||
// checking the convergence of the skin pressure
|
||||
const double pskin_tol = 1000.; // 1000 pascal
|
||||
const auto pskin_failure_type = CR::WellFailure::Type::Pressure;
|
||||
for (int perf = 0; perf < baseif_.numPerfs(); ++perf) {
|
||||
const double pskin_residual = res[Bhp_ + 1 + perf + baseif_.numPerfs()];
|
||||
if (std::isnan(pskin_residual)) {
|
||||
report.setWellFailed({pskin_failure_type, CR::Severity::NotANumber, dummy_component, baseif_.name()});
|
||||
} else if (pskin_residual > maxResidualAllowed * 10.) {
|
||||
report.setWellFailed({pskin_failure_type, CR::Severity::TooLarge, dummy_component, baseif_.name()});
|
||||
} else if (pskin_residual > pskin_tol) {
|
||||
report.setWellFailed({pskin_failure_type, CR::Severity::Normal, dummy_component, baseif_.name()});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Scalar>
|
||||
void
|
||||
StandardWellGeneric<Scalar>::
|
||||
|
@ -85,10 +85,6 @@ protected:
|
||||
const double bhp,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
void checkConvergencePolyMW(const std::vector<double>& res,
|
||||
ConvergenceReport& report,
|
||||
const double maxResidualAllowed) const;
|
||||
|
||||
void computeConnectionPressureDelta();
|
||||
|
||||
std::optional<double> computeBhpAtThpLimitInj(const std::function<std::vector<double>(const double)>& frates,
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <opm/simulators/utils/DeferredLoggingErrorHelpers.hpp>
|
||||
#include <opm/simulators/linalg/SmallDenseMatrixUtils.hpp>
|
||||
#include <opm/simulators/wells/VFPHelpers.hpp>
|
||||
#include <opm/simulators/wells/WellConvergence.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
@ -2501,7 +2502,8 @@ namespace Opm
|
||||
|
||||
// checking the convergence of the extra equations related to polymer injectivity
|
||||
if constexpr (Base::has_polymermw) {
|
||||
this->checkConvergencePolyMW(res, report, this->param_.max_residual_allowed_);
|
||||
WellConvergence(*this).
|
||||
checkConvergencePolyMW(res, Bhp, this->param_.max_residual_allowed_, report);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,4 +115,44 @@ checkConvergenceControlEq(const WellState& well_state,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
WellConvergence::
|
||||
checkConvergencePolyMW(const std::vector<double>& res,
|
||||
const int Bhp,
|
||||
const double maxResidualAllowed,
|
||||
ConvergenceReport& report) const
|
||||
{
|
||||
if (well_.isInjector()) {
|
||||
// checking the convergence of the perforation rates
|
||||
const double wat_vel_tol = 1.e-8;
|
||||
const int dummy_component = -1;
|
||||
using CR = ConvergenceReport;
|
||||
const auto wat_vel_failure_type = CR::WellFailure::Type::MassBalance;
|
||||
for (int perf = 0; perf < well_.numPerfs(); ++perf) {
|
||||
const double wat_vel_residual = res[Bhp + 1 + perf];
|
||||
if (std::isnan(wat_vel_residual)) {
|
||||
report.setWellFailed({wat_vel_failure_type, CR::Severity::NotANumber, dummy_component, well_.name()});
|
||||
} else if (wat_vel_residual > maxResidualAllowed * 10.) {
|
||||
report.setWellFailed({wat_vel_failure_type, CR::Severity::TooLarge, dummy_component, well_.name()});
|
||||
} else if (wat_vel_residual > wat_vel_tol) {
|
||||
report.setWellFailed({wat_vel_failure_type, CR::Severity::Normal, dummy_component, well_.name()});
|
||||
}
|
||||
}
|
||||
|
||||
// checking the convergence of the skin pressure
|
||||
const double pskin_tol = 1000.; // 1000 pascal
|
||||
const auto pskin_failure_type = CR::WellFailure::Type::Pressure;
|
||||
for (int perf = 0; perf < well_.numPerfs(); ++perf) {
|
||||
const double pskin_residual = res[Bhp + 1 + perf + well_.numPerfs()];
|
||||
if (std::isnan(pskin_residual)) {
|
||||
report.setWellFailed({pskin_failure_type, CR::Severity::NotANumber, dummy_component, well_.name()});
|
||||
} else if (pskin_residual > maxResidualAllowed * 10.) {
|
||||
report.setWellFailed({pskin_failure_type, CR::Severity::TooLarge, dummy_component, well_.name()});
|
||||
} else if (pskin_residual > pskin_tol) {
|
||||
report.setWellFailed({pskin_failure_type, CR::Severity::Normal, dummy_component, well_.name()});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -55,6 +55,11 @@ public:
|
||||
ConvergenceReport& report,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
void checkConvergencePolyMW(const std::vector<double>& res,
|
||||
const int Bhp,
|
||||
const double maxResidualAllowed,
|
||||
ConvergenceReport& report) const;
|
||||
|
||||
private:
|
||||
const WellInterfaceGeneric& well_;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user