Skip to content

PDSS Water calculation error at 287.9K #577

@ctudpython

Description

@ctudpython

Cantera version

2.4.0

Operating System

Windows 7 (Linux also tested)

Python/MATLAB version

3.6.5 (Anaconda distribution)

Description of the problem

When trying to use the PDSS module for non-ideal mixtures, the calculation of the water density crashes at exactly 287.9 K regardless of the pressure used. Other temperatures work just fine.

A small model to check this is to get the xml file for the solution of NaCl from the repository:
https://github.com/Cantera/cantera/blob/master/test_problems/VCSnonideal/NaCl_equil/HMW_NaCl.xml
and changing a few lines of code (18-23) to disable the solute molalities. We change from:

      <soluteMolalities>
             Na+:6.0954
             Cl-:6.0954
             H+:2.1628E-9
             OH-:1.3977E-6
      </soluteMolalities>

to

      <!--soluteMolalities>
             Na+:6.0954
             Cl-:6.0954
             H+:2.1628E-9
             OH-:1.3977E-6
      </soluteMolalities-->

and we run this small code under jupyter notebook:

import numpy as np
import cantera as ct

liq = ct.Solution('HMW_NaCl.xml', 'NaCl_electrolyte') 
liq.TP = 287.9, 1e5
print(liq.report())

Then, the following error occurs:

CanteraError Traceback (most recent call last)
in ()
1 liq = ct.Solution('HMW_NaCl.xml', 'NaCl_electrolyte')
----> 2 liq.TP = 287.9, 1e5
3 print(liq.report())

interfaces\cython\cantera\thermo.pyx in cantera._cantera.ThermoPhase.TP.set()

CanteraError:


CanteraError thrown by WaterPropsIAPWS::corr:
Error occurred trying to find liquid density at (T,P) = 287.9 1678.12


We tried to track the function which is causing the error by comparing inputs and outputs of the failed iteration (which would work if we call the function separately). We tracked the error to the following files/classes/functions:
1)WaterPropsIAPWS.cpp -> void WaterPropsIAPWS::corr ->densLiq = density(temperature, pressure, WATER_LIQUID, densLiq)
2)WaterPropsIAPWS.cpp -> doublereal WaterPropsIAPWS::density ->m_phi.dfind(p_red, tau, deltaGuess)
3)WaterPropsIAPWSphi.cpp->doublereal WaterPropsIAPWSphi::dfind(doublereal p_red, doublereal tau, doublereal deltaGuess)

And there we did not go deeper. It would give no convergence when called with the previous code, but it would work if we did the calculation alone with the supposed input data of the corresponding failed iteration.

For more data or questions, we would be glad to give/answer them, respectively.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions