300 likes | 424 Views
HelmholtzMedia – A Fluid Properties Library. Matthis Thorade , Ali Saadat Helmholtz Centre Potsdam GFZ German Research Centre for Geosciences Section 4.1 Reservoir Technologies. Motivation. Organic Rankine Cycle Power cycles Refrigeration cycles
E N D
HelmholtzMedia – A Fluid Properties Library Matthis Thorade, Ali Saadat Helmholtz Centre Potsdam GFZ German Research Centre for Geosciences Section 4.1 Reservoir Technologies
Motivation • Organic Rankine Cycle • Power cycles • Refrigeration cycles • Components: HE, PHE, Pumps, Turbines, Valves, etc.
Outline • Helmholtz energy equation of state (EoS) • Vapour-Liquid-Equilibrium (VLE) • Iterative Procedures • Additional Properties • Implementation & Validation • Outlook & Summary
Helmholtz EoS: functional form logarithmic: ≈ 2 terms polynomial: ≈ 2 terms Planck-Einstein: ≈ 4 terms polynomial: ≈4…10 terms BWR: Benedict-Webb-Rubin: ≈ 10…50 Gaussian Bell ≈ 2…4 terms Benedict, M.; Webb, G. B. & Rubin, L. C. (1940), 'An Empirical Equation for Thermodynamic Properties of Light Hydrocarbons and Their Mixtures I. Methane, Ethane, Propane and n-Butane', The Journal of Chemical Physics8 (4) , 334-345 . Setzmann, U. & Wagner, W. (1991), 'A New Equation of State and Tables of Thermodynamic Properties for Methane Covering the Range from the Melting Line to 625 K at Pressures up to 100 MPa', Journal of Physical and Chemical Reference Data20 (6) , 1061-1155 .
Thermodynamic State Properties from EoS … Span, R. (2000), Multiparameter equations of state: an accurate source of thermodynamic property data , Springer Verlag .
Derivatives of Thermodynamic State Properties and and and . . . and and Thorade, M. & Saadat, A. (2012), 'Partial derivatives of thermodynamic state properties for dynamic simulation', submitted to: Environmental Earth Sciences(GeoEn Special Issue).
Further Partial Derivatives Tummescheit, H. (2002), 'Design and Implementation of Object-Oriented Model Libraries using Modelica', PhD thesis, Lund University. Thorade, M. & Saadat, A. (2012), 'Partial derivatives of thermodynamic state properties for dynamic simulation',
Outline • Helmholtz energy equation of state (EoS) • Vapour-Liquid-Equilibrium (VLE) • Iterative Procedures • Additional Properties • Implementation & Validation • Outlook & Summary
Vapour-Liquid-Equilibrium (VLE) • Thermal equilibrium: • Mechanical equilibrium: • Diffusional equilibrium: • Have to be solved simultaneously to find the VLE from the Helmholtz EoS • For a given temperature T, solve mechanical and diffusional equilibrium: and 2 unknowns, 2 equations
2D-Newton setSat_T: after 4 iterations initial guess better guess RES(initial guess) Jacobian matrix Press, W.; Teukolsky, S.; Vetterling, W. & Flannery, B. (2007), Numerical Recipes: The Art of Scientific Computing , Cambridge University Press .
VLE ancillary equations • dewDensity_T • bubbleDensity_T • saturationPressure_T • saturationTemperature_d (iterative inversion using Ridders'method) • Boundaries: • saturationTemperature_p(iterative inversion using Newton's method) Ridders, C. (1979), 'A new algorithm for computing a single root of a real continuous function', IEEE Transactions onCircuits and Systems, 26(11) , 979 - 980 . Press, W.; Teukolsky, S.; Vetterling, W. & Flannery, B. (2007), Numerical Recipes: The Art of Scientific Computing , Cambridge University Press .
VLE by pressure and density • setSat_d: 2D-Newton • If d<d_crit: vapor side, find T and liq.d • If d>d_crit: liquid side, find T and vap.d • RES_p = p(T,liq.d) – p(T,vap.d) = 0 • RES_g = g(T,liq.d) – g(T,vap.d) = 0 • setSat_p: 3D-Newton • Find T, liq.d and vap.d such that • RES_p = p(T,liq.d) – p = 0 • RES_p = p(T,vap.d) – p = 0 • RES_g = g(T,liq.d) – g(T,vap.d) = 0
Outline • Helmholtz energy equation of state (EoS) • Vapour-Liquid-Equilibrium (VLE) • Iterative Procedures • Additional Properties • Implementation & Validation • Outlook & Summary
Property functions and frequency of use + Iterative algorithms !!! Wagner, W. et.al.: The IAPWS Industrial Formulation 1997 for the Thermodynamic Properties of Water and Steam In: Journal of Engineering for Gas Turbines and Power , Vol. 122 , Nr. 1 ASME (2000) , S. 150-184 .
setStatefunctions • setState_pT • Find d such that RES_p=p(d,T)-p=0 • setState_ph • Find d and T such that RES_p=p(d,T)-p=0 and RES_h=h(d,T)-h=0 • setState_ps • Find d and T such that RES_p=p(d,T)-p=0 and RES_s=s(d,T)-s=0 • setState_pd • Find T such that RES_p=p(d,T)-p=0 • setState_Ts • Find d such that RES_s=s(d,T)-s=0
setState_ph • Input p and h • Calculate VLE from ancillary functions • sat.Tsat:=saturationTemperature_p • sat.vap.d:=dewDensity_T; and sat.liq.d:=bubbleDensity_T; • sat.vap.h:=h(Tsat,vap.d);and sat.liq.h:=h(Tsat,liq.d); • If necessary, calculate VLE from EoS • Determine region and set boundaries • If single-phase, start Newton from saturation values (± offset), • check boundaries About 4 iterations, maximum 10 About 10 timesslowerthansetState_dT
Outline • Helmholtz energy equation of state (EoS) • Vapour-Liquid-Equilibrium (VLE) • Iterative Procedures • Additional Properties • Implementation & Validation • Outlook & Summary
Additional properties • Surface tension • Viscosity • Thermal conductivity
Outline • Helmholtz energy equation of state (EoS) • Vapour-Liquid-Equilibrium (VLE) • Iterative Procedures • Additional Properties • Implementation & Validation • Outlook & Summary
Implementation • Based on Modelica.Media • extends PartialTwoPhaseMedium • All functions available, same input & output • Add entropy s to ThermodynamicState • Add states liq and vap to SaturationProperties • annotation(inverse=xyz) • annotation(derivative=xyz_der) Elmqvist, H.; Tummescheit, H. & Otter, M. (2003), Object-oriented modeling of thermo-fluid systems, in 'Proceedings of the 3rd International Modelica Conference' , pp. 269--286 .
Validation • 6 fluids: n-Butane, Isobutane, Isopentane, Propane, R134a, Ethanol • Possible working fluids for geothermal ORC • Manually validated by comparing values to values calculated from RefProp • d, T, p, h, u, s (ThermodynamicState) • Tsat, psat, dliq, dvap (SaturationProperties) • cp, beta, kappa, speed of sound • About 20 points, including (d,T)=(0,Tmax), (d,T)=(dmax,Tmax), (d,T)=… • Pretty-print coefficient matrix using MSL function • Validate analytical derivatives by comparing them to numerical derivatives
Stability • Single-phase: • T=ramp.y from T_trip to T_max • p=sine.y from 0 to p_max • state:=setState_pTis a valid single-phase state • Call all other setState functions using values from state • Two-phase: • T=ramp.y from T_trip to T_crit • d=d_crit • state:=setState_dTis a valid two-phase state • Call all other setState functions using values from state • Ancillary functions and setSat functions • T=ramp.y from T_trip to T_crit • sat:=setSat_T • Call all other setSatfunctions using values from sat
Outline • Helmholtz energy equation of state (EoS) • Vapour-Liquid-Equilibrium (VLE) • Iterative Procedures • Additional Properties • Implementation & Validation • Outlook & Summary
Known issues = Outlook • BaseProperties currently fixed to (p,h) • Numerical Jacobians when running Modelica.Media.Examples.Test.MediaTestModels • EoS always slower than table or spline based media • Functional form: Hyperbolic & non-analytical terms • Mixtures, e.g. GERG2008
Summary • HelmholtzMedia is a library for the calculation of fluid properties for pure fluids that can be described by the Helmholtz energy EoS • 6 fluids implemented, about 1 day for each additional fluid • Additional properties: Surface tension, viscosity, thermal conductivity • Implemented in Modelica, released under Modelica license