Anda di halaman 1dari 14

Material Balances and System of Linear Equations 1

In most cases in this section, we will get linear algebraic equations when we write material balances.

Linear algebraic equations are those in which unknown variables do not appear in a product or
fraction with themselves or any other unknown variable, and also do not appear as exponents or in
logarithms. That is, with unknown variables x and y and known constants a and b, we will see ax and
by but NOT any of the following: ax2 , axy , ax/y , eax, log(by).

Linear equations can be solved by the methods of "linear algebra."

Some of the problems may be simple such that we can solve them in a step-wise manner and not
involve explicitly the methods of linear algebra. An example is Himmelblau & Riggs, Workbook
problem 7.3.

Other problems will require that we write matrices and use the methods of linear algebra. An
example is Himmelblau & Riggs, Workbook problem 7.4.

These problems are solved on the following slides.

ReactorLab.net, Resources, Matlab


Material Balances and System of Linear Equations 2

Consider Himmelblau & Riggs, Workbook Problem 7.3.

The system consists of a separator, one inlet stream or "feed stream," and two outlet or product
streams. The components are ethanol (e), methanol (m) and water (w).

We chose a basis of 1 hr. When solving the problem, we will write that F = 100 kg. That just saves us
a little writing. When reporting the final solution, we will report the stream values as flow rates in
kg/hr.

There are 4 unknowns, the flow rate of W and the mass fractions of the 3 components in stream W.

There are 3 components, so we can write 3 independent material balances. Our 4th equation is that
which states that the sum of the mass fractions in a stream equals 1.

ReactorLab.net, Resources, Matlab


Material Balances and System of Linear Equations 3

This problem is simple such that we can solve for the unknown values in a step-wise manner.

This is an open system at steady state with no chemical reactions. Therefore, the word equation for
both the total balance and component balances is "in = out." First write the total mass balance:

F = P + W >> 100 kg = 60 kg + W >> solve for W = 40 kg >> report as W = 40 kg/hr

Next we can write a component balance for ethanol and solve for the mass fraction of ethanol in W:

Next write a component balance for methanol and solve for the mass fraction of methanol in W:

Now, to get the mass fraction of water in W, we can either do a balance on water, or use the sum of
the fractions in a stream = 1. Note that, if we write all 3 component balances, those 3 equations
would sum to equal the sum of the unknown fractions in stream W, since only 3 of those 4 equations
are linearly independent.

ReactorLab.net, Resources, Matlab


Material Balances and System of Linear Equations 4

We have a solution. But let's keep looking at this.

We had 4 unknowns:

Some of our equations had products of W and a mass fraction, e.g.,

With W and the mass fraction of ethanol in W as unknowns, this is not a linear equation. However,
since we were able to determine the value of W in the first step using the total mass balance, by
substituting that value of W in the equation above, we removed the product of the two unknowns
and the equation became linear.

If we weren't able to determine the value of W first, we could rewrite the problem in terms of the
unknown mass flow rates miW in stream W instead of mass fractions. The equation above would
become:

Then we would have eliminated the possibility of any products of unknowns in the equations for this
problem. We would still have 4 unknowns, and would have 3 independent material balances plus 1
equation stating that the sum of the mass flow rates in stream W equals the total mass flow rate of W.

ReactorLab.net, Resources, Matlab


Material Balances and System of Linear Equations 5

Consider Himmelblau & Riggs, Workbook Problem 7.4

The system consists of a separator, two inlet streams or "feed streams" (or one stream with two
immiscible phases), and two outlet or product streams. We are given the total mass flow rate of
product stream P and the compositions of all four streams.

Choose a basis of 1 hr. When solving the problem, we will write that P = 350 kg. That just saves us a
little writing. When reporting the final solution, we will report the stream values as flow rates in kg/hr.

There are 3 unknowns: FA (Feed, Aqueous), FO (Feed, Organic), and W (Waste). The component Hac
is acetic acid, W is water, and Bz is benzene.

ReactorLab.net, Resources, Matlab


Material Balances and System of Linear Equations 6

There are 3 independent equations: there are 3 components, therefore we can write 3 independent
material balances. We can write one combination of 3 of the total of 4 balances: total mass, and each
of the three components is (we can choose other combinations).

This is an open system at steady state with no chemical reactions. The "word equation" is
accumulation = 0 at steady state = in - out. The word equation is same for both total mass and
components for this problem since there are no chemical reactions in these component balances.

That is: in = out

Total mass balance:

FO + FA = W + P

Benzene balance:

FO = 0.674 W

Water balance:

0.2 FA = 0.217 W

ReactorLab.net, Resources, Matlab


Material Balances and System of Linear Equations 7

There doesn't appear to be a way to solve this system of equations for the unknown values by simple
substitution, as we could with Workbook Problem 7.3.

Let's write these equations in matrix form and use techniques of "linear algebra." First, rewrite the
equations with the unknowns on the left side in the same order and all constant values on the right
side:

FO + FA - W = 350

FO - 0.674 W = 0

0.2 FA - 0.217 W = 0

Now we can separate terms into matrix A and column vectors x and y:

ReactorLab.net, Resources, Matlab


Material Balances and System of Linear Equations 8

We can use linear algebra to solve for x, the column vector of unknown values:

We multiply both sides from the left by the inverse of matrix which is

where is the identity matrix (1's on diagonal, 0's everywhere else).

The question is now, how do we actually carry out this solution?

ReactorLab.net, Resources, Matlab


Gauss-Jordan elimination 9

There are several related ways in which we can solve for the values in our unknown vector x.

The method of Gauss-Jordan elimination is described in Appendix L of Himmelblau & Riggs, 7th ed.

First, form the augmented matrix:

Now, we want to do elementary row operations - multiply a row by a constant and add it to a second
row and replace the second row with the sum - in order to get this form with an identity submatrix
on the left side, where a, b and c are constants that result from the row operations:

such that and FO = a, FA = b, W = c

ReactorLab.net, Resources, Matlab


Gauss-Jordan elimination 10

We start with the original augmented matrix and follow the procedure in Appendix L.

We can easily get column 1 into the desired form. Element a11 (top left in row 1, column 1) is 1. If it
weren't 1, then we could divide the row by its value such that it becomes 1. Pick element a11 as a
"pivot" element. Multiply row 1 by -1 and add the result to row 2, replacing row 2 by the sum.

You need to be able to do this method for small problems on a quiz in this class. The process is
continued until we get this:

such that and FO = 311 kg/hr


FA = 500 kg/hr
W = 461 kg/hr

ReactorLab.net, Resources, Matlab


Gauss-Jordan elimination 11

The last step in the problem solving strategy is to check the results. Take our answers and check the
total mass balance with them.

FO + FA = W + P >> 311 + 500 = 461 + 350 = 811 checks

Here are a couple notes on the linear operations in this method:

- You can swap the order of the rows in the augmented matrix if you wish.

- If you swap the order of the columns in the augmented matrix, you can do that only with the
columns of the A submatrix and you must also swap the corresponding rows in the column vector of
unknowns, x. Be careful doing this! There is probably never any need to swap columns in this
method.

TRY THIS: Show how the equations in Workbook problem 7.3 can be written in vector-matrix form.

ReactorLab.net, Resources, Matlab


Gauss-Jordan elimination 12

Rank of a matrix - degrees of freedom

The "rank" of the augmented matrix = the number of non zero rows after reduction of the matrix to
obtain an identity submatrix on the left side.

Rank = 3 Rank = 2

If the rank of the augmented matrix is less than the number of unknowns, the system is
under-determined, and the number of degrees of freedom is greater than zero, ND > 0.

If the rank of the augmented matrix is greater than the number of unknowns, the system is
over-determined, and the number of degrees of freedom is less than zero, ND < 0.

ReactorLab.net, Resources, Matlab


Solving linear equations with software tools 13

Since solving a set of linearly independent equations is very common, there are software tools for
doing this.

MATLAB

>> A = [1 1 -1; 1 0 -0.674; 0 0.2 -0.217];


>> y = [350; 0; 0];
>> x = inv(A)*y
x =
311.8037
500.3294
461.1331

where >> is prompt in the command window, spaces or commas separate elements in the same row
of a matrix, new lines or semicolons separate rows in a matrix, and a semicolon at the end of a line
suppresses display in the command window of the result of that line's operation. A % starts a
comment.

>> rank([A,y]) % use standard function to determine rank of augmented matrix [A,y]
ans =
3

ReactorLab.net, Resources, Matlab


Solving linear equations with software tools 14

POLYMATH - use the LEQ (linear equation) tool that is specifically designed to solve these problems.

Excel - use the MINVERSE() and MMULT() functions. It's a pain to do this in Excel, as far as I'm
concerned. The trick is that you have to select the proper range of cells to receive the
answer, type the equation, then type control-shift-enter to enter the equation NOT
type the usual enter key by itself.

See Simultaneous linear equations at ReactorLab.net, Resources, Matlab, Examples of solving math
problems with Matlab.

In class, we continued with another problem in linear algebra, fitting a polynomial function to
experimental data...

ReactorLab.net, Resources, Matlab

Anda mungkin juga menyukai