Skip to content

Conversation

@bobmyhill
Copy link
Member

This pull request introduces several improvements and refactors to the nonlinear solver infrastructure and compositional polytope tools, focusing on enhanced convergence control, more robust solution reporting, and improved handling of endmember ordering in compositional simplification. The most significant changes are the introduction of per-component convergence tolerances for nonlinear solvers, a new Solution class for standardized solver results, and logic to preserve endmember order when simplifying composites.

Nonlinear Solver Improvements

  • Added a F_tol parameter for per-component convergence tolerances in both the DampedNewtonSolver class and the damped_newton_solve function, allowing for more precise control over solver termination based on the function residuals. Also implemented a default tolerance generator in default_F_tolerances. [1] [2] [3] [4] [5] [6] [7]
  • The solver now performs an additional convergence check on F(x) using F_tol before declaring success, increasing reliability for equilibrium calculations.

Solution Reporting Refactor

  • Introduced a new Solution class (and supporting Iterates class) to encapsulate solver results, replacing the previous use of SimpleNamespace and namedtuple. This provides a more structured and extensible way to store results and iteration history. [1] [2] [3] [4] [5]
  • Updated all relevant code to use the new Solution object, including iteration storage and output formatting. [1] [2] [3]

Polytope and Compositional Tools

  • Added reorder_to_echelon function and logic in simplify_composite_with_composition to reorder basis matrices to echelon form, helping preserve the order of endmembers in simplified composites. This change is validated by a new test. [1] [2] [3]
  • Updated output files and tests to reflect the new ordering and structure of endmembers in polytopes and simplified composites. [1] [2] [3] [4]

Miscellaneous

  • Minor improvements to benchmarks and output reporting, including more informative print statements when solver fails in check_fig_7_fO2.
  • Refactored the calculation of total atoms in equilibrate for clarity and correctness.

These changes collectively improve the reliability, transparency, and usability of the nonlinear solver and compositional simplification workflow.

@bobmyhill bobmyhill requested a review from Copilot October 11, 2025 14:09
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

This pull request introduces several improvements to the nonlinear solver infrastructure and compositional polytope tools, focusing on enhanced convergence control and more robust solution reporting. The main changes include adding per-component convergence tolerances (F_tol) for nonlinear solvers, replacing SimpleNamespace with a structured Solution class, and implementing logic to preserve endmember ordering in compositional simplification.

  • Added F_tol parameter for per-component convergence tolerances in nonlinear solvers
  • Introduced new Solution and Iterates classes to replace SimpleNamespace for solver results
  • Added endmember ordering preservation in polytope simplification via reorder_to_echelon function

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
burnman/optimize/nonlinear_solvers.py Added Solution/Iterates classes and F_tol convergence checking
burnman/tools/equilibration.py Added default_F_tolerances function and integrated F_tol parameter
burnman/tools/polytope.py Added reorder_to_echelon function to preserve endmember ordering
tests/test_polytope.py Added test for simplified composite endmember order preservation
misc/ref/example_polytopetools.py.out Updated reference output reflecting new endmember ordering
misc/benchmarks/slb_2024_benchmarks.py Added diagnostic output for solver failures
Comments suppressed due to low confidence (1)

burnman/tools/equilibration.py:1

  • The assert statement has been removed without replacement validation logic. Consider adding a warning or raising a more descriptive exception if maxres exceeds the threshold, as this assertion was likely important for detecting convergence issues.
# This file is part of BurnMan - a thermoelastic and thermodynamic toolkit for

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

@geodynamics geodynamics deleted a comment from Copilot AI Oct 11, 2025
@bobmyhill bobmyhill changed the title Add F(x) termination criterion to DampedNewtonSolver Add F(x) termination criterion to DampedNewtonSolver, fix Jacobian for volume constraints Oct 11, 2025
@bobmyhill bobmyhill merged commit 4114dc6 into geodynamics:main Oct 11, 2025
12 checks passed
@bobmyhill bobmyhill deleted the F_tol branch October 11, 2025 15:30
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