Commit Graph
214 Commits
Author SHA1 Message Date
Magne Sjaastad 3e0d2e22ff #14241 MSW: Remove obsolete TODO in buildMswWellExportData
The geometry-based MSW export now handles valve completions, fishbones laterals, fractures and tie-in laterals, so the comment describing these as unimplemented is no longer accurate.
2026-06-19 12:50:14 +02:00
Magne Sjaastad 5afdeac106 #14241 MSW: Update stale comments referencing deleted legacy classes
Remove references to the deleted RicMswItem/RicMswBranch/RicMswSegment tree and the removed collectWelsegsData collection functions from code comments in the geometry-based MSW export path.
2026-06-19 12:50:14 +02:00
Magne Sjaastad 313ed1e4fc #14241 MSW: Remove obsolete legacy MSW code and data structures
Remove the legacy tree-based MSW extraction path now that the geometry-based path is the only supported implementation. This deletes extractSingleWellMsw_Legacy and all unused tree-building helpers in RicWellPathExportMswTableData, trims RicMswTableDataTools to the shared helpers used by the geometry path, and removes the RicMswItem class family (RicMswBranch, RicMswSegment, RicMswCompletions, RicMswExportInfo, RicMswSegmentCellIntersection, RicMswValveAccumulators).

Also remove the useImprovedMswDataStructures preference and its keyword, and delete the obsolete legacy-vs-geometry comparison unit test.
2026-06-19 12:50:14 +02:00
Magne Sjaastad 59af9f51e9 #14153 Guard against empty well path geometry in MSW cell segment generation 2026-06-08 16:16:40 +02:00
Kristian Bendiksen 253d57f1a5 #14121 Well Path: prevent crash when exporting completions for a non-existing well path
When a project references an RMS well path file that no longer exists, the well path geometry is null. The MSW completion export validated the eclipse case, well path, and MSW parameters but not the geometry, so generateCellSegments asserted and crashed when triggering Export Completion Data for Visible Well Paths.

Guard the single MSW export dispatcher extractSingleWellMswData with a well path geometry null check that returns an error, protecting all export callers. Harden generateCellSegments to return empty instead of asserting on null geometry.

Also log a warning on the interactive well path import path when a file cannot be read, matching the existing project-load behavior.

Fixes #14121.
2026-06-08 08:46:40 +02:00
Kristian Bendiksen cbae501a13 #14111 Preserve time-of-day in exported DATES keyword
The Event Timeline stores event timestamps with full time-of-day precision, but the exported SCHEDULE deck only emitted DAY/MONTH/YEAR in the DATES keyword, dropping any sub-day precision the user had set.

Emit the optional TIME field (HH:MM:SS[.SSS]) in datesKeyword() whenever the timestamp is non-midnight, formatting with millisecond precision when present. Date-only events keep their previous DAY/MONTH/YEAR-only output. The first-date comment in the schedule generator mirrors the same time so it stays consistent with the keyword.
2026-06-05 16:21:01 +02:00
Kristian Bendiksen 19c547cc2e Well Event: Add opt-in column-aligned schedule output
Add an align_columns option to schedule generation. When enabled, each
keyword is serialized with a '--'-prefixed column-header comment and data
rows right-aligned into fixed-width columns, instead of the compact default
form. The default output is unchanged.

A new RimKeywordFactory::deckKeywordToAlignedString introspects the OPM deck
model and renders each item in its own column (consecutive defaults are not
collapsed into 'N*'). The flag is threaded through RicScheduleDataGenerator
and exposed on the GenerateSchedule scriptable method as align_columns in the
Python generate_schedule_text wrapper.
2026-06-01 15:45:03 +02:00
Kristian Bendiksen cb9274ecd6 Python: Add first_date_as_comment option to generate_schedule_text
Some commercial simulators reject a DATES keyword whose value equals the
simulation start date. The earliest event date is, by construction, that start
date, so generate_schedule_text now emits it as a comment line (e.g.
"-- Date: 1 JAN 2024") instead of a DATES keyword by default.

The new first_date_as_comment parameter (default True) threads from the Python
wrapper through the GenerateSchedule scriptable method into
RicScheduleDataGenerator. Only the first/earliest date is affected; later dates
are always emitted as DATES keywords. Pass first_date_as_comment=False to
restore the previous behavior.
2026-06-01 11:28:27 +02:00
Kristian Bendiksen 326ae0d719 #14063 Well Event: Sort schedule output by well name
The well list driving schedule generation originates from a
std::set<RimWellPath*>, so it was ordered by pointer address and the
per-well keyword records (WELSPECS, COMPDAT, COMPLUMP, MSW keywords, well
control) came out in a non-deterministic order that only looked sorted by
coincidence.

Sort the well list once by the deck export name in generateSchedule, so
every per-well keyword is emitted in a stable, well-name-sorted order,
matching the convention already used by the file-based completion export.
Schedule-level keywords (GRUPTREE, RPTRST, TUNING) are left untouched.
2026-05-29 15:43:30 +02:00
Kristian Bendiksen 9515e6c277 #13273 Well Event: Support completion number on perforation events for COMPLUMP
Add a completion_number parameter to the add_perf_event Python API
(AddPerfEvent scriptable method) and a matching field on
RimWellEventPerf. When a timeline perforation event is materialised into
a RimPerforationInterval, a non-zero completion number is copied across,
so it flows through the existing completion-data path onto
RigCompletionData.

The schedule generator now emits COMPLUMP alongside COMPDAT: COMPDAT
generation is folded into generateCompletionsForWell, which computes the
completion data once and builds both keywords from it via the existing
RimKeywordFactory::complumpKeyword (added in #13273). COMPLUMP only
produces records for perforations that have a completion number and is
merged across wells like COMPDAT.
2026-05-29 15:43:30 +02:00
Kristian Bendiksen fab4a4c472 #14079 Well Event: Keep WELSEGS and COMPSEGS per-well instead of merging
WELSEGS and COMPSEGS carry a per-well header record followed by that
well's segment records, so segments from different wells cannot share a
single header. Commit 6ef024c merged records of the same keyword across
wells, which is invalid for these two keywords.

Accumulate WELSEGS and COMPSEGS as separate per-well blocks in a
dedicated container and serialise each block individually, while the
remaining keywords (WELSPECS, COMPDAT, WSEGVALV, WSEGAICD, well-control
and schedule keywords) continue to merge. Emission preserves the
existing priority ordering.
2026-05-29 15:43:30 +02:00
Kristian Bendiksen 24269b07d5 #14079 Well Event: Export MSW keywords per well via explicit well list
Replace the include_welsegs / include_compsegs boolean flags on the
schedule-generation API with a list of wells (export_msw_for_wells) that
gates the multi-segment-well keywords. WSEGVALV and WSEGAICD are now gated
the same way as WELSEGS and COMPSEGS: all four are emitted only for wells
present in the list. An empty list (the default) suppresses MSW export for
all wells, while COMPDAT and well-control keywords are unaffected.

C++: RicScheduleDataGenerator takes a std::set<const RimWellPath*> mswWells
and generateMswForWell early-returns for wells not in the set.
RimcWellEventTimeline_generateSchedule replaces the two bool fields with a
scriptable PdmPtrArrayField<RimWellPath*>, resolved via
ptrReferencedObjectsByType().

Python: generate_schedule_text / generate_schedule expose
export_msw_for_wells (List[WellPath]) instead of the boolean flags. Updates
the well_event_schedule example and adds regression tests covering the
empty-list default, per-well selection, and WSEGVALV/WSEGAICD gating.
2026-05-29 15:43:30 +02:00
Kristian Bendiksen 80417b9947 #14064 Well Event: Make WELSEGS and COMPSEGS optional in schedule export
Add include_welsegs and include_compsegs flags (default True, preserving
current behaviour) to the schedule-generation API. Plumbed through
RimcWellEventTimeline_generateSchedule -> RicScheduleDataGenerator ->
generateMswForWell, gating only the WELSEGS / COMPSEGS merge calls.
WSEGVALV and WSEGAICD are unaffected.

Python: generate_schedule_text gains include_welsegs / include_compsegs
keyword arguments that forward to generate_schedule. Callers wanting
control-only / well-header-only schedule updates can now suppress the
verbose MSW table blocks.
2026-05-28 08:21:17 +02:00
Kristian Bendiksen 6ef024cee9 #14063 Well Event: Group records of same keyword across wells
The schedule generator previously concatenated full keyword blocks
(`KEYWORD ... /\n/\n`) — one per well — producing verbose output where
each WELSPECS / COMPDAT / WCONHIST / WELSEGS / COMPSEGS / etc. block
appeared once per contributing well. Eclipse keywords are designed to
hold multiple records under a single header; the per-well repetition is
syntactically valid but bloats the file and obscures intent.

Switch `RicScheduleDataGenerator` to accumulate
`std::map<QString, Opm::DeckKeyword>` instead of raw concatenated text.
Each per-well helper now returns an `Opm::DeckKeyword`, and a new
`mergeKeyword` primitive appends its records into the accumulator entry,
creating the entry from the helper's keyword on first encounter. At
emission time each accumulated keyword is serialised once.

To support this, `RifEventKeywordFormatter` is split: each `format*`
QString function now wraps a corresponding `build*` function that
returns `std::optional<Opm::DeckKeyword>`. `RimWellEventKeyword` and
`RimKeywordEvent` expose a parallel `generateDeckKeyword` accessor.
The text-scraping `extractKeywordName` helper becomes dead code and is
removed.
2026-05-28 08:21:17 +02:00
Magne Sjaastad 071d6cc19e #14050 CMake: Remove dead variable definitions and references
* CMake: Remove dead CODE_HEADER_FILES variable
* CMake: Remove dead COMMAND_CODE_HEADER_FILES and COMMAND_MOC_SOURCE_FILES
* CMake: Remove dead MOC_SOURCE_FILES and FORM_FILES_CPP references
* CMake: Remove dead HEADER_FILES reference
* CMake: Delete unused CustomPCH.cmake superseded by target_precompile_headers
2026-05-26 13:10:20 +02:00
magnesj 86d11f42fd Fixes by codespell 2026-05-22 06:58:22 +02:00
Magne Sjaastad 5691333c61 MSW Export: Add preference for improved MSW data structures and rename extraction methods 2026-05-21 10:12:49 +02:00
Magne Sjaastad dad431edac RicPerforationCellFilterEvaluator: Guard against out-of-range global cell index 2026-05-21 10:12:49 +02:00
Magne Sjaastad 91fed8e48c #14020 Use perforation interval cell filter to limit COMPDAT and MSW export
* Completions: Apply perforation cell filter to COMPDAT and MSW export
* PerforationInterval: Limit Cell Filter dropdown to case-level filters
* PerforationInterval: Prefix Cell Filter entries with case name when multiple cases
* Completions: Use std::format for cell filter suppression log messages
2026-05-20 16:04:40 +02:00
Kristian Bendiksen 5ffcb69acc #13126 RiaLogging: Use std::string_view instead of QString for logging 2026-05-08 10:11:09 +02:00
Kristian Bendiksen bb0afbf962 #13126 RiaLogging: Extract errorInMessageBox to RiuMessageDialog
Move the QMessageBox-displaying helper out of the logging utility into a
dedicated UI class. RiaLogging.h no longer pulls QMessageBox/QWidget into
the ~270 files that include it. Behavior is preserved: showError displays
the dialog when running interactively (and not under regression tests),
then forwards the text to RiaLogging::error.
2026-05-08 10:11:09 +02:00
Magne Sjaastad c82ba05c1b #13876 WellPathGeometry: Return default values instead of assert and crash 2026-04-16 16:43:36 +02:00
Kristian Bendiksen a0dbbf6cb1 Remove deprecated size_t overloads from RigActiveCellInfo
Migrate all callers to use type-safe ReservoirCellIndex and
ActiveCellIndex wrappers, then remove the deprecated isActive(size_t),
cellResultIndex(size_t), and setCellResultIndex(size_t, size_t) methods.
2026-03-31 12:32:05 +02:00
Magne Sjaastad 8d0c3f340b CompletionExport: Add RicMswBranchBuilder and RicWellPathExportMswGeometryPath
Add new MswExport subdirectory with branch builder and geometry path classes
as part of the simplified MSW export approach. Update CMakeLists to include
the new files and add CompletionExportCommands to the include path.
2026-03-27 14:47:32 +01:00
Magne Sjaastad 20052771ad CompletionExport: Simplify findFishboneLateralsWellBoreParts and add unit tests
- Make findFishboneLateralsWellBoreParts public and return result by value
- Move WellBorePartForTransCalc to its own header RicWellBorePartForTransCalc.h
- Replace MSW tree traversal with direct RimFishbones lateral geometry iteration
- Add setSubsOrientationMode() to RimFishbones for deterministic test angles
- Add unit tests validating intersected cells and result values
2026-03-23 10:29:58 +01:00
Magne Sjaastad 83f667cdf8 Replace RimTools::wellPathCollection() with RimWellPathCollection::instance()
Remove the redundant wrapper function and update all call sites to use RimWellPathCollection::instance() directly.
Remove unused #include "RimTools.h" from files using RimWellPathCollection::instance() directly
2026-03-18 13:41:27 +01:00
JJ 24be78f105 Tie-in valve improvements (#13661)
Support (bool, something) pairs as tuples on python side.
Support custom outlet valve md
Add python test for custom outlet valve md
Use tie-in depth as default for custom valve md
Standalone valve creation and display updates
Update MSW valve export
Add valve open/shut flag.
Add python examples
2026-03-06 12:01:14 +01:00
Kristian Bendiksen 21f00ffd0a Order keywords per date by priority in RicScheduleDataGenerator
Refactor generateDateSection to collect keyword output into a map
keyed by keyword name, then emit in a defined priority order
(WELSPECS, COMPORD, GRUPTREE, COMPDAT, etc.) with remaining
keywords appended afterward.
2026-02-20 13:43:58 +01:00
Kristian Bendiksen 3c838e69cd Add WELSPECS keyword to schedule. 2026-02-20 13:43:58 +01:00
Magne Sjaastad 33bf89d196 Dual porosity: Shift K-layer to fracture section for completion export
For dual porosity models, the first N K-layers represent MATRIX and
K-layers N+1 to 2N represent FRACTURE. Shift K to the fracture section
at production points so exported completion data (COMPDAT, WPIMULT,
COMPLUMP, COMPSEGS) references the correct K-layer. Subtract the offset
in LGR bounding box computation where original grid K is needed.
2026-02-20 09:27:20 +01:00
Magne Sjaastad 05623a3fc6 Refactor: Extract RicTransmissibilityCalculator from completion export
Move transmissibility calculation logic (TransmissibilityData,
connection factor computation, non-Darcy flow calculations) from
RicWellPathExportCompletionDataFeatureImpl into a dedicated
RicTransmissibilityCalculator class. Add unit tests for the
extracted calculator.
2026-02-20 09:27:20 +01:00
Magne Sjaastad d52f595c41 Refactor: Rename RiaStatisticsTools to RigStatisticsTools
Replaced all references to RiaStatisticsTools with RigStatisticsTools across the codebase, including header includes, static method calls, and test files. Updated CMake configuration to remove RiaStatisticsTools and add RigStatisticsTools. Renamed and updated related unit tests. No changes to logic or algorithms; this is a namespace and organizational refactor for consistency. Also added ApplicationLibCode include directories as PRIVATE to relevant targets.
2026-02-18 09:22:39 +01:00
Kristian Bendiksen 1ec53cc3f2 #13425 Fix ICD/AICD valve output in schedule generation
ICD valves now produce WSEGVALV and AICD valves now produce WSEGAICD
in the generated schedule. Three root causes were fixed:

- Create per-event valve templates with proper parameters instead of
  reusing default templates that lack orifice diameter and AICD fields
- Use perforation interval range for ICD/AICD valve positioning so
  valveLocations() returns non-empty results for the accumulator
- Add 5 AICD parameter fields to the Python API and event classes
2026-02-12 08:15:22 +01:00
Kristian Bendiksen 82e2dbc434 #13425 Fix WELSEGS date scoping: tubing events only appear at their event dates
Tubing event diameter/roughness values were leaking into earlier date
sections in the generated schedule. The WELSEGS collection functions
did not filter intervals by export date, unlike COMPSEGS and other
keywords which already received the exportDate parameter.

Thread exportDate through collectWelsegsData, collectWelsegsDataRecursively,
and collectWelsegsSegment. Add date-aware overloads of getDiameterAtMD and
getRoughnessAtMD that use isActiveOnDate to filter intervals. Update test
to verify tubing values only appear at their scheduled dates.
2026-02-12 08:15:22 +01:00
Kristian Bendiksen 6782d6a40e Refactor: remove unused code. 2026-02-12 08:15:22 +01:00
Kristian Bendiksen 561006c60c Refactor: Use export date instead of time step for MSW export. 2026-02-12 08:15:22 +01:00
Kristian Bendiksen a4dad97024 #13425 Add time-dependent well events and schedule data generation
Implement timeline-based event system for managing temporal changes in
well completions, perforations, valves, and production controls.

Features:
- Event timeline container with date-based querying
- Six event types: PERF, VALVE, TUBING, WSTATE, WTYPE, WCONTROL
- Schedule keyword generation (DATES, COMPDAT, WELSEGS, WCONPROD, WCONINJE)
- Multi-well schedule generation support
- Python GRPC API for event management
- YAML configuration file support
- Comprehensive test suite

Implementation:
- New directory: ApplicationLibCode/ProjectDataModel/WellEvents/
- Event classes inherit from RimWellEvent base class
- RimWellEventTimeline integrated into RimWellPath
- RicScheduleDataGenerator for multi-well schedule export
- Python API: event_timeline(), add_perf_event(), add_valve_event(), etc.
- Tests verify all event types and YAML config parsing

#13425 Add date tracking to valves and diameter/roughness intervals

Add creation date fields to RimWellPathValve and RimDiameterRoughnessInterval
to support filtering objects by date during completion data export.

- Add m_useCustomStartDate and m_startDate fields
- Add enableCustomStartDate(), setCustomStartDate(), isActiveOnDate() methods
- Set creation dates when applying valve and tubing events in RimWellEventTimeline

#13425 Add date-based filtering for schedule data export

Add optional export date parameter to MSW data collection functions to filter
valves and perforations based on their creation dates during schedule export.

- Add exportDate parameter to collectWsegvalvData, collectWsegAicdData,
  collectWsegSicdData, and collectCompsegData functions
- Filter valves by checking isActiveOnDate() on the associated RimWellPathValve
- Add RimPerforationInterval reference to RicMswPerforation for date filtering
- Pass export date from RicScheduleDataGenerator through the extraction chain

This ensures segment numbers reflect the full model while only including
objects active on the export date in output keywords.

Add test to prove compsegs changes over time.

#13425 Fix mypy type checking errors in well_events.py

- Add type annotations to all function parameters
- Fix generic type hints (dict -> Dict[str, Any])
- Import Any type for proper type safety
- Add type: ignore for method reassignment
- All 31 tests pass

#13425 Add schedule-level keyword events for non-well-specific keywords

Add a new event type called "Keyword Event" for schedule-level Eclipse
keywords (RPTRST, GRUPTREE, RPTSCHED, etc.) that are NOT tied to a
specific well path. This complements the existing RimWellEventKeyword
which operates at the well level.

- Add RimKeywordEvent class inheriting from RimWellEvent with null wellPath
- Add SCHEDULE_KEYWORD enum value to EventType
- Add addKeywordEvent() method to RimWellEventTimeline
- Add AddKeywordEvent Python API method to RimcWellEventTimeline
- Update RicScheduleDataGenerator to output global keywords after well sections
- Add Python wrapper add_keyword_event() with type inference
- Add tests and examples for RPTRST, GRUPTREE keywords
2026-02-12 08:15:22 +01:00
Kristian Bendiksen 3e19046776 Janitor: remove unused code. 2026-02-02 16:49:11 +01:00
JJ 94c3059fd8 Add support for SICD valves (#13496)
* Add SICD parameters
* Add wsegsicd valves to completion export
* Add python method to read template info from valve
* Update tests
2026-01-29 11:16:05 +01:00
Magne Sjaastad d53f71ae45 Add MSW segment support for WELSEGS-based visualization
Introduce RimMswSegment and RimMswSegmentCollection classes to manage and visualize Multi-Segment Well (MSW) segments from Eclipse WELSEGS data. Update WelsegsRow to include source well name for correct segment grouping. Integrate new classes into the build system and UI, enabling accurate 3D well path representation and improved segment management in ResInsight.
2026-01-20 14:13:22 +01:00
Kristian Bendiksen 4650ac0820 MSW Export: fix WELSEGS off-by-one for "join segment". 2025-12-17 16:34:04 +01:00
Kristian Bendiksen da48c78b02 #13316 Custom MSW well segment definitions 2025-12-17 16:34:04 +01:00
Magne Sjaastad 6d480f6012 Add some MSW documentation 2025-12-11 13:43:56 +01:00
Magne Sjaastad 4f53c2692e #13295 Always use grid local IJ for WELSPECS/WELSPECL 2025-12-08 15:22:00 +01:00
JJ 9f17dd81ff Add support for COMPLUMP keyword (#13273)
* Add support for COMPLUMP keyword, both in python interface, file export and opm flow jobs
* Add support for WPIMULT kw in opm flow jobs
* Always provide per connection dFactors in COMPDAT kw (negative value)
* Include LGR support in COMPLUMP file export
2025-12-04 19:25:41 +01:00
Magne Sjaastad a23599cb5d Completion export cleanup
Use MSW as postfix to base name
Drop "Unified" for individual well export
Remove export option Individually/Combined
Remove SPLIT_ON_WELL_AND_COMPLETION_TYPE
2025-12-02 16:03:56 +01:00
Magne Sjaastad 83db509b10 MSW: Make sure extension of custom file name is included 2025-11-25 12:41:20 +01:00
Magne Sjaastad e490d9ef87 Refactors MSW completion data extraction
- redirects export functions to use new MSW extraction code
- removes previous implementation
- fix missing parts of RigMswDataFormatter
2025-11-24 12:47:26 +01:00
Magne Sjaastad 0b74a4accc Removes addOneBasedCellIndex function 2025-11-17 19:45:14 +01:00
Magne Sjaastad 7e299c4841 Add support for more MSW tables in Python
* Use caf::VecIjk0
* Adds MSW tables to the gRPC interface
* Adds unified completion data retrieval
* Add unite tests for MSW data
2025-11-17 11:54:02 +01:00