mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
adding checkConvergenceExtraEqs to StandardWell
This commit is contained in:
parent
4f7b899290
commit
94057a53f9
@ -475,9 +475,15 @@ namespace Opm
|
||||
|
||||
virtual void updateWaterThroughput(const double dt, WellState& well_state) const override;
|
||||
|
||||
// checking the convergence of the well control equations
|
||||
void checkConvergenceControlEq(ConvergenceReport& report,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
// checking convergence of extra equations, if there are any
|
||||
void checkConvergenceExtraEqs(const std::vector<double>& res,
|
||||
ConvergenceReport& report,
|
||||
DeferredLogger& deferred_logger) const;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -2032,36 +2032,7 @@ namespace Opm
|
||||
|
||||
checkConvergenceControlEq(report, deferred_logger);
|
||||
|
||||
if (this->has_polymermw && well_type_ == INJECTOR) {
|
||||
// checking the convergence of the perforation rates
|
||||
const double wat_vel_tol = 1.e-8;
|
||||
const int dummy_component = -1;
|
||||
const auto wat_vel_failure_type = CR::WellFailure::Type::MassBalance;
|
||||
for (int perf = 0; perf < number_of_perforations_; ++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, name()});
|
||||
} else if (wat_vel_residual > maxResidualAllowed * 10.) {
|
||||
report.setWellFailed({wat_vel_failure_type, CR::Severity::TooLarge, dummy_component, name()});
|
||||
} else if (wat_vel_residual > wat_vel_tol) {
|
||||
report.setWellFailed({wat_vel_failure_type, CR::Severity::Normal, dummy_component, 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 < number_of_perforations_; ++perf) {
|
||||
const double pskin_residual = res[Bhp + 1 + perf + number_of_perforations_];
|
||||
if (std::isnan(pskin_residual)) {
|
||||
report.setWellFailed({pskin_failure_type, CR::Severity::NotANumber, dummy_component, name()});
|
||||
} else if (pskin_residual > maxResidualAllowed * 10.) {
|
||||
report.setWellFailed({pskin_failure_type, CR::Severity::TooLarge, dummy_component, name()});
|
||||
} else if (pskin_residual > pskin_tol) {
|
||||
report.setWellFailed({pskin_failure_type, CR::Severity::Normal, dummy_component, name()});
|
||||
}
|
||||
}
|
||||
}
|
||||
checkConvergenceExtraEqs(res, report, deferred_logger);
|
||||
|
||||
return report;
|
||||
}
|
||||
@ -3186,4 +3157,52 @@ namespace Opm
|
||||
report.setWellFailed({ctrltype, CR::Severity::Normal, dummy_component, name()});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename TypeTag>
|
||||
void
|
||||
StandardWell<TypeTag>::
|
||||
checkConvergenceExtraEqs(const std::vector<double>& res,
|
||||
ConvergenceReport& report,
|
||||
DeferredLogger& deferred_logger) const
|
||||
{
|
||||
// if different types of extra equations are involved, this function needs to be refactored further
|
||||
|
||||
// checking the convergence of the extra equations related to polymer injectivity
|
||||
if (this->has_polymermw && well_type_ == INJECTOR) {
|
||||
// checking the convergence of the perforation rates
|
||||
const double wat_vel_tol = 1.e-8;
|
||||
const int dummy_component = -1;
|
||||
const double maxResidualAllowed = param_.max_residual_allowed_;
|
||||
using CR = ConvergenceReport;
|
||||
const auto wat_vel_failure_type = CR::WellFailure::Type::MassBalance;
|
||||
for (int perf = 0; perf < number_of_perforations_; ++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, name()});
|
||||
} else if (wat_vel_residual > maxResidualAllowed * 10.) {
|
||||
report.setWellFailed({wat_vel_failure_type, CR::Severity::TooLarge, dummy_component, name()});
|
||||
} else if (wat_vel_residual > wat_vel_tol) {
|
||||
report.setWellFailed({wat_vel_failure_type, CR::Severity::Normal, dummy_component, 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 < number_of_perforations_; ++perf) {
|
||||
const double pskin_residual = res[Bhp + 1 + perf + number_of_perforations_];
|
||||
if (std::isnan(pskin_residual)) {
|
||||
report.setWellFailed({pskin_failure_type, CR::Severity::NotANumber, dummy_component, name()});
|
||||
} else if (pskin_residual > maxResidualAllowed * 10.) {
|
||||
report.setWellFailed({pskin_failure_type, CR::Severity::TooLarge, dummy_component, name()});
|
||||
} else if (pskin_residual > pskin_tol) {
|
||||
report.setWellFailed({pskin_failure_type, CR::Severity::Normal, dummy_component, name()});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user