








Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Chemical Engineering Thermodynamics Example Assignment from ฤฐTU
Typology: Assignments
1 / 14
This page cannot be seen from the preview
Don't miss anything!
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Redlich-Kwong Iteration for Propane in a 0.1 L Vial at 309 K & 1.01325 bar % P_calc(n) = (RT)/(v - b) - a/(sqrt(T)v(v+b)) = P_target, % where v = V/n is the molar volume. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% clear; clc; format long; %---------------------- Given/Known Data --------------------------------- R = 0.08314; % Gas constant [Lยทbar/(molยทK)] T = 309; % Temperature [K] P = 1.01325; % Target pressure [bar] V = 0.100; % Vial volume [L] Mw = 44.1; % Molar mass of propane [g/mol] % Critical properties of propane: Tc = 369.8; % Critical temperature [K] Pc = 42.48; % Critical pressure [bar] %------------------ Calculate Redlich-Kwong Parameters -------------------- a = 0.42748 * (R^2 * Tc^(2.5)) / Pc; % Parameter a [L^2ยทbar/mol^2] b = 0.08664 * (R * Tc) / Pc; % Parameter b [L/mol] %------------------- Define Function f(n) -------------------------------- % f(n) = P_calc(n) - P_target; we seek n such that f(n) = 0. f = @(n) RK_pressure(n, a, b, R, T, V) - P; %------------------- Bisection Method Setup ------------------------------ % Choose an initial bracket [nLow, nHigh] where f(nLow)f(nHigh) < 0. nLow = 1e-5; % Lower bound for n [mol] nHigh = 0.1; % Upper bound for n [mol] fLow = f(nLow); fHigh = f(nHigh); if fLow * fHigh > 0 error('Function does not change sign over [nLow, nHigh]. Adjust the bounds.'); end maxIter = 50; % Maximum number of iterations tolerance = 1e-6; % Convergence tolerance for |f(n)| [bar] disp(' Iter nLow nHigh nMid f(nMid) '); for i = 1:maxIter nMid = 0.5 * (nLow + nHigh); % Midpoint of current bracket fMid = f(nMid); % Display iteration info: fprintf('%4d %10.6g %10.6g %10.6g %10.6g\n', i, nLow, nHigh, nMid, fMid); 1
13 0.00398909 0.00401351 0.0040013 0. 14 0.00398909 0.0040013 0.0039952 -0. 15 0.0039952 0.0040013 0.00399825 -0. 16 0.00399825 0.0040013 0.00399977 0. 17 0.00399825 0.00399977 0.00399901 8.91907e- 18 0.00399825 0.00399901 0.00399863 -6.13083e- 19 0.00399863 0.00399901 0.00399882 4.153e- 20 0.00399863 0.00399882 0.00399873 1.76996e- 21 0.00399863 0.00399873 0.00399868 5.78437e- 22 0.00399863 0.00399868 0.00399865 -1.73227e- Bisection converged in 22 iterations. Solution: n = 0.00399865 mol Mass of propane = 0.1763 g Published with MATLABยฎ R2024b 3
T = 309; % Temperature [K] P = 1.01325; % Pressure [bar] V = 0.100; % Volume [L] R = 0.08314; % Gas constant [Lยทbar/(molยทK)] MW = 44.1; % Molar mass of propane [g/mol] omega = 0.152; % Acentric factor for propane % Critical properties for propane: T_c = 369.8; % Critical temperature [K] P_c = 42.48; % Critical pressure [bar]
Tr_target = T / T_c; % Reduced temperature, ~0. Pr_target = P / P_c; % Reduced pressure, ~0.
For Table D.1 (Z0): For TR = 0.80: PR = 0.0100 --> Z0 = 0.9935 PR = 0.0500 --> Z0 = 0.9669 For TR = 0.85: PR = 0.0100 --> Z0 = 0.9946 PR = 0.0500 --> Z0 = 0. For Table D.2 (Z1): For TR = 0.80: PR = 0.0100 --> Z1 = -0.0648 PR = 0.0500 --> Z1 = -0.0767 For TR = 0.85: PR = 0.0100 --> Z1 = -0.0622 PR = 0.0500 --> Z1 = -0. PR = [0.0100, 0.0500]; % Reduced pressure grid values TR = [0.80, 0.85]; % Reduced temperature grid values % Matrices for Z0 and Z1 (rows correspond to TR, columns to PR) Z0_table = [0.9935, 0.9669; 0.9946, 0.9725]; Z1_table = [-0.0648, -0.0767; -0.0622, -0.0731]; % Create grid matrices for interpolation [PR_grid, TR_grid] = meshgrid(PR, TR);
Z0_interp = interp2(PR_grid, TR_grid, Z0_table, Pr_target, Tr_target); Z1_interp = interp2(PR_grid, TR_grid, Z1_table, Pr_target, Tr_target);
Z = Z0_interp + omega * Z1_interp; 2
n = P * V / (Z * R * T); % n = PV / (Z R T) mass = n * MW; % Mass in grams
fprintf('Interpolated Z0 = %f\n', Z0_interp); fprintf('Interpolated Z1 = %f\n', Z1_interp); fprintf('Overall compressibility factor, Z = %f\n', Z); fprintf('Number of moles, n = %e mol\n', n); fprintf('Mass of propane = %f g\n', mass); Interpolated Z0 = 0. Interpolated Z1 = -0. Overall compressibility factor, Z = 0. Number of moles, n = 4.040993e-03 mol Mass of propane = 0.178208 g Published with MATLABยฎ R2024b 3
Species xi Ki Ki* xi Ki Ki* xi Ki Ki* xi Ethane 0,14 2,20 0,31 3,50 0,49 3,60 0, Propane 0,13 0,70 0,09 1,40 0,18 1,45 0, ฤฐsobutane 0,25 0,30 0,08 0,68 0,17 0,70 0, ฤฐsopentene 0,48 0,10 0,05 0,23 0,11 0,25 0, Sum of Ki* xi (yi)= 0,52 0,95 (^) 0,99 ๏ 1
Species yi Ki yi/Ki Ki yi/Ki Ki yi/Ki Ethane 0,42 4,00 0,11 3,90 0,11 3,70 0, Propane 0,3 1,60 0,19 1,57 0,19 1,50 0, ฤฐsobutane 0,15 0,80 0,19 0,78 0,19 0,75 0, ฤฐsopentene 0,13 0,30 0,43 0,28 0,46 0,27 0, Sum of yi/Ki(xi )= 0,91 0,96 (^) 0,99 ๏ 1
Parameters for Antoine Eq. Name A B C Benzene 13,7819 2726,81 217, Toluene 13,932^ 3056,96^ 217, T ( โ) ๐ท๐^ ๐๐๐^ (๐๐ท๐) ๐ท๐^ ๐๐๐^ (๐๐ท๐) ๐ท = ๐๐ ร ๐ท๐^ ๐๐๐^ + ๐๐ ร ๐ท๐^ ๐๐๐^ (๐๐ท๐) 90 136,50 54,31 81, 100 180,45 74,26 109, 102 190,42 78,87 115, 103 195,55 81,26 118, 104 200,79 83,70 122, 103,5 198,16 82,47 120, 103,4 197,64 82,23 120, 103,3 197,11 81,98 119, 103,31 197,17 82,01 120, T (โ) ๐ท๐^ ๐๐๐^ (๐๐ท๐) ๐ท๐^ ๐๐๐^ (๐๐ท๐) (๐๐ ร^