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.
opm/simulators/wells/*.cppcurrently contains 140assert(calls.assert()is disabled byNDEBUG, 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_NDEBUGoption, which currently defaults toOFF(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 toON, every one of these 140 checks silently disappears.Proposal: audit the asserts in the well code and split them:
assertOPM_THROWso they hold in release tooAn earlier attempt at this (#4566) targeted
BlackoilModelEbos.hppandAdaptiveTimeSteppingEbos.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.