Skip to main content

Finite Differences and the Method of Lines

  • Chapter
  • First Online:
Simulation of ODE/PDE Models with MATLAB®, OCTAVE and SCILAB

Abstract

In this chapter, finite difference (FD) approximations and the method of lines, which combine FD with available time integrators, are discussed. First, a convection diffusion-reaction PDE is used to introduce a few basic FD schemes and addresses the concept of stability of the numerical scheme. As a rule of thumb, centered FD schemes appear as good choices for approximating second-order (diffusion) operators, whereas upwind FD schemes are preferable to first-order (convection) operators. Once stability is ensured, accuracy can be adjusted by selecting appropriately the fineness of the spatial grid and the order of the FD approximation (i.e. the stencil of points on which the FD approximation is built). The calculation of FD approximation can be conveniently organized using differentiation matrices, which are easy to manipulate in MATLAB, SCILAB, or OCTAVE. FD can also be efficiently computed on arbitrarily spaced grids using an algorithm due to Fornberg. This chapter continues with a presentation of different methods to take the boundary conditions into account. Boundary conditions are an essential part of the IBVP definition, and several methods for translating the BCs in the code implementation are presented. Finally, attention is paid to the computation of the Jacobian matrix of the ODE system, which is used by various solvers.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 139.00
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 179.00
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info
Hardcover Book
USD 179.99
Price excludes VAT (USA)
  • Durable hardcover edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

References

  1. Schiesser WE (1991) The numerical method of lines. Academic Press, San Diego

    MATH  Google Scholar 

  2. Owens DH (1981) Multivariable and optimal systems. Academic Press, London

    Google Scholar 

  3. Varga RS (1981) Matrix iterative analysis. Prentice-Hall, New York

    Google Scholar 

  4. Glansdorff P, Prigogine I (1971) Thermodynamic theory of structure, stability and fluctuations. Wiley-Interscience, New York

    MATH  Google Scholar 

  5. Hairer E, Wanner G (1996) Solving ordinary differential equations II: stiff and differential algebraic problems. Springer, Berlin

    Book  MATH  Google Scholar 

  6. Fornberg B (1988) Generation of finite difference formulas on arbitrarily spaced grids. Math Comput 51(184):699–706

    Article  MATH  MathSciNet  Google Scholar 

  7. Fornberg B (1998) Calculation of weights in finite difference formulas. SIAM Rev 40(3):685–691

    Article  MATH  MathSciNet  Google Scholar 

  8. Weng HS, Eigenberger G, Butt JB (1975) Catalyst poisoning and fixed bed reactor dynamics. Chem Eng Sci 30(11):1341–1351

    Article  Google Scholar 

  9. Tali-Maamar N, Damak T, Babary JT, Nihtilä MT (1993) Application of a collocation method for simulation of distributed parameter bioreactors. Math Comp Sim 35:303–319

    Article  Google Scholar 

  10. Lyness JN, Moler CB (1967) Numerical differentiation of analytic functions. SIAM J Numer Anal 4(2):202–210

    Article  MATH  MathSciNet  Google Scholar 

  11. Squire W, Trapp G (1998) Using complex variables to estimate derivatives of real functions. SIAM Rev 40(1):110–112

    Article  MATH  MathSciNet  Google Scholar 

  12. Cao Y (2008) Complex step jacobian. Technical Report 18176, Matlab Central

    Google Scholar 

  13. Brewster MW, Gobber MK (2011) A comparative evaluation of matlab, octave, freemat, and scilab on tara. Technical Report HPCF-2011-10, Department of Mathematics and Statistics, University of Maryland, Baltimore County

    Google Scholar 

Further Reading

  1. Vande Wouwer A, Saucez P, Schiesser WE (2001) Adaptive method of lines. Chapman Hall/CRC, Boca Raton

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Alain Vande Wouwer .

Rights and permissions

Reprints and permissions

Copyright information

© 2014 Springer International Publishing Switzerland

About this chapter

Cite this chapter

Vande Wouwer, A., Saucez, P., Vilas, C. (2014). Finite Differences and the Method of Lines. In: Simulation of ODE/PDE Models with MATLAB®, OCTAVE and SCILAB. Springer, Cham. https://doi.org/10.1007/978-3-319-06790-2_3

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-06790-2_3

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-06789-6

  • Online ISBN: 978-3-319-06790-2

  • eBook Packages: EngineeringEngineering (R0)

Publish with us

Policies and ethics