Commit Graph
216 Commits
Author SHA1 Message Date
Magne Sjaastad ce9ae46a91 #15021: Move completion data export helpers to RicCompletionDataExportTools
Move the COMPDAT/COMPLUMP export and combine helpers, including completionNumberForCell, out of RicWellPathExportCompletionDataFeatureImpl. Remove an unreachable HUGE_VAL branch, fix the combined D-factor divisor and a zero-transmissibility division, and drop unused includes.
2026-10-24 20:30:43 +02:00
Magne Sjaastad 6a15c84463 #13485: Export unique top-level well paths for completions and MSW 2026-10-22 13:34:49 +02:00
Kristian Bendiksen 409f175467 COMPLUMP: Choose completion number by largest overlap in cell
When several perforation intervals cut the same cell, the completion number
was taken from the first contribution, which depended on the order events
were applied. Unrelated event changes (e.g. group tree members) could then
change COMPLUMP numbers on boundary cells.

Pick the number with the largest summed MD overlap in the cell, with ties
going to the lowest number. Also use stable_sort for same-date events so
they keep file order.
2026-10-21 14:43:07 +02:00
Jon Jenssen 5293dbe015 Add preference setting to select which dynamic result to show as default (if available) 2026-10-20 19:02:32 +02:00
Magne Sjaastad c04edc9d39 #14963: Order COMPDAT connections mainbore-first, then laterals
Completions could interleave mainbore and lateral connections, since the
final sort ordered by well name, completion type and measured depth, and
each lateral has its own independent MD scale. Connections for a well's
mainbore should all come before connections for its side steps.

Added RicScheduleDataGenerator::sortCompletionsMainBoreFirst(), which
groups completions by owning well path (via
RigCompletionData::sourcePdmObject()) and emits them in the traversal
order of RimWellPath::allWellPathLaterals(), mainbore first. Sibling
laterals are ordered by tie-in measured depth, as allWellPathLaterals()
itself is not deterministic. The sort is applied in
completionDataForWellPaths() so schedule export, COMPDAT/COMPLUMP export
and the gRPC/Python query all get the same ordering.
2026-10-20 13:06:58 +02:00
Magne Sjaastad 6e8e658f6d #14980: Remove global max segment length from segment collection
The global max segment length no longer exists, so segment subdivision is defined only by the segment intervals.
2026-10-19 21:13:13 +02:00
Kristian Bendiksen 360c3c69db #14684 Simulator Events: Allow schedule generation without a grid case
Grid-dependent keywords (WELSPECS, COMPORD, COMPDAT, COMPLUMP, WELSEGS, COMPSEGS, WSEGVALV, WSEGAICD) are skipped and reported as WARNING comments in the schedule header, so production-data-only setups can still generate DATES and well control keywords.
2026-10-19 12:00:28 +02:00
Kristian Bendiksen c56e921160 #14958 Sim Events: Move PRESSURE_COMPONENTS to WELSPECS
Move Pressure Drop and Length and Depth from the segment collection to
the well path completion settings. PRESSURE_COMPONENTS is now a dated
WELSPECS attribute used for the WELSEGS header at export, and is
rejected on SEGMENT events.
2026-10-19 09:28:29 +02:00
Kristian Bendiksen 2f86d4c210 #14956: Rename well event Tubing to Segment
Rename RimWellEventTubing to RimWellEventSegment (keyword WellEventSegment),
EventType::TUBING to SEGMENT, and the scripting method AddTubingEvent to
AddSegmentEvent (Python: add_segment_event). Update the project tree label,
schedule comments, Python helpers, examples, tests and docs.
2026-10-19 09:28:29 +02:00
Magne Sjaastad 43a4378cee ResInsight: Migrate commands, UI and application code to attribute map 2026-10-17 13:23:22 +02:00
Magne Sjaastad c323846ec5 #13475: Unified LGR completion export tables and single WELSPECL entry per well
* Export LGR completions in single COMPDATL, WPIMULTL and COMPLMPL tables
* Export only first WELSPECL entry per well
* Move LGR test well path to subfolder and format test
2026-10-15 15:25:49 +02:00
Magne Sjaastad 97d132685b #14804: Address review comments on segment placement, ISEG gRPC, min/max validation 2026-10-12 19:12:08 +02:00
Magne Sjaastad d8f346e9ab #14804 MSW export: Segmentation controls per interval and around perforations
Add fixed, min and max segment length per segment interval (fixed is exclusive with min/max, min and max can be combined), connect COMPSEGS rows to the nearest segment node, and add collection options for a single segment before the first and after the last perforation.
2026-10-12 19:12:08 +02:00
Kristian Bendiksen 24e5d2b441 #14870 Schedule export: reject independent trees sharing an MSW name 2026-10-12 18:47:03 +02:00
Kristian Bendiksen f3d9d04281 #14870 Schedule export: export multilateral wells once per well name
Wells sharing an export name now produce one WELSPECS/COMPORD record,
one set of MSW keywords, and no duplicate COMPDAT/COMPLUMP connections.
Events on any well in the group trigger the group's keywords.

Connections in cells shared by several well paths of a group are combined
into one record. MSW keywords are exported for the well tree of the first
group member selected for MSW export.

Fixes #14870
2026-10-12 18:47:03 +02:00
Kristian Bendiksen 164dee3f4b #14873 Schedule export: valve events only emit WSEGVALV/WSEGAICD
VALVE events no longer trigger WELSPECS, COMPORD, WELSEGS and COMPSEGS.
WELSEGS/COMPSEGS are only regenerated for tubing and perforation events.

Fixes #14873
2026-10-12 18:47:03 +02:00
Alif Be 60f96f0ebd #14643: Add blank line after RAW_TEXT 2026-10-12 12:54:20 +02:00
Alif Be 1abff4c0dc Adjust ordering of Flow keywords 2026-10-07 10:48:42 +02:00
Kristian Bendiksen 3046c7e09d #14829: Emit insert-date event comment above DATES keyword
Fixes #14829.
2026-10-02 12:36:54 +02:00
Kristian Bendiksen 9dda0faa3c #14640 Simulator Events: Add menu to export schedule based on events
The schedule generated from the well event timeline can now be written to
file from the GUI, without scripting.

- RicScheduleDataGenerator::generateScheduleForTimeline() collects the dates
  and wells from the timeline (honoring the last applied timestamp, never
  filtering insert-date events). The Python generate_schedule() method now
  calls it, so GUI and Python export the same schedule.
- New RicExportScheduleFeature "Export Schedule from Events" asks only for the
  file name and uses fixed defaults: the Eclipse case of the active view (else
  the first case of the project), MSW keywords for every well with events, the
  first date as a comment and aligned columns.
- Available from the context menu of the well event timeline and the well path
  collection, and from File -> Export, gated by the new experimental feature
  "simulator-events-export".
2026-09-25 14:35:45 +02:00
Kristian Bendiksen 8324af966c #14666 Simulator Events: Expand INSERT_DATE into insert-date events
INSERT_DATE statements are now expanded into one timeline event per
occurrence instead of a list of bare dates, so each generated date keeps
the COMMENT of its statement.

- New RimWellEventInsertDate (EventType::INSERT_DATE): a date-only event
  that generates no keyword, added with
  WellEventTimeline.add_insert_date_event(event_date, comment).
- The schedule generator writes the comment of an insert-date event as
  "--" lines directly below its DATES keyword.
- generate_schedule(_text) no longer takes additional_dates; insert-date
  events are part of the timeline, but keep the previous behavior of not
  being filtered by set_timestamp().
- SimulatorEventsDocument.report_dates and ApplyReport.report_dates are
  replaced by SimulatorEventsDocument.insert_date_events/insert_dates;
  merging files drops insert dates repeating both date and comment.
2026-09-25 14:35:45 +02:00
Kristian Bendiksen afe8f39f6b #14772 Python: Add Reservoir.export_completions as object method and forward exportWellPathCompletions to it
RimEclipseCase_exportCompletions takes WellPath objects (empty list
means all visible well paths) and an explicit export folder, and
exposes all completion export settings. The existing enums
ExportSplit, CompdatExport and PressureDepletionWBHPSource are
registered as Python StrEnums CompletionExportSplit,
CompdatExportType and TransScalingWbhpSource.

RicfExportWellPathCompletions resolves well path names to objects and
the export folder from the command file executor, then forwards to the
object method. Case.export_well_path_completions() in Python is kept
and emits a DeprecationWarning.
2026-09-22 14:19:23 +02:00
Kristian Bendiksen 52e212e24f #14667 Completions: Simplify segment interval properties 2026-09-16 11:35:13 +02:00
Kristian Bendiksen 63bcc22485 #14667 Completions: Move MSW settings to segments 2026-09-16 11:35:13 +02:00
Magne Sjaastad 2120a13d63 #14654 Fix Linux Release build defining NO_DEBUG instead of NDEBUG
* #14654 Fix Linux Release build defining NO_DEBUG instead of NDEBUG

CMAKE_CXX_FLAGS_RELEASE was overwritten with -DNO_DEBUG on Linux in
both CMakeLists.txt and Fwk/CMakeLists.txt. NO_DEBUG is not a standard
macro, so NDEBUG was never defined in Linux Release builds.

As a result, cafAssert.h fell back to CAF_ENABLE_ASSERTS 1, keeping
CAF_ASSERT (and standard assert()) active in Release and aborting the
app, even though RESINSIGHT_ENABLE_ASSERTS_IN_RELEASE defaults to OFF.
Windows and macOS Release builds were unaffected.

Drop the override entirely so CMake supplies its default Release
flags (-O3 -DNDEBUG) on Linux, matching Windows and macOS.

Also simplify CEE_USE_QT5/CEE_USE_QT6 handling: set them directly
instead of via option() with malformed NOT DEFINED(...) guards.

Fixed missing initialization in VfpValueSelection and WellPathCellIntersectionInfo
2026-09-14 14:17:33 +02:00
Kristian Bendiksen 30254df9e9 #14683 Avoid building an Opm::Parser per keyword in schedule generation
Constructing an Opm::Parser populates the complete keyword database (2774
keywords, measured at 2.4 ms per construction) and this was done once per
keyword event in RifEventKeywordFormatter::buildKeyword, and twice more per
keyword in the column-aligned serialisation in RimKeywordFactory. Schedule
generation was therefore completely dominated by parser construction and grew
directly with the number of events on the timeline. Use a single shared parser
instance instead, since the parser is stateless once constructed.

Also compute the events for a date once in generateDateSection and pass them to
the per-well helpers, instead of calling RimWellEventTimeline::getEventsAtDate
four times per well and date, which scaled as dates x wells x events.

Generating a schedule for a production data set with 1737 events over 490 dates
goes from 4.2 s to 0.1 s, and 21000 events over 14 wells now complete in 0.5 s.
2026-09-07 18:58:05 +02:00
Kristian Bendiksen 1336eba81d #14635 Orion Events: Use well name alias for generic keywords 2026-09-01 11:56:59 +02:00
Kristian Bendiksen ebf0ef0cc0 #14637 #14641 Orion Events: Emit END first after date 2026-09-01 11:56:59 +02:00
Magne Sjaastad f8a55787fd #14646 MSW: Number fracture branches by measured depth
The branch number of a fracture followed the order the fractures were created, so appending a second set of fractures to a well put them after the existing ones regardless of where along the well they sit. Sort by the fracture start MD instead. The order also decides which fracture connects a grid cell shared by two of them.
2026-08-31 10:28:41 +02:00
Magne Sjaastad d085f6ce74 #14646 MSW: Report a grid cell only once across COMPSEGS branches
A grid cell has a single COMPDAT connection and must be connected to exactly one segment, but the geometry-based export emitted one COMPSEGS row per branch intersecting the cell. Restore the well-global bookkeeping the removed tree path had: tag each branch with its origin and let the branch carrying most flow claim a shared cell, perforations before fishbones before fractures.
2026-08-31 10:28:41 +02:00
Kristian Bendiksen e1b192ff86 #14570 Orion Events: Fix schedule user metadata 2026-08-24 13:26:19 +02:00
Kristian Bendiksen d6878ea562 #14513 Orion Events: Add raw schedule text events 2026-08-24 13:26:19 +02:00
Kristian Bendiksen db1c1f1f13 #14554 Orion Events: Add WELLSPEC event 2026-08-20 11:02:55 +02:00
Kristian Bendiksen 27b45353ea Orion Events: Add restart schedule cutoff 2026-08-20 11:02:55 +02:00
Kristian Bendiksen 61f615ac4c Orion Events: Preserve event comments 2026-08-20 11:02:55 +02:00
Kristian Bendiksen a362f868c3 Orion Events: Generate COMPORD for new wells 2026-08-20 11:02:55 +02:00
Kristian Bendiksen 0b7ce2252c Orion Events: Add schedule generation metadata 2026-08-20 11:02:55 +02:00
Magne Sjaastad c0ebe1a331 #14496 MSW export: Order COMPSEGS by branch number
The COMPSEGS rows were emitted in the order the branches are listed in, so they followed the WELSEGS order where the completion branches come before the laterals with a lower branch number.

The rows are now collected while the segments are visited and sorted by branch number before they are added. The sort is stable, so the rows of a branch keep their order along the well path.
2026-08-10 09:42:17 +02:00
Magne Sjaastad f796801a7a #14496 MSW export: Assign branch ID to well path laterals before completions
Branch numbers are handed out from two counters. The well path laterals are numbered first, so that the main bore and the laterals occupy the lowest branch numbers. The completion branches (valves, fractures and fishbones) are numbered after all laterals, and are still listed immediately after the lateral they are connected to.

The multiple_laterals test project is reduced to a single Eclipse case, and is used by two new unit tests covering the branch numbers and the order the branches are listed in.
2026-08-10 09:42:17 +02:00
Magne Sjaastad c8e11da3d5 #14252 MSW: Report a grid cell only once in COMPSEGS
When several perforation intervals overlap the same grid cell, the main bore COMPSEGS table emitted one row per interval. Two perforations placed back to back therefore reported the same IJK twice, while COMPDAT correctly reported a single connection for that cell.

The candidate intersections collected for one cell all describe the same IJK, so they are now merged into a single COMPSEGS row spanning the union of the overlapping measured depth ranges.

Add TestModels/msw-export/project-files/perf_two_back_to_back.rsp covering the case.
2026-08-10 09:41:41 +02:00
Magne Sjaastad 1c4c304064 #14476 ApplicationLibCode: Remove unused cvf includes
Remove 95 cvf include lines that the including file does not use. Found by
extracting the symbols declared by every VizFwk header, including symbols they
re-export, and flagging includes where none of those symbols appear anywhere in
the file. Each removal is verified by a full build.

Most of them are cvfVector3.h and cvfObject.h, left behind as the files they
were once needed by changed.

pch.h is left untouched. It includes cvfObject.h and cvfVector3.h on purpose, so
that the files using the precompiled header do not have to.

Note that a clean build after removing an include does not prove the include was
unnecessary, only that the declarations still arrive some other way. That path
can differ between platforms and with RESINSIGHT_ENABLE_UNITY_BUILD, so this
needs a CI round on Linux as well.
2026-08-07 15:05:57 +02:00
Magne Sjaastad 56e98ba1c4 #14476 ApplicationLibCode: Replace CVF_ASSERT with CAF_ASSERT
Migrate all assert macros in ApplicationLibCode to CAF_ASSERT and remove every
use of cvfAssert.h.

CVF_ASSERT is replaced one to one. CVF_TIGHT_ASSERT is also replaced by
CAF_ASSERT, which is semantically exact: CVF_ENABLE_TIGHT_ASSERTS is 1 only
under _DEBUG, and that is what CAF_ASSERT now does. The two CVF_FAIL_MSG sites
become CAF_ASSERT( false && "message" ), preserving the message with the idiom
already used elsewhere in the code base.

Counts before and after: CVF_ASSERT 1044 to 0, CVF_TIGHT_ASSERT 66 to 0,
CVF_FAIL_MSG 2 to 0, cvfAssert.h references 154 to 0.

Include handling: files that included cvfAssert.h directly now include
cafAssert.h instead, includes left dead by the migration are removed, and files
that were relying on cvfAssert.h transitively get an explicit cafAssert.h. Files
that reach cafAssert.h through another caf header are left unchanged; a missing
include here is a compile error, not a silently disabled assert.

ResultStatisticsCache links only LibCore and therefore had no path to
cafAssert.h. Add the cafPdmCore directory as a private include path rather than
linking the library, since cafAssert.h is header only.

Note that this stops these asserts from firing in Release and RelWithDebInfo,
where CVF_ASSERT was previously active.
2026-08-07 15:05:57 +02:00
Magne Sjaastad 827fa64deb #14252 MSW: Name the lateral in the WELSEGS comment line
The first segment of a lateral had its comment cleared when the lateral had a tie-in valve, leaving the rows unlabelled. Write the well path name instead, so the exported segments can be traced back to the lateral they belong to.
2026-08-07 13:29:32 +02:00
Magne Sjaastad 74a6c0827b #14477 MSW: Apply max segment length to fishbones laterals
The geometry path emitted one WELSEGS row per cell intersection of a fishbones lateral, ignoring the max segment length and the custom segment intervals. The tree path split them like every other completion, in collectCompletionWelsegsSegments.

Split each cell intersection with createSubSegmentMDPairs and chain the resulting rows. The lateral geometry is not part of the well path, so the TVD of a sub-segment cannot be interpolated along the well path. Interpolate linearly between the start and end TVD of the intersection instead, as the tree path did for fishbones. The cell is connected by the first sub-segment only, leaving COMPSEGS unchanged, and the lateral label stays on the first row.

An intersection now covers several segment numbers that share one effective diameter, and must still contribute once to the sum for its cell. FishbonesLateralSegment therefore holds the segment numbers of an intersection rather than a single one, and the intersections are grouped per lateral in FishbonesLateral. This replaces the separate list of first and second segment numbers, since the reduction rule is now expressed on the intersections of a lateral.

Verified with a copy of fishbones.rsp with max segment length enforced at 4 m: the three laterals are split into three or four rows each, depths are evenly interpolated, effective diameters are unchanged at 0.01664 and 0.00960, and COMPSEGS is identical. The sweep against TestModels/msw-export is unchanged, as none of the projects enforce a max segment length.
2026-08-07 13:29:32 +02:00
Magne Sjaastad 32850cac9e #14477 MSW: Make the ICD area summation order independent
The summation reproduced the tree implementation, where an ICD sub connected to several cells took part in the sum of each of them, reading areas that earlier cells had already replaced. The result depended on the order the cells were visited in, and an ICD sub could contribute an already combined area to the next cell.

Compute every cell sum from the original areas instead. An ICD sub spans a 0.1 m valve segment and normally connects to a single cell, and when it reaches into more than one it now reports the largest of the sums it takes part in.

Behaviour is unchanged for the common case of one ICD sub per cell, and the sweep against TestModels/msw-export is unaffected. Added tests for the multi-cell case and for independence of the recording order.
2026-08-07 13:29:32 +02:00
Magne Sjaastad cd315870f2 #14477 MSW: Sum WSEGVALV area for fishbones ICD subs sharing a grid cell
The legacy tree path gave every fishbones ICD sub connected to the same grid cell the sum of their areas, so the cell sees the total flow area of the ICDs completing it. That was part of updateDataForMultipleItemsInSameGridCell and disappeared with the rest of the tree code, leaving each ICD sub with its own area.

Record the grid cells each ICD sub connects to while the branches are built, and apply the summation together with the effective diameters. FishbonesDiameterContext now carries both, and is renamed to FishbonesExportContext.

An ICD sub connected to several cells takes part in the sum of each of them and ends up with the value of the last cell in ascending cell order. This is order dependent, and is kept because the tree implementation behaved the same way.

None of the projects in TestModels/msw-export has more than one ICD sub per cell, so the sweep against the stored reference output is unchanged. Added unit tests for applyIcdAreaPerCell and applyEffectiveDiameters instead, since neither function had coverage.
2026-08-07 13:29:32 +02:00
Magne Sjaastad a4713ed43b #14477 MSW: Compute effective diameter for fishbones laterals
The geometry path exported the raw equivalent diameter for every fishbones lateral segment. The legacy tree path replaced it with an effective diameter, computed in updateDataForMultipleItemsInSameGridCell, which was removed together with the rest of the tree code.

Reinstate both rules. Laterals sharing a grid cell get Deff = sqrt(d1^2 + d2^2 + ..) over the lateral segments in that cell (#7686). The first segment of a lateral shares its cell with the main bore and with the first segment of every other lateral on the same sub, so it inherits the effective diameter of the second segment of the same lateral (#7731). A lateral contained in a single grid cell has no second segment and keeps the combined value, which is where the difference from the tree path was most visible.

Lateral segments are recorded while the branches are built, since the grid cell of a segment is not recoverable afterwards. COMPSEGS deduplication clears the cell intersections of segments in an already connected cell. The context is shared by the main bore and all tie-in laterals, and applied once the branches are assembled.

Verified against the twelve projects in TestModels/msw-export: every well with stored reference output now matches the legacy values, including the fishbones laterals that previously differed.
2026-08-07 13:29:32 +02:00
Magne Sjaastad c3801b268e #14477 MSW: Restore diameter and roughness for fishbones ICD subs
The fishbones ICD sub segment left RigMswSegment::diameter and roughness unset, and the formatter renders an empty optional as the 1* default marker. The legacy tree path emitted 0.15 and 5.0e-5 for these rows, taken from the RicMswSegment constructor defaults. RigMswSegment has never had such defaults, so the comment claiming the tree behaviour was matched was wrong.

Set both values explicitly, as buildFractureBranches already does. Verified against TestModels/msw-export/project-files/fishbones.rsp: the ICD sub WELSEGS row again exports 0.15000 and 0.0000500, matching the stored legacy reference output.
2026-08-07 13:29:32 +02:00
Magne Sjaastad 2ac1948abe #14245 Remove gsl functions and ThirdParty/gsl folder 2026-06-24 18:47:04 +02:00
Magne Sjaastad 3ae102ba6c #14241 MSW: Use valve segment MD for ICV COMPSEGS distances
ICV valve COMPSEGS rows used the cell overlap MD range within the valve coverage instead of the valve segment measured depth. The legacy tree export redirected the perforation intersections onto the ICV segment, so their COMPSEGS Start/End Length reflected the valve segment MD range. Restore that behavior by emitting the ICV COMPSEGS with the valve segment MD range while still selecting the overlapping cells. Fixes test_well_events test_wells_only_appear_at_their_event_dates.
2026-06-19 12:50:14 +02:00