Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ChemSage DAT support: parsing heat capacity parameters #401

Open
bocklund opened this issue Mar 22, 2022 · 1 comment
Open

ChemSage DAT support: parsing heat capacity parameters #401

bocklund opened this issue Mar 22, 2022 · 1 comment

Comments

@bocklund
Copy link
Collaborator

bocklund commented Mar 22, 2022

DAT files allow for giving an H298, S298, and Cp polynomial terms to construct the Gibbs energy. When there are multiple temperature intervals, each new interval needs to provide a H_transformation and S_transformation as well as the Cp polynomial terms.

To add parameters specified this way to a pycalphad database, we need to integrate the heat capacity parameters to obtain H and S and combine them to compute (symbolically) G = H - TS that is piecewise in temperature.

Currently, the DAT parser can parse the heat capacity intervals, but will raise an error when converting parsed heat capacity intervals to symbolic piecewise intervals (implementing the pycalphad.io.cs_dat.IntervalCP class). There are two issues at play:

  1. SymEngine does not provide symbolic integration. For the DAT-prescribe polynomial terms (CP_TERMS = (S.Zero, S.One, v.T, v.T**2, v.T**(-2))), we should be able to hardcode analytical antiderivatives of the heat capacity temperature terms (particularly where the power rule does not apply, e.g. the S.One term that gives a T**(-1) term in the entropy integral) as they relate to Gibbs energy. The DAT file also allows users to provide their own coefficient-exponent pairs that we won't be able to hardcode integrals for, but the exponents will be a real number so we should be able to apply the power rule on the exponents and "evaluate" the integrals symbolically by plugging in the integration limits to the hardcoded+power-rule terms.
  2. When there are multiple temperature limits, each temperature limit needs to include the integration of heat capacity terms (and inclusion of transformation enthalpy and entropy) from the preceding intervals. The way the code is written right now, the energy contribution for each temperature interval is computed in isolation. For the Cp-type parameters in the DAT file, each interval would have to know about all the preceding intervals to be able to integrate properly from 298 K up until the temperatures in the current interval. Some things may have to be re-designed a little regarding how piecewise Gibbs energy expressions are constructed.

The DAT file below is mentioned in the ChemApp documentation and has heat capacity terms that can be used for testing

C-N-O                    See commentary below !                GTT  16/09/97
  3   1  28   2
C                        N                        O
     12.0110                  14.0067                  15.9994
  6   1   2   3   4   5   6
  4   1   2   3   4
GAS
IDMX
C
 7 3   1.0   0.0   0.0
 716680.00      158.09900
 3400.0000      20.975300     -.39964699E-03 0.20077000E-06 -3361.3000
0.00000000
 10000.000      23.050699     0.12092100E-03 -.40457500E-08 -17116500.
0.00000000
 20000.000      19.445299     0.30792100E-03 0.36924100E-09 0.11237700E+09
C2
 7 4   2.0   0.0   0.0
 830457.00      197.09500
 500.00000      97.481400     -.16406000     0.11841400E-03 -1381500.0
0.00000000
 4300.0000      30.083500     0.52427799E-02 -.49857601E-06  1737000.0
0.00000000
 12000.000      27.969601     0.38818000E-02 -.19335900E-06  44760100.
0.00000000
 20000.000      86.666603     -.31285000E-02 0.43685599E-07 -.12092200E+10
C3
 7 5   3.0   0.0   0.0
 839958.00      237.61000
 1000.0000      32.215599     0.29097101E-01 -.10668400E-04  200555.00
0.00000000
 2800.0000      59.939800     -.50827898E-02 0.15248399E-05 -5538910.0
0.00000000
 5100.0000     -7.2863898     0.20966399E-01 -.12041700E-05 0.11744000E+09
0.00000000
 8000.0000      60.731098     0.95443502E-02 -.83080499E-06 -.38919699E+09
0.00000000
 10000.000      211.87399     -.18404599E-01 0.61829900E-06 -.16880399E+10
C4
 7 3   4.0   0.0   0.0
 1033920.0      252.85600
 2500.0000      53.395401     0.27995300E-01 -.49561600E-05 -362017.00
0.00000000
 7000.0000      106.17400     -.33283301E-02 0.24180900E-06 -43813500.
0.00000000
 10000.000      92.451797     0.53776300E-03 -.42438199E-07 -15174300.
C5
 7 3   5.0   0.0   0.0
 1050940.0      271.67200
 900.00000      62.971901     0.63403003E-01 -.24581601E-04 -372551.00
0.00000000
 3500.0000      106.59700     0.29567401E-02 -.42434201E-06 -7495690.0
0.00000000
 10000.000      112.17100     0.13222300E-04 -.66332700E-09 -13131600.
CN
 7 6   1.0   1.0   0.0
 440287.00      202.64301
 1000.0000      23.311701     0.13630500E-01 -.36727999E-05  188321.00
0.00000000
 2800.0000      32.865898     0.13884200E-02 0.58599801E-06 -1381760.0
0.00000000
 5500.0000      35.624802     0.45816898E-02 -.44317400E-06 -29864200.
0.00000000
 9800.0000      49.662998     -.10938901E-02 0.10360400E-06 -10523900.
0.00000000
 19000.000      26.034599     0.32982901E-02 -.10904700E-06  86173200.
0.00000000
 20000.000      70.670502     -.40738899E-03 -.23514801E-07 -.17567300E+10
CN2_CNN
 7 2   1.0   2.0   0.0
 633484.00      232.08701
 1500.0000      37.080898     0.24793999E-01 -.59896302E-05 -145473.00
0.00000000
 6000.0000      69.647003     -.18004900E-02 0.13017301E-06 -14647200.
CN2_NCN
 7 3   1.0   2.0   0.0
 500535.00      226.22900
 700.00000      22.682100     0.74644603E-01 -.37100399E-04  68821.203
0.00000000
 1900.0000      65.881699     -.16084200E-03 -.35964300E-06 -4262720.0
0.00000000
 6000.0000      64.095901     -.50357298E-03 0.41227899E-07 -687544.00
C2N_CCN
 7 3   2.0   1.0   0.0
 804806.00      239.02901
 900.00000      36.285400     0.36251500E-01 -.15046300E-04 -105900.00
0.00000000
 5300.0000      59.165699     0.13928399E-02 -.79184099E-08 -3093670.0
0.00000000
 6000.0000      54.098099     0.31922900E-02 -.18162299E-06  8301570.0
C2N_CNC
 7 3   2.0   1.0   0.0
 684924.00      233.81900
 800.00000      35.192699     0.41986100E-01 -.19222200E-04 -85784.703
0.00000000
 4000.0000      60.762402     0.80248498E-03 -.10756100E-06 -3195470.0
0.00000000
 6000.0000      62.406399     -.13479100E-04 0.10161200E-08 -5052510.0
CNO
 7 3   1.0   1.0   1.0
 177496.00      232.38100
 900.00000      30.857500     0.41810598E-01 -.16743699E-04 -154913.00
0.00000000
 3300.0000      58.688599     0.19923300E-02 -.29848300E-06 -4462280.0
0.00000000
 6000.0000      62.265900     0.21348900E-04 -.14226700E-08 -7807020.0
CNO_NCO
 7 3   1.0   1.0   1.0
 159410.00      232.22099
 800.00000      28.862801     0.47146101E-01 -.20431900E-04 -92762.602
0.00000000
 2000.0000      53.999100     0.63656601E-02 -.13898500E-05 -3099870.0
0.00000000
 6000.0000      63.381302     -.60019898E-03 0.92913197E-07 -8626740.0
CO
 7 3   1.0   0.0   1.0
-110529.00      197.66499
 800.00000      25.846201     0.65631098E-02 0.98167504E-06  111208.00
0.00000000
 2200.0000      29.936600     0.54106200E-02 -.10533500E-05 -1082960.0
0.00000000
 6000.0000      37.175900     0.20404700E-03 0.38694901E-08 -5448030.0
CO2
 7 4   1.0   0.0   2.0
-393510.00      213.78300
 900.00000      29.329599     0.39927199E-01 -.14750300E-04 -248862.00
0.00000000
 2700.0000      54.438499     0.51133898E-02 -.80510500E-06 -4358740.0
0.00000000
 7600.0000      76.003403     -.52149598E-02 0.64008100E-06 -35080900.
0.00000000
 10000.000     -85.621300     0.24522400E-01 -.90525100E-06 0.14018900E+10
C2O
 7 3   2.0   0.0   1.0
 291043.00      233.60800
 1000.0000      37.785702     0.29073700E-01 -.94620900E-05 -225213.00
0.00000000
 3500.0000      56.629601     0.52282899E-02 -.59135601E-06 -4096730.0
0.00000000
 6000.0000      68.436699     0.97912597E-03 -.14914700E-06 -32900900.
N
 7 2   0.0   1.0   0.0
 472687.00      153.29800
 2950.0000      20.893900     -.16910399E-03 0.60112100E-07 -5577.5698
0.00000000
 6000.0000      16.376101     0.45674801E-03 0.16739800E-06  15118200.
N2
 7 3   0.0   2.0   0.0
0.00000000      191.61099
 800.00000      27.223301     0.25198299E-02 0.32362900E-05  76653.398
0.00000000
 2200.0000      28.423800     0.63785501E-02 -.12398300E-05 -833938.00
0.00000000
 6000.0000      37.550098     0.12318000E-04 0.25352801E-07 -6855020.0
N3
 7 3   0.0   3.0   0.0
 436000.00      223.06599
 800.00000      24.401800     0.50211601E-01 -.20478799E-04 -123306.00
0.00000000
 2200.0000      52.349899     0.71044699E-02 -.14389200E-05 -3738980.0
0.00000000
 6000.0000      61.964901     0.11107600E-03 -.88627798E-08 -9309660.0
NO
 7 5   0.0   1.0   1.0
 91277.000      210.74500
 1300.0000      23.051201     0.15473500E-01 -.47752401E-05  233303.00
0.00000000
 5500.0000      37.556301     -.51918800E-04 0.60612400E-07 -3986150.0
0.00000000
 9800.0000      13.212000     0.37948100E-02 -.64632999E-07 0.20715299E+09
0.00000000
 14500.000      4.4607501     0.72746398E-02 -.28647401E-06 -.18147400E+09
0.00000000
 20000.000      170.93600     -.86434204E-02 0.14216199E-06 -.56028498E+10
NO2
 7 3   0.0   1.0   2.0
 34193.000      240.16600
 800.00000      22.650000     0.52844901E-01 -.22859200E-04  70594.102
0.00000000
 2400.0000      54.239700     0.28189200E-02 -.15991800E-06 -3832450.0
0.00000000
 6000.0000      46.444000     0.47797300E-02 -.96086502E-07  11854400.
NO3
 7 3   0.0   1.0   3.0
 71128.000      252.62199
 600.00000      13.982300     0.14200200     -.87225097E-04 -143564.00
0.00000000
 1300.0000      69.838501     0.14972700E-01 -.48511401E-05 -3489250.0
0.00000000
 6000.0000      82.856201     0.95063398E-04 -.83041503E-08 -6635110.0
N2O
 7 3   0.0   2.0   1.0
 81600.000      220.00500
 900.00000      31.214800     0.38315602E-01 -.14092900E-04 -246006.00
0.00000000
 2900.0000      55.975101     0.42720600E-02 -.57106701E-06 -4357220.0
0.00000000
 6000.0000      62.137299     0.62846800E-03 0.26556201E-07 -9580270.0
N2O3
 7 3   0.0   2.0   3.0
 86631.000      314.73401
 900.00000      56.690399     0.62969401E-01 -.25171499E-04 -45424.500
0.00000000
 3600.0000      100.38500     0.13410100E-02 -.55178301E-07 -6993170.0
0.00000000
 6000.0000      93.545403     0.34843700E-02 -.22545800E-06  10275000.
N2O4
 7 3   0.0   2.0   4.0
 11110.000      304.44501
 700.00000      54.510300     0.12472000     -.61755600E-04 -627855.00
0.00000000
 2400.0000      121.09400     0.57820301E-02 -.11838400E-05 -7002920.0
0.00000000
 6000.0000      128.78999     0.22902101E-04 -.17693800E-08 -10930000.
N2O5
 7 3   0.0   2.0   5.0
 13300.000      355.71701
 800.00000      76.767700     0.10727900     -.47430101E-04 -820876.00
0.00000000
 3000.0000      141.33299     0.50176601E-02 -.83227502E-06 -8874420.0
0.00000000
 6000.0000      149.48500     0.40587100E-04 -.27888700E-08 -15036600.
O
 7 2   0.0   0.0   1.0
 249174.00      161.06000
 2950.0000      21.015600     -.25374099E-03 0.73878802E-07  85794.203
0.00000000
 6000.0000      17.211901     0.10827100E-02 -.45871200E-07  7946340.0
O2
 7 5   0.0   0.0   2.0
0.00000000      205.14700
 900.00000      22.258600     0.20477301E-01 -.80396803E-05  153499.00
0.00000000
 3700.0000      33.557301     0.24697999E-02 -.10016600E-06 -1079770.0
0.00000000
 9600.0000      24.479799     0.52695200E-02 -.36092700E-06  30241900.
0.00000000
 18500.000      87.561401     -.51574502E-02 0.11272600E-06 -.58104998E+09
0.00000000
 20000.000      63.737000     -.28750000E-02 0.54000001E-07 -.50307798
O3
 7 7   0.0   0.0   3.0
 141800.00      239.00500
 700.00000      27.581200     0.55261500E-01 -.27632401E-04 -199061.00
0.00000000
 1300.0000      60.102901     -.41291201E-02 0.31049201E-05 -3144350.0
0.00000000
 2100.0000      134.37000     -.79414703E-01 0.24627499E-04 -24724500.
0.00000000
 2800.0000     -421.20001     0.25682199     -.32686101E-04 0.42609699E+09
0.00000000
 3500.0000     -223.44400     0.18447199     -.25841100E-04  43179700.
0.00000000
 4900.0000      764.84302     -.19705500     0.15587100E-04 -.19221700E+10
0.00000000
 6000.0000      149.96100     -.25671501E-01 0.21330600E-05 0.43400000E+09
C_DIAMOND_A4
 4 1   1.0   0.0   0.0
 6000.0000     -16359.441      175.61000     -24.310000     -.47230000E-03
0.00000000      2698000.0
2 -.26100000E+09  -2.0 0.11100000E+11  -3.0
C
 7 3   1.0   0.0   0.0
0.00000000      5.6859999
 800.00000     -3.0257599     0.47484200E-01 -.23528601E-04 -45617.301
0.00000000
 1900.0000      20.021799     0.48779999E-02 -.11859501E-05 -2133160.0
0.00000000
 6000.0000      25.499001     -.19641699E-03 0.95123198E-07 -3795520.0
#############################################################################

Date           : 16.09.1997
Originator     : KH
Serial No      : CNO.DAT
Quality Status : A
ChemSage Vers. : 4.0

Temperatures   : All
Compositions   : All
Applications   : Combustion equilibria and thermodynamic properties of
                 the gas species and condensed phases.


Sources of data

Unary          : 96SGT and 91Din
Binary         : None

References     : 91Din  Dinsdale,A.T. CALPHAD 15(4), 1991, 317-427
                 96SGT  SGTE Pure Substance database, Edition 1996

###########################################################################
@maxposchmann
Copy link

FWIW, I've literally never seen this used in practice in a DAT file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants