-
1
Polymath Tutorial Principles of Chemical Processes II
Objectives: Be able to use POLYMATH to solve typical chemical
engineering problems using the Differential Equation, Non-Linear
Equation and the Linear Equations Solver.
To be submitted as specified by the instructor using Blackboard.
Submit in one word document per person. Save the word document
using the following format: yournamePolymath.docx
1. Answers to questions on page 2 2. 1 page from the NLE module
of C&S 2.10a 3. 1 page from the LEQ module of C&S 2.4a 4. 1
page from the DEQ solver output with graph.
1. Open polymath:
-
2
2. Go to Help, Contents F1 or Press F1
3. Read the section titled Introduction to Polymath both getting
started and Variables and expressions and answer the following
questions typed into a word document to be submitted at the end of
the tutorial:
3.1. How many simultaneous ordinary differential equations can
be simultaneously solved
using the educational version of POLYMATH? 3.2. How many
explicit equations can be solved using the POLYMATH ode solver?
3.3. What does NLE represent? 3.4. What symbol on the tool bar
represents the polymath scientific constants menu? Give
the value of pi to an accuracy of 12 digits using polymath
scientific constants. 3.5. How would you have polymath give you the
absolute value of a number? 3.6. Have polymath, using the
calculator give you the cosine of 30 degrees. What did you
type?
-
3
Cutlip&ShachamProblem2.10parta:BubblePointCalculationforanIdealBinaryMixtureinCutlipandShacham.This
problem is in your Cutlip and Shacham text. In presenting this
tutorial I have given you an example of how I would like computer
oriented problems to be submitted for homework. Every problem
starts with a hand written statement of the problem following the
engineering homework format given in the syllabus. Note that sample
calculations of major equations are given on this page.
Place scan of 2 pages of handwritten notes
HeskethPlaced Image
-
HeskethText Boxmm Hg
-
5
Figure1:Presstheshortcutfornonlinearequationsolver(NLE)
Figure2:Usethetemplatesforeasyentryofequations
Figure3:Theisthetemplatewiththeoverallequationentered.Notethisistheimplicitequation.(ThedefinitionofanimplicitequationisthatyoucannotsolvedirectlyforthevariableTbp.Inotherwordsyoucannotwrite:Tbp=f(allothervariables)AlsonotethatthedegreesymbolcanbetypedpressingandholdingtheAltkeyandthentypingthenumbersusingthenumerickeypad0176.OtherusefulsymbolsareformicrometerAlt+0181for.
-
6
Figure4:AfteryoupresstheDonebuttonthefollowingequationiswrittenintheprogram.NoticethatanerrorisgivenwiththeredX.Beforeyoucanfindthisyouwillneedtogiveanupperlimit.Noticethecommentsaregivenafterthecommentsymbolof#andareingreen.
Figure5:Presstheshortcutbuttontohelpyouentertheexplicitsupportingequations.Ifyoupreferthesecouldbetypeddirectlyintothewindow.
-
7
Figure6:ExplicitEquationEntryScreen
Figure7:minimumandmaximumvaluesofTbp.Youneedtouseyourjudgementofthephysicalsituationtopicktheselimits.
-
8
Figure8:Showlistofvariablesthatareneeded
Figure9:Variablesinredneedtobedefinedbyanequation
Figure10:Whatiswrongwiththisprogram?
-
9
Figure11EntertheProblemTitleandsaveyourwork
-
10
Figure12:Thefollowingscreenresults.Copythisintoaworddocumentsothatyoucansubmitpage
Figure13:MakeagraphofthesolutionbyclickingontheboxnexttothewordGraph(seeredarrowabove)
-
11
Figure14:PolymathoutputsforNLEforasingleexplicitequation.Thegraphingoptionisnotavailableformorethanoneexplicitequation
Figure15:Optionsforgraphs
CopyandPasteGraph
Selectwhatyouwouldliketograph
Changefontsize,addtitletoxaxis.
-
12
Figure16:Themenutochangethesizeoftheplottedlineormarkers
Figure17:ThismenuallowsyoutoaddatitlethatIhaveusedasanxaxistitle
-
13
Figure18:Allgraphsmusthavexaxisandyaxislabels.WhenusingPolymathyoumustmanuallyaddayaxislabel.
ObjectiveFunctionf(Tbp)(mm Hg)
-
14
ObjectiveFunctionf(Tbp)(mmHg)
Thispageplusthehandwrittenpagesshouldbeturnedinalongwiththehandcalculations.Noticethatiftheproblemrequestedananswerofabubblepointandmolefractionsthenthesemustbegivenbythestudentwithboxesaroundtheanswer.Itisbesttodothisbywritingtheansweronthehandcalculationpageorbytypingitonthispage.Forpartsb&cthenagreenengineeringpagemustfollowthisonewiththesetupof2.10partb.Thiswouldbepage3oftheassignmentor3/6.
POLYMATH Report C&S 2.10a: Bubble Point Calculation for an
Ideal Binary MixtureNonlinear Equation 12-Jan-2009Calculated values
of NLE variables Variable Value f(x) Initial Guess
1 Tbp 63.66452 1.722E-10 55. ( 10. < Tbp < 100. )
Variable Value
1 Pvapc5 1784.045
2 Pvapc6 646.2172
3 xc5 0.1
4 xc6 0.9 Nonlinear equations 1 f(Tbp) =
xc5*Pvapc5+xc6*Pvapc6-760 = 0
T is in C and Pvap is in mm Hg
Explicit equations 1 Pvapc6 =
10^(6.87776-1171.53/(Tbp+224.366))
2 Pvapc5 = 10^(6.85221-1064.63/(Tbp+232))
3 xc6 = 0.9
4 xc5 = 0.1 General Settings Total number of equations 5 Number
of implicit equations 1 Number of explicit equations 4 Elapsed time
0.0000 sec Solution method SAFENEWT Max iterations 150 Tolerance F
0.0000001 Tolerance X 0.0000001 Tolerance min 0.0000001 Data
file:
-
15
ExampleoftheLinearEquationSolverbasedonCutlip&ShachamProblem2.4a:SteadyStateMaterialBalanceseonaSeparationTrainThis
problem is in your Cutlip and Shacham text. In presenting this
tutorial I have given you an example of how I would like computer
oriented problems to be submitted for homework. Again, every
problem starts with a hand written statement of the problem
following the engineering homework format given in the
syllabus.
-
17
Figure19:Fullyenteredproblem.MakesurethatthehandcalculationsshowtheoriginationoftheBcolumnnumbers.Alsoenteratitleandsavetheproblem
Figure20:Problemtitlescreen
-
18
Figure21:Thisscreenappearsafterpressingthesolverbutton.Youshouldselectallandthencopythispageintoaworddocument,tobesubmittedwithyourhandwrittenwork.Rememberthatyoucantypeorwriteanswerstoproblemsonthesepages.
-
19
Thiswouldbepage3ofproblem2.4aorforthe2problemhomeworksetpage6/6
POLYMATH Report Problem 2.10 Steady-State Material Balances on a
Separation TrainLinear Equations 12-Jan-2009 Linear Equations
Solution Variable Value
1 x1 26.25
2 x2 17.5
3 x3 8.75
4 x4 17.5
The equations [1] 0.07x1 + 0.18x2 + 0.15x3 + 0.24x4 = 10.5 [2]
0.04x1 + 0.24x2 + 0.10x3 + 0.65x4 = 17.5 [3] 0.54x1 + 0.42x2 +
0.54x3 + .1x4 = 28 [4] 0.35x1 + 0.16x2 + 0.21x3 + .01x4 = 14
Coefficients matrix and beta vector x1 x2 x3 x4 beta
1 0.07 0.18 0.15 0.24 10.5
2 0.04 0.24 0.1 0.65 17.5
3 0.54 0.42 0.54 0.1 28.
4 0.35 0.16 0.21 0.01 14.
General Number of equations: 4 Data file:
e:\laptop\courses\principleschemprocii\lecture\c&s2.4a.pol
A check of the answer would be that the sum of each of the 4
streams should equal 70 kmol/min:
26.25 kmol/min +17.5 kmol/min +8.75 kmol/min +17.5 kmol/min = 70
kmol/min
Remember that numbers always have units!
-
20
ExampleoftheDifferentialEquationSolverThis example is based on a
batch reactor with 2 simultaneous chemical reactions. A component
mole balance is constructed for chemical species. Since this is a
batch reactor then the mole balances are differential equations. If
this problem was an assigned homework problem then the first page
of the problem would be a hand written setup of the problem. This
page would contain:
Setup of the component species mole balances including a diagram
of the process (process flow diagram, pfd)
Initial conditions Sample calculations showing the order of
magnitude of the results.
For example the mole balances for A, B and C are given by
(1)
(2)
(3)
The initial conditions in the batch reactor at t=0 min are
A(0)=1 kmol/L, B(0)=0 kmol/L and C(0)=0 kmol/L. These are known as
initial values. The integration will proceed from 0 min to t=3 min.
The rate constants are k1=1 min-1 and k2=2 min-1.
The following would be a sample calculation to show the order of
magnitude of a change in the concentration of A with time. Using
the initial conditions the initial change in A with time is:
1 1 / 1 / min (4)
An estimate of the value of after 1 minute would be (NOTICE that
this is not a correct integration of the differential equation.
This is ONLY an ESTIMATE and an assumption is made that the rate is
constant. From this problem you will see that the rate starts at
this initial value and then decreases with decreasing concentration
of A.)
/~ 1 / min
1/ 1 / (5)
The above result gives the final value the concentration of A to
be zero. In other words if the reaction rate was at 1 kmol/(L min)
for 1 minute, then there would be no reactant A left. It is
-
21
then up to the student doing the problem to evaluate if this
reaction rate is what was specified or should the rate be 10 times
lower.
1. Start the Differential Equations Solver by selecting Program,
DEQ Differential Equations and keep the help window open
2. Choose the Differential Equations solver in the help menu
3. Enter the 3 differential Equations and supporting explicit
algebraic equations. To do this and
learn about POLYMATH, I suggest that you read through the
POLYMATH help file starting with the Overview section. After
entering the equations and running the program return to step
3.6.
-
22
4. Sort the equation by using the button
5. Now enter a problem title by selecting Edit, Enter Problem
Title
-
23
6. Add a graph to the output by clicking the box and rerun the
program
7. Edit the POLYMATH produced graph by
doing the following: a. Open the Design or Graph properties
window by clicking on the paint brush Increase the width of the
lines to a 2
b. Add a title c. Change the x,y axis to a decimal with 2
digits showing
Graph
DesignorGraphProperties
-
24
d. Open the Curves and Functions menu and edit the x-axis by
selecting the Label
button. The x-axis should have a label: time (s). Always give
units on labels. Please note that the SI abbreviation for seconds
is s.
e. The only part missing is the y-axis which will be entered
later. You can do this
either by writing on the paper or adding text as shown next. 8.
Now prepare this polymath program results to be handed in for a
homework assignment.
This is what you will do for all homework assignments involving
POLYMATH. a. Select the Differential Equations Solution output
screen, click on the text and
then choose Edit, Select All. Then paste this into a word
document. b. Copy the graph (you can use the copy button, Ctrl + C
etc.) c. In word select the graph and use text wrapping so that the
output will fit on one
page. d. Now add a y-axis using the textbox tool. Concentration
(mol/m3)
CurvesandFunctions
-
25
Calculated values of DEQ variables Variable Initial value
Minimal value Maximal value Final value
1 A 1. 0.0497871 1. 0.0497871
2 B 0 0 0.2499865 0.0473083
3 C 0 0 0.9029046 0.9029046
4 k1 1. 1. 1. 1.
5 k2 2. 2. 2. 2.
6 t 0 0 3. 3. Differential equations
1 d(A)/d(t) = -k1*A
Concentration of component A
2 d(C)/d(t) = k2*B
Concentration of component C
3 d(B)/d(t) = k1*A-k2*B
Concentration of Component B
Explicit equations 1 k2 = 2
Reaction rate constant with respect to A
2 k1 = 1 Reaction rate constant with respect to A
General
POLYMATH Report Concentration Profile of Series ReactionOrdinary
Differential Equations 22-Jan-2008
Total number of equations 5 Number of differential equations 3
Number of explicit equations 2 Elapsed time 0.000 sec Solution
method RKF_45 Step size guess. h 0.000001 Truncation error
tolerance. eps 0.000001
Concentrationmol/m3
Figure22:ConcentrationProfileofaSeriesReaction
-
26
9. The above was probably too much work for a graph. An
alternative method which I prefer is to use excel to produce the
graph. In this case you should do the following
a. Select the Table output button
b. Run the program again c. Select the table d. Click on the
upper left corner of the table (similar to excel)
e. Then select Edit, Copy With Headers. (This will copy the
names of the variables
as well as the numbers) f. Paste this into an excel spreadsheet
and produce a graph with all titles given and
labels. Notice that for computer generated data, no markers are
used. Draw this data using a line and not markers.
UpperleftCornerSelectsall
CopywithHeaders
-
27
Calculated values of DEQ variables Variable Initial value
Minimal value Maximal value Final value
1 A 1. 0.0497871 1. 0.0497871
2 B 0 0 0.2499865 0.0473083
3 C 0 0 0.9029046 0.9029046
4 k1 1. 1. 1. 1.
5 k2 2. 2. 2. 2.
6 t 0 0 3. 3. Differential equations
1 d(A)/d(t) = -k1*A
Concentration of component A
2 d(C)/d(t) = k2*B
Concentration of component C
3 d(B)/d(t) = k1*A-k2*B
Concentration of Component B Explicit equations
1 k2 = 2
Reaction rate constant with respect to A
2 k1 = 1
Reaction rate constant with respect to A General
POLYMATH Report Concentration Profile of Series ReactionOrdinary
Differential Equations 22-Jan-2008
Total number of equations 5 Number of differential equations 3
Number of explicit equations 2 Elapsed time 0.000 sec Solution
method RKF_45 Step size guess. h 0.000001 Truncation error
tolerance. eps 0.000001
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0 0.5 1 1.5 2 2.5 3
Concen
tration(m
ol/m
3 )
Time(s)
A
C
B
Figure23:ConcentrationProfileofaSeriesReaction
-
28
Excel Hint:
Did you know that one way to select a column of data is to hold
the shift key down and double click on the lower line? For example
to select the Column C data go to cell C1 and double click on the
line between rows 1 and 2 . Similarly if you want to move to the
bottom of a data set you can just double click on the lower dark
black line without holding the shift key.
To be submitted as specified by the instructor using Blackboard.
Submit in one word document per person. Save the word document
using the following format: yournamePolymath.docx
1. Answers to questions on page 2 2. 1 pagePrintout of NLE
C&S 2.10a 3. 1 page printout of LEQ C&S 2.4a 4. 1 page
printout of DEQ solver output with graph.
Holdingtheshiftkey;doubleclickonthelowerdarkblackline