Skip to content

Thermodynamic and physical properties

Even Solbraa edited this page May 16, 2019 · 7 revisions

See the example script GasFlashProperties.m. The script illustrates how to set up a fluid, calculate various properties, perform flashes at constant temperature and pressure (PT-flash), flashes at constant enthalpy and pressure (PH-flash), flashes at constant entropy and pressure (PS-flash).

1. Calculation of properties of a fluid.

Physical properties (viscosity, thermal conductivity) are calculated using fluid.initPhysicalProperties(). Thermodynamic properties of a fluid are calculated calling the fluid.init(2) method, and can then be read using the functions:

`enthalpy = fluid.getEnthalpy();`
`entropy = fluid.getEntropy();`
`numberOfPhases = fluid.getNumberOfPhases();`
`mixMolarVolume =  1.0 / fluid.getDensity("mol/m3"); `
`mixDensity = fluid.getDensity("kg/m3");`
`mixZfactor = fluid.getZ();`
`mixEnthalpy = fluid.getEnthalpy("Jmol");`
`mixEntropy = fluid.getEntropy("JmolK");`
`mixCp = fluid.getCp("J/molK");`
`mixCv = fluid.getCv("J/molK");`
`mixKappa = fluid.getKappa();`
`mixViscosity = fluid.getViscosity("kg/msec");`
`mixThermalConductivity = fluid.getConductivity("W/mK");`

2. Calculation of properties for a given phase of a fluid.

Thermodynamic properties of a phase in a fluid are calculated when calling the fluid.init(2) method, and can then be read using the functions listed below. Valid phase names are: "gas", "oil", "aqueous".

    `phaseNumber = fluid.getPhaseNumberOfPhase("gas");`
    `gasFractionc(c) = fluid.getMoleFraction(phaseNumber) * 100; `
    `gasMolarVolume(c) = 1.0 / fluid.getPhase(phaseNumber).getDensity("mol/m3");`
    `gasVolumeFraction(c) = fluid.getCorrectedVolumeFraction(phaseNumber) * 100; `
    `gasDensity(c) = fluid.getPhase(phaseNumber).getDensity("kg/m3");`
    `gasZ(c) = fluid.getPhase(phaseNumber).getZ();`
    `gasMolarMass(c)= fluid.getPhase(phaseNumber).getMolarMass() * 1000;`
    `gasEnthalpy(c) = fluid.getPhase(phaseNumber).getEnthalpy("J/mol");`
    `gasWtFraction(c) = fluid.getWtFraction(phaseNumber) * 100;`
    `gasKappa(c) = fluid.getPhase(phaseNumber).getGamma();`
    `gasViscosity(c) = fluid.getPhase(phaseNumber).getViscosity("kg/msec");`
    `gasThermalConductivity(c) = fluid.getPhase(phaseNumber).getConductivity("W/mK");`
    `gasSoundSpeed(c) = fluid.getPhase(phaseNumber).getSoundSpeed();`
    `gasJouleThomsonCoefficient(c) = fluid.getPhase(phaseNumber).getJouleThomsonCoefficient() / 1e5;`