#*--------------------------------------------------------------------- * EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC. * * This LIBRARY is free software; you can distribute it and/or modify * it under the therms of the ALSOC FREE LICENSE as available at * http://www.enq.ufrgs.br/alsoc. * * EMSO Copyright (C) 2004 - 2007 ALSOC, original code * from http://www.rps.eng.br Copyright (C) 2002-2004. * All rights reserved. * * EMSO is distributed under the therms of the ALSOC LICENSE as * available at http://www.enq.ufrgs.br/alsoc. * *---------------------------------------------------------------------- * 1. Thermodynamic properties from van der Waals equation *---------------------------------------------------------------------- * * Description: * This problem is part of a collection of 10 representative * problems in Chemical Engineering for solution by numerical methods * developed for Cutlip (1998). * * Subject: * * Introduction to Chemical Engineering * * Thermodynamics * * Concepts utilized: * Use of the van der Waals equation of state to calculate molar * volume and compressibility factor for a gas. * * Numerical method: * * Single nonlinear algebraic equation * * Reference: * * CUTLIP et al. A collection of 10 numerical problems in * chemical engineering solved by various mathematical software * packages. Comp. Appl. in Eng. Education. v. 6, 169-180, 1998. * * More informations and a detailed description of all problems * is available online in http://www.polymath-software.com/ASEE * *---------------------------------------------------------------------- * Author: Rodolfo Rodrigues * GIMSCOP/UFRGS - Group of Integration, Modeling, Simulation, * Control, and Optimization of Processes * $Id$ *--------------------------------------------------------------------*# using "types"; #*--------------------------------------------------------------------- * Equation of state *--------------------------------------------------------------------*# Model van_der_waals PARAMETERS outer Pc as pressure (Brief="Critical pressure"); outer Tc as temperature (Brief="Critical temperature"); R as Real (Brief="Gas constant", Default=0.08206, Unit='atm*l/mol/K'); VARIABLES P as pressure (Brief="Pressure"); V as volume_mol (Brief="Molar volume", DisplayUnit='l/mol'); T as temperature (Brief="Temperature"); a as Real (Brief="Parameter a of van der Waals equation", Unit='atm*(l/mol)^2'); b as volume_mol (Brief="Parameter b of van der Waals equation", DisplayUnit='l/mol'); EQUATIONS "Van der Waals equation" (P + a/V^2)*(V - b) = R*T; "Parameter a" a = (27/64)*(R^2*Tc^2)/Pc; "Parameter b" b = R*Tc/(8*Pc); end #*--------------------------------------------------------------------- * Thermodynamic properties calculation (question a) *--------------------------------------------------------------------*# FlowSheet properties PARAMETERS Pc as pressure; Tc as temperature; VARIABLES equation_of_state as van_der_waals; Pr as Real (Brief="Reduced pressure"); Z as Real (Brief="Compressibility factor"); EQUATIONS # Thermodynamic properties "Reduced pressure" Pr = equation_of_state.P/Pc; "Compressibility factor" Z = equation_of_state.P*equation_of_state.V/(equation_of_state.R*equation_of_state.T); SET Pc = 111.3*'atm'; # for ammonia Tc = 405.5*'K'; # for ammonia SPECIFY equation_of_state.P = 56*'atm'; equation_of_state.T = 450*'K'; OPTIONS Dynamic = false; end #*--------------------------------------------------------------------- * Variation of properties with Pr (question b and c) *--------------------------------------------------------------------*# FlowSheet variation_of_properties PARAMETERS Pc as pressure; Tc as temperature; VARIABLES equation_of_state as van_der_waals; Pr as Real (Brief="Reduced pressure"); Z as Real (Brief="Compressibility factor"); EQUATIONS "Change time in Pr" Pr = time/'s'; # Thermodynamic properties "Reduced pressure" Pr = equation_of_state.P/Pc; "Compressibility factor" Z = equation_of_state.P*equation_of_state.V/(equation_of_state.R*equation_of_state.T); SET Pc = 111.3*'atm'; # for ammonia Tc = 405.5*'K'; # for ammonia SPECIFY equation_of_state.T = 450*'K'; OPTIONS TimeStart = 1; TimeStep = 0.5; TimeEnd = 20; end