Fix segfault when an ACTIONX block drills a new well - #7258
Open
hnil wants to merge 3 commits into
Open
Conversation
The parallel well bookkeeping is built once, at construction, from
schedule().getWellsatEnd(). A well that WELSPECS creates inside an
ACTIONX block is not in that set, so it has no ParallelWellInfo entry:
- serial: not_on_process_ short-circuits to false, the well enters
wells_ecl_, and createLocalParallelWellInfo dereferences end() -
SIGSEGV in initializeWellPerfData (the assert guarding this is
compiled out in release builds);
- parallel: not_on_process_ reports the well as remote on every rank,
so it is silently dropped from the simulation.
Register the missing wells before the local well structure is built.
The schedule is replicated, so every rank visits the same new wells in
the same order - a requirement for the communicator split in
ParallelWellInfo's constructor. Whether the new well perforates cells
on a rank has to be worked out from the connections, since a well
drilled by an action took no part in the grid partitioning.
Hold the entries by pointer so that adding one does not invalidate the
references handed out to the well container and the well state.
Repro: flow actionx/ACTIONX_WELSPECS.DATA. In parallel the run now
reaches the existing distributed-well diagnostic and completes with
--allow-distributed-wells=true.
The CPRW coarse system reserves one row per well and is sized when the preconditioner is created; the update path then writes a diagonal entry per well into it. A well drilled by an ACTIONX block raises the well count mid-run, so an in-place update wrote past the end of the coarse matrix. There is an assert for exactly this, but it is compiled out in release builds; what remains is a segfault in addWellPressureEquations. Track the well count the solver was built for and force a full rebuild when it changes. With this, actionx/ACTIONX_WELSPECS.DATA runs to completion using the default (CPR) solver, not just with --linear-solver=ilu0.
akva2
reviewed
Jul 31, 2026
| /// \param wname Well name | ||
| /// \return Pointer to the well's information, or nullptr if the well is | ||
| /// not known to the parallel well bookkeeping. | ||
| ParallelWellInfo<Scalar>* findParallelWellInfo(const std::string& wname) const; |
Member
Author
There was a problem hiding this comment.
You mean the return could be a const?
hnil
marked this pull request as ready for review
August 2, 2026 17:22
The lookup itself does not modify anything; only the path that hands the information to initializeWellPerfData() and the well state needs a mutable handle.
Member
Author
|
The mutability is required: The |
hnil
force-pushed
the
bugfix/actionx-new-well-parallel-info
branch
from
August 7, 2026 14:46
323c280 to
8e1b6ea
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two defects hit by
actionx/ACTIONX_WELSPECS.DATA(WELSPECS inside an ACTIONX block):No
ParallelWellInfofor the new well. The parallel well bookkeeping is built once fromschedule().getWellsatEnd(), which does not contain action-created wells. Serial:createLocalParallelWellInfodereferencesend()→ SIGSEGV ininitializeWellPerfData(the guarding assert is compiled out in release). Parallel:not_on_process_reports the well as remote on every rank, so it is silently dropped. Fixed by registering missing wells before the local well structure is built; entries are now held by pointer so adding one does not invalidate references handed out earlier.CPRW coarse system not resized. It reserves a row per well at creation; the well count then grows and the update path writes past the end. Fixed by rebuilding the solver when the well count changes.
Serial run now completes with the default solver; parallel reaches the existing distributed-well diagnostic and completes with
--allow-distributed-wells=true.Note:
udq_actionx/ACTIONX_NE.DATAstill fails, but for an unrelated reason — an OPEN COMPDAT connection in a cell that is not in the simulation grid, at report step 0.