Support solid-solid transitions in element standard-state formation integrals - #186
Open
gaoflow wants to merge 1 commit into
Open
Support solid-solid transitions in element standard-state formation integrals#186gaoflow wants to merge 1 commit into
gaoflow wants to merge 1 commit into
Conversation
The generic standard_state_transitions path in element_standard_state_integral integrated the solid Cp in one piece and ignored solid_T_trans/solid_H_trans, so no element with solid-solid transitions could be expressed. The path now segments the solid integral at each transition temperature and adds the transition enthalpy/entropy when crossed. Activates the commented-out Mn, Ti, Be, and S data (all NIST-JANAF exact); S fixes standard_state_ideal_gas_formation for H2S, SO2, SO3, H2SO4, CS2, and Ti fixes TiO2. Ca and Fe stay commented: Ca's solid Cp fit is ~50% off JANAF, and Fe's Tm value is actually its boiling point. Tests cross-check formation values against the JANAF compound tables and the element paths against JANAF S-001/Mn-001/Ti-001/Be-001.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
standard_state_ideal_gas_formationraisesNotImplementedErrorfor any element outside the20-entry whitelist in
chemical_utils.py. H2S, SO2, SO3, H2SO4, CS2, and TiO2 all crash on ittoday. The whitelist sits right next to six data entries commented out with
# TODO(Mn, Ti,Ca, S, Be, Fe), and an abandoned
elif ele == "S": raise NotImplementedErrorbranch shows thetransition handling was scaffolded and never finished.
Root cause:
element_standard_state_integralintegrates the solid heat capacity in one pieceand ignores the
solid_T_trans/solid_H_transkeys, so no element with solid-solidtransitions could be expressed. The generic path now segments the solid integral at each
transition temperature, adding H_trans to dH and H_trans/T_trans to dS when crossed — the same
formula already used for melt and vaporization. Elements without transitions are unchanged.
Activated Mn, Ti, Be, and S; their commented values are exactly the NIST-JANAF element tables
(S: 368.3 K / 401 J; Mn: 980/1361/1412 K; Ti: 1166 K; Be: 1527 K). Formation values now match
the JANAF compound tables: H2S/SO2/SO3/H2SO4/CS2 and TiO2 within ~1% (tests added, element
paths cross-checked against JANAF S-001/Mn-001/Ti-001/Be-001).
Ca and Fe stay commented: Ca's solid Cp fit in this repo is ~50% off JANAF (the transition
data is right but the integral would be wrong), and Fe's entry has no boiling point — its
Tm: 3133.345is actually the boiling point.Sulfur's 432 K liquid-liquid lambda anomaly (noted in the old branch's comment) is not modeled;
the commented data omits it.
Repro before:
standard_state_ideal_gas_formation(Chemical('H2S'), 400.0)→ NotImplementedError.After: computes, matches JANAF H-080 at 1% rtol.
pytest tests/test_chemical_utils.py32 passed.