Skip to content

fix the derivatives of the NSE table when doing trilinear - #2110

Merged
zingale merged 7 commits into
AMReX-Astro:developmentfrom
zingale:fix_linear_derivs
Nov 2, 2026
Merged

zingale merged 7 commits into
AMReX-Astro:developmentfrom
zingale:fix_linear_derivs

Conversation

@zingale

@zingale zingale commented Oct 5, 2026

Copy link
Copy Markdown
Member

the were using the tricubic instead of trilinear code path. We haven't been using the trilinear, but it is good to fix this to be consistent.

the were using the tricubic instead of trilinear code path.
We haven't been using the trilinear, but it is good to fix this
to be consistent.
@zingale zingale added the nse label Oct 6, 2026

@melilly melilly left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code makes sense to me, but I'd like to verify issue #2074 is solved with the change. Can you upload a script or add a test that directly reproduces the discrepancy in the issue?

@zingale

zingale commented Nov 2, 2026

Copy link
Copy Markdown
Member Author

I've added a new test block to the nse_interp_check unit test that exercises the trilinear interpolation in the same way the tricubic is done.

On development (with the wrong derivs for trilinear) we get:

    testing temperature derivatives of linear

        first finite-difference derivatives
            dAbar/dT = -1.097834358e-09
            dbea/dT = -6.968188463e-12

        now using derivative of the interpolant
            dAbar/dT = -1.075182436e-09
            dbea/dT = -6.863845759e-12

    testing density derivatives of linear

        first finite-difference derivatives
            dAbar/drho = 4.095834076e-10
            dbea/drho = 7.893956522e-13

        now using derivative of the interpolant
            dAbar/drho = 3.988138616e-10
            dbea/drho = 7.618659448e-13

so there is differences in the second sig fig for most.

With the changes on this branch, we get:

    testing temperature derivatives of linear

        first finite-difference derivatives
            dAbar/dT = -1.097834358e-09
            dbea/dT = -6.968188463e-12

        now using derivative of the interpolant
            dAbar/dT = -1.097834698e-09
            dbea/dT = -6.968171776e-12

    testing density derivatives of linear

        first finite-difference derivatives
            dAbar/drho = 4.095834076e-10
            dbea/drho = 7.893956522e-13

        now using derivative of the interpolant
            dAbar/drho = 4.095838821e-10
            dbea/drho = 7.893078626e-13

now we see much better agreement.

@zingale
zingale merged commit f0d4129 into AMReX-Astro:development Nov 2, 2026
33 checks passed
@zingale
zingale deleted the fix_linear_derivs branch November 2, 2026 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NSE EOS Jacobians use cubic derivatives when linear interpolation is selected

2 participants