mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-11-25 10:40:21 -06:00
Add object to keep track of penalty cards for convergence monitoring
This commit is contained in:
parent
3acf0cbd14
commit
988ca3aa60
@ -97,4 +97,10 @@ namespace Opm
|
||||
}
|
||||
|
||||
|
||||
std::string to_string(const ConvergenceReport::PenaltyCard& pc)
|
||||
{
|
||||
return fmt::format("PenaltyCard {{ NonConverged: {}, DistanceDecay: {}, LargeWellResiduals: {}, Total: {} }}",
|
||||
pc.nonConverged, pc.distanceDecay, pc.largeWellResiduals, pc.total());
|
||||
}
|
||||
|
||||
} // namespace Opm
|
||||
|
@ -53,6 +53,31 @@ namespace Opm
|
||||
NotANumber = 3,
|
||||
};
|
||||
|
||||
struct PenaltyCard {
|
||||
int nonConverged{0};
|
||||
int distanceDecay{0};
|
||||
int largeWellResiduals{0};
|
||||
|
||||
int total() const {
|
||||
return nonConverged + distanceDecay + largeWellResiduals;
|
||||
}
|
||||
|
||||
PenaltyCard& operator+=(const PenaltyCard& other) {
|
||||
nonConverged += other.nonConverged;
|
||||
distanceDecay += other.distanceDecay;
|
||||
largeWellResiduals += other.largeWellResiduals;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename Serializer>
|
||||
void serializeOp(Serializer& serializer)
|
||||
{
|
||||
serializer(nonConverged);
|
||||
serializer(distanceDecay);
|
||||
serializer(largeWellResiduals);
|
||||
}
|
||||
};
|
||||
|
||||
using CnvPvSplit = std::pair<
|
||||
std::vector<double>,
|
||||
std::vector<int>>;
|
||||
@ -291,6 +316,26 @@ namespace Opm
|
||||
return well_failures_;
|
||||
}
|
||||
|
||||
const PenaltyCard& getPenaltyCard() const
|
||||
{
|
||||
return penaltyCard_;
|
||||
}
|
||||
|
||||
void addNonConvergedPenalty()
|
||||
{
|
||||
penaltyCard_.nonConverged++;
|
||||
}
|
||||
|
||||
void addDistanceDecayPenalty()
|
||||
{
|
||||
penaltyCard_.distanceDecay++;
|
||||
}
|
||||
|
||||
void addLargeWellResidualsPenalty()
|
||||
{
|
||||
penaltyCard_.largeWellResiduals++;
|
||||
}
|
||||
|
||||
Severity severityOfWorstFailure() const
|
||||
{
|
||||
// A function to get the worst of two severities.
|
||||
@ -318,6 +363,7 @@ namespace Opm
|
||||
serializer(this->wellGroupTargetsViolated_);
|
||||
serializer(this->cnvPvSplit_);
|
||||
serializer(this->eligiblePoreVolume_);
|
||||
serializer(this->penaltyCard_);
|
||||
}
|
||||
|
||||
private:
|
||||
@ -332,6 +378,7 @@ namespace Opm
|
||||
bool wellGroupTargetsViolated_;
|
||||
CnvPvSplit cnvPvSplit_{};
|
||||
double eligiblePoreVolume_{};
|
||||
PenaltyCard penaltyCard_;
|
||||
};
|
||||
|
||||
struct StepReport
|
||||
@ -349,6 +396,9 @@ namespace Opm
|
||||
|
||||
std::string to_string(const ConvergenceReport::WellFailure& wf);
|
||||
|
||||
std::string to_string(const ConvergenceReport::PenaltyCard& pc);
|
||||
|
||||
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user