Skip to content

FIX: Fix fraction of solid when multiple solids are forming - #65

Merged
bocklund merged 2 commits into
pycalphad:masterfrom
bocklund:fix-multiphase-fraction-solid
Oct 21, 2026
Merged

bocklund merged 2 commits into
pycalphad:masterfrom
bocklund:fix-multiphase-fraction-solid

Conversation

@bocklund

Copy link
Copy Markdown
Collaborator

When more than one solid formed during Scheil solidification simulations, fraction of solid was updated in a way that double counted the current_fraction_solid (the amount of solid accumulating in each time step). This PR makes the fix suggested in #64 and adds a test using pure solids that where the fractions of solid, liquid, and phase compositions can be known exactly.

Closes #64.

Thanks to @BRZ1028 for reporting!

…ing the step

Each step equilibrates the remaining liquid, so each solid phase forms
(1 - fs at the start of the step) * NP(phase). The fraction solid was
updated inside the loop over stable phases, so every solid phase after the
first was scaled by liquid already reduced by the previous phases. When two
or more solid phases formed in one step, this undercounted the solid, broke
mass balance, and made per-phase amounts depend on phase order.

Add a test against the exact Scheil solution for an ideal liquid with
pure-element solids, which goes through ALPHA + BETA forming together, and
a mass balance test on the Chen A-B-C ternary monovariant.

Reported in pycalphad#64.
@bocklund bocklund changed the title FIX: Fix fraction of solid when multilpe solids are forming FIX: Fix fraction of solid when multiple solids are forming Oct 21, 2026
GitHub Actions runners now use ubuntu-26.04 instead of ubuntu-24.04. System Python is upgraded from 3.12 to 3.14 and scheil depends on PyCalphad, which only installs well on <=3.13 right now because its symengine pin on 0.13 doesn't have 3.14+ wheels. This causes our smoke tests and doc builds to fail in CI. This pins the Python version for smoke tests and doc builds in CI, following pycalphad/pycalphad#748.
@bocklund
bocklund merged commit a7c488a into pycalphad:master Oct 21, 2026
10 checks passed
@bocklund
bocklund deleted the fix-multiphase-fraction-solid branch October 21, 2026 18:35
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.

simulate_scheil_solidification undercounts the solid when several solid phases are stable in one step

1 participant