Skip to content

fix: SurfaceGenerator crash when wells are present - #4169

Open
npillardou wants to merge 5 commits into
developfrom
fix/npillardou/surfaceGeneratorWells
Open

npillardou wants to merge 5 commits into
developfrom
fix/npillardou/surfaceGeneratorWells

Conversation

@npillardou

@npillardou npillardou commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Running a case that combines a SurfaceGenerator with wells crashes during the fracturing step:

SurfaceGenerator::findFracturePlanes → getSubRegion
Error cause: castedChild == nullptr (…/wellRegion/elementSubRegions/wellRegionUniqueSubRegion)

Wells register their own nodes and elements in the node-to-element maps
(WellElementSubRegion::updateNodeManagerNodeToElementMap). SurfaceGenerator assumes every
entry of these maps is a 3D cell and casts it to CellElementSubRegion. That cast throws as soon
as the mesh contains a WellElementRegion.

Changes

SurfaceGenerator.cpp

  • Add a small helper, getCellSubRegion, that returns nullptr for non-cell entries (e.g. well
    elements).
  • Skip these entries in findFracturePlanes, mapConsistencyCheck, calculateNodeAndFaceSif
    and calculateElementForcesOnEdge.
  • Never split a node that is attached only to non-3D elements.
  • In calculateNodeAndFaceSif, average the elastic moduli over cell elements only. Before, the
    sum was divided by the total number of node-to-element entries, wells included.

The other CellElementSubRegion casts in this file go through the face-to-element maps, where
wells never appear, so they are left unchanged.

New integrated test: ALM_inclinedFault_ISG_well_smoke

This is ALM_inclinedFault_ISG_smoke, with the injection done through a well instead of a
pressure prescribed on a whole block:

  • SinglePhaseReservoirPoromechanicsConformingFracturesALM + SinglePhaseReservoir + WellManager.
  • One vertical BHP-controlled injector (55 MPa), perforated at mid-thickness of reservoir block 97.
  • The reservoir blocks (96, 97) get a higher permeability (1e-13 m²) than the over- and
    underburden (1e-18 m²).
  • The fault pressure is initialized to 35 MPa right after fracturing with a FieldApplicator.
    It is not prescribed, so it can evolve with the injection.

Input refactoring

  • prescribedFaultPressure moved from ALM_inclinedFault_base.xml to the four cases that
    include it (ISG, ISG_DruckerPrager, ESG, ESG_friction_cohesion). The definition is
    unchanged.
  • Reason: the well case must not have this Dirichlet condition on the fault pressure, and an
    included file cannot override it.

Testing

  • Reproducer: without this fix, ALM_inclinedFault_ISG_well_smoke crashes at cycle 0 with
    the error above.
  • With the fix: the case runs on 1 and 4 MPI ranks (~52 s serial, ~18 s on 4 ranks).
  • Splitting: identical to the case without a well, both with 468 split nodes and 310 fault
    elements.
  • The four existing ISG/ESG cases: logs are identical before and after the
    prescribedFaultPressure move (time steps, fracture states, ALM convergence, linear iterations
    and residuals).

Notes

  • A new baseline is needed for ALM_inclinedFault_ISG_well_smoke.
  • Found while setting up the test, not fixed here: in FieldApplicator, the targetRegions
    filter never matches. It compares subRegion.getParent().getName() to the region name, but the
    parent of a sub-region is the elementSubRegions group. The new test does not set
    targetRegions. The specification's objectPath already targets the fault.

@npillardou npillardou added type: bug Something isn't working flag: ready for review flag: requires rebaseline Requires rebaseline branch in integratedTests ci: run integrated tests Allows to run the integrated tests in GEOS CI ci: run code coverage enables running of the code coverage CI jobs ci: run device builds Allows to run the device (CUDA/HIP) builds labels Oct 22, 2026
@victorapm
victorapm self-requested a review October 22, 2026 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci: run code coverage enables running of the code coverage CI jobs ci: run device builds Allows to run the device (CUDA/HIP) builds ci: run integrated tests Allows to run the integrated tests in GEOS CI flag: ready for review flag: requires rebaseline Requires rebaseline branch in integratedTests type: bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants