Design and Simulation Lab (CHCE 4111)
B. Tech Chemical Engineering Spl. Refining and Petrochemicals, Semester VII
UPES, Dehradun
AY – 2021 - 22
Dr. Nilanjana Banerjee Department of Chemical Engineering
Practice Lab – 3 Linear algebra using python programming
Instructions: Each question can be programmed as a cell. Create one single .py file and submit it
on blackboard 1 week from the date of uploading. Remember each programmer has his/her own
style of programming which is like a signature, unique. So, it becomes very apparent when you
have copied someone else’s work. You will be penalized for each copied work.
Consider the following mixing process. This is a common chemical engineering scenario which
arise when you have multiple reactors in series and/or parallel. Though in our case we are not
considering any sort of reaction happening to make the system simpler.
Here Q01, Q12, Q13, Q22, Q32, Q34, Q41, and Q44 denote the volumetric flowrates and CO1, C1,
C2, C3 and C4 denote the initial concentration and concentrations in mixer 1, 2, 3 and 4
respectively. To develop the sets of linear equations, we will have to write a mass balance
equation across each of these mixers.
Remember, as per mass balance, Mass in = Mass out. i.e. if a mass balance is written across the
first mixer then Q01*CO1 + Q41*C4 = Q12*C1 + Q13*C1. As you can see, there are 4 unknown
variables, so to make the system solvable there should be 4 sets of linear equation.
1. Develop the sets of Linear Algebraic equation.
2. Develop the logic/algorithm for the program. Draw the flowchart to describe the
algorithm.
3. Write a python function/program to solve the above sets of linear equations using
Gauss-Jordan Elimination method. Make the function generalized enough so that it
can be used for any number of variables and sets of equations. The code will be tested
for different sets of linear equations.
Page 1 of 1
NB