“FM” — 2017/10/11 — 12:40 — page 1 — #1 NUMERICAL SOLUTION OF DIFFERENTIAL EQUATIONS This introduction to finite difference and finite element methods is aimed at advancedundergraduateandgraduatestudentswhoneedtosolvedifferential equations. The prerequisites are few (basic calculus, linear algebra, and ordi- naryandpartialdifferentialequations)andsothebookwillbeaccessibleand usefultoreadersfromarangeofdisciplinesacrossscienceandengineering. Part I begins with finite difference methods. Finite element methods are thenintroducedinPartII.Ineachpart,theauthorsbeginwithacomprehen- sive discussion of one-dimensional problems, before proceeding to consider two or higher dimensions. An emphasis is placed on numerical algorithms, relatedmathematicaltheory,andessentialdetailsintheimplementation,while someusefulpackagesarealsointroduced.Theauthorsalsoprovidewell-tested Matlab® codes,allavailableonline. ZHILINLIisatenuredfullprofessorattheCenterforScientificComputation& DepartmentofMathematicsatNorthCarolinaStateUniversity.Hisresearch area is in applied mathematics in general, particularly in numerical analysis for partial differential equations, moving interface/free boundary problems, irregular domain problems, computational mathematical biology, and sci- entific computing and simulations for interdisciplinary applications. Li has authoredonemonograph,TheImmersedInterfaceMethod,andalsoeditedsev- eralbooksandproceedings. ZHONGHUAQIAO is an associate professor in the Department of Applied MathematicsattheHongKongPolytechnicUniversity. TAOTANG is a professor in the Department of Mathematics at Southern UniversityofScienceandTechnology,China. 13:40:38, subject to the Cambridge Core “FM” — 2017/10/11 — 12:40 — page 2 — #2 13:40:38, subject to the Cambridge Core “FM” — 2017/10/11 — 12:40 — page 3 — #3 NUMERICAL SOLUTION OF DIFFERENTIAL EQUATIONS Introduction to Finite Difference and Finite Element Methods ZHILIN LI NorthCarolinaStateUniversity,USA ZHONGHUA QIAO HongKongPolytechnicUniversity,China TAO TANG SouthernUniversityofScienceandTechnology,China 13:40:38, subject to the Cambridge Core “FM” — 2017/10/11 — 12:40 — page 4 — #4 UniversityPrintingHouse,CambridgeCB28BS,UnitedKingdom OneLibertyPlaza,20thFloor,NewYork,NY10006,USA 477WilliamstownRoad,PortMelbourne,VIC3207,Australia 314–321,3rdFloor,Plot3,SplendorForum,JasolaDistrictCentre,NewDelhi–110025,India 79AnsonRoad,#06-04/06,Singapore079906 CambridgeUniversityPressispartoftheUniversityofCambridge. ItfurtherstheUniversity’smissionbydisseminatingknowledgeinthepursuitof education,learning,andresearchatthehighestinternationallevelsofexcellence. www.cambridge.org Informationonthistitle:www.cambridge.org/9781107163225 DOI:10.1017/9781316678725 ©ZhilinLi,ZhonghuaQiao,andTaoTang2018 Thispublicationisincopyright.Subjecttostatutoryexception andtotheprovisionsofrelevantcollectivelicensingagreements, noreproductionofanypartmaytakeplacewithoutthewritten permissionofCambridgeUniversityPress. Firstpublished2018 PrintedintheUnitedKingdombyClays,StIvesplc AcataloguerecordforthispublicationisavailablefromtheBritishLibrary. ISBN978-1-107-16322-5Hardback ISBN978-1-316-61510-2Paperback CambridgeUniversityPresshasnoresponsibilityforthepersistenceoraccuracy ofURLsforexternalorthird-partyinternetwebsitesreferredtointhispublication anddoesnotguaranteethatanycontentonsuchwebsitesis,orwillremain, accurateorappropriate. 13:40:38, subject to the Cambridge Core “FM” — 2017/10/11 — 12:40 — page v — #5 Table of Contents Preface pageix 1 Introduction 1 1.1 BoundaryValueProblemsofDifferentialEquations 1 1.2 FurtherReading 5 PARTI FINITEDIFFERENCEMETHODS 7 2 FiniteDifferenceMethodsfor1DBoundaryValueProblems 9 2.1 ASimpleExampleofaFiniteDifferenceMethod 9 2.2 FundamentalsofFiniteDifferenceMethods 14 2.3 DerivingFDFormulasUsingtheMethodofUndetermined Coefficients 19 2.4 Consistency, Stability, Convergence, and Error Estimates of FDMethods 21 2.5 FDMethodsfor1DSelf-adjointBVPs 27 2.6 FDMethodsforGeneral1DBVPs 29 2.7 TheGhostPointMethodforBoundaryConditionsInvolving Derivatives 30 2.8 AnExampleofaNonlinearBVP 34 2.9 TheGridRefinementAnalysisTechnique 37 2.10 *1DIIMforDiscontinuousCoefficients 39 Exercises 44 3 FiniteDifferenceMethodsfor2DEllipticPDEs 47 3.1 BoundaryandCompatibilityConditions 49 3.2 TheCentralFiniteDifferenceMethodforPoissonEquations 51 3.3 TheMaximumPrincipleandErrorAnalysis 55 13:40:46, subject to the Cambridge Core “FM” — 2017/10/11 — 12:40 — page vi — #6 vi TableofContents 3.4 FiniteDifferenceMethodsforGeneralSecond-orderElliptic PDEs 60 3.5 SolvingtheResultingLinearSystemofAlgebraicEquations 61 3.6 AFourth-orderCompactFDSchemeforPoissonEquations 67 3.7 A Finite Difference Method for Poisson Equations in Polar Coordinates 69 3.8 Programmingof2DFiniteDifferenceMethods 72 Exercises 75 4 FDMethodsforParabolicPDEs 78 4.1 TheEulerMethods 80 4.2 TheMethodofLines 85 4.3 TheCrank–Nicolsonscheme 87 4.4 StabilityAnalysisforTime-dependentProblems 89 4.5 FDMethodsandAnalysisfor2DParabolicEquations 97 4.6 TheADIMethod 99 4.7 An Implicit–explicit Method for Diffusion and Advection Equations 104 4.8 SolvingEllipticPDEsusingNumericalMethodsforParabolic PDEs 105 Exercises 105 5 FiniteDifferenceMethodsforHyperbolicPDEs 108 5.1 CharacteristicsandBoundaryConditions 109 5.2 FiniteDifferenceSchemes 110 5.3 TheModifiedPDEandNumericalDiffusion/Dispersion 115 5.4 TheLax–WendroffSchemeandOtherFDmethods 117 5.5 NumericalBoundaryConditions 120 5.6 Finite Difference Methods for Second-order Linear HyperbolicPDEs 121 5.7 Some Commonly Used FD Methods for Linear System of HyperbolicPDEs 127 5.8 FiniteDifferenceMethodsforConservationLaws 127 Exercises 131 PARTII FINITEELEMENTMETHODS 133 6 FiniteElementMethodsfor1DBoundaryValueProblems 135 6.1 TheGalerkinFEMethodforthe1DModel 135 6.2 DifferentMathematicalFormulationsforthe1DModel 138 6.3 KeyComponentsoftheFEMethodforthe1DModel 143 13:40:46, subject to the Cambridge Core “FM” — 2017/10/11 — 12:40 — page vii — #7 TableofContents vii 6.4 Matlab Programming of the FE Method for the 1D Model Problem 152 Exercises 156 7 TheoreticalFoundationsoftheFiniteElementMethod 158 7.1 FunctionalSpaces 158 7.2 SpacesforIntegralForms,L2(Ω)andLp(Ω) 160 7.3 SobolevSpacesandWeakDerivatives 164 7.4 FEAnalysisfor1DBVPs 168 7.5 ErrorAnalysisoftheFEMethod 173 Exercises 178 8 IssuesoftheFEMethodinOneSpaceDimension 181 8.1 BoundaryConditions 181 8.2 TheFEMethodforSturm–LiouvilleProblems 185 8.3 High-orderElements 189 8.4 A1DMatlabFEPackage 195 8.5 TheFEMethodforFourth-orderBVPsin1D 208 8.6 TheLax–MilgramLemmaandtheExistenceofFESolutions 214 8.7 *1DIFEMforDiscontinuousCoefficients 221 Exercises 223 9 TheFiniteElementMethodfor2DEllipticPDEs 228 9.1 TheSecondGreen’sTheoremandIntegrationbyPartsin2D 228 9.2 WeakFormofSecond-orderSelf-adjointEllipticPDEs 231 9.3 TriangulationandBasisFunctions 233 9.4 Transforms,ShapeFunctions,andQuadratureFormulas 246 9.5 SomeImplementationDetails 248 9.6 SimplificationoftheFEMethodforPoissonEquations 251 9.7 SomeFESpacesinH1(Ω)andH2(Ω) 257 9.8 TheFEMethodforParabolicProblems 272 Exercises 275 Appendix:NumericalSolutionsofInitialValueProblems 279 A.1 SystemofFirst-orderODEsofIVPs 279 A.2 Well-posednessofanIVP 280 A.3 SomeFiniteDifferenceMethodsforSolvingIVPs 281 A.4 SolvingIVPsUsingMatlabODESuite 284 Exercises 288 References 289 Index 291 13:40:46, subject to the Cambridge Core “FM” — 2017/10/11 — 12:40 — page viii — #8 13:40:46, subject to the Cambridge Core “FM” — 2017/10/11 — 12:40 — page ix — #9 Preface Thepurposeofthisbookistoprovideanintroductiontofinitedifferenceand finite element methods for solving ordinary and partial differential equations ofboundaryvalueproblems.Thebookisdesignedforbeginninggraduatestu- dents,upperlevelundergraduatestudents,andstudentsfrominterdisciplinary areasincludingengineersandotherswhoneedtoobtainsuchnumericalsolu- tions. The prerequisite is a basic knowledge of calculus, linear algebra, and ordinary differential equations. Some knowledge of numerical analysis and partialdifferentialequationswouldalsobehelpfulbutnotessential. Theemphasisisontheunderstandingoffinitedifferenceandfiniteelement methodsandessentialdetailsintheirimplementationwithreasonablymathe- maticaltheory.PartIconsidersfinitedifferencemethods,andPartIIisabout finite element methods. In each part, we start with a comprehensive discus- sionofone-dimensionalproblemsbeforeproceedingtoconsidertwoorhigher dimensions. We also list some useful references for those who wish to know moreinrelatedareas. Thematerialsofthistextbookingeneralcanbecoveredinanacademicyear. Thetwopartsofthebookareessentiallyindependent.Thusitispossibletouse onlyonepartforaclass. Thisisatextbookbasedonmaterialsthattheauthorshaveused,andsome are from Dr. Randall J. LeVeque’s notes, in teaching graduate courses on the numericalsolutionofdifferentialequations.Mostsamplecomputerprogram- ming is written in Matlab®. Some advantages of Matlab are its simplicity, a widerangeoflibrarysubroutines,doubleprecisionaccuracy,andmanyexisting andemergingtool-boxes. Awebsitewww4.ncsu.edu/~zhilin/FD_FEM_Bookhasbeensetup,topostor linkcomputercodesaccompanyingthistextbook. We would like to thank Dr. Roger Hoskin, Lilian Wang, Peiqi Huang, and HongruChenforproofreadingthebook,orforprovidingMatlabcode. ix 08:57:00, subject to the Cambridge Core terms of use, 01 “FM” — 2017/10/11 — 12:40 — page x — #10 08:57:00, subject to the Cambridge Core terms of use, 01