Title: CHEE 321 CHEMICAL REACTION ENGINEERING
1CHEE 222 CHEMICAL PROCESS DYNAMICS AND NUMERICAL
METHODS
2Module 2. Lumped Parameter Steady State System
- This module deals with various forms of
algebraic equations that arise for
lumped-parameter system operating under steady
state. The following topics will be covered - System of Linear Equations
- Solution Method
- Matrix Inversion
- Cramers Method
- Computer-based solution (Matrix inversion in
Matlab) - Non-linear Single-Variable System
- Iterative Solution
- Bisection Method
- Newtons Method
- Convergence criteria
- Computer-based solution (Matlab fzero, roots)
- Non-linear Multivariable System
- Linearization Introduction to Jacobians
- Newton-Raphson Method
3System of Linear Equations
4Module 2.1 System of Linear Equations
- Review of Matrix Form Representation of System of
Linear Equations - Solution Method
- Matrix Inversion
- Adjoint of a Matrix
- Determinant
- Cramers Rule
- Linearity of System of Equations
- Independency of Equations
5Computer based solution method
- Solve the following set of equations
- 2x1 3x2 - 4x3 3 0 (1)
- - 4x2 2x3 2 0 (2)
- x1 - x2 5x3 9 0 (3)
6Matrix Form Representation of System of Linear
Eqns
- We are interested in finding solution to a system
of n equations (f1, f2, fn) in n state variables
(x1, x2, xn). - The set of functions is to be
solved such that
7Matrix Form Representation of System of Linear
Eqns (cont.)
- The system of equations
can be expressed as - where,
8Solution of a System of Equations Matrix
Inversion
- The solution of the following system of equations
- can be written as follows
- The objective is to find the inverse of Matrix A,
i.e. A-1
9Inverse of a Matrix
- For a square matrix A
- Accordingly,
- How can we calculate the adjoint of a Matrix?
Determinant of A
10Solution of System of Equation Cramers Rule
- The following system of equations
- can be also solved by Cramers Rule, which is
given as follows - where, Ai, represents the matrix obtained by
replacing coefficients associated with ith state
variable in the A matrix with constants, b.
11Linearity of a System of Equations
- Although not explicitly specified, the solution
method discussed in previous slide applies to
linear system of equations. - What does linearity of a system of equation
refer to?
Notes to be provided in class
12Independency of Equations
- Another implicit assumption made in deriving the
solution for linear system of equations is that
the equations are independent. - What does independency of equations mean?
- How can we find whether a system of equation is
independent of each other ?
Notes to be provided in class
13Computer based solution method
- Solve the following set of equations
- 2x1 3x2 - 4x3 3 0 (1)
- - 4x2 2x3 2 0 (2)
- x1 - x2 5x3 9 0 (3)
14Single-variable Non-Linear Equations
15Module 2.2 Solution of Single-Variable
Non-Linear Equation
- Introduction to Non-Linear Equations
- Examples
- Discussion on Non-Linearity
- Solution Methods for Single-Variable Non-Linear
Equations - Graphical
- Interval Halving or Bisection Method
- Newtons Method
- Initial Guess General Discussion
- Solution using MATLAB
- Roots function
- Fzero function
16Example Hydrogen Storage For Fuel Cell Powered
Vehicles
Calculate the volume of tank required to store 4
kg of Hydrogen at ambient temperature of
15C. Additional Information Maximum rated
pressure of tank is 5,000 psi
Let us use van der Waals Equation of State
For H2 a 0.0247 J-m3/mol b 2.65x10-5 m3/mol
Source of Pictures www.hydrogensafety.info/procee
dings/ ToddSuckow-NHA-CaFCP-9-04.pdf
17Methods for Solving Single-Variable Non-Linear
Equation
- Graphical Method ?
- Interval Halving or Bisection Method
- False Position (Regular Falsi) Method
- Newtons Method ??
18Illustration of Graphical Method
Example Hydrogen Storage For Fuel Cell Powered
Vehicles
19Newtons Method
- Recall, that our objective is to find the
solution (ZEROS) of a non-linear function, say,
f(x). - We start with Taylor series expansion of the
function, f(x), around the vicinity of expected
root, say x x0 - If we consider only the first-order terms, the
above equation can be simplified as follows - We use this equation to estimate the value of x
that will bring us closer to the solution, i.e.
zero of the function or f(x) 0.
20Newtons Method (Cont.)
- To find a suitable estimate for the solution, we
set f( x)0, in the following eqn. - Accordingly, after re-arranging the equation we
get - where,
- is the first derivative
of the function with respect to (w.r.t.) x and
evaluated at xx0
21Graphical Illustration of Newtons Method
Notes to be provided in class
22Convergence Criteria for Iterative Processes
- Newtons method falls in the category of
iterative processes of solution method. - Iterative procedures for numerical solution of a
function, by definition, require that we stop the
iteration at some point when we believe that an
acceptable solution has been reached. - We say that the iterative procedure has converged
when the iterated solution is a close enough to
the actual solution. That is, the solution is
within a specified level of tolerance - The simplest criterion for convergence could be
as follows
23Absolute and Relative Tolerance
- Absolute Tolerance (ea) Relates to the absolute
difference between two successive iterated
solution - Relative Tolerance er Relates to the change
between two successively iterated solution as a
fraction of last solution. - Most procedures employ a combination of the two
tolerances
24Initial Guess General Consideration
25SOLVING single-variable non-linear equation by
MATLAB
26MATLAB Function roots
- The ROOTS function allows you to calculate the
roots of a polynomial function. - Let us say we want to find the roots of the
following function - MATLAB Command
- First, we represent the polynomial function by a
row vector containing the coefficients. For the
given example, this can be done as follows - gtgt f 1 -5 -1 2
- Next, we can type the following command to obtain
the roots of the equation - gtgt x roots (f)
27MATLAB Function fzero
- fzero function finds zeros of the function of a
single-variable - MATLAB Command
- gtgt x fzero(fun,x0)
- tries to find a zero of an function defined by
fun near x0, if x0 is a scalar. - fun is an M-file function
- The value x returned by fzero is near a point
where fun changes sign, or NaN if the search
fails. In this case, the search terminates when
the search interval is expanded until an Inf,
NaN, or complex value is found.
28M-file Script File
Output of this file
name of the function should be the same as file
name
Output of this file
- function ffun(x)
- fx3-5x2-x2
- end
29Multi-variable Non-Linear Equations
30Multi-variable Non-Linear Equations
- Consider a system of n equations in n unknowns
- The objective is to find a set of solutions (x)
such that
31Solution of Multi-variable Non-Linear Equations
- The solution for multi-variable Non-Linear
Equations can be achieved by extension of the
Newtons Method we applied to single-variable
non-linear system. - Basic Principle It involves expansion of each of
the function fi(x) as a Taylor series around a
given set of initial guess, x0
32Taylor Series Expansion of Multi-variable Function
Notes to be provided in class
33The Jacobian Matrix
Notes to be provided in class