Skip to content

140 assert() calls in opm/simulators/wells/ are inactive in release builds #7247

Description

@hnil

opm/simulators/wells/*.cpp currently contains 140 assert( calls. assert() is disabled by NDEBUG, so in any build that defines it these are not checks at all — the conditions they guard simply go unverified in the configuration users actually run.

This interacts with opm-common's WITH_NDEBUG option, which currently defaults to OFF (cmake/Modules/UseOptimization.cmake), i.e. release builds presently keep asserts enabled. That default is itself worth revisiting for performance — but if it is ever flipped to ON, every one of these 140 checks silently disappears.

Proposal: audit the asserts in the well code and split them:

  • genuine internal invariants that cannot be triggered by input — leave as assert
  • conditions reachable from deck input or from solver state — convert to OPM_THROW so they hold in release too

An earlier attempt at this (#4566) targeted BlackoilModelEbos.hpp and AdaptiveTimeSteppingEbos.hpp, which no longer exist; the patch is dead but the problem is not. Raising it as an issue rather than a stale PR so the audit can be scoped properly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions