Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[draft] trying to warn about too big segment depth change #3976

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 19 additions & 0 deletions opm/input/eclipse/Schedule/MSW/WellSegments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include <opm/input/eclipse/Schedule/MSW/WellSegments.hpp>

#include <opm/common/OpmLog/OpmLog.hpp>
#include <opm/input/eclipse/Schedule/MSW/Segment.hpp>
#include <opm/input/eclipse/Schedule/MSW/SICD.hpp>
#include <opm/input/eclipse/Schedule/MSW/Valve.hpp>
Expand Down Expand Up @@ -608,6 +609,24 @@ namespace Opm {
return segment.depth() - outlet_segment.depth();
}

void WellSegments::checkSegmentDepthConsistency(const std::string& well_name) const {
constexpr double limit = 1. + std::numeric_limits<double>::epsilon();
for (const auto& segment : this->m_segments) {
const int segment_number = segment.segmentNumber();
if (segment_number == 1) {
continue; // not totally sure how to handle the top segment yet
}
const double segment_length = this->segmentLength(segment_number);
const double segment_depth_change = this->segmentDepthChange(segment_number);
if (std::abs(segment_depth_change) > limit * segment_length) {
// TODO: output considering UNIT
const std::string msg = fmt::format(" Segment {} of well {} has a depth change of {} meters,"
" while it has a length of {} meters, which is unphysical.",
segment_number, well_name, segment_depth_change, segment_length);
OpmLog::warning(msg);
}
}
}

std::set<int> WellSegments::branches() const {
std::set<int> bset;
Expand Down
2 changes: 2 additions & 0 deletions opm/input/eclipse/Schedule/MSW/WellSegments.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ namespace Opm {
const std::vector<Segment>::const_iterator begin() const;
const std::vector<Segment>::const_iterator end() const;

void checkSegmentDepthConsistency(const std::string& well_name) const;

template<class Serializer>
void serializeOp(Serializer& serializer)
{
Expand Down
9 changes: 9 additions & 0 deletions opm/input/eclipse/Schedule/Schedule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,14 @@ void check_compsegs_consistency(Opm::WelSegsSet& welsegs,
throw Opm::OpmInputError(msg, std::get<1>(difference[0]));
}
}

void check_welsegs_consistency(const std::vector<::Opm::Well>& wells) {
for (const auto& well : wells) {
if (well.isMultiSegment()) {
well.getSegments().checkSegmentDepthConsistency(well.name());
}
}
}
}// end anonymous namespace

namespace Opm
Expand Down Expand Up @@ -608,6 +616,7 @@ void Schedule::iterateScheduleSection(std::size_t load_start, std::size_t load_e
}

check_compsegs_consistency(welsegs_wells, compsegs_wells, this->getWells(report_step));
check_welsegs_consistency(this->getWells(report_step));
this->applyGlobalWPIMULT(wpimult_global_factor);
this->end_report(report_step);

Expand Down