mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Change non-convergence monitor to checking if number of non-converged has increased
This commit is contained in:
parent
cda47a6387
commit
eef0ba50bf
@ -1064,7 +1064,7 @@ namespace Opm {
|
|||||||
report.setReservoirFailed({types[ii], CR::Severity::Normal, compIdx});
|
report.setReservoirFailed({types[ii], CR::Severity::Normal, compIdx});
|
||||||
}
|
}
|
||||||
|
|
||||||
report.setReservoirConvergenceMetric(types[ii], compIdx, res[ii]);
|
report.setReservoirConvergenceMetric(types[ii], compIdx, res[ii], tol[ii]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1113,22 +1113,23 @@ namespace Opm {
|
|||||||
void checkCardPenalty(ConvergenceReport& report, int iteration)
|
void checkCardPenalty(ConvergenceReport& report, int iteration)
|
||||||
{
|
{
|
||||||
if (iteration > 0) {
|
if (iteration > 0) {
|
||||||
const auto& prev_report = convergence_reports_.back().report.back();
|
|
||||||
const auto& prev_metrics = prev_report.reservoirConvergence();
|
|
||||||
const auto& current_metrics = report.reservoirConvergence();
|
const auto& current_metrics = report.reservoirConvergence();
|
||||||
|
|
||||||
auto distances = std::vector<double>(current_metrics.size(), 0.0);
|
auto distances = std::vector<double>(current_metrics.size(), 0.0);
|
||||||
|
int current_above_tolerance = 0;
|
||||||
|
|
||||||
for (size_t i = 0; i < current_metrics.size(); ++i) {
|
for (size_t i = 0; i < current_metrics.size(); ++i) {
|
||||||
distances[i] = std::max(std::log(current_metrics[i].value()), 0.0);
|
distances[i] = std::max(std::log(current_metrics[i].value()), 0.0);
|
||||||
|
// Count number of metrics above tolerance
|
||||||
|
if (current_metrics[i].value() > current_metrics[i].tolerance()) {
|
||||||
|
current_above_tolerance++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (current_metrics[i].type() == prev_metrics[i].type() && current_metrics[i].phase() == prev_metrics[i].phase()) {
|
// Add penalty if number of metrics above tolerance has increased
|
||||||
if (current_metrics[i].value() > prev_metrics[i].value()) {
|
if (current_above_tolerance > prev_above_tolerance_) {
|
||||||
// Metric value has increased, add a penalty card
|
|
||||||
report.addNonConvergedPenalty();
|
report.addNonConvergedPenalty();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
// use L1 norm of the distances vector
|
// use L1 norm of the distances vector
|
||||||
double current_distance = std::accumulate(distances.begin(), distances.end(), 0.0);
|
double current_distance = std::accumulate(distances.begin(), distances.end(), 0.0);
|
||||||
|
|
||||||
@ -1136,6 +1137,7 @@ namespace Opm {
|
|||||||
report.addDistanceDecayPenalty();
|
report.addDistanceDecayPenalty();
|
||||||
}
|
}
|
||||||
prev_distance_ = current_distance;
|
prev_distance_ = current_distance;
|
||||||
|
prev_above_tolerance_ = current_above_tolerance;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (report.wellFailures().size() > 0) {
|
if (report.wellFailures().size() > 0) {
|
||||||
@ -1445,7 +1447,7 @@ namespace Opm {
|
|||||||
double linear_solve_setup_time_;
|
double linear_solve_setup_time_;
|
||||||
ConvergenceReport::PenaltyCard total_penaltyCard_;
|
ConvergenceReport::PenaltyCard total_penaltyCard_;
|
||||||
double prev_distance_ = std::numeric_limits<double>::infinity();
|
double prev_distance_ = std::numeric_limits<double>::infinity();
|
||||||
|
int prev_above_tolerance_ = 0;
|
||||||
public:
|
public:
|
||||||
std::vector<bool> wasSwitched_;
|
std::vector<bool> wasSwitched_;
|
||||||
};
|
};
|
||||||
|
@ -678,7 +678,7 @@ private:
|
|||||||
report.setReservoirFailed({types[ii], CR::Severity::Normal, compIdx});
|
report.setReservoirFailed({types[ii], CR::Severity::Normal, compIdx});
|
||||||
}
|
}
|
||||||
|
|
||||||
report.setReservoirConvergenceMetric(types[ii], compIdx, res[ii]);
|
report.setReservoirConvergenceMetric(types[ii], compIdx, res[ii], tol[ii]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ struct LocalDomainsPartitioningMethod { static constexpr auto value = "zoltan";
|
|||||||
struct LocalDomainsOrderingMeasure { static constexpr auto value = "maxpressure"; };
|
struct LocalDomainsOrderingMeasure { static constexpr auto value = "maxpressure"; };
|
||||||
|
|
||||||
struct ConvergenceMonitoring { static constexpr bool value = false; };
|
struct ConvergenceMonitoring { static constexpr bool value = false; };
|
||||||
struct ConvergenceMonitoringCutOff { static constexpr int value = 30; };
|
struct ConvergenceMonitoringCutOff { static constexpr int value = 6; };
|
||||||
template<class Scalar>
|
template<class Scalar>
|
||||||
struct ConvergenceMonitoringDecayFactor { static constexpr Scalar value = 0.75; };
|
struct ConvergenceMonitoringDecayFactor { static constexpr Scalar value = 0.75; };
|
||||||
|
|
||||||
|
@ -129,13 +129,14 @@ namespace Opm
|
|||||||
// use this for anything else.
|
// use this for anything else.
|
||||||
ReservoirConvergenceMetric() = default;
|
ReservoirConvergenceMetric() = default;
|
||||||
|
|
||||||
ReservoirConvergenceMetric(ReservoirFailure::Type t, int phase, double value)
|
ReservoirConvergenceMetric(ReservoirFailure::Type t, int phase, double value, double tolerance)
|
||||||
: type_(t), phase_(phase), value_(value)
|
: type_(t), phase_(phase), value_(value), tolerance_(tolerance)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
ReservoirFailure::Type type() const { return type_; }
|
ReservoirFailure::Type type() const { return type_; }
|
||||||
int phase() const { return phase_; }
|
int phase() const { return phase_; }
|
||||||
double value() const { return value_; }
|
double value() const { return value_; }
|
||||||
|
double tolerance() const { return tolerance_; }
|
||||||
|
|
||||||
template <typename Serializer>
|
template <typename Serializer>
|
||||||
void serializeOp(Serializer& serializer)
|
void serializeOp(Serializer& serializer)
|
||||||
@ -143,6 +144,7 @@ namespace Opm
|
|||||||
serializer(this->type_);
|
serializer(this->type_);
|
||||||
serializer(this->phase_);
|
serializer(this->phase_);
|
||||||
serializer(this->value_);
|
serializer(this->value_);
|
||||||
|
serializer(this->tolerance_);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -151,6 +153,7 @@ namespace Opm
|
|||||||
ReservoirFailure::Type type_ { ReservoirFailure::Type::Invalid };
|
ReservoirFailure::Type type_ { ReservoirFailure::Type::Invalid };
|
||||||
int phase_ { -1 };
|
int phase_ { -1 };
|
||||||
double value_ { 0.0 };
|
double value_ { 0.0 };
|
||||||
|
double tolerance_ { 0.0 };
|
||||||
};
|
};
|
||||||
|
|
||||||
class WellFailure
|
class WellFailure
|
||||||
|
Loading…
Reference in New Issue
Block a user