mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Rename ConvergenceStatus -> ConvergenceReport.
This commit is contained in:
@@ -660,7 +660,7 @@ namespace Opm {
|
||||
BlackoilWellModel<TypeTag>::
|
||||
getWellConvergence(const std::vector<Scalar>& B_avg) const
|
||||
{
|
||||
ConvergenceStatus report;
|
||||
ConvergenceReport report;
|
||||
|
||||
for (const auto& well : well_container_) {
|
||||
report += well->getWellConvergence(B_avg);
|
||||
@@ -671,13 +671,13 @@ namespace Opm {
|
||||
{
|
||||
// Debug reporting.
|
||||
for (const auto& f : report.wellFailures()) {
|
||||
if (f.severity == ConvergenceStatus::Severity::NotANumber) {
|
||||
if (f.severity == ConvergenceReport::Severity::NotANumber) {
|
||||
OpmLog::debug("NaN residual found with phase " + std::to_string(f.phase) + " for well " + f.well_name);
|
||||
}
|
||||
}
|
||||
|
||||
// Throw if any nan residual found.
|
||||
bool nan_residual_found = (severity == ConvergenceStatus::Severity::NotANumber);
|
||||
bool nan_residual_found = (severity == ConvergenceReport::Severity::NotANumber);
|
||||
const auto& grid = ebosSimulator_.vanguard().grid();
|
||||
int value = nan_residual_found ? 1 : 0;
|
||||
nan_residual_found = grid.comm().max(value);
|
||||
@@ -690,13 +690,13 @@ namespace Opm {
|
||||
{
|
||||
// Debug reporting.
|
||||
for (const auto& f : report.wellFailures()) {
|
||||
if (f.severity == ConvergenceStatus::Severity::TooLarge) {
|
||||
if (f.severity == ConvergenceReport::Severity::TooLarge) {
|
||||
OpmLog::debug("Too large residual found with phase " + std::to_string(f.phase) + " for well " + f.well_name);
|
||||
}
|
||||
}
|
||||
|
||||
// Throw if any too large residual found.
|
||||
bool too_large_residual_found = (severity == ConvergenceStatus::Severity::TooLarge);
|
||||
bool too_large_residual_found = (severity == ConvergenceReport::Severity::TooLarge);
|
||||
const auto& grid = ebosSimulator_.vanguard().grid();
|
||||
int value = too_large_residual_found ? 1 : 0;
|
||||
too_large_residual_found = grid.comm().max(value);
|
||||
|
||||
@@ -122,7 +122,7 @@ namespace Opm
|
||||
virtual void updateWellStateWithTarget(WellState& well_state) const;
|
||||
|
||||
/// check whether the well equations get converged for this well
|
||||
virtual ConvergenceStatus getWellConvergence(const std::vector<double>& B_avg) const;
|
||||
virtual ConvergenceReport getWellConvergence(const std::vector<double>& B_avg) const;
|
||||
|
||||
/// Ax = Ax - C D^-1 B x
|
||||
virtual void apply(const BVector& x, BVector& Ax) const;
|
||||
|
||||
@@ -405,7 +405,7 @@ namespace Opm
|
||||
|
||||
|
||||
template <typename TypeTag>
|
||||
ConvergenceStatus
|
||||
ConvergenceReport
|
||||
MultisegmentWell<TypeTag>::
|
||||
getWellConvergence(const std::vector<double>& B_avg) const
|
||||
{
|
||||
@@ -419,18 +419,18 @@ namespace Opm
|
||||
}
|
||||
}
|
||||
|
||||
using CS = ConvergenceStatus;
|
||||
CS::WellFailure::Type ctrltype = CS::WellFailure::Type::Mb;
|
||||
using CR = ConvergenceReport;
|
||||
CR::WellFailure::Type ctrltype = CR::WellFailure::Type::Mb;
|
||||
switch(well_controls_get_current_type(well_controls_)) {
|
||||
case THP:
|
||||
ctrltype = CS::WellFailure::Type::CtrlTHP;
|
||||
ctrltype = CR::WellFailure::Type::CtrlTHP;
|
||||
break;
|
||||
case BHP:
|
||||
ctrltype = CS::WellFailure::Type::CtrlBHP;
|
||||
ctrltype = CR::WellFailure::Type::CtrlBHP;
|
||||
break;
|
||||
case RESERVOIR_RATE:
|
||||
case SURFACE_RATE:
|
||||
ctrltype = CS::WellFailure::Type::CtrlRate;
|
||||
ctrltype = CR::WellFailure::Type::CtrlRate;
|
||||
break;
|
||||
default:
|
||||
OPM_THROW(std::runtime_error, "Unknown well control control types for well " << name());
|
||||
@@ -438,7 +438,7 @@ namespace Opm
|
||||
|
||||
std::vector<double> maximum_residual(numWellEq, 0.0);
|
||||
|
||||
ConvergenceStatus report;
|
||||
ConvergenceReport report;
|
||||
// TODO: the following is a little complicated, maybe can be simplified in some way?
|
||||
for (int eq_idx = 0; eq_idx < numWellEq; ++eq_idx) {
|
||||
for (int seg = 0; seg < numberOfSegments(); ++seg) {
|
||||
@@ -452,11 +452,11 @@ namespace Opm
|
||||
// Control equation
|
||||
const double control_residual = abs_residual[seg][eq_idx];
|
||||
if (std::isnan(control_residual)) {
|
||||
report.setWellFailed({ctrltype, CS::Severity::NotANumber, -1, name()});
|
||||
report.setWellFailed({ctrltype, CR::Severity::NotANumber, -1, name()});
|
||||
} else if (control_residual > param_.max_residual_allowed_) {
|
||||
report.setWellFailed({ctrltype, CS::Severity::TooLarge, -1, name()});
|
||||
report.setWellFailed({ctrltype, CR::Severity::TooLarge, -1, name()});
|
||||
} else if (control_residual > param_.tolerance_wells_) {
|
||||
report.setWellFailed({ctrltype, CS::Severity::Normal, -1, name()});
|
||||
report.setWellFailed({ctrltype, CR::Severity::Normal, -1, name()});
|
||||
}
|
||||
} else {
|
||||
// Pressure equation
|
||||
@@ -474,20 +474,20 @@ namespace Opm
|
||||
const double flux_residual = maximum_residual[eq_idx];
|
||||
// TODO: the report can not handle the segment number yet.
|
||||
if (std::isnan(flux_residual)) {
|
||||
report.setWellFailed({CS::WellFailure::Type::Mb, CS::Severity::NotANumber, eq_idx, name()});
|
||||
report.setWellFailed({CR::WellFailure::Type::Mb, CR::Severity::NotANumber, eq_idx, name()});
|
||||
} else if (flux_residual > param_.max_residual_allowed_) {
|
||||
report.setWellFailed({CS::WellFailure::Type::Mb, CS::Severity::TooLarge, eq_idx, name()});
|
||||
report.setWellFailed({CR::WellFailure::Type::Mb, CR::Severity::TooLarge, eq_idx, name()});
|
||||
} else if (flux_residual > param_.tolerance_wells_) {
|
||||
report.setWellFailed({CS::WellFailure::Type::Mb, CS::Severity::Normal, eq_idx, name()});
|
||||
report.setWellFailed({CR::WellFailure::Type::Mb, CR::Severity::Normal, eq_idx, name()});
|
||||
}
|
||||
} else { // pressure equation
|
||||
const double pressure_residual = maximum_residual[eq_idx];
|
||||
if (std::isnan(pressure_residual)) {
|
||||
report.setWellFailed({CS::WellFailure::Type::Pressure, CS::Severity::NotANumber, -1, name()});
|
||||
report.setWellFailed({CR::WellFailure::Type::Pressure, CR::Severity::NotANumber, -1, name()});
|
||||
} else if (std::isinf(pressure_residual)) {
|
||||
report.setWellFailed({CS::WellFailure::Type::Pressure, CS::Severity::TooLarge, -1, name()});
|
||||
report.setWellFailed({CR::WellFailure::Type::Pressure, CR::Severity::TooLarge, -1, name()});
|
||||
} else if (pressure_residual > param_.tolerance_pressure_ms_wells_) {
|
||||
report.setWellFailed({CS::WellFailure::Type::Pressure, CS::Severity::Normal, -1, name()});
|
||||
report.setWellFailed({CR::WellFailure::Type::Pressure, CR::Severity::Normal, -1, name()});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ namespace Opm
|
||||
virtual void updateWellStateWithTarget(WellState& well_state) const;
|
||||
|
||||
/// check whether the well equations get converged for this well
|
||||
virtual ConvergenceStatus getWellConvergence(const std::vector<double>& B_avg) const;
|
||||
virtual ConvergenceReport getWellConvergence(const std::vector<double>& B_avg) const;
|
||||
|
||||
/// Ax = Ax - C D^-1 B x
|
||||
virtual void apply(const BVector& x, BVector& Ax) const;
|
||||
|
||||
@@ -1483,7 +1483,7 @@ namespace Opm
|
||||
|
||||
|
||||
template<typename TypeTag>
|
||||
ConvergenceStatus
|
||||
ConvergenceReport
|
||||
StandardWell<TypeTag>::
|
||||
getWellConvergence(const std::vector<double>& B_avg) const
|
||||
{
|
||||
@@ -1508,9 +1508,9 @@ namespace Opm
|
||||
well_flux_residual[compIdx] = B_avg[compIdx] * res[compIdx];
|
||||
}
|
||||
|
||||
ConvergenceStatus report;
|
||||
using CS = ConvergenceStatus;
|
||||
CS::WellFailure::Type type = CS::WellFailure::Type::Mb;
|
||||
ConvergenceReport report;
|
||||
using CR = ConvergenceReport;
|
||||
CR::WellFailure::Type type = CR::WellFailure::Type::Mb;
|
||||
// checking if any NaN or too large residuals found
|
||||
for (unsigned phaseIdx = 0; phaseIdx < FluidSystem::numPhases; ++phaseIdx) {
|
||||
if (!FluidSystem::phaseIsActive(phaseIdx)) {
|
||||
@@ -1522,11 +1522,11 @@ namespace Opm
|
||||
const int compIdx = Indices::canonicalToActiveComponentIndex(canonicalCompIdx);
|
||||
|
||||
if (std::isnan(well_flux_residual[compIdx])) {
|
||||
report.setWellFailed({type, CS::Severity::NotANumber, compIdx, name()});
|
||||
report.setWellFailed({type, CR::Severity::NotANumber, compIdx, name()});
|
||||
} else if (well_flux_residual[compIdx] > maxResidualAllowed) {
|
||||
report.setWellFailed({type, CS::Severity::TooLarge, compIdx, name()});
|
||||
report.setWellFailed({type, CR::Severity::TooLarge, compIdx, name()});
|
||||
} else if (well_flux_residual[compIdx] > tol_wells) {
|
||||
report.setWellFailed({type, CS::Severity::Normal, compIdx, name()});
|
||||
report.setWellFailed({type, CR::Severity::Normal, compIdx, name()});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1536,16 +1536,16 @@ namespace Opm
|
||||
double control_tolerance = 0.;
|
||||
switch(well_controls_get_current_type(well_controls_)) {
|
||||
case THP:
|
||||
type = CS::WellFailure::Type::CtrlTHP;
|
||||
type = CR::WellFailure::Type::CtrlTHP;
|
||||
control_tolerance = 1.e3; // 0.01 bar
|
||||
break;
|
||||
case BHP: // pressure type of control
|
||||
type = CS::WellFailure::Type::CtrlBHP;
|
||||
type = CR::WellFailure::Type::CtrlBHP;
|
||||
control_tolerance = 1.e3; // 0.01 bar
|
||||
break;
|
||||
case RESERVOIR_RATE:
|
||||
case SURFACE_RATE:
|
||||
type = CS::WellFailure::Type::CtrlRate;
|
||||
type = CR::WellFailure::Type::CtrlRate;
|
||||
control_tolerance = 1.e-4; // smaller tolerance for rate control
|
||||
break;
|
||||
default:
|
||||
@@ -1554,11 +1554,11 @@ namespace Opm
|
||||
|
||||
const int dummy_component = -1;
|
||||
if (std::isnan(well_control_residual)) {
|
||||
report.setWellFailed({type, CS::Severity::NotANumber, dummy_component, name()});
|
||||
report.setWellFailed({type, CR::Severity::NotANumber, dummy_component, name()});
|
||||
} else if (well_control_residual > maxResidualAllowed * 10.) {
|
||||
report.setWellFailed({type, CS::Severity::TooLarge, dummy_component, name()});
|
||||
report.setWellFailed({type, CR::Severity::TooLarge, dummy_component, name()});
|
||||
} else if ( well_control_residual > control_tolerance) {
|
||||
report.setWellFailed({type, CS::Severity::Normal, dummy_component, name()});
|
||||
report.setWellFailed({type, CR::Severity::Normal, dummy_component, name()});
|
||||
}
|
||||
|
||||
return report;
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
#include <opm/autodiff/BlackoilModelParametersEbos.hpp>
|
||||
#include <opm/autodiff/RateConverter.hpp>
|
||||
|
||||
#include <opm/simulators/timestepping/ConvergenceStatus.hpp>
|
||||
#include <opm/simulators/timestepping/ConvergenceReport.hpp>
|
||||
#include <opm/simulators/WellSwitchingLogger.hpp>
|
||||
|
||||
#include<dune/common/fmatrix.hh>
|
||||
@@ -138,7 +138,7 @@ namespace Opm
|
||||
|
||||
virtual void initPrimaryVariablesEvaluation() const = 0;
|
||||
|
||||
virtual ConvergenceStatus getWellConvergence(const std::vector<double>& B_avg) const = 0;
|
||||
virtual ConvergenceReport getWellConvergence(const std::vector<double>& B_avg) const = 0;
|
||||
|
||||
virtual void solveEqAndUpdateWellState(WellState& well_state) = 0;
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef OPM_CONVERGENCESTATUS_HEADER_INCLUDED
|
||||
#define OPM_CONVERGENCESTATUS_HEADER_INCLUDED
|
||||
#ifndef OPM_CONVERGENCEREPORT_HEADER_INCLUDED
|
||||
#define OPM_CONVERGENCEREPORT_HEADER_INCLUDED
|
||||
|
||||
#include <cassert>
|
||||
#include <numeric>
|
||||
@@ -32,7 +32,7 @@ namespace Opm
|
||||
/// Represents the convergence status of the whole simulator, to
|
||||
/// make it possible to query and store the reasons for
|
||||
/// convergence failures.
|
||||
class ConvergenceStatus
|
||||
class ConvergenceReport
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace Opm
|
||||
|
||||
// ----------- Mutating member functions -----------
|
||||
|
||||
ConvergenceStatus()
|
||||
ConvergenceReport()
|
||||
: status_{AllGood}
|
||||
, res_failures_{}
|
||||
, well_failures_{}
|
||||
@@ -90,7 +90,7 @@ namespace Opm
|
||||
well_failures_.push_back(wf);
|
||||
}
|
||||
|
||||
ConvergenceStatus& operator+=(const ConvergenceStatus& other)
|
||||
ConvergenceReport& operator+=(const ConvergenceReport& other)
|
||||
{
|
||||
status_ = static_cast<Status>(status_ | other.status_);
|
||||
res_failures_.insert(res_failures_.end(), other.res_failures_.begin(), other.res_failures_.end());
|
||||
@@ -153,4 +153,4 @@ namespace Opm
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif // OPM_CONVERGENCESTATUS_HEADER_INCLUDED
|
||||
#endif // OPM_CONVERGENCEREPORT_HEADER_INCLUDED
|
||||
Reference in New Issue
Block a user