Avoid connection depths outside perforated cell.

This commit is contained in:
Vegard Kippe
2023-08-17 11:13:15 +02:00
parent 263070f9b4
commit 4f74385dc0
2 changed files with 8 additions and 3 deletions

View File

@@ -89,9 +89,10 @@ struct Record {
const double segment_depth = segment.depth();
const double segment_distance = segment.totalLength();
// for top segment, no interpolation is needed
// Interpolation with top segment may lead to depths outside of the
// perforated grid cell, so simply stick to grid cell center in this case
if (segment_number == 1) {
center_depth = segment_depth;
center_depth = -1.0;
return;
}

View File

@@ -247,7 +247,11 @@ const std::optional<std::pair<double, double>>& Connection::perf_range() const {
std::size_t compseg_insert_index,
const std::pair<double, double>& perf_range) {
this->segment_number = segment_number_arg;
this->center_depth = center_depth_arg;
// Keep the default (center cell) value unless a positive (hopefully reasonable) value is given
if (center_depth_arg > 0)
{
this->center_depth = center_depth_arg;
}
this->m_sort_value = compseg_insert_index;
this->m_perf_range = perf_range;
}