Engineering With Python Rotating Header Image

Steady-State Material Balances on a Separation Train – Solution

Solve the problem:

Execute the script and let’s see what the molar flow rates of D_1, D_2, B_1 and B_2 are?  I’m on the edge of my seat…however, I have been working for a while and kinda need to go, if you know what I mean, but I digress, let’s see it.

Molar Flow Rates of the four Components:

I printed the A and b arrays just to double-check.  Remember an earlier post.  Also, I set up to solve for B and D since that was the answer for the third part.  I should have put in the units.  Sooo lazy.  Now let’s use IPython and set for the second part.

Using IPython as an integrated solution with the programming:

Now, you see you can use IPython as part of an integrated approach to solving problems.  What I did was a little clumsy, but I wanted to show a basic approach.  You could probably set up a much more efficient approach.  Let me show you something else.

How I changed the feed composition array:


You see, I just added it in the array.  This is a very, very nice feature of arrays.  Can you see how you might use that approach to ‘automate’ this script to allow you to set the 1% or whatever as an input value and let it crank.  Cool!  Next time, we might try a catalytic reactor.  Hey, I can see you’re excited, especially when you wake up.



One Comment

  1. Steve says:

    Hi Fidel (axl456):

    Thanks for the great comment! Well done with your program. I come from a procedural/functional programming background with Fortran. I’m still trying to get the ‘hang’ of object-oriented, and you’ve done some very nice work, you’re definitely getting the programmer’s touch! I went back and checked, the problem statement (Part (b)) in the edition of the text I have asks, “Reduce the original feed flow rate to the first column ‘in turn’ for each of the components by first 1% then 2% and calculate the corresponding flowrates of D_1, B_1, D_2, B_2 and explain the results”. So, I didn’t state it correctly in the post. Thanks for asking and allowing me to correct. The program I show in the post answers the question in the text. For time-sake, I only reduced the xylene by 1% for demonstration in the post. What you find at 2% is that you begin to get negative numbers (non-physical) and the problem is over-specified (assuming I did it right…). Nice job and thanks again for the great comment! I learned a lot from your programming example and I hope others do too. That’s what this blog is about!


Leave a Reply