Skip to content

Debye-Hückel cp calculations incorrect when using variable A_Debye #1500

@speth

Description

@speth

Problem description

When using the mode where A_Debye is a function of T and P, calculations of the constant pressure heat capacity do not satisfy thermodynamic consistency tests.

Steps to reproduce

Create a phase definition by adding the following phase and species definitions to test/data/debye-huckel-all.yaml:

phases:
- name: debye-huckel-B-dot-ak-IAPWS
  elements: [O, H, C, E, Fe, Si, N, Na, Cl]
  species:
  - water_IAPWS: [H2O(L)]
  - species_waterSolution: [Na+, Cl-, H+, OH-, NaCl(aq), NaOH(aq), SiO2(aq),
      NaH3SiO4(aq), H3SiO4-]
  thermo: Debye-Huckel
  activity-data:
    model: B-dot-with-variable-a
    A_Debye: variable
    B_Debye: 3.28640E9 kg^0.5/gmol^0.5/m
    max-ionic-strength: 50.0
    B-dot: 0.041
    default-ionic-radius: 4.0 angstrom
  state: {T: 300.0 K, P: 1.01325e+05 Pa, molalities: {Na+: 9.3549, Cl-: 9.3549, H+: 1.0499e-08,
      OH-: 1.3765e-06, NaCl(aq): 0.98492, NaOH(aq): 3.8836e-06, NaH3SiO4(aq): 6.8798e-05,
      SiO2(aq): 3.0179e-05, H3SiO4-: 1.0231e-06}}

water_IAPWS:
- name: H2O(L)
  composition: {H: 2, O: 1}
  equation-of-state:
    model: liquid-water-IAPWS95

Add a test case to consistency.cpp / consistency-cases.yaml to test the same states that are used for the other Debye-Huckel tests, then run the gtest test suite.

Behavior

The following test output (slightly simplified) shows that the cp calculations are off:

[ RUN      ] DebyeHuckel_b_dot_ak_IAPWS/TestConsistency.cp_eq_dhdT/0
The difference between cp_fd and cp_mid is 605.84843225777149, which exceeds abstol, where
cp_fd evaluates to 3377833.5181276002,
cp_mid evaluates to 3378439.366559858, and
abstol evaluates to 3.3784393665598578.
[  FAILED  ] DebyeHuckel_b_dot_ak_IAPWS/TestConsistency.cp_eq_dhdT/0

[ RUN      ] DebyeHuckel_b_dot_ak_IAPWS/TestConsistency.cp_eq_dhdT/1
The difference between cp_fd and cp_mid is 261.74634717032313, which exceeds abstol, where
cp_fd evaluates to 2365772.22687006,
cp_mid evaluates to 2366033.9732172303, and
abstol evaluates to 2.3660339732172302.
[  FAILED  ] DebyeHuckel_b_dot_ak_IAPWS/TestConsistency.cp_eq_dhdT/1

[ RUN      ] DebyeHuckel_b_dot_ak_IAPWS/TestConsistency.cp_eq_dhdT/2
The difference between cp_fd and cp_mid is 543.4203562955372, which exceeds abstol, where
cp_fd evaluates to 3378542.5882879645,
cp_mid evaluates to 3379086.00864426, and
abstol evaluates to 3.37908600864426.
[  FAILED  ] DebyeHuckel_b_dot_ak_IAPWS/TestConsistency.cp_eq_dhdT/2

[ RUN      ] DebyeHuckel_b_dot_ak_IAPWS/TestConsistency.cp_eq_dhdT/3
The difference between cp_fd and cp_mid is 536.87257880996913, which exceeds abstol, where
cp_fd evaluates to 3378463.8793207705,
cp_mid evaluates to 3379000.7518995805, and
abstol evaluates to 3.3790007518995804.
[  FAILED  ] DebyeHuckel_b_dot_ak_IAPWS/TestConsistency.cp_eq_dhdT/3

[ RUN      ] DebyeHuckel_b_dot_ak_IAPWS/TestConsistency.cp_eq_dsdT_const_p_times_T/0
The difference between cp_fd and cp_mid is 605.77241257159039, which exceeds abstol, where
cp_fd evaluates to 3377833.9096641899,
cp_mid evaluates to 3378439.6820767615, and
abstol evaluates to 3.3784396820767615.
[  FAILED  ] DebyeHuckel_b_dot_ak_IAPWS/TestConsistency.cp_eq_dsdT_const_p_times_T/0

[ RUN      ] DebyeHuckel_b_dot_ak_IAPWS/TestConsistency.cp_eq_dsdT_const_p_times_T/1
The difference between cp_fd and cp_mid is 261.7126909350045, which exceeds abstol, where
cp_fd evaluates to 2365772.3556048786,
cp_mid evaluates to 2366034.0682958136, and
abstol evaluates to 2.3660340682958134.
[  FAILED  ] DebyeHuckel_b_dot_ak_IAPWS/TestConsistency.cp_eq_dsdT_const_p_times_T/1

[ RUN      ] DebyeHuckel_b_dot_ak_IAPWS/TestConsistency.cp_eq_dsdT_const_p_times_T/2
The difference between cp_fd and cp_mid is 543.39873323589563, which exceeds abstol, where
cp_fd evaluates to 3378543.1893083248,
cp_mid evaluates to 3379086.5880415607, and
abstol evaluates to 3.3790865880415604.
[  FAILED  ] DebyeHuckel_b_dot_ak_IAPWS/TestConsistency.cp_eq_dsdT_const_p_times_T/2

[ RUN      ] DebyeHuckel_b_dot_ak_IAPWS/TestConsistency.cp_eq_dsdT_const_p_times_T/3
The difference between cp_fd and cp_mid is 536.85167412599549, which exceeds abstol, where
cp_fd evaluates to 3378464.4802999701,
cp_mid evaluates to 3379001.3319740961, and
abstol evaluates to 3.3790013319740959.
[  FAILED  ] DebyeHuckel_b_dot_ak_IAPWS/TestConsistency.cp_eq_dsdT_const_p_times_T/3

System information

  • Cantera version: main at 13cb334
  • OS: macOS 13.3, though presumably this applies universally

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions