Skip to content

Fix the OmegaIm default: drop the int cast on LargeValue - #63

Draft
aoymt wants to merge 1 commit into
developfrom
fix/omegaim-default
Draft

Fix the OmegaIm default: drop the int cast on LargeValue#63
aoymt wants to merge 1 commit into
developfrom
fix/omegaim-default

Conversation

@aoymt

@aoymt aoymt commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

RFC: this changes a physics-facing default written into
modpara.def; please review the intended behavior before merging.

StdFace_main.c computed the spectrum default as

StdFace_PrintVal_d("OmegaIm", &StdI->OmegaIm, 0.01* (int)StdI->LargeValue);

The (int) cast truncates LargeValue: for LargeValue < 1 the
default collapses to exactly 0, and for any non-integer
LargeValue the presumably intended 0.01 * LargeValue is rounded
down to the previous 0.01 step (e.g. LargeValue = 6.75 gave
OmegaIm = 0.06 instead of 0.0675).

This PR drops the cast and updates the affected reference files.

Impact (measured over the reference suite)

Of the 65 modpara.def references containing OmegaIm:

category count
used the truncated default with non-integer LargeValue → changes 34
integer LargeValue (truncation was a no-op) 24
OmegaIm set explicitly in the input 7

The 34 reference updates touch only the OmegaIm column of the
OmegaMax / OmegaMin lines (69 changed lines total); the base-mode
integration suite passes 94/94 with the fix.

Behavior change

HPhi spectrum / time-evolution runs that relied on the default will see
a slightly larger OmegaIm (or a non-zero one where it used to be 0
for weakly-coupled systems). Users who need the old value can set
OmegaIm explicitly. Suggest a release-note entry.

Notes for reviewers

  • Verified to merge cleanly onto the current develop head (the
    momentum-mode additions to StdFace_main.c do not overlap this
    change); the base-mode suite passes 95/95 on the merged tree.
  • The pytest (3.10) CI job may fail on this branch for an unrelated,
    pre-existing reason (tomllib is Python 3.11+ stdlib; fixed on the
    Python development line). This PR touches only src/ and test/*/ref/.

🤖 Generated with Claude Code

The spectrum default was computed as 0.01 * (int)StdI->LargeValue,
truncating the fractional part of LargeValue: for LargeValue < 1 the
default collapsed to exactly 0, and for any non-integer LargeValue the
intended 0.01 * LargeValue was rounded down to the previous 0.01 step.

Survey over the reference suite (65 modpara.def with OmegaIm): 34 cases
used the truncated default and change; 24 have integer LargeValue
(unchanged); 7 set OmegaIm explicitly (unchanged). The reference files
are updated surgically - only the OmegaIm column of the OmegaMax /
OmegaMin lines changes; base-mode integration passes 94/94.

Behavior change: HPhi spectrum / time-evolution runs that relied on the
truncated default will see a slightly larger OmegaIm (or a non-zero one
where it used to be 0).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

1 participant