MISSOURI
Ss DSS Oia eee tee Rte rel neteny
ChE 301
MODELING AND COMPUTING
OF
CHEMICAL AND BIOLOGICAL
PROCESSES
PART II:
INTRODUCTION TO
NUMERICAL COMPUTING
PROFESSOR MUTHANNA AL-DAHHAN
DEPARTMENT OF CHEMICAL AND
BIOLOGICAL ENGINEERING
FALL 2011MA curricuum
COMPUTING IN THE
UNDERGRADUATE ChE CURRICULUM
An Integrated Approach
Mutuanna H. At-DanHan
Washington University + St, Louis, MO 63130
he influence of computers on our lives grows with
| ‘each new technological breakthrough. Today the num-
berand types of computer applications ae too vast 10
count. With the development of fast, efficient digital com.
puters, the role of computing in solving engineering prob-
lems, analysis. design, text processing, graphics, communi
cation, and accessing information has increased dramatically
and has led to a great demand for computer application skills
in the curricula and practice of various engineering disci-
plines. Hence. computer literacy has become vital in engi-
‘neering education. research, and practice. As a result, courses.
in chemical engineering, as well as in other engineering,
disciplines, have become more computer-oriented at all Iev-
els ofthe curriculum,
Recent surveys on computing conducted by the CACHE
Corporation Curriculum Committee show that chemical en-
sgineering graduates overwhelmingly considered computing,
to be an integral part of the undergraduate program. This
raises the question as to what undergraduate chemical engi
neering students should know regarding computers and com-
Putations. It is evident thatthe students must
+ Have access 10 computing facilities
+ Be efficient in programming in at least one high-level lan
‘guage (such as Fortran)
* Be copable of implementing numerical computing techniques
‘onthe computers
+ Be exposed 10 the use of available software packages for
‘computing, dara analysis, and design
* Be able 10 use the compuer for technical calewations, prob:
lem solving. data processing, process design and simulation,
+ Be ready 10 efficiently use computing support facilites such as
operating systems, editors, ec
Another difficult question that needs to be addressed is:
How best should undergraduate chemical engineering stu:
dents acquire these skills. systematically and effectively, at
an early stage of their academic program?
198
a-4
‘Muthanna H AF Dabhan a Assatant Professor oh
‘Chemcal Ergneeng and Assocate Dect’ of
te Cnemea! Feacton Engnvereg Laborato at
‘Washingon Unversity Me aceed he Bacelors
degree fom te Unversty of Baghdad (1979) hs
Masters segree tom Oragan site Unversity
(1868, ad hs Doctoral degree tom Washgion
‘Unnersiy (1999, atl chemea!expneanng. Hs
rasearchiniress are in chervcal eacon eng.
neenng, mabphase reactor syste, mass tr
for process engroenng. and unt operators
Although the current practice of teaching programming in
Fortran or another language (e.g., Basic, Pascal, C. C++, etc.)
in the early years (freshman or sophomore levels) helps stu=
dents acquire some of the above mentioned skills, it does not
provide them with the vital knowledge of how to efficiently
solve engineering problems. This knowledge is essential for a
strong engineering program: enhanced understanding of che
cal engineering principles at all course levels and the capability
Of handling problem assignments, projects, case studies, etc.,
‘equires a knowledge of programming, computing techniques
for solving problems. understanding of computer capabilities
and limitations, and exposure to available software packages,
etc. Often, these skills are introduced by more than one course
at different levels of the curriculum,
For example. numerical methods and analysis are usually
offered at the senior or graduate level, clearly far too late for
the students to use the material in the curriculum, Even if the
available computing packages (such as Matlab, Mathematica,
and Spreadsheets) are taught with the calculus and linear alge~
bra courses. they do not provide the students with the highly
desirable integrated skills mentioned above.
‘A common practice is to cover the needed computational
skills and software for solving engineering problems through
assignments in different courses. This does not work very well,
hhowever, since it detracts from the principles taught in the
course. Moreover, an average student often has 10 struggle
with the computational tools needed to solve the problem at
hand and ends up losing perspective of both the physical situa-
tion and the computational method. The grade-conscious stu-
dent focuses on getting the job done; it is viewed asa struggle,
and the student misses the learning part.
(Chemical Engineering EducationIt is much more beneficial to the student to have a single
‘course early in the curriculum that focuses on computational
literacy. Such a course can combine leaming computational
skills with solving specific problems and gives the students,
broad exposure to a variety of computing tools in an inte-
{grated fashion. Enabling students to develop all the above
‘mentioned skills through a single course offered early in the
‘curriculum is not easy, but is essential fora productive engi-
neering program. The same conclusion has been recently
reached by Davis, etal." based on the surveys on computing
‘managed by the CACHE Corporation Curriculum Committee
‘At Washington University, we have developed and taught
an effective early-stage (freshman or sophomore year) com-
puting course that provides. in a systematic manner, the skills
‘mentioned above."®! The course, “Introduction to Computing
and Computer Applications.” is based on the premise that
chemical engineering students should be provided with an
integrated, strong. and early introduction to computing tech-
niques and packages for solving engineering problems. The
‘material is presented in a form that allows students to follow
the logic involved and to understand the relationships between
the computer. programming, numerical computing, comput-
ing software packages, and practical skills for solving engi-
neering problems. This course and its approach are described
and discussed in the following sections.
COURSE STRUCTURE AND CONTENTS
‘The course is offered each semester every year. It is as-
‘sumed that the students have had litle experience with the
computer and its applications in programming, computing,
analysis, graphics, wordprocessing. ete.
The course is structured to achieve the following goals:
1. To acquaint the students with the computer (such as its basic
architectural components and their functions. its capabilites
‘and its imitations in solving engineering problems. ete) and to
faniliarice them with computing support facilities (such as the
‘operating system. editor, compiler et)
2, To make the students efficient in programming ina high-level
language (Fortran)
4. To introduce the students to numerical methods and computing
and their effective implementation on the computer using For.
san programming.
4. To use the commercially available and widely used computing
software and library packages such as Matlab. Mathematica
Spreadsheets. and IMSL (International Mathematics and Stats.
ties Library),
5. Topractce the acquired knowledge by solving real-world engi
neering and scientific problems
Achieving these goals prepares the students properly and ef-
fectively for the engineering courses at all levels,
Each week, some elements of Fortran programming, nu-
‘merical computing techniques and computing by commercial
software are given almost equal coverage. Engineering and
science problems are practiced through illustrated examples,
‘workshops, and homework assignments, Table | shows the
outline of the course structure and contents.
MATERIAL PRESENTED
As can be seen in Table 1, the course content is organized
into three parallel subjects that include 1) programming in
Fortran, 2) numerical computing, and 3) computing software
packages, in that order. Practical engineering problems are
Week
ia
‘Subjects
Inwodationo compa citecturalcomponet and hei functions
Running compat: progans bing. comphagfinking. ctecung
+ Proce or sling robles sing the computer
* lcduton wo mumeril computing and enieening poten sling
* nuaduton computing softase: Ml, Mathematics. and Spreadsheets
2+ Programming Foran sya / Arte computations
+ Nunenalsompuig: The Taye Ses,
* Mata, Matheatica. and Spreadsheets: Bling up clusions nd data
processing
4+ Programming: Simple input and out
+ Name compuing: Numeral dferniaiowlnvofsction dient
cations
* Mats. Mathematica. and Speaésbets Alger clsons and
‘exctions: symbolic compuatondenphie
5 + Programming: Congo sactue- Fractures
+ Numencan compan: Root of equation and conversion rte
+ Mata, Matiematia, nd Spreadsheets: Rot eaten computing if
strc: gape
6 + Programming Cool scr DO lop ste
+ Nimenal computing: Nomen inegrston
* Mat. Mathai, rd Spesdshee Computing of integrals Dong
panic
7+ Programming Dat fils and adn npavotp ees
TABLE 1
Course Outline: Computing and Computer Applications
+ Numeral computing: Review ofc mae termini an operations
+ Mata. Mathematica and Spee: Handing data es and maces
8 + Popraming:Arayprocesing
* Nunencal computing Stems ofa slgebraic equations
* Mat, Mathematica. and pease: Maa aay computations
sovig Seto inca quan
9+ Programming: Subprogram ncn and struts
+ Nareial computing: IMSL sbrootines brary package
* Mats, Mathematics, and Spreaisbees: Functions ad more conputtions
10 + Progamming: Sabpograms «functions ad sobonies,
+ Numencalcompating: Systems of soles algebraic equations IMSL.
* Mata, Mathemanca. an Spreadsheet: Solving online equations
11 + Programming: Adios Fora tres
+ Naren computing: Curve fit and satis asysis/ MSL
* Mat. Mathematica and Speaishees Carve iting and sista!
analysis: graphics
ramming: Addorl Foran fexes
+ Numeral competing: Inrplaton IMSL.
+ Mata, Mathematics an Spreadees: ting an interpola erapis
13 «Progamming: Review
+ Nureial computing: Morera equations IMSL.
+ Mat, Matematica. and Sreaishees: Differentiation: apies
1s Review
Sumner 1995
19
2-2introduced in the lectures’ illustrated examples and in the
‘workshop and homework assignments. It is noteworthy
that programming in Fortran is covered first It has been
‘my experience that this helps the students understand and
follow the algorithm steps and flowchart ofthe computing
techniques and to translate them to a computer program,
After a particular computing technique is covered, stu-
dents are introduced to computing packages to perform the
same computation. This sequence helps students appreci
ate the Aexibility of programming as well as the ease,
capabilities, and power of computation using software pack-
ages for solving engineering problems. Textbooks and ref-
‘erences used in the course are listed in Table 2.
The three key parallel topics of Table 1 are presented
and covered as follows:
Programming in Fortran + There are a number of pro-
gramming languages other than Fortran that are used for
different purposes. such as Basic, Pascal, COBOL. C, C++
(which is an “object-oriented” language), etc. Although
each language has its supporters who claim its superiority
in some aspect (e.g. use, ease of learning, etc), Fortran 3s
a structured language is still the dominant language in
engineering and scientific computations. Iis the mother of|
advanced computer languages, will likely remain preemi-
nent among its peers, and will continue to be a central
element in the training of engineers and scientists. It is
easy to leam and appropriate for beginners. Moreover, the
‘overwhelming majority of engineering and scientific com
puter programs, as well as the most popular and efficient
‘computing packages such as IMSL, NAG, et..are writen
in Fortran." Since knowing one computer language and
the concept of programming is helpful when learning other
programming languages, students who have learned For-
tran can more readily master the other languages.
For the reasons cited above, Fortran is used as the pro:
gramming language in this course. There are many text-
books concerning Fortran, but in general, most of them are
either wordy or very detailed. In contrast, the rules and
structure of the Fortran language have been summarized
for this course and are presented in a concise manner. The
students follow the material with ease and interest since it
contains many illustrative examples. The prepared sum-
mary is distributed to the students as class notes. In
addition, a Fortran book by Etter"! is used as a reference.
Numerical Computing + Knowledge of this subject is
vital for solving engineering problems—in practice the
solution of most engineering and scientific problems re-
uires the application of numerical computing techniques.
In order to use numerical methods efficiently in learning to
use the computer and programming in solution of engi-
neering problems, an effective numerical computing text,
‘matching the level of the class, was developed and printed
200
in the form of course notes. It provides an early and focused
introduction to numerical methods and engineering. problem
solving using the computer. It consists of an introduction to the
‘computer and its elements. the procedure for solving problems
using the computer, numerical computing techniques, introduc-
tion to the IMSL subroutine library. and recommended refer-
ences. The covered numerical methods, which represent the
core of the text, are the common techniques used in many
engineering and scientific applications.
‘One unique feature ofthe text is that all the numerical meth
‘ods are presented in a simple, easy-to-understand manner. Each
technique is covered by: 1) a short introduction describing the
‘mathematical basis for the technique; 2) steps of the algorithm
needed for implementation; 3) illustrated examples by hand
calculator, following the algorithm steps for the technique: 4)
translation of the algorithm steps into a programming flowchart
that can be readily implemented in a computer program; 5)
Programming recommendations and comments. if necessary.
Introduction to the IMSL subroutines is covered with simple
and understandable examples that illustrate the implementation
of this library.
‘The sequence of introduced and discussed numerical methods,
is chosen in such a way that it is well integrated with the
covered Fortran topics necessary for implementation of @ par-
ticular numerical method. as illustrated in Table I. In other
‘words, we let the students practice programming by implement-
{ng numerical computing. For instance, when a DO loop struc-
ture in Fortran is covered, numerical integration is presented
where a DO loop is implemented: when array processing is
introduced in Fortran, matrices and numerical methods for solu-
tion of sets of linear equations are discussed in order to use the
newly acquired Fortran knowledge, etc. This approach provides
an efficient way to leam both the numerical techniques and
programming, as also confirmed by Chapra and Canale."
Computing Software + Matlab, Mathematica, and Spread-
sheet (Excel) are commercial software packages for interactive
TABLE 2
‘Course Textbooks and References
> AbDathan. Madcon Nunenel Compan.” Chemie
Egicerig Deprnen. Washington Univers, St.Louis, MO 198, 1995)
> AbDaynan M. "Clas Noes” Chemical Eniceing Depa.
Washingoa Universi St Lowi, MO (1992. 1995
> Eee DM. Sirctred Foran 7 or Engineer and Stents 4 Ed.
BenaninCunmngs Pubishng Conary. Ie 183)
> Wiliams. tathemaicaA Sytem or Dong Mathematics bs Computer
2m ES, Asn. Wesley ubising Company In (991),
> Mutbb User'sand Reference Guides. Matlab Hk Perfomance Numeric
Computation and Visual Sofware. Te Mah Works ne (1983)
> The Side Ein of Mab for MS-DOS Personal Computers. The Mat
Curiam Seis. The Math Wor Ine (1983)
> Handout on Enel Sprains, Mites, ard Mab, Cmte for
Engineering Computing (CEC), Washington Unversity (198)
> User's Manual. FORTR&W Sabrovtnes for Mahemanl Aplin. IMSL
{Umea Mathematics nd Sats Library I 1991
Chemical Engineering Education
V-3‘numerical computation, data analysis and processing, and
graphics. They are available with detailed user manuals and
‘monographs, as shown in Table 2, and on-line help is avail-
able within the system. These software packages are intro-
duced in the early weeks of the semester. followed by simple
examples and assignments designed to familiarize the stu-