Skip to content

Add Engle24Auto XUV model with per-timestep dispatch#347

Merged
RoryBarnes merged 1 commit into
mainfrom
EngleAuto
May 27, 2026
Merged

Add Engle24Auto XUV model with per-timestep dispatch#347
RoryBarnes merged 1 commit into
mainfrom
EngleAuto

Conversation

@RoryBarnes
Copy link
Copy Markdown
Collaborator

Introduces a new sXUVModel value, Engle24Auto, that lets vplanet pick between the Engle (2024) Early (M >= 0.4 Msun) and MidLate (M < 0.4 Msun) coefficient sets at every integration timestep based on the current stellar mass. Both coefficient blocks must be set in star.in.

Motivation: when CXUVFC's vconverge runs draw stellar mass from a Gaussian prior that straddles the 0.4 Msun model boundary, every sample should use the calibration that matches its drawn mass. Forcing one model up front biases the posterior for boundary stars (Wolf 327, TOI-406, TOI-2095, TOI-700, TOI-4438) and outright fails for stars whose mean is at or beyond the calibration bound (TRAPPIST-1, M=0.0898; Teegarden, M=0.097; GJ 4274, M=0.18; GJ 3473, M=0.36 sigma=0.016).

Verification bounds: Auto accepts dMass in (0.075, 0.75) Msun -- a 25% extrapolation margin around the calibrated union range [0.1, 0.6] -- and exits beyond that to flag truly unphysical inputs.

Changes:

  • src/stellar.h: define STELLAR_MODEL_ENGLE24AUTO (=9).
  • src/stellar.c: parse "engle24a*" in ReadXUVModel; add VerifyXUVEngleAuto (relaxes VerifyTwoEngleOptionsNotSet, applies the 25% safety bound); dispatch Auto in VerifyXUVEngle and per-timestep in fnPropsAuxStellar based on body[].dMass.
  • tests/Stellar/EngleAutoMidLate/: benchmark test that Auto at M=0.181 reproduces the existing EngleXUV (MidLate) numerics bit-identically, proving correct dispatch in the MidLate regime.
  • tests/Stellar/EngleAutoEarly/: benchmark test at M=0.5 with the full Auto coefficient set populated -- proves correct dispatch in the Early regime. Both test files generated via tests/maketest.py.

Proposed changes

Describe your changes here to communicate to the maintainers the value of this pull request (PR). If it fixes a bug or resolves a feature request, be sure to link to that issue.

Types of changes

What types of changes does your PR introduce to VPLanet?
Put an x in the boxes that apply

  • Bugfix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • New module (non-breaking change that adds a new module)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of the steps that are necessary before merging your PR.

  • I have added tests that prove my fix is effective or that my feature works
  • I have adhered to the Style or run the clang format code shown here
  • I have added necessary documentation (if appropriate)
  • I have run Valgrind on new tests to ensure no errors were found
  • (Optional) I have added an example showcasing the new change

Further comments

If this is a relatively large or complex change, explain why you chose the solution you did, what alternatives you considered, or anything else you believe to be relevant.

Introduces a new sXUVModel value, Engle24Auto, that lets vplanet pick
between the Engle (2024) Early (M >= 0.4 Msun) and MidLate (M < 0.4 Msun)
coefficient sets at every integration timestep based on the current
stellar mass. Both coefficient blocks must be set in star.in.

Motivation: when CXUVFC's vconverge runs draw stellar mass from a
Gaussian prior that straddles the 0.4 Msun model boundary, every sample
should use the calibration that matches its drawn mass.  Forcing one
model up front biases the posterior for boundary stars (Wolf 327,
TOI-406, TOI-2095, TOI-700, TOI-4438) and outright fails for stars
whose mean is at or beyond the calibration bound (TRAPPIST-1, M=0.0898;
Teegarden, M=0.097; GJ 4274, M=0.18; GJ 3473, M=0.36 sigma=0.016).

Verification bounds: Auto accepts dMass in (0.075, 0.75) Msun -- a 25%
extrapolation margin around the calibrated union range [0.1, 0.6] --
and exits beyond that to flag truly unphysical inputs.

Changes:
- src/stellar.h: define STELLAR_MODEL_ENGLE24AUTO (=9).
- src/stellar.c: parse "engle24a*" in ReadXUVModel; add
  VerifyXUVEngleAuto (relaxes VerifyTwoEngleOptionsNotSet, applies the
  25% safety bound); dispatch Auto in VerifyXUVEngle and per-timestep
  in fnPropsAuxStellar based on body[].dMass.
- tests/Stellar/EngleAutoMidLate/: benchmark test that Auto at M=0.181
  reproduces the existing EngleXUV (MidLate) numerics bit-identically,
  proving correct dispatch in the MidLate regime.
- tests/Stellar/EngleAutoEarly/: benchmark test at M=0.5 with the
  full Auto coefficient set populated -- proves correct dispatch in
  the Early regime.  Both test files generated via tests/maketest.py.
@github-actions
Copy link
Copy Markdown

Test Results (ubuntu-24.04 py3.13)

20 103 tests   19 847 ✅  1m 43s ⏱️
     1 suites       0 💤
     1 files       256 ❌

For more details on these failures, see this check.

Results for commit 4cd0940.

@github-actions
Copy link
Copy Markdown

Test Results (ubuntu-24.04 py3.14)

20 103 tests   19 847 ✅  1m 43s ⏱️
     1 suites       0 💤
     1 files       256 ❌

For more details on these failures, see this check.

Results for commit 4cd0940.

@github-actions
Copy link
Copy Markdown

Test Results (ubuntu-24.04 py3.12)

20 103 tests   19 847 ✅  1m 45s ⏱️
     1 suites       0 💤
     1 files       256 ❌

For more details on these failures, see this check.

Results for commit 4cd0940.

@github-actions
Copy link
Copy Markdown

Test Results (ubuntu-22.04 py3.13)

20 103 tests   19 847 ✅  1m 48s ⏱️
     1 suites       0 💤
     1 files       256 ❌

For more details on these failures, see this check.

Results for commit 4cd0940.

@github-actions
Copy link
Copy Markdown

Test Results (ubuntu-24.04 py3.11)

20 103 tests   19 847 ✅  1m 41s ⏱️
     1 suites       0 💤
     1 files       256 ❌

For more details on these failures, see this check.

Results for commit 4cd0940.

@github-actions
Copy link
Copy Markdown

Test Results (ubuntu-24.04 py3.10)

20 103 tests   19 847 ✅  1m 47s ⏱️
     1 suites       0 💤
     1 files       256 ❌

For more details on these failures, see this check.

Results for commit 4cd0940.

@github-actions
Copy link
Copy Markdown

Test Results (ubuntu-24.04 py3.9)

20 103 tests   19 847 ✅  1m 51s ⏱️
     1 suites       0 💤
     1 files       256 ❌

For more details on these failures, see this check.

Results for commit 4cd0940.

@github-actions
Copy link
Copy Markdown

Test Results (ubuntu-22.04 py3.11)

20 103 tests   19 847 ✅  1m 46s ⏱️
     1 suites       0 💤
     1 files       256 ❌

For more details on these failures, see this check.

Results for commit 4cd0940.

@github-actions
Copy link
Copy Markdown

Test Results (ubuntu-22.04 py3.10)

20 103 tests   19 847 ✅  1m 49s ⏱️
     1 suites       0 💤
     1 files       256 ❌

For more details on these failures, see this check.

Results for commit 4cd0940.

@github-actions
Copy link
Copy Markdown

Test Results (ubuntu-22.04 py3.9)

20 103 tests   19 847 ✅  1m 54s ⏱️
     1 suites       0 💤
     1 files       256 ❌

For more details on these failures, see this check.

Results for commit 4cd0940.

@github-actions
Copy link
Copy Markdown

Test Results (ubuntu-22.04 py3.12)

20 103 tests   19 847 ✅  1m 48s ⏱️
     1 suites       0 💤
     1 files       256 ❌

For more details on these failures, see this check.

Results for commit 4cd0940.

@github-actions
Copy link
Copy Markdown

Test Results (ubuntu-22.04 py3.14)

20 103 tests   19 847 ✅  1m 47s ⏱️
     1 suites       0 💤
     1 files       256 ❌

For more details on these failures, see this check.

Results for commit 4cd0940.

@RoryBarnes RoryBarnes merged commit dd55da7 into main May 27, 2026
1 of 44 checks passed
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