Skip to content

Reject a missing WCONPROD control mode when a well is first opened - #5259

Open
hnil wants to merge 1 commit into
OPM:masterfrom
hnil:bugfix/wconprod-missing-control-mode
Open

Reject a missing WCONPROD control mode when a well is first opened#5259
hnil wants to merge 1 commit into
OPM:masterfrom
hnil:bugfix/wconprod-missing-control-mode

Conversation

@hnil

@hnil hnil commented Jul 31, 2026

Copy link
Copy Markdown
Member

WCONPROD item 3 can legitimately be defaulted — a well that is not being opened needs no control mode, and a later record that only revises limits keeps the mode the well already has. Opening a well that never got one was accepted in two broken ways:

  • 1* left the mode undefined and the simulator failed every time step with Well control must be specified for well ..., chopped to the minimum step and aborted;
  • `` reached WellProducerCModeFromString() and surfaced as `Internal error: Unknown enum state string:`.

Both are now rejected up front with keyword, file and line. Unknown/unsupported mode strings report the same way instead of as an internal error.

Covers wconprod/WCONPROD-01 .. -12; WCONPROD-00 (which defaults the mode in a later record) still runs. Test added.

Item 3 of WCONPROD may legitimately be omitted: a well that is not being
opened needs no control mode, and a later record that only revises limits
keeps the mode the well already has.  Opening a well that has never been
given one has no meaning, but was accepted in two different broken ways:

  - '1*' left the mode undefined, and the simulator then failed every
    time step with "Well control must be specified for well ...", chopped
    to the minimum step and aborted;
  - '' reached WellProducerCModeFromString(), whose std::invalid_argument
    surfaced as "Internal error: Unknown enum state string:".

Reject both up front, with the keyword, file and line the user can act
on.  Unknown and unsupported mode strings now report the same way rather
than as an internal error.

Covers wconprod/WCONPROD-01 .. -12 in opm-tests.  WCONPROD-00, whose
second record defaults the mode to keep the first record's ORAT, still
runs.
@hnil hnil added the manual:bugfix This PR is a bug fix and should be noted in the manual label Aug 2, 2026
@hnil
hnil marked this pull request as ready for review August 2, 2026 17:22
@hnil
hnil requested review from GitPaean and vkip August 2, 2026 17:22

@vkip vkip left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense and looks good to me.

@akva2

akva2 commented Aug 3, 2026

Copy link
Copy Markdown
Member

jenkins build this please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

manual:bugfix This PR is a bug fix and should be noted in the manual

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants