Skip to content

fix precision issues in interp_2d - #1130

Open
zingale wants to merge 1 commit into
mainfrom
MZ/interp_precision
Open

zingale wants to merge 1 commit into
mainfrom
MZ/interp_precision

Conversation

@zingale

@zingale zingale commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

for the double precision bicub_db, implicit typing was being used resulting in intermediate calculations stored as single precision

for the single precision bicub_sg, 1/36 was stored as an integer, resulting in 0.

Also fix a comment in ferguson that pointed to the wrong interplation when an error was raised.

for the double precision bicub_db, implicit typing was being used
resulting in intermediate calculations stored as single precision

for the dingle precision bicub_sg, 1/36 was stored as an integer,
resulting in 0.

Also fix a comment in ferguson that pointed to the wrong interplation
when an error was raised.
@Debraheem

Debraheem commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Wow, i will have a look soon. Can you check where these splines are called? Does it affect bicubic splines in kap? Much of kap is piped through the bicubic splines...

@zingale

zingale commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator Author

From codex:

The double precision fix affects callers of interp_evbicub_db:

  • Atmosphere tables: temperature and pressure interpolation — table_atm.f90:405 (atm/private/table_atm.f90:405).
  • AESOPUS opacities: opacity and derivatives — kap_aesopus.f90:571 (kap/private/kap_aesopus.f90:571).
  • Carbon/nitrogen enhanced opacities: opacity and derivatives — kapcn.f90:406 (kap/private/kapcn.f90:406).
  • Gravity darkening: Teff and luminosity corrections — gravity_darkening.f90:126 (star/private/gravity_darkening.f90:126).
  • Phase separation: Medin–Cumming composition changes — phase_separation.f90:574 (star/private/phase_separation.f90:574), also line 677.
  • Ionization: charge of Fe56 in He4 — mod_ionization.f90:210 (ionization/private/mod_ionization.f90:210).
  • STELLA: ionization data for Sobolev optical depths — stella_extras.f90:420 (stella/res/stella_extras.f90:420).
  • SCVH EOS table generation: scvh_core.f90:556 (eos/eosDT_builder/src/scvh_core.f90:556).

The single precision fix (1/36) affects:

  • Opacity table preprocessing: ferg_logP.f90:173 (kap/preprocessor/src/ferg_logP.f90:173) and line 188, which interpolate between the log R and log P table representations. Regenerating those tables can therefore change their contents.

@Debraheem

Copy link
Copy Markdown
Member

Oh my!

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants