Skip to content

Bug in property calculations for saturated liquid/vapor #920

@ischoegl

Description

@ischoegl

Problem description

The implementation of property calculations for edge cases (saturated liquid / vapor) is incorrect.

Steps to reproduce / Behavior

In [1]: import cantera as ct
   ...: w = ct.Water()
   ...: w.TP
Out[1]: (300.0, 101324.99996785645)

In [2]: w.cp_mass, w.thermal_expansion_coeff, w.isothermal_compressibility
Out[2]: (4180.788860505055, 0.0002739534956286111, 4.5370965768089256e-10)

In [3]: w.TP = 300, w.P_sat + 1 # compressed liquid
   ...: w.cp_mass, w.thermal_expansion_coeff, w.isothermal_compressibility
Out[19]: (4181.302071450938, 0.0002736968713794185, 4.5385398006526666e-10)

In [4]: w.TQ = 300, 0 # saturated liquid
   ...: w.cp_mass, w.thermal_expansion_coeff, w.isothermal_compressibility
Out[4]: (81268775.17346017, 66.66325231711855, 110675.13197217113)

In [5]: w.TQ = 300, 1 # saturated vapor
   ...: w.cp_mass, w.thermal_expansion_coeff, w.isothermal_compressibility
Out[5]: (81266465.29549846, 66.66325263277206, 2.834506650014112)

In [6]: w.TP = 300, w.P_sat - 1 # superheated vapor
   ...: w.cp_mass, w.thermal_expansion_coeff, w.isothermal_compressibility
Out[6]: (1871.4780865974458, 0.0033559522559820127, 0.00028393341634016384)

I.e. values jump to unreasonable values for edge cases (where properties are calculated based on one-sided differentials).

System information

  • Cantera version: 2.5.0b1
  • OS: Ubuntu 18.04
  • Python/MATLAB/other software versions: 3.6.9

Additional context

Documenting another bug found while investigating #907. There is a question whether these properties should be calculated at all (see #919)..

PS: The cv calculation is likewise affected (calculations for saturated mixtures yield unreasonable results).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions