-
8/11/2019 00 Computer-Aided Computation for Chemical Engineers.pdf
1/30
Computer-Aided Computation
for Chemical Engineers
Cheng-Liang ChenPSELABORATORY
Department of Chemical EngineeringNational TAIWAN University
-
8/11/2019 00 Computer-Aided Computation for Chemical Engineers.pdf
2/30
Chen CL 1
Computer-Aided Computation
for Chemical EngineersCourse Objectives
This course emphasizes the derivation of a variety of numerical
methods and their application to the solution of chemical
engineering problems. The first objectiveof the course is to enable
the students to formulate chemical engineering problems as
mathematical models belonging to one of the following categories:
1. Complex consecutive calculations,
2. Linear and nonlinear algebraic equations,
3. Ordinary differential equations,
4. Partial differential equations, and
5. Multiple linear and polynomial regressions.
-
8/11/2019 00 Computer-Aided Computation for Chemical Engineers.pdf
3/30
Chen CL 2
Computer-Aided Computation
for Chemical Engineers
Course ObjectivesRecently, MATLAB has been widely recognized as ahigh-performance language for technical computing. It integrates
computation, visualization, and programming in an easy-to-use
environment. The second objectiveof this course is to enable
students to solve the resultant models using MATLAB and
Simulink.
-
8/11/2019 00 Computer-Aided Computation for Chemical Engineers.pdf
4/30
Chen CL 3
Computer-Aided Computation
for Chemical Engineers
Course ObjectivesNote: We are not going to train you as a programmerorsoftwareengineer. The main learning objectives in this course include:
1. To use computational tool(s) for solving engineering problems
effectively;
2. Understand and analyze the problem and formulate the model
accurately;
3. Use analytical methods or numerical techniques to find propersolution;
4. Use computer program for solving the problem.
-
8/11/2019 00 Computer-Aided Computation for Chemical Engineers.pdf
5/30
Chen CL 4
Computer-Aided Computationfor Chemical Engineers
Outline
Simulink and MATLAB
Materials Illustrative Applications
Simulation with Simulink
Simulink solution of ODEs, some linear
and nonlinear functions
Simulink simulation examples:a gas process
a stirred-tank heater
a batch bioreactor
Computing with MATLAB
Plotting tips
Programming techniques
Problem solving steps
Some simple engineering problems
C C
-
8/11/2019 00 Computer-Aided Computation for Chemical Engineers.pdf
6/30
Chen CL 5
Computer-Aided Computationfor Chemical Engineers
Outline
Numerical Solution of Nonlinear Equations
Numerical Methods Illustrative Applications
Types of roots and their approximation
Methods of successive substitution
Methods of linear interpolation
Wegstein method
Newton-Raphson method
Solution of the Colebrook Equations
Solution of the Soave-Redlich-KwongEquation
Solution ofnth-Degree Polynomials andTransfer Functions
Newtons method for simultaneous
nonlinear equations
Solution of Nonlinear Equations in
Chemical Equilibrium
Ch CL 6
-
8/11/2019 00 Computer-Aided Computation for Chemical Engineers.pdf
7/30
Chen CL 6
Computer-Aided Computationfor Chemical Engineers
Outline
Numerical Solution of Simultaneous Linear Algebraic Equations
Numerical Methods Illustrative Applications
Cramers rule
Gauss elimination method
Gauss-Jordan reduction methodGauss-Seidel substitution method
Jacobi method
Heat transfer in a pipe
Solution of a steam distribution
problemSolution of chemical reaction andmaterial balance equations
Ch CL 7
-
8/11/2019 00 Computer-Aided Computation for Chemical Engineers.pdf
8/30
Chen CL 7
Computer-Aided Computationfor Chemical Engineers
Outline
Finite Difference Methods and Interpolation
Numerical Methods Illustrative Applications
Finite Differences (FDs):Backward-Forward-Central
Difference equations and their solutionsInterpolating polynomials
Interpolation of equally spaced pts
Gregory-Newton method
Stirlings method
Interpolation of unequally spaced pts
Lagrange polynomials
Spline interpolation
Equally spaced data: Gregory-Newtonmethod
The Lagrange polynomials and cubicsplines
Ch CL 8
-
8/11/2019 00 Computer-Aided Computation for Chemical Engineers.pdf
9/30
Chen CL 8
Computer-Aided Computationfor Chemical Engineers
Outline
Numerical Differentiation and Integration
Numerical Methods Illustrative Applications
Differentiation by FDs:Backward-Forward-Central
Spline differentiation
Mass transfer flux from an open vessel
Derivative of vectors of equally spaced
ptsNewton-Cotes formulas of integration
Gauss quadrature
Spline integration
Multiple integrals
Integration formula:trapezoidal and Simpsons 1/3 rules
Integration formulas:Gauss-Legendre quadrature
-
8/11/2019 00 Computer-Aided Computation for Chemical Engineers.pdf
10/30
Chen CL 10
-
8/11/2019 00 Computer-Aided Computation for Chemical Engineers.pdf
11/30
Chen CL 10
Computer-Aided Computationfor Chemical Engineers
Outline
Numerical Solution of Partial Differential Equations
Numerical Methods Illustrative Applications
Solution of PDEs using finitedifferences
Elliptic PDEsParabolic PDEs
Hyperbolic PDEs
Solution of the Laplace and Poissonequations
Solution of parabolic PDEs for diffusionSolution of parabolic PDEs for heattransfer
Chen CL 11
-
8/11/2019 00 Computer-Aided Computation for Chemical Engineers.pdf
12/30
Chen CL 11
Computer-Aided Computationfor Chemical Engineers
Outline
Linear and Nonlinear Regression Analysis
Numerical Methods Illustrative Applications
Review of statistical terminologies
Linear regression analysis
The least squares methodProperties of estimated par.s
Nonlinear regression analysis
The method of steepest descent
The Gauss-Newton method
Newtons method
The Marquardt method
Multiple nonlinear regressions
Analysis of variance
Nonlinear regression using theMarquart method
Chen CL 12
-
8/11/2019 00 Computer-Aided Computation for Chemical Engineers.pdf
13/30
Chen CL 12
Computer-Aided Computationfor Chemical Engineers
Outline
Process Optimization
Numerical Methods Illustrative Applications
Linear programming
Nonlinear programming with and
without constraintsMixed-integer linear programming
Mixed-integer nonlinear programming
Refinery process
Synthesis of water networks
Synthesis of cooling-water networks
Synthesis of heat-exchanger networks
Chen CL 13
-
8/11/2019 00 Computer-Aided Computation for Chemical Engineers.pdf
14/30
Chen CL 13
Computer-Aided Computationfor Chemical EngineersText Book and References
Constantinides, A. and N. Mostoufi, Numerical Methods for
Chemical Engineers with MATLAB Applications, Prentice
Hall, Upper Saddle River, NJ, 1999.
Cutlip, M. B., and M. Shacham, Problem Solving in Chemical
Engineering with Numerical Methods,Prentice Hall, Upper Saddle
River, NJ, 2nd Ed., 2007.
William J. Palm III,Introduction to MATLAB 7for Engineers,
McGraw-Hill, New York, 2005.
-
8/11/2019 00 Computer-Aided Computation for Chemical Engineers.pdf
15/30
Chen CL 15
-
8/11/2019 00 Computer-Aided Computation for Chemical Engineers.pdf
16/30
Chen CL 15
Some High-level Programming Languages
Language Key Data Application Area Origin of Names
FORTRAN IBM (1957) Scientific programming FORmula TRANslation language
LISP MIT (1958) Symbolic computation (AI) LISp Processing Common Lisp Object System
COBOL USA (1959) Business data processing COmmon Business-Oriented Language
BASIC (1965) Simple on PC Beginners All Purpose Symbolic Instruction Code
C Bell (1972) Systems programming Predecessor language was named B
PROLOG (1972) Symbolic computation (AI) PROgramming LOGic (Frence)
Ada USA (1980) Real-time distributed systems Ada Augusta Byron collaborated with nineteenth-
century computer pioneer Charles Babbage
Smalltalk (1980) Graphical user interfaces; Object-oriented programming
Objects talk to one another via messages
C++ Supports objects and objected-
oriented programming
Incremental modification of C (++ is the C
increment operator)
JAVA SUN (1995) Supports Web programming Originally named Oak
Chen CL 16
-
8/11/2019 00 Computer-Aided Computation for Chemical Engineers.pdf
17/30
Chen CL 16
Progress of Programming Languages
1955
1960
1965
1970
1975
1980
1985
1990
1995
2000
Year
Progress of Programming Languages
(Machine Language) (Assembly Language)
01011010 ADD
Chen CL 17
-
8/11/2019 00 Computer-Aided Computation for Chemical Engineers.pdf
18/30
Chen CL 17
Progress of Programming Languages
1955
1960
1965
1970
1975
1980
1985
1990
1995
2000
Year
Progress of Programming Languages
(Machine Language) (Assembly Language)FORTRAN
DO 7, LOOP = 1,5 READ *, X, Y
AVE=(X+Y)/2.0
PRINT *, X,Y,AVE
7 CONTINUE
END
Chen CL 18
-
8/11/2019 00 Computer-Aided Computation for Chemical Engineers.pdf
19/30
Chen CL 18
Progress of Programming Languages
1955
1960
1965
1970
1975
1980
1985
1990
1995
2000
Year
Progress of Programming Languages
(Machine Language) (Assembly Language)FORTRAN
COBOL
01 EMPLOYEERECORD 05 EMPLOYEENUMBER PIC 9(5)
05 EMPLOYEENAME PIC X(30)
05 BIRTHDATE
10 BIRTHMONTH PIC 99
10 FILLER PIC X
10 BIRTHDAY PIC 99
05 DATEHIRED
10 MONTHHIRED PIC 99
10 FILLER PIC X
10 DAYHIRED PIC 99
Chen CL 19
-
8/11/2019 00 Computer-Aided Computation for Chemical Engineers.pdf
20/30
Chen CL 19
Progress of Programming Languages
1955
1960
1965
1970
1975
1980
1985
1990
1995
2000
Year
Progress of Programming Languages
(Machine Language) (Assembly Language)FORTRAN
COBOLLISP
SCHEME
COMMON
LISP
CLOS
PROLOG(defun length (x) (cond ((null x) 0)
(t(+1 (length (cdr x))))))
(length (I Love Computers))
3
Chen CL 20
-
8/11/2019 00 Computer-Aided Computation for Chemical Engineers.pdf
21/30
Progress of Programming Languages
1955
1960
1965
1970
1975
1980
1985
1990
1995
2000
Year
Progress of Programming Languages
(Machine Language) (Assembly Language)FORTRAN
COBOLLISP
SCHEME
COMMON
LISP
CLOS
PROLOG
BASIC
VISUAL
BASIC
Dim i, sum
sum = 0
For i = 1 to 10
sum = sum + 1
Next i
Chen CL 21
-
8/11/2019 00 Computer-Aided Computation for Chemical Engineers.pdf
22/30
Progress of Programming Languages
1955
1960
1965
1970
1975
1980
1985
1990
1995
2000
Year
Progress of Programming Languages
(Machine Language) (Assembly Language)FORTRAN
COBOLLISP
SCHEME
COMMON
LISP
CLOS
PROLOG
BASIC
VISUAL
BASIC
ALGOL60
PASCAL
MODULA2
MODULA3
if (i > 0) then
x := 10
else
y := 5
Chen CL 22
-
8/11/2019 00 Computer-Aided Computation for Chemical Engineers.pdf
23/30
Progress of Programming Languages
1955
1960
1965
1970
1975
1980
1985
1990
1995
2000
Year
Progress of Programming Languages
(Machine Language) (Assembly Language)FORTRAN
COBOLLISP
SCHEME
COMMON
LISP
CLOS
PROLOG
BASIC
VISUAL
BASIC
ALGOL60
PASCAL
MODULA2
MODULA3
CPL
C
if (i > 0)
x = 10;
else
y = 5;
Chen CL 23
-
8/11/2019 00 Computer-Aided Computation for Chemical Engineers.pdf
24/30
Progress of Programming Languages
1955
1960
1965
1970
1975
1980
1985
1990
1995
2000
Year
Progress of Programming Languages
(Machine Language) (Assembly Language)FORTRAN
COBOLLISP
SCHEME
COMMON
LISP
CLOS
PROLOG
BASIC
VISUAL
BASIC
ALGOL60
PASCAL
MODULA2
MODULA3
CPL
C
SIMULA
SMALLTALK
C++
C++Standard
Chen CL 24
-
8/11/2019 00 Computer-Aided Computation for Chemical Engineers.pdf
25/30
Progress of Programming Languages
1955
1960
1965
1970
1975
1980
1985
1990
1995
2000
Year
Progress of Programming Languages
(Machine Language) (Assembly Language)FORTRAN
COBOLLISP
SCHEME
COMMON
LISP
CLOS
PROLOG
BASIC
VISUAL
BASIC
ALGOL60
PASCAL
MODULA2
MODULA3
CPL
C
SIMULA
SMALLTALK
C++
C++Standard
ADA
JAVA
Chen CL 25
-
8/11/2019 00 Computer-Aided Computation for Chemical Engineers.pdf
26/30
Progress of Programming Languages
1955
1960
1965
1970
1975
1980
1985
1990
1995
2000
Year
Progress of Programming Languages
(Machine Language) (Assembly Language)FORTRAN
COBOLLISP
SCHEME
COMMON
LISP
CLOS
PROLOG
BASIC
VISUAL
BASIC
ALGOL60
PASCAL
MODULA2
MODULA3
CPL
C
SIMULA
SMALLTALK
C++
C++Standard
ADA
JAVA
MATLAB
Chen CL 26
-
8/11/2019 00 Computer-Aided Computation for Chemical Engineers.pdf
27/30
MATLAB ?
MATrixLAB
oratory
In 1978, Professor Cleve Moler (New Mexico University, USA)
usedFORTRANto write the MATLABfor applications involvingmatrices, linear algebra, and numerical analysis
In 1984, Jack Little (Stanford University) used C to rewrite and
to commercialize the MATLAB software (MathWorks Company)
MATLAB is both a computer programming language and
an interactive software environment for using that language
effectively
Chen CL 27
-
8/11/2019 00 Computer-Aided Computation for Chemical Engineers.pdf
28/30
Why MATLAB ?Outstanding Features
Significantly simpler programming Continuity (no distinction) among integer, real, and complex values
(any variable can take any type of number without special declaration)
Extended range of numbers and their accuracy
(all in double precision)
Extensive graphic tools including graphic user interface functions
A comprehensive mathematical library
Capability of linking with traditional programming languages
Transportability of MATLAB programs
MATLAB has a number of add-on software modules, called
toolboxes, that perform more specialized computations.
All toolboxesrun under the core MATLABprogram
Chen CL 28
-
8/11/2019 00 Computer-Aided Computation for Chemical Engineers.pdf
29/30
SimulinkGraphical Dynamic Simulation
built on top of
MATrixLABoratory
Chen CL 29
-
8/11/2019 00 Computer-Aided Computation for Chemical Engineers.pdf
30/30
Thank You for Your AttentionQuestions Are Welcome