Skip to content

Conversation

@bobmyhill
Copy link
Member

@bobmyhill bobmyhill commented Oct 10, 2025

This pull request introduces improvements to the handling of solver tolerances in the equilibration routines, making them more flexible and robust. The changes allow the tolerance parameter (tol) to be specified as either a single float or a per-parameter array, with sensible defaults provided when not specified. The documentation and tests have been updated to reflect and validate these changes.

Enhancements to tolerance handling:

  • The tol parameter in equilibrate and related functions can now be a float or a 1D numpy array, with default tolerances set for each parameter if tol is not provided. This allows for finer control and clearer defaults for pressure, temperature, phase amounts, and compositional vectors. [1] [2] [3]
  • Validation logic in nonlinear_solvers.py ensures that array tolerances are 1D and match the number of parameters, raising informative errors if mismatched.

Documentation and usability improvements:

  • The docstrings for equilibrate and related functions have been updated to clearly describe the new behavior and default values for the tolerance parameter.

Testing and backward compatibility:

  • New tests verify correct error handling for invalid tolerance inputs and ensure that valid cases work as expected.
  • Calls to equilibrate in the SLB2024 benchmark script have been updated to use the new default tolerance behavior, removing explicit tol arguments for simplicity. [1] [2] [3] [4] [5]

@bobmyhill bobmyhill requested a review from Copilot October 10, 2025 12:57

This comment was marked as outdated.

@bobmyhill bobmyhill requested a review from Copilot October 10, 2025 13:27
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@bobmyhill bobmyhill force-pushed the equilibration_tolerances branch from a8919a1 to 5c86daa Compare October 10, 2025 13:29
@bobmyhill bobmyhill merged commit 8277500 into geodynamics:main Oct 10, 2025
12 checks passed
@bobmyhill bobmyhill deleted the equilibration_tolerances branch October 10, 2025 13:53
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