ebook img

Numerical Methods for Chemical Engineering - Applications in MATLAB® PDF

515 Pages·2007·6.539 MB·515\515
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Numerical Methods for Chemical Engineering - Applications in MATLAB®

Numerical Methods for Chemical Engineering Applications in M ® ATLAB KENNETH J. BEERS MassachusettsInstituteofTechnology cambridge university press Cambridge,NewYork,Melbourne,Madrid,CapeTown,Singapore,Sa˜oPaulo, Delhi CambridgeUniversityPress TheEdinburghBuilding,CambridgeCB28RU,UK PublishedintheUnitedStatesofAmericabyCambridgeUniversityPress,NewYork www.cambridge.org Informationonthistitle:www.cambridge.org/9780521859714 (cid:2)C K.J.Beers2007 Thispublicationisincopyright.Subjecttostatutoryexception andtotheprovisionsofrelevantcollectivelicensingagreements, noreproductionofanypartmaytakeplacewithout thewrittenpermissionofCambridgeUniversityPress. Firstpublished2007 Reprinted 2009 PrintedintheUnitedKingdomattheUniversityPress,Cambridge AcatalogrecordforthispublicationisavailablefromtheBritishLibrary ISBN 978-0-521-85971-4 hardback CambridgeUniversityPresshasnoresponsibilityforthepersistenceoraccuracyofURLsforexternal orthird-partyinternetwebsitesreferredtointhispublication,anddoesnotguaranteethatanycontent onsuchwebsitesis,orwillremain,accurateorappropriate.Informationregardingprices,travel timetablesandotherfactualinformationgiveninthisworkarecorrectatthetimeoffirstprintingbut CambridgeUniversityPressdoesnotguaranteetheaccuracyofsuchinformationthereafter. Preface Thistextfocusesontheapplicationofquantitativeanalysistothefieldofchemicalengi- neering. Modern engineering practice is becoming increasingly more quantitative, as the useofscientificcomputingbecomesevermorecloselyintegratedintothedailyactivities ofallengineers.Itisnolongerthedomainofasmallcommunityofspecialistpractitioners. Whereasinthepast,onehadtohand-craftaprogramtosolveaparticularproblem,carefully husbandingthelimitedmemoryandCPUcyclesavailable,nowwecanveryquicklysolvefar morecomplexproblemsusingpowerful,widely-availablesoftware.Thishasintroducedthe needforresearchengineersandscientiststobecomecomputationallyliterate–toknowthe possibilitiesthatexistforapplyingcomputationtotheirproblems,tounderstandthebasic ideasbehindthemostimportantalgorithmssoastomakewisechoiceswhenselectingand tuningthem,andtohavethefoundationalknowledgenecessarytonavigateindependently throughtheliterature. This text meets this need, and is written at the level of a first-year graduate student inchemicalengineering,aconsequenceofitsdevelopmentforuseatMITforthecourse 10.34, “Numerical methods applied to chemical engineering.” This course was added in 2001tothegraduatecorecurriculumtoprovideallfirst-yearMastersandPh.D.students withanoverviewofquantitativemethodstoaugmenttheexistingcorecoursesintransport phenomena,thermodynamics,andchemicalreactionengineering.Carehasbeentakento develop any necessary material specific to chemical engineering, so this text will prove usefultootherengineeringandscientificfieldsaswell.Thereaderisassumedtohavetaken the traditional undergraduate classes in calculus and differential equations, and to have ® someexperienceincomputerprogramming,althoughnotnecessarilyinMATLAB . Even a cursory search of the holdings of most university libraries shows there to be a greatnumberoftextswithtitlesthatarevariationsof“AdvancedEngineeringMathematics” or“NumericalMethods.”Sowhyaddyetanother? I find that there are two broad classes of texts in this area. The first focuses on intro- ducing numerical methods, applied to science and engineering, at the level of a junior orseniorundergraduateelectivecourse.Thescopeisnecessarilylimitedtorathersimple techniquesandapplications.Thesecondclassistargetedtoresearch-levelworkers,either higher graduate-level applied mathematicians or computationally-focused researchers in scienceandengineering.Thesemaybeeitheradvancedtreatmentsofnumericalmethods formathematicians,ordetaileddiscussionsofscientificcomputingasappliedtoaspecific subjectsuchasfluidmechanics. ix x Preface Neitheroftheseclassesoftextisappropriateforteachingthefundamentalsofscientific computingtobeginningchemicalengineeringgraduatestudents.Examplesshouldbetyp- ical of those encountered in graduate-level chemical engineering research, and while the studentsshouldgainanunderstandingofthebasisofeachmethodandanappreciationof itslimitations,theydonotneedexhaustivetheory-prooftreatmentsofconvergence,error analysis, etc. It is a challenge for beginning students to identify how their own problems maybemappedintoonesamenabletoquantitativeanalysis;therefore,anyappropriatetext shouldhaveanextensivelibraryofworkedexamples,withcodeavailabletoservelateras templates.Finally,thetextshouldaddresstheimportanttopicsofmodeldevelopmentand parameterestimation.Thisbookhasbeendevelopedwiththeseneedsinmind. Thistextfirstpresentsafundamentaldiscussionoflinearalgebra,toprovidethenecessary foundationtoreadtheappliedmathematicalliteratureandprogressfurtheronone’sown. Next, a broad array of simulation techniques is presented to solve problems involving systems of nonlinear algebraic equations, initial value problems of ordinary differential anddifferential-algebraic(DAE)systems,optimizations,andboundaryvalueproblemsof ordinary and partial differential equations. A treatment of matrix eigenvalue analysis is included,asitisfundamentaltoanalyzingthesesimulationtechniques. Nextfollowsadetaileddiscussionofprobabilitytheory,stochasticsimulation,statistics, andparameterestimation.Asengineeringbecomesmorefocuseduponthemolecularlevel, stochasticsimulationtechniquesgaininimportance.ParticularattentionispaidtoBrownian dynamics,stochasticcalculus,andMonteCarlosimulation.Statisticsandparameteresti- mationareaddressedfromaBayesianviewpoint,inwhichMonteCarlosimulationprovesa powerfulandgeneraltoolformakinginferencesandtestinghypothesesfromexperimental data. In each of these areas, topically relevant examples are given, along with MATLAB (www.mathworks.com)programsthatservethestudentsastemplateswhenlaterwriting their own code. An accompanying website includes a MATLAB tutorial, code listings of all examples, and a supplemental material section containing further detailed proofs and optionaltopics.Ofcourse,whilesignificantefforthasgoneintotestingandvalidatingthese programs,noguaranteeisprovidedandthereadershouldusethemwithcaution. Theproblemsaregradedbydifficultyandlengthineachchapter.ThoseofgradeAare simple and can be done easily by hand or with minimal programming. Those of grade B requiremoreprogrammingbutarestillratherstraightforwardextensionsorimplementations oftheideasdiscussedinthetext.ThoseofgradeCeitherinvolvesignificantthinkingbeyond thecontentpresentedinthetextorprogrammingeffortatalevelbeyondthattypicalofthe examplesandgradeBproblems. Thesubjectscoveredarebroadinscope,leadingtotheconsiderable(thoughhopefully notexcessive)lengthofthistext.Thefocusisuponprovidingafundamentalunderstanding oftheunderlyingnumericalalgorithmswithoutnecessarilyexhaustivelytreatingalloftheir details,variations,andcomplexitiesofuse.Masteryofthematerialinthistextshouldenable first-yeargraduatestudentstoperformoriginalworkinapplyingscientificcomputationto their research, and to read the literature to progress independently to the use of more sophisticatedtechniques. Preface xi Writing a book is a lengthy task, and one for which I have enjoyed much help and support.ProfessorWilliamGreenofMIT,withwhomItaughtthiscourseforonesemester, generouslysharedhisopinionsofanearlydraft.Theteachingassistantswhohaveworked onthecoursehavealsobeenagreatsourceoffeedbackandhelpinproblem-development, ashave,ofcourse,thestudentswhohavewrestledwithintermediatedraftsandmyevolving approachtoteachingthesubject.MyPh.D.studentsJungmeeKang,KirillTitievskiy,Erik Allen, and Brian Stephenson have shown amazing forbearance and patience as the text becameanadditional,andsometimesdemanding,memberofthegroup.Aboveall,Imust thankmyfamily,andespeciallymysupportivewifeJen,whohavebeentrackingmyprogress andeagerlyawaitingthecompletionofthebook. Contents Preface pageix 1 Linearalgebra 1 Linearsystemsofalgebraicequations 1 Reviewofscalar,vector,andmatrixoperations 3 Eliminationmethodsforsolvinglinearsystems 10 Existenceanduniquenessofsolutions 23 Thedeterminant 32 Matrixinversion 36 Matrixfactorization 38 Matrixnormandrank 44 Submatricesandmatrixpartitions 44 Example.Modelingaseparationsystem 45 Sparseandbandedmatrices 46 MATLABsummary 56 Problems 57 2 Nonlinearalgebraicsystems 61 Existenceanduniquenessofsolutionstoanonlinearalgebraicequation 61 IterativemethodsandtheuseofTaylorseries 62 Newton’smethodforasingleequation 63 Thesecantmethod 69 Bracketingandbisectionmethods 70 Findingcomplexsolutions 70 Systemsofmultiplenonlinearalgebraicequations 71 Newton’smethodformultiplenonlinearequations 72 EstimatingtheJacobianandquasi-Newtonmethods 77 Robustreduced-stepNewtonmethod 79 Thetrust-regionNewtonmethod 81 SolvingnonlinearalgebraicsystemsinMATLAB 83 Example.1-Dlaminarflowofashear-thinningpolymermelt 85 Homotopy 88 Example.Steady-statemodelingofacondensation polymerizationreactor 89 v vi Contents Bifurcationanalysis 94 MATLABsummary 98 Problems 99 3 Matrixeigenvalueanalysis 104 Orthogonalmatrices 104 Aspecificexampleofanorthogonalmatrix 105 Eigenvaluesandeigenvectorsdefined 106 Eigenvalues/eigenvectorsofa2×2realmatrix 107 Multiplicityandformulasforthetraceanddeterminant 109 Eigenvaluesandtheexistence/uniquenesspropertiesoflinear systems 110 Estimatingeigenvalues;Gershgorin’stheorem 111 ApplyingGershgorin’stheoremtostudytheconvergenceofiterative linearsolvers 114 Eigenvectormatrixdecompositionandbasissets 117 NumericalcalculationofeigenvaluesandeigenvectorsinMATLAB 123 Computingextremaleigenvalues 126 TheQRmethodforcomputingalleigenvalues 129 Normalmodeanalysis 134 Relaxingtheassumptionofequalmasses 136 Eigenvalueproblemsinquantummechanics 137 SinglevaluedecompositionSVD 141 Computingtherootsofapolynomial 148 MATLABsummary 149 Problems 149 4 Initialvalueproblems 154 Initialvalueproblemsofordinarydifferentialequations (ODE-IVPs) 155 Polynomialinterpolation 156 Newton–Cotesintegration 162 Gaussianquadrature 163 Multidimensionalintegrals 167 LinearODEsystemsanddynamicstability 169 OverviewofODE-IVPsolversinMATLAB 176 Accuracyandstabilityofsingle-stepmethods 185 StiffstabilityofBDFmethods 192 Symplecticmethodsforclassicalmechanics 194 Differential-algebraicequation(DAE)systems 195 Parametriccontinuation 203 MATLABsummary 207 Problems 208 Contents vii 5 Numericaloptimization 212 Localmethodsforunconstrainedoptimizationproblems 212 Thesimplexmethod 213 Gradientmethods 213 Newtonlinesearchmethods 223 Trust-regionNewtonmethod 225 Newtonmethodsforlargeproblems 227 UnconstrainedminimizerfminuncinMATLAB 228 Example.Fittingakineticratelawtotime-dependentdata 230 Lagrangianmethodsforconstrainedoptimization 231 ConstrainedminimizerfminconinMATLAB 242 Optimalcontrol 246 MATLABsummary 252 Problems 252 6 Boundaryvalueproblems 258 BVPsfromconservationprinciples 258 Real-spacevs.function-spaceBVPmethods 260 Thefinitedifferencemethodappliedtoa2-DBVP 260 Extendingthefinitedifferencemethod 264 Chemicalreactionanddiffusioninasphericalcatalystpellet 265 Finitedifferencesforaconvection/diffusionequation 270 Modelingatubularchemicalreactorwithdispersion;treating multiplefields 279 NumericalissuesfordiscretizedPDEswithmorethantwo spatialdimensions 282 TheMATLAB1-Dparabolicandellipticsolverpdepe 294 Finitedifferencesincomplexgeometries 294 Thefinitevolumemethod 297 Thefiniteelementmethod(FEM) 299 FEMinMATLAB 309 FurtherstudyinthenumericalsolutionofBVPs 311 MATLABsummary 311 Problems 312 7 Probabilitytheoryandstochasticsimulation 317 Thetheoryofprobability 317 Importantprobabilitydistributions 325 Randomvectorsandmultivariatedistributions 336 Browniandynamicsandstochasticdifferentialequations (SDEs) 338 Markovchainsandprocesses;MonteCarlomethods 353 Geneticprogramming 362 viii Contents MATLABsummary 364 Problems 365 8 Bayesianstatisticsandparameterestimation 372 Generalproblemformulation 372 Example.Fittingkineticparametersofachemicalreaction 373 Single-responselinearregression 377 Linearleast-squaresregression 378 TheBayesianviewofstatisticalinference 381 Theleast-squaresmethodreconsidered 388 Selectingapriorforsingle-responsedata 389 Confidenceintervalsfromtheapproximateposteriordensity 395 MCMCtechniquesinBayesiananalysis 403 MCMCcomputationofposteriorpredictions 404 Applyingeigenvalueanalysistoexperimentaldesign 412 Bayesianmultiresponseregression 414 Analysisofcompositedatasets 421 Bayesiantestingandmodelcriticism 426 Furtherreading 431 MATLABsummary 431 Problems 432 9 Fourieranalysis 436 Fourierseriesandtransformsinonedimension 436 1-DFouriertransformsinMATLAB 445 Convolutionandcorrelation 447 Fouriertransformsinmultipledimensions 450 Scatteringtheory 452 MATLABsummary 459 Problems 459 References 461 Index 464 1 Linear algebra Thischapterdiscussesthesolutionofsetsoflinearalgebraicequationsanddefinesbasic vector/matrix operations. The focus is upon elimination methods such as Gaussian elim- ination, and the related LU and Cholesky factorizations. Following a discussion of these methods,theexistenceanduniquenessofsolutionsareconsidered.Exampleapplications includethemodelingofaseparationsystemandthesolutionofafluidmechanicsboundary valueproblem.Thelatterexampleintroducestheneedforsparse-matrixmethodsandthe computationaladvantagesofbandedmatrices.Becauselinearalgebraicsystemshave,under well-defined conditions, a unique solution, they serve as fundamental building blocks in more-complexalgorithms.Thus,linearsystemsaretreatedhereatahighlevelofdetail,as theywillbeusedoftenthroughouttheremainderofthetext. Linear systems of algebraic equations WewishtosolveasystemofNsimultaneouslinearalgebraicequationsfortheNunknowns x ,x ,...,x ,thatareexpressedinthegeneralform 1 2 N a x +a x +···+a x =b 11 1 12 2 1N N 1 a x +a x +···+a x =b 21 1 22 2 2N N 2 (1.1) . . . a x +a x +···+a x =b N1 1 N2 2 NN N N a is the constant coefficient (assumed real) that multiplies the unknown x in equation ij j i. b is the constant “right-hand-side” coefficient for equation i, also assumed real. As a i particularexample,considerthesystem x +x +x =4 1 2 3 2x +x +3x =7 (1.2) 1 2 3 3x +x +6x =2 1 2 3 forwhich a =1 a =1 a =1 b =4 11 12 13 1 a =2 a =1 a =3 b =7 (1.3) 21 22 23 2 a =3 a =1 a =6 b =2 31 32 33 3 1

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.