@@ -64,10 +64,13 @@ namespace Opm {
6464
6565
6666 WellSegments::WellSegments (const std::string &wname, double length_top,
67- const std::vector<std::pair<double , double >>& intersections,
67+ const std::vector<std::pair<double , double >>& intersections_md,
68+ const std::vector<std::pair<double , double >>& intersections_tvd,
6869 double diameter, const UnitSystem& unit_system)
6970 {
70- this ->addWellSegmentsFromIntersections (wname, length_top, intersections, diameter, unit_system);
71+ this ->addWellSegmentsFromIntersections (
72+ wname, length_top, intersections_md, intersections_tvd, diameter, unit_system
73+ );
7174 }
7275
7376
@@ -194,7 +197,8 @@ namespace Opm {
194197
195198
196199 void WellSegments::addWellSegmentsFromIntersections (const std::string &wname, double length_top,
197- const std::vector<std::pair<double , double >>& intersections,
200+ const std::vector<std::pair<double , double >>& intersections_md,
201+ const std::vector<std::pair<double , double >>& intersections_tvd,
198202 double diameter, const UnitSystem& unit_system)
199203 {
200204 // Meaningless value to indicate unspecified values.
@@ -221,28 +225,33 @@ namespace Opm {
221225 const double volume = invalid_value;
222226
223227 // If necessary add an extra segment at the top:
224- if (intersections[0 ].first > length_top) {
225- const auto startMD = intersections[0 ].first ;
226- const auto length = (startMD - length_top) / 2.0 + length_top;
227- const auto depth = length;
228+ if (intersections_md[0 ].first > length_top) {
229+ const auto startMD = intersections_md[0 ].first ;
230+ const auto startTVD = intersections_tvd[0 ].first ;
231+ const auto length = 0.5 * (startMD + length_top);
232+ const auto depth = 0.5 * (startTVD + length_top);
228233 const auto outletSegmendID = segmentID - 1 ;
229234 this ->addSegment (
230235 segmentID, branchID, outletSegmendID,
231- length, depth , diameter,
236+ depth, length , diameter,
232237 roughness, area, volume, true ,
233238 0.0 , 0.0
234239 );
235240 segmentID += 1 ;
236241 }
237242
238243 // Add a segment for each cell:
239- for (const auto & [startMD, endMD] : intersections) {
240- const auto length = (endMD - startMD) / 2.0 + startMD;
241- const auto depth = length;
244+ for (auto it_md = intersections_md.begin (), it_tvd = intersections_tvd.begin ();
245+ it_md != intersections_md.end () && it_tvd != intersections_tvd.end ();
246+ ++it_md, ++it_tvd) {
247+ const auto & [startMD, endMD] = *it_md;
248+ const auto & [startTVD, endTVD] = *it_tvd;
249+ const auto length = 0.5 * (startMD + endMD);
250+ const auto depth = 0.5 * (startTVD + endTVD);
242251 const auto outletSegmendID = segmentID - 1 ;
243252 this ->addSegment (
244253 segmentID, branchID, outletSegmendID,
245- length, depth , diameter,
254+ depth, length , diameter,
246255 roughness, area, volume, true ,
247256 0.0 , 0.0
248257 );
0 commit comments