Skip to content

NSE derivatives remain nonzero outside the clamped table domain #2075

Description

@zingale

reproduce.cpp
reproduction-output.txt

Reviewed commit: 3ac0bda4f00da3eed0446beadfc1cd5c51b99a40

Suggested priority: Medium

Affected code: nse_tabular/nse_table.H:402-418, nse_tabular/nse_table.H:496-539, nse_tabular/nse_table.H:549-592.

Description

nse_interp() clamps temperature and density to the table bounds. Outside a bound, the returned composition is constant with respect to that coordinate. The derivative routines also clamp their interpolation coordinates, but return the boundary polynomial slope divided by the original temperature or density instead of zero. This creates an inconsistent EOS Jacobian even with default cubic interpolation.

Reproduction

Using the shipped table, cubic interpolation, and Ye=0.472:

State Reported derivative Centered finite difference
T=3e10, rho=1.23e9 dabar/dT=-1.456288624132152e-13 0
T=5.18e9, rho=2e10 dabar/drho=1.942508832455048e-11 0

Both finite-difference samples remain outside the relevant bound. Temperature and density units are K and g/cm³.

Expected behavior / suggested fix

Return zero for differentiation along a strictly out-of-range coordinate when values use constant extension. Specify the derivative
convention exactly on the boundary. Alternatively, reject out-of-domain evaluations consistently across value and derivative APIs.

Impact and validation: Newton iterations can visit outside the table, where these artificial composition slopes affect their co
rrections. The derivative mismatch is reproduced in output; no convergence failure is attributed specifically to this defect.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    ai-code-auditAI-generated code audit findingsnse

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions