• No results found

edit ] Looping method

In document Introduction to Chemical Processes (Page 106-109)

This is one method that does work, and that is somewhat different from any single-variable method. In the looping method technique, it is necessary to be able to solve each equation for a

unique variable, and then you'll go around in a loop essentially, starting with an initial guess on (ideally) a single variable, say y, and then evaluating all equations until you return to your original variable with a new value y'. If the result is not the same as the guess(es) you started with, you need to make a new guess based on the trends in the results.

NOTE:

What kind of trends am I talking about? If you have a well-behaved system, an increase in y will consistently lead to either an increase or a decrease in y', so you can take advantage of this to see which way you need to adjust your original guess. DO NOT attempt to use the value for y' as a new guess!

More specifically, here is an algorithm you can use:

1. Solve all equations for a different variable.

2. Make a guess on one variable (or as many as necessary to evaluate a second one, if it's more than one it gets harder though, so it is recommended to use another method)

3. Go through all of the equations until you end up recalculating the variable (or all of the variables) which you had originally guessed. Note whether the result is higher or lower than your guess.

5. After these two guesses, we know whether increasing or guess will increase or decrease the recalculated value. Therefore, we can deduce whether we need to increase or decrease our guess to get a recalculated value equal to the guess.

6. Keep guessing appropriately until the recalculated value equals the guess.

This technique is often necessary in engineering calculations because they are based on data, not on explicit equations for quantities. As we'll see, however, it can be difficult to get it to converge, and this method isn't that convenient to do by hand (though it is the most reliable one to do realistically). It is great, however, for inputting guesses into a computer or spreadsheet until it works.

Example:

Solve this system:

1. 2.

First we need to solve one of them for x, let's choose the first one:

• To start off, we make a guess: y = 0.1 Then from the first equation, x = 2.303

• Plug this back into the second equation and you'll come out with y' = 0.834. The

recalculated value is too high.

• Now make a new guess on y: say, y = 0.5. This results in x = 0.6931

Plugging back into the second equation gives y' = -0.3665. The recalculated value is too low.

NOTE:

Now we know that increasing the guess decreases the recalculated value y' and vice versa. Since the second value of y' is too low this means that we need the guess to be smaller than 0.5; likewise, since the first y' was too high we need it to be greater than 0.1.

• Lets now try y = 0.25.

This results in x = 1.386 from the first equation and y' = 0.326 from the second. Too high

so we need to increase our guess.

This yields x = 1.204 and thus y' = 0.185, which is too low indicating the guessed value

was too high.

• Guess y = 0.28, hence x = 1.273 and y'= 0.241. The guess is therefore still too high. • Guess y = 0.27, hence x = 1.309 and y' = 0.269. Therefore we have now converged:

[edit] Looping Method with Spreadsheets

We can do the guessing procedure more easily by programming it into a spreadsheet. First set up three rows like so:

A B C 1 y guess x y' 2 =-ln(A2) =ln(B2)

In B2 we put the first function solved for x, and in C2 we have the second function solved for y. Now all we need to do is type in guesses in A2 until the value in C2 is the same as our guess (the spreadsheet will automatically calculate B2 and C2 for you). To make things even easier, put the line into cell D2. Since we want y' to equal y, just keep guessing until the value in D2 is as close to zero as you like.

As a more in-depth example (which would be significantly more difficult to do by hand), consider the system:

Example:

Solve:

• • •

In order for this to work, we only need to solve each equation for a unique variable, the expression need not be explicit! The following will work (assuming that X is a positive quantity), and this will be evident shortly:

• • •

Now we need to ask: which variable would be the best to guess to start the iteration procedure? In this case the best answer is T because from this guess, we can calculate P from equation 3, then X from equation 2, and finally a new guess on T from equation 1, and use this new value as a gauge of our old guess.

NOTE:

Generally you want to start the loop with a variable that allows you to calculate a second value with only that one guess. Try to algebraically manipulate your equations so that this is the case before solving, because we want to avoid guessing on multiple variables if at all possible.

Lets program this into the spreadsheet:

A B C D E

1 T guess P X T' T' - T guess

2 =0.1*A2 =sqrt(A2^3 - B2) =(2*B2^2*C2^2 - 3*exp(- C2/A2))/(A2 - 2) =D2 - A2

Once all this is programmed in, you can just input guesses as before, with the eventual result that:

In document Introduction to Chemical Processes (Page 106-109)

Related documents