Function solve_temperature_from_enthalpy

Source
pub fn solve_temperature_from_enthalpy(
    enthalpy_value: f64,
    pressure: f64,
    x_nacl: f64,
) -> Result<f64, String>
Expand description

Calculate temperature, given composition, pressure and enthalpy

This calculation underlies the pressure-enthalpy flash

Enthalpy is a monotonic function of temperature; a simple bracketing and bisection approach is used where the amount that is bisected is estimated from a limited Newton step, with the derivative estimated from the bracket; a step size limiter of 95% if the bracketed domain is imposed.

§Arguments:

  • enthalpy_value - enthalpy, J/mol
  • pressure - pressure, Pa
  • x_nacl - NaCl mole fraction, mol/mol

§Returns

Temperature, K, or an error