hw2 - (e Compare the relative performance of the three...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Department of Chemical Engineering University of California, Santa Barbara Chemical Engineering 132B Computational Methods in Chemical Engineering Fall 2011 Homework #2 Homework due: Thursday, 6 October 2011 1. Consider the following PVT problem discussed in class. Suppose that one mole of chlorine gas has a pressure of 2 atm and a temperature of 413K. What is the volume of the gas in liters? You may assume the van der Waals equation of state applies, i.e. ± P + an 2 V 2 ² ( V - bn ) = nRT with a = 6 . 29 atm liter 2 /mol 2 and b = 0 . 0562 liter/mol. (a) Plot the EOS as a function of volume and identify the approximate location of all roots. Which root is the physical one? (b) Solve for the fluid volume using the method of bisection to a precision of 5 significant figures, implementing the stopping condition discussed in class. (c) Solve the same problem using Newton’s method to a precision of 5 significant figures, with the initial guess given by the ideal gas law, and with the appropriate stopping condition discussed in class. (d) Repeat (c), but using fixed point iteration.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: (e) Compare the relative performance of the three methods for this problem reporting the approximate error versus iteration number, the order of convergence, and the asymptotic error constant λ . 2. Speedtest. Compare the execution times of the three methods you used in problem 1 (b), (c), and (d) using the MatLab functions tic and toc . Further compare these times with timing for a root obtained from a call to the MatLab function fzero . Can you draw any conclusions regarding the computational efficiency of the MatLab built-in functions? 3. Extra Credit – 10pts. Optimize a MatLab code that you write yourself based on any “open method” that starts at the ideal gas volume and finds the real gas solution to problem 1 with 7 significant figures of precision. Report your execution time and provide the m-file. The 5 codes with the smallest execution times (on the TA’s computer) will garner extra credit....
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online