55 views

Uploaded by Adriano Henrique

Traveling Wave Analysis

save

- Linux Journal
- 211ME3174
- Elmer Tutorials
- Nonlinear and Robust Control of PDE Systems (1)
- 33 2 Elliptic Pde
- Fourier
- Model of a Heat Exchanger ( Hyperbolic PDE)
- Sylabus
- SMA3116 Course Outline
- Web 5215
- MacSyma Userf Guide.pdf
- [Matematica] Il Metodo Della Tangente IPERBOLICA Per La Soluzione Di Equazioni Differenziali NON Lineanri_Hereman-Malfliet-WMSCI-2005
- Shannon Wavelet Regularization Methods for a Backward Heat Equation
- AEIE Final Upto 4th Year Syllabus
- Syllabus TE Numerical Methods
- fermenter
- S Coombes- Waves, bumps, and patterns in neural field theories
- Pde
- Lecture 9 Non-homogeneous Linear ODE, Method of Undetermined Coefficients
- 324638401-Carl-E-Froberg-Carl-Erik-Frhoberg-Introduction-BookFi-org-pdf.pdf
- Shooting Methods
- PFC Josue Aranda Ruiz
- An Application of the ADM to Seven-Order DKAYA
- Lecture 01 - systems modeling and control - ME575 class work
- Notification for General Recruitment UCEK JNTUK
- Numerical Solution of Planar Mechanism
- Lecture Notes CSM1
- Wikibooks Calculus
- Hsc Science March 2018 Board Question Paper of Maths
- Lecture 17
- Lang Muir
- Flow Through Packed and Fluidized Beds
- Ruthven-Adsorption
- Chemical Engineering Science Volume 27 Issue 10 1972 [Doi 10.1016%2F0009-2509%2872%2985046-2] Jaroslav Votruba; Vladimír Hlaváček; Miloš Marek -- Packed Bed Axial Thermal Conductivity
- Lagoas+de+Estabilizaçao
- Jiang, Jianwen-Metal-Organic Frameworks_ Materials Modeling Towards Engineering Applications-Pan Stanford Pub (2015)
- Heat Transfer in Packed Beds
- Aula 3 - Reatores Não Ideais (1)
- tese desorcao
- Dissertacao Carolina Niedesberg
- Interpretação - A Importância Da Comunicação Oral Na Engenharia
- Modelo Formatação de Trabalho Acadêmico
- Gne 147 - Projeto de Aterro Sanitario - Aula 09- Sistema de Tratamento Dos Percolados
- Apostila
- Rela Fisica 2.docx
- APS 01 - QM35E -
- Relatório 6
- relatorio de fisica 2 (dilatação linear)
- Questionário
- Shreve - Cap 16
- Lista 5 - Limites
- Lista de Cdi
- DBO-OXITOP AULA PRÁTICA
- ANEXO 4
- Lista 6 - Derivada
- Modelo Formatação de Trabalho Acadêmico
- Lista 2 - Classificação
- Lista 3 - Funções Aplicações
- Segunda Lista de Exercícios
- Relatorio 2 Quimica Analitica I
- Practica n° 10. Triaxiales
- Piedra Pizarra
- Biological Matrices
- Tablas de Equivalencias
- Exposición Siete Pasos Lidia
- Caracterización Demográfica de La Población Rural
- VLSM - Conceitos Básicos
- 17682 Example File
- Casos Parcticos de Tributa
- Informe de Caudal Tacsanapampa
- Huawei Certification HCDA Lab Guide v1.5
- Introduction to PLSQL
- MA1018_Guia_1
- Normas de convivencia en el aula
- Genetic Risk Factors
- ORGANOGRAFIA_VEGETAL
- ASTM D 1196
- Qué son Valores cívicos.docx
- 4.0.GLUCOLISIS_24474.pdf
- biologia_4
- Globalization or World Society-Luhmann
- Infecciones Del Tracto Genital Superior
- Catalogo Conjuntos de Puesta a Punto_02
- Unidad 1 Ingenieria Economica
- Petroleum Engineering Project Names
- Modelos mecánicos y orgánicos
- Direito Do Consumidor Modulto III
- 115422638 Sesion de Aprendizaje 1 Xmind
- IOA64 Digital

You are on page 1of 446

**Traveling Wave Analysis of
**

Partial Differential

Equations

**Traveling Wave Analysis of
**

Partial Differential

Equations

Numerical and Analytical Methods

with MATLABr and Maple™

Graham W. Griffiths

City University, London, UK

William E. Schiesser

Lehigh University, Bethlehem, PA, USA

**AMSTERDAM • BOSTON • HEIDELBERG • LONDON
**

NEW YORK • OXFORD • PARIS • SAN DIEGO

SAN FRANCISCO • SINGAPORE • SYDNEY • TOKYO

Academic Press is an imprint of Elsevier

**Academic Press is an imprint of Elsevier
**

30 Corporate Drive, Suite 400, Burlington, MA 01803, USA

The Boulevard, Langford Lane, Kidlington, Oxford, OX5 1GB, UK

Copyright © 2012 Elsevier Inc. All rights reserved.

**No part of this publication may be reproduced or transmitted in any form or by any means, electronic or
**

mechanical, including photocopying, recording, or any information storage and retrieval system, without

permission in writing from the publisher. Details on how to seek permission, further information about the

Publisher’s permissions policies and our arrangements with organizations such as the Copyright Clearance

Center and the Copyright Licensing Agency, can be found at our Web site www.elsevier.com/permissions

This book and the individual contributions contained in it are protected under copyright by the Publisher (other

than as may be noted herein).

MATLABr is a trademark of The MathWorks, Inc. and is used with permission. The MathWorks does not warrant

the accuracy of the text or exercises in this book. This book’s use or discussion of MATLABr software or related

products does not constitute endorsement or sponsorship by The MathWorks of a particular pedagogical

approach or particular use of the MATLABr software.

Notices

Knowledge and best practice in this field are constantly changing. As new research and experience broaden our

understanding, changes in research methods, professional practices, or medical treatment may become

necessary.

Practitioners and researchers must always rely on their own experience and knowledge in evaluating and using

any information, methods, compounds, or experiments described herein. In using such information or methods

they should be mindful of their own safety and the safety of others, including parties for whom they have a

professional responsibility.

To the fullest extent of the law, neither the Publisher nor the authors, contributors, or editors, assume any

liability for any injury and/or damage to persons or property as a matter of products liability, negligence or

otherwise, or from any use or operation of any methods, products, instructions, or ideas contained in the

material herein.

**Library of Congress Cataloging-in-Publication Data
**

Application submitted

**British Library Cataloguing-in-Publication Data
**

A catalogue record for this book is available from the British Library.

ISBN: 978-0-12-384652-5

**For information on all Academic Press publications
**

visit our Web site at www.elsevierdirect.com

Typeset by: diacriTech, India

**Printed in the United States of America
**

11 12 13 14 8 7 6 5 4 3 2 1

Dedication

To our teachers, with respect and appreciation.

Preface

**Partial differential equations (PDEs) have been developed and used in science and engineer-
**

ing for more than 200 years, yet they remain a very active area of research because of both

their role in mathematics and their application to virtually all areas of science and engineer-

ing. This research has been spurred by the relatively recent development of computer solution

methods for PDEs. These have extended PDE applications such that we can now quantify

broad areas of physical, chemical, and biological phenomena. The current development of PDE

solution methods is an active area of research that has benefited greatly from advances in com-

puter hardware and software, and the growing interest in addressing PDE models of increasing

complexity.

A large class of models now being actively studied are of a type and complexity such that

their solutions are usually beyond traditional mathematical analysis. Consequently, numeri-

cal methods have to be employed. These numerical methods, some of which are still being

developed, require testing and validation. This is often achieved by studying PDEs that have

known exact analytical solutions. The development of analytical solutions is also an active area

of research, with many advances being reported recently, particularly for systems described

by nonlinear PDEs. Thus, the development of analytical solutions directly supports the devel-

opment of numerical methods by providing a spectrum of test problems that can be used to

evaluate numerical methods.

This book surveys some of these new developments in analytical and numerical meth-

ods and is aimed at senior undergraduates, postgraduates, and professionals in the fields of

engineering, mathematics, and the sciences. It relates these new developments through the

exposition of a series of traveling wave solutions to complex PDE problems. The PDEs that have

been selected are largely named in the sense that they are generally closely linked to their orig-

inal contributors. These names usually reflect the fact that the PDEs are widely recognized and

are of fundamental importance to the understanding of many application areas. Each chapter

follows the general format:

. The PDE and its associated auxiliary conditions (initial conditions (ICs) and boundary

**. conditions (BCs)) are stated.
**

A series of routines is discussed with detailed explanations of the code and how it relates to

the PDE. They are written in Matlab but have been specifically programmed so that they

can be easily converted to equivalent routines in other languages. The routines have the

following common features:

– The numerical procedure is the method of lines (MOL) in which the boundary value

(spatial) partial derivatives are replaced with algebraic approximations, in the present

case finite differences (FDs), although other approximations such as finite elements

(FEs), finite volumes (FVs), and spectral methods (SMs) could be used. The FD

approximations are implemented in a series of library routines; the details of how these

routines were developed are given as an introduction to facilitate the development of

new routines that may be required for particular PDE applications.

**Traveling Wave Analysis of Partial Differential Equations. DOI: 10.1016/B978-0-12-384652-5.xxxxx-x
**

Copyright © 2011 by Elsevier Inc. All rights reserved.

xi

xii Preface

**– The resulting system of ordinary differential equations (ODEs) in an initial value
**

variable, typically time in an application, is then integrated numerically using an initial

value ODE integrator from the Matlab library.

– The displayed numerical output also includes the analytical solution and the difference

between the numerical and analytical solutions. The agreement between the two

solutions is displayed numerically and graphically as a way of demonstrating the

**. validity of the numerical methods.
**

An analytical solution for the PDE is stated, including a reference to the original source of

the solution, and in some cases, a verification (proof ) of the solution by substitution into

**. the PDE and auxiliary conditions.
**

Additionally, in several chapters, the analytical solution is derived by relatively new

techniques such as the tanh-, exp-, Riccati- or factorization-based methods. The derivation

is either by direct application of the analytical method or through the use of the computer

algebra system (CAS), Maple. Where Maple is used, the associated code is included in the

text along with a description of its main functional elements. This code usually

demonstrates the use of our new Maple procedures, which implement various analytical

methods that are described in the text. Graphical output from these Maple applications is

provided, including a 2D animation (to facilitate insight into and understanding of the

solution) and a plot in 3D perspective. Maple is also used in other chapters to confirm

analytical solutions from the literature. Where appropriate, the code is provided in the mws

**. file format as well as the mw format so that it will also run in early versions of Maple.
**

The form of the analytical solution is considered, with particular emphasis on traveling

wave analysis by which the PDE (in an Eulerian or fixed frame) is converted to an ODE (in a

Lagrangian or moving frame). An analytical solution to the ODE is then derived and the

**. inverse coordinate transformation is applied to provide an analytical solution to the PDE.
**

A second approach to a PDE analytical solution, the method of residual functions, is also

used in some of the chapters to derive an analytical solution to a PDE that is closely related

**. to the original PDE.
**

The basic approach of traveling wave analysis, whereby a PDE is transformed to an

associated ODE, is also reversed in two chapters. These start with ODEs that are then

restated as PDEs that are first and second order in the initial value variable. The analytical

**. solution to the initial ODE is then provided as an analytical solution to the PDE.
**

The structure of the PDE is usually revisited briefly with regard to its form, such as whether

it is first or second order in the initial value variable, the order of the boundary value

derivatives, the features of nonlinear terms, and the form of the BCs. In this way, the

intention of the final summary is to suggest concepts and computational approaches that

**. can be applied in new PDE applications.
**

Each chapter concludes with a discussion of the numerical solution, particularly how it

conforms to the initial statement of the PDE and its auxiliary conditions; also the

numerical solution is evaluated with regard to the magnitude of the errors and how these

**. errors might be reduced through additional computation.
**

In Chapter 2 we discuss the linear advection equation, one of the simplest PDEs, and show

that solutions involving steep gradients or discontinuities can be difficult to achieve

numerically. We then illustrate how flux limiters can be employed to improve the fidelity of

the numerical solution. A short appendix to this chapter is also included, which briefly

**. discusses some of the background to the ideas behind flux limiters.
**

A general appendix details the tanh-, exp-, Ricatti-, direct integration-, and

factorization-based methods. Maple implementation, by way of newly developed

procedures, is included for the tanh-, exp- and Ricatti-based analytical methods. As

Preface xiii

**referred to above, these general features are then referenced for specific applications in
**

appendices to individual chapters.

In summary the major focus of this book is the numerical MOL solution of PDEs and the

testing of numerical methods with analytical solutions, through a series of applications. The

origin of the analytical solutions through traveling wave and residual function analysis provides

a framework for the development of analytical solutions to nonlinear PDEs that are now widely

reported in the literature. Also in selected chapters, procedures based on the tanh, exp, and

Ricatti methods that have recently received major attention are used to illustrate the derivation

of analytical solutions. References are provided where appropriate to additional information

on the techniques and methods deployed.

Our intention is to provide a set of software tools that implement numerical and analytical

methods that can be applied to a broad spectrum of problems in PDEs. They are based on the

concept of a traveling wave and the central feature of these methods is conversion of the system

PDEs to ODEs. The discussion is limited to one-dimensional (1D) PDEs and complements our

earlier book A Compendium of Partial Differential Equation Models: Method of Lines Analysis

with Matlab, Cambridge University Press, 2009.

Finally all the code discussed in this book, along with a set of the MOL DSS library routines,

is available for download from www.pdecomp.net.

Graham W. Griffiths

Nayland, Suffolk, UK

William E. Schiesser

Bethlehem, PA, USA

June 1, 2010

and extension of the applica- tion to other cases that require a numerical solution. Thus.g.1) ∂t ∂x ∂x2 ∂x∂t ∂x2 ∂t . which gives us some assurance. Through this approach. We start with a brief introduction to the methods of traveling wave solutions and resid- ual functions to provide analytical solutions that can be used to test the numerical MOL procedures. we utilize analytical (exact) solutions for comparison with the numer- ical solutions. . we present two distinct methodologies with regard to the derivation of analytical solutions that have been widely used and reported extensively. In order to test MOL algorithms and software. The approach we have followed is. both in number and form. we hope to convey the essence of MOL and analyti- cal analysis as applied to a series of applications that illustrate a spectrum of important concepts and details. e. to illustrate the use of these meth- ods through example applications. In addition. numerical procedures (meth- ods. . 1 Introduction to Traveling Wave Analysis Most applications of partial differential equations (PDEs) in science and engineering require numerical solutions.. . The trav- eling wave analytical solutions are derived with Maple procedures and scripts that are also presented. (1. Traveling Wave Solutions We consider a general PDE ! ∂u ∂u ∂ 2 u ∂ 2 u ∂ 3 u = f u. implementation of the boundary conditions. algorithms) are available to compute numerical solutions to most problems. we introduce the method of lines (MOL).00001-7 1 Copyright © 2012 Elsevier Inc. calculation of the PDE spatial derivatives.. Traveling Wave Analysis of Partial Differential Equations DOI: 10. since the equations are typically too complicated. for each chapter. . a general numerical procedure that can be applied to all the major classes of PDEs. In this book.. . All rights reserved. They are (1) the traveling wave method and (2) the residual function method. typically a MOL numerical solution is presented for an important PDE through a parallel discussion of the equations and Matlab routines. In the subsequent discussion. an analytical solution is derived using either the associated traveling wave or residual function method. to admit analytical solutions. that the methods are correct. However..1016/B978-0-12-384652-5. The particular focus of the application is emphasized.

2) are = −kc. dU(ξ → ±∞) d2 U(ξ → ±∞) U(ξ → ±∞) = 0..3) are taken as zero. . (1. which applies standard calculus techniques to transform the problem into one that can be integrated. .. ∂x2 ∂x∂t since it corresponds to a linear translation along the x axis with respect to t. t) = U(ξ ).4) dξ dξ 2 Consequently. This case (ξ(x. second.. etc. ..3) have typically been achieved using many approaches. and higher spatial derivatives tend to zero as ξ → ∞. U(ξ ). dξ dξ dξ 2 dξ 2 dξ 3 or in canonical form ! dU dU d2 U d3 U = f U. . . (1. Analytical solutions of eq.. = 0. .2) dξ ∂x dξ ∂x2 dξ 2 ∂x dξ ∂x∂t dξ 2 ∂x ∂t ∂ξ ∂ξ For the linear case ξ(x. t) is a function to be specified..e.3) is an ordinary differential equation (ODE) in ξ (which illustrates a principal advantage of a traveling wave solution. + . then the solution to eq. (1. ∂x ∂x∂t 2 ∂x4 The solution process for eq. Direct integration method. . We discuss in detail the following methods in the main Appendix and give examples throughout the various chapters: . . t) = k(x − ct)) is generally termed a traveling wave.3) dξ dξ dξ 2 dξ 3 where the constants c and k are included in f ..e. a PDE is reduced to an ODE). i.3) is often based on the auxiliary conditions that the dependent variable and its first.k . t) = k(x − ct). . the partial derivatives in eq. can be found.1) follows as u(x. constants of integration produced during the solution of eq. . . The extension to other derivatives in eq.. where ξ = ξ(x.. (1.. Equation (1.. k and c are arbitrary constants generally termed the wavenumber and wave velocity. . = 0..1).1) can be written as ∂u dU ∂ξ dU ∂ξ ∂ dU ∂ξ ∂ dU ∂ξ ∂ ∂ dU ∂ξ = = f U.. (1. (1. ∂ 3u ∂ 3u ∂ 4u such as 3 . see appendix 3 of [6]. i. respectively. t) = U(ξ ). For this case. k . eq. (1.2 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS which can be analyzed through a change of variables u(x. (1.3). . = ∂t ∂x ∂ 2ξ ∂ 2ξ k. ∂t dξ ∂t dξ ∂x ∂x dξ ∂x ∂t dξ ∂x ∂t ∂x dξ ∂x ! dU ∂ξ dU ∂ 2 ξ d2 U ∂ξ 2 dU ∂ 2 ξ d2 U ∂ξ ∂ξ = f U. −k c . .. (1. −k c . .2) reduces to ! dU dU 2 d2 U 2 2 d U 3 3 d U (−kc) = f U. + . . (1. follows in the same way as the preceding analysis. . (1. eq. If a solution to eq. . = = · · · = 0. (1. Then. .

. = 0. 5] which factors the problem ODE (transformed PDE) into . . For example. All the above methods benefit from the use of a computer algebra system (CAS). such as Maple.6). (1. Examples of higher-dimensional MOL analysis are given in [6]. we refer to eq. subject to the initial condition u(x. we set u1 = u and u2 = .1) is a one-dimensional (1D) PDE in the sense that x corresponds to a single spatial direction or dimension. . if eq. which facilitates algebraic operations. We will consider only numerical solutions to 1D problems in this book. These techniques lead to systems of nonlinear equations that can be solved analytically. Numerical methods can also be extended naturally to higher-order PDEs in t. and 3D. smaller problems that can be solved more easily. Thus. t = 0) = f (x) (1. (1. ∂t Thus.3) and (1.1) are not required other than through the conditions ξ → ±∞. In principle. . However. Introduction to Traveling Wave Analysis 3 . . Expansion methods based on tanh [4].1) was second order in t (rather than first order in t) by the standard procedure of defining additional dependent ∂u variables. The preceding discussion applies as well to PDEs that are second and higher order in t. (1. In general. (1. we have ! ∂ 2u ∂u ∂ 2 u = f t. which transforms eq. .6a) ∂t ! ∂u2 ∂u1 ∂ 2 u1 = f t. Traveling wave solutions and the corresponding Cauchy .5) ∂t 2 ∂x ∂x2 expressed as ∂u1 = u2 (1. . we would use the expansion method as this gener- ally presents no difficulty. (1.7) df (x → ±∞) with f (x → ±∞) = 0. a PDE that is nth order in t can be reduced to n PDEs that are first order in t. exp [3]. some 2D analytical solution examples using the tanh method are provided here. . (1. u1 . Equations (1. This approach is applied in several of the following chapters to PDEs that are second order in t. . ... 2D. .1) into two first-order PDEs. such as the solution of simultaneous nonlinear equations. and solutions fall out naturally. and Riccati [7] expansions of elements of the ODE (transformed PDE). .6b) ∂t ∂x ∂x2 and the numerical procedures for first order (in t) PDEs to be discussed subsequently can be applied to eqs.4) essentially constitute an initial value problem in the sense that boundary conditions for eq. Chapter 1 . (higher-order derivatives in x are homoge- dx neous) as a Cauchy problem. For analytical traveling wave solutions. Equation (1. (1. the numerical methods to be discussed can be applied to systems of PDEs in 1D. Factorization method [1. u.1).

To summarize the method of traveling waves.8). hopefully. If eq. This change to a moving coordinate system can often lead to a significant simplification as we have observed here. some of the subsequent problems are based on boundary conditions at finite values of x that follow from an analytical solution to eq.8). (1. and PDE solution are consistent). denoted as f (x. t).9) is substituted in eq. In other words.10) βu βx cos t γ u2 γ x2 cos t 2 Sum of terms Sum of terms 0 6= 0 . This procedure is best explained through an example. eq. Residual Function Solutions A second general approach to the solution of a PDE such as eq. (1.8) ∂t 2 ∂x we then assume a solution to eq. We refer to this remaining part as the residual function.8). A number of methods have been developed for the solution of the ODE. If we start with PDE (1.1) (so that the initial conditions. as we might expect. ∂ 2u ∂ 2u + α 2 + βu + γ u2 = 0 (1. (1.8) [2]. (1.9) for the particular values β = 0.8) Term from eq. there will be a function remaining that is not part of the original PDE. This process is summarized in the following table Term in eq.9) ∂ 2u −x cos t ∂t 2 ∂ 2u α 2 0 ∂x (1.9) will not satisfy eq. and any α in eq. (1. (the quadratic Klein–Gordon equation). eq. Also. then determine an associated PDE that. in fact. we give some guidelines for assuming the solution. At the end of this discussion.8) exactly. is solved by the assumed solution. −1 ≤ x ≤ 1 (1. will be easier to solve than the original PDE. in this case. (1. boundary conditions. (1. (1.8) such as ua (x. t) = x cos t. The transformation from a PDE to an ODE can be considered as going from a fixed Euler coordinate system in x and t to a moving Lagrangian coordinate system in ξ . (1.1) is to assume a solu- tion.4 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS (initial value) problems are illustrated by several of the problems that follow. the PDE is transformed to an ODE which. (1. γ = 1. if a solution to the PDE is assumed to be a function of a linear combination of x and t such as ξ = k(x − ct). (1.

12). this method can be generally applied to produce an analytical solution to a related PDE. t) (which is also termed a nonhomogeneous or inhomogeneous term). namely.12) can be used as a test problem. an analytical solution will result by including the residual function in the original PDE to arrive at a related PDE (with the assumed solution as an analytical solution). the resulting modified PDE (with the residual function) will be relatively easy to solve numerically. (1.8) in the sense that the only difference between the two PDEs is the residual function f (x. that is. the method of residual functions can still be applied (including the required ICs and/or BCs). we in fact will not know the analytical solution to the original . the assumed solution will satisfy the original PDE.12) is similar to eq. If the assumed solution is “smooth” in the sense that it and its derivatives are well behaved. γ = 1). since it has an analytical solution. (1. This completes the discussion of the methods of traveling waves and residual functions. In other words.e. the various partial deriva- tives exist and can be derived). Finally.11) then eq. is not the PDE we started with. . they sum to −x cos t + x2 cos2 t for α = −1.9). (1. If a PDE test problem is required to have specified initial conditions (ICs) and/or boundary conditions (BCs) and if these are included in the assumed solution. if we make exactly the right choice of an analytical solution. Chapter 1 . β = 0.9) is a solution of the PDE ∂ 2u ∂ 2u + α + βu + γ u2 = f (x. (1. eq. of course. if it can be substituted into the PDE (i. However. eq.8). We will consider a series of example PDE applications for which the analytical solutions could be derived by either of these two methods. Introduction to Traveling Wave Analysis 5 Note that the terms in the right column do not sum to zero (and in fact.12) includes the essential terms of eq. However. (1. (1. eq. the functions of x and t in eq.9) are smooth . For example. the same partial derivatives. Note that this procedure is general in the sense that no matter what we assume for an analytical solution. as well as all of their derivatives. if we define a residual function as f (x. Of course. (1. Also. (1. eq. eq. The assumed analytical solution can be of essentially any form so long as it can be substituted in the original PDE. Thus.. the better will be the . We could also add a logical extension that the closer the assumed analytical solution is to the true (but unknown) analytical solution of the initial PDE. (well behaved). (1. (1.12) ∂t 2 ∂x2 Equation (1.8). PDE. (1. resulting test problem based on the modified PDE. t) = −x cos t + x2 cos2 t. but generally this is unlikely. some guidelines for selecting an analytical solution are as follows: . t).

He. J.pdf>. UK. X.C. Theor. H. Cambridge University Press. 2009. 60 (7) (1992) 650–654.-H. 30 (2006) 700–708. Solitons and Fractals. O. [5] H. Phys. Solitary wave solutions of nonlinear wave equation. AJMMS 1 (1) (2007) 27–34. 114 (3) (2005) 533–538.org/PS cache/math-ph/pdf/0401/0401040v3. Math. Numerical solution of the nonlinear Klein-Gordon equation using radial basis functions. Rosu. Wu. Phys. A.6 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS References [1] O. The tanh-coth method combined with the Riccati equation for solving the KdV equa- tion.C. [2] M. Prog. Exp-function method for nonlinear wave equations.E. [6] W. Nonlinear second order ODE: factorizations and particular solutions.W. [7] A. [3] J. Rosu. 2010.-H. Cornejo-Perez. last accessed 23 April. [4] W. Griffiths. G. Shokri. Malfliet. Am. . J. Comp. 230 (2009) 400–410. Cornejo-Perez. A Compendium of Partial Differential Equation Models. Supersymmetric pairing of kinks for polynomial nonlinearities: <http://arxiv.M. Schiesser. Chaos. Wazwaz. Dehghan. App.

3) also satisfies IC (2.1) and (2. t = 0) = f (x) (2.2).1) and (2. t) = U(ξ ) = f (x − ct).2) The solution to eqns. eq. This aspect will be discussed subsequently. (2. To confirm that eq.2) is u(x.00002-9 7 Copyright © 2012 Elsevier Inc. but which somewhat paradoxically. if f (x) is the Heaviside unit step function. . so it is a complete solution.3) is a traveling wave solution since it has an independent variable ξ = x − ct (as discussed in Chapter 1). (2. (2.2) to be the Gaussian function 2 f (x) = e−λx (2.4) . (2. this propagating discontinuity makes the numerical solution of even a simple PDE such as eq. we substitute it as follows: dU ∂ξ dU ∂ξ = −c dξ ∂t dξ ∂x dU dU (−c) = −c (1) dξ dξ Thus.1).3) is a solution to eqns.2).3) indi- cates this step function propagates left to right in x with increasing t. All rights reserved. (2.3) Note that the function of eq.1016/B978-0-12-384652-5. Equation (2. also termed a Cauchy problem. is one of the most difficult to solve numerically. For example. the linear advection equation. Traveling Wave Analysis of Partial Differential Equations DOI: 10. (2.1) difficult computationally.1) and (2. (2. this point will be illustrated in the subsequent discussion. then this is termed a Riemann problem. (2. Equations (2. eq. ξ = x − ct (2. 2 Linear Advection Equation We begin our discussion of particular PDEs with one that might be considered the simplest PDE. Smooth Solutions We now consider a specific example with a smooth solution and choose the IC function of eq. (2.2) are an example of an initial value problem. The linear advection equation is ∂u ∂u = −c (2.1) ∂t ∂x with the initial condition (IC) u(x. If f (x) has a finite discontinuity (usually at x = 0).3) satisfies eq.

.1: Numerical solution to eq.1. x varies through the values x = −5. The numerical solution. 2. The computer code also produces a plot of the solution in 3D perspective.8 0. (2.i). 4. (2.2 0 −0.8 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Linear advection equation. The close agreement between the numerical and analytical solutions is also apparent from the tabulated numerical output reproduced in Table 2. from eq. The difference between the two solutions is err(it. .3 (it is part of the computer code to follow) for the three values of t (including t = 0).2. 10.i). u(it. changes with an index it=1. only every fifth value appears in the output). the analytical (exact) solution to eq. 2.201 for 201 values of x (i is part of the computer . We can note the following points about this output: . (2.. The analytical solution (from eq.2 −5 0 5 10 x FIGURE 2. code. Then. t = 0.1.3..6 u(x. is in close agreement with the numerical solution. . −4.. t) = e−λ(x−ct) (2.5) The numerical and analytical solutions produced by the computer code that follows are in Fig. 2.4 0. Within each of these values of t. . (2.1) (lines) with the analytical solution superimposed (circles) using five-point FD approximations in dss004 [20].3).250. t varies through the values t = 0.1) is 2 u(x. . u anal(it.2. 4 1. ..2 1 0. This solution also changes with an index i=1..i).5)). t ) 0.

6 0.8 u (x.1 are considered next.4 0. pde 1 main. (2.m % % Linear advection equation % % Clear previous files clear all clc % % Parameters shared with other routines global xl xu x n ncall % global c lambda c=1. Chapter 2 . 2. u(x. lambda=1. u0=inital_1(t0). as a function of x and t using four-point FD approximations in dss004.2) that produced the output in Figs.1). The Matlab routines for the numerical method of lines (MOL) integration of eqns.2: Numerical solution to eq. nout=3. tout=[t0:2:tf]'. t). and the tabulated output in Table 2. % . Linear Advection Equation 9 Linear advection equation 1 0. (2.1) and (2. t ) 0. % % Independent variable for ODE integration tf=4. starting with the main program.2. ncall=0.0.2 0 0 1 2 −5 t 3 0 5 x 4 10 FIGURE 2.1 and 2. % % Initial condition t0=0.

end end % % Display selected output for it=1:nout fprintf('\n t x u(it.1: Main program pde 1 main.ncall). errors in numerical solution for it=1:nout for i=1:n u_anal(it.i)-u_anal(it.i).options).'JPattern'. . o .2f%8. ylabel('t').0e-06. % % Explicit (nonstiff) integration if(mf==1)[t.u) xlabel('x').'-'.t)') title('Linear advection equation.i)=u(it. reltol=1. zlabel('u(x.u0. title('Linear advection equation').'o') axis([-5 10 -0.10 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS % ODE integration mf=2.options).u(it. LISTING 2.t. options=odeset('RelTol'. end end fprintf(' ncall = %4d\n\n'. % % Plot numerical and analytical solutions figure(2) plot(x.S) [t. err(it.tout.i) err(it.u]=ode15s(@pde_1.'AbsTol'.25 1. We can note the following points about this listing: . end % % Store analytical solution. 2. t(it).t(it)).i)\n').u0.reltol.x. % pause options=odeset(options.x(i). abstol=1.25]). 4.i).. t = 0.u]=ode45(@pde_1.abstol).6f\n'.. After clearing previous files.numerical.analytical') figure(3) surf(x..u.t)').i).m. some global parameters are declared that can be shared with other routines.i) u_anal(it.0e-06.i)=ua_1(x(i).u_anal(it. xlabel('x') ylabel('u(x. solid .err(it.u_anal.i)).6f%15. for i=1:10:n fprintf('%6.tout.6f%15. end % % Implicit (sparse stiff) integration if(mf==2) S=jpattern_num_1.3f%15.

500 0.00 −3.939413 0.750 0.000000 2.00 8.000000 0. Linear Advection Equation 11 Table 2.250 0.500 0.001930 0.000 0.250 0.000 0.209611 0.000 0.000000 0.750 0.00 4.250 0.i) err(it.00 −0.000000 0.000026 0.000064 2.367879 0.750 0.000 0.000005 −0.000000 0.750 0.000000 0.000000 0.000000 −0.i) 2.250 0.000005 0.939459 0.000 0.000000 0.00 6.00 1.00 1.939413 0.500 0.500 0.000000 0.00 4.000026 0.00 10.046771 −0.00 −2. Chapter 2 .250 0.000000 2.000000 0.00 8.00 0.000005 0.000000 0.000000 t x u(it.750 0.778801 −0.000028 2.000000 0.000001 2.000000 0.000026 0.1: Tabular numerical and analytical solutions t x u(it.00 7.778801 0.000 0.000000 2.00 −4.750 0.00 3.00 5.500 0.000000 0.000000 0.000000 0.000 0.000000 0.000000 0.018316 0.00 −5.750 0.000000 0.250 0.000000 0.939413 0.000000 0.00 7.209640 0.000000 0.000000 2.001930 0.000000 0.00 5.250 0.000000 2.000000 0.750 0.000518 0.000014 2.000000 0.000000 0.500 0.000000 0.000000 2.000046 2.046771 0.046771 0.250 0.778801 0.000002 2.00 −1.i) u anal(it.000520 −0.000000 0.000000 −0.000 0.000000 0.00 −3.000000 −0.001930 0.00 0.046756 0.000000 0.000000 2.000520 0.00 −5.000000 2.000 0.000000 (Continued ) .000000 0.000520 0.500 0.000002 2.018316 0.00 10.000000 0.000000 0.000000 0.i) 0.000000 0.209611 0.000000 −0.500 0.00 6.000000 0.018316 0.000000 0.000026 0.250 0.00 7.000 0.500 0.367879 0.00 7.000000 0.000000 0.00 4.000000 0.000004 2.00 −2.000000 0.000000 0.367881 0.367879 0.00 −0.018316 0.000000 0.00 −2.00 1.000000 0.000000 0.000 0.000000 0.00 9.000000 0.000000 −0.00 −2.00 4.000000 2.00 9.000000 2.250 0.00 −1.00 −4.00 2.000000 0.250 0.i) err(it.500 0.000000 2.000000 0.000000 0.000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000005 0.000000 0.00 1.250 0.00 2.i) u anal(it.000000 0.778736 0.209611 0.00 3.000000 0.001934 0.000000 0.000000 2.000000 −0.

00 0.00 10.006323 0. .000000 4.000000 4.105399 −0.000000 0.000 0.500 0.569869 0.000000 0.006330 −0. this function basically uses the IC function of eq.000000 0.00 9.000 0. The IC of eq.105399 0.000000 4.000058 4.000 0.500 0.00 −3.000001 0.00 7.000002 0.750 0.000053 4.1: (Continued) t x u(it.006336 0.105346 0.000086 4.12 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 2.750 0.000 0.00 −0.00 4. (2.006330 0.250 0. .i) 4.000000 0.000000 −0.000000 0.000001 0.00 1. (2.00 3.000122 0.000001 4.500 0.000000 0.000001 0.250 0.569783 −0. lambda=1.750 0.000004 0.250 0.000001 0.250 0.00 −1.250 0. Two model parameters.000000 4.000000 −0.105447 0.000001 −0.250 0.000126 0.569725 0.1) and λ in eq.000000 % % Linear advection equation % % Clear previous files clear all clc % % Parameters shared with other routines global xl xu x n ncall .000007 4.i) err(it.000000 4. (2.00 2.500 0.750 0.000000 0.000000 −0.4).000 0.000000 0.000002 4.00 −5.00 8. c in eq.00 −2.500 0.000123 −0.4). % global c lambda c=1.00 6.569783 0.00 4.00 5.000000 0. are assigned numerical values.i) u anal(it.999978 1.00 −4.000 0.000000 4.000000 0.000004 4.000002 4. % % Initial condition t0=0.000006 4. (2.000047 4.2) is set numerically through a call to function inital 1(t0) (to be discussed subsequently).000000 4.000000 4.000123 0.000000 0.000022 4.00 1.000000 −0.0.000000 0.000000 0.00 7.000002 4.000000 0.00 −2.

reltol=1. tout=[t0:2:tf]'.i)=ua_1(x(i). is the basis for 201 ODEs in t (as programmed subsequently in function pde 1.u0. % % ODE integration mf=2.tout.u]=ode15s(@pde_1.'JPattern'. The analytical solution of eq.options). % % Explicit (nonstiff) integration if(mf==1)[t. end end % % Display selected output .t(it)). options=odeset('RelTol'.i)-u_anal(it. % % Store analytical solution.options). The error tolerances for the ODE integration are specified before the call to the ODE integrator. % pause options=odeset(options.u]=ode45(@pde_1. errors in numerical solution for it=1:nout for i=1:n u_anal(it. Linear Advection Equation 13 u0=inital_1(t0). Chapter 2 . As a result of the ODE integration.1.u0. 2 in array t.m). err(it. end For ode15s. defined in inital 1(t0) for 201 points. 2. the solution of the 201 ODEs is returned in array u at the .0e-06. These ODEs are integrated by a call to the nonstiff integrator ode45 or the stiff integrator ode15s as specified by mf. The two solutions (numerical and analytical) and their difference are then displayed through the fprintf statement.0e-06. (2. the sparse option is specified which requires a function jpattern num 1 to determine the structure of the ODE Jacobian matrix (discussed subsequently). nout=3.1)) is then defined as t = 0. The grid in x.i). abstol=1. The output sequence of t (in eq. 4 (a total of three . which produced the output in Table 2. end % % Implicit (sparse stiff) integration if(mf==2) S=jpattern_num_1. (2.5) computed in function ua 1. ncall=0.1). values of t = 0.m (discussed subsequently) is subtracted from the numerical solution to give the difference err.tout. % % Independent variable for ODE integration tf=4.reltol.abstol).'AbsTol'. outputs as reflected in Table 2.i)=u(it.S) [t. 1.

solid . t = 0.i)\n'). xlabel('x') ylabel('u(x.u) xlabel('x').t)').14 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS for it=1:nout fprintf('\n t x u(it. for i=1:10:n fprintf('%6. options = AbsTol: 1.'o') axis([-5 10 -0.i)).t)') title('Linear advection equation.i) err(it.u(it..i).25]).ncall).u_anal.i) u_anal(it.numerical.2f%8.0000e-006 BDF: [] Events: [] InitialStep: [] Jacobian: [] JConstant: [] JPattern: [201x201 double] Mass: [] MassConstant: [] MassSingular: [] MaxOrder: [] MaxStep: [] NormControl: [] OutputFcn: [] OutputSel: [] Refine: [] RelTol: 1.x.t.6f\n'.err(it. title('Linear advection equation').i). end end fprintf(' ncall = %4d\n\n'.u. zlabel('u(x. 2. 4.6f%15.2 are then produced by calls to the Matlab utilities plot and surf. o .1 and 2.analytical') figure(3) surf(x.x(i).'-'.3f%15. The plots of Figs. The number of calls to the ODE routine pde 1. The first is a list of the options selected for the sparse matrix version of ode15s.1 produces two additional outputs. . % % Plot numerical and analytical solutions figure(2) plot(x. .m is displayed as a measure of the computational effort to produce the numerical solution.25 1. The main program of Listing 2..u_anal(it.6f%15.0000e-006 Stats: [] . t(it).. The value is rather modest (ncall = 399) indicating the computational efficiency of the ODE integrator ode15s. ylabel('t'). 2.

401 elements.1. The ODE routine. This example illustrates two features for most of the numerical solutions that follow: .3. produced by the call to ode15s. pde 1. the numerical solution is validated through the use of eq. whereas the ODE-dependent variables are numbered horizontally.m is discussed subsequently. point finite differences (FDs) in the ODE routine pde 1. the band is five elements wide. In particular. and thus the Jacobian matrix is pentadiagonal. The ODEs are numbered vertically. 2. (2. This point is illustrated by the map of the Jacobian matrix in Fig.n. only 808 are nonzero. Chapter 2 . We can note the following points about this map: . This bandwidth of five results from the use of five- . the Jacobian matrix is banded. particular PDE applications in the subsequent chapters.m. The Matlab routines can be considered as templates that will be modified for . (2.xu. that is. called by ode15s is listed next. that uses only the nonzero elements of the Jacobian matrix. In other words. We now go on to a discussion of the routines (functions) that were called during the execution of the main program. we attempt to achieve a numerical solution in which the errors are considered acceptable (small enough to be essentially negligible). y = 100 indicates . % . Of the 40. the error tolerances and the size of the ODE Jacobian matrix are indicated.3)) is used to evaluate the errors in the numerical solution.3). To conclude this discussion of the main program in Listing 2. which is an important reason for using a sparse matrix integrator . dependent variable 101 that appears in the RHS of ODE 100. it increases rapidly with the number of ODEs.401 elements. For example. which is 2. The analytical solution (eq.u) % % Function pde_1 computes the t derivative vector for the linear % advection equation % global xl xu x n ncall % global c lambda % % ux ux=dss004(xl. function ut=pde_1(t. In the present case.u).0% of the total. Linear Advection Equation 15 In the present case. the effectiveness (efficiency) of the sparse option of ode15s is clear. Since this matrix has a size equal to the number of ODEs squared. In conclusion. 98% of the elements are essentially zero (and using them in any calculations would simply waste computer time). Of course. The nonzero elements are clustered around the main diagonal. an entry at x = 101. the Jacobian matrix is 201 × 201 = 40.

.m are the ODE-independent variable. ut.xu.m. 2.n. a transpose must be included (to transpose ut from a row to a column vector).m.u). pde 1. Note that to satisfy ode15s which calls pde 1. We can note the following points about this listing: . (2.m. % % Vectorized ut=-c*ux'. The input arguments of pde 1. Thus. . all of these parameters are available (numerically) for use in .m in main program pde 1 main. The second set of parameters is defined mumerically in pde 1 main. u (of length n). is the output.m. a vector of length n. LISTING 2. which is the origin of the pentadiagonal system mapped in Fig. The function and some global parameters are defined. % % Increment calls to pde_1 ncall=ncall+1. % end % ut=ut'. ux is computed by five-point FDs in dss004. which is the same vector displayed vertically in Fig.u) % % Function pde_1 computes the t derivative vector for the linear % advection equation % global xl xu x n ncall % global c lambda The first set of global parameters is defined numerically by the call to inital 1.3. and the vector of ODE-dependent variables. 2. % % ux ux=dss004(xl. function ut=pde_1(t.3. The programming requirement in pde 1. The output argument of pde 1.m from the main program pde 1 main.16 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS % PDE % % Procedural % for i=1:n % ut(i)=-c*ux(i).m. u is the same vector displayed .3. 2. t. u is an input to dss004 and the resulting derivative ux.2: ODE function pde 1.1) is computed by a call to dss004 ([20]). horizontally in Fig. The first derivative ∂u ∂x in eq.m is the vector of ODE derivatives.m is to compute all n = 201 derivatives before exiting from the routine.

(2. which operates on vectors and matrices in much the same way as with scalars. a transpose is used to return the . Linear Advection Equation 17 Jacobian sparsity pattern – nonzeros 808 (2. In the first approach (commented). In both cases. Chapter 2 . The PDE. % % Vectorized ut=-c*ux'.000%) 0 20 40 60 Semidiscrete equations 80 100 120 140 160 180 200 0 20 40 60 80 100 120 140 160 180 200 Dependent variables FIGURE 2. eq. In either case.1). which is one of the advantages of the MOL (a second advantage is the use of ODE library integrators. The second is termed vectorized and uses the features specific to Matlab. .3: Map of the ODE Jacobian matrix. such as ode15s and ode45). % end % ut=ut'. (2. the close resemblance of the programming to eq.1). a for loop is used to program eq. is then programmed in either of two ways: % % PDE % % Procedural % for i=1:n % ut(i)=-c*ux(i).1) is clear. this is termed procedural and is commonplace in other programming languages such as Fortran. (2.

The function is defined and global parameters are included for use by inital 1. dx=(xu-xl)/(n-1).3: IC function inital 1. i. but the computer run times are quite acceptable.m is called. u0(i)=ua_1(x(i).m. since the Gaussian pulse of eq.0.m is incremented each time pde 1. the Gaussian pulse is centered at x = 0. end LISTING 2. We can note the following points about inital 1. respectively. % % IC from analytical solution for i=1:n x(i)=xl+(i-1)*dx. function u0=inital_1(t0) % % Function inital_1 sets the initial condition for the linear % advection equation % global xl xu x n % % Spatial domain and initial condition xl=-5. In this case.m.0). Thus. The spatial domain in x is defined as −5 ≤ x ≤ 10 with 201 points.m (this routine is considered next). xu=10.18 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS derivative ut as a column vector (required by ode45 and ode15s). the counter for the calls to pde 1. The interval in x is determined by the characteristics of the solution.e. (2.4) is considered next. Finally.1 and 2. The IC. The routine that defines IC (2. . ua 1. 2. The selection of 201 points provides good resolution of the solution as indicated in Figs. function u0=inital_1(t0) % % Function inital_1 sets the initial condition for the linear % advection equation % global xl xu x n . 4.1).2. it moves left to right in x at velocity c = 1. .4) initially (t = 0) is centered at x = 0 (see Fig. n=201. 2. is then implemented by a call to the routine that calculates the analytical solution to eq.5) with t = 0. xu=10. dx=(xu-xl)/(n-1). % % Spatial domain and initial condition xl=-5. 4. (2. eq. at t = 0. 10). 2.4).m: . (2. 2. and the interval −5 ≤ x ≤ 10 includes the moving pulse (it does not interact with the boundaries at x = −5. n=201.

One possibility is to recognize that u(x.m that call pde 1.ybase. (2.tbase. the solution does not change.m to map the ODE Jacobian matrix (as expected since pde 1.4).vectorized). Fig. [Jac. which indicates a BC in x is required. Two other routines have been used.2.4).0. LISTING 2. t) remains zero at the left boundary.m has the programming for the ODEs). The “dss” denotes Differentiation in Space Subroutine and “004” indicates fourth-order FDs (five-point FDs) that are used in dss004. in this particular case.m for IC (2. numjac is a Matlab utility that maps the ODE Jacobian matrix (and therefore produced . There are two additional details we can consider concerning the preceding MOL solution. x = xl . . end Note the for steps through the 201 values of x to define IC (2. t = 0) = 0 defined in inital 1. Chapter 2 . but they will not be listed and discussed here to conserve space.m.4).m of Listing 2. Function ua 1. The last line of ua 1.t) % % Function uanal computes the exact solution of the linear advection % equation for comparison with the numerical solution global c lambda % % Analytical solution uanal=exp(-(lambda*(x-c*t))ˆ2).ytbase. 2. function uanal=ua_1(x.ybase). These routines form the DSS library ([20]) which is provided with the downloads for this book.m.fac]=numjac(@pde_1. .3).4) follows. ranging from second to tenth order are used for MOL analysis in subsequent chapters .m calls pde 1.thresh. .4: Function ua 1. u0(i)=ua_1(x(i).m are ytbase=pde_1(tbase.0).m for IC (2. A set of spatial differentiation routines. When this is done. and therefore could be used as a BC u(x = xl . The two statements in jpattern num 1. since u(x = xl . Briefly. But in pde 1. Thus. Linear Advection Equation 19 % % IC from analytical solution for i=1:n x(i)=xl+(i-1)*dx.m is a straightforward programming statement for eq. t) = 0 which could be coded as u(1)=0 just before the call to dss004. The other routine that was used is dss004 to compute ux in pde 1. t) remains at its initial value u(x = xl .1) has a first-order derivative in x. jpattern num 1.fac. Equation (2. a BC has not been specified.

and we now consider a variant of the preceding problem that illustrates this point.6). (2.m. an invariant can be computed as a test of the numerical solution (it should remain constant).6).1 indicates that the numerical solution is quite acceptable.1) and (2.3) is the analytical solution of eqns. The agreement between the numerical solution and the ana- lytical solution of eq. To handle this second case of eq. First.6).m will become pde 2 main. (2.3) and (2.3) indicates that this pulse should move left to right with velocity c = 1.20 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS the required BC has no effect. In order to conserve space. we note that eq. and ua 1.m. an invariant or integral constraint can be stated mathematically as Z∞ I= u(x. t)dx = const −∞ I could be computed numerically for the numerical solution (in Fig.1) using a quadrature such as Simpson’s rule.1 and Table 2. .5) in Fig.. (2. Of course. However.m. it is not always the case that solutions are smooth.6).1) and (2.m. 0≤x<1 (2.2) for f (x) of eq.1) that I remains essentially constant.4). but IC (2. we will use the preceding routines with only the changes required to include eq. since we would expect (from Fig. 2. this will not always be the case (depending on the circumstances of the problem). inital 1.4) will be changed to a square pulse 0. we see that the solution does not change shape as it moves along the x axis. This completes the discussion of the MOL solution of eqns. Solutions with Sharp Gradients or Discontinuities Unfortunately. respectively. (2.5). (2. we will change the 1 designation in the routine names to 2. 2.1) and (2. x≥1 Equation (2. (2. We can then put this solution into the routine ua 2. x<0 f (x) = 1.m. subsequent discussion of eq. in order to keep the routines separated and organized. but the use of an integral constraint as a test of the numerical solutions for some PDE applications is discussed in subsequent chapters. and in fact. (2. pde 1. In other words.6) 0.2) for the Gaussian pulse IC of eq. We do not carry out this calculation here.4) to IC (2.m. i. we will indicate only the changes in the preceding code in going from IC (2. pde 1 main. pde 2.2) will again be analyzed. (2. (2. and ua 2. the use of a BC is illustrated in the . From eqns.m. the area under the traveling Gaussian pulse remains constant. (2. In other words. inital 2.1). We now consider what the numerical solution actually looks like. Equations (2.m.e. Thus. 2.

6). n=201.6: Function inital 2. .3 to −10 ≤ x ≤ 10 % % Spatial domain and initial condition xl=-10.6). function u0=inital_2(t0) % % Function inital_2 sets the initial condition for the linear % advection equation % global xl xu x n % % Spatial domain and initial condition xl=-10. % % IC from analytical solution for i=1:n x(i)=xl+(i-1)*dx. Chapter 2 .6) in inital 2. The interval in x has been increased from −5 ≤ x ≤ 10 in inital 1. The coding in ua 2.0.m for IC (2.m. elseif(xi>1) uanal=0.6) except that the variable x is replaced by ξ = x − ct (since eq. elseif((xi>=0)&(xi<=1)) uanal=1. ua 2.5: Function ua 2. We can note the following points about inital 2. In other words.0). The reason for this change is explained subsequently.m for IC (2. ua 2. if(xi<0) uanal=0.m is now used to set IC (2. n=201. end LISTING 2. u0(i)=ua_2(x(i). end LISTING 2. xu= 10.m: .3) indicates a traveling wave solution with independent variable x − ct). Linear Advection Equation 21 function uanal=ua_2a(x. (2.m follows from IC (2.t) % % Function uanal computes the exact solution of the linear advection % equation for comparison with the numerical solution global c % % Analytical solution xi=x-c*t.m applies to all values of t and not just t = 0 of IC (2. xu= 10. dx=(xu-xl)/(n-1).m of Listing 2.6).

Clearly. The numerical solution is highly oscillatory and distorted. the MOL solution . In conclusion. We cannot achieve the instantaneous change in f (x) from 0 to 1 at x = 0 and from 1 to 0 at x = 1 defined by eq.m and the grid in x with a finite number of points. at least for our purpose. the call to ua 2.m was also saved as file ua 2.6) defines two discontinuities at x = 0. (2.0). this only reduced the distortions in . We. and the subsequent analytical solution having the vertical lines is moved to the right at velocity c = 1. This error wave goes past x = −5. One of these plots is discussed next (the other two plots are not included in the discussion at this point).m.m and jpattern num 1. When ua 2b. 1 and t = 0. We could do the plotting of the IC so that vertical lines are drawn at x = 0.m in List- ing 2.m discussed previously. now consider some alternatives that might lead to a better numerical solution. Thus.5 is saved as file ua 2.m for this particular execution of the various routines. the best resolution in x we can achieve for these changes is over the grid spacing (10 − (−10))/(201 − 1) = 0.m are essentially the same as pde 1.5 is defined as ua 2a.22 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS . as long as ua 2a. u0(i)=ua_2(x(i). In other words. Execution of pde 2 main. it would seem that the call to ua 2 would not execute.. 2.6).m and jpattern num 2. The call to the analytical solution (at t = 0) is actually to ua 2 while the function in Listing 2.m.4: . (2.1 except that the calls to ua 1 and pde 1 have been changed to ua 2 and pde 2. and when this occurs and the left boundary is x = −5.m of Listing 2. Rather.m is the same as main program pde 1 main. An error wave (oscillation around x = 0) propagates right to left (from the left face of the pulse). for IC (2.0.6) is completely unsatisfactory. the distortions are even more severe.m.m (a different analytical solution) is to be used later.m). Thus. To explain why this is not so.m operates on this grid). The answer. ua 2b. We can note the following points about Fig. ua 2a. but we did not add these details to the plotting (and therefore the plotting in pde 1 main and pde 2 main remains the same). is that we can save a series of analytical solutions as files.m in inital 2.m. The main program pde 2 main.m gives three plots as pde 1 main. This raises the question of why this apparent complexity has been introduced.. Matlab calls a function by its file name (and not by the name in the first-line definition). therefore.6 will execute correctly. the use of the five-point FDs in dss004 did not work for IC (2. the left boundary was set at x = −10. .6) using ua 2.m of Listing 2. Thus. Files pde 2.m. we only have to create a file by the name used in the calling statement (ua 2.. and to select any particular solution to be called by inital 2. Thus. as mentioned previously. f (x) of eq.. 1 which cannot be represented exactly with computer arithmetic.1 for 201 points (since ua 2. it will also be saved as file ua 2. file ua 2a. the numerical solution but obviously did not eliminate them.m.

4 1. Chapter 2 .2 −0.1) (lines) with the analytical solution superimposed (circles) using five-point FD approximations in dss004.. at the point i and the point i − 1 upstream or upwind of i with respect to the direction of flow (left to right for c > 0). i. To start. A FD for the derivative in x in eq.7) is termed a two-point upwind FD approximation.4 −10 −5 0 5 10 x FIGURE 2. (2. (2.7) can be built into pde 2. that is. we consider another FD approximation in place of dss004. (2.e. Thus. t = 0. Linear Advection Equation 23 Linear advection equation. 2.m very simply. t ) 0.7) ∂x i 1x Note that the approximation of the x derivative at grid point i is based on u(i) and u(i − 1). Equation (2. u(1)=0. end (note that the BC u(x = −10. the line that calls dss004 is replaced with % % ux dx=(xu-xl)/(n-1).1) can be constructed that uses just two values of the dependent variable. for i=2:n ux(i)=(u(i)-u(i-1))/dx.4 1. . O(1x). indicates this approximation is first order in 1x or of order one in 1x (1x to the first power).2 1 0.6 u (x. t) = u(1)=0 has been applied before the for loop so that the for loop starts at i=2). ∂u u(i) − u(i − 1) ≈ + O(1x) (2. the approximation of eq.8 0.4 0.2 0 −0.4: Numerical solution to eq. read as of order 1x.

5: Numerical solution to eq. Thus.4 0. initial value problem with a discontinuous initial condition. (2. the 2pu FD .6 u (x.4 and 2. 2.3 0. (2.9 0. power or degree. eq. 2. t = 0.7 0. (2.6) are plotted in Fig.5 0. The numerical distortions of Figs.6). 4 1 0. since the dependent variable appears only to the first power.5 are a consequence of an important . t ) 0. Also. .1) (lines) with the analytical solution superimposed (circles) using a 2pu FD approximation. The numerical solution again does not match the analytical solution. If the preceding routines are executed with this change.4 and 2. The numerical solution does not have the oscillations of Fig. approximation of eq.7) is a linear approximation in the sense that u appears to the first .4) and numerical diffusion (Fig. Equations (2.1) and (2. that is a Cauchy or . but it is excessively smoothed. as eq. which are generally observed when solving strongly convective or strongly hyperbolic PDEs such . Equation (2.5 illustrated the two principal types of errors in numerical solutions. (2. 2.7) does not produce an acceptable numerical solution. in this case. 2.6) are example of a Riemann problem. Similarly.5. numerical oscillation (Fig.4. the five-point FD approximations in dss004 are linear. 2. theorem.5). the analytical and numerical solutions for f (x) of eq. To explain.2 0.24 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Linear advection equation.1 0 −10 −5 0 5 10 x FIGURE 2. these FD approximations are O(1x4 ).8 0. 2.1). We can note the following points about these solutions: . the Godunov barrier theorem [5] [6]. Figures 2. (2.

. To conserve space. In other words. vanl1. at least reduce them to an acceptable level. the velocity in eq. For many problems. due to reflection off a boundary or wall). Linear Advection Equation 25 . but it also produces excessive numerical diffusion. % % ux u(1)=0.g.m and super. they are discussed elsewhere ([26]) and are available with the downloads for this book.see Appendix at the end of this chapter for details on these plus 13 additional types.xu.xu. the so-called flux limiter. (2. higher than first order.c).u.n. we repeat the solution of eqns. Godunov’s barrier theorem then states that Thm: There is no linear approximation to the Riemann problem. we will not consider these centered limiters here. if we are to produce a numerical solution that does not oscillate using approximations of higher order than one (to achieve an acceptable accuracy in the numerical solution). the approximations cannot be linear (they must be nonlinear). the limiters are not centered or symmetric with respect to the point where the derivative ux is computed.. which are centered and therefore work with flow in either direction without having to specify the direction. We now introduce a nonlinear numerical device.7) is first order and therefore does not oscillate. we will not discuss these routines. % % superbee % ux=super(xl. (2. flux limiters will either totally eliminate oscillations or. Some background to flux limiters is included in the appendix to this chapter. As an example. In applications. the van Leer. and the superbee limiters . In other words. 2.1) and (2. v1 ux=vanl1(xl.4). the numerical value of the argument is not used). since the limiters require the direction of flow or wave propagation (as the sign of the fifth argument.m (in place of the call to dss004). that is nonoscillatory.m. If the direction of flow is not known. The calls to these routines are easily included in pde 1. c. This argument is required. the numerical solution from these approximations oscillates (as in Fig.n.c). . Chapter 2 . (2. flux limiters are available. % % vanLeer. To illustrate the idea.u. or changes due to flow reversals (e. since the fourth-order FDs of dss004 are linear (and higher than first . Also.1). the direction of flow is often known (from the physical situation such as flow through a pipe or reactor).6) with two represen- tative flux limiters. The two limiters have a fifth input argument. We can note the following points about this coding: . the FD approximation of eq. that gener- ally reduces the level of oscillation in the solution. order). The van Leer and superbee limiters have been programmed in two routines.

unrealistic.2 1 0.6. We can note the following points about these solutions: . (2. since at the ∂u points of discontinuity. Linear advection equation. we are asking the routine to calculate a derivative ux that is not defined.6 is as good as it is perhaps unexpected and surprising. t = 0. Viewed in this way.26 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS . the fact that the numerical solution in Fig.8 0. 4 1.6) produced by vanl1 appears in Fig. If the simulation is continued.6 u (x. it is a major improvement over the numerical solutions of Figs.5. (2. The plot of the numerical and analytical solutions for eq.4 and 2. In a sense. we will not discuss these routines here. Although the numerical solution does not reproduce the analytical solution exactly. eventually the dissipation will be considerable and the result will be totally . .6) presents an impossible problem. particularly the absence of unrealistic oscillations. 2. the IC function of eq. Thus. However. The function for the van Leer limiter has the name vanl1. which occur for all linear approximations above first order (according to Godunov’s theorem). t ) 0.6: Numerical solution to eq.m and vanl3. 2. since we also have available routines for two other limiters (in routines vanl2. 2. (2. The 1 was added. at these points of ∂x discontinuity.4 0.2 −10 −8 −6 −4 −2 0 2 4 6 8 10 x FIGURE 2. is undefined (or infinite). 2. there is a certain amount of dissipation or attenuation of the pulse from its initial shape.1) (lines) with the analytical solution superimposed (circles) using a van Leer flux limiter.2 0 −0.m) that are due to van Leer.

After the initial slight smearing of discontinuities. This requires a minimum of two ghost cells to be added at the start of the spatial domain and one at the end. periodic BCs effectively transform the spatial domain into a torus. and i + 2.7(A)) performs considerably better than the van Leer limiter (Fig. i + 1. For ease of programming. 2. ncall = 4033 for superbee. as the pulse then propagates without further distortion or dissipation for a long time. we consider also the superbee limiter for comparison with the van Leer limiter (and executed merely by activating the call to super in the preceding code and deactivating the call to vanl1). which results in the system having the same number of grid points as cells. We mention briefly that the extended duration numerical solution shown in Fig. the superbee limiter performs well. The number of ghost cells depends upon the size of the numerical stencil. Note: for a finite volume scheme cell. and i + 1. For our application with c > 0. This technique simply connects together the two ends of a 1D linear spatial domain by the addition of an additional cell. But now. This facility can be used by the reader to explore the performance of flux limiters over extended time durations 1 For a 2D Cartesian coordinate problem. we use a finite difference scheme based on a four-point upwind stencil consisting of grid points numbered i − 1. u0 = un Cells inserted at the start of spatial domain un+1 = u1 . there- fore.7(B) was obtained by using periodic boundary conditions. for our application with c < 0. some will perform better than others. The grid points 1 and n. un+2 = u2 Cells inserted at the end of spatial domain The limiter routines provided along with the downloads for this book include a flag peri- odic BC that can be set to 0 for nonperiodic BCs or 1 for periodic BCs. As an example. ncall = 1349 for van Leer. Chapter 2 .e.. assuming that the spa- tial domain consists of grid points numbered from 1 to n. Similarly. we require a minimum of one ghost cell to be added at the start of the spatial domain and two at the end. Linear Advection Equation 27 As we might expect.7(C). 2. 2. apart from a small amount . which are populated with vari- ables u1 to un . i. A simple method of implementing periodic BCs is to add ghost cells at either end of the spatial domain [14]. This is highlighted by plot of Fig. since many flux limiters have been proposed. respectively. The superbee limiter (Fig. we use a finite dif- ference scheme based on a four-point upwind stencil consisting of grid points numbered i − 2. n. However. 2. Therefore. grid point values are used. it is usual to add the same number of ghost cells to each end.7(A). The plotted output follows in Fig. i − 1. i. this improved performance requires a somewhat greater calculational effort. of dissipation. thus effectively transforming it into a ring 1 see Fig. i. .6). we insert two ghost cells at each end and set the grid values as follows: u−1 = un−1 . 2. values are used but for a finite difference scheme. they are almost indistinguishable. We can note the following points about this solution: .7(B) when the later pulses have been superimposed on earlier ones — in fact. become neighbors. 2.

1) (lines) with the analytical solution superimposed (circles) using the superbee flux limiter. (b) Periodic spatial domain defined with the linear domain repeated indefinitely left and right.8 0.2 −10 −8 −6 −4 −2 0 2 4 6 8 10 x (B) FIGURE 2. t ) 0. 2.28 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Linear advection equation. t = 0. 4 1.2 1 0. (c) Equivalent periodic spatial domain defined as a ring with n cells and n grid points. Image (C) is shown on the following page. t = 0.2 0 −0.4 0.6 u (x. (B) Extended duration (tf=24) numerical solution to eq.2 1 0.8 0. .6 u (x. (C) (a) Linear spatial domain with n grid points and n − 1 cells. (2. (2. t ) 0. 2. 4 1.2 −10 −8 −6 −4 −2 0 2 4 6 8 10 x (A) Linear advection equation.4 0.7: (A) Numerical solution to eq.1) (lines) with the analytical solution superimposed (circles) using the superbee flux limiter.2 0 −0.

there- fore. . Chapter 2 .8) ( 0.1) and (2. (2. that long simulation times (where c × t > xmax ) result in the solution propagating around the spatial domain. This type of solution is often termed a moving front. (2. 2pu. A step as defined in eq.8) 1.3) indicates. We now consider a second IC function with a discontinuity. the Heaviside (unit) step function. we have found superbee to be a good compromise between accuracy and computational efficiency. the analytical solution is a unit step that propagates from left to right with velocity c > 0. and an extensive literature is available for computing solutions to moving front problems.6).7: (Continued) where it would be impractical to plot the entire spatial domain. we just repeat three methods we considered previously.m or super. (2.m). Linear Advection Equation 29 1 2 3 n –1 n (a) 1 n 1 n1 n (b) n 1 2 3 (c) (C) FIGURE 2. and the superbee flux limiter. It should also be noted that for some applications the superbee limiter can result in unrealistic sharpening of the solution. As eq. It will be clear. we observe that the computational effort can vary widely for different limi- ters without a major improvement in the accuracy of the numerical solution. (2. (2. thus.8)). The reader could certainly come to a different conclusion when comparing the perfor- mance of the many limiters that have been proposed (and which can be coded through minor variations in vanl1. Here.8) again define a Riemann problem (because of the discontin- uous IC of eq. x>1 Equations (2.8) occurs more frequently in applications than the pulse of eq. Generally. defined in eq. five-point centered FDs (in dss004). Note: Periodic BCs can occur naturally in problems described in cylindrical coordinates. x<0 f (x) = (2.

1) appears in Fig.1) and (2. Again.e. the use of a nonlinear approximation for ux rather than a linear approximation.m).m as explained previously).5. In other words. and (2. (2.6) (with ua 2b.8(B). 2.8(A) and 2. because this strongly hyperbolic PDE propagates discontinuities.t) % % Function uanal computes the exact solution of the linear advection % equation for comparison with the numerical solution global c % % Analytical solution xi=x-c*t.4)). Again. the numerical solution is smooth but excessively damped. true discontinuities do not occur. the differences between the numerical and analytical solutions will probably be imperceptible when plotted. 2.m for IC (2. the numerical solution is a substantial improvement over Figs. Note again the use of the variable ξ = x − ct so that we have a Lagrangian (moving coor- dinate) solution of eqns.3) and (2. but there is no oscillation or overshoot as in Fig. Also. i.8(B).30 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS The analytical solution is easily programmed in ua 2. we again should appreciate that we are asking for the calculation of a derivative in x that is undefined at the points of discontinuity and viewed this way. (2. elseif(xi>=0) uanal=1. (2. (2. We note that the numerical solution is highly oscillatory with an error wave propagating right to left from the left face of the step (as in Fig.8) in function ua 2. Generally for physical systems. The plotted output with the 2pu approximation of the derivative in x in eq.m saved as file ua 2.8). All of the other preceding routines remained unchanged in using IC (2.. The plotted output with the superbee flux limiter appears in Fig.8(A). end LISTING 2. there is usually some smoothing from physical phenomena or processes. The numerical solution is not a vertical line at the points of discontinuity as defined by eqns. (2. as in Fig.8(A) and the smoothing (numerical diffusion) is minimal compared with Fig.m function uanal=ua_2b(x.9.6.7: Function ua 2.m of Listing 2.8).8) rather than IC (2.6). as in Fig. so that a discontinuity does not occur. The plotted output from the five-point centered FDs in dss004 appears in Fig. (2. such as a second derivative in x. 2. 2. the numerical solution of Fig. 2.1). If the PDE problem has any smoothing. 2. 2. 2. if(xi<0) uanal=0.7.8(B). We can add some additional points: . it requires special attention to compute a solu- tion of reasonably good accuracy.2). To conclude the discussion of eqns. 2. In other words. the superbee flux limiter provides a high-quality numerical solution with no additional programming (in pde 1.9 is quite satisfactory.8). such as diffusion . 2.

4 B 1 0. t = 0.2 1 0.8: (A) Numerical solution to eqns.8) (lines) with the analytical solution superimposed (circles) using five-point FDs in dss004 (B) Numerical solution to eqns.6 u (x.5 0. (2.8) (lines) with the analytical solution superimposed (circles) using 2pu FDs.4 0.6 u (x. t ) 0.9 0. Linear Advection Equation 31 Linear advection equation.8 0. 2.2 0. 4 A 1. t = 0. (2. Chapter 2 .1) and (2.7 0.3 0. 2.8 0.1 0 −10 −8 −6 −4 −2 0 2 4 6 8 10 x FIGURE 2.4 0.1) and (2.2 0 −0. t ) 0.4 −10 −8 −6 −4 −2 0 2 4 6 8 10 x Linear advection equation. .2 −0.

32 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS

**Linear advection equation; t = 0, 2, 4
**

1.4

1.2

1

0.8

u (x, t )

0.6

0.4

0.2

0

−10 −8 −6 −4 −2 0 2 4 6 8 10

x

FIGURE 2.9: Numerical solution to eqns. (2.1) and (2.8) (lines) with the analytical solution superimposed (circles)

using the superbee flux limiter.

**or the effect of viscosity in fluid flow, that precludes a discontinuity. Thus, test
**

problems with discontinuities, such as eqns. (2.6) and (2.8), are generally not

completely realistic physically, or in other words, are overly stringent in testing the

**. applicability of numerical methods to physical problems.
**

When we used the FD approximations of dss044 or the 2pu approximation of eq. (2.7),

we might naturally think that they should produce an acceptable numerical solution,

especially since the accuracy of these approximations improves with increasing

numbers of grid points (smaller 1x). However, if we ran some additional cases for

larger numbers of grid points (than n = 201), we would find the accuracy of the

numerical solutions does not improve substantially (they still have excessive

numerical diffusion and oscillation). Also, we might reason that using higher-order

FDs (using more grid points than the five in dss004) would give better numerical

solutions; in fact, if we used higher-order FDs, we would find that the numerical

solutions oscillate even more than in Figs. 2.4 and 2.8. Thus, we conclude that using

more grid points (generally termed h refinement) or higher-order approximations

(generally termed p refinement) will not necessarily produce numerical solutions of

acceptable accuracy, especially for strongly hyperbolic problems. Fortunately, for less

**. difficult PDE problems, h and p refinement are effective.
**

Somewhat ironically, although eq. (2.1) is perhaps the simplest PDE we can envision, it

also is one of the most difficult to solve numerically, depending on the properties of

Chapter 2 . Linear Advection Equation 33

**f (x) in eq. (2.2). PDEs that have a small amount of smoothing or diffusion, typically
**

through a second derivative in x, appear to be more complicated than eq. (2.1), but

they are actually easier to integrate numerically than eq. (2.1). PDEs with first- and

second-order derivatives in x are termed hyperbolic–parabolic (or convective–diffusive);

**. we will consider some examples of these mixed-type PDEs subsequently.
**

The resolution of steep moving fronts, such as those from ICs (2.6) and (2.8) can be

achieved by numerical methods other than flux limiter schemes. They include

weighted essentially non-oscillatory (WENO) [21], level set [16], and discontinuous

Galerkin [8] methods. These recently developed schemes can be thought of as

high-resolution extensions to the MOL approach. However, they are more advanced

and are still the subject of ongoing research; as such, they will not be discussed further

here. An additional possibility would be the method of characteristics (MOC), which

would give exactly the correct numerical solution to eqns. (2.1), (2.6), and (2.8). It has

been used successfully for many years in application areas, such as adsorption,

chromatography [1, 17], and water-hammer [22]. However, our experience has

indicated that more accurate numerical methods such as MOC are difficult to

implement in a general-purpose format (they require an analysis for each particular

PDE application, followed by some specialized coding), whereas the MOL approach is

quite general and can be applied to a spectrum of PDE problems, both linear and

nonlinear, with simultaneous PDEs. We demonstrate this generality in the subsequent

applications. MOL and MOC have also been combined in the solution of the Euler

**. equations for fluid mechanics [2].
**

The accurate resolution of steep moving fronts is determined by the smoothness of the

fronts (with discontinuities being the most difficult). Mathematically, the functions of

eqns. (2.6) and (2.8) are discontinuous in the solution (u(x, t) of eq. (2.1)). If these ICs

are continuous in u(x, t = 0) but discontinuous in the first x derivative, the calculation

of the numerical solution is much easier. To demonstrate this point, we consider a

∂u(x, t = 0)

triangular pulse IC that is continuous in u(x, t = 0) but discontinuous in .

∂x

The triangular pulse is defined as

x<0

0,

0≤x<2

x/2,

f (x) = (2.9)

2 − x/2, 2≤x<4

0, x≥4

**We can note the following points about this f (x) in eq. (2.2):
**

. Equation (2.3) indicates that this pulse moves left to right with velocity c = 1, which is

**.. subsequently used to evaluate the numerical solution.
**

The function consists of four sections:

For x < 0, the function of eq. (2.9) is zero.

34 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS

**.. For 0 ≤ x < 2, the function increases linearly from f (0) = 0 to f (2) = 1.
**

For 2 ≤ x < 4, the function decreases linearly from f (2) = 1 to f (4) = 0.

. For x ≥ 4, the function is zero.

Thus, f (x) is continuous in x, but its first derivative is discontinuous at x = 0, 2, 4.

The first derivative undergoes its largest discontinuity at x = 2 so that it provides the

most stringent test of the numerical solution at x = 2, as will be observed in the

subsequent comparison of the analytical and numerical solutions.

Since the triangular pulse of eq. (2.9) is a significant departure from the previous test

problems, the associated Matlab files will be given the designation 3. For example, the

main programs are numbered:

**... pde 1 main.m - Gaussian pulse of eq. (2.4)
**

pde 2 main.m - square pulse of eq. (2.6) and step of eq. (2.8)

pde 3 main.m - triangular pulse of eq. (2.9)

**Thus, for the triangular pulse of eq. (2.9), the Matlab routines are pde 3 main.m, pde 3.m,
**

inital 3.m, and ua 3.m.

The routine that implements IC (2.9) is as follows:

function uanal=ua_3(x,t)

%

% Function uanal computes the exact solution of the linear advection

% equation for comparison with the numerical solution

global c

%

% Analytical solution

xi=x-c*t;

if(xi<0)

uanal=0;

elseif((xi>=0)&(xi<=2))

uanal=(x-c*t)/2;

elseif((xi>=1)&(xi<=4))

uanal=2-(x-c*t)/2;

elseif(xi>1)

uanal=0;

end

LISTING 2.8: Function ua 3.m for IC (2.9).

**The coding in Listing 2.8 is a straightforward implementation of eq. (2.9). ua 3.m is
**

then called in pde 3 main.m, pde 3.m, and inital 3.m, dss004 is called in pde 3.m to give

a five-point FD numerical solution to eqns. (2.1), (2.2), and (2.9). The plotted output is in

Fig. 2.10.

The agreement between the numerical and analytical solutions is generally quite good.

The only points of significant difference are at the peak where the two linear segments of

the solutions are connected (x = 2, 4, 6 corresponding to t = 0, 2, 4 for c = 1). The tabulated

numerical output near these three points is listed in Table 2.2.

As expected, the IC (t = 0) values of the peak agree (since the numerical and analytical

solutions always start from the same IC). At t = 2, the numerical peak value is 0.970590,

Chapter 2 . Linear Advection Equation 35

**Linear advection equation; t = 0, 2, 4
**

1.2

1

0.8

0.6

u (x, t )

0.4

0.2

0

−0.2

−10 −8 −6 −4 −2 0 2 4 6 8 10

x

FIGURE 2.10: Numerical solution to eqns. (2.1) and (2.9) (lines) with the analytical solution superimposed (circles)

using five-point FDs in dss004.

**whereas at t = 4, it is 0.968542. Although the errors are significant, they do not represent
**

a major distortion of the numerical solution (as indicated in Fig. 2.10).

In an effort to improve these peak values, two other numerical solutions were

computed:

. Nine-point, eighth-order FDs in routine dss008 were used in place of dss004. The

peak values are summarized in Table 2.3. Although the peak values improved

marginally (closer to 1.000000), unexpectedly, an error wave developed near the left

boundary x = −10 as indicated in Fig. 2.11.

. The superbee flux limiter was called in pde 3.m. The peak values are summarized in

Table 2.4. The peak values are actually less accurate than for dss004, and the number

of calls to pde 3.m increased from ncall = 515 (dss004) to ncall = 3055 (super).

Thus, both efforts to improve the peak values were unsuccessful.

**In summary, the smoothness of the triangular pulse IC of eq. (2.9) relative to the square
**

pulse IC of eq. (2.8) provided a generally satisfactory numerical solution. This conclusion

also indicates why the numerical solution for the Gaussian IC of eq. (2.4) was relatively

easy to compute, since this function is continuous and has continuous derivatives of all

orders. Also, the numerical solution for the triangular pulse of eq. (2.9) deteriorates as the

pulse is narrowed (below the width of 4) as might be expected; presumably, this could be

countered by adding more grid points (in all of the previous cases, n = 201).

36 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS

**Table 2.2: Abbreviated and tabular numerical and analytical
**

solutions for eqns. (2.1), (2.2), and (2.9) from dss004

t x u(it,i) u anal(it,i) err(it,i)

**0.00 0.000 0.000000 0.000000 0.000000
**

0.00 1.000 0.500000 0.500000 0.000000

0.00 2.000 1.000000 1.000000 0.000000

0.00 3.000 0.500000 0.500000 0.000000

0.00 4.000 0.000000 0.000000 0.000000

t x u(it,i) u anal(it,i) err(it,i)

**2.00 2.000 0.013343 0.000000 0.013343
**

2.00 3.000 0.495102 0.500000 −0.004898

2.00 4.000 0.970590 1.000000 −0.029410

2.00 5.000 0.503054 0.500000 0.003054

2.00 6.000 0.014590 0.000000 0.014590

t x u(it,i) u anal(it,i) err(it,i)

**4.00 4.000 0.012795 0.000000 0.012795
**

4.00 5.000 0.493201 0.500000 −0.006799

4.00 6.000 0.968542 1.000000 −0.031458

4.00 7.000 0.502513 0.500000 0.002513

4.00 8.000 0.017230 0.000000 0.017230

ncall = 459

**As a concluding point, we mention that the various traveling wave functions (Gaussian,
**

square pulse, and triangular pulse) did not reach the boundaries in x; thus, the boundary

values remained at zero. If the traveling wave functions had reached either boundary in x,

the solution would have become more complicated and would be determined by what is

assumed and computed at the boundaries; that is, the BC in x would have become more

consequential. We will not consider this added complication (however, in physical applica-

tions, it can be important). Additional details concerning MOL analysis for traveling waves

including boundary effects can be found in [19].

This rather extended discussion of eq. (2.1) was provided at this point to demonstrate

that PDE applications are not necessarily straightforward to solve and each PDE problem is

usually a new problem with no guarantee of success in advance for computing an accept-

able numerical solution; to a minimum extent, some trial and error may be required to

produce a numerical solution of acceptable accuracy.

In subsequent chapters, we analyze a series of PDE applications for which the com-

putation of acceptable numerical solutions was achieved (generally confirmed through

comparisons with analytical solutions). We would not, however, wish to leave the

impression that the programming and testing of the computer code led directly to an

acceptable solution. Generally, we had to experiment to arrive at a workable numerical

procedure, and we wish to convey to the reader that this is a normal part of this type of

experimental investigation.

Chapter 2 . Linear Advection Equation 37

**Table 2.3: Abbreviated and tabular numerical and analytical
**

solutions for eqns. (2.1), (2.2), and (2.9) from dss008

t x u(it,i) u anal(it,i) err(it,i)

**0.00 0.000 0.000000 0.000000 0.000000
**

0.00 1.000 0.500000 0.500000 0.000000

0.00 2.000 1.000000 1.000000 0.000000

0.00 3.000 0.500000 0.500000 0.000000

0.00 4.000 0.000000 0.000000 0.000000

t x u(it,i) u anal(it,i) err(it,i)

**2.00 2.000 0.007239 0.000000 0.007239
**

2.00 3.000 0.497509 0.500000 −0.002491

2.00 4.000 0.983813 1.000000 −0.016187

2.00 5.000 0.501166 0.500000 0.001166

2.00 6.000 0.008799 0.000000 0.008799

t x u(it,i) u anal(it,i) err(it,i)

**4.00 4.000 0.009567 0.000000 0.009567
**

4.00 5.000 0.505752 0.500000 0.005752

4.00 6.000 0.979748 1.000000 −0.020252

4.00 7.000 0.497179 0.500000 −0.002821

4.00 8.000 0.009959 0.000000 0.009959

ncall = 515

Appendix2

Flux limiters are used in numerical schemes to solve problems in science and engi-

neering, particularly fluid dynamics, that are described by partial differential equations

(PDEs). Their main purpose is to avoid the spurious oscillations (wiggles) that would oth-

erwise occur with high-order spatial discretization (as predicted by Godunov [5, 6]) due

to shocks, discontinuities, or steep gradients in the solution domain. They can be used

directly on finite difference schemes for simple applications, such as the 1D advection PDE

of eq. (2.1). However, for more complex systems involving conservation laws, finite volume

high-resolution schemes are employed that are also designed to avoid entropy violations.

A popular high-resolution scheme is the MUSCL scheme—MUSCL stands for

Monotone Upstream-centered Schemes for Conservation Laws 3 . The term was introduced

in a seminal paper by Bram van Leer [30]. In this paper, he constructed the first

high-order, total variation diminishing (TVD) scheme, where he obtained second-order

spatial accuracy. The concept of TVD was introduced by Ami Harten [7] and relates to a

2

This appendix is based on the Wikipedia article, http://en.wikipedia.org/wiki/Flux limiters, written by one of

the authors.

3

A readable overview of the MUSCL scheme is available on-line at: http://en.wikipedia.org/wiki/

MUSCL scheme.

38 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS

**Linear advection equation; t = 0, 2, 4
**

1.2

1

0.8

0.6

u (x, t )

0.4

0.2

0

−0.2

−10 −8 −6 −4 −2 0 2 4 6 8 10

x

**FIGURE 2.11: Numerical solution to eqns. (2.1) and (2.9) (lines) with the analytical solution superimposed (circles)
**

using nine-point FDs in dss008.

**monotone numerical scheme. A system is said to be monotonicity preserving if the
**

following properties are maintained over time:

.. No new local extrema are created within the solution spatial domain,

The value of a local minimum is nondecreasing, and the value of a local maximum is

nonincreasing.

Use of flux limiters, together with an appropriate high-resolution scheme, make the

solutions total variation diminishing.

Flux limiters are also referred to as slope limiters because they both have the same

mathematical form and both have the effect of limiting the solution gradient near shocks

or discontinuities. In general, the term flux limiter is used when the limiter acts on system

fluxes, and slope limiter is used when the limiter acts on system states.

**How They Work
**

The main idea behind the construction of flux limiter schemes is to limit the spatial deriva-

tives to realistic values—for scientific and engineering problems, this usually means phys-

ically realizable values. They are used in high-resolution schemes for solving problems

described by PDE’s and only come into operation when sharp wave fronts are present. For

smoothly changing waves, the flux limiters do not operate and the spatial derivatives can

Chapter 2 . Linear Advection Equation 39

**Table 2.4: Abbreviated and tabular numerical and analytical
**

solutions for eqns. (2.1), (2.2), and (2.9) from super.m.

t x u(it,i) u anal(it,i) err(it,i)

**0.00 0.000 0.000000 0.000000 0.000000
**

0.00 1.000 0.500000 0.500000 0.000000

0.00 2.000 1.000000 1.000000 0.000000

0.00 3.000 0.500000 0.500000 0.000000

0.00 4.000 0.000000 0.000000 0.000000

t x u(it,i) u anal(it,i) err(it,i)

**2.00 2.000 0.012115 0.000000 0.012115
**

2.00 3.000 0.500211 0.500000 0.000211

2.00 4.000 0.950851 1.000000 −0.049149

2.00 5.000 0.498828 0.500000 −0.001172

2.00 6.000 0.002511 0.000000 0.002511

t x u(it,i) u anal(it,i) err(it,i)

**4.00 4.000 0.012292 0.000000 0.012292
**

4.00 5.000 0.500114 0.500000 0.000114

4.00 6.000 0.943321 1.000000 −0.056679

4.00 7.000 0.493475 0.500000 −0.006525

4.00 8.000 0.002608 0.000000 0.002608

ncall=3055

**be represented by higher-order approximations without introducing nonreal oscillations.
**

Consider the 1D semidiscrete scheme below,

dui 1 h i

+ F ui+ 1 − F ui− 1 = 0

dt 1xi 2 2

where, for a finite volume scheme, F ui+ 1 and F ui− 1 represent edge fluxes for the

2 2

ith cell. Similarly, for a finite difference scheme, they represent flux values on the grid at

point x = xi+ 1 and point x = xi− 1 . If these fluxes can be represented by low- and high-

2 2

resolution schemes, then a flux limiter can switch between these schemes depending upon

the gradients close to the particular cell as follows:

high

F ui+ 1 = f low1 − φ (ri ) f low1 − f 1

2 i+ 2 i+ 2 i+ 2

high

= f low1 − φ ri−1 f low1 − f 1

F ui− 1

2 i− 2 i− 2 i− 2

limr→∞ φcm (r) = 3 φcm (r) = (r + 2)2 0.e. lim φkn (r) = 2 r→∞ minmod# [18] φmm (r) = max [0. r > 0. and r represents the ratio of successive gradients on the solution mesh.5 (r + |r|) φhc (r) = . φ(r) = flux limiter func- tion. r)] . r≤0 HCUS∗ [31] 1. lim φmm (r) = 1 r→∞ monotonized central (MC)# [29] φmc (r) = max [0. φ(r): CHARM ∗ [33] r (3r + 1) . 2)] . it is represented by a high-resolution scheme. ui − ui−1 ri = ui+1 − ui The limiter function is constrained to be greater than or equal to zero. min (2r.5(1 + r). i. There- fore. 0. f high = high-resolution flux. and a particular choice is usually made on a trial-and-error basis. or zero gradient). min (2r. when the limiter is equal to 1 (smooth solution). lim φhc (r) = 3 (r + 2) r→∞ HQUICK ∗ [13] 2 (r + |r|) φhq (r) = . Similarly. opposite slopes.40 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS where. r ≥ 0.. (1 + 2r) /3. i.e. lim φhq (r) = 4 (r + 3) r→∞ Koren [11] φkn (r) = max [0. the flux is represented by a low-resolution scheme. f low = low-resolution flux. min (1. No particular limiter has been found to work well for all problems. when the limiter is equal to zero (sharp gradient. The various limiters listed below have differing switching characteristics and are selected to suit the particular prob- lem and numerical solution scheme. Limiter Functions The following are common forms of flux/slope limiter function. lim φmc (r) = 2 r→∞ .. 2)] .

min (1 ≤ β ≤ 2) . min (2r. lim φop (r) = 1.25 + 0. 4)] . lim φva1 (r) = 1 r2 + 1 r→∞ van Albada 2∗ Alternative form used on high spatial order schemes [10] 2r φva2 (r) = .25 + 0. 2)] . 1) . lim φsb (r) = 2 r→∞ Sweby # [23] φsw (r) = max [0. min (2r. lim φum (r) = 2 r→∞ van Albada 1# [27] r2 + r φva1 (r) = . min (2r.5 r2 + r + 1 r→∞ smart ∗ [4] φsm (r) = max [0. 2)] .75r) . lim φsm (r) = 4 r→∞ superbee# [18] φsb (r) = max [0. β)] . min (βr. (1 ≤ β ≤ 2) . Linear Advection Equation 41 Osher [3] φos (r) = max [0. lim φos (r) = β r→∞ ospre# [31] 1.75 + 0.25r) . min (r. 1) . (0. lim φva2 (r) = 0 r2 + 1 r→∞ . (0.75r) . Chapter 2 .5 r 2 + r φop (r) = . lim φsw (r) = β r→∞ UMIST [15] φum (r) = max [0. (0. (r. β)] . min (r.

2. φ (r) φ = 2r φ =r φ =2 2 1 φ =1 r 1 2 3 FIGURE 2. φ(1) = 1. . plots for the Osher and Sweby limiters have been generated using β = 1. Unless indicated to the contrary. lim φvl (r) = 2 1+r r→∞ ∗ Limiter is not second-order TVD! # Limiter is symmetric and exhibits the following symmetry property. and [32]. TVD limiters satisfy at least the following criteria: . 1 ≤ φ(r) ≤ 2. (1 ≤ r ≤ 2) . r ≤ φ(r) ≤ 2r.42 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS van Leer # [28] r + |r| φvl (r) = . Second-order..5.12: Admissible limiter region for second-order TVD schemes [23].. φ (r) 1 =φ r r This is a desirable property. the reader is referred to [9] [12] [25] [24].13. 1 ≤ φ(r) ≤ r. This means that they are designed such that they pass through a certain region of the solution. the above limiter functions are second-order total variation diminishing (TVD). in order to guarantee stability of the scheme. For further information relating to the theory and application of flux limiters. . known as the TVD region. In this image. 2. The admissible limiter region for second-order TVD schemes is shown in the Sweby Dia- gram Fig. as it ensures that the limiting actions for forward and backward gradients operate in the same way. (0 ≤ r ≤ 1) .12 [23] and plots showing limiter functions overlaid onto the TVD region are shown in Fig. (r > 2) .

13: Limiter functions overlaid onto second-order TVD region. Chapter 2 . Linear Advection Equation 43 φ (r) Second-order TVD region CHARM HCUS HQUICK 3 3 3 2 2 2 φ (r) φ (r) φ (r) 1 1 1 0 0 0 0 1 2 3 0 1 2 3 0 1 2 3 r r r Koren MC Minmod 3 3 3 2 2 2 φ (r) φ (r) φ (r) 1 1 1 0 0 0 0 1 2 3 0 1 2 3 0 1 2 3 r r r Osher Ospre Smart 3 3 3 β = 1.5 2 2 2 φ (r) φ (r) φ (r) 1 1 1 0 0 0 0 1 2 3 0 1 2 3 0 1 2 3 r r r van Abada 1 van albada 2 van Leer 3 3 3 2 2 2 φ (r) φ (r) φ (r) 1 1 1 0 0 0 0 1 2 3 0 1 2 3 0 1 2 3 r r r FIGURE 2.5 2 2 2 φ (r) φ (r) φ (r) 1 1 1 0 0 0 0 1 2 3 0 1 2 3 0 1 2 3 r r r Superbee Sweby UMIST 3 3 3 β = 1. .

E. Fedkiw. W. J. Cambridge University Press.B. [4] P. [7] A. Method of characteristics technique: application to heat and mass transfer. Vreugdenhil & B. Service. Meth. Warburton. The QUICK algorithm: a uniformly 3rd-order finite- difference method for highly convective flows. 129–131. Tehran.P.D. 1986. in: Proceedings of the First Conference on Numerical Methods in Laminar & Turbulent Flow. In: C. Leonard.G. J. Sergei. UK. 1990. pp. Springer. in: 4th Conference of Iranian AeroSpace Society.S. Osher. Rhee. Simulation. Numerical Computation of Internal and External Flows. Cambridge University Press.R. [9] C. Curvature-compensated convective transport: SMART. Num. Cambridge Universty Press. Fluids. A. Fluid. [2] M. 1998. Computational Gas Dynamics. Phys.M. [10] M. 2002. Wiley. Leschziner. L. (1983) 363–373.B. K. 18 (1986) 337. Num. [20] W. Comput. Moscow. T. Gerber.K. Upstream monotonic interpolation for scalar transport with application to complex turbulent flows. Mech. 2003. Amundson. 19 (1994) 527. J. [8] J. Pseudo characteristic method of lines solution of the conservation equations. 56 (2001) 171–185. Nodal Discontinuous Galerkin Methods: Algorithms. Vieweg. Carver. Acrivos. Springer-Verlag. [14] R. [12] C. A robust upwind discretisation method for advection. Sbornik. vande Wouwer. Ph. Braunschweig. R. High resolution schemes for hyperbolic conservation laws. Theory and Application of Single Equations. J. Ann. Eng. [6] Godunov. Gaskell. Leschziner. A Compendium of Partial Differential Equation Models. J. 7226. in: AIAA Paper 83-1943. Finite Volume Methods for Hyperbolic Problems. Dover Publications. Hesthaven. 49 (1983) 357–393. K. Lau.. 48 (4) (1956) 703–710. Fluids. 1993. Thesis. Swansea. UK. Thermodynamically based moisture prediction using Roe’s scheme. Moscow State University.S.A. Int.A. Stockie. .44 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS References [1] A. [18] P. M. 2008. Lien. Kermani. J.-K. [19] P. First-order Partial Differential Equations. Sergei. Chatkravathy.C. Numerical Methods for Advection-Diffusion Problems. S. G. Analysis and Applications. A. Schiesser. NY. Rev. 807. Ind.B.E. 8 (1988) 617. volume 2: Computational Methods for Inviscid and Viscous Flows. Aris and N.R. McGuirk. Koren. Level Set Methods and Dynamic Implicit Surfaces. Leveque. High resolution applications of the Osher upwind scheme for the Euler equations. 35 (1) (1980) 57–76. a new boundedness- preserving transport algorithm. A. Upwinding in the method of lines. Translated US Joint Publ. [15] F. Chem.H. Res. New York. 1978. Meth. Griffiths. 2003.W. Iran. [17] H. [13] B.J. Saucez. Comp. R. Math. Different Methods for Shock Waves. Proceedings of the AIAA Sixth Comutational Fluid Dynamics Conference. 47 (1959) 271–306. Compu- tat. Characteristic-based schemes for the Euler equations. Roe. Hirsch. Phys. [3] S.J. UK. A Difference Scheme for Numerical Solution of Discontinuous Solution of Hydro- dynamic Equations. Chichester. Harten. Koren (Eds). Int. Schiesser. 1969. 2009. 1954. New York. M. [5] Godunov. Math. Amir Kabir University of Technology. diffusion and source terms. January 27–29. [11] B. Osher. Laney. pp.. [16] S.

UK.A.W. Bedford. van Leer. van Leer. van Leer. Goteborg.P. Roberts. W.H. Computational Fluid mechanics and Heat Transfer. VKI Preprint 21. J. Chapman and Hall/CRC. J.). (1995). [28] B. H. [29] B. Waterson. 23 (1977) 263–75. New York.B.F. 108 (1982) 76. 1999. Wylie. D. Comp. Wesseling. Saucez.D.. [26] A. Sweby. High Order Weighted Essentially Nonoscillatory Schemes for Convection Dominated Problems. Chapter 2 . New York. Anal.. Springer-Verlag. Streeter. Num.W. 14 (1974) 361–70. Schiesser (Eds. McGraw-Hill. FL. Phys. Adaptive Method of Lines. SIAM J. vande Wouwer. 21 (1984) 995–1011. Chapter 1. Numerical simulations of physical discontinuities in single and multi-fluid flows for arbitrary Mach numbers.C.K. Comp. SIAM Review. Principles of Computational Fluid Dynamics. Pletcher. Zhou. Deconinck. High resolution schemes using flux-limiters for hyperbolic conservation laws. Comp. Boca Raton. Springer-Verlag. [30] B. Sweden. Ph. [32] P. [22] V. Toro. A unified approach to the design and application of bounded higher- order convection schemes. 2001. 1997. Shu. Van Leer. Tannehill. . [25] E. Upstream-centered finite- difference schemes for ideal compressible flow. 1997. Astron. [23] P. Fluid Mechanics. ninth ed. J. PhD Thesis. 2001. Astrophys. W. van Albada. Towards the ultimate conservative difference scheme III. E. Riemann Solvers and Numerical Methods for Fluid Dynamics: A Practical Introduction. [24] J. Phys. K. 1995. Taylor and Francis. B. Towards the ultimate conservative difference scheme II. New York. [31] N. [27] G. Phys. of Tech.. 32 (1979) 101. Anderson. Towards the ultimate conservative difference scheme V. 51 (1) (2009) 82–126.E. A comparative study of computational methods in cosmic gas dynamics. Linear Advection Equation 45 [21] C. R. Monotonicity and conservation combined in a second order scheme. Chalmers Univ. second ed. [33] G.

All rights reserved. t) = Ce−(x−Dt) (3.3) Equation (3. u(x. 3 Linear Diffusion Equation PDEs that model diffusion. can admit travel- ing wave solutions as we demonstrate in the following analysis. the integration constant is C1 = 0. Traveling Wave Analysis of Partial Differential Equations DOI: 10. dξ A second integration gives U(ξ ) = Ce−ξ/k which satisfies the condition U(ξ ) = 0. The linear diffusion equation is ∂u ∂ 2u =D 2 (3. technically classified as parabolic PDEs. ξ → ∞.00003-0 47 Copyright © 2012 Elsevier Inc.1016/B978-0-12-384652-5. t = 0) = f (x) (3.1) gives dU ∂ξ dU ∂ξ ∂ξ d =D dξ ∂t dξ dξ ∂x ∂x dU d2 U (−kD) = D 2 k2 (3.5) dξ dU If we impose the conditions U(ξ ) = = 0. Thus. ξ → ∞ (with k = 1). . ξ = k(x − Dt) (3.4) dξ dξ Equation (3.6) .3).1) ∂t ∂x with the initial condition (IC) u (x. (3.4) is a second-order ODE that can be integrated once to give (after cancellation of D) dU k + U = C1 (3.2) For a traveling wave solution. we consider U(ξ ) = u(k(x − Dt)). when substituted into eq.

xu.2).m is function ut=pde_1(t. Substitution of eq. The Matlab routines closely resemble those of Chapter 2. (3.6) is the analytical solution to eq. Before proceeding to the Matlab routines. (3. (3. (3. (3. t) = eDt . end .nl. t = 0) = f (x) = e−x (3. First.6)–(3. the ODE routine pde 1.6) is a valid test of the numerical solution. (3. Since eq. we are assured that eq. (3.7) so C = 1 in eq. Here.u) % % Function pde_1 computes the t derivative vector for the linear % diffusion equation % global xl xu x n ncall % global D % % uxx nl=1.1) and (3. u(n)=0. which we take as u(x = 0. u(1)=exp(D*t).1) with IC (3. (3.6) ∂u De−(x−Dt) ∂t ∂ 2u (3. (3.1) is second order in x. it requires two boundary conditions (BCs).6) satisfies IC (3. (3.7) and BCs (3.9) Equation (3.n. (3. (3.6). uxx=dss044(xl.8) and (3.7) and BCs (3.10) −D −De−(x−Dt) ∂x2 Sum of terms Sum of terms 0 0 By inspection. we confirm that eq. % % PDE for i=1:n ut(i)=D*uxx(i). nu=1.48 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS For the IC for eq. (3.1) Terms from eq.9).6) into eq.u. Thus.1) gives (with C = 1) Terms in PDE eq.nu).8) u(x → ∞) = 0 (3.1) and eq.6) (with C = 1) is the analytical solution that will be used to evaluate the numerical solution. ux(1)=0.8) and (3. we list a few details pertaining to eqns. (3.ux.9). eq.9). we take u(x.

ut=ut'. LISTING 3. function ut=pde_1(t.u) % % Function pde_1 computes the t derivative vector for the linear % diffusion equation % global xl xu x n ncall % global D . nu=1) at grid points 1 corresponding to x = 0 and n (= 51) corresponding to x = ∞ (subsequently set in function inital 1.ux. (3.u.xu. We can note the following points about pde 1. (3. uxx. nu=1.nu). ux(1)=0. The second derivative in eq. BCs.1: Function pde 1. Equation (3. ut(n)=0. u(1)=exp(D*t).n. the derivatives in t are set to zero at the boundaries (so that the ODE integrator does not move the boundary values away from their prescribed values). all input arguments must have a value). ut(n)=0. % % Increment calls to pde_1 ncall=ncall+1.m for eq. Chapter 3 .1). Note that ux(1)=0 is used only to satisfy the calling requirements of dss044 (in Matlab. % % Increment calls to pde_1 ncall=ncall+1.9) specified (nl=1.1). is then computed using the function dss044 with Dirichlet BCs (3. % % uxx nl=1. Since Dirichlet BCs are used. end ut(1)=0. ut=ut'. u(n)=0.m: . A transpose is included to meet the requirements of the ODE .nl. Linear Diffusion Equation 49 ut(1)=0.m).8) and (3. The function and some global parameters are first defined.1) is then programmed % % PDE for i=1:n ut(i)=D*uxx(i). uxx=dss044(xl. ux is not actually used in dss044 for Dirichlet .

m for IC (3.0. dx=(xu-xl)/(n-1). The grid in x is then defined over the interval 0 ≤ x ≤ 10 for 51 points. n=51. end LISTING 3.0).m listed next.7). Finally. .7).0). the counter for the number of calls to pde 1. u0(i)=ua_1(x(i). end As the grid in x is defined in the for loop. function ua 1 (listed next) is called (for t = 0) to define IC (3.7) is programmed in inital 1. The function and some global parameters are first defined. (3.2: Function inital 1. dx=(xu-xl)/(n-1). % % Spatial domain and initial condition xl= 0. u0(i)=ua_1(x(i).m is incremented.0. We can note the following points about inital 1. The IC of eq.50 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS integrator ode15s. % % IC from analytical solution for i=1:n x(i)=xl+(i-1)*dx. function u0=inital_1(t0) % % Function inital_1 sets the initial condition for the linear % advection equation % global xl xu x n . function u0=inital_1(t0) % % Function inital_1 sets the initial condition for the linear % advection equation % global xl xu x n % % Spatial domain and initial condition xl= 0. xu=10. xu=10. % % IC from analytical solution for i=1:n x(i)=xl+(i-1)*dx.m: . n=51.

1) (lines) with the analytical solution superimposed (circles) using five-point FD approximations in dss044 [1]. LISTING 3.6). This can be inferred from the analytical solution. (3. x = 10 effectively defines a boundary at x = ∞. .6). Function ua 1.3: Function ua 1. … 4 60 50 40 u (x. t = 0.9). we have essentially implemented BC (3. (3.m for analytical solution (3. 1.1: Numerical solution to eq. In other words. t) 30 20 10 0 0 1 2 3 4 5 6 7 8 9 10 x FIGURE 3. eq. eq.m is a straightforward implementation of the analytical solution. t) = e−(10−Dt) which for the present example is small for any value of t we consider (t ≤ 4). Linear diffusion equation. u(x = 10. function uanal=ua_1(x. Chapter 3 .6). Linear Diffusion Equation 51 . since with C = D = 1.t) % % Function uanal computes the exact solution of the linear diffusion % equation for comparison with the numerical solution % global D % % Analytical solution uanal=exp(-(x-D*t)). (3.

reflects the banded structure of the ODEs produced by dss044. that is.1). pde 1 main. Fig. 3.1 indicates good agreement between the analytical and numerical solutions. t) 30 20 10 4 3 0 0 2 2 t 4 1 6 x 8 0 10 FIGURE 3.1 also reflect the good agreement between these two solutions. the solution of eq. This is to be expected.2 is a 3D plot of the numerical solution. The main program. The problem parameter is set in the statements.1 and therefore it is not listed here.m in Chapter 2 and is therefore not reproduced here. The tabular analytical and numerical solutions given in Table 3. global D D=1. The main program produces the same three figures and tabulated output as in Chapter 2. (2. Figure 3. is essentially the same as pde 1 main of Listing 2.3.2) or (3.1) is generally not a problem. . which are now reviewed.1) subject to IC (3.7) and BCs (3. the Jacobian matrix routine jpattern num 1. (3. The computational effort reflected in ncall = 150 is quite modest. (3.2: 3D plot of the numerical solution to eq. The map of the ODE Jacobian matrix. In summary.8) and (3. the propagation of steep fronts as in the case of the linear advection eq. Figure 3. since parabolic problems tend to produce smooth solutions.m is the same as jpattern num 1.52 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Linear diffusion equation 60 50 40 u(x.9) is straightforward. Also.

1 would be simply changed to ut(i)=D*uxx(i)+u(i)ˆ2. Chapter 3 .3: Jacobian matrix map of the MOL ODEs for n = 51. although we generally discuss PDE problems in the subsequent chapters for which analytical solutions are available to evaluate the numerical solutions. if the problem included a second-order chemical reaction so that eq. However. Linear Diffusion Equation 53 Jacobian sparsity pattern – nonzeros 243 (9. In other words. .11) ∂t ∂x the preceding coding of pde 1 in Listing 3. the comparison of the numerical and analy- tical solutions becomes much more difficult because the analytical solution is not readily available.343%) 0 5 10 15 Semidiscrete equations 20 25 30 35 40 45 50 0 5 10 15 20 25 30 35 40 45 50 Dependent variables FIGURE 3. (3. Although the change in the coding is trivial. because we have followed a numerical approach. For example. extensions of the prob- lem are straightforward.1) becomes ∂u ∂ 2u = D 2 + u2 (3.

135335 -0.000000 0.00 5.000 0.00 9.000 0.049787 -0.54 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 3. .000912 0.000000 0.000 20.000911 4.000026 4.000000 -0.367879 -0.718282 2.002477 0.000029 4.000 0.598150 0.000001 1.000 2.000000 0. . .00 1.000 2.000 0.000334 4.000 0.018316 -0.367879 0.00 3.049787 0.000 1. .00 10. i) err (it.000000 -0.135335 0.000 0.000 0. i) err (it.000000 1.367878 0.000 0.000 0.135335 -0.000 1.000123 0.00 4.135287 0.000123 0.000912 0.00 1.388982 7.000 0.000123 0.000000 0.000912 -0.00 4. .006738 0.085537 -0.000040 1.006738 -0.00 3.718282 0.002479 0.000 0.000000 1.002479 0.000000 1.000 0.000335 0.018316 0.00 2.049787 0.000000 t x u (it.00 8.00 6.000 54.135335 0.000901 0.000001 1.002479 0.000123 4. i) u anal (it. i) u anal (it. i) u anal (it.00 5.000045 0.00 1.049787 0.000 0.00 0.000000 0.000 0.000 0.000335 -0.00 8.049787 -0.000000 4. 3 removed .135335 0.000 0.000000 0.002479 -0.049664 0.000 0.00 9.000123 0.000 0. i) 4.389056 -0.00 5.000 0. .000052 4.000000 ncall=150 . output for t=2.000000 1. .018315 0.000000 0.000 0.000 0.000048 4. .00 3.085485 20.00 7.00 10. t x u (it.000000 0.000 0.00 9.000000 1.000 0.005827 0.00 10.000074 4. . .002479 0.1: Tabular numerical and analytical solutions t x u (it.017981 0.000000 1.00 7.000000 0.00 2. i) 1.999971 1.367853 0.00 0.000 0.018316 -0.000002 1.018316 0.000000 .00 2.00 6.000 0.000 7.598150 54.000000 1.000000 0.006738 0.00 4.006738 0.718282 -0.367879 -0.000010 1.000295 0.00 7.718233 2.000045 0. i) err (it.000000 0.367879 0.000335 0. i) 0.00 8.00 0.000048 4.006738 -0.000 0.00 6.

In fact.W. Linear Diffusion Equation 55 the intent is to demonstrate numerical procedures that can readily be extended to cases for which analytical solutions are not available. . Cambridge University Press. G.E. UK. Reference [1] W. A Compendium of Partial Differential Equation Models. 2009. the possibility of solving numerically (at least in principle) a PDE problem of essentially any complexity is the principal reason for studying and using numerical methods. Schiesser. Griffiths. Chapter 3 .

∂u ∂u ∂ 2u = −c + D 2 − rc u (4. we combine these two types of PDEs plus reaction to give a linear convection–diffusion-reaction (CDR) PDE. (4. c. parabolic) derivative in x. we consider U(ξ ) = u[k(x − x0 − ct)]. Traveling Wave Analysis of Partial Differential Equations DOI: 10.4) is a second-order ODE d2 U Dk2 − rc U = 0 (4. hyper- bolic) derivative in x. All rights reserved. velocity.3).3) where k.00004-2 57 Copyright © 2012 Elsevier Inc. ξ = k(x − x0 − ct) (4. The IC is u(x.1). gives dU ∂ξ dU ∂ξ dU ∂ξ ∂ξ d = −c +D − rc U dξ ∂t dξ ∂x dξ dξ ∂x ∂x dU dU d2 U (−kc) = −ck + Dk2 − rc U (4.2) For a traveling wave solution to eqns.4) dξ dξ dξ 2 Equation (4.2). Equation (4.1) ∂t ∂x ∂x Equation (4. and in Chapter 3 a PDE with just a second-order (diffusive. 4 A Linear Convection Diffusion Reaction Equation We considered previously in Chapter 2 a PDE with just a first-order (convective.5) can be integrated by assuming an exponential solution U(ξ ) = C exp(Bξ ) .5) dξ 2 Equation (4. t = 0) = f (x) (4. respectively. and initial displacement. and x0 are the wavenumber. when substituted into eq.1) and (4. .1016/B978-0-12-384652-5.1) can also be classified as a hyperbolic–parabolic (or convective–diffusive) PDE. (4. Now.

ξ → ∞ and C+ = 0. and the BCs are r rc u(x = 0. dξ we take r rc u(x. eqns. (4.7) Dk2 u(x → ∞. t) = 0 (4.1) is therefore r rc u(x.9) Dk2 To verify this solution.5) is Dk2 r r rc rc U(ξ ) = C+ exp ξ + C − exp − ξ Dk2 Dk2 where C+ and C− are constants to be determined. follow directly from eq.1).9) ∂u r r rc rc − (−kc) exp − k(x − x 0 − ct) ∂t Dk2 Dk2 ∂u r r rc rc +c −c (k) exp − k(x − x0 − ct) ∂x Dk2 Dk2 ∂ 2u rc r rc (4.7) and (4.1) Terms from eq. (4.8). (4. B = ± so that the solution to eq. (4.6).8) The solution to eq. For the IC for eq. t) = exp − k(x − x 0 − ct) (4.10) −D −D 2 (k ) exp − 2 k(x − x0 − ct) ∂x2 Dk Dk2 r rc +rc u rc exp − k(x − x0 − ct) Dk2 Sum of terms Sum of terms 0 0 The IC.9). eq. and BCs. we have: Terms in PDE eq.6) Dk2 so C− = 1. (4. t) = exp − k(−x0 − ct) (4.58 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Substitution in eq. (4. dU If we impose the conditions U(ξ ) = = 0. (4. .5) gives Dk2 B2 − rc = 0 r rc Thus. t = 0) = exp − k(x − x 0 ) (4. (4. (4.

ux. % % PDE for i=1:n ut(i)=-c*ux(i)+D*uxx(i)-rc*u(i). % % uxx nl=1.8) at grid point 1 corresponding to x = 0 and n (= 51) corresponding to x = ∞ (n is set in function inital 1.m for eq.ux. discussed subsequently). (4. end ut(1)=0. (4.xu.m is function ut=pde_1(t. and (4. (4.nu). LISTING 4.u).1: Function pde 1.n. A Linear Convection Diffusion Reaction Equation 59 The Matlab routines closely resemble those of Chapter 3. (4.8).nl.9). (4. the ODE routine pde 1. is computed using the function dss004 with BCs (4.n. ux=dss004(xl.xu. ut(n)=0.u) % % Function pde_1 computes the t derivative vector for the linear % convection diffusion reaction equation % global xl xu x n ncall % global D rc k x0 c sr . (4. Here. First.7). u(n)=0. The function and some global parameters are first defined. ux(1)=0.u.7) and (4.6). % % ux . nu=1. The first derivative in eq.u) % % Function pde_1 computes the t derivative vector for the linear % convection diffusion reaction equation % global xl xu x n ncall % global D rc k x0 c sr % % ux u(1)=exp(-sr*k*(-x0-c*t)).1). % % Increment calls to pde_1 ncall=ncall+1. Chapter 4 . we list a few details pertaining to eqns.m. uxx=dss044(xl.1). function ut=pde_1(t.1).m: . ut=ut'. We can note the following points about pde 1.

u(n)=0.nu). The second derivative in eq. Finally.6) is programmed in inital 1. (4.60 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS u(1)=exp(-sr*k*(-x0-c*t)).u.m is incremented.n. function u0=inital_1(t0) % % Function inital_1 sets the initial condition for the linear % convection-diffusion reaction equation % global xl xu x n % % Spatial domain and initial condition xl= 0.xu.nu=1) again at grid points 1 corresponding to x = 0 and n (= 51) corresponding to x = ∞. all input arguments must have a value). % % uxx nl=1. BCs. uxx=dss044(xl. the derivatives in t are set to zero at the boundaries (so that the ODE integrator does not move the boundary values away from their prescribed values). The IC of eq.1) is then programmed: % % PDE for i=1:n ut(i)=-c*ux(i)+D*uxx(i)-rc*u(i). A transpose is included to meet the requirements of the ODE integrator ode15s. Note that ux(1)=0 is used only to satisfy the calling requirements of dss044 (in Matlab. ux=dss004(xl. ut(n)=0.7) and (4. (4.m). n=51. is computed using the function dss044 with Dirichlet BCs (4.ux.1).u). . xu=10. ut=ut'. ux is not actually used in dss044 for Dirichlet .8) specified (nl=1. . Equation (4. (subsequently set in function to inital 1. end ut(1)=0. % % Increment calls to pde_1 ncall=ncall+1. Since Dirichlet BCs are used.xu. ux(1)=0. the counter for the number of calls to pde 1.nl. uxx. nu=1.n.m.

% % Spatial domain and initial condition xl= 0. function uanal=ua_1(x. u0(i)=ua_1(x(i).m for IC (4.8). t) = e−(10−ct) which for the present example is small for any value of t we consider (t ≤ 3 and c = 1).9) . n=51. dx=(xu-xl)/(n-1). We can note the following points about inital 1. (4. end LISTING 4.m is a straightforward implementation of the analytical solution. % % IC from analytical solution for i=1:n x(i)=xl+(i-1)*dx.0). In other words. Chapter 4 . function u0=inital_1(t0) % % Function inital_1 sets the initial condition for the linear % convection diffusion reaction equation % global xl xu x n . x = 10 effectively defines a boundary r at x = ∞. eq.6). x0 = 0.2: Function inital 1.9).0.0. we have essentially implemented BC (4. DK 2 u(x = 10. since with k = 1. The grid in x is then defined over the interval 0 ≤ x ≤ 10 for 51 points. This can be inferred from the analytical rc solution.0). function ua 1 (listed next) is called (for t = 0) . to define IC (4. Function ua 1.6). % % IC from analytical solution for i=1:n x(i)=xl+(i-1)*dx. eq. (4. u0(i)=ua_1(x(i).m: .t) % . end As the grid in x is defined in the for loop. The function and some global parameters are first defined. xu=10. A Linear Convection Diffusion Reaction Equation 61 dx=(xu-xl)/(n-1).

c=1.5.1 and therefore is not listed here. 1. The main program. the Jacobian matrix routine jpattern num 1. (4. rc=1. The problem parameters are set in the statements. pde 1 main. is essentially the same as pde 1 main of Listing 2.6). LISTING 4.3: Function ua 1.m for analytical solution eq. sr=(rc/(D*kˆ2))ˆ0. x0=0. Also. which are now reviewed.1: Numerical solution to eq. 3 (bottom to top). k=1. t) 10 5 0 0 1 2 3 4 5 6 7 8 9 10 x FIGURE 4. . global D rc k x0 c sr D=1.m in Chapters 2 and 3 and is therefore not reproduced here.1) (lines) with the analytical solution superimposed (circles) using five-point FD approximations in dss004 and dss044 [1] for t = 0. Linear CDR equation 25 20 15 u (x.62 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS % Function uanal computes the exact solution of the linear convection % diffusion reaction equation for comparison with the numerical solution % global D rc k x0 c sr % % Analytical solution uanal=exp(-sr*k*(x-x0-c*t)). The main program produces the same three figures and tabulated output as in Chap- ters 2 and 3. (4. 2.m is the same as jpattern num 1.

2: 3D plot of the numerical solution to eq. Chapter 4 . extensions of the problem are straightforward.1 indicates good agreement between the analytical and numerical solutions. Fig. that is. since this hyperbolic–parabolic problem has a smooth solution due to the diffusive second derivative in x. The tabular analytical and numerical solutions given in Table 4. This is to be expected. reflects the banded structure of the ODEs produced by dss044 and dss044.1) subject to IC (4. (2.6) and BCs (4.5 0 2 1 t 4 0.8) is straightforward. Figure 4. 4. the problem is strongly parabolic.1).5 6 x 8 0 10 FIGURE 4.5 2 0 1. A Linear Convection Diffusion Reaction Equation 63 Linear CDR equation 25 20 15 u(x.2 is a 3D plot of the numerical solution. (4. However. (4. if the problem included a nonlinear convective term. because we have followed a numerical approach.1 also reflect the good agree- ment between these two solutions. so the propagation of a steep front such as in the case of the linear advection eq.5 (4. The computational effort reflected in ncall = 140 is quite modest.7) and (4. For example.t) 10 5 3 2. In summary.1) is not a problem.3.1) becomes ∂x ∂u ∂u ∂ 2u = −u + D 2 − rc u1. (4.11) ∂t ∂x ∂x . The map of the ODE Jacobian matrix. ∂u u and an (effective) 1.5-order chemical reaction so that eq. Figure 4. the solution of eq.

343%) 0 5 10 15 Semidiscrete equations 20 25 30 35 40 45 50 0 5 10 15 20 25 30 35 40 45 50 Dependent variables FIGURE 4. the intent is to demonstrate numerical procedures that can readily be extended to cases for which analytical solutions are not available. the possibility of solving numerically (at least in principle) a PDE problem of essentially any complexity is the principal reason for studying and using numerical methods. Although the change in the coding is trivial. the comparison of the numerical and analyti- cal solutions becomes much more difficult because the analytical solution is not readily available. . the preceding coding of pde 1 in Listing 4. As we commented previously.1 would be simply changed to ut(i)=-u(i)*ux(i)+D*uxx(i)+u(i)ˆ(1.64 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Jacobian sparsity pattern – nonzeros 243 (9.5). In fact.3: Jacobian matrix map of the MOL ODEs for n = 51. although we generally discuss PDE problems in the subsequent chapters for which analytical solutions are available to evaluate the numerical solutions.

049787 0.018316 0.018316 0.00 7.000030 3.000000 0. A Linear Convection Diffusion Reaction Equation 65 Table 4.1: Tabular numerical and analytical solutions t x u (it. output for t=1. .00 6.367879 0.00 0.000 0.367879 −0.000335 0. UK.006738 0. .000 0.000124 3.049787 0.000000 0.000 0.049787 −0.135335 0.000912 0.000123 0. 2009.000 0.00 10.000045 0.002355 0.000 2.000000 1.000 7.000335 0.135321 0.000007 3.00 8. i) err (it.000 0.000 0. A Compendium of Partial Differential Equation Models. .000 0.006720 0.000 0.389056 −0.00 0.000123 0.006738 −0.000000 0. Griffiths.000 0.000045 0.018316 −0. i) u anal (it.00 4.000 0.000005 3. t x u (it.000 1.E.049781 0.718184 2. G. .000098 3. i) u anal (it.367849 0.000018 3. .085537 0. .085537 20.135335 0.00 8.00 4.000 20.00 5.000912 0.000000 0. Chapter 4 . .W.999941 1.000000 0.000 0. .000000 0.000 0.00 9.00 7.000000 0.000000 .00 5.00 2. . i) 3.000014 3.000000 ncall=140 Reference [1] W.00 9. Cambridge University Press.000000 −0.367879 0.00 1.00 3.000 0.000000 3.000 0. Schiesser.000000 0.018311 0.002479 −0.000 0. i) err (it.00 1.002479 0.00 2.000098 3.000 0.000 0.388959 7.000059 3.00 6. 2 removed .i) 0.000 0. .000912 0.135335 −0.002479 0.000000 0.00 3.006738 0. .000000 0.718282 −0.00 10.000912 0.000000 0.

t) = ct + x+1 = x+ ct + 1 (5. since eq. a=0. and (5) analytical Neumann boundary conditions (BCs).1) ∂t ∂x where a. t) = 1.2) 2a 2a b The second form of the analytical r a traveling wave solution solution of eq. t) = sin(π x/xu )e−a(π/xu ) (5. the interval in x is xl ≤ x ≤ xu . eq. (4) nonlinear third-type. p3) r !−1 r r ! !−1 b b 2a u(x.2) is quite straightforward. c 6= 0.00005-4 67 Copyright © 2012 Elsevier Inc.3) which provides the IC with t = 0. xu is the value of x at the right boundary. p3) ∂u ∂ 2u = a 2 − bu3 − cu2 (5. b=c=0) The ODE routine. Fortunately. We will use the analytical solution 2t u(x. (5. 2a b We study eq. That is. 5 Diffusion Equation with Nonlinear Source Terms The diffusion equation with nonlinear source terms we will consider is ([3]. finding an alternative to eq. function ut=pde_1(t. both for the linear case b = c = 0 for which eq. Traveling Wave Analysis of Partial Differential Equations DOI: 10.2) reduces to the trivial solution u(x. (3) third-type. Dirichlet BCs (ncase=1. (2) Neumann.2) indicates r b 2a with a wavenumber equal to and a wave velocity equal to − c. nbc=1. All rights reserved. (5. An analytical solution is ([3]. (5. pde 1. but some branching is required for the 10 cases. Case 1: Linear PDE. (5.1) reduces to the one-dimensional diffusion equation of Chapter 3 and for the nonlinear case b 6= 0.u) % % Function pde_1 computes the t derivative vector for the diffusion . b.1) to investigate the use of (1) Dirichlet. the Matlab routines still resemble those of previous chapters. and c are arbitrary.1) becomes the linear diffusion equation. For the linear case.m. (5. is considered first (with ncase. the left boun- dary value of x will be denoted as xl . To implement the 10 cases ((linear and nonlinear PDE)(5 BCs) = 10 cases). . so we look for another solution. nbc set in the main program).1.1016/B978-0-12-384652-5. (5.

n. .t).n. % % Dirichlet BCs if(nbc==1) u(1)=ua_1(x(1). end % % Nonlinear Neumann BCs if(nbc==4) ux(1)=-(1/a)*(1-u(1)ˆ4).u).u).xu. end % % Nonlinear case if(ncase==2) % % ux ux=dss004(xl. ux(n)=(pi/xu)*cos(pi*x(n)/xu)*exp(-a*(pi/xu)ˆ2*t). ux(n)=(1/a)*(1-u(n)ˆ4). end % % Analytical Neumann BCs if(nbc==5) ux(1)=(pi/xu)*cos(pi*x(1)/xu)*exp(-a*(pi/xu)ˆ2*t). % % Dirichlet BCs if(nbc==1) u(1)=0.n.u).xu.ux). end % % Neumann BCs if(nbc==2) ux(1)=0.n.t). end % % uxx uxx=dss004(xl.68 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS % equation with nonlinear source terms % global xl xu x n ncall ncase nbc % % Model parameters global a b c % % Linear case if(ncase==1) % % ux ux=dss004(xl. end % % Third type BCs if(nbc==3) ux(1)=-(1/a)*(1-u(1)). u(n)=0. ux(n)=0. ux=dss004(xl.xu. u(n)=ua_1(x(n). ux(n)=(1/a)*(1-u(n)).xu.

ut(i)=a*uxx(i)-b*cu-c*sq. end % % PDE for i=1:n sq=u(i)ˆ2. end if(nbc==1) ut(1)=0.n. (5. end % % Analytical Neumann BCs if(nbc==5) ux(1)=-1/(c*t+(b/(2*a))ˆ0. end % % Nonlinear Neumann BCs if(nbc==4) ux(1)=-(1/a)*(1-u(1)ˆ4).m for eq. cu=u(i)*sq.5*x(n)+1)ˆ2*(b/(2*a))ˆ0. Chapter 5 . end % % Neumann BCs if(nbc==2) ux(1)=0. Diffusion Equation with Nonlinear Source Terms 69 ux=dss004(xl.u) % % Function pde_1 computes the t derivative vector for the diffusion % equation with nonlinear source terms % global xl xu x n ncall ncase nbc % .u).5.ux). The function and some global parameters are first defined. we consider each case one at a time. ut(n)=0. % % Increment calls to pde_1 ncall=ncall+1.xu. end % % uxx uxx=dss004(xl.5. Because of the branching for the 10 cases.5*x(1)+1)ˆ2*(b/(2*a))ˆ0. LISTING 5. end ut=ut'.n. function ut=pde_1(t.xu. ux(n)=-1/(c*t+(b/(2*a))ˆ0. ux(n)=(1/a)*(1-u(n)ˆ4).1: Function pde 1.1). end % % Third type BCs if(nbc==3) ux(1)=-(1/a)*(1-u(1)). . ux(n)=(1/a)*(1-u(n)). ux(n)=0.

analytical solutions may not even be available. The routine then goes into the first BC type.1) is second order in x. in the case of nonlinear BCs. Thus. We have used so-called stagewise differentiation in which uxx is computed by two successive calls to dss004. two BCs are required. Since eq. dss004 is called again to use these boundary values. % % Linear case if(ncase==1) % % ux ux=dss004(xl.1) is then programmed (at the end of pde 1. end Note that u(x = xl = 0.u). nonlinear BCs are easily . t) = u(x = xu = 1.xu.n.1). Equation (5. but as we will observe. ux=dss004(xl. b = c = 0 with ncase=1 as defined numerically in the main program pde 1 main. t) = 0 are used as the BCs (as u at grid points 1. The second derivative in eq. nbc=1 for Dirichlet BCs. namely the ease with which BCs of essentially any form can be specified (as illustrated by the 10 cases).n. % % Dirichlet BCs if(nbc==1) u(1)=0.m).n.70 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS % Model parameters global a b c . as discussed in Chapter 4. This contrasts with the analytical approach in which changes in the BCs generally require major changes in the corresponding analytical solutions. is computed by a second call to dss004 (further down pde 1.m and received by pde 1.ux). and they could even be functions of t.n). The zero BC values are generally termed homogeneous. This completes the derivatives in x with the BCs for ncase=1. (5. (5.m as global variables). compute uxx from u.xu. . this case illustrates an important advantage of the numerical approach to PDEs. Then. in principle. nbc=1 (the first of the 10 cases). . the routine starts with a call to dss004 to compute ux (first for the linear case. To implement these BCs. However. implemented numerically (for nbc=4).m). uxx. any values could be used. u(n)=0. % % uxx uxx=dss004(xl. An alternative would be to use dss044 to directly . % % PDE for i=1:n sq=u(i)ˆ2.u).xu.

0). Chapter 5 . (5. (5.m. ut(n)=0.2: Function inital 1.m is incremented. and we have only the linear diffusion equation ut(i)=a*uxx(i). function u0=inital_1(t0) % % Function inital_1 sets the initial condition for the diffusion % equation with nonlinear source terms % % Parameters shared with other routines global xl xu x n ncall % % Model parameters global a b c % % Spatial domain and initial condition xl=0. % % IC from analytical solution for i=1:n x(i)=xl+(i-1)*dx. Diffusion Equation with Nonlinear Source Terms 71 cu=u(i)*sq. end LISTING 5. Since Dirichlet BCs are used (nbc=1). % % Increment calls to pde_1 ncall=ncall+1. end if(nbc==1) ut(1)=0. The function and some global parameters are first defined.3) with t = 0. function u0=inital_1(t0) % % Function inital_1 sets the initial condition for the diffusion equation . ut(i)=a*uxx(i)-b*cu-c*sq. The IC from eq.m: .2) with t = 0 is programmed in inital 1.m. end ut=ut'. the derivatives in t are set to zero at the boundaries (so that the ODE integrator does not move the boundary values away from their prescribed values). (5. A transpose is included to meet the requirements of the ODE integrator ode15s. We can note the following points about inital 1. This completes the coding for the first of the 10 cases (ncase=nbc=1) in pde 1. xu=1. the counter for the number of calls to pde 1. then return to the other nine cases. we complete the discussion of this first case. Finally.m for IC from eq. At this point.0.2) or eq. u0(i)=ua_1(x(i). Recall again that b = c = 0 (for ncase=1) so that the nonlinear terms sq and cu have no effect. n=26. dx=(xu-xl)/(n-1).

2) for ncase=2.2) and (5. % % Spatial domain and initial condition xl=0. end LISTING 5. function ua 1 (listed next) is called (for t = 0) to define the IC from eq.m for analytical solution (5. ncase=1. The grid in x is then defined over the interval 0 ≤ x ≤ 1 for 26 points. ua 1. % % IC from analytical solution for i=1:n x(i)=xl+(i-1)*dx. xu=1.m.3: Function ua 1. (5.m serves both cases. for eqns. function uanal=ua_1(x. .t) % % Function uanal computes the exact solution of the diffusion equation % with nonlinear source terms for comparison with the numerical solution % % Model parameters global xl xu n ncall ncase nbc global a b c % % Analytical solution % % Linear case if(ncase==1) uanal=sin(pi*x/xu)*exp(-a*(pi/xu)ˆ2*t). (5.m is a straightforward implementation of the analytical solutions.3).0).72 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS % with nonlinear source terms % % Parameters shared with other routines global xl xu x n ncall % % Model parameters global a b c . since ncase is a global variable that is passed to the routine for the analytical solutions. u0(i)=ua_1(x(i).5*x+1).3). (5. end As the grid in x is defined in the for loop.2) and (5. (5. end % % Nonlinear case if(ncase==2) uanal=1/(c*t+(b/(2*a))ˆ0.0. inital 1. dx=(xu-xl)/(n-1). n=26. Function ua 1.3) with t = 0 for ncase=1 or the IC from eq.3).2) and (5. eqns.2.

3:tf]'. is essentially the same as pde 1 main of previous chap- ters. 2 .abstol). end % % Select BCs % % 1 . % % ODE integration mf=2. % % Linear case if(ncase==1) a=0. Chapter 5 . options=odeset('RelTol'. % % Diffusion equation with nonlinear source terms % % Clear previous files clear all clc % % Parameters shared with other routines global xl xu x n ncall ncase nbc % % Model parameters global a b c % % Select case % % 1 .reltol. b=1.Nonlinear third type.linear. ncall=0.0. % % Initial condition t0=0.nonlinear ncase=1. abstol=1.Analytical Neumann nbc=1.0e-06. c=1. it is listed here along with some discussion. pde 1 main.Dirichlet.Neumann. end % % Nonlinear case if(ncase==2) a=1. u0=inital_1(t0). 4 . c=0.9. nout=4. tout=[t0:0. reltol=1.1. b=0.0e-06.'AbsTol'. 2 . Diffusion Equation with Nonlinear Source Terms 73 The main program. % % Explicit (nonstiff) integration . % 5 . % % Independent variable for ODE integration tf=0. 3 . but since it contains the coding for the 10 cases.Third type.

.tout.6f%15. for i=1:n fprintf('%6.'o') title('Diffusion equation with nonlinear source terms.ncall).u_anal(it.6f\n'.t(it).2f%8.S) [t.u_anal. u(it. t = 0.numerical. 0.i)=u(it. end end end if(nbc==2 | nbc==3 | nbc==4) for it=1:nout fprintf('\n t x u(it.. errors in numerical solution if(nbc==1 | nbc==5) for it=1:nout u(it. 0.'-'. end end for it=1:nout fprintf('\n t x u(it.u.3f%15. el=40. end end end fprintf(' ncall = %4d\n\n'.9.i) err(it.i)-u_anal(it.6f%15.i)).u(it.err(it. 0. % % Plot numerical and analytical solutions figure(2) if(nbc==1 | nbc==5) plot(x. solid .t(it)). t = 0.i)\n').i).i)\n').u(it..x(i).74 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS if(mf==1)[t. .t.2f%8.t(it)).analytical') elseif(nbc==2 | nbc==3 | nbc==4) plot(x.3f%15. end % % Implicit (sparse stiff) integration if(mf==2) S=jpattern_num_1.u) az=50. o .x.6f\n'.i)=ua_1(x(i). 0.n)=ua_1(x(n). 0.t)') figure(3) surf(x.i)).options).i).i) u_anal(it.6.3.options).1)=ua_1(x(1).'JPattern'.3. for i=1:n u_anal(it. for i=1:n fprintf('%6.t(it)).x(i).u0. end % % Store analytical solution.tout. options=odeset(options.i). t(it).'-') title('Diffusion equation with nonlinear source terms. err(it.u0.u]=ode45(@pde_1.numerical') end xlabel('x') ylabel('u(x. 0.u]=ode15s(@pde_1.u.9. solid .6.

Here. % % Select case % % 1 .9. 0.1).linear. The IC from inital 1.4: Main program pde 1 main.m is set. end % % Nonlinear case if(ncase==2) a=1. 2 .Nonlinear third type. Diffusion Equation with Nonlinear Source Terms 75 view(az. One of the five BCs is then selected. we specify nbc=1 corresponding to the homogeneous Dirichlet BCs used in .9 with four outputs at t = 0. end . LISTING 5.Dirichlet. We can note the following points about pde 1 main. % % Linear case if(ncase==1) a=0. % % Diffusion equation with nonlinear source terms % % Clear previous files clear all clc % % Parameters shared with other routines global xl xu x n ncall ncase nbc % % Model parameters global a b c . b=0. which includes setting the values of a. 0. c in eq. c=0.nonlinear ncase=1. and the interval in t is defined as 0 ≤ t ≤ 0.3. (5. title('Diffusion equation with nonlinear source terms').m for eq.Neumann. 4 .Analytical Neumann nbc=1. 2 .Third type. 0. b=1. . b. zlabel('u(x.6. % % Select BCs % % 1 .m of Listing 5. % 5 . 3 .el) xlabel('x').1. c=1. pde 1.m: . (5.1. The case is selected. ylabel('t').t)').1). Previous files are cleared and the problem parameters are declared as global and defined numerically. Chapter 5 .

% % Explicit (nonstiff) integration if(mf==1)[t.. For nbc=1.i) u_anal(it.tout.3:tf]'.reltol.. errors in numerical solution if(nbc==1 | nbc==5) for it=1:nout u(it. These same considerations (availability of an analytical solution) apply to the plotted output as well.i)-u_anal(it.u(it..6f\n'. for i=1:n fprintf('%6.i)).3) can be used for comparison with the numerical solution. . nonstiff ) or by ode15s (for mf=2.i)=u(it. u0=inital_1(t0). analytical solutions (5. end % % Implicit (sparse stiff) integration if(mf==2) S=jpattern_num_1.76 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS % % Initial condition t0=0. % % Independent variable for ODE integration tf=0.0e-06.options). The ODE integration is by ode45 (for mf=1. end .3f%15. err(it.'JPattern'.1)=ua_1(x(1). % % ODE integration mf=2.u]=ode45(@pde_1.6f%15.9. tout=[t0:0.2) and (5.4.t(it)).err(it.i). for i=1:n u_anal(it.t(it)).u0.m as the first argument.i)=ua_1(x(i).5. ncall=0. % % Store analytical solution. stiff ).3.2f%8. end end for it=1:nout fprintf('\n t x u(it. reltol=1.abstol). u(it.i).6f%15.x(i).t(it)).i).S) [t. end .'AbsTol'.tout. Note that these integrators call pde 1.i)\n'). options=odeset(options.options).n)=ua_1(x(n). The solution is displayed numerically.0e-06.u]=ode15s(@pde_1. and the difference between the two solutions (err) can be included in the output.i) err(it. options=odeset('RelTol'. an analytical solution is not readily available and therefore only the numerical solution is displayed.u_anal(it. For nbc=2.u0. t(it). nout=4. abstol=1.0.

1 also reflect the good agreement between these two solutions. ylabel('t'). since the number of grid points. 0. is relatively small. 0.6. n = 26. 5. t = 0.2 is the 3D plot of the numerical solution. .3. The map of the ODE Jacobian matrix. 0.u_anal.t.'-') title('Diffusion equation with nonlinear source terms. Chapter 5 . is displayed at the end to give an indication of . % % Plot numerical and analytical solutions figure(2) if(nbc==1 | nbc==5) plot(x.3. the increase in the bandwidth of the ODE Jacobian matrix through successive calls of the spatial differentiator such as dss004. the individual elements of the Jacobian matrix are distinct.m to compute uxx from u by stagewise differentiation.u) az=50.9. solid .3.t)').ncall).9. for i=1:n fprintf('%6.numerical') end xlabel('x') ylabel('u(x.6. t = 0. el=40. The tabular analytical and numerical solutions given in Table 5. Diffusion Equation with Nonlinear Source Terms 77 end end if(nbc==2 | nbc==3 | nbc==4) for it=1:nout fprintf('\n t x u(it. solid . zlabel('u(x.u(it. view(az. note that the band- width is 9 and not 5 as might be expected from the five-point FDs in dss004.t(it). that is. Figure 5. Also. The number of calls to pde 1.t)') figure(3) surf(x.'-'.3f%15.m is the same as jpattern num 1.numerical.analytical') elseif(nbc==2 | nbc==3 | nbc==4) plot(x.el) xlabel('x'). Finally. reflects the banded structure of the ODEs produced by dss004.'o') title('Diffusion equation with nonlinear source terms. o . This greater bandwidth is due to the repeated use of dss004 in pde 1. the solutions are displayed graphically in 2D (by plot) and 3D (by surf).m in previous chapters and is therefore not reproduced here. end end end fprintf(' ncall = %4d\n\n'. In particular. The Jacobian matrix routine jpattern num 1. ncall. the total computational effort required to compute the numerical solution. title('Diffusion equation with nonlinear source terms'). Figure 5.i)\n').x. 0.x(i). Fig. 0. which are now reviewed.u.m.1 indicates good agreement between the analytical and numerical solutions.6f\n'.i)).u. 0. This example illustrates one of the disadvantages of stagewise differentiation.2f%8. The main program produces the same three figures and tabulated output as in previous chapters.

6 0.8 0.4 0.7 0.5 0.4 0.2 1 0. (5.2 0.5 0.4 0.1 0.6.7 0. . superimposed (circles) using five-point FD approximations in dss004 for t = 0.3). eq.2 1 0 FIGURE 5.8 t 0. (5.8 0.3 0.1).4 0.2: 3D plot of the numerical solution to eq.9 0. Diffusion equation with nonlinear source terms 1 0.9 1 x FIGURE 5. 0.4 0.6 u (x. t ) 0.78 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Diffusion equation with nonlinear source terms 1 0.1 0 0 0. 0.2 0 0 0.1) (lines) with the analytical solution.8 0.2 0.8 0.3 0.6 x 0. 0.1: Numerical solution to eq.6 u (x.3. (5.6 0.9 (top to bottom). t ) 0.

1 is .m of Listing 5. the BCs are ∂u(x = xl .1. nbc=2. The agreement between the analytical and numerical solution of approximately six figures is due in part to the smoothness of the solution as reflected in Fig. Diffusion Equation with Nonlinear Source Terms 79 Jacobian sparsity pattern – nonzeros 198 (29. Also.290%) 0 5 Semidiscrete equations 10 15 20 25 0 5 10 15 20 25 Dependent variables FIGURE 5. Case 2: Linear PDE.3)). (5. t → ∞) = 0 (although the interval in t would have to be expanded beyond t = 0.1. The computational effort reflected in ncall = 95 is quite modest. In summary.1) subject to the IC from eq. (5. a=0. b=c=0) For ncase=1.3: Jacobian matrix map of the MOL ODEs for n = 26. homogeneous Neumann BCs). t) = =0 (5. xu = 1) is straightforward. the solution has the limiting value u(x. Neumann BCs (ncase=1. (5.9 to demonstrate this limiting value.nbc=2 (linear case. even when using only 26 grid points. We now consider the other nine cases. the solution of eq.4) ∂x ∂x The relevant coding in pde 1. as a result of the homogeneous Dirichlet BCs.3) (with t = 0) and two homogeneous Dirichlet BCs (with xl = 0. t) ∂u(x = xu . particularly. 5. which is also apparent from eq. since the solution is quite smooth. Chapter 5 .

120 0. .248690 0. 0.481754 0.248690 0.051558 0.151435 0.151436 0.00 0.248690 0.000000 0.i) err(it.160 0. Output for t=0.241799 0. .000000 0.125333 0.90 0.000000 0. 0.000 0.102304 0.000001 0.000000 0.000000 0.080 0.880 0. .i) 0.00 0.051559 0. .000000 0. .000000 0.000000 0.198179 0.00 0.151435 0.840 0.125333 0.000000 0.960 0. .00 0.120 0.90 1.000000 0. .00 0. .i) err(it. .368125 0.000000 0.90 0.151436 0.000000 0.000000 0.000 0.198179 0.000000 .080 0.125333 0.102303 0.000 0.840 0.920 0.000 0.00 0.000000 .241797 0.000002 0.198180 0. 0. % % Linear case if(ncase==1) . . . .000000 ncall=95 .i) 0.000001 0.481754 0.nbc=1 t x u(it.920 0.880 0.241799 0.800 0.102303 0.00 1. . .90 0.200 0.1: Abbreviated tabular numerical and analytical solutions for ncase=1.90 0.00 0.000000 0.000000 0.000000 0.248690 0.368125 0.90 0. .000000 0.000002 .i) u anal(it. .160 0. .90 0.102304 0.90 0.3.125333 0.051558 0. t x u(it.90 0.198180 0. .90 0.i) u anal(it.040 0.80 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 5.368125 0.90 0.481754 0.368125 0. .00 0.00 0.000000 0.040 0. .241797 0. .000000 0.481754 0.960 0.000000 0.6 removed .051559 0.000000 0. .000001 0.000001 0.90 0.

2 0.8 0.n.6.5 0.xu. % % uxx uxx=dss004(xl.3 0.5 0. The plotted numerical solution is in Fig. eq. 5. .6 0. ux(n)=0. 0.xu.1) using five-point FD approximations in dss004 for t = 0.4: Numerical solution to eq. 0. .6 u (x.9 for ncase=1. end LISTING 5.nbc=2. Diffusion Equation with Nonlinear Source Terms 81 % % ux ux=dss004(xl.3.4 0.m for eq.7 0.9 1 x FIGURE 5.7 0.4 0. end .4. 0.1 0 0 0.2 0.n. (5.3 0.5: Programming from pde 1.u).ux). .1 0. (5. t ) 0.4)) resets the boundary values of the first derivative. % % Neumann BCs if(nbc==2) ux(1)=0.1) with ncase=1.8 0. (5. .9 0. Chapter 5 . nbc=2. . . Diffusion equation with nonlinear source terms 1 0. ux(1).ux(n). The coding for homogeneous Neumann BCs (nbc=2.

We can note.4 0. t → ∞) = 2/π = 0. this idea is explained in Appendix 1 at the end of this chapter. (5.1. a=0. t) ∂u(x = xu .82 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Diffusion equation with nonlinear source terms 1 0.636620.2). in particular.2 0 0 0. third-type BCs). = a(1 − u(x = xu . t ) 0. nbc=3. 5.8 0.m of Listing 5. The limiting value u(x. t) = −a(1 − u(x = xl .3 and is therefore not reproduced here (since the PDE is the same and the numerical approxi- mations are nearly the same with differences only at the boundaries for nbc=1.4 t 0.1). another test of the numerical solution based on conserva- tion of mass (or energy) is possible. t → ∞) approaches a constant value 2/π = 0.1 is .5 is the 3D plot of the numerical solution.2 1 0.nbc=3 (linear case.6 u (x. the BCs are ∂u(x = xl . u(x. However. b=c=0) For ncase=1.6 0.4)) at the boundaries.6 x 0. as explained in Appendix 1 at the end of this chapter. Also. an analytical solution is not presented for this case (that could be used to evaluate the numerical solution). t)) (5. Figure 5. Also.2 1 0 FIGURE 5. t)).5) ∂x ∂x The relevant coding in pde 1. Case 3: Linear PDE. Third-Type BCs (ncase=1.8 0. The map of the ODE Jacobian matrix is basically the same as in Fig.8 0. the zero slope (homogeneous Neumann BCs eq.636620 is apparent. (5.5: 3D plot of the numerical solution to eq.4 0.

(5. The plotted numerical solution is in Fig.8 0.7 0. end LISTING 5.8 0.u).xu.6: Numerical solution to eq.5 0.4 0.ux). (5. t ) 0. % % uxx uxx=dss004(xl. .6: Programming from pde 1.xu. .6 u (x. 5.2 0.1 0 0 0.9 0.1 0. . . Chapter 5 .3.n.m for eq. ux(n)=(1/a)*(1-u(n)).2 0.4 0. .6. 0.1) using five-point FD approximations in dss004 for t = 0. end .6. % % Linear case if(ncase==1) % % ux ux=dss004(xl.1) with ncase=1.n.9 for ncase=1. (5. nbc=3. Diffusion Equation with Nonlinear Source Terms 83 .3 0. % % Third type BCs if(nbc==3) ux(1)=-(1/a)*(1-u(1)).5). 0. . .9 1 x FIGURE 5. Diffusion equation with nonlinear source terms 1 0.7 0.6 0.3 0.5 0. . The coding for the third-type BCs (nbc=3) follows directly from eq. 0.nbc=3.

this would be more apparent numerically if the final value of t was increased from t = 0.4 0.4 0.9).3 and is there- fore not reproduced here (since the PDE is the same and the numerical approximations are nearly the same with differences only at the boundaries for nbc=1. Case 4: Linear PDE.9 (the same interval in t was used in all 10 cases to minimize the coding).9 1 FIGURE 5. t) = −a[1 − u(x = xl . Also.2 0.2 0. the BCs are ∂u(x = xl .5 0. 5.3 0. nbc=4. t) 0.7 is the 3D plot of the numerical solution.nbc=4 (linear case. b=c=0) For ncase=1. Nonlinear Third-Type BCs (ncase=1. (5. t → ∞) = 1 follows from BCs (5. t) ∂u(x = xu .6 0.8 0 x 0. = a[1 − u(x = xu . The limiting value u(x.7 0. t)4 ].4 t 0 0.6) ∂x ∂x . We can note in particular that the limiting value u(x. Figure 5.6 u(x. a=0. nonlinear third-type BCs).8 0.2 0 0.1. an analyt- ical solution is not presented for this case (that could be used to evaluate the numerical solution).6 0.7: 3D plot of the numerical solution to eq. t → ∞) = 1 is apparent (particularly if t is extended beyond t = 0. t)4 ] (5.1 0.5). The map of the ODE Jacobian matrix is basically the same as in Fig.1).84 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Diffusion equation with nonlinear source terms 1 0.3).8 1 0.

this example illustrates a major advantage of numerical . The relevant coding in pde 1.1 is . Although the solution for the nonlinear case (nbc=4) is a minor extension of the linear case (nbc=3) numerically (as discussed subsequently).m for eq.7) can be accommodated numerically by using a root finder applied to fb to compute ux at the boundary. . nonlinear BCs of the general form (for a second-order PDE) fb (u. .7: Programming from pde 1. the accommodation of nonlinear BCs.6). (5. .ux). 5. . . end LISTING 5.8. followed by application of the method for nonlinear third-type BCs discussed next. end . methods. % % Linear case if(ncase==1) % % ux ux=dss004(xl. .5). % % Nonlinear Neumann BCs if(nbc==4) ux(1)=-(1/a)*(1-u(1)ˆ4). % % uxx uxx=dss004(xl. . the nonlinear terms u(x = xl .m of Listing 5. t)4 are significant for the following reasons: . (5. The plotted numerical solution is in Fig. and in fact.n. nbc=4. However. The fourth power has an important application in radiation heat transfer (according to .9 . that is. In other words. ux . x. (5. the nonlinear case is much more difficult. ux(n)=(1/a)*(1-u(n)ˆ4).xu.xu. The coding for the nonlinear third-type BCs (nbc=4) follows directly from eq.6). t)4 .u).n. Diffusion Equation with Nonlinear Source Terms 85 Equation (5. t → ∞) = 1 follows from BCs (5. the Stefan–Boltzmann law).6) may appear to be a trivial extension of eq. this would be more apparent numerically if the final value of t was increased from t = 0. u(x = xu . t) = 0 (5. Chapter 5 . To extend this idea further. analytical solutions for the nonlinear case may not be available.1) with ncase=1. analytically. We can note in particular that the limiting value u(x.

are obtained by differentiating eq.9 is the 3D plot of the numerical solution.1 0. The limiting value u(x.3. (5.9) ∂x .2 0. 0.1 0 0 0.9). Analytical Neumann BCs (ncase=1.1.4 0. Case 5: Linear PDE. this is primarily due to the unavailability of an analytical solution for this nonlinear case. t ) 0.7 0.3 0.3 and is therefore not reproduced here (since the PDE is the same and the numerical approximations are nearly the same with differences only at the boundaries for nbc=1. t) 2 = (π/xu ) cos(π x/xu )e−a(π/xu ) t (5. t → ∞) = 1 is apparent (particularly if t is extended beyond t = 0. Also. 0.5 0.nbc=4. the same interval in t was used in all 10 cases to minimize the coding). fb1 .9 for ncase=1.3 0.8) ∂x ∂x where the BC functions.7 0.6. 5. t) = fb1 (t). b=c=0) As a final linear case.8: Numerical solution to eq.6 u (x. xu . t) ∂u(x = xu . we consider analytical Neumann BCs (ncase=1.86 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Diffusion equation with nonlinear source terms 1 0.2 0. = fb2 (t) (5. fb2 . Figure 5.9 1 x FIGURE 5.4). 0.3) with x = xl . nbc=5) ∂u(x = xl .9 0.8 0.1) using five-point FD approximations in dss004 for t = 0.4 0. The map of the ODE Jacobian matrix is basically the same as in Fig. (again. ∂u(x. nbc=5. (5.8 0. an analytical solution is not presented for this case (that could be used to evaluate the numerical solu- tion).5 0.6 0. a=0.

.2 0 0.5 0. Chapter 5 .1 0. % % Analytical Neumann BCs if(nbc==5) ux(1)=(pi/xu)*cos(pi*x(1)/xu)*exp(-a*(pi/xu)ˆ2*t). .9 1 FIGURE 5. end .6 u(x.3 0.u).8 0 x 0. The relevant coding in pde 1.1).6 0.6 0.4 0.1 is . .9: 3D plot of the numerical solution to eq.8 0. (5. Diffusion Equation with Nonlinear Source Terms 87 Diffusion equation with nonlinear source terms 1 0.m of Listing 5. .2 0.2 0.n.7 0.8 1 0. % % Linear case if(ncase==1) % % ux ux=dss004(xl. ux(n)=(pi/xu)*cos(pi*x(n)/xu)*exp(-a*(pi/xu)ˆ2*t). . % % uxx .4 0.xu. .4 t 0 0. . t) 0.

9 for ncase=1.6 0. The plotted numerical solution is in Fig. 5.m for eq.3 0. the latter.3 0. 5.xu. a portion of the two solutions at t = 0.1) with ncase=1.8 0. The computational effort reflected in ncall = 71 is modest.5 0.4 0. The map of the ODE Jacobian matrix is basically the same as in Fig. ∂x ∂x which includes the numerical (lines) and analytical (circles) solutions.6. nbc=5.2. t) = ux(1) and = ux(n). t ) 0. (5.88 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS uxx=dss004(xl.2 0. 5.nbc=5 (top to bottom). Table 5.5.9 0.10.1) using five-point FD approximations in dss004 t = 0.3).ux).9 1 x FIGURE 5.3.4 (Figs.4 0.11.8) with ∂u(xl . (5. 0. again eq.10: Numerical (lines) and analytical (circles) solutions to eq.2) is produced by the code for nbc=1. .8)).7) and (5.1 0. 5.5).n. The agreement between the numerical and analytical solutions is quite satisfactory. The coding for the analytical Neumann BCs (nbc=5) follows directly from eq. This completes the discussion of the five BC cases for the linear PDE (b = c = 0. 0.1 0 0 0.7 0.2 0.9 is listed in Table 5.6 u (x. (5. Recall again that the numerical and plotted output from pde 1 main in Listing 5. 0. We now essentially repeat the preceding discussion for the five BC cases Diffusion equation with nonlinear source terms 1 0. (5.8 0.7 0.10. t) ∂u(xu .3 and is therefore not reproduced here (since the PDE is the same and the numerical approximations are nearly the same with differences only at the boundaries for nbc=1. (5. Figure 5. ncase=1).8: Programming from pde 1. applies since Neumann BCs based on this solution were used (in eqns. end LISTING 5.5 0.11 is the 3D plot of the numerical solution.

Diffusion Equation with Nonlinear Source Terms 89 Diffusion equation with nonlinear source terms 1 0.8 0. The purpose of this dis- cussion is to demonstrate.8 0. . Chapter 5 . .nbc=5 t x u(it.90 0.90 0.4 0. . .391239 0.404083 0.11: 3D plot of the numerical solution to eq.2: Abbreviated tabular numerical and analytical solutions for ncase=1.000004 0.2.1).404086 0.600 0.404083 0.90 0.i) . 0. that a nonlinear PDE numerical solution is as readily computed as for a linear PDE. ncase=2). .391239 0.90 0.000004 0. ncall=71 (nbc=1.2 1 0.4 0.391235 0.2 0 0 0.4 t 0. we present only the details for the few differences.6 x 0. . . . at least in principle.560 0.520 0. Table 5.000003 .400 0.4.i) u anal(it. . c 6= 0.5) for the nonlinear PDE (b 6= 0. Since the following discussion is basically a repetition of the previous discussion.391235 0.410561 0.i) err(it.6 0.90 0. (5.404086 0.410561 0.90 0.000003 0. t ) 0.410557 0.2 1 0 FIGURE 5. .000004 0.410557 0.3.8 0.6 u (x. .000004 0.480 0.440 0.

u).m of Listings 5. inital 1. Dirichlet BCs (ncase=2.n. c (programmed in pde 1 main. end % % PDE for i=1:n sq=u(i)ˆ2. (5. b. (5.90 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Case 6: Nonlinear PDE.m of Listing 5. The plotted solutions follow.1 is . and the map of the Jacobian matrix does not change significantly from the preceding five linear cases.2 and 5. ux=dss004(xl. .xu.u). end if(nbc==1) ut(1)=0.m of Listing 5. end LISTING 5. ut(n)=0.xu. a portion of the two solutions at t = 0. The programming of eq. % % Increment calls to pde_1 ncall=ncall+1. nbc=1).m can again be used for the Dirichlet BCs through the use of ncase as a global vari- able (refer to Listing 5.m for eq. cu=u(i)*sq. end .3. .1) with ncase=2. nbc=1. % % Dirichlet BCs if(nbc==1) u(1)=ua_1(x(1).4) are changed. only the values of a. The agreement between the numerical and analytical solutions is to at least six figures.1) for the nonlinear case (ncase=2) is the same as for the linear case (ncase=1).ux).t). . .3). nbc=1. end ut=ut'. ua 1.9 is listed in Table 5.xu.m and pde 1 main. % % uxx uxx=dss004(xl. The computational effort reflected in ncall=87 is quite modest. u(n)=ua_1(x(n).t).9: Programming from pde 1. a=b=c=1) For Dirichlet BCs (ncase=2. .n.n. ut(i)=a*uxx(i)-b*cu-c*sq.4 remain the same for ncase=2. % % Nonlinear case if(ncase==2) % % ux ux=dss004(xl. the relevant coding in pde 1.

3.1 0. 5.452258 0.5 0.446546 0.8 0. .440 0. 5. Table 5.452258 0.5. 0.90 0.90 0.i) . 0. .430244 0.480 0.4 0 0. nbc=1. (5. ncall=87 Diffusion equation with nonlinear source terms 1 0.435544 0.90 0.435544 0. .560 0. 0.4 0.000000 0.7 0.5 0.3: Abbreviated tabular numerical and analytical solutions for ncase=2.3) is produced by the code for ncase=2.000000 0.i) err(it. .600 0. .12: Numerical (lines) and analytical (circles) solutions to eq. Figure 5. . .000000 .000000 0.520 0.90 0.7 u (x.430244 0.000000 0. t ) 0. .2 0.3 0.13 is the 3D plot of the numerical solution.nbc=1 (top to bottom). 0.1) using five-point FD approximations in dss004 t = 0.400 0.440976 0.90 0.4 (Figs. .6.nbc=1 t x u(it. Diffusion Equation with Nonlinear Source Terms 91 Table 5.13. . Chapter 5 .i) u anal(it. .12.8 0.458118 0.9 0.9 for ncase=2.458118 0.000000 0.90 0.9 1 x FIGURE 5.6 0.446546 0.6 0. Recall again that the numerical and plotted output from pde 1 main in Listing 5.440976 0.

4 0 0.m of Listing 5.1).n. the relevant coding in pde 1.4 0. % % Neumann BCs if(nbc==2) ux(1)=0. Neumann BCs (ncase=2. . % % Nonlinear case if(ncase==2) % % ux ux=dss004(xl.13: 3D plot of the numerical solution to eq.6 x 0. nbc=2.u). .9 0.8 0.4 t 0. (5. ux(n)=0.6 0. (5.1 is .2 1 0 FIGURE 5.8 0.6 0. . . . Case 7: Nonlinear PDE.8 0. . end . .2 1 0.4) (ncase=2. t ) 0.92 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Diffusion equation with nonlinear source terms 1 0.7 u (x. nbc=2).5 0. . a=b=c=1) For the Neumann BCs of eq.xu.

m of Listing 5. The programming of eq. This value could also be confirmed by Table 5.90 0.90 0. . b.520 0.m and pde 1 main.480 0. cu=u(i)*sq.9 is listed in Table 5.372288 0.372287 0. ut(i)=a*uxx(i)-b*cu-c*sq. and the map of the Jacobian matrix does not change significantly from the preceding cases.600 0.4 remain the same for ncase=2.i) .3722 is clear.nbc=2 t x u(it.10: Programming from pde 1.372286 0. Chapter 5 . c (programmed in pde 1 main.372289 0.1) for the nonlinear case (ncase=2) is the same as for the linear case (ncase=1). end LISTING 5. ut(n)=0. ncall=188 . .1) with ncase=2. 0. end ut=ut'.n. (5. . The computational effort reflected in ncall = 188 is modest.4. inital 1.4: Abbreviated tabular numerical and analytical solutions for ncase=2.372288 0.90 0.90 0. and the approach to a constant value u(x.372286 .ux).90 0. end if(nbc==1) ut(1)=0. end % % PDE for i=1:n sq=u(i)ˆ2. only the values of a. A portion of the solution at t = 0.560 0. Diffusion Equation with Nonlinear Source Terms 93 % % uxx uxx=dss004(xl. t → ∞) = 0. % % Increment calls to pde_1 ncall=ncall+1.m for eq. .4) are changed. (5.m of Listings 5. The plotted solutions follow.440 0.2 and 5.90 0.xu.400 0. nbc=2.

5 0. . Third-type BCs (ncase=2.7 0.6 0.4 0.636620 for the linear case.5 0.nbc=2 (top to bottom).4 0 0. .2 0.9 1 x FIGURE 5. t ) 0. note that it is different than the value 2/π = 0.4 (Figs. % % Nonlinear case if(ncase==2) % % ux ux=dss004(xl. .5) (ncase=2. 5.3.1) using five-point FD approximations in dss004 t = 0.14: Numerical solution to eq.1 0.15 is the 3D plot of the numerical solution. 0. 5.8 0.9 for ncase=2. nbc=3. . Recall again that the numerical and plotted output from pde 1 main in Listing 5. nbc=3). 0. application of mass conservation as explained in Appendix 1 at the end of this chapter.xu.8 0. .4) is produced by the code for ncase=2.94 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Diffusion equation with nonlinear source terms 1 0. % % Third type BCs if(nbc==3) .4. a=b=c=1) For the third-type BCs of eq. Figure 5. (5.3.3 0.1 is .15. 0. the relevant coding in pde 1. Case 8: Nonlinear PDE.7 u (x. Table 5.14.6.m of Listing 5.6 0.9 0.u). (5.n. nbc=2.

(5.8 0.6 0. ut(i)=a*uxx(i)-b*cu-c*sq. end ut=ut'.8 0.1) with ncase=2.4 t 0.6 0. end if(nbc==1) ut(1)=0. (5.15: 3D plot of the numerical solution to eq. cu=u(i)*sq.ux). Diffusion Equation with Nonlinear Source Terms 95 ux(1)=-(1/a)*(1-u(1)). end .9 0. ux(n)=(1/a)*(1-u(n)). Chapter 5 .8 0.4 0.5 0.n. % % Increment calls to pde_1 ncall=ncall+1.2 1 0 FIGURE 5. end LISTING 5. .m for eq. .2 1 0. Diffusion equation with nonlinear source terms 1 0. ut(n)=0. t ) 0. end % % PDE for i=1:n sq=u(i)ˆ2.xu.6 x 0.1). % % uxx uxx=dss004(xl. .4 0 0 0. nbc=3.7 u (x.11: Programming from pde 1.

∂t This is an important point.3 0. since for this case. we could in principle compute a numerical ∂u solution by appending a derivative in an initial value variable. (5. is not clear. but it could be studied further by extending the solution beyond t = 0. 0.4 remain the same for ncase=2.96 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Diffusion equation with nonlinear source terms 1 0. Table 5.5 0.16. such as in eq.7 0.9 for ncase=2. only the values of a.4 (Figs.65 0.m of Listing 5.3.6 0. t → ∞). (5.2 and 5. if we start with a BVODE. A portion of the solution at t = 0. the preceding numerical solution to eq.2 0. c (programmed in pde 1 main.17 is the 3D plot of the numerical solution.95 0. 0. t ) 0. 5. nbc=2. In other words.9 1 x FIGURE 5. the resulting solution is then for the BVODE. (5.1) ∂u for → 0. it will be the solution to eq. inital 1.9 0. Recall again that the numerical and plotted output from pde 1 main in Listing 5. (5.85 0. The programming of eq. (5.9 is listed in Table 5. .9.75 0.6.1) for the nonlinear case (ncase=2) is the same as for the linear case (ncase=1). The approach to a solution invariant in t.4 0.1).5) is produced by the code for ncase=2.17.3.55 0 0. Figure 5.nbc=3 (top to bottom). The com- putational effort reflected in ncall = 183 is modest. b. 5.5.16: Numerical solution to eq. Whatever the limiting solution might be. eq.8 0.1) using five-point FD approximations in dss004 t = 0.8 u (x.1) reduces to an ODE (with only a second derivative in x). To emphasize this point.1 0.4) are changed. then ∂t integrate numerically in t until this derivative effectively vanishes. u(x.m of Listings 5.7 0. 0. The plotted solutions follow.6 0. and the map of the Jacobian matrix does not change significantly from the preceding cases.4. (5.1) (for large t) is also a solution to a two-point nonlinear boundary value ODE (BVODE).m and pde 1 main.

5 0 0.400 0.90 0.9 0. Chapter 5 . (5.6 0. ncall=183 Diffusion equation with nonlinear source terms 1 0. 0.8 0.i) .90 0.560 0. .6 0.8 u (x. t ) 0.606608 0.608456 .606608 0.520 0.608456 0. .480 0.4 0.4 t 0.90 0.605685 0. .600 0.2 1 0 FIGURE 5.90 0.605685 0. .8 0.6 x 0.1). Diffusion Equation with Nonlinear Source Terms 97 Table 5.440 0.nbc=3 t x u(it.17: 3D plot of the numerical solution to eq.90 0.90 0. .2 1 0.5: Abbreviated tabular numerical and analytical solutions for ncase=2.7 0.

(5. . end % % PDE for i=1:n sq=u(i)ˆ2. cu=u(i)*sq. . . a=b=c=1) For the nonlinear third-type BCs of eq. % % Nonlinear Neumann BCs if(nbc==4) ux(1)=-(1/a)*(1-u(1)ˆ4). b. end . end LISTING 5. ut(n)=0.ux).1) with ncase=2. The programming of eq.m of Listing 5. (5. . ut(i)=a*uxx(i)-b*cu-c*sq.n. end if(nbc==1) ut(1)=0.98 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Case 9: Nonlinear PDE.4) are changed. only the values of a.m for eq. % % Nonlinear case if(ncase==2) % % ux ux=dss004(xl.n. the relevant coding in pde 1. nbc=4. % % uxx uxx=dss004(xl. .1 is . . (5.m of Listing 5.1) for the nonlinear case (ncase=2) is the same as for the linear case (ncase=1). end ut=ut'. . ux(n)=(1/a)*(1-u(n)ˆ4).u).6) (ncase=2.xu. c (programmed in pde 1 main. Nonlinear Third-Type BCs (ncase=2. . nbc=4). nbc=4.12: Programming from pde 1. % % Increment calls to pde_1 ncall=ncall+1.xu.

723781 . Again. nbc=3 case.9 are nearly the same.4.719499 0.2 and 5. it will be ∂u the solution to eq. the approach to a solution invariant in t. since for this case.440 0.723781 0.5 (linear BCs) ∂t and Table 5. this could be confirmed by extending the solution beyond t = 0. which reflects the difference in eqns.6. In other words.m of Listings 5. the BCs have a significant effect in the two cases (even though they are similar).1).90 0.6 (nonlinear BCs) are substantially different. (5.19.560 0. .720924 0.720924 0. Diffusion Equation with Nonlinear Source Terms 99 Table 5. Chapter 5 .4 remain the same for ncase=2. this approach to a solution invariant in t is an important point.9. .1) (for large t) is also a solution to a two-point nonlinear boundary value ODE (BVODE).520 0.719499 0. .i) . 0. Table 5. (5. The computational effort reflected in ncall = 228 is modest. There is also an important distinction from the preceding ncase=2.1) for → 0. ncall=228 inital 1.480 0. then integrate ∂t numerically in t until this derivative effectively vanishes. 5.19 is the 3D plot of the numerical solution.nbc=4 t x u(it. since now the ODE and the boundary condi- tions are nonlinear. eq. if we start with a BVODE that is nonlinear in both the ODE and its boundary conditions.90 0. 5. .1) reduces to an ODE (with only a second derivative in x).90 0. A portion of the solution at t = 0. u(x. as with nbc=3. t → ∞) is clear.6). the resulting solution is then for the nonlinear BVODE. Whatever the limiting solution might be.6 and t = 0. In other words. Figure 5.9 is listed in Table 5.90 0. the preceding numerical solution to eq. In contrast with nbc=3.6) is produced by the code for ncase=2.4 (Figs.90 0. The plotted solutions follow. . that is.90 0.3.m and pde 1 main. (5.5) and (5. since the curves for t = 0. we could in principle compute a numerical solution by ∂u appending a derivative in an initial value variable. (5.18. nbc=2.400 0. (5. such as in eq. Note also that the solutions of Table 5. Recall again that the numerical and plotted output from pde 1 main in Listing 5.6: Abbreviated tabular numerical and analytical solutions for ncase=2. and the map of the Jacobian matrix does not change significantly from the preceding cases.600 0.

9 for ncase=2.2 1 0 FIGURE 5.8 u (x.4 0.95 0. .5 0.55 0 0.3.6 0.6 0.6 x 0. 0. t ) 0.nbc=4 (top to bottom).4 0.85 0.1).4 t 0.7 0.7 0.1 0. (5.2 1 0.18: Numerical solution to eq.9 0.19: 3D plot of the numerical solution to eq.2 0.8 0.75 0. t ) 0. 0.65 0.8 0.6 0.8 u (x.9 0. (5. 0.5 0 0.3 0.7 0.1) using five-point FD approximations in dss004 t = 0.6.8 0.100 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Diffusion equation with nonlinear source terms 1 0.6 0.9 1 x FIGURE 5. Diffusion equation with nonlinear source terms 1 0.

nbc=5. . t) r b 2a b =− (x + ct) + 1 (5. (5. ut(n)=0.10) ∂x 2a b 2a For ncase=2. a=b=c=1) Finally.5. Diffusion Equation with Nonlinear Source Terms 101 Case 10: Nonlinear PDE. end ut=ut'.n. r !−2 r ∂u(x. . (5.5. . end LISTING 5. ut(i)=a*uxx(i)-b*cu-c*sq.xu.2) with respect to x.13: Programming from pde 1. Analytical Neumann BCs (ncase=2. the relevant coding in pde 1.ux). cu=u(i)*sq. ux(n)=-1/(c*t+(b/(2*a))ˆ0. we conclude (with the tenth case) using the analytical Neumann BCs obtained by differentiation eq. nbc=5.m for eq. end % % PDE for i=1:n sq=u(i)ˆ2.5*x(1)+1)ˆ2*(b/(2*a))ˆ0.5*x(n)+1)ˆ2*(b/(2*a))ˆ0. nbc=5.1 is . end if(nbc==1) ut(1)=0. Chapter 5 . % % Analytical Neumann BCs if(nbc==5) ux(1)=-1/(c*t+(b/(2*a))ˆ0. . % % Increment calls to pde_1 ncall=ncall+1. .u).m of Listing 5. end % % uxx uxx=dss004(xl. .n. % % Nonlinear case if(ncase==2) % % ux ux=dss004(xl.xu.1) with ncase=2.

430244 0. 0. . In conclusion. we have considered 10 cases of the solution of eq.4) are changed. c 6= 0) with linear and nonlinear BCs.560 0. We are developing analo- gous procedures for 2D and 3D PDEs.nbc=5 t x u(it.1) for the nonlinear case (ncase=2) is the same as for the linear case (ncase=1). .000000 0.440976 0.452258 0. .1) as a linear PDE (b = c = 0) and a nonlinear PDE (b 6= 0.000000 0.i) . and the numerical and analytical solutions agree to at least six figures.7: Abbreviated tabular numerical and analytical solutions for ncase=2.i) err(it. This is a valuable procedure.102 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 5. since agreement between numerical and analytical solutions gives some assurance that the numerical procedures are sound and . ncall=84 The programming of eq.5.430244 0. . The plotted solutions follow. (5.21 is the 3D plot of the numerical solution.4 (Figs. .20.435544 0. and the map of the Jacobian matrix does not change significantly from the preceding cases.i) u anal(it.2 and 5.480 0.446546 0.000000 0. .7) is produced by the code for ncase=2.440 0.90 0.21. only the values of a.m of Listing 5.452258 0. nbc=1.520 0.90 0. 5. The computational effort reflected in ncall = 84 is quite modest. The intent is to demonstrate the generality and flexibility of the numerical approach to PDE solutions.000000 0.7.000000 0. Figure 5.000000 . 5. Table 5. The obvious limitation to the preceding cases is that they are all 1D. . b.9 is listed in Table 5.600 0.458118 0.90 0.4 remain the same for ncase=2. .90 0. c (programmed in pde 1 main.90 0.m of Listings 5. (5.400 0. A portion of the solution at t = 0.458118 0. Appendix 1 In the previous chapters. .m and pde 1 main.90 0. inital 1.435544 0.446546 0. Recall again that the numerical and plotted output from pde 1 main in Listing 5. . we have evaluated numerical PDE solutions by comparison with analytical solutions. although these additional cases are also discussed to a limited extent in [5].440976 0.

0. t ) 0. 0.8 0.7 0.6 x 0. 0.6 0.1).4 0. (5.6 0.8 0.8 0.4 0 0. Diffusion equation with nonlinear source terms 1 0.3.2 1 0.5 0. (5.7 u (x.4 0 0 0.4 0. .2 0.9 0.21: 3D plot of the numerical solution to eq.9 0.1 0. Chapter 5 .6 0. Diffusion Equation with Nonlinear Source Terms 103 Diffusion equation with nonlinear source terms 1 0.4 t 0.5 0.1) using five-point FD approximations in dss004 t = 0.5 0.8 0.9 for ncase=2.8 0.nbc=5. t ) 0.6.9 1 x FIGURE 5.7 u (x.20: Numerical solution (lines) and analytical solution (circles) to eq.2 1 0 FIGURE 5.6 0.3 0.

to use this method.8.3). for example. mass does not remain constant for t > 0. 2. For the linear case (ncase=1). .7 is large enough that the solution reaches a con- stant value as will be observed in the following numerical output. To accomplish this. 0. Rather. In other words. we demonstrate how the conservation of mass (or energy) can be applied to the numeri- cal solution of eq. the BCs specify zero flux or insulated boundaries so that the initial mass or energy of the system should remain constant with increasing t. numerical integration may be simpler than .7 (with the four output points t = 0. (5. We can make three additional points about this application of the conservation of mass (energy): .636620 at t = 2.104 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS can therefore be used in the solution of PDE systems for which an analytical solution is not available.1)). or energy. Recall again that this agreement was accomplished with only n = 26 points. −cu2 can be considered as representing depletion of mass due to a third. the two nonlinear terms −bu3 .3) (with t = 0). (5.3) (with t = 0). nbc=2 is listed in Table 5. the solution approaches a constant value given by the integral average of the IC. (5. t = 2.12) xu − xl We can then compare the numerical value (2/π = 0. (5. by using Simpson’s rule. This test of conservation could not be applied to the nonlinear case ncase=2 (b 6= 0. R xu xl sin(π x/xu )dx cos(π x/xu )(xu /π)|xxul =− xu − xl xu − xl (xu /π)[cos(π xl /xu ) − cos(π xu /xu )] (xu /π)[1 + cos(π xl /xu )] = = (5.9. the IC is eq. respectively. Thus. and for t → ∞. All of the other Matlab code remain unchanged.11) can be considered as the application of an integral constraint or invariant. Physically. However.11) xu − xl xu − xl For xu = 1. Physically. A second widely used method for the validation of numerical methods is to apply a conservation principle such as conservation of mass.and second-order reaction. 1. the integral can be evaluated numerically. which is due to the smoothness of the solution of eq.11). The output for ncase=1. Here.m with the expanded interval 0 ≤ t ≤ 2.7 is apparent. eq.9 in pde 1 main. (5.636620 (5. it is not necessary to evaluate the integral analytically as we have done for eq.1) for the linear case (ncase = 1) and homogeneous Neumann BCs (nbc=2).7).8. we replace the relatively short time interval 0 ≤ t ≤ 0. (5.636620) with the value that the numer- ical solution approaches for t → ∞. The agreement with the integral average value 2/π = 0. momentum.11) becomes R xu xl sin(π x/xu )dx = 2/π = 0. (5. xl = 0. Equation (5. c 6= 0 in eq. for a more complicated IC than eq.

187381 0.062791 0.636610 2.636630 2.998027 0.248690 0.70 0.900 0.i) 0.00 0.636611 2. .998027 0.500 0. .040 0.9.00 0. .062791 0. .70 0.i) 2.00 0.960 0.00 0.020 0.636630 2.040 0.125333 0.187381 0. t x u(it.636612 . .70 0.100 0.460 0.500 1.920 0. .00 1.636611 2.00 0.8 removed .00 0.940 0. Diffusion Equation with Nonlinear Source Terms 105 Table 5.080 0.000000 0. . .020 0. .636630 (Continued ) . 1.248690 0.540 0.00 0. output for t=0.100 0.70 0. .980 0.Chapter 5 . 0.992115 0.7 t x u(it.00 0.480 0. . .00 0. 2.992115 .00 0.70 0.8: Abbreviated tabular numerical and analytical solutions for 0≤t≤2. . . .125333 0.00 0. .060 0.70 0.636610 2.00 0. . .080 0.000 0. .000000 0.636610 2.00 0.060 0.309017 0. .00 0. . 0.460 0.480 0.00 0.520 0.70 0.309017 . . .000000 . .70 0.70 0.000 0. .000 0.00 0.

636611 2.13) ∂t ∂x If we assume a traveling wave solution of the form u (x.920 0.000 0.8: (Continued) t x u(it. a check that the integral does not change with t confirms the conservation principle for any t > 0. t) = U (ξ ).70 0.520 0. c = velocity. eq. .70 0. and k = wavenumber. t).636610 ncall=226 analytical integration.636612 2. where ξ = k (x − ct).636630 .70 0. αk αk2 .940 0.13) reduces to the traveling wave ODE d2 U dU 2 +g + F(U) = 0 (5.70 0. .980 0. its total mass or energy will remain the same and should therefore be independent (invariant) with respect to t. (5. the use of numerical integration in applying an integral .70 1.636630 2.14) dx dx c −1 2 where g = and F(U) = U (δ + βU). . (5.636611 2.106 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 5. as we will be using different constant names in our analysis ∂u ∂ 2u − α 2 + βu3 + δu2 = 0. . u = u(x.1) below for convenience. With either method (analytical or numerical). t > 0 (5. Appendix 2 We conclude this chapter by solving the diffusion equation with nonlinear source terms using the factorization method as outlined in the main Appendix (after Chapter 19). constraint is commonplace.70 0. We repeat the problem eq.636610 2. the integral constraint can be applied at any t > 0 (it does not apply at just t → ∞). .540 0.70 0. In other words.70 0.636610 2. In fact. Although the shape of the solution will change with t. 2.i) 2.960 0.900 0.

(5. i. i.e. Also.16) dU k aαk αk Collecting terms and equating the coefficients r of U to zero (as the left-hand side of β eq. (A.14) (the third term) as F(U) 1 = f1 f2 = − 2 U (δ + βU) U αk and choose a 1 δ + bβU . D − f2 (U) D − f1 (U) U = 0.15) k aαk where we have also introduced the constant a. Now. Therefore. t) leads to the final solution !−1 β r u(x. becomes h a i 1 D± (δ + βU) D ∓ − U U = 0 (5. (A. we obtain the following ODE df1 2α 1 c U + f1 + f2 = − U + (δ + βU) = −g = − (5. adopting the grouping a of Cornejo-Perez [2]. d2 U df1 dU − U + f 1 + f 2 + f1 f2 U = 0 (5. α 6= 0 f1 = − U.20) and set K = 1. (5.19) dξ k 2α Integrating eq.20) k 2α where K is an arbitrary constant of integration.17) is compatible with the first-order ODE dξ β 2 r dU 1 ± U =0 (5.41) and (5. (5. transforming back to u(x. From eqns.16) is equal to a constant) gives a = ± . eq.39). f2 = (5.21) 2α .. Diffusion Equation with Nonlinear Source Terms 107 We factor the polynomial function of eq. we find that c = − on setting U = 0.15).18) aαk k d where D = . (5.18) either manually or using Maple yields !−1 β r 1 U =± ξ +K (5. then. as g is a constant and indepen- 2α δ dent of the value of U..40b). t) = (x − ct) + 1 (5.17) dξ 2 dU dξ the corresponding factorization eq. (5. it follows that eq. (A. We take the positive value of eq. Chapter 5 .e.

a). ># Collect terms in U eqn2:=collect(simplify(lhs(eqn1)-rhs(eqn1).x)+beta*uˆ3+delta*uˆ2=0. defVal) defVal end proc.u=U}.[xi. # Ref: Cornejo-Perez. operands. pp 533-538 restart.f[1]):f[2]:=subs(U(xi)=U. ode1:=dchange(tr1.x.2) (but with different constant names) used in the numerical simulation discussed in the main body of this chapter. g:=c/(alpha*k). ># Factor F(U)/U . Readers are referred to the papers by Berkovich [1] and Cornejo-Perez and Rosu [2. # Nonlinear second order ODE: Factorizations and # particular solutions. c:=solve(sol1.U)*U+f[1]+f[2]=-g. if we swap the equation for f1 with that for f2 . ># Define F(U). vol 114. with(DEtools): with(PDEtools): with(plots): alias(u=u(x. ># Use the C-P grouping alias(U=U):f[1]:=subs(U(xi)=U.108 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS β r From eq. and H. defVal) if operator = ln then return -infinity else return defVal end if end proc).t)): alias(U=U(xi)): >NumericEventHandler(division_by_zero = proc (operator.'recursive').size). and similarly the equation for f2 with that for f1 . Rosu (2005). The Maple script of Listing 5.14 will perform the above calculations. operands. (5. the same calculation procedure arrives at the following entirely different form of traveling wave solution δ δ δ (x − ct) −1 u (x. ># Equate coeff of U to zero eqn3:=coeff(eqn2. . However. C. Also. (5.size).t=tau. we see that the wave velocity is given by c = −δ .eqn1). Progress of Theoretical # Physics.Note: 'a' introduced f[1]:=-a*U/k. ># Convert PDE to ODE tr1:={x=(xi/k+c*tau).U]). division_by_zero = proc (operator. This solution is the same as the β analytical solution of eq. 4] for more information on this method and additional examples of its use.U)=0. O. g F:=-(1/alpha/kˆ2)*Uˆ2*(delta+beta*U). from the above defini- r 2α 2α tions. ># Check that factorization is correct F_chk:=simplify(eval(f[1]*f[2]*U)).t)-alpha*diff(u.tau.pde1. # Some calculations to confirm the results of a # factorization solution. No 3. we deduce that the wavenumber k = . f[2]:=(delta+beta*U)/(alpha*k*a). sol1:=simplify(subs(U=0.c). t) = − 1 − K exp − √ (5. sol2:=solve(eqn3. ># Diffusion equation with nonlinear source terms.U.f[2]): eqn1:=diff(f[1].21).22) β β 2αβ where K is an arbitrary constant. ># Define PZ-1 equation pde1:=diff(u.

shading=Z. Factorization as a method of finding exact invariant solutions of the Kolmogorov- Petrovskii-Piskunov equation and the related Semenov and Zeldovich equations. alpha:=1.. ROMAN.10. animate(zz.t) satisfies pde1: pdeCHK:=simplify(pdetest(sol5.10.axes='framed'. title="Diffusion equation with nonlinear source terms". ROMAN. (1992) 162–167. beta:=1.grid=[100. ROMAN.10. labelfont=[TIMES.xi)-f[1]*U(xi)."u"].frames=100. 16]. 45. thickness=3. >plot3d(zz.axesfont=[TIMES. ROMAN. labels=["x". additional Maple scripts are included with the downloads for this book which obtain other solutions to the diffusion equation with nonlinear terms using tanh-.x=0. ># Fomulate 1st order ode from [D-f[1]]U=0 f[1]:=subs(U=U(xi). 16].M..10.rhs(sol4))). if odeCHK = 0 then print('solution PASSES'). Berkovich. ># Obtain solution to ode2 sol4:=dsolve(ode2).t=0. exp-. else print('solution FAILS!')."u(x. style=patchnogrid. _C1:=1. ># Check solution U(xi) satisfies ode1 odeCHK:=simplify(eval(subs({U(xi)=rhs(sol4)}. References [1] L. labels=["x". LISTING 5. ># Plot results # ============ x0:=0.VERTICAL].HORIZONTAL.. 16])."t". Chapter 5 . zz:=rhs(sol5). 16]). else print('solution FAILS!').axesfont=[TIMES. labeldirections=[HORIZONTAL.axes=framed.100]. 16]. Diffusion Equation with Nonlinear Source Terms 109 a:=sol2[1]. Dokl. and Riccati-based methods. ># Obtain solution to pde1 sol5:=u=simplify(eval(subs({xi=k*(x-c*t)}.symbolic). Sov. 16].14: Maple code to derive a solution to the diffusion equation with nonlinear source terms using the factorization method. titlefont=[TIMES. titlefont=[TIMES. if pdeCHK = 0 then print('solution PASSES'). end if. . ROMAN.size).symbolic).t)"].f[1]). delta:=1. ROMAN. ># Check solution u(x.lhs(ode1))).t=0. labelfont=[TIMES.67]. end if.numpoints=300. Finally. orientation=[-34..pde1).x=0. Math. title="Diffusion equation with nonlinear source terms".ode2:=diff(U(xi).

Theor. [4] H. Zaitsev. Phys. FL. 2010.110 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS [2] O. A Compendium of Partial Differential Equation Models. Cornejo-Perez. last accessed 23 April. Handbook of Nonlinear Partial Differential Equations. Polyanin. [3] A.F. Chapman & Hall/ CRC. H. Rosu.C. Supersymmetric pairing of kinks for polynomial nonlinearities. Griffiths.D. Nonlinear second order ODE: factorizations and particular solutions. Cambridge University Press. http://arxiv. G. [5] W.org/PS cahe/math-ph/pdf/0401/0401040v3. Boca Raton. . Cambridge. Rosu. Progr. Schiesser.E. UK. O. V. 2004.C. 2009. Cornejo-Perez.W.pdf. 114 (3) (2005) 533–538.

First.m is function ut=pde_1(t. . t) = + tanh (3x + t) (6.t).n.00006-6 111 Copyright © 2012 Elsevier Inc.1).1) ∂t ∂x ∂x2 3 with initial condition (IC) 1 1 1 1 2 u(x.1016/B978-0-12-384652-5. 6 Burgers–Huxley Equation We now consider the Burgers–Huxley equation. (6.10 u(1)=ua_1(x(1). ut=ut'.3).n. Traveling Wave Analysis of Partial Differential Equations DOI: 10. end ut(1)=0. % % ux ux=dss004(xl.xu.u) % % Function pde_1 computes the t derivative vector for the Burgers-Huxley % equation % global xl xu x n ncall % % BCs at x = -15. % % PDE for i=2:n-1 ut(i)=-(u(i)ˆ2)*ux(i)+uxx(i)+(2/3)*u(i)ˆ3*(1-u(i)ˆ2). 0) = + tanh x (6. the ODE routine pde 1. we list a few details pertaining to eqns.3) 2 2 9 The Matlab routines closely resemble those of Chapters 2–5. % % uxx uxx=dss004(xl.u).2) 2 2 3 and BCs at x = −15.2). Here. ut(n)=0. 0 ≤ x ≤ 1 (6. . u(n)=ua_1(x(n). All rights reserved. which has a spectrum of applications in nonlinear physics and physiology [5] ∂u ∂u ∂ 2 u 2 3 + u2 − = u (1 − u2 ).ux). t > 0. and (6.xu. (6.t). 10 given by the analytical solution [3] 1 1 1 1 2 u(x.

u) % % Function pde_1 computes the t derivative vector for the Burgers-Huxley % equation % global xl xu x n ncall .1). uxx.ux). (6. The first derivative in eq. so-called stagewise differentiation. % % Increment calls to pde_1 ncall=ncall+1. We can note the following points about pde 1. . the two required BCs are taken from eq. the derivatives in t are set to zero at the boundaries (so that the ODE integrator does not move the boundary values away from their prescribed values). % % PDE for i=2:n-1 ut(i)=-(u(i)ˆ2)*ux(i)+uxx(i)+(2/3)*u(i)ˆ3*(1-u(i)ˆ2).1). (6. respectively (with n=51 subsequently set in function inital 1.xu.1).t). . A transpose is included to meet the requirements of the ODE . ut(n)=0.112 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS % % Increment calls to pde_1 ncall=ncall+1. Equation 6.m: . The second derivative in eq.u). as discussed in Chapter 4.m). (6. LISTING 6. % % BCs at x = -15.2) with x = −15.1 is then programmed. ut=ut'. % % ux ux=dss004(xl. is computed with dss004 by differentiating ux. The alternative would be to use dss044 to directly compute uxx from u.n.10 u(1)=ua_1(x(1). Since eq. is computed using the function dss004. function ut=pde_1(t. u(n)=ua_1(x(n).n. (6.m for eq.t). end ut(1)=0. The function and some global parameters are first defined.xu.n. Since Dirichlet BCs are used. ux.1: Function pde 1. 10 at grid points i=1. (6.1) is second order in x. % % uxx uxx=dss004(xl.

2: Function inital 1.0).0. % % IC from analytical solution for i=1:n x(i)=xl+(i-1)*dx. the counter for the number of calls to pde 1. function u0=inital_1(t0) % % Function inital_1 sets the initial condition for the Burgers- % Huxley equation % global xl xu x n % % Spatial domain and initial condition xl=-15. end As the grid in x is defined in the for loop. end LISTING 6. Finally.2).2). u0(i)=ua_1(x(i). (6.0.0). n=51.m is incremented.m: . % % Spatial domain and initial condition xl=-15. xu= 10. We can note the following points about inital 1.m for IC from eq.2) is programmed in inital 1. dx=(xu-xl)/(n-1). u0(i)=ua_1(x(i). The IC of eq. The grid in x is then defined over the interval −15 ≤ x ≤ 10 for 51 points (these grid parameters were selected by trial and error to produce a numerical solution with acceptable accuracy).m. The function and some global parameters are first defined. dx=(xu-xl)/(n-1). Burgers–Huxley Equation 113 integrator ode15s. Chapter 6 . (6. (6. . % % IC from analytical solution for i=1:n x(i)=xl+(i-1)*dx. xu= 10. function ua 1 (listed next) is called (for t = 0) to define the IC from eq. function u0=inital_1(t0) % % Function inital_1 sets the initial condition for the Burgers- % Huxley equation % global xl xu x n . n=51.

m is a straightforward implementation of the analytical solution. The main program produces the same three figures and tabulated output as in Chapters 2–5 which are now reviewed.1 0 −15 −10 −5 0 5 10 x FIGURE 6. uanal=((1/2)*(1+(expp-expm)/(expp+expm)))ˆ0. The main program.5 0. is similar to pde 1 main Listing 2.m for analytical solution (6.9 0. (6. . eq.8 0.2 0.4 0. 15 (right to left). (6.6 u (x.1 and therefore is not listed here.3 0.3: Function ua 1. LISTING 6.m in Chapters 2–4 and is therefore not reproduced here.1: Numerical solution to eq.5. 5. expm=exp(-(1/3)*x-(1/9)*t).2).114 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Function ua 1. The Jacobian matrix routine jpattern num 1.t) % % Function uanal computes the exact solution of the Burgers-Huxley % equation for comparison with the numerical solution % % Analytical solution expp=exp( (1/3)*x+(1/9)*t). Burgers–Huxley equation 1 0.1) (lines) with the analytical solution superimposed (circles) using five-point FD approximations in dss004 for t = 0.t) 0.7 0. 10. function uanal=ua_1(x. pde 1 main.m is the same as jpattern num 1.3).

Note that the curves move right to left. Figure 6.6 u (x. the individual elements of the Jacobian matrix are distinct.1). that is. the solution appears to be a traveling wave as specified by eq.t) 0. Also. reflects the banded structure of the ODEs produced by dss004. This greater bandwidth is due to the repeated use of dss004 in pde 1. the agreement between the analytical and numerical solutions of approximately five figures is quite acceptable. For t > 0. Burgers–Huxley Equation 115 Burgers−Huxley equation 1 0. The computational effort reflected in ncall = 129 is quite modest.3) in the sense that the successive curves are displaced by a constant distance in t. the velocity is c = −3/9 (the Lagrangian variable is ξ = k(x − ct) = (1/3)(x + 3/9t)).m to compute uxx from u by stage- wise differentiation. is relatively small. Chapter 6 .8 0.4 0. the increase in the bandwidth of the ODE Jacobian matrix through successive calls of the spatial differentiator such as dss004.2 is a 3D plot of the numerical solution. As required. The tabular analytical and numerical solutions also reflect the good agreement between these two solutions. Figure 6. even with only 51 grid points.3. In particular. the analytical and numerical solutions agree for t = 0 (since both solu- tions are from eq.2 0 15 10 10 5 0 t 5 −5 −10 x 0 −15 FIGURE 6. n = 51.2: 3D plot of the numerical solution to eq.2). . Fig. note that the band- width is 9 and not 5 as might be expected from the five-point FDs in dss004. (6. The map of the ODE Jacobian matrix. since from eq.2)). 6. Also. This example illustrates a disadvantage of stagewise differentiation.1 indicates good agreement between the analytical and numerical solutions. since the number of grid points. (6. (6. (6.

456737)/(0.3333 1t 5−0 which compares with the analytical value of c = −3/9 = −0.6503 Similarly.6503) c= = = −0. for t = 5.263%) 0 5 10 15 Semidiscrete equations 20 25 30 35 40 45 50 0 5 10 15 20 25 30 35 40 45 50 Dependent variables FIGURE 6.1.1 can be used to estimate the velocity of the travel- ing wave of Fig.116 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Jacobian sparsity pattern – nonzeros 423 (16.3168 Thus. t = 0) = 0.1 at t = 0. the estimated velocity (of the value u(x.5) is 1x −3.5 gives x = −3. .0)(0. For example. The numerical solution of Table 6.477017)/(0.3168 − (−1.539758 − 0. For u(x. x = −2. linear interpolation to determine x for u(x. the value of x can be estimated by linear interpolation within the solution values of Table 6.0 + 3. t = 5) = 0.3333 (as discussed previously).477017) = −3. t) = 0.5 + 2.0 + (−1. t) = 0.518596 − 0.5 + (−3.5)(0.5.5 for t = 0 and t = 5.5 − 0. we can determine the distance (in x) between the two solution values u(x.456737) = −1. 6.3: Jacobian matrix map of the MOL ODEs for n = 51.5 − 0.

.500 0.000000 0.013872 0. .000 0. . .00 −13. .999207 0.009403 0.500 0.00 9.000000 0.000000 0.998275 0.000041 5.000000 5. Burgers–Huxley Equation 117 Table 6.998275 0.999708 0.500 0. .999431 0.999708 0.000019 .00 −1.000000 . . i) u anal (it.646088 0.000 0.000 0. .417432 0.00 −2.007960 0.500 0. .00 10.000 0.000 0. 5.999113 0. .00 −14.000 0.000000 5.500 0.019358 0.007960 0.603802 −0.00 9.013123 0.000 0.666837 −0.500 0.997595 0.999206 0. .00 −14.500 0.00 −4.006738 0.00 9. .00 10.00 8. .518596 0.000000 5.000000 5.00 −14.998763 0.456737 0.000 0. . .000000 0. 0.022867 0.000000 0.1: Tabular numerical and analytical solutions t x u (it.539758 −0.000 0.011743 0.00 8. . i) err (it.00 −3. 15 removed .000000 0.00 −2.500 0.456737 0. . i) 5.00 −1.011743 0.00 −14.000000 5.000000 5.00 −13.000 0. . ncall=129 .000000 0.000 0.016387 −0. .000000 5.000000 t x u (it. i) 0.000 0. Chapter 6 .997595 0.646088 0.00 −13.539705 0.00 8.666818 0.011108 0.013123 0.000000 0.019358 0.00 −0.000000 .500 0.011108 0. 0. .00 −15.603761 0.013872 0.00 0.707107 0.009403 0.500 0.999791 0.998763 0.500 0. i) u anal (it.00 9.000 0.000043 5.00 −13. .000000 0. i) err (it.582446 0.00 −2.000 0.999592 0.000053 5.000000 5.582446 0.500 0.999593 0.000000 0. .999364 0.707107 0. .476965 0.999431 0.00 −2.00 −3.000000 0.022868 0.000 0.999364 0.00 −15. .417475 −0.999113 0.398584 0. .999791 0.000000 .518596 0. .477017 −0.000053 5.000 0.000000 . .006738 0. .00 8.500 0. output for t=10.000000 0.398584 0.000000 0. .016387 0.000 0. . 5.000 0.

2) (with t = 0) and two Dirichlet BCs from eq.m (Listing 6. Consequently.6). 10) is straightforward. (6. From eqns. yet the programming in pde 1. We will apply the factorization method to eq. (6. we have β −a + a−1 − aδ − α U δ + β a − γ a−1 + c = 0 hp i hp i (6. as outlined in the main Appendix.8) . we obtain the following ODE √ √ √ df1 β δ β β 1 1 − U δ + a−1 U δ − γ = −g (U) = − c − αU δ U + f1 + f2 = −aδ U +a (6. and γ = 0. (6. Uδ − γ f1 (U) = a f2 (U) = a−1 (6.4) reduces to eq. (6. This converts the PDE to the following ODE.1) is straightforward.1) is nonlinear. and start by applying the traveling wave transformation u(x. ξ = k(x − ct).41) and (6. the solution of eq. t) = U(ξ ).4). eq.4) ∂t ∂x ∂x When α = 1.1) subject to the IC from eq. (6. (6. u = u(x. t). we factorize F(U) as F(U) β = f1 f2 = 2 1 − U δ U δ − γ U k and choose √ √ β β 1 − Uδ . β = 2/3. Also.6) k k where we have also introduced the constant a to be determined later. t ≥ 0 (6. δ = 2.5) dξ 2 dξ 1 β c − αU δ and F(U) = 2 U 1 − U δ U δ − γ . eq. (6. (A. variations in the PDE can easily be made for cases for which an analytical solution might not be available.118 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS In summary. where g(U) = k k In order to proceed with this method.7) dU k k k k Rearranging and collecting terms. d2 U dU + g(U) + F(U) = 0 (6.1).2) (with x = −15. Appendix We conclude this chapter with an analysis of the generalized Burgers–Huxley equation which has the following form [5] ∂u ∂u ∂ 2 u + αuδ − 2 = βu 1 − uδ uδ − γ .

e.9) is compatible with the first-order ODE dξ √ dU β 1 − Uδ U = 0 ∓a (6. and γ = 0.14) 3 9 2 2 3 9 −1/2 1/2 4 4 1 1 2 2 u2 (x. i.13) 3k Finally. we are able to equate each of the terms within square brackets to zero.11) yields a general solution of the form √ −1/δ = 1 ± K exp − a βδ/k ξ U ! #)−1/δ (6.40b). t).9) dξ k dξ Thus.39) of main Appendix). t) = 1 + exp − x+ t = + tanh x+ t (6.. (6.12) ( " p −α ± α 2 + 4β (1 + δ) = 1 ± K exp − δξ 2 (1 + δ) k where K is an arbitrary constant. Using the same values for constants as in the numerical simulation..11) dξ k Integrating eq. (6. Chapter 6 . 4]. D − f2 (U) D − f1 (U) U = 0 (see eq. eq. i. ξ = k(x − ct) yields the solutions −1/2 1/2 2 2 1 1 1 1 u1 (x.. the corresponding factorization of eq. δ = 2. setting K = +1 and applying the inverse transformation U(ξ ) = u(x.e.10) k k d where D = . it follows that eq. from which it follows that d2 U 1 p h i dU β a − γ a−1 − a (1 + δ) − a−1 U δ 2 + + f1 f2 U = 0 (6. yielding p p −α ± α 2 + 4β (1 + δ) c = − β a − γ a−1 . we obtain −1/2 −1 ± 3 U = 1 ± K exp − ξ (6. Burgers–Huxley Equation 119 Now. (A. (A. for consistency. (6.e.5). β = 2/3.15) 3 9 2 2 3 9 . i. because U is a variable. Therefore. a= √ 2 β (1 + δ) We now adopt the grouping of Cornejo-Perez [2. α = 1. t) = 1 + exp + x+ t = − tanh x+ t (6. becomes √ √ β β D − a−1 Uδ − γ D−a 1 − Uδ U = 0 (6.

Progress of Theoretical # Physics.eqn1).U)*U+f[1]+f[2]=-subs(U(xi)=U.U]). For all solu- tions.g). that is used in the main body of this chap- ter for the numerical simulation. for example. C.3).4. Readers are referred to the papers by Berkovich [1] and Cornejo-Perez and Rosu [2. This is left as an exercise for the reader. t = 0). sol1:=simplify(subs(U=0. 4] for more information on this method and additional examples of its use. # Nonlinear second order ODE: Factorizations and # particular solutions. vol 114. ># Check that factorization is correct F_chk:=simplify(eval(f[1]*f[2]*U)). ># Factor F(U)/U .pde1.[xi. t) = 1 − exp + x+ t = − coth x+ t (6. g F:=(beta/kˆ2)*U*(1-Uˆdelta)*(Uˆdelta-gamma).f[1]):f[2]:=subs(U(xi)=U.t)): alias(U=U(xi)): ># Define PDE equation pde1:=diff(u. and H. . Rosu (2005). (6. ># Use the C-P grouping alias(U=U):f[1]:=subs(U(xi)=U. the wavenumber k is equal to 1/3 and for solutions u2 and u4 . setting K = −1 yields the solutions −1/2 1/2 2 2 1 1 1 1 u3 (x.f[2]): eqn1:=diff(f[1]. ode1:=dchange(tr1. By inspection. the wave velocity c is equal to −1/3. we see that for solutions u1 and u3 .16) 3 9 2 2 3 9 −1/2 1/2 4 4 1 1 2 2 u4 (x.t=tau.17) 3 9 2 2 3 9 Solution u1 is the same solution. with(DEtools): with(PDEtools): with(plots): unprotect(gamma): alias(u=u(x. eq.t)+alpha*uˆdelta*diff(u.tau. No 3. (6. pp 533-538 >restart. ># Convert PDE to ODE tr1:={x=(xi/k+c*tau). ># Define F(U). A Maple script that derives these solutions is given in Listing 6. eq.Note: 'a' introduced f[1]:=a*sqrt(beta)*(1-Uˆdelta)/k. c:=solve(sol1. O.x)-diff(u.size).c).120 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Alternatively.x) -beta*u*(1-uˆdelta)*(uˆdelta-gamma)=0. it is equal to 2/3. Additional solutions can be found by choosing different factorizations of eq.u=U}.10) could be changed to √ √ β β D − a−1 1 − Uδ D−a Uδ − γ U = 0 k k and the same procedure followed. # Some calculations to confirm the results of a # factorization solution to the Burgers-Huxley Equation # Ref: Cornejo-Perez.x.5). f[2]:=(1/a)*sqrt(beta)*(Uˆdelta-gamma)/k. t) = 1 − exp − x+ t = + coth x+ t (6. Note: solutions u3 and u4 have singularities at (x = 0. g:=(1/k)*(c-alpha*Uˆdelta). (6.

exp-. Burgers–Huxley Equation 121 ># Collect terms in U eqn2:=collect(simplify(lhs(eqn1)-rhs(eqn1).x=-20. zz:=simplify(eval(rhs(sol5))).. additional Maple scripts are included with the downloads for this book that solve the Burgers–Huxley equation using tanh-. 16]).beta:=2/3. thickness=3.x=-20. Berkovich.symbolic). else print('solution FAILS!'). style=patchnogrid. ># Obtain solution to pde1 sol5:=u=simplify(eval(subs({xi=k*(x+x0-c*t)}.numpoints=100.grid=[100.68]. a:=sol2[1]. Finally.xi)-f[1]*U(xi).. ># Check solution u(x. ># Equate coeff of U to zero eqn3:=coeff(eqn2. Sov. title="Burgers-Huxley Equation").a).4: Maple code to derive a solution to the Burgers–Huxley equation using the factorization method.HORIZONTAL. ># Plot results # ============ x0:=0. .axesfont=[TIMES.. if pdeCHK = 0 then print('solution PASSES'). sol2:=solve(eqn3."t". 16]. Chapter 6 .pde1). _C1:=1.gamma:=0.10. 16]. and Riccati-based methods. orientation=[-122. ROMAN. if odeCHK = 0 then print('solution PASSES').lhs(ode1))). end if. labeldirections=[HORIZONTAL. ROMAN.30. LISTING 6.Uˆdelta)=0.'recursive'). shading=Z. labels=["x".size). Math.frames=50. animate(zz. end if.symbolic).title="Burgers-Huxley Equation".t)"]."u(x.t=0.size).M. ># Obtain solution to ode2 sol4:=dsolve(ode2). ROMAN. ># Fomulate 1st order ode from [D-f[1]]U=0 f[1]:=subs(U=U(xi).delta:=2. labelfont=[TIMES.alpha:=1.100].axes=framed. ># Check solution U(xi) satisfies ode1 odeCHK:=simplify(eval(subs({U(xi)=rhs(sol4)}.U.t) satisfies pde1: pdeCHK:=simplify(pdetest(sol5..ode2:=diff(U(xi). 45 (1992) 162–167. titlefont=[TIMES.VERTICAL]. Dokl.t=0.30. Factorization as a method of finding exact invariant solutions of the Kolmogorov- Petrovskii-Piskunov equation and the related Semenov and Zeldovich equations.10. >plot3d(zz.axes='framed'. else print('solution FAILS!'). References [1] L.rhs(sol4))).f[1]).

S. Prog.Y.C. 114 (3) (2005) 533–538. Solitary wave solutions of the generalized Burgers-Huxley equation. http://arxiv. Cornejo-Perez.K. Nonlinear Anal. Lu. last accessed 23 April. Zhu. [3] A.pdf. Rosu. 2010. Supersymmetric pairing of kinks for polynomial nonlinearities. [5] X. Y. Cornejo-Perez. World Appl. J. Molabahrami. Wang. Rosu. Khani. 10 (2) (2009) 589–600.122 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS [2] O. 23 (1990) 271–274. R. F. Nonlinear second order ODE: Factorizations and particular solutions. Phys. H. A: Math. . Gen. Theor. Phys.C.. Z. [4] H. O.org/PS cache/math-ph/pdf/0401/0401040v3. The homotopy analysis method to solve the Burgers-Huxley equation.

t) = 1 − tanh x− t (7.n. we list a few details pertaining to eqns.1) ∂t ∂x ∂x2 with an initial condition (IC) and two boundary conditions (BCs) at x = −10. is function ut=pde_1(t.ux).t). ut(n)=0. First. . (7.1016/B978-0-12-384652-5. All rights reserved. 7 Burgers–Fisher Equation We consider the Burgers–Fisher equation.m for eq. % % ux ux=dss004(xl. ut=ut'. .1: Function pde 1.u) % % Function pde_1 computes the t derivative vector for the Burgers-Fisher % equation % global xl xu x n ncall % % BCs at x = -10. % % uxx uxx=dss004(xl.00007-8 123 Copyright © 2012 Elsevier Inc. Traveling Wave Analysis of Partial Differential Equations DOI: 10. which has applications principally in biology [1] ∂u ∂u ∂ 2 u + u2 − = u(1 − u2 ).1) and (7. u(n)=ua_1(x(n).xu. % % PDE for i=2:n-1 ut(i)=-(u(i)ˆ2)*ux(i)+uxx(i)+u(i)*(1-u(i)ˆ2).m. 10 given by the analytical solution [1] 1 1 1 10 2 u(x. end ut(1)=0.10 u(1)=ua_1(x(1). LISTING 7.2).2) 2 3 9 The Matlab routines closely resemble those of Chapters 3–6. Here. the ODE routine pde 1. t>0 (7.1).t). (7. % % Increment calls to pde_1 ncall=ncall+1.xu.u).n.

(7. ux=dss004(xl. % % PDE for i=2:n-1 ut(i)=-(u(i)ˆ2)*ux(i)+uxx(i)+u(i)*(1-u(i)ˆ2).u).1) is second order in x. % % ux ux=dss004(xl.t).2) with x = −10. .n.u).xu.t). respectively (with n=51 subsequently set in function inital 1. The first derivative in eq. The alternative would be to use dss044 to directly compute uxx from u. The function and some global parameters are first defined. end ut(1)=0. . ut(n)=0. (7.2) with t = 0 is programmed in inital 1. % % uxx uxx=dss004(xl.1). 10 at grid points i=1. so-called stagewise differentiation.ux). A transpose is included to meet the requirements of the ODE integrator ode15s. is computed with dss004 by differentiating ux.m is incremented.n. The second derivative in eq. Since Dirichlet BCs are used. % % BCs at x = -10. u(n)=ua_1(x(n).m). % % Increment calls to pde_1 ncall=ncall+1. The IC from eq.n.m. Since eq. uxx. is computed using the function dss004.1) is then programmed.124 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS We can note the following points about pde 1. the counter for the number of calls to pde 1. Equation (7. . the two required BCs are taken from eq.1). ut=ut'. (7.xu. (7.m: . the derivatives in t are set to zero at the boundaries (so that the ODE integrator does not move the boundary values away from their prescribed values). (7.n. as discussed in Chapter 4.10 u(1)=ua_1(x(1).xu. Finally. % % Function pde_1 computes the t derivative vector for the Burgers-Fisher % equation % global xl xu x n ncall . ux.

0. function uanal=ua_1(x.0). (7. We can note the following points about inital 1. Chapter 7 .2) with t = 0.2). dx=(xu-xl)/(n-1). u0(i)=ua_1(x(i).0.m from (7. % % IC from analytical solution for i=1:n x(i)=xl+(i-1)*dx. end As the grid in x is defined in the for loop. The grid in x is then defined over the interval −10 ≤ x ≤ 10 for 51 points. eq.t) % % Function uanal computes the exact solution of the Burgers-Fisher . u0(i)=ua_1(x(i).m is a straightforward implementation of the analytical solution. end LISTING 7. The function and some global parameters are first defined. n=51.2: Function inital 1. xu= 10. function ua 1 (listed next) is called (for t = 0) to define the IC from eq. % % IC from analytical solution for i=1:n x(i)=xl+(i-1)*dx. (7. Burgers–Fisher Equation 125 function u0=inital_1(t0) % % Function inital_1 sets the initial condition for the Burgers- % Fisher equation % global xl xu x n % % Spatial domain and initial condition xl=-10. xu= 10. n=51.2) Function ua 1. dx=(xu-xl)/(n-1).0).m: . function u0=inital_1(t0) % % Function inital_1 sets the initial condition for the Burgers- % Fisher equation % global xl xu x n . % % Spatial domain and initial condition xl=-10.

The main program.5. Figure 7. expm=exp(-(1/3)*x+(10/9)*t). 2.1 and therefore is not listed here. Also. is essentially the same as pde 1 main of Listing 2.2 0.1 0 −10 −8 −6 −4 −2 0 2 4 6 8 10 x FIGURE 7. 4 (left to right).8 0.2) in the sense that the successive curves should be displaced by a constant distance in t. this apparent discrepancy is due to the termination of the plot on the right at Burgers–Fisher equation 1 0.m for analytical solution (7. uanal=((1/2)*(1-(expp-expm)/(expp+expm)))ˆ0. (7.6 u (x. the solution does not appear to be exactly a traveling wave as specified by eq.1: Numerical solution to eq.t) 0.1) (lines) with the analytical solution superimposed (circles) using five-point FD approximations in dss004 for t = 0. The main program produces the same three figures and tabu- lated output as in Chapters 2–6. .m in Chapters 2–6 and is therefore not reproduced here.m is the same as jpattern num 1.5 0. Also.3: Function ua 1.2).3 0. 3.4 0. (7.7 0.126 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS % equation for comparison with the numerical solution % % Analytical solution expp=exp( (1/3)*x-(10/9)*t). 1. LISTING 7. pde 1 main. which are now reviewed. However. the Jacobian matrix routine jpattern num 1.9 0.1 indicates good agreement between the analytical and numerical solutions.

The tabular analytical and numerical solutions of Table 7.2 is a 3D plot of the numerical solution.3. the analytical and numerical solutions agree for t = 0 (since both solutions are from eq.2 0 4 3 10 2 5 t 0 1 x −5 0 −10 FIGURE 7. (7. that is. This greater bandwidth is due to the repeated use of dss004 in pde 1. In particular. (7.m to compute uxx from u by stage- wise differentiation. since the number of grid points.2: 3D plot of the numerical solution to eq. that is. The map of the ODE Jacobian matrix.1 also reflect the good agree- ment between these two solutions (see Table 7. 10 for the BCs is straightforward. note that the band- width is 9 and not 5 as might be expected from the five-point FDs in dss004. the increase in the bandwidth of the ODE Jacobian matrix through successive calls of the spatial differentiator such as dss004.4 0. Figure 7. the agreement between the analytical and numerical solutions of approximately five figures is quite acceptable. Burgers–Fisher Equation 127 x = 10 (if the plot was extended beyond x = 10. is relatively small. the solution of eq. the traveling wave characteristic.1) subject to the IC and two BCs from eq.2) with t = 0).1). would be apparent).t) 0. particularly since the Burgers–Fisher equation 1 0. In summary. even with only 51 grid points. 7. The computational effort reflected in ncall = 190 is quite modest. displacement along the x axis without changing shape. Also.2) with t = 0 for the IC and x = −10. reflects the banded structure of the ODEs produced by dss004. (7. Chapter 7 . This example illustrates a disadvantage of stagewise differentiation. Fig. n = 51. As required. .1). the individual elements of the Jacobian matrix are distinct.8 0. For t > 0.6 u (x. (7.

t) − 2 v (x.3: Jacobian matrix map of the MOL ODEs for n = 51. (7. we shall show that by applying certain transformations. it will yield a rather simple solution.128 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Jacobian sparsity pattern – nonzeros 423 (16. t) 1 − v (x. In fact. t)s = 0 (7. Consequently. t) + pv (x. and Riccati methods all fail on this equation in its current form. exp. Appendix We conclude this chapter by outlining an approach to solving the generalized Burgers– Fisher equation ∂ ∂ ∂2 v (x. the tanh.263%) 0 5 10 15 Semidiscrete equations 20 25 30 35 40 45 50 0 5 10 15 20 25 30 35 40 45 50 Dependent variables FIGURE 7. eq. variations in the PDE can easily be made for cases for which an analytical solution might not be available. t)s v (x.1) is nonlinear. solution is quite smooth.m is straightforward. However. . Also. this appears to be a rather daunting equation for which we have to find an analytical traveling wave solution. yet the programming in pde 1. t) − qv (x.3) ∂t ∂x ∂x On first sight.

00 −8.999931 0.981858 −0.997595 0.200 0.999910 0.999800 0.000004 1.000000 0.00 1.600 0.918737 0.000000 0. .00 8.573893 −0.000000 0.00 −1.000002 1.997595 0.000000 t x u (it. .035651 0.000000 0.00 4.00 2.918740 0. .000001 1.000001 1.986015 0.897600 0.999882 0.522813 −0.600 0.00 −2.949857 0.998156 0.00 0. Burgers–Fisher Equation 129 Table 7.046526 0.800 0.000 0.400 0.800 0.00 1.200 0.000000 0.600 0.040728 0.991725 −0.00 0.000 0.872080 0.766788 −0.897604 0.800 0.00 −8.200 0.00 −8.000002 1.625046 −0.00 10.400 0.806677 0.400 0.991724 0.000004 1.400 0.976508 −0. Chapter 7 .675029 0.00 3.200 0.999364 0.000 0.200 0.986016 −0. i) u anal (it.000001 1.998917 0.000000 1.069316 0.00 9.000000 1.999170 0.00 −2.00 −9.999739 0.00 0.000000 0.00 −8.872084 0.999931 0.998156 0. i) 0.046526 0.600 0.000001 1.806675 0.999910 0.00 4. .989236 0. .000000 1.00 −8.060698 0.999882 0.00 −9.000001 1.000004 1.999364 0.722636 0.841824 0.00 −9.00 4.00 −9.000000 1.053144 0.000007 1.999800 0.600 0.040728 0.800 0.998917 0.000000 0. .00 −10. .999739 0.841820 0.960916 −0.400 0.000001 1.00 −10.989237 −0.00 8.000006 1.969652 0.625038 0.949857 0.000000 0.999170 0.800 0.998587 0.000 0.000 0.200 0.00 −2.935976 0.960916 0.00 −8.000003 1.00 9.000001 1.069316 0.000000 1.000001 1.053144 0.060698 0. 1.000000 0. .00 3.000 0.000000 . i) u anal (it.969653 −0. .976507 0. .1: Tabular numerical and analytical solutions t x u (it.000000 1.400 0.722639 −0.400 0.675035 −0. i) 1.600 0.000 0.800 0.800 0.000 0.573886 0. 0.000000 0.000 0.000000 1.00 −0. i) err (it. i) err (it.035651 0.522808 0.998587 0.00 2.00 2.00 8.999847 0.000000 .00 −0.981857 0.00 −1.000004 (Continued ) .935977 0.800 0.999847 0.000007 1.000 0.400 0.766788 0.

181651 0.000 0.000004 1.159594 0.000004 1. 3.000001 1.000 0.00 8. Eliminating the denominators by cross- multiplication. we have written u for u(x.000001 1.140092 0. output for t = 2.380238 0.181655 0.000005 1.600 0.206522 0.200 0.800 0.00 10.200 0.00 5.200 0. 4 removed .000002 1.000002 1. .206526 0.338553 0.130 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 7.000 0.107737 0. .265673 0. for brevity. .140091 0.000002 1.000005 1.472929 0. which yields the following traveling wave solution.472931 −0. .122887 0. dividing by the common factor u1/s .300350 0.00 7.234460 0.00 6. i) err (it.122886 0.300345 0. . . " # 1 1 s −xp − xps + tp2 + tqs2 + tq + 2tqs u = + tanh 2 2 2 (1 + s)2 .159596 0.800 0.00 9.338548 0.234455 0. and collecting like terms yields the much simpler form 2 ∂ ∂2 ∂ ∂ su − su 2 u + (s − 1) u + psu2 u − qs2 u2 (1 − u) = 0 ∂t ∂x ∂x ∂x We are now able to apply the tanh method. .00 7.000000 .265679 0.000003 1. .600 0.400 0. ncall=190 We start by introducing the following new variable v(x.00 6.00 9.000006 1. .425175 0.1: (Continued ) t x u (it.400 0. t). t) = u(x.00 8.00 5.000005 1.00 8. i) u anal (it.380234 0.600 0.107737 0.00 6. i) 1. t)1/s from which we obtain s 2 2 u1/s ∂ p u1/s u1/s ∂ u1/s ∂ u1/s ∂ 2 u1/s ∂ h s i u+ u− 2 2 u − u + u − qu1/s 1 − u1/s =0 su ∂t su ∂x s u ∂x su ∂x 2 su2 ∂x where. .425177 0.

4) does indeed satisfy eq.5) 2 3 3 From eq.4 and 7. Using the Maple procedure pdetest(). Finally. s 1 1 10 v= 1 − tanh x− t (7.4) 2 2 (1 + s)2 which is a solution to the generalized Burgers–Fisher equation (7.2). (7.4: 2D plot of the solution to Burgers–Fisher equation at t = 0. Figure 7. Chapter 7 . (7. we obtain v " # s −xp − xps + tp2 + tqs2 + tq + 2tqs u 1u v= t 1 + tanh (7.5: 3D plot of the solution to Burgers–Fisher equation.t) 0. by applying the inverse transformation v = u.2 0 0 10 20 30 40 50 60 x FIGURE 7. (7.4). which then moves left to right when the animation (see 1 0.4 0.6 v 0. 2D and 3D plots of this solution are given in Figs. we arrive at the solution given in eq. we see that the wavenumber is equal to k = 1/3 and the wave velocity is equal to c = 10/3. 1 0.3).8 0.6 v(x. sub- stituting the values p = 1. and s = 2 into eq. we confirm that eq.e.8 0. . 7.4 is the initial condition (at t = 0). i.5.4 0..2 −10 10 0 8 10 20 6 x 30 4 t 40 2 50 60 0 FIGURE 7.3). (7.5). (7. q = 1. Burgers–Fisher Equation 131 √ Then.

"v"]. with(PDEtools): with(PolynomialTools): with(plots): ># Set up alias alias(u=u(x. .t)): ># Define generalized B-F pde pde0:=diff(v.x)}).10. ROMAN.s:=2.title="Burgers-Fisher Equation". end if. 16]. tanhMethod(M.5 is a 3D plot that demonstrates the movement of the solution through x and t.grid=[100.p:=1. # Solve transformed equation intFlg:=0: # No integration of U(xi) needed ! M:=1.60. ROMAN.. axes=framed. t=0.VERTICAL]. shading=Z. ># Set parameter values #p:=1. 16]. labelfont=[TIMES.axesfont=[TIMES.x. 16]).numpoints=100.infoLevOut).x0:=0.t=0. else print("pdetest(): FAILED").4. if testSol=0 then print("pdetest(): PASSED").intFlg. titlefont=[TIMES.x=-10.x..HORIZONTAL..axesfont=[TIMES.pde1. thickness=3. ROMAN. 16]."t".60. testSol:=pdetest(soln. A Maple script that performs the calculations for Figs. labels=["x". 16]). animate(zz. title="Burgers-Fisher Equation".x0:=0.{diff(u.pde0. Figure 7. ># Test Solution (May take a long time!) s:=2. ROMAN. ># Animate the solution zz:=rhs(soln).3 and 7. 7. ># Generate a 3D surface plot of standard solution plot3d(zz.axesfont=[TIMES. ># Divide through by uˆ1/s pde1:=simplify(pde1/(uˆ(1/s)). ># Burgers-Fisher Equation # Attempt at Malfliet's tanh solution restart.q:=1. LISTING 7. labels=["x".q:=1.pde0). style=patchnogrid.t)"].axes=framed.x)-q*v*(1-vˆs)=0.[u]). # Set order of approximation infoLevOut:=0.4) is activated. ># Apply a transformation tr0:={v=uˆ(1/s)}.x)."v(x. labeldirections=[HORIZONTAL. 16].symbolic): pde1:=collect(pde1.4 is given in Listing 7. orientation=[-45.diff(u. ROMAN. soln:=v=sqrt(rhs(sol[4])). ROMAN. labelfont=[TIMES.53].x)-diff(v.. >read("tanhMethod.diff(u.100].4: Maple code used to confirm correctness of analytical solutions to the generalized Burgers–Fisher equation.132 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Listing 7. ROMAN. 16].frames=50.t)): alias(v=v(x. pde1 := numer(lhs(pde1))*denom(rhs(pde1)) = numer(rhs(pde1))*denom(lhs(pde1)).x=-10. titlefont=[TIMES.t)+p*vˆs*diff(v.10. pde1:=dchange(tr0.txt"). title="Burgers-Fisher Equation".t).

Reference [1] A.and Riccati-based methods are included with the downloads for this book. . Chapter 7 . Khani. R. Nonlinear Anal. F. Molabahrami. World Appl. Burgers–Fisher Equation 133 Additional Maple scripts that find traveling wave solutions to the Burgers–Fisher equa- tion using exp. The homotopy analysis method to solve the Burgers-Huxley equation. 10 (2) (2009) 589–600.

the ODE routine pde 1.1) ∂t ∂x with the analytical solution 1 u(x. t) = . is ∂u ∂ 2 u = 2 + u(1 − uq ).6) as suggested in [3]. with applications in biology [3].1)–(8.u).xu.n.m is function ut=pde_1(t.10 u(1)=ua_1(x(1).3) q q b= (8. Here. . 8 Fisher–Kolmogorov Equation The Fisher–Kolmogorov equation. q>0 (8. % . (8.t). All rights reserved.6). Traveling Wave Analysis of Partial Differential Equations DOI: 10.2) (1 + aebξ )s where 2 s= (8. although a is arbitrary. u(n)=ua_1(x(n). The Matlab routines closely resemble those of Chapters 3 and 7.t).00008-X 135 Copyright © 2012 Elsevier Inc. ξ = x − ct (8. % % ux ux=dss004(xl. First.5) [2(q + 2)]1/2 We take √ a= 2−1 (8.4) [2(q + 2)]1/2 q+4 c= (8.u) % % Function pde_1 computes the t derivative vector for the Fisher- % Kolmogorov equation % global xl xu x n ncall % % Model parameters global a b c s q % % BCs at x = -5. we list a few details pertaining to eqns.1016/B978-0-12-384652-5.

u). (8.xu. as discussed in Chapter 4.ux). Since eq. % % uxx uxx=dss004(xl. . % % PDE for i=2:n-1 . Equation (8. is computed using the function dss004. % % BCs at x = -5.m: . end ut(1)=0. % % PDE for i=2:n-1 ut(i)=uxx(i)+u(i)*(1-u(i)ˆq). ux.n.1) is then programmed.136 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS % uxx uxx=dss004(xl. u(n)=ua_1(x(n).1) is second order in x.u) % % Function pde_1 computes the t derivative vector for the Fisher- % Kolmogorov equation % global xl xu x n ncall % % Model parameters global a b c s q . function ut=pde_1(t. . (8. The alternative would be to use dss044 to directly compute uxx from u. The first derivative in eq.1). % % ux ux=dss004(xl.xu. The second derivative in eq.m for eq.n.10 u(1)=ua_1(x(1). uxx. respectively (with n=51 subsequently set in function inital 1. 10 at grid points i=1. (8. is computed with dss004 by differentiating ux.t). We can note the following points about pde 1.2) with x = −5. (8.t).m). ut(n)=0. % % Increment calls to pde_1 ncall=ncall+1.n. so-called stagewise differentiation.ux). The function and some global parameters are first defined. (8.n.1). LISTING 8. the two required BCs are taken from eq.1: Function pde 1.xu. ut=ut'.1).

The function and some global parameters are first defined. end ut(1)=0.m: .2) is programmed in inital 1. The IC from eq. Since Dirichlet BCs are used. the counter for the number of calls to pde 1. xu=10.0). the derivatives in t are set to zero at the boundaries (so that the ODE integrator does not move the boundary values away from their prescribed values). function u0=inital_1(t0) % % Function inital_1 sets the initial condition for the Fisher- % Kolmogorov equation % % Parameters shared with other routines global xl xu x n ncall % % Model parameters global a b c s q % % Spatial domain and initial condition xl=-5. end LISTING 8.0.2).m. ut(n)=0. A transpose is included to meet the requirements of the ODE integrator ode15s. dx=(xu-xl)/(n-1). u0(i)=ua_1(x(i). Fisher–Kolmogorov Equation 137 ut(i)=uxx(i)+u(i)*(1-u(i)ˆq). % % IC from analytical solution for i=1:n x(i)=xl+(i-1)*dx.m is incremented. n=51. Finally.2: Function inital 1. Chapter 8 . We can note the following points about inital 1. (8. % % Increment calls to pde_1 ncall=ncall+1. ut=ut'.m for IC from eq. function u0=inital_1(t0) % % Function inital_1 sets the initial condition for the Fisher- % Kolmogorov equation % % Parameters shared with other routines global xl xu x n ncall % % Model parameters global a b c s q . (8.

end As the grid in x is defined in the for loop. Function ua 1. . function ua 1 (listed next) is called (for t = 0) to define the IC from eq. pde 1 main. (8. . xu=10.2). is similar to pde 1 main of Listing 2.m for analytical solution (8. b=q/(2*(q+2))ˆ(1/2).138 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS .2). dx=(xu-xl)/(n-1). function uanal=ua_1(x. . c=(q+4)/(2*(q+2))ˆ(1/2). The grid in x is then defined over the interval −5 ≤ x ≤ 10 for 51 points (these grid parameters were selected by trial and error to produce a numerical solution with acceptable accuracy). . (8. The main program.m is a straightforward implementation of the analytical solution. n=51.0. % % IC from analytical solution for i=1:n x(i)=xl+(i-1)*dx.0).3: Function ua 1. u0(i)=ua_1(x(i). . . % % Model parameters global a b c s q % q=1. LISTING 8. . uanal=1/(1+a*exp(b*z))ˆs. s=2/q. eq. % % Spatial domain and initial condition xl=-5.t) % % Function uanal computes the exact solution of the Fisher-Kolmogorov % equation for comparison with the numerical solution % % Model parameters global a b c s q % % Analytical solution z=x-c*t.1 and therefore we list only a few selected parts of it. a=2ˆ(1/2)-1.2).

3)–(8.ncall).. These constants and parameters are then passed as global variables (not shown) so that they can be used in pde 1.6f\n'. Chapter 8 . In particular.i)) and their difference (err) are displayed at the output points (t = 0.m. note that the band- width is 9 and not 5 as might be expected from the five-point FDs in dss004. n = 51. reflects the banded structure of the ODEs produced by dss004. Fig. since the number of grid points. Fisher–Kolmogorov Equation 139 % % Display selected output fprintf('\n q = %4. The parameter q in eq. for i=1:n fprintf('%6.2f%8.i)). ξ = x − ct). LISTING 8. This example illustrates a disadvantage of stagewise differentiation. .1 and ua 1. .6f%15.a. would be apparent).5. c. that is.2) is computed for subsequent use in analyzing the numerical solution (note the Lagrangian or traveling wave or moving coordinate of eq. u anal(it. . This greater bandwidth is due to the repeated use of dss004 in pde 1. 0. the solution does not appear to be exactly a traveling wave as specified by eq.. and the parameters a. (8. 8. Also. and the numerical and analytical solutions (u(it. end end fprintf(' ncall = %4d\n\n'.2f\n'.2 is a 3D plot of the numerical solution.m is the same as jpattern num 1. (8. Also.m of Listing 8. The Jacobian matrix routine jpattern num 1. that is. t(it). c = %4.i). displacement along the x axis without changing shape.2f. We can note the following points about this code: . Figure 8. the traveling wave characteristic.3. In particular. . the wave velocity c of eq. s of eqns.i).u_anal(it.2f s = 4.i).2f.s). .i)\n'). this apparent discrepancy is due to the termination of the plot on the right at x = 10 (if the plot was extended beyond x = 10.3.m of Listing 8.m in Chapters 3–7 and is therefore not reproduced here. is relatively small. .1 indicates good agreement between the analytical and numerical solutions.i) u_anal(it. which are now reviewed. These parameters are then displayed. (8. The map of the ODE Jacobian matrix. The main program produces the same three figures and tabulated output as in Chap- ters 3–7.2f.i) err(it.. the increase in the bandwidth of the ODE Jacobian matrix through successive calls of the spatial differentiator such as dss004.6f%15.q. a = %4. 5 or 11 values) through the for it=1:nout loop (with nout=11). . for it=1:nout fprintf('\n t x u(it.2) in the sense that the successive curves should be displaced by a constant distance in t. . .m to compute uxx from u by stage- wise differentiation.1) is first defined.4: A selected portion of main program pde 1 main.u(it. 1.b. b = %4.3f%15.err(it.c.x(i).6) are then computed. (8. Figure 8. the individual elements of the Jacobian matrix are distinct. . However. (8. b.2).

the low number of grid points worked in our favor.1.8 0. this is not always the case.5.5 − 0. see Table 8.m with x = t = 0). but.1 0 −5 0 5 10 x FIGURE 8.9)(0. 1.2 − 1.140 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Fisher–Kolmogorov equation 1 0.1. .1) (lines) with the analytical solution superimposed (circles) using five-point FD approximations in dss004 for t = 0.6 u (x.t ) 0.4 0.m and used in ua 1. The computational effort reflected in ncall = 150 is quite modest. By linear interpolation.1 can be used to estimate the velocity of the traveling wave of Fig.7 0. of course. 5 (left to right).3 0.5 0. As required. 8.0407 1t 1−0 .9 + (2.480950 − 0.2 0.1: Numerical solution to eq. 0. t = 0) = 0. the estimated velocity is 1x 2.9 0.516824)/(0. the analytical and numerical solutions agree for t = 0 (since both solutions are from eq. . The tabular analytical and numerical solutions also reflect the good agreement between these two solutions.5.516824) = 2. (8. the agreement between the analytical and numerical solutions of approximately six figures is quite acceptable.2) with t = 0).1) is x = 1.0407 − 0 c= = = 2.0407 Thus. x = 0 (this follows from the values of q and a set in pde 1 main. For u(x. . even with only 51 grid points. The numerical solution of Table 8.5 at time t = 1 (from Table 8. (8. the point on the x axis where u = 0. In this case. For t > 0. .

4.2 0 5 4 10 3 5 t 2 0 x 1 0 −5 FIGURE 8. δ = 1. (8. and m = q + 1.2) (with x = −5. the KPP constants would become: a = 1. eq.1) is straightforward. yet the programming in pde 1.1). (8. t) 0. The F–K equation is a sim- plified version of the KPP equation.6).m (Listing 8. which compares with the computed value of c = 2.1) ∂t ∂x u = u(x. (8. We follow the general approach used in the appendix to Chapter 10. (8. Consequently.2: 3D plot of the numerical solution to eq.4 0. (10. and we repeat the problem equation below for convenience ∂u ∂ 2 u − 2 − u 1 − uq = 0 (8.6 u (x. the solution of eq.1). Also. b = −1.1) subject to the IC from eq. q > 0 (8. as outlined in the main Appendix. 10) is straightforward.8 0. where for this problem.04 (see the parameter values in Table 8. Appendix We conclude this chapter by solving the Fisher–Kolmogorov (F–K) equation using the factorization method [1. t > 0.2) (with t = 0) and two Dirichlet BCs from eq. variations in the PDE can easily be made for cases for which an analytical solution might not be available.7) . In summary. 5]. (8. t). Chapter 8 .1) is nonlinear. eq. Fisher–Kolmogorov Equation 141 Fisher–Kolmogorov equation 1 0.

8) dx2 dx c 1 where γ = and F(U) = 2 U(1 − U q ).263%) 0 5 10 15 Semidiscrete equations 20 25 30 35 40 45 50 0 5 10 15 20 25 30 35 40 45 50 Dependent variables FIGURE 8. t) = U (ξ ). eq. and k = wavenumber. k k We factor the polynomial function of eq.142 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Jacobian sparsity pattern – nonzeros 423 (16. (8. where ξ = k (x − ct).7) reduces to the traveling wave ODE d2 U dU +γ + F(U) = 0 (8.3: Jacobian matrix map of the MOL ODEs for n = 51. (8. c = velocity. If we assume a traveling wave solution of the form u (x.8) (the third term) as F(U) 1 = f1 f2 = 2 1 − U q/2 1 + U q/2 U k .

000000 1.000000 1. .003883 0. .000000 0.00 −4.003084 0.014201 0.000000 1. .000003 1.800 0.00 9.845091 0.00 0. .586240 −0.00 −4.000000 t x u (it. b=0. .949175 0.021717 0. .00 −4.558806 0.000000 0. . .100 0.00 −0.942839 0.619243 −0. 1.900512 0.000000 1.935754 −0.861038 0.000000 0.000 0.00 8.1: Tabular numerical and analytical solutions q=1.800 0.00 9. 0.00 −5.00 1.00 10.861038 0.002445 0.488015 0.00 1.500 0.000000 0.000000 0.000000 0.700 0. Fisher–Kolmogorov Equation 143 Table 8.000000 1.900 0.900512 0.017594 0.000 0.451830 0.415572 0.888652 0. .000000 1.021720 0. a=0.00 8.00.00 9.000000 0.558806 0. i) 1.444722 0.619243 0.523780 0.100 0.00 −3.000000 . i) u anal (it.100 0.003883 0. .001531 0.000000 0.586240 0.927842 0.000000 1.954833 0. i) err (it.002445 0.003084 0. .00 2.845091 0.00 −5.400 0.000000 0.379608 0.800 0.000000 0. 1.480950 0.000000 0. i) u anal (it.100 0.00 0.516824 0. . .000000 0.400 0.516824 −0. c=2.000000 0.00 9.000 0.000000 .488015 0.000002 1.300 0.379608 0.014202 0.04 s=2.949175 −0. .000000 1.000 0.200 0.927842 −0.00 −4.00 −4. .00 −3.888652 0. 0.954833 0.000002 (Continued ) .451830 0. .400 0.000000 .800 0.700 0.480950 −0.00 0.001531 0.444723 −0.500 0.00 −0.552017 0.00 8.523780 0.935754 0. . .600 0. i) err (it.017591 0.41.500 0.001936 0.000000 1.00 2. .00 −4.700 0.942839 −0.200 0.000 0.001936 0. Chapter 8 .00 1. .00 1.552018 −0.400 0.700 0.875527 0.100 0.415572 0.000000 .00 t x u (it. i) 0.41.875527 0.00 1.

.12) αk k .9) k αk where we have also introduced the constant α.e.11) dξ 2 k dξ 2 D − f2 (U) D − f1 (U) U = 0. i) 1.000000 .700 0. f2 = 1 + U q/2 .00 9. eq. . .40b).011428 0. From eqns.1: (Continued) t x u (it.144 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 8.000001 1. i. as γ is a con- 2 q+2 2(q+2) α+α −1 stant and independent of the value of U.e.011427 0. (A. (8.39). i. Therefore. Thus. . Also.. we find that γ = − k . (A.41) and (8.007338 0. output for t = 2. . on setting U = 0.10) 1 c + 1 + U q/2 = −γ = − αk k Collecting terms and equating the coefficients of U q/2 to zero (as the left-hand side of q+4 eq. .9).400 0. becomes α h 1 i D± 1 + U q/2 D∓ 1 − U q/2 U = 0 (8.00 9. ncall=150 and choose α 1 f1 = 1 − U q/2 . (A. 3. adopting the grouping of Cornejo-Perez [2].009170 0.000001 1.007338 0. it follows that d2 U α + α −1 dU ∓ + f1 f2 U = 0 (8. . α 6= 0 (8. we obtain the following ODE df1 q α α U + f1 + f2 = − U q/2 + 1 − U q/2 dU 2 k k (8. . i) err (it. the corresponding factorization eq. .009169 0.00 10.000 0. 4. i) u anal (it. 5 removed . . .10) is equal to a constant) gives α = ± q 2 and c = √ .

># Some calculations to confirm the results of a # factorization solution to the FisherKolmogorov Equation # Ref: Rosu. C. eqns. it follows that eq.x. ># Check that factorization is correct F_chk:=simplify(eval(f[1]*f[2]*U)). Therefore.[xi.Note: alpha introduced f[1]:=alpha*(1-Uˆ(q/2))/k. Substituting back values for ξ . (8.15) The above solution with x0 = 0 is the same as the analytical solution. H.2–8. sol1:=simplify(subs(U=0. If we let K = ±K̂ exp[kx0 ].U]).f[1]):f[2]:=subs(U(xi)=U.size). f[2]:=(1+Uˆ(q/2))/(alpha*k).13) dξ k Integrating eq.U)*U+f[1]+f[2]=-subs(U(xi)=U.eqn1).11) is compatible with the first-order ODE dξ dU α ∓ 1 − U q/2 U = 0 (8.14) where k and c are as defined above. which leads to the final solution 2(q+2) −2/q U = 1 + K exp[k(x − ct)] (8. Cornejo-Perez (2008). ># Define F(U).5 will perform the above calculations. # Supersymmetric pairing of kinks for polynomial # nonlinearities. ># Factor F(U)/U . ># Use the C-P grouping alias(U=U):f[1]:=subs(U(xi)=U.t)): alias(U=U(xi)): ># Define F-K equation pde1:=diff(u. ode1:=dchange(tr1.u=U}.pde1.13) either manually or using Maple yields −2/q 1 U = 1 + K exp − αqξ 2k where K is anarbitrary constant of integration. [arXiv:math-ph/0401040v3 24 Dec 2004| # |ArXiv: math-ph/0401040] restart.t)-diff(u. Fisher–Kolmogorov Equation 145 d where D = . we arrive at the standard form of traveling wave solution n o−2/q U ± = 1 ± K̂ exp[k(x − x0 − ct)] (8. ># Convert PDE to ODE tr1:={x=(xi/k+c*tau). The Maple code of Listing 8.g). (8. (8. g F:=U*(1-Uˆ(q))/(kˆ2). c. used in the numerical simulation discussed in the main body of this chapter. and α. Chapter 8 .x)-u*(1-uˆq)=0.f[2]): eqn1:=diff(f[1].t=tau. g:=c/k. and O.5).tau. . we q find that k = √ . with(DEtools): with(PDEtools): alias(u=u(x.

.symbolic). alpha:=sol2[2]. 45 (1992) 162–167. Springer.F. ># Obtain solution to ode2 sol4:=dsolve(ode2).f[1]). exp-.C.'recursive'). sol2:=solve(eqn3. New York. V. if pdeCHK = 0 then print('solution PASSES'). else print('solution FAILS!'). I: An Introduction. ># Collect terms in Uˆ(q/2)) eqn2:=collect(simplify(lhs(eqn1)-rhs(eqn1).ode2:=diff(U(xi). third ed. and Riccati-based methods are included with the downloads for this book.D.D.symbolic): if odeCHK = 0 then print('solution PASSES').5: Maple code to derive a solution to the Fisher–Kolmogorov equation using the factorization method. Murray. ># Check solution U(xi) satisfies ode1 odeCHK:=simplify(eval(subs({U(xi)=rhs(sol4)}.alpha). additional Maple scripts that obtain different solutions to the Fisher- Kolmogorov equation using tanh-.M. Dokl. Cornejo-Perez. . Factorization as a method of finding exact invariant solutions of the Kolmogorov- Petrovskii-Piskunov equation and the related Semenov and Zeldovich equations. ># Equate coeff of U to zero eqn3:=coeff(eqn2.rhs(sol4))). Math.Uˆ(q/2))=0. 450–451. else print('solution FAILS!'). Handbook of Nonlinear Partial Differential equations. http://arxiv.xi)-f[1]*U(xi).146 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS c:=solve(sol1. Supersymmetric pairing of kinks for polynomial nonlinearities. Polyanin.rhs(ode1))). 2010.U. O. ># Obtain solution to pde1 sol5:=u=simplify(expand(subs({xi=k*(x-c*t)}.size). ># Check solution u satisfies pde1 pdeCHK:=simplify(pdetest(sol5. 2002. 2004. FL. Phys. end if. LISTING 8. Rosu. ># Fomulate 1st order ode from [D-f[1]]U=0 f[1]:=subs(U=U(xi). [5] H.c).size). Nonlinear second order ODE: Factorizations and particular solutions. Cornejo-Perez. [4] A. Theor. [3] J.org/PS cache/math-ph/pdf/0401/0401040v3.pdf. Berkovich. Zaitsev. Boca Raton.pde1). Accessed 23 April.C. end if. Mathematical Biology. Prog. [2] O. H. References [1] L. 114 (3) (2005) 533–538. Finally. Chapman and Hall/CRC Press. Rosu. Sov.

[10] studied a related equation that added a diffusion term for the con- duction process of action potentials along nerves. All rights reserved.1) ∂t ∂x (a and D are arbitrary. u is directly related to the membrane potential and v represents several variables associated with terms that contribute to the membrane current from sodium. as we discuss later. the Fitzhugh–Nagumo system reduces to the nonlinear reaction–diffusion equation ([11]. potassium. and it turns out that this constant is equal to zero.00009-1 147 Copyright © 2012 Elsevier Inc. f (u) = u (u − 1) (a − u) ∂t ∂x ∂v = bu − γ v ∂t Here. f (u) = u (u − 1) (a − u) ∂t ∂x ∂v = (Lu − Mv) ∂t In the limit when → 0. p4). The first version was developed by Fitzhugh [3] and consisted of a 2 × 2 (two equations in two unknowns) system of ODEs. The parameters 0 < a < 1. Thus. we have v ' constant.1016/B978-0-12-384652-5. The Fitzhugh–Nagumo equation is a simplification of the Hodgin–Huxley model [6] for the membrane potential of a nerve axon. (9. . b. . γ = M. Nagumo et al. can be described by these equations [9] ∂u ∂ 2u = D 2 + f (u) − v. and the preceding equations become ∂u ∂ 2u = D 2 + f (u) − v. 9 Fitzhugh–Nagumo Equation One of the most widely studied biological systems with excitable behavior is neural com- munication by nerve cells via electrical signaling. with 0 ≤ a ≤ 1 and D > 0). Traveling Wave Analysis of Partial Differential Equations DOI: 10. The diffusion constant D is associated with axial current in the axon. where spatial diffusion in the transmembrane potential is allowed but without any applied external current. 0 < 1.1). It is analytically easier to see what is going on if we consider b and γ to be small so that b = L. ∂u ∂ 2u = D 2 − u(1 − u)(a − u) (9. and γ are all positive. under these conditions. This system. and other ions. D has a marked effect on the solution of eq.

1) has the following analytical traveling wave solution ([11]. the reader is referred to [4. Here. (9.xu. p4) 1 u (x. (9. is function ut=pde_1(t.xu. function ut=pde_1(t.ux). the ODE routine pde 1.2). % % ux ux=dss004(xl. u(n)=ua_1(x(n). 11].t).1 u(1)=ua_1(x(1).1). LISTING 9. 9. % % uxx uxx=dss004(xl. % % PDE for i=2:n-1 ut(i)=D*uxx(i)-u(i)*(1-u(i))*(a-u(i)). (9.m: . we list a few details pertaining to eqns. We can note the following points about pde 1. end ut(1)=0. t) = (9. 5.1).u) % % Function pde_1 computes the t derivative vector for the Fitzhugh-Nagumo % equation % global xl xu x n ncall % global a D % % BCs at x = 0.t). The function and some global parameters are first defined. For further details of the Fitzhugh–Nagumo system. The Matlab routines closely resemble those of Chapters 3–8.2) x 1 1 + exp √ + a− t 2D 2 Equation (9.m.2) is the analytical solution to the reduced Fitzhugh–Nagumo equation (9. First.148 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Equation (9.m for eq.n.1) that we use to evaluate the numerical solution of eq.n. ut(n)=0.1) and (9. ut=ut'.u) % % Function pde_1 computes the t derivative vector for the Fitzhugh-Nagumo % equation % . % % Increment calls to pde_1 ncall=ncall+1.1: Function pde 1.u).

(9.1 u(1)=ua_1(x(1). so-called stagewise differentiation. respectively (with n=26.2) (in ua 1.m with x = 0. ut(n)=0.2) programmed in ua 1.xu. . Since eq. is computed with dss004 by differentiating ux. The second derivative in eq.xu. as discussed in Chapter 4. A transpose is included to meet the requirements of the ODE integrator ode15s. subsequently set in function inital 1.t). the derivatives in t are set to zero at the boundaries (so that the ODE integrator does not move the boundary values away from their prescribed values). Fitzhugh–Nagumo Equation 149 global xl xu x n ncall % global a D . (9. the counter for the number of calls to pde 1. (9. u(n)=ua_1(x(n).m).n. (9. % % BCs at x = 0.t). ux. ut=ut'. Chapter 9 .m.1) is programmed in a for loop over the interior points i=2 to i=n-1. The first derivative in eq. % % uxx uxx=dss004(xl. (9. Equation (9.u). % % PDE for i=2:n-1 ut(i)=D*uxx(i)-u(i)*(1-u(i))*(a-u(i)). Finally.n. is computed using the function dss004. % % Increment calls to pde_1 ncall=ncall+1. end ut(1)=0. Since Dirichlet BCs are used. uxx. the two required BCs are taken from eq.ux). 1 at grid points i=1.1) is second order in x. function u0=inital_1(t0) % % Function inital_1 sets the initial condition for the Fitzhugh-Nagumo % equation % global xl xu x n % . The IC of eq. % % ux ux=dss004(xl.1).m with t = 0) is programmed in inital 1.1).n.m is incremented. The alternative would be to use dss044 to directly compute uxx from u.

function u0=inital_1(t0) % % Function inital_1 sets the initial condition for the Fitzhugh-Nagumo % equation % global xl xu x n . Function ua 1. end LISTING 9. (9. we consider some essential differences in detail.t) % % Function uanal computes the exact solution of the Fitzhugh-Nagumo % equation for comparison with the numerical solution % global a D % % Analytical solution uanal=1/(1+exp((1/2ˆ0. n=101.m for IC from eq. % % IC from analytical solution for i=1:n x(i)=xl+(i-1)*dx. eq.2).2) with t = 0.3: Function ua 1.0. LISTING 9. However.5+(a-1/2)*t)).5)*x/Dˆ0.m is a straightforward implementation of the analytical solution.0. u0(i)=ua_1(x(i). u0(i)=ua_1(x(i). (9. The function and some global parameters are first defined. (9. . We can note the following points about inital 1. pde 1 main.2).m for analytical solution (9. function uanal=ua_1(x. % % Spatial domain and initial condition xl=-60.0). The grid in x is then defined over the interval −60 ≤ x ≤ 20 for 101 points. The main program.2). is similar to pde 1 main of Chapters 2–8.2: Function inital 1. xu=20. xu=20. end As the grid in x is defined in the for loop.0).150 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS % Spatial domain and initial condition xl=-60. % % IC from analytical solution for i=1:n x(i)=xl+(i-1)*dx.m: . function ua 1 (listed next) is called (for t = 0) to define the IC from eq. dx=(xu-xl)/(n-1). n=101. dx=(xu-xl)/(n-1).

options).0e-06.0e-06.n)=ua_1(x(n).'AbsTol'. ncall=0. nout=31. end % % Independent variable for ODE integration t0=0. abstol=1.'JPattern'.u]=ode45(@pde_1. end if(ncase==2)a=1. for it=1:nout u(it.u0. % % Initial condition u0=inital_1(t0).u]=ode15s(@pde_1. if((it-1)*(it-11)*(it-21)*(it-31)==0) . end % % Store analytical solution.tout. D=0.options). % % ODE integration mf=2.t(it)). % % Moving front % ncase=2. reltol=1. Fitzhugh–Nagumo Equation 151 % % Clear previous files clear all clc % % Parameters shared with other routines global xl xu x n ncall % % Model parameters global a D % % Select ncase % % Smooth solution % ncase=1.tout. tf=60.abstol). Chapter 9 . options=odeset('RelTol'. if(ncase==1)a=1.t(it)). % % Explicit (nonstiff) integration if(mf==1)[t.u0.1)=ua_1(x(1). errors in numerical solution iplot=0. end % % Implicit (sparse stiff) integration if(mf==2) S=jpattern_num_1.1. D=1. tout=[t0:2:tf]'. % pause options=odeset(options. ncase=1.S) [t. u(it.reltol.

i).analytical') figure(3) surf(x. ylabel('t').u_anal(iplot.6f\n'.i). two cases are programmed (for −60 ≤ x ≤ 20. fprintf('\n t x u(it. Then.i) err(it. u_anal(iplot. for i=1:n tplot(iplot)=t(it). tplot(iplot).m). end end end fprintf(' ncall = %4d\n\n'.u_anal.. t = 0.3f%15.4: .i).t)') title('Fitzhugh-Nagumo equation. solid . uplot(iplot. view(47. 40.uplot(iplot. title('Fitzhugh-Nagumo equation'). 20.6f%15.i)=u(it.t. 60.. . n = 101 from inital 1. We can note the following points about Listing 9. err(iplot.i)=ua_1(x(i).i) u_anal(it. o . The model parameters are declared as global.152 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS iplot=iplot+1.i)-u_anal(iplot..u) xlabel('x').i)).x. axis tight shading interp colormap cool LISTING 9.4: Main program pde 1 main.uplot.err(iplot.20). % % Plot numerical and analytical solutions figure(2) plot(x. % % Clear previous files clear all clc % % Parameters shared with other routines global xl xu x n ncall % % Model parameters global a D % % Select ncase % % Smooth solution % ncase=1.ncall).2f%8.'o') xlabel('x') ylabel('u(x.t)').i)=uplot(iplot.i)\n').numerical.6f%15.'-'. % % Moving front % ncase=2.t(it)). zlabel('u(x. fprintf('%6.i).x(i).

2. end The IC from eq.S) [t.1) is smaller. D=1. D = 1 produces a moderately steep moving front solution (as reflected in the subsequent output).options). tout=[t0:2:tf]'.'JPattern'.'AbsTol'. they produce an excessive number of curves for the 2D plot from plot.1 produces a considerably steeper moving front solution as might be expected since the diffusion term in eq. end if(ncase==2)a=1. For the first case. Chapter 9 . end . the solution for only t = 0.u]=ode45(@pde_1. D=1. 40. tf=60. abstol=1. . reltol=1. Fitzhugh–Nagumo Equation 153 ncase=1. The integration of the 101 ODEs by ode45 (nonstiff ) or ode15s (stiff ) follows after the IC is .u0. if(ncase==1)a=1. ncall=0. (9. However.2) with t = 0 is then defined by a call to function inital 1. .reltol. % % Explicit (nonstiff) integration if(mf==1)[t.options). 4. For the second case. 60 is stored in uplot for the 2D plot. a total of 31 outputs (counting t = 0) result for t = 0. The 31 solution values from the ODE integration provide a smooth 3D plot from surf. % pause options=odeset(options. (9. defined.u0. 20. end if(ncase==2)a=1. % % Independent variable for ODE integration t0=0. D=0. Therefore.0e-06.abstol). the corresponding four analytical solutions are put in array u anal.0e-06.1.tout. Thus. % % Initial condition u0=inital_1(t0). and the difference between the numerical and analytical solutions is put in err. D = 0. options=odeset('RelTol'. D=0. 60. % % ODE integration mf=2. nout=31. .u]=ode15s(@pde_1. end . t varies over the interval 0 ≤ t ≤ 60 with the solution from ODE integrator ode45 and ode15s produced at intervals of 2. .tout.1. end % % Implicit (sparse stiff) integration if(mf==2) S=jpattern_num_1.m. if(ncase==1)a=1.

'o') xlabel('x') ylabel('u(x.x(i). Note that the four output points from the total of 31 are selected by if((it-1)*(it-11)*(it-21)*(it-31)==0) The counter for the calls to pde 1. view(47.i)=u(it. 20.3f%15.numerical. axis. colormap). The Jacobian matrix routine jpattern num 1.i)-u_anal(iplot. errors in numerical solution iplot=0.t(it)). .analytical') figure(3) surf(x.uplot(iplot. The main program produces the same three figures and tabulated output as in Chap- ters 2–8. ylabel('t').t)'). axis tight shading interp colormap cool The appearance of the 3D plot is enhanced by calls to four Matlab routines (view. title('Fitzhugh-Nagumo equation').6f%15. shading.i).1)=ua_1(x(1). ncall.uplot.m in Chapters 2–8 and is therefore not reproduced here. 40.err(iplot. zlabel('u(x. end end end fprintf(' ncall = %4d\n\n'. 60.t)') title('Fitzhugh-Nagumo equation. % % Plot numerical and analytical solutions figure(2) plot(x. tplot(iplot).u) xlabel('x').. solid .i)\n').. u_anal(iplot.'-'.20). which are now reviewed.i). u(it.154 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS % % Store analytical solution. is displayed at the end (t = 60) to give an .i)=ua_1(x(i)..6f\n'.x. fprintf('\n t x u(it. indication of the total computational effort.ncall).i). fprintf('%6.i)).u_anal.i)=uplot(iplot.m.u_anal(iplot.i) err(it.t(it)).m is the same as jpattern num 1. The 2D plot (with four solution curves) and the 3D plot (with 31 solution curves) are produced by calls to plot and surf.i). for i=1:n tplot(iplot)=t(it). respectively. t = 0.t(it)).t. for it=1:nout u(it. o . err(iplot.2f%8.6f%15.n)=ua_1(x(n).i) u_anal(it. uplot(iplot. if((it-1)*(it-11)*(it-21)*(it-31)==0) iplot=iplot+1.

20 are large enough that the traveling waves does not reach the boundaries for t ≤ 60. Figure 9. 20 and around the front (from approximately u = 0.1. 9. 60 1. This smoothness is perhaps unexpected considering the exponential in the analytical solution of eq.2 is a 3D plot of the numerical solution. (9.1 indicates good agreement between the analytical and numerical solutions (the successive curves are right to left for t = 0.4 1. eq. The boundary points x = −60. t = 0. the traveling wave charac- teristic of eq. (9. Also. . The agreement between the analytical and numerical solutions of approximately four figures (at t = 60) is due in part to the smoothness of the solutions as analytical solution of eq. (9. 40. This greater bandwidth is due to the repeated use of dss004 in pde 1. Fig. if the wave did reach a boundary.1: Numerical solution to eq.2 0 −60 −50 −40 −30 −20 −10 0 10 20 x FIGURE 9.4 0. 20.2 1 0.2) reflected in Fig.01 to u = 0.m in inital 1. The computational effort reflected in ncall = 536 is modest. The solution near the end points x = −60. As a cautionary note.2) is clear (the solution is merely displaced along the x axis). 9.1. t) 0. reflects the banded structure of the ODEs produced by dss004.1 also reflect the good agreement between these two solutions. some unexpected numer- ical effects might occur that would require additional analysis for an acceptable resolution of the solution ([12]). the band- width is 9 and not 5 as might be expected from the five-point FDs in dss004.8 u (x. Also. 20. The analytical and numerical solutions agree exactly at t = 0 as expected (from the use of ua 1. (9.3.m to compute uxx from u by stagewise differentiation. The tabular analytical and numerical solutions given in Table 9.6 0.99) is retained in Table 9. Chapter 9 .2). Fitzhugh–Nagumo Equation 155 Fitzhugh–Nagumo equation. Figure 9. The map of the ODE Jacobian matrix.1) (lines) with the analytical solution superimposed (circles) using five-point FD approximations in dss004 for ncase=1. 40. 60).m).

000000 0. .000000 0. 0.00 0.981290 0.018710 0.000007 0.032480 0.00 −58.000000 0.000002 0.6 0.845150 0.00 −6. .243908 0.00 0.000014 20.00 −57.000000 0.000000 0. .000000 1.984360 −0.154850 0.967520 0.4 0. .00 19.00 −1.00 −59.362233 0.000000 t x u(it.1: Portion of the numerical and analytical solutions for ncase=1 t x u(it.000000 0.00 −3.i) u anal(it.094256 0.00 −2.000000 0.000000 0.000000 0.4 0.000000 1.981290 0.243908 0.00 −60.0 0.500000 0. .032480 0.154850 0.000057 .2 0.000000 0.756092 0.4 0.000000 .000000 0.0 0.i) err(it.905744 0.0 0.000000 0.00 −19.4 1.000000 1.8 1.2 0.i) 0.0 0.00 18.000000 0.4 0.00 1.00 −57.000001 0.944193 0.000000 0.000000 −0.6 0. .00 17.000000 1.0 1.00 −56. .00 2.000000 0.000000 0.000000 0. 20.000000 .000004 0.094256 0.000000 0.000002 0.4 1.2 0.000000 0. .i) u anal(it.000000 0.00 −59.156 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 9.00 −0.756092 0.00 5.2 1.010713 0.8 0.0 0.8 0. .6 0.00 16.00 −5.00 −4.018710 0.000000 0.000000 1.00 20.989287 0.637767 0.i) err(it.000000 0.000000 20.989287 0.055807 0.00 −58.000000 1.000007 0. . .00 6.000000 1.000000 20.000000 0.6 1.00 4.6 1.000000 0.00 4.000000 0.972730 0.000000 0. 0.637767 0.000000 1.905744 0. .000000 0.8 0.00 −4.8 0. .2 0.2 1.0 1.000001 0.000000 0.00 −60.8 0.000000 1.6 0.000000 0.055807 0.944193 0.010713 0.000000 0.984345 0.000001 0. .845150 0.000001 0.000000 20.500000 0.4 0.000000 20.i) 20.000000 0.000000 0.000000 0. .00 −20.000000 .362233 0.000000 1.967520 0.000004 0.00 −56.00 3.6 0.972786 −0.8 1.

000091 20.6 0.00 −28.208766 0.4 0.00 16.4 0.000000 0.000000 −0.i) 40. .131366 0.593474 0.8 1.00 18.000000 −0.00 −12.000000 20.000000 .000000 0.00 −8.00 −31.000000 0.6 0.000000 20.i) err(it.953058 −0.00 −13. Chapter 9 . Fitzhugh–Nagumo Equation 157 Table 9. .317194 0.8 0.2 0.000000 40.4 1. .4 0.0 0.8 0.279836 0.111505 0.046114 0.00 −60.8 0.000000 0.977279 0.0 0. .00 −29.001434 20.000000 0.001917 40.6 0.00 −34.000000 40.449916 0.1: (Continued ) 20.00 −57.406753 0.046621 0.6 0.000000 t x u(it.000000 40.000000 0.002142 20.8 0.00 −56.000220 40.000055 40.002860 40.6 0.066618 0.180804 0.000489 20.2 0.00 −18.038725 0.279079 0.000000 1.000000 1.000089 40.0 0.00 −28.960662 0.920201 −0.816984 0.012916 0.00 −32.022369 0.00 −24.000158 20.887747 0.719760 0.678748 0.180241 0.0 1.986932 0.00 −9.4 0.001038 40.079197 0.000263 20.00 17.818447 0.i) u anal(it.0 0.680686 0.000000 40.00 −59.867859 0.001067 20.867541 0. 20.00 −16.545459 0.00 −27.977219 0.0 0.00 −15. .00 −16.0 0.000000 0.986987 0.00 −17.00 −33.6 0. .000060 40.952968 0.000564 20.00 −14.00 −12.000087 .000619 40.00 20.000000 −0.00 −32.932825 0.4 0.000000 0.000317 20.8 0.00 −11.000000 0.000388 20.000000 0.00 −8.2 0. .066230 0.001357 40.000000 1.000508 (Continued ) .000000 −0.8 0.210123 0.4 0.00 −58.022527 0.00 −24.000000 1.2 1.405320 0.001938 20.000000 20. 40.078439 0.00 19.003302 40.000000 1.4 0.012829 0. .2 0.887128 0.000025 20.000000 0.111016 0.002611 40.000758 40.8 0.932605 0.717148 0.000000 20.319111 0.547600 0.960574 0.000756 20.590172 0. .789200 0.130327 0.038988 0.00 −25.001463 40.6 1.6 0.788133 0.00 −10. .0 0.920176 0.452776 0.2 0.00 −30.00 −26.

000309 40.4 0.999978 0.0 0.000000 0.00 19.00 20.752632 0.015532 0.032407 0.000000 40.4 0.00 16.00 −40.00 −36.000000 60.00 −23. .054831 0.0 0.6 0.980944 0.000000 40.i) 60.000103 60.000219 60.755718 0.004249 60.499598 0.904138 0.00 −47.154152 0.00 −42.000000 0.093908 0. .000000 0.i) 40.000000 −0.000001 60.000000 40.00 −39.999961 0.0 0.981087 0. .4 0.003261 60.2 0.6 0.00 −60.357930 0.00 −48.00 19. 60.000143 60.8 0. .0 0.000000 t x u(it.00 −43.00 17.i) err(it.989087 0.00 −37.027032 0. .00 18.00 −59.999993 0.4 0.2 0.000000 0. .0 0.637691 0. .00 −41. .000166 . 60.000000 0. 40.1: (Continued ) t x u(it.000297 60.000509 60.00 −40.000825 60. .00 −46.00 −48.000000 0.8 0.2 0.00 −57.i) u anal(it.00 −58.026724 0.240481 0.00 −44.966928 0.4 0.2 0.633442 0.000000 40.943201 0.000000 0.000000 −0.844429 0.00 17.000000 −0.000000 0.4 0.361191 0.010517 0.001738 60. .00 −56.999988 0.00 16.000000 −0.001730 60.842690 0.158 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 9.000000 60.001234 60. .i) err(it.000000 0.8 0.6 0.018667 0.018370 0.000000 60.495332 0.00 −38.999993 0.00 18.004266 60.152422 0.000000 0.000000 −0.999988 0.242814 0.00 −44.0 0.943602 0.00 20.00 −36. .000000 0.2 0.6 0.000000 60.015355 0.003086 60.000841 60.000000 0.999996 0.8 0.999963 0.031898 0.000000 −0.000177 . .010683 0.6 0.i) u anal(it.967147 0.999979 0.000000 −0.000000 60.8 0.6 0.904979 0.999996 0. .000000 0.055656 0.4 0. .002333 60.0 0.989190 0.092674 0.000001 60.00 −22.2 0.8 0.000002 .00 −45.000000 60.8 0.2 0.000000 ncall=536 .000402 60.

4 indicates good agreement between the analytical and numerical solutions (the successive curves are right to left for t = 0. The computational effort reflected in ncall = 727 is still modest. which also reflects the considerably steeper moving front (compare Figs. 9.1 −60 60 −40 50 40 −20 30 x 0 20 t 10 20 0 FIGURE 9. The map of the ODE Jacobian matrix (not reproduced here) is the same as in Fig.5. D is reduced to 0. Fitzhugh–Nagumo Equation 159 Fitzhugh–Nagumo equation 1 0. as reflected in the following plotted and tabular solutions (Figs. since the only change is in D from 1 to 0. 20.6 0.6 u (x. Table 9. For Case 2.2).1 and 9. The tabular analytical and numerical solutions given in Table 9.00 -13.5 0.1) for ncase=1.4). 9.3 as expected.2: 3D plot of the numerical solution to eq.2 0. for example. (9.601214 0.2 also reflect the good agreement between these two solutions.4 0.5). 60.135746 which is due to the relatively steep moving front as explained subsequently. 40. at t = 60 (from Table 9. even with the considerably steeper moving front (compare Figs.1 (the ODE structure does not change).t) 0. 9. even though the error is rather large for certain points along the solution. 60). 9.8 0.4.2 and 9.3 0. Figure 9.1 so that the variation of the solution with x is more pronounced.2). Chapter 9 .5 is a 3D plot of the numeri- cal solution. .7 0.9 0. Figure 9. 9.736960 0.

Thus. termed adaptive mesh refinement. value of D). An alternative is to use an adaptive grid. The solution is changing rapidly (is strongly vertical at the moving front) so that the . in which the number of points is adjusted by the numerical algorithm to adequately resolve the solution. they are inherently more complicated than fixed grid methods (such as .1 (steeper front).3: Jacobian matrix map of the MOL ODEs for n = 101 for ncase=1. the maximum error along the moving front is increasing with t. as reflected in the three successive plots for t = 20. 9. The sharp front is marginally resolved with n = 101 so that for D < 0. 60.558%) 0 10 20 30 Semidiscrete equations 40 50 60 70 80 90 100 0 10 20 30 40 50 60 70 80 90 100 Dependent variables FIGURE 9. grid is dependent on the particular PDE problem conditions (in this case. 40. the adequacy of a particular spatial . more points in x might be required. which implies that the numerical solution might fail for t > 60.160 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Jacobian sparsity pattern – nonzeros 873 (8. . We can note the following points about Fig. In other words. AMR. Although AMR methods are well developed [14].4: . the selection of the number of spatial points is typically determined by a trial-and-error process. occasional large errors do not distort the plot substantially. However.

6 u (x. Fitzhugh–Nagumo equation 1 0. .2 0 −0. 60 1.6 u (x.4 0.8 0.5 0. Chapter 9 . 40. t) 0.1 0 −60 60 −40 50 40 −20 30 x 0 20 t 10 20 0 FIGURE 9. t) 0.2 −60 −50 −40 −30 −20 −10 0 10 20 x FIGURE 9.4: Numerical solution to eq. (9.1) for ncase=2.2 0. Fitzhugh–Nagumo Equation 161 Fitzhugh−Nagumo equation.1) (lines) with the analytical solution superimposed (circles) using five-point FD approximations in dss004 for ncase=2. (9. 20.5: 3D plot of the numerical solution to eq.7 0.9 0. t = 0.2 1 0.4 0.8 0.3 0.

856787 0.005487 20.0 1.000000 .i) 0.000000 0.000000 0.000000 1. .000000 0. .000000 20.00 −0.00 −1. .0 0.2 1.4 1.00 −58.000000 20.00 −59.4 0.00 16.4 0. .000000 20.000000 0.00 18.000000 0.00 2.004648 0.2 −0.000000 0.4 0.000000 0.000000 0.000052 0.000000 0.000000 1. .00 −60.925668 0.027180 0.6 0. 20.054962 0.000000 0.000000 1. 20.995352 0.8 1.722641 0.6 −0.500000 0.009878 .00 −60.000000 0.2: Abbreviated tabular numerical and analytical solutions for ncase=2 t x u(it.000000 0.000000 0.000000 0.6 1.143213 0.000000 0.000000 1.000000 0. .000000 1.i) err(it.000000 20.972820 0.000000 0. 0.00 20.000000 0.000000 0.0 0.000000 0.997761 0.005684 20.6 0.00 1.4 0.i) err(it.000000 0.500000 0.027180 0. . .000000 0.000000 1.077505 20.004648 0.856787 0.00 −7.00 18. .000000 0.6 0.4 1.000000 0.000000 0. .00 17.6 1.000000 0.000000 0.000000 0. .000000 20.000000 0.000000 t x u(it. .000000 20.0 0.000000 20.000000 0.00 −4.995352 0.000000 0.000000 −0.8 1. .i) u anal(it.00 0.060646 0.019506 0.i) u anal(it.000000 0. .0 0.0 1. .00 −2.00 −6.000000 0.000000 0.000000 0.258127 0.8 0.00 −57.00 −59. .00 17.143213 0.000000 0.00 0.000000 . .000000 1.000000 −0.8 0.00 −56.4 0.2 0.986755 −0.928172 0.00 −4. .000000 1.8 0.00 −56.000000 0.00 −58.00 20.8 0.i) 20.00 16.6 0.000000 0.000000 1.2 0.675491 0.00 19.335632 0.972820 0.000000 20.2 1.009628 0.00 −5.981269 0.002290 20.00 19.2 1.000000 . 0. .00 −57.002504 20.4 0.000000 1.8 0.000000 0.000000 0. .00 −3.000000 0.047150 20.00 −2.000000 0.000000 .162 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 9.

124694 0.000000 40.2 −0.040419 0.000000 60.962856 0.000000 1. .000000 0.i) u anal(it.420042 0.2: (Continued ) t x u(it.0 0.988144 0.00 −56.000000 0.000000 0.00 −11.6 0. .000000 60.000000 60.000000 0.000000 0.000000 1.0 1.000000 1.6 0.4 1.8 1.019834 0.135746 60.022625 60.4 0.993593 −0.00 −8. .000000 0. . Fitzhugh–Nagumo Equation 163 Table 9.084545 60.00 16.002857 40.i) 40.000000 1.736960 0.2 0.000000 40.2 0.006339 60. .00 −59.00 −7.00 −12.4 0.00 −57.835951 0. .00 −10.00 17.996912 −0.00 −11.000000 40. .016706 40.000000 60.000000 −0. .000000 0.000000 40.000000 0.2 0.00 −56.00 −60.00 −13.00 −14.4 1.000000 .4 0.008924 .000000 40.000000 0.0 0.000000 0. .000000 1.4 0.000000 0.000000 1.0 0. .000000 40.00 17.00 −12.000000 1.i) err(it.6 −0.000000 −0.4 0.2 0.023463 40. .000000 .000000 40.00 −8.000000 0.900194 0.8 0.001006 .00 18.201277 0. Chapter 9 .00 −9.565642 0.0 0.00 −58.968699 0.000000 60.2 −0.107988 0. .006992 0.910405 0.00 −59.00 16.812487 0. . .000000 0. .8 0.00 20.000000 0.000000 0.000000 0.6 −0.990736 0. .000000 0. 40.00 18. 40.000000 ncall=727 .i) err(it.010212 60.000000 60.000000 1.000000 0.000000 0.000000 0.000000 −0.000000 0.000000 1. .016479 40.000000 0.601214 0.995499 0.981805 0.000000 1.00 −6.8 1.000000 t x u(it. .001413 60.8 0.00 20.000000 −0.000000 0.036314 0.063044 0.005843 40.000000 60.003371 0.00 −60.004377 0.00 19.6 1.00 −16.00 −15.0 1. 60.015916 0.i) 60.000000 60.00 −57.i) u anal(it.000000 0.000000 0.000000 0.2 1.0 0.00 −58.000000 40. .8 0.2 1.285822 0. .145600 40. 60.00 19.6 1.

1) subject to the IC from eq.5 − 0. √ + a− t. can be derived by procedures such as the exp and tanh methods. The Coupled Fitzhugh–Nagumo Equations The coupled diffusive Fitzhugh–Nagumo equations are classified as reaction–diffusion equations and are a simplified version of the more complex Hodgkin–Huxley model that . D = 0. x 1 We note in eq. Analytical solutions.2236)/0.2). it typically will require fewer grid points than a fixed grid method.1) is nonlinear.285822 − 0.2. once an adaptive grid is operational. For Case 2.6 + (−12.1))0.5 1 − = −0. t = 0) = 0.2) (with x = −60. which agrees to (0. Also. particularly through the use of a computer algebra system (CAS) that also facilitates the verification of analytical solutions from the literature. and it can therefore result in a substantially reduced computational effort. eq.164 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS the use of n = 101 points in the present example).5 from Table 9.5 a − .736960) = −13.1798 − 0)/(60 − 1t 0) = −0.74% with the value of −0.5 at t = 60.2) that x and t appear in a linear combination. Appendix We conclude this chapter by first returning to the coupled two PDE systems at the beginning of the chapter.1.2) (with t = 0) and two Dirichlet BCs from eq. the solution of eq. (9. and then an example illustrating how to obtain the analytical traveling wave solution to the single Fitzhugh–Nagumo equation used in the numerical simulation. This example also demonstrates the possible sensitivity of a PDE solution to embedded parameters (such as D). then x = −13.8 − (−13. (9.5 2 1 v = −((2)(0.2236. and it therefore has the greatest error). eq. yet the programming in pde 1.736960)/(0. Consequently. and they typically require tuning of the AMR algorithm parameters to arrive at an acceptable numerical solution. t) = 0.2236 × 100 = −1. if we estimate (by linear interpolation) the value of x at which the numerical solution is 0. with a = 1. (9. particularly in the resolution of steep moving fronts.5) is approximately 1x (using also the value u(x = 0.2) represents a traveling wave solution. the velocity (for movement of the point u(x. In summary. for example.6))(0.2236 from eq.1798. and (2D) 0. Thus. however.m is straightforward. For example. (9. 2D 2 so that eq. 2 The velocity can also be estimated from the numerical output of Table 9. variations in the PDE can easily be made for cases for which an analytical solution might not be available. (9. 20) is straightforward. (9.2) v ≈ = (−13.2197. (9. (9. then k = and v = −(2D)0. If we consider the Lagrangian variable to be k(x − vt) where k and v are the wavenumber and wave velocity. respec- 1 1 tively. This approach based on the CAS system Maple is demonstrated in the following Appendix.2) (recall again the second calculation is based on the part of the solution that is changing most rapidly.2197 − 0.

and γ a model parameter. However. which is considerably slower than the speed of electricity flowing along a wire. the steady-state values for the state variables are found to be v = 0 and r = 0. This is because.008. this process is controlled chemically by. resulting in an infusion of positive ions into its axon and another propagating impulse. i. In mammals.e.. a combination of positively charged ions of sodium (Na+ ) and potassium (K+ ) and. where a diffusion term has been incor- porated into the above ODEs and which also include an external stimulus I. Chapter 9 .3a) ∂t ∂x ∂r = (v − γ r) (9. γ = 2. Fitzhugh–Nagumo Equation 165 describes the dynamics of the voltage V (x. primarily. excitability. electrical charge is carried by electrons that are very much smaller than the ions. which are the charge carriers within an axon. the impulses can trig- ger the associated neuron to fire.15 . For our subsequent analysis. to a lesser extent by positively charged ions of calcium (Ca2+ ) and neg- atively charged ions of chloride (Cl− ).3b) ∂t The stimulus I represents an external current applied to an axon (or nerve fiber) and D represents electrical diffusivity of the axon. as it is more usual to work in normalized units. t) across a nerve cell [13].54. we introduce the spatially distributed Fitzhugh–Nagumo equations. 15] ! dV V3 = 10 V − −R dτ 3 dR = 0. I = 0. within a wire.25V + 1. a = 0. If the stimulus reaches a certain threshold level. = 0. They are derived from the Fitzhugh–Nagumo ordinary differential equations [7. which pass through ion channels in the surrounding insulating myelin membrane of the axon. In order to model waves that travel along an excitable medium.08 (−R + 1. By setting the time derivatives to zero.03. For a full description of the associated biophysical processes. On reaching a synapse. by setting the time derivatives to zero.5) dτ where V represents the neural excitation voltage and R represents a recovery variable. we choose to use the following form of transformed equations dv = v (v − 1) (µ − v) − r dt dr = (v − γ r) dt where µ represents excitation threshold. the result is an impulse that propagates at speeds up to 100 m/s. refer to [2] and for electrical analogs refer to [8]. Again. we take the parameter values to be [1] D = 0.139. ∂v ∂ 2v = D 2 + v (v − 1) (a − v) − r + I (9. the steady-state values for the state variables are found to be V = −(3/2) and R = −(3/8). and so on.

6 0.5 . In this case. However. the solutions demonstrate rich dynamics with traveling pulses that propagate along the simulated axon.166 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Fitzhugh–Nagumo equations — Single pulse stimulation A model of electrical activity in a neuron 1. i.8 Membrane voltage 0. Equations (9. ∂u ∂ 2u = D 2 − u (1 − u) (a − u) ∂t ∂x by application of the Maple procedures outlined in the main Appendix.2 0 −0. Applying the tanhMethod() procedure as detailed in Listing 9. this results in two voltage spikes traveling in opposite directions that emanate from the point of stimulation (see Figs.43 (ms) 1 0.8 and 9. but it is included in the downloads for this chapter. if the stimulation is applied continuously.9).6: Solution resulting from a single-pulse stimulus applied at x = 25 (normalized units). we can easily calculate numerical solutions that demonstrates the general utility of the numerical approach..e.6 and 9.2 Time = 286. Analytical Solution of the Single Fitzhugh–Nagumo Equation We can find the analytical solution to the single Fitzhugh–Nagumo equation.7).3b) represent a nonlinear system for which an analytical solution is not available. a stream of voltage spikes is gener- ated (known as bursting or firing) that propagate in each direction away from the point of stimulation (see Figs. However.3a) and (9. The Maple code for producing the above figures will not be discussed here. 9. If the stimulation is applied as a single pulse.2 Neural excitation Recovery variable −0. 9.4 0 5 10 15 20 25 30 35 40 45 50 Distance along axon FIGURE 9.4 0.

05 0 50 40 30 0 Distance 50 20 100 150 10 200 Time 250 0 300 FIGURE 9.7: 3D plot resulting from a single pulse stimulus applied at x = 25.1 0.15 Voltage 0. bottom: recovery variable (normalized units).8 0.2 0 −0. top: neural excitation. . Chapter 9 .2 50 40 30 0 Distance 50 20 100 150 10 Time 200 250 0 300 Fitzhugh–Nagumo model — Recovery variable 0.6 Voltage 0.4 0. Fitzhugh–Nagumo Equation 167 Fitzhugh–Nagumo model — Neural excitation 0.

16]. . 16]..43 (ms) 1 0. >alias(u=u(x. 16]).60. shading=Z. axesfont=[TIMES.4 0 5 10 15 20 25 30 35 40 45 50 Distance along axon FIGURE 9.labels=["x"."u"].numpoints=100.axes='framed'. labeldirections=[HORIZONTAL.168 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Fitzhugh–Nagumo equations — Continuous stimulation A model of electrical activity in a neuron 1. style=patchnogrid.8 Membrane voltage 0.axesfont=[TIMES.axes=framed. ROMAN. # Set order of approximation infoLevOut:=0.x0:=0. animate(rhs(sol[n]). 16]).2 Time = 286.. 16].t)-D*diff(u. 16].intFlg.t=0.t=0.0.labelfont=[TIMES.50. >read("tanhMethod. plot3d(rhs(sol[n]). >intFlg:=0: # No integration of U(xi) needed ! M:=1.txt").8: Solution resulting from a continuous stimulus applied at x = 25 (normalized units). ROMAN.60.infoLevOut). with(PDEtools): with(PolynomialTools): with(plots): unprotect(D). ROMAN. ># Fitzhugh-Nagumo Equation # Attempt at Malfliet's tanh solution restart..x=-10.x.4 0. labels=["x". a:=1.grid=[100."u(x. orientation=[116. titlefont=[TIMES.axesfont=[TIMES. 16]. titlefont=[TIMES.t)"].2 Neural excitation Recovery variable −0.6 0.100]. title="Fitzhugh-Nagumo Equation". ROMAN.HORIZONTAL.n:=4."t".pde1. labelfont=[TIMES.50.x)+u*(1-u)*(a-u)=0. thickness=3. ># Plot Case 1: # =========== D:=1. title="Fitzhugh-Nagumo Equation".51].t)): >pde1:=diff(u. ROMAN.VERTICAL]. tanhMethod(M. ROMAN. ROMAN.x=-10.2 0 −0.frames=50..

Fitzhugh–Nagumo Equation 169 Fitzhugh–Nagumo model — Neural excitation 1 Voltage 0.9: 3D plots resulting from a continuous stimulus applied at x = 25. bottom: recovery variable (normalized units). top: neural excitation. Chapter 9 .2 Voltage 0.1 0 50 40 30 0 Distance 50 20 100 150 10 200 Time 250 0 300 FIGURE 9. .5 0 50 40 30 0 Distance 50 20 100 150 10 200 Time 250 0 300 Fitzhugh–Nagumo model — Recovery variable 0.

VERTICAL]. expMethod(Md.6.axes=framed.. Md:=1.100].axes=framed.x=-55."u(x. >read("expMethod. D:=1."u"].intFlg.60. a:=1.20. >alias(u=u(x. titlefont=[TIMES.Mn. _b[-1]:=1.x. 16]. where the wavenumber is 1 2D given by k = √ and the velocity by c = (2a − 1).axes='framed'.20..pde1.t)): >pde1:=diff(u. we can apply the expMethod() procedure as detailed in Listing 9.grid=[100.labels=["x". 16].4) 2 2 2 2D 4 This demonstrates the traveling wave property √ of the solution.axesfont=[TIMES. LISTING 9. style=patchnogrid. with(PDEtools): with(PolynomialTools): with(plots):unprotect(D). 16]). zz:=rhs(sol[n]). titlefont=[TIMES. ROMAN. title="Fitzhugh-Nagumo Equation". axesfont=[TIMES. >intFlg:=0: # No integration of U(xi) needed ! Mn:=1.frames=50. title="Fitzhugh-Nagumo Equation"..60.t)-D*diff(u.0. 16]).numpoints=100. # Set order of approximation infoLevOut:=0.labels=["x". a:=1. title="Fitzhugh-Nagumo Equation".HORIZONTAL. orientation=[116. shading=Z.t)"]. ROMAN.. 16]. ROMAN. ROMAN.1."u"]. animate(zz.infoLevOut). thickness=3. x0:=0..x)+u*(1-u)*(a-u)=0. ROMAN. 2 2D 2 Alternatively. ># Fitzhugh-Nagumo Equation # Attempt at Exp solution restart. ROMAN. ># Plot Case 1: # =========== n:=3. labeldirections=[HORIZONTAL.5: Maple code to find traveling wave solutions of the Fitzhugh–Nagumo equation using the tanh method. labelfont=[TIMES.. .labelfont=[TIMES."t".txt").10. 16]. 16].t=0.x=-5.170 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS ># Plot Case 2: # =========== D:=0. ROMAN. plot3d(rhs(sol[n]).t=0. labels=["x". animate(rhs(sol[n]). Animations and 3D plots are also produced for cases 1 and 2.axesfont=[TIMES. produces 15 traveling wave solutions from which we select the following as an example √ √ √ √ √ 1 1 2 2 x + 2 D 2ta − D 2t u := − tanh √ 2 2 8 D which simplifies to 1 1 x 1 u= − tanh √ + (2a − 1) t (9.51].60.x=-5.t=0.

4) and (9. labels=["x". 1 u= (9.grid=[100.axesfont=[TIMES. ROMAN. plot3d(zz.t=0.. we obtain. using the hyperbolic identity tanh(θ ) = 1 − 2/(1 + exp(2θ )).10.frames=50. shading=Z.axesfont=[TIMES. labeldirections=[HORIZONTAL. 16].10.grid=[100."u(x. ROMAN. labelfont=[TIMES.60. in fact."u(x. Finally.x=-55. 16]. On letting b−1 = 1.labelfont=[TIMES. ROMAN. labels=["x". (9.axes='framed'.numpoints=100.6: Maple code to find traveling wave solutions of the Fitzhugh–Nagumo equation using the exp method.2)). ROMAN. 16]. ROMAN.5) are. labelfont=[TIMES. thickness=3.60. 16]. including three trivial solutions and the following solution as outputted from Maple √ √ √ √ √ 2 2 x − d 2t + 2 d 2tα − √ b−1 e 8 d u := √ √ √ √ √ √ √ √ √ √ 2 2 x − d 2t + 2 d 2tα 2 2 x − d 2t + 2 d 2tα − √ √ b−1 e 8 d +e 8 d where b−1 is an arbitrary constant. Fitzhugh–Nagumo Equation 171 thickness=3. LISTING 9. Chapter 9 . labeldirections=[HORIZONTAL. titlefont=[TIMES. ROMAN.10. ROMAN. ROMAN. 16]). 16]. 16]). titlefont=[TIMES.axes='framed'.. orientation=[-31.. 16].. 16].1. axesfont=[TIMES.HORIZONTAL. ROMAN. Animations and 3D plots are also produced for cases 1 and 2. after simplification. ROMAN. 16].5) x 1 1 + exp √ + α − t 2d 2 which is the traveling wave solution we used in the above numerical simulation (eq.VERTICAL].labelfont=[TIMES. ROMAN. title="Fitzhugh-Nagumo Equation". title="Fitzhugh-Nagumo Equation"."u"].axesfont=[TIMES.VERTICAL]. titlefont=[TIMES."t".t=0.labels=["x".x=-20.100]. Also.HORIZONTAL.axesfont=[TIMES. 16]. ># Plot Case 2: # =========== D:=0. 16]).33]. ROMAN.60. (9. .x=-20. title="Fitzhugh-Nagumo Equation". animate(zz. 16]). equivalent.100].axes=framed.t)"]. an additional Maple code that finds traveling wave solutions to the Fitzhugh– Nagumo equation using the Riccati-based method is included with the downloads for this book."t".numpoints=100.t)"]. plot3d(zz. orientation=[-31. 16].t=0. style=patchnogrid. shading=Z.frames=50. we note that the tanh and exp solutions of eqns.33]. ROMAN.. which produces 33 traveling wave solutions. ROMAN. titlefont=[TIMES. axesfont=[TIMES. style=patchnogrid. a:=1..

53 (2006) 797–820. [15] H.E. Arimoto.A. Decisions. [2] M. 2009. Handbook of Nonlinear Partial Differential Equations. Williams & Wilkins.W. Mathematical Biology II: Spatial Models and Biomedical Applications. Springer. A quantitative description of membrane current and its application to conduction and excitation in nerve. 82 (1975) 881–895. Comp. Chapman & Hall/CRC. and Actions: The Dynamical Foundations of Neuroscience. [3] R. J. Biol. [4] J. 59 (2002) 541. second ed. Springer. Guckenheimer. [10] J.yorku..ca/webpages/wilson. A. Murray.. Vande Wouwer. Fitzhugh. [9] J. 2000. UK. Bear. Homoclinic orbits of the Fitzhugh-Nagumo equation: The singular-limit. Wilson. [6] A. Biophysics of Computation. Alford. Mon. An active pulse transmission line simulating nerve axon. [8] C. 117 (1952) 500–505. Mathematical models of threshold phenomena in the nerve membrane. V. Rotating wave solutions of the Fitzhugh-Nagumo equations. 2005. . Proc. Math. Hodgin.P.F. Oxford.. Schiesser. S. 2001. UK.htm. Philadelphia. [12] P. Oxford University Press. Kuehn. 2001. Saucez. 56 (2001) 171–185. Simul. second ed. Nagumo. 1999.R. Scott. 2004. Auchmuty. M. Neuroscience: Exploring the Brain. G. [13] A. Routledge. J. Upwinding in the method of lines. Zaitsev. J.. Am. [11] A. Conners. discrete and continuous dynamical systems Series S. Chapman & Hall/CRC. Lippincott. 17 (1955) 257–269. 1999. Biophysics. A. [5] S.D. Saucez. Huxley. W.172 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS References [1] J. 2. 4 (2009) 851–872. UK.F. New York. IRE. Oxford. [14] A. S. Oxford Uni- versity Press.L.D. Spikes. Some mathematical problems from neurobiology. C. Vande Wouwer. [7] J.F. B. Third ed. Paradiso. Math. Math. W. available on-line at http://cvr. FL. Boca Raton. Boca Raton. New York. Koch. Polyanin. no. Math. Encyclopedia of Nonlinear Science. P. Adaptive Method of Lines. Keener. Physiol. Hastings.G. Mathematical Physiology I: Cellular Physiology. Bull. Schiesser. Yoshizawa.E. Sneyd. FL. 50 (1962) 2061–2070.

and it also clearly demonstrates a traveling wave solution as explained subsequently.5 ) (10. Traveling Wave Analysis of Partial Differential Equations DOI: 10.2) where a(1 − m)(m + 3) λ= .4) 2(m + 1) r b β= − (10. All rights reserved. (10. (9. b. . also called the Fisher–KPP equation or just the KPP equation. pde 1. and D are arbitrary. First. (10.u) % % Function pde_1 computes the t derivative vector for the Kolmogorov- % Petrovskii-Piskunov equation % global xl xu x n ncall % % Model parameters global a b m D % % BCs . (10.3) 2(m + 1) s a(1 − m)2 µ= . eq. KPP is used to model tumor growth and invasion [3].1) ∂t ∂x where a. (10. Here. p7) h i2/(1−m) u(x. p7).1). 10 Kolmogorov–Petrovskii–Piskunov Equation The Kolmogorov–Petrovskii–Piskunov (KPP) equation ([4]. (10. is used in biological applications. The Matlab routines closely resemble those of Chapter 9. the ODE routine.1016/B978-0-12-384652-5. m(6= 1).1) is similar to eq. for example.00010-8 173 Copyright © 2012 Elsevier Inc. is function ut=pde_1(t. An analytical solution is ([4].1). we list a few details pertaining to eqns. t) = β + exp(λt + µx/D0.1)–(10.5) a We note that eq.5).m. ∂u ∂ 2u = D 2 + au + bum (10.

Since eq. % % Increment calls to pde_1 ncall=ncall+1. (10.xu.n.1).1).xu.t).n. (10. The alternative would be to use dss044 to directly compute uxx from u. ux. xu = x(n) = 10 at grid points i=1. % % PDE for i=2:n-1 ut(i)=D*uxx(i)+a*u(i)+b*u(i)ˆm. ut(n)=0.n.t). We can note the following points about pde 1. % % ux ux=dss004(xl.n.ux). .u).1: Function pde 1. The function and some global parameters are first defined. is computed with dss004 by differentiating ux. so-called stagewise differentiation. subsequently set in the main program pde 1 main. % % ux ux=dss004(xl. and passed as global variables. the two required BCs are taken from eq. (10. % % uxx uxx=dss004(xl. end ut(1)=0.1) is second order in x.u). u(n)=ua_1(x(n).174 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS u(1)=ua_1(x(1).ux).t).t). as discussed in Chapter 4. respectively (with n=101.m: . function ut=pde_1(t. ut=ut'. (10.n.1). LISTING 10. . % % uxx uxx=dss004(xl. uxx. (10. The second derivative in eq.xu. % % BCs u(1)=ua_1(x(1).xu. is computed using the function dss004.m for eq.m).u) % % Function pde_1 computes the t derivative vector for the Kolmogorov- % Petrovskii-Piskunov equation % global xl xu x n ncall % % Model parameters global a b m D . The first derivative in eq.2) with xl = x(1) = −10. u(n)=ua_1(x(n).

the derivatives in t are set to zero at the boundaries (so that the ODE integrator does not move the boundary values away from their prescribed values). function u0=inital_1(t0) % % Function inital_1 sets the initial condition for the Kolmogorov- % Petrovskii-Piskunov equation % % Parameters shared with other routines global xl xu x n ncall .m: .2) with t = 0. (10. % % IC from analytical solution for i=1:n x(i)=xl+(i-1)*dx. end ut(1)=0. ut(n)=0.1) is then programmed.m.0). (10. The grid in x is then defined over the interval xl = −10 ≤ x ≤ xu = 10 for 101 points (these grid parameters were selected by trial and error to produce a numerical solution .0. % % Increment calls to pde_1 ncall=ncall+1. u0(i)=ua_1(x(i). The function and some global parameters are first defined.m is incremented. A transpose is included to meet the requirements of the ODE integrator ode15s. Since Dirichlet BCs are used. end LISTING 10. the counter for the number of calls to pde 1. Finally. % % PDE for i=2:n-1 ut(i)=D*uxx(i)+a*u(i)+b*u(i)ˆm. ut=ut'. Equation (10. The IC of eq.2) (with t = 0) is programmed in inital 1. Kolmogorov–Petrovskii–Piskunov Equation 175 . function u0=inital_1(t0) % % Function inital_1 sets the initial condition for the Kolmogorov- % Petrovskii-Piskunov equation % % Parameters shared with other routines global xl xu x n ncall % % Spatial domain and initial condition dx=(xu-xl)/(n-1). Chapter 10 . We can note the following points about inital 1.m for IC from eq.2: Function inital 1.

u0(i)=ua_1(x(i).5. % % IC from analytical solution for i=1:n x(i)=xl+(i-1)*dx.4: Selected lines from the main program pde 1 main. beta=(-b/a)ˆ0. therefore.0).1.1. .t) % % Function uanal computes the exact solution of the Kolmogorov- % Petrovskii-Piskunov equation for comparison with the numerical % solution % % Model parameters global a b m D lambda mu beta % % Analytical solution uanal=(beta+exp(lambda*t+mu*x/Dˆ0. n=101. xu=10. (10. (10. function uanal=ua_1(x. end As the grid in x is defined in the for loop. Note that the parameters a.5))ˆ(2/(1-m)). . xl=-10. % % Parameters shared with other routines global xl xu x n ncall % % Model parameters global a b m D lambda mu beta a=1. LISTING 10.0. is similar to pde 1 main of Listing 2.176 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS with acceptable accuracy.m. . and (10. m=2.3).5.2). and β are declared global so that they can be shared with other routines. eq. we consider only a few specific lines of code pertaining to the parameters defined in eqns. D=0. λ. D. and (10. . mu=(a*(1-m)ˆ2/(2*(m+1)))ˆ0.4). pde 1 main.3). b. .m for analytical solution (10. lambda=a*(1-m)*(m+3)/(2*(m+1)). discussed subsequently).5). function ua 1 (listed next) is called (for t = 0) to define the IC from eq.m is a straightforward implementation of the analytical solution.m for eqns. (10. and they are defined numerically in the main program. µ. m.5). (10.2) (with t = 0). LISTING 10. (10. The main program. Function ua 1. . b=-1. (10. % % Spatial domain and initial condition dx=(xu-xl)/(n-1).4).3: Function ua 1. pde 1 main.2). .

1) (lines) with the analytical solution superimposed (circles) using five-point FD approximations in dss004 for t = 0. For t > 0. (10.m is the same as jpattern num 1. n = 101. Figure 10. the wave velocity is c = −(D0.1 also reflect the good agreement between these two solutions.7 0. The map of the ODE Jacobian matrix.5 0. Fig. the analytical and numerical solutions agree for t = 0 (since both solutions are from eq. 6. Chapter 10 .1 0 −10 −8 −6 −4 −2 0 2 4 6 8 10 x FIGURE 10.4 0.2 is a 3D plot of the numerical solution. reflects the banded structure of the ODEs produced by dss004.3. Note that the curves move left to right. (10.5 (x + (D0. 9 (left to right).5 /µ)λt). Figure 10. which are now reviewed.5 /µ)λ (which will be confirmed in the subsequent discussion of the numerical output. (10. Also.5 = µ/D0. t) 0.6 u(x. note that λ < 0).2). 3. As required.3 0. Kolmogorov–Petrovskii–Piskunov Equation 177 KPP equation 1 0. in other words. the agreement between the .m in Chapters 2 –9 and is therefore not reproduced here. The Jacobian matrix routine jpattern num 1.2) with t = 0). The number of grid points.2 0. 10. The main program produces the same three figures and tabulated output as in Chap- ters 3–9.2) in the sense that the successive curves are displaced by a constant distance in t.1 indicates good agreement between the analytical and numerical solutions.1: Numerical solution to eq. The computational effort reflected in ncall = 260 is quite modest. (10. the solution appears to be a traveling wave as specified by eq.8 0.9 0. since from eq. The tabular analytical and numerical solutions given in Table 10. the Lagrangian variable is ξ = λt + µx/D0. is large enough that the individual elements of the Jacobian matrix are not distinct.

468560 − 0.1). t) 0.9 0. For u(x.2533 Thus. t = 0) = 0.5 − 0.2: 3D plot of the numerical solution to eq.40 − 1.80)(0. 10. For example.6835) c= = = 0. The numerical solution of Table 10.60 + 0.2533 − (−0.1.3 0.1 8 6 −10 4 t −5 0 2 x 5 0 10 FIGURE 10.520241) = 1. x = −0.8 0.5 − 0. for t = 3.6835 Similarly. the estimated velocity (of the value u(x.520241)/(0.444285 − 0.4 0. t = 3) = 0. the value of x can be estimated by linear interpolation within the solution values of Table 10. linear interpolation to determine x for u(x.6 u (x.1 at t = 0.5.178 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS KPP equation 0.1 can be used to estimate the velocity of the travel- ing wave of Fig.5 for t = 0 and t = 3.2 0.543844)/(0.5 gives x = 1.6456 1t 3−0 .80 + (−0.20)(0. t) = 0. we can determine the distance (in x) between the two solution values u(x.5 0. even with only 101 grid points.5) is 1x 1.7 0.20 + (1.543844) = −0. (10. analytical and numerical solutions of approximately five figures is quite acceptable. t) = 0.

1) is straightforward.5 /0. µ = 0. (10. (10.8333.6455 (λ and µ were computed according to eqns.4082. In summary. (10.3: Jacobian matrix map of the MOL ODEs for n = 101. xu = 10) is straightforward. Conse- quently. Appendix We conclude this chapter by solving the KPP equation using the factorization method as outlined in the main Appendix.558%) 0 10 20 30 Semidiscrete equations 40 50 60 70 80 90 100 0 10 20 30 40 50 60 70 80 90 100 Dependent variables FIGURE 10.4). as programmed in Listing 10. which compares with the analytical value (with λ = −0. eq. as we use . D = 0. Also.1) is nonlinear. the solution of eq.1) c = −(D0.3) and (10. The equation is repeated below for convenience. yet the programming in pde 1.4).2) (with xl = −10.10.5 /µ)λ = −(0.4082)(−0.1) subject to the IC from eq.m (Listing 10. (10. (10. variations in the PDE can easily be made for cases for which an analytical solution might not be available.8333) = 0.2) (with t = 0) and two Dirichlet BCs from eq. Chapter 10 . Kolmogorov–Petrovskii–Piskunov Equation 179 Jacobian sparsity pattern—nonzeros 873 (8.

800 0.i) err(it. .00 −9.000007 3.00 −0.999994 0.400 0.000000 0. .000000 −0.000000 0. . . . .000000 0.000000 0.000000 0. .000000 . .000000 0.000000 t x u(it.318314 0.000004 3.000000 0.00 10.00 −9.468560 0.000000 0.999999 0.000000 0.615151 0. .999999 0.00 −0.400 0.392258 0. .800 0.00 −10.00 9.800 0.00 1.000000 −0.i) 0.00 −9.000000 0.000000 0.000000 0. . .999999 0. .000000 3.999986 0.00 9.999994 0.000000 0. .468560 0.000 0.444285 −0.400 0.i) u anal(it.00 −10.00 −9.400 0.00 10.444278 0.000000 0. 0.000000 3.660371 0.392258 0. .318314 0. ncall=260 .000000 1.000000 0.200 0.000 0.000000 3.00 1.00 −0. .00 −9.000000 0.000001 3.600 0. .000000 0. 0.800 0.00 9.00 9.i) u anal(it. output for t = 6.999995 0.600 0.00 1.000 1. .i) 3.000000 0.600 0. .000000 .000000 .800 0.660375 0.999986 0.000005 .000 0.200 0.00 −9.200 0. . .593089 0.000 0.543844 0. .000000 3.999999 0. .400 0.543844 0.00 −9.000000 0.000000 3.520238 0.400 0. .999999 0.000000 0.Table 10.00 9.000000 0. .00 0.00 9.999995 0. . .999989 0.520241 −0.999999 0. .00 −9.000 0.999999 0. .000000 0. 9 removed .800 0. 3.000000 0.000000 .000000 3.00 −1.600 0.00 1.000000 0.600 0.593090 0.999989 0.999999 0.00 −0. 3.000000 0.1: Tabular numerical and analytical solutions t x u(it.000000 0.00 9.999992 0.200 0.368354 0.000000 3.999992 0.615151 0.000000 −0.200 0. .000000 3.000000 −0.200 0.i) err(it.600 0.000000 0.000000 0.000000 0.00 9.000003 3.368359 −0.

41) and (10. i.8). on setting U = 0.11) αk δ a k δ a . kδ k δ We factor the polynomial function of eq. Therefore. (A. we obtain the following ODE df1 (m − 1) (m−1)/2 α √ α + a/δ 1 − −b/aU (m−1)/2 p p U + f1 + f2 = − −b/δ U dU 2 k k (10. Kolmogorov–Petrovskii–Piskunov Equation 181 slightly different notation than in eq. (10. From eqns.8) δ a k δ a αk where we have also introduced the constant α. α 6= 0 (10. i. k it follows that √ d2 U a/δ α + α −1 dU ∓ + f1 f2 U = 0 (10. ∂u ∂ 2u − δ 2 − au − bum = 0 (10. adopting the grouping of Cornejo-Perez [2].. (A.40b). (10. Also. (10. Chapter 10 .. (10. c = velocity. where ξ = k (x − ct).9) √ 1 c + a/δ 1 + −b/aU (m−1)/2 p = −γ = − αk kδ Collecting terms and equating the coefficients of U (m−1)/2 to zero (as the left-handside of 2 √ m+3 eq. we find that γ = a/δ α + α −1 − . eq. 2(m + 1) 2(m + 1) as√ γ is a constant and is independent of the value of U.9) is equal to a constant) gives α = ± √ and c = − aδ √ . (A.e. t) = U (ξ ).7) dx2 dx c 1 where γ = and F(U) = 2 aU + bU m . becomes " r !# " r !# α a r r 1 a b (m−1)/2 b (m−1)/2 D± 1+ − U D∓ 1− − U U =0 (10. Thus.10) dξ 2 k dξ 2 D − f2 (U) D − f1 (U) U = 0.6) ∂t ∂x If we assume a traveling wave solution of the form u (x.1).6) reduces to the traveling wave ODE d2 U dU +γ + F(U) = 0 (10.e.39). f2 = 1+ − U . eq. and k = wavenumber. the corresponding factorization eq.7) (the third-hand term) as r ! r ! F(U) a b 1/2 m−1/2 b 1/2 m−1/2 = f1 f2 = 2 1 − − U 1+ − U U δk a a and choose r ! r ! b (m−1)/2 α r r a a b (m−1)/2 1 f1 = 1− − U .

12) either manually or using Maple yields r √ !−2/(m−1) b a/δ U= − + K exp − α(m − 1)ξ a 2k where K is an arbitrary integration. (10.182 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS d where D = . (10. constant of √ m−1 we find that k = a/δ √ . 5] for more information on this method and additional examples of its use. which leads to the final solution 2(m + 1) r !−2/(m−1) b U= − + K exp k(x − ct) (10. with(DEtools): with(PDEtools): >alias(u=u(x.5. (10. it follows that eq.t=tau.U]). Cornejo-Perez (2008). C. eqns. ># Define F(U). [arXiv:math-ph/0401040v3 24 Dec 2004| # |ArXiv: math-ph/0401040] restart. (10. If we let K = ± exp kx0 . # Supersymmetric pairing of kinks for polynomial # nonlinearities. Additional solutions to eq.x)-a*u-b*uˆm=0.[xi.12) dξ k δ a Integrating eq. Cornejo-Perez. ># Convert PDE to ODE tr1:={x=(xi/k+c*tau). we arrive at the standard form of traveling wave solution given in eq.2) r !−2/m−1 b ± − ± exp k (x − x0 − ct) U = (10.u=U}. ># Some calculations to confirm the results of a # factorization solution to the KPP Equation # Ref: Rosu.10) is compatible with the first-order ODE dξ r ! dU α r a b ∓ 1 − − U (m−1)/2 U = 0 (10.pde1.6) are given by Polyanin and Zaitsev [4.2)–(10. H. Substituting back values for ξ .14) a The above solution with x0 = 0 is the same as the analytical solution.t)-d*diff(u. Therefore.13) a where k and c are as defined above. c. Maple code that performs the above calculations is included in Listing 10. (10. ode1:=dchange(tr1.x. used in the numerical simulation discussed in the main body of this chapter.5). chapter 1]. and O.tau. and an .t)): alias(U=U(xi)): ># Define KPP equation pde1:=diff(u. and Rosu [2. Readers are referred to the papers by Berkovich [1]. g .

g). Factorization as a method of finding exact invariant solutions of the Kolmogorov– Petrovskii–Piskunov equation and the related Semenov and Zeldovich equations.Note: alpha introduced f[1]:=alpha*sqrt(a/(d))*(1-sqrt(-b/a)*Uˆ((m-1)/2))/k.U)*U+f[1]+f[2]=-subs(U(xi)=U. ># Check that factorization is correct F_chk:=simplify(eval(f[1]*f[2]*U)). ># Use the C-P grouping alias(U=U):f[1]:=subs(U(xi)=U. 45 (1992) 162–167. else print('solution FAILS!'). >sol2:=solve(eqn3.symbolic).ode2:=diff(U(xi). alpha:=sol2[1]. ># Fomulate 1st order ode from [D-f[1]]U=0 f[1]:=subs(U=U(xi).c).pde1). ># Obtain solution to ode2 sol4:=dsolve(ode2).size).alpha). ># Check solution u satisfies pde1: m:=3.f[2]): eqn1:=diff(f[1].f[1]).Uˆ((m-1)/2))=0.f[1]):f[2]:=subs(U(xi)=U. g:=c/(d*k). if pdeCHK = 0 then print('solution PASSES'). c:=solve(sol1. References [1] L.eqn1). ># Collect terms in Uˆ((m-1)/2)) eqn2:=collect(simplify(lhs(eqn1)-rhs(eqn1). additional Maple codes that obtain different solutions to the KPP equation using tanh-.size). end if. ># Check solution U(xi) satisfies ode1 odeCHK:=simplify(eval(subs({U(xi)=rhs(sol4)}. exp-. ># Equate coeff of U to zero eqn3:=coeff(eqn2. Chapter 10 . LISTING 10.5: Maple code to derive a solution to the the KPP equation using the factorization method. Math.M. ># Factor F(U)/U . ># Obtain solution to pde1 sol5:=u=simplify(eval(subs({xi=k*(x-c*t)}. else print('solution FAILS!').rhs(ode1))).rhs(sol4))).symbolic): if odeCHK = 0 then print('solution PASSES'). Berkovich. Dokl. . and Riccati-based methods are included with the downloads for this book.xi)-f[1]*U(xi).size).U. # Need to assign a value to m pdeCHK:=simplify(pdetest(sol5. Finally.'recursive'). Sov. >sol1:=simplify(subs(U=0. end if. Kolmogorov–Petrovskii–Piskunov Equation 183 F:=U*(a+b*Uˆ(m-1))/(d*kˆ2). f[2]:=sqrt(a/(d))/(alpha)*(1+sqrt(-b/a)*Uˆ((m-1)/2))/k.

V. FL. 2004. Cornejo-Perez. Polyanin. Herrero. Slow and fast invasion waves in a model of acid-mediated tumour growth. [4] A.org/PS cache/math-ph/pdf/0401/0401040v3. 2010. 114(3) (2005) 533–538. Chapman & Hall/ CRC.D. Biosci.184 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS [2] O. [5] H. M. [3] A. Rosu.A. Cornejo-Perez.pdf. M. Phy. Math.R. 220 (2009) 45–56. H. Rodrigo. Nonlinear second order ODE: Factorizations and particular solutions. Handbook of Nonlinear Partial Differential Equations. Supersymmetric pairing of kinks for polynomial nonlinearities. Theo. Fasano.C. Boca Raton. http://arxiv.C.F. Zaitsev. O. Progr. . Rosu. Accessed 23 April.

p593) is ∂u ∂u ∂ 2u ∂ 3u ∂ 4u = −u −α 2 −β 3 −γ 4 (11. .m is function ut=pde_1(t.1)–(11. u(n)=ua_1(x(n).u) % % Function pde_1 computes the t derivative vector for the Kuramoto- % Sivashinsky equation % global xl xu x n ncall % % Model parameters global alpha beta gamma k % % BCs at x = 0. The Matlab routines closely resemble those of Chapters 3–10. Two more BCs are available by differentiating eq. (11. Here.1) ∂t ∂x ∂x ∂x ∂x r 11 with the analytical solution [6] for the parameter values β = 0. 20. (11.t). 20.xu. (11.t). we list a few details pertaining to eqns. α = γ = 1. First.3) can then be applied as Neumann BCs at x = −10.2) with x = −10.1016/B978-0-12-384652-5. k = ± .n. % % ux ux=dss004(xl. t) = k 11H 3 − 9H + 2 . 19 15 1 15 u(x. Traveling Wave Analysis of Partial Differential Equations DOI: 10. % .u).3) ∂x 19 ∂x ∂x with ∂H 1 1 15 = k 1 − tanh2 kx − k2 t ∂x 2 2 19 Equation (11. H = tanh kx − k2 t .2) 19 2 19 Two Dirichlet BCs are available by applying eq. (11.2) ∂u 15 ∂H ∂H = k 33H 2 −9 (11. 11 Kuramoto–Sivashinsky Equation The Kuramoto–Sivashinsky equation ([6].3). the ODE routine pde 1. All rights reserved.1 u(1)=ua_1(x(1).00011-X 185 Copyright © 2012 Elsevier Inc.

% % ux ux=dss004(xl.1 u(1)=ua_1(x(1).xu.m: .uxxx). % % Increment calls to pde_1 ncall=ncall+1.ux).1).2) are used to define two Dirichlet BCs at x = −10.u) % % Function pde_1 computes the t derivative vector for the Kuramoto- % Sivashinsky equation % global xl xu x n ncall % % Model parameters global alpha beta gamma k . LISTING 11. 20 corresponding to the two grid points i=1. % % uxx uxx=dss004(xl. end ut(1)=0.u).n.186 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS % BCs at x = 0.m.m for eq.n with n=201 set in inital 1. The function and some global parameters are first defined.m (Dirichlet) and uax 1.1 ux(1)=uax_1(x(1).n. u(n)=ua_1(x(n).3) are used to define two Neumann BCs at x = −10.t). % % uxxxx uxxxx=dss004(xl.t). is computed using the function dss004. .xu. Equation (11.uxx).m (Neumann) discussed subsequently. % % PDE for i=2:n-1 ut(i)=-u(i)*ux(i)-alpha*uxx(i)-beta*uxxx(i)-gamma*uxxxx(i).n.1: Function pde 1. 20 and eqs.t). ut=ut'. % % BCs at x = 0. The first derivative in eq. Both sets of BCs are programmed in ua 1.n. We can note the following points about pde 1. (11. 20.1) is fourth order in x. ut(n)=0. (11.t).xu.1).xu. Equations (11. (11. % % uxxx uxxx=dss004(xl. function ut=pde_1(t. ux(n)=uax_1(x(n). ux. and the four required BCs are taken from the analytical solution with x = −10.

% % PDE for i=2:n-1 ut(i)=-u(i)*ux(i)-alpha*uxx(i)-beta*uxxx(i)-gamma*uxxxx(i). so-called stagewise differentiation.t). % % uxx uxx=dss004(xl. . ux(n)=uax_1(x(n). uxx. The IC from eq. Equation (11.m is incremented.ux). Kuramoto–Sivashinsky Equation 187 % % BCs at x = 0. uxxx.t). Since Dirichlet BCs are used. % % Increment calls to pde_1 ncall=ncall+1. Finally.1 ux(1)=uax_1(x(1). The second. xu= 20.2) with t = 0 is programmed in inital 1.uxxx).uxx). % % uxxxx uxxxx=dss004(xl. third. (11.1) is then programmed.xu. A transpose is included to meet the requirements of the ODE integrator ode15s. the derivatives in t are set to zero at the boundaries (so that the ODE integrator does not move the boundary values away from their prescribed values). dx=(xu-xl)/(n-1). are computed with successive calls to dss004.m with t = 0). end ut(1)=0. the counter for the number of calls to pde 1. (11.xu.n. and fourth derivatives in eq.n.1). . and uxxxx. % . n=201. ut=ut'. function u0=inital_1(t0) % % Function inital_1 sets the initial condition for the Kuramoto- % Sivashinsky equation % % Parameters shared with other routines global xl xu x n ncall % % Spatial domain and initial condition xl=-10. ut(n)=0.xu. % % uxxx uxxx=dss004(xl.n. Chapter 11 .m (the IC is programmed in ua 1.

2). (11. eq. % % IC from analytical solution for i=1:n x(i)=xl+(i-1)*dx. Two Dirichlet BCs are available by applying eq. (11.2) with t = 0. function ua 1 (listed next) is called (for t = 0) to define the IC from eq. LISTING 11. function uanal=ua_1(x.5*k*x-(15/19)*kˆ2*t). The function and some global parameters are first defined.m for analytical solution (11. n=201. (11. Two more (Neumann) BCs . 20. Function ua 1.2: Function inital 1.m: . The grid in x is then defined over the interval −10 ≤ x ≤ 20 for 201 points.m is a straightforward implementation of the analytical solution.188 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS % IC from analytical solution for i=1:n x(i)=xl+(i-1)*dx.3: Function ua 1. (11. uanal=(15/19)*k*(11*Hˆ3-9*H+2). eq.0. We can note the following points about inital 1. % % Spatial domain and initial condition xl=-10. end LISTING 11.t) % % Function uanal computes the exact solution of the Kuramoto- % Sivashinsky equation for comparison with the numerical solution % % Model parameters global alpha beta gamma k % % Analytical solution H=tanh(0.2) at x = −10. As noted previously.0).2). u0(i)=ua_1(x(i).1) is fourth order in x and therefore requires four BCs.m for the IC from eq. function u0=inital_1(t0) % % Function inital_1 sets the initial condition for the Kuramoto- % Sivashinsky equation % % Parameters shared with other routines global xl xu x n ncall .0.2) with t = 0. u0(i)=ua_1(x(i).0). end As the grid in x is defined in the for loop. (11. dx=(xu-xl)/(n-1). xu= 20.

m is a straightforward implementation of the analytical derivative.5*k*x-(15/19)*kˆ2*t. % % Independent variable for ODE integration t0=0.i). The main program. . .3).i) err(it.3). (11.i)). eq.i) u_anal(it. pde 1 main. gamma=1. nout=6. tf=10. LISTING 11. This derivative is programmed in uax 1. % % Model parameters global alpha beta gamma k alpha=1.2f%8. % % Display selected output for it=1:nout fprintf('\n t x u(it. A selected part of this routine follows.u(it. tout=[t0:2:tf]'. (11. k=(11/19)ˆ0... beta=0.ncall).3f%15. .3)).1. Kuramoto–Sivashinsky Equation 189 are available by differentiating eq. (11. .i)\n'). is essentially the same as pde 1 main of Listing 2.m for the analytical derivative (11. .5*k. % % Initial condition u0=inital_1(t0). t(it).err(it. ncall=0.i). . function uax=uax_1(x. % % Plot numerical and analytical solutions figure(2) .x(i).4: Function uax 1.t) % % Function uax computes the derivative (in x) of the exact solution % of the Kuramoto-Sivashinsky equation % global alpha beta gamma k % % Analytical solution arg=0.6f%15.u_anal(it. uax=(15/19)*k*(33*Hˆ2*Hx-9*Hx). Hx=(1-tanh(arg)ˆ2)*0. end end fprintf(' ncall = %4d\n\n'. H=tanh(arg).6f\n'. Function uax 1. Chapter 11 .0. for i=1:5:n fprintf('%6..5.6f%15.2) with respect to x (to give eq.

5: Portion of main program pde 1 main.t.u_anal. ylabel('t').5 3 2.t)'). . This main program produces the same three figures and tabulated output as Chapters 3–10.190 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS plot(x. The Jacobian matrix routine jpattern num 1.u) shading 'interp'. zlabel('u(x. . 10.m is the same as jpattern num 1.x. title('Kuramoto-Sivashinsky equation'). The solution is plotted in 2D (by a call to plot) and 3D (by a call to surf). solid . axis 'tight' xlabel('x'). Kuramoto–Sivashinsky equation 3. LISTING 11. 2. .numerical. which are now reviewed. 2. (11. 4. 4.1: Numerical solution to eq.2)) superimposed (circles) using five-point FD approximations in dss004 for t = 0. . . t) 1 0.5 2 1. The problem parameters are defined numerically and the scale in t is defined as 0 ≤ t ≤ 10 with output displayed at t = 0. .m in Chapters 3–10 and is therefore not reproduced here.'-'. (11. o .5 0 −0.u. .1) (lines) with the analytical solution (eq. This code consists essentially of two parts. .'o') xlabel('x') ylabel('u(x. . 10 (left to right).t)') title('Kuramoto-Sivashinsky equation.analytical') figure(3) surf(x.5 −1 −10 −5 0 5 10 15 20 x FIGURE 11.5 u (x. .

m is straightforward. reflects the banded structure of the ODEs produced by dss004. Chapter 11 .2: 3D plot of the numerical solution to eq. Figure 11. Chapter 10. Also. In summary. Consequently.5 10 8 20 6 15 10 t 4 5 0 x 2 −5 0 −10 FIGURE 11. variations in the PDE can easily be made for cases for which an analytical solution might not be available. t) 1 0. 1 15 We note in eq. If we consider the Lagrangian variable to be k(x − vt) where k and v are the wavenumber and wave velocity. (11.3.1. Figure 11.2) that x and t appear as the linear combination. (11. (11.1) subject to the IC from eq. respectively. Fig. (11.1.1) is nonlinear.2 is the 3D plot of the numerical solution.5 2 1. 20) is straightforward. (11.3) (with x = −10. then k and v follow immediately from the linear combination 1 15 kx − k2 t. (11.5 0 −0. two Dirichlet BCs from eq. yet the programming in pde 1.1 indicates good agreement between the analytical and numerical solutions. eq. The computational effort reflected in ncall = 564 is modest. for an example of this comparison). 20). The tabular analytical and numerical solutions indicate good agreement as displayed in Table 11. and two Neumann BCs from eq. kx − k2 t 2 19 so that the analytical solution represents a traveling wave as reflected in Fig.2) (with t = 0).2) (with x = −10. for example. (11. 11. This point was discussed in earlier chapters in which the wave velocity from 2 19 the analytical solution was compared with the wave velocity from the numerical solution (see. the solution of eq. The map of the ODE Jacobian matrix.1). . 11. Kuramoto–Sivashinsky Equation 191 Kuramoto–Sivashinsky equation 3 2.5 u (x.

and Yoshiki Kuramoto. in particular. β = 0.200%) 0 20 40 60 Semidiscrete equations 80 100 120 140 160 180 200 0 20 40 60 80 100 120 140 160 180 200 Dependent variables FIGURE 11. γ = 1 reduces to the form 1 2 ut = − u − uxx − uxxxx .3: Jacobian matrix map of the MOL ODEs for n = 201. The eq. Both Gregory Sivashinsky. which is usually pre- sented in a normalized form. it is used to model the thermal mechanism of flame propagation or com- bustion waves. 2 x . whilst studying laminar flame fronts [7]. Appendix The Kuramoto–Sivashinsky equation describes one of the simplest nonlinear systems that exhibit turbulence. discovered independently the equation now known as the Kuramoto–Sivashinsky equation. This equation models the time evolution of flame-front velocity which is determined by a balance between the quantity of heat released by the combustion reaction and the heat required to preheat the incoming reactants.1) with constants α = 1. It has been used to study various reaction-diffusion problems and. whilst studying diffusion-induced chaos [4].192 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Jacobian sparsity pattern – nonzeros 3313 (8. (11.

014276 0.000000 . However.750 0.00 19.200865 2. .287359 2.00 −7.00 −7.078424 0.402791 2.402775 2.000131 10.4.00 17.000 0. transform- ing the problem into the Fourier domain greatly reduces the stiffness of the problem and enables good results to be obtained with little computing effort.044520 0. t x u(it.402728 0.00 20. . .250 0.137674 0.137674 0.000023 10.000000 0.4. Output for t = 2.1: Tabular numerical and analytical solutions t x u(it. to give rich exam- ples of chaotic behavior.025224 0. .i) err(it.250 2. 11. Chapter 11 . .500 2.402785 2.000003 −0.00 −8.000000 0.000015 −0.000000 .000 −0.805901 −0. .000050 10.00 −7.402758 0. .750 2. .00 18.000000 ncall=564 which can be simulated using periodic boundary conditions.000002 0.000 2.250 2.000000 0.000000 0. .000000 0.000178 10.250 −0.000002 0.000187 10. x ∈ [0. Kuramoto–Sivashinsky Equation 193 Table 11.000000 0.500 0.287410 −0.402775 0.6.00 −9. The results at later times are extremely sensitive to small changes in initial conditions.00 20.078424 0.i) u anal(it.500 2.402728 2. see Fig. .00 −10.402785 0.00 17.337154 2. 10.805714 1.337154 0. .200996 −0. .00 −10.000000 0.00 19.025224 0. L]. .00 17. .000008 −0. and the transition from a smooth solution to chaos makes modeling in the time domain very difficult for extended simulated time periods.750 −0.044520 0.000 2.000063 .000000 0. .750 2.000 0.052825 2.000045 10.00 −9.00 18.000000 10.000 0.053003 −0. .i) 0.000048 0. .i) err(it. 0.i) 10.000005 −0.8 removed .00 17.014276 0.000 2.i) u anal(it.00 −7.000036 0.000 1. . . For example.00 −8. .500 −0.402758 2.000006 10. .402791 0.000018 0.000003 0.

0) = cos(x/16) (1 + sin(x/16)) and x ∈ [0. 32π]. and Riccati methods described in the main Appendix. >alias(u=u(x.t)): . 3. 11. (11. 8]. ># Kuramoto-Sivashinsky Equation # Attempt at Malfliet's tanh solution restart. We choose the tanh method and the Maple code listed in Listing 11.4 is based on spectral methods and uses the exponential time differencing scheme ETDRK4 described in detail by Cox and Matthews [2]. exp. This topic will not be considered further here.m. and for additional information relating to applications and theory of the Kuramoto– Sivashinsky equation.4: Time evolution for the Kuramoto–Sivashinsky equation with initial condition u(x. This image was generated from Matlab code described in the paper by Kassam and Trefethen [3]. The Kuramoto–Sivashinsky equation also admits traveling wave solutions. with(PDEtools): with(PolynomialTools): with(plots):unprotect(gamma). and these can be found using any one of the tanh. used to generate Fig. The solution of PDEs by spectral methods is currently an active area of research and can provide outstanding results for some problems. A copy of this code is included with the downloads for this book. kursiv.6 finds 11 solutions. readers are referred to [1. one of which corresponds to the original solution given in eq.2). The Matlab code.194 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Kuramoto–Sivashinsky equation 5 0 u 150 −5 100 90 80 100 70 60 50 t x 50 40 30 20 10 0 FIGURE 11. 5. A good general introduction to these methods is given in Trefethen’s monograph [9].

pdf>.gamma:=1. and the Riccati method finds 11 × 6 solu- tions (recall that each solution of the Riccati equation yields six separate traveling wave solutions).infoLevOut). (11."u(x. P. 64 (1978) 346–367.txt").t)+u*diff(u.t)"]. 2009.x. in: Chaos: Classical and Quantum.35. Comp.axesfont=[TIMES. axes=framed.x. They both find solutions that match the original solution of eq. Turbulence.2). J.. LISTING 11. lightmodel=none. Exponential time differencing for stiff systems. Schmelcher.org/version13/chapters/ChaosBook.35. Suppl."u"]. Fourth order time stepping for stiff PDEs.x)+alpha*diff(u. 16]). L. axes=framed..axesfont=[TIMES. 16]. 16]).1) using the tanh method. Trefethen. orientation=[-116.. Kuramoto–Sivashinsky Equation 195 >pde1:=diff(u. labelfont=[TIMES.x=-10.VERTICAL].x=-10. Theor.x. Diffusion-induced chaos in reaction systems. style=patchnogrid. grid=[100. ># Animate solution zz:=rhs(sol[8]). P. thickness=3. ># Generate a 3D surface plot of solution plot3d(zz. In order to save space. Progr. tanhMethod(M.M.x)=0. labeldirections=[HORIZONTAL.46].x. # Set order of approximation infoLevOut:=0. 26 (2002) 1214–1233. [2] S..K. ROMAN.intFlg.HORIZONTAL. 176 (2002) 430–455. Comp.t=0.6: Maple code to solve eq.x0:=0. animate(zz. listings of the Maple code implementations of the exp and Riccati methods will not be included here.100]. SIAM J. Chapter 11 . ROMAN. Copenhagen. Niels Bohr Institute. References [1] C. It is as equally straightforward to find traveling wave solutions by application of either of the Maple procedures expMethod() or riccatiMethod() described in the main Appendix. 16].20.x. . Diakonos. alpha:=1.20. titlefont=[TIMES. The exp method finds eight solutions. Phys. shading=Z. F. labelfont=[TIMES. >read("tanhMethod.x. ROMAN.C. [3] A-K. t=0. Kuramoto.thickness=0. <http://chaosbook. Sci. (11.title="Kuramoto-Sivashinsky Equation". Phys. 16]. Cox.labels=["x". ># set parameter values beta:=0. 16].x) +beta*diff(u."t". but they are available in the downloadable software for this book. ROMAN.pde1. ROMAN. >intFlg:=1: # No integration of U(xi) needed ! M:=3.N. titlefont=[TIMES.x)+gamma*diff(u. Kassam. [4] Y.frames=50. numpoints=100. Chandre.labels=["x". ROMAN. Matthews.title="Kuramoto-Sivashinsky Equation".

Nonlinear analysis of hydrodynamic instability in laminar flames-I. 2004.F.D. Ann. V. PhD thesis (version 0. Trefethen. Boca Raton. and turbulence in flames. pattern formation.I. [8] G. Polyanin. . Derivation of basic equations. Zaitsev. Sivashinsky. Lan. 15 (1983) 179–99. Chapman & Hall/ CRC.196 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS [5] Y. SIAM. School of Physics. 2004. Philadelphia. Instabilities. FL. Fluid Mech. Dynamical systems approach to 1-d spatiotemporal chaos – A cyclist’s view. [7] G.I. Spectral Methods in Matlab. Sivashinsky. 2000. Acta Astronautica 4 (1977) 1177–1206. [9] L. [6] A.N. May 18. PA.8). Rev. Handbook of Nonlinear Partial Differential Equations. Georgia Institute of Technology.

n. the ODE routine pde 1. All rights reserved. 12 Kawahara Equation The Kawahara equation ([8]. which is computed using finite differences (FDs) as explained subsequently. end .1016/B978-0-12-384652-5. Here.xu. This chapter is also an introduction to Chapter 18 pertaining to a PDE fourth-order in x and second-order in t. Traveling Wave Analysis of Partial Differential Equations DOI: 10. (12. k= . p632) is ∂u ∂u ∂ 3u ∂ 5u +u +a 3 = b 5 (12.n. % % PDE % For loop for i=1:n ut(i)=-u(i)*ux(i)-a*uxxx(i)+b*uxxxxx(i).2) 169b cosh z 2 13b where C1 . we list a few details pertaining to eqns.n.t).1) ∂t ∂x ∂x ∂x An analytical solution is ([8].t). u(n)=ua_1(x(n). . % % uxxx uxxx=u3x9p(xl.xu.u). C2 are arbitrary constants. First.xu. p632) 105a2 r 1 a u(x. The Matlab routines closely resemble those of previous chapters.00012-1 197 Copyright © 2012 Elsevier Inc. % % uxxxxx uxxxxx=u5x11p(xl.u) % % Function pde_1 computes the t derivative vector for the fifth- % order Kawahara equation % global xl xu x n ncall % % Model parameters global a b k C1 C2 % % BCs u(1)=ua_1(x(1).u). ab > 0 (12.2). We study this equation to investigate the use of a fifth-order derivative. % % ux ux=dss004(xl.1) and (12. z = kx − (18bk5 + C1 k)t + C2 . t) = 4 + 2C1 .m is function ut=pde_1(t.u).

1: Function pde 1. % % Increment calls to pde_1 ncall=ncall+1. ux. Dirichlet BCs. (12. x(1) and x(n) correspond to x = −30.m for eq. 9p = nine points used in the FD approximation for uxxx. we use Dirichlet BCs from eq. Since eq. The origin of u3x9p is discussed later. and we will find that the numerical solution is still accurate.1) is fifth-order in x. is computed by routine u3x9p. u(n)=ua_1(x(n).m The first derivative. LISTING 12. % % ux ux=dss004(xl.1).2). The third derivative in eq. (12. we will specify only the dependent variable at the boundaries.e. For the first case.n.xu.t). uxxx.m and passed as global variables to . % % BCs ut(1)=0. This second case will be discussed later.m: . where ua 1.xu.1). The notation signifies 3x = third derivative. However.n. ut(n)=0. (12. i.u). The function and some global parameters are first defined.t). since the solution and its derivatives are essentially zero at the boundaries in x. is then computed by dss004.1).198 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS ut=ut'. % % uxxx uxxx=u3x9p(xl.u) % % Function pde_1 computes the t derivative vector for the fifth- % order Kawahara equation % global xl xu x n ncall % % Model parameters global a b k C1 C2 . (12.m in which no BCs are programmed.m is the code for eq. it generally requires five BCs.u). function ut=pde_1(t. pde 1. 30 and n = 101 as subsequently defined in inital 1. We can note the following points about pde 1. .. In fact. % % BCs u(1)=ua_1(x(1). (12. . we will consider a small variation in pde 1.

Finally. the counter for the number of calls to pde 1.m for IC from eq. the derivatives in t are set to zero at the boundaries (so that the ODE integrator does not move the boundary values away from their prescribed values).1). The IC from eq. dx=(xu-xl)/(n-1).0). u0(i)=ua_1(x(i).2: Function inital 1. Equation (12. Since Dirichlet BCs are used.m. end ut=ut'. % % BCs ut(1)=0. The origin of u5x11p is discussed later.m is incremented. % % PDE % For loop for i=1:n ut(i)=-u(i)*ux(i)-a*uxxx(i)+b*uxxxxx(i). Similarly. n=101. uxxxxx. A transpose is included to meet the requirements of the ODE integrator ode15s. % % Increment calls to pde_1 ncall=ncall+1. Kawahara Equation 199 . function u0=inital_1(t0) % % Function inital_1 sets the initial condition for the fifth-order % Kawahara equation % % Parameters shared with other routines global xl xu x n ncall % % Model parameters global a b k C1 C2 % % Spatial domain and initial condition xl=-30. for uxxxxx.1) is then programmed. the fifth derivative in eq. ut(n)=0. xu= 30. . % % Spatial grid for i=1:n x(i)=xl+(i-1)*dx. (12. (12. 11p = 11 points used in the FD approximation . (12.2) with t = 0. The notation signifies 5x = fifth derivative.0. is computed by routine u5x11p. end LISTING 12.2) with t = 0 is programmed in inital 1. Chapter 12 .

(12.m for analytical solution (12. % % Spatial grid for i=1:n x(i)=xl+(i-1)*dx. LISTING 12. Function ua 1.0). % % Spatial domain and initial condition xl=-30.t) % % Function uanal computes the exact solution of the fifth-order % Kawahara equation for comparison with the numerical solution. The main program. The grid in x is then defined over the interval −30 ≤ x ≤ 30 for 101 points.m: .2).m is a straightforward implementation of the analytical solution. xu= 30. is essentially the same as pde 1 main of previous chap- ters and therefore is not listed here.1) are set in pde 1 main and then passed as global variables to the other routines where they are required. C5 are the FD coefficients) . u0(i)=ua_1(x(i).2) with t = 0. function u0=inital_1(t0) % % Function inital_1 sets the initial condition for the fifth-order % Kawahara equation % % Parameters shared with other routines global xl xu x n ncall % % Model parameters global a b k C1 C2 . function uanal=ua_1(x. end As the grid in x is defined in the for loop. The function and some global parameters are first defined. (12. The parameters of eq.200 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS We can note the following points about inital 1. % global a b k C1 C2 % % Analytical solution z=0. (12. dx=(xu-xl)/(n-1). % % Model parameters (C3. uanal=105*aˆ2/(169*b*cosh(z)ˆ4)+2*C1. function ua 1 (listed next) is called (for t = 0) to define the IC from eq. pde 1 main. n=101.2).5*k*x-(18*b*kˆ5+C1*k)*t+C2.0.3: Function ua 1. eq.

3 % for i=1:m+1 % % Display coefficients for derivative of order 3 i=m+1. which has a nine-point.i)*8 C3(5.:.i)*8 % end % % Calculation of FD weights complete end % .m with m = 3.:)=weights(x(ip). fprintf('\n=============================\n'). % % Compute weighting coefficients for finite differences % over ip points for ip=1:ng % % Weighting coefficients in array C3 C3(ip.n.m.:.xu. function uxxx=u3x9p(xl. centered FD approxima- tion for a third derivative. 1. ng = 9 % C3(:. fprintf('\n\n Numerical Derivative Order: %d'.5.:. equally spaced grid for i=1:9 x(i)=i-1. end % % Compute FD approximation for up to and including the mth % derivative m=3. C1=1.u) % % Function u3x9p computes the derivative uxxx based on nine points global ncall C3 % % For the first call to u3x9p (ncall = 0). Kawahara Equation 201 global a b k C1 C2 C3 C5 % a=1. b=1. k=(a/(13*b))ˆ0. We now consider function u3x9p. 2.ng-1. Chapter 12 . nd=ng. % % Number of grid points ng=9.nd-1.i-1). % % Coefficients in u3x9p. C2=0. end % % Display coefficients for derivatives of orders 0. compute the FD weighting % coefficients % if(ncall==0) % % Default points.m).x.

7. % % For the first call to u3x9p (ncall = 0).2.m (with ncall=0 set in the main program).n..8..4)*u(i-1). function uxxx=u3x9p(xl.. rdx3=1..4: Function u3x9p.0. for i=1:n % % At the left end. end The definition of the grid x is for the purpose of calculating the FD weighting coefficients only. +C3(5.9.4)*u(i-4). We can note the following points about u3x9p. (C3(5.1).1.0. uxxx = 0 elseif(i>(n-4))uxxx(i)=0.. +C3(5.202 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS % uxxx % Spatial increment dx=(xu-xl)/(n-1). uxxx = 0 if(i<5)uxxx(i)=0..4)*u(i+1). (12..4)*u(i+4))..4)*u(i-3).m for the third derivative uxxx in eq.m: . +C3(5...0/dxˆ3.3.. compute the FD weighting % coefficients % if(ncall==0) % % Default points.. % % At the right end.4)*u(i+2)...4)*u(i+3). +C3(5..4)*u(i-2)...u) % % Function u3x9p computes the derivative uxxx based on nine points global ncall C3 . For the first call to u3x9p. end end LISTING 12. +C3(5. +C3(5.5.xu. it is not the grid used in the method of lines (MOL) solution of .4)*u(i ). +C3(5.. a uniform grid in x of nine equally spaced points is defined. The function and some global parameters are first defined. equally spaced grid for i=1:9 x(i)=i-1.4. +C3(5. % % Interior points else uxxx(i)=rdx3*.6.

m with m = 3. fprintf('\n\n Numerical Derivative Order: %d'.. the order of the derivative to be approximated is specified. Then. fprintf('\n=============================\n'). Finally. computed (at each of the grid points. The details of weights will be considered subsequently.i-1).:. m=3..2. It also computes the weights for the function to be differentiated. the fifth coefficient is 1 for the function at the fifth point and 0 elsewhere. An optional display of the coefficients is included (just for our information).0. % % Compute FD approximation for up to and including the mth % derivative m=3. 1.ng).0. nd=ng. We can note the following details about this code: weights computes the FD weighting cofficients for the derivatives up to and including third order. ip=1..ng-1. % % Display coefficients for derivatives of orders 0.0 at grid point 5.1). % % Coefficients in u3x9p.:. for example.i)*8 % end % % Calculation of FD weights complete end .x. % % Compute weighting coefficients for finite differences % over ip points for ip=1:ng % % Weighting coefficients in array C3 C3(ip. which can have any grid spacing (and not necessarily integer spacing as .m).0. the weighting coefficients are computed by function weights and placed in array C3. 2.0. Chapter 12 . The weighting coefficients in the FD approximation are then computed.:)=weights(x(ip). In other words. ng = 9 % C3(:. First. which are. 0.0. . the number of grid points in the FD approximation is specified (ng=9). end The for loop steps through the ng = 9 grid points for which weighting coefficients are . % % Number of grid points ng=9. used in x(i)). 3 % for i=1:m+1 % % Display coefficients for derivative of order 3 i=m+1. Kawahara Equation 203 eq.:.. (12.0.1.nd-1.i)*8 C3(5.

and the third subscript of C3 is i = 1.m (if(ncall==0).4) includes a np x np = 9 x 9 array of FD weighting coefficients for the third derivative.1. using C3(5.8. then used repeatedly as u3x9p is called). Then. In other words.jcol. C3(irow.jcol.6.4.4)*u(i+4)).4)*u(i+3). for example. is then computed.. 4. so that the weighting coefficients are calculated only once. % % Interior points else uxxx(i)=rdx3*.4)*u(i+1).m). uxxx = 0 if(i<5)uxxx(i)=0..4)*u(i-4).. is computed.204 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Thus. The multiplication by 8 merely rescales the coefficients to values that are more typical of those reported in the literature. 2. irow=1 corresponds to grid point 1 in the basic grid of nine points.4)*u(i-3). 3. end end . the third index 4 specifies the weighting coefficients for the third derivative. displayed.. The final end completes the if for the first call to u3x9p.4)*u(i-1)...5.0. and thus only i=m+1=4 corresponding to the third derivative is . for i=1:n % % At the left end..... dx.4)*u(i+2).4)*u(i ).9. basic grid of nine points. and . +C3(5. +C3(5. Thus. The FD approximation of the third derivative. uxxx = 0 elseif(i>(n-4))uxxx(i)=0.. uxxx... +C3(5.i)*8 displays the nine FD weighting coefficients (using :) at grid point 5 for the third derivative (since i=4).2. +C3(5. +C3(5. the for loop steps through all of the grid points (n=101 set in inital 1..:.0. there are four sets of weighting coefficients for the function and its first three derivatives. Note that the for loop is commented.4)*u(i-2). +C3(5.. First. +C3(5.3. (C3(5. and irow=9 corresponds to grid point 9 in the . % % uxxx % Spatial increment dx=(xu-xl)/(n-1)..0/dxˆ3. C3(irow. As noted above. and column jcol specifies the nine weighting coefficients at grid point irow.. The first and second subscripts of C3 each range over 1–9 so that.7. rdx3=1. % % At the right end.. the grid spacing. +C3(5.4) corresponds to row irow for the FD approximation at grid point irow.

Again. Rather. (12. coefficients (second subscript = 1–9). the algorithm computes weighting coefficients for FD approximations of nonuniform grids. function to be differentiated varies most rapidly.m. .g. Chapter 12 . the third derivative is set to zero. which is acceptable if the solution and its . noncentered approximations. fewer total grid points are often required as the number of grid points in the approximation is increased. the order of the FD approximation also increases. such as in the adaptive grid solution of PDEs. as more points are used in the FD approximation. in general. For example. remain at zero at the left boundary (as they do in the case of eq. Of derivatives of any order. the third derivative will be zero or that the weighting coefficients are not set for grid points i=1. (12. For the intermediate points i = 5 to i = n-4. We can note the following details about this code: For the first four grid points (i<5 in the total of n=101). The two end statements conclude the if statement and the for loop in i. Kawahara Equation 205 . experience has indicated that in the MOL solution of PDEs. So efficiently that the algorithm can be used to compute new weighting coefficients for FD approximations during the course of the calculation. To minimize such effects. e. Based on any number of grid points. nine as in u3x9p. As the number of grid points is increased.2. This approach is often used in order to concentrate grid points where they are most needed. third order as in u3x9p. which is acceptable if the solution and its derivatives . numerical distortions can occur at the boundaries (this is discussed later). derivatives remain at zero at the left boundary (as they do in the case of eq.. In fact. n = 101 could possibly be reduced to achieve a specified accuracy in the numerical MOL PDE solution. At the boundary and near-boundary points.m. Similarly. for the last four grid points (i>(n-4) in the total of n=101). This remarkable algorithm computes weighting coefficients for FD approximations: .2)). we set uxxx to zero at the right boundary. This is a small price.2)). for a given accuracy of the approximation. the third derivative is set to zero.g. using nine weighting . The additional computational effort in using a higher-order FD approximation is generally more than . the third derivative is computed by a central FD for the middle grid point (first subscript = 5). we set uxxx to zero at the left boundary. offset by the reduced number of total grid points to achieve a prescribed accuracy. as the number of grid points is increased. numerical distortions can occur at the boundaries.g. The function weights is an implementation of the algorithm by Fornberg [3] for the calculation of weighting coefficients for FD approximations.4. With arbitrary selection of the grid points... To minimize any such effects. This does not mean that. experience has indicated that in the MOL solution of PDEs.3. One small disadvantage in using more grid points within the MOL integration of PDE is the increase in the ODE Jacobian bandwidth. This is accomplished by using . for the third deriviative (third subscript = 4). e.. where the . e. however. for the improved accuracy of the FD approximation.

k)-c5*c(i.k+1) = (c4*c(j+1.1) = c4*c(j+1.k+1) = c1*(k*c(i.1) = -c1*c5*c(i.0.m). found in % c(1:n+1.k+1) = 0.1:m+1) % c1 = 1. end c(i+1. A listing of function weights.1) = 1.n.0:m) weights at grid locations x(1:n+1) for % derivatives of order 0:m.1)/c3. . function [c]=weights(z.5: Function weights.k))/c3.m for the FD approximation of derivatives. for i=1:n mn = min(i. end c1 = c2.0. end c(j+1.m) % % Input Parameters % % z location where approximations are to be % accurate % % n one less than total number of grid points % % x(1:n+1) grid point locations % % m highest derivative for which weights are % sought % Output Parameter % % c(1:n+1.k+1))/c2.m follows without any further explanation. for j=0:i-1 c3 = x(i+1)-x(j+1). c5 = c4. for k=0:m for j=0:n c(j+1. c2 = 1.206 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS The Fornberg algorithm is the centerpiece of much of the reported FD PDE solutions.k+1)-k*c(j+1.0. c2 = c2*c3.nd. end end c(1. c4 = x(i+1)-z. end LISTING 12. end for k=mn:-1:1 c(j+1.x.0.1)/c2. c4 = x(1)-z. if (j==i-1) for k=mn:-1:1 c(i+1. The details of the algorithm can be found in the publications by Fornberg [3].

The weighting coefficients are antisymmetric (of opposite sign) around the center .. for a centered approximation of odd-order derivatives (such as 5th.6)*u(i-2). The computational effort reflected in ncall = 166 is quite modest.. 5 and i = n − 4. for example.. n is zeroed to minimize unrealistic effects at the boundaries. We can note the following points about this output (Table 12. The Jacobian matrix routine jpattern num 1. 11th).7. points.6)*u(i+4).6)*u(i-1).m is very similar to u3x9p. they are exact for higher-order polynomials as well. +C5(6. +C5(6. 3. This does not affect the numerical solution. n − 3. The calculation of the fifth derivative uxxxxx (third subscript 6 in C5) in u5x11p. 12. Fig.m in Listing 12. respectively. This will also be true for centered FD approximations of odd-order derivatives.6)*u(i+1). This is required in order to . i = 5 for a 9-point FD approximation and i = 6 for an 11-point FD approximation. +C5(6.. Kawahara Equation 207 Function u5x11p..1 indicates good agreement between the analytical and numerical solutions. The map of the ODE Jacobian matrix.1): . +C5(6. The coefficients sum to zero (the reader might verify this).m at grid point 6 (first subscript 6 in C5) is uxxxxx(i)=rdx5*.10.m is the same as jpattern num 1. which are now reviewed. after plot.. The only essential differences are the use of 5 and 11 in place of 3 and 9. are zero. The FD approximations are exact not only for a zeroth-order polynomial (constant function).1 also reflect the good agreement between these two solutions. this will be the case .2 is a 3D plot of the numerical solution. Figure 12. +C5(6....6)*u(i+3).1..6)*u(i+2). +C5(6. but only the plotting of the numerical and analytical solutions.. Chapter 12 . The main program produces the same three figures and tabulated output as in previous chapters. n − 1.6)*u(i-4).9..3.m in previous chapters and is therefore not reproduced here.m called in pde 1. the fifth derivative at grid points i = 1.. the 11-point . The weighting coefficients for the center points. +C5(6...5.. In general.3.6)*u(i-5).. reflects the banded structure of the ODEs produced by u3x9p and 5x11p.11. Specifically. −10 ≤ x ≤ 20 by inserting a statement like axis([-10 20 2 2. differentiate a constant function to zero. Also.4... +C5(6. (C5(6.. 4..6)*u(i-3).. n − 2.6)*u(i+5)).6)*u(i ). Again.2. The tabular analytical and numerical solutions given in Table 12.8. the nine-point approximation is exact for a polynomial up to and including eighth order (it will differentiate an eighth-order polynomial exactly). Figure 12. 2. +C5(6.4. +C5(6. The resolution of the traveling pulses can be increased by decreasing the interval in x from −30 ≤ x ≤ 30 to.6.7]).

600).9 −30 −20 −10 0 10 20 30 x FIGURE 12. (12.00 7. For example. superimposed (circles) using 9.1) (lines) with the analytical solution. the peak value of the solution of eq.00 6. the error is acceptable (as reflected in Fig. The agreement between the analytical and numerical solution of approximately four figures is acceptable for most applications.m.00 7.6 2.2). generally.000113 3. We can note. from Table 12.3 2.208 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Fifth-order Kawahara equation.800 2. t) 2. the maximum error is -0. However. t = 0.000069 3. which is approximately twice the error at the maximum of the solution (at x=6. however.1: Numerical solution to eq. (12.600 2.590046 -0. In particular. end of this chapter. and it could be reduced by increasing the number . 3 2. we have from Table 12.1) (where the solution changes most rapidly in x) is accurately preserved as demonstrated in Fig.1.2 2.589914 2. These order conditions can be studied numerically using the programs listed in Appendix 1 at the .1 that the maximum error in the numerical solu- tion does not occur at the maximum point in the solution.200 2. 3.and 11-point approximations in u3x9p.621197 2.1.621265 -0.1 and the following selected numerical output from Table 12.613835 -0.613723 2.000132.1).5 2. 12. approximation is exact for polynomials up to and including tenth order.7 2. 12.000132 For these three points. 1.1 2 1.m and u5x11p.4 u (x. at t = 3. (12. 2. eq.

3.2 2. of grid points (e. Of course.1) for the particular solution of eq. We observe that the two outputs are essentially identical indicating that BCs are not required for eq. (12. (12.3 is listed in Table 12. The derivatives at the boundary points would have to be calculated using the FD weighting coefficients available from weights. n=301 demonstrates substantially smaller errors in the numerical solution). (12.5 30 2 20 1.4 u (x. To demonstrate this point (no BCs required). the . (12.4. and for subsequent values of t. (12.2: 3D plot of the numerical solution to eq. the Dirichlet BCs in pde 1. a portion of the output for t = 3 from Tables 12. Chapter 12 . (12. this is not a general conclusion for eq.5 2. we can add the following comments: .1). For example. We also mentioned previously that BCs are not required for eq. the boundary values remain zero. In other words. BCs would be required if the solution and its derivatives depart from zero near the boundaries.1 is listed below in Table 12. To compare the output with and without BCs. Kawahara Equation 209 Fifth-order Kawahara equation 2. Abbreviated output analogous to that in Table 12.5 −20 0 −30 FIGURE 12. in the case of u3x9p..1) since the solution and its derivatives at the boundaries remain essentially at zero.1 2 3 2.5 10 1 0 t −10 x 0. t) 2.m.3 2.1 and 12.m can be repeated. For this case (of significant boundary effects).6 2. the IC from eq.g.2) at (t = 0) sets the boundary values of the solution and its derivatives zero.2).m can be commented (deactivated) and the exe- cution of pde 1 main.1).

m is straightforward. Also. which require additional refinement of the MOL algorithm and programming in the ODE derivative routine (pde 1. (12.m).1) subject to the IC from eq. unexpected boundary effects might be observed. Consequently.n-2. In summary. Even with the derivative calculated at all the grid points. (12.n-1. the solution of eq.4. variations in the PDE can easily be made for cases for which an analytical solution might not be available. (12.2. third derivative uxxx would be calculated at points i=1. Specifically.n rather .210 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Jacobian sparsity pattern-nonzeros 946 (9. eq.3. We will not go into the details of what may be required but rather refer to where boundary effects in MOL analysis are discussed in detail [9. than set to zero as in Listing 12. 11].4. We should also point out that the development of an MOL code for a new PDE problem is not necessarily straightforward.1) is nonlinear.274%) 0 10 20 30 Semidiscrete equations 40 50 60 70 80 90 100 0 10 20 30 40 50 60 70 80 90 100 Dependent variables FIGURE 12.2) (with x = −30. yet the programming in pde 1. .n-3. 30) is straightforward.3: Jacobian matrix map of the MOL ODEs for n = 101.2) (with t = 0) and without or with two Dirichlet BCs from eq. (12.

000 2. 0. .600 2.000001 2.m) ============================= ans = −0.000000 0.3611 a = 1.7500 52.000001 2.00 −1.000000 0.00 −27.000002 2.800 2.000000 0.000 2.000001 2.2333 Numerical Derivative Order: 5 (from u5x11p.000001 2.600 2.000001 2.000000 0.i) err(it.1: Abbreviated tabular numerical and analytical solutions for n = 101 Numerical Derivative Order: 3 (from u3x9p. .2667 −2.000001 0.00 0.000000 0.00 −28.000002 0.612768 0.000003 0.000003 0.000000 0.600 2.000000 0.200 2.621302 0.00 1.000001 2.200 2.2667 −0.i) u anal(it.000 b = 1.4000 0.000002 2.000000 t x u(it.000002 0.m) ============================= ans = −0.00 29.8333 −0.000000 0.400 2.000 2.000000 0.4000 −11.000 t x u(it.000001 0.2333 2. Chapter 12 .000000 0. (Continued ) . 0.612768 2. .000001 2.00 30.i) err(it.000000 .600 2. .0000 21.587976 2.000000 1.000001 0. .000001 0.000000 1.i) 0.00 −28.400 2.i) u anal(it.800 2.00 28.00 −28.00 −29.000 2.00 −27.000000 2. .000002 2.000 2.00 28.2222 −21.621302 2.587976 2.612768 0. .000000 1.000002 0.000000 0.400 2.0000 −16.00 27.7500 −4.2667 11.000002 0.000000 0.i) 1.00 −27. .000 2.587976 0.000000 0.200 2.000001 0.00 −30.800 2. .00 27.000000 0.000001 2. .00 −29.000000 1.00 −30.200 2.000003 2.587976 0.612768 2.000001 −0.0000 53. .000000 1.000000 .000001 2.00 −28.00 −27.8333 −52.000000 0.600 2. .200 2.00 −0.2667 16. .000000 0.3611 4.000 2. . Kawahara Equation 211 Table 12.000000 0.000001 0.000000 0.000001 0.000000 .2222 0.000001 2.000003 2. .00 0.000002 2.000001 2.0000 −53.

000033 1.000000 2.600 2.600 2.000038 2.000000 .000001 2.000001 2.00 30.400 2.000004 2.617241 0. .000006 t x u(it. .000001 2.620053 2. .00 −28.00 28.000001 2.000 2.00 6.i) u anal(it.000 2.i) err(it.000 2.400 2.620436 2.000019 −0.400 2.000002 −0.000026 −0.565150 2.000000 0.605264 2.00 2.800 2.000025 2.000001 3. .000005 −0.000006 3.000000 1.577185 2.000021 2.600 2.000099 2. .i) err(it.000108 .000000 1.00 3.00 27.000 2.620082 −0.000000 0.000017 2.574920 2. .000001 2.000001 2.000001 2.00 −28.000 2.00 4.000000 0.000000 0.000001 2.000001 t x u(it.000005 2.000000 1.000006 2.00 29.400 2.000067 .i) 1.000001 2.00 −30.00 3.800 2.200 2.000000 1.00 5.600 2.00 −29.000 2.000008 2.599108 −0.577252 −0. .565257 −0.200 2.i) u anal(it.200 2.00 −27.800 2.617898 2.000000 −0.000001 2.000 2.000011 2.212 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 12.i) 3.800 2. 1.000 2.000 2.i) err(it.000003 . 2.00 −29.000036 0.00 3.00 4. .000000 1.00 1.000000 0.574849 0.000000 1.000031 1.000001 2.000001 2.00 27.00 27.000000 0. .606705 −0. 2.00 28. .000011 0.000002 2.620467 −0.00 29.800 2.597334 0.000001 2.000013 −0.000 2.000010 −0.000007 −0.000071 2.00 −30. .1: (Continued) t x u(it.000001 2.00 28.200 2.000003 −0.00 27.597367 2.000003 2.000012 2. .00 −27.000055 1. .00 1.800 2.000008 −0.605243 0.400 2.000029 2.i) 2.000072 2.000001 2.000000 0.000003 2.000007 2.000004 −0. .617241 2.599010 2. .00 30.606650 2.600 2.00 3.617970 −0.00 −28.000000 2.400 2.00 28.000001 2.i) u anal(it.000000 0.200 2.

620082 −0. Chapter 12 .00 2.000004 2.620467 −0.00 −28. we might start with a = b = 0 in which case.1: (Continued) 3.000 2.621197 2. even after reviewing the code to correct any programming errors. It is quite natural in developing a MOL code to include all of the PDE derivatives.000023 ncall = 166 Table 12.000 2. . (12.000000 0.1) (from Table 12.00 5.00 6.000000 0.00 28.00 27.00 29. .000001 2. we have just the nonlinear advection equation.000039 2. 3.000000 3.00 4.620436 2. and associated ICs and BCs. This PDE has been .585846 0.400 2.00 −27.611632 −0.590046 −0.00 27. . .200 2.613835 −0.00 30.000023 −0.585907 2.000069 . . 3.400 2.000088 −0. The question then is what caused the failed execution.000 2.000003 2.800 2.000000 1.000007 3.000122 0.600 2.00 7.000063 −0.00 28. there can be a series of such terms of varying complexity.000000 2.00 6.400 2. (12.000081 2.621197 2. .800 2.000124 2. this . Kawahara Equation 213 Table 12.00 0. Typically. initial execution of the code might not proceed as expected.000006 3. Unfortunately.000061 3. in the case of eq.621265 −0.000005 3.000031 2.00 7.000002 3.611622 2.1) peak value peak value t x (numerical) (analytical) error 0.600 2.200 2.600 2. .000010 3.200 2.2: Peak values of the solution of eq. .621265 −0.000003 3. .000055 2.600 2. is not obvious.00 −27.000032 −0.000004 .000132 .000028 2. .621302 2. However.620053 2.000113 3.621302 0. To progress past this unsatisfactory result.1).589914 2.000000 0.000029 3.000 2.000045 −0.200 2.000008 3. in most cases.00 6. we suggest an incremental approach to code development.000 2.000069 3.613723 2. For example.

000000 0.000002 2.000000 0.00 1.000000 0.612768 0. .000001 0.000000 0.00 1.620467 −0.400 2.000055 1.000003 0.600 2.400 2.000005 −0.00 1.600 2.00 29.000 2.000 2. .000001 0.000 2.617241 0.000000 0.000001 2. 1.000000 0.3: Abbreviated tabular numerical and analytical solutions for n = 101.000001 2.000000 1.000011 0.i) err(it. .612768 2.400 2. .621302 0.000000 .00 3.000001 0.000000 0.620436 2.000000 1.597334 0. .621302 2.00 30.000002 0.000002 2.000 2. . .800 2.000001 0.000000 0.000001 2.000003 0.00 −27.000001 2. 0.00 −27.000001 2.00 −27.000001 2.612768 0.600 2.000002 0.i) u anal(it. no BCs t x u(it.617241 2.200 2.214 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 12.577185 2.000008 2.000000 0.000001 2.000000 t x u(it.587976 2.00 3.i) err(it. . .000000 1.000000 1.00 −0.606650 2.800 2.00 27. .000000 0.000001 2.000000 0.000 2.612768 2.00 −30.000001 2.597367 2.000001 −0.000001 2.200 2.587976 0.i) 0. .000008 0. .00 −29.00 −27.587976 2.000000 0.000001 2.800 2.600 2.000000 1.000002 0.000001 2.000000 0.000011 2.400 2.000067 .00 −28.577252 −0.00 −1.000005 2.00 −29.000000 0.000000 .000 2.00 0.000001 1.200 2.000003 2.00 28.000000 .606705 −0.000031 1.00 −28. . .000002 2.00 27.000000 0. .00 27.i) 1. 1.000033 1.000000 .600 2.000001 0.200 2.800 2.00 28.600 2.000 2. .000 2.00 27.00 0. . .000002 0.000001 0.200 2.00 −28.200 2.587976 0.000001 1.000003 2. .00 28.000000 0.000000 0. 0.00 −30.000 2.000000 1.000001 0.200 2. .00 2.i) u anal(it.000000 0.000002 2.00 −28.600 2.

000003 −0.600 2.800 2.000007 −0.000000 1.000026 0.574849 0.00 3. .000019 0.000000 0.00 6.800 2.00 30.000001 2.611632 −0.000001 2.00 4.000 2.800 2.000000 0.605264 2. . .000004 −0.000000 0.200 2.617970 −0.00 27.i) u anal(it. .00 6.000007 3.613835 −0. . .611622 2. 2.000001 3.00 −28.000021 2. . .621265 −0. . . . .600 2.000002 −0.000003 3.000071 2.000 2.000002 2.000003 2.000000 0.000004 3.i) err(it.000001 2.613722 2.000001 2.000003 2.600 2.000001 2.000004 .000004 2.00 7.000007 2. .00 −27.000021 2.400 2.000099 2.00 28.585846 0.800 2.00 28.000000 0.200 2.00 28.000000 0.000001 3.000001 2.000003 2.000000 0. (Continued ) .000006 t x u(it.000000 2.00 −29. .000001 t x u(it. 2.000 2.00 −30. .000001 2.000000 0.00 29.400 2.i) err(it.000013 2.000000 0.000000 0.400 2.000003 2.605243 0.00 4.200 2.00 7.000000 2.000 2.000 2.000036 0. .00 −30.617898 2.000133 . . 3.620053 2.599010 2.000072 2.600 2.00 6.00 −28.00 −27.000 2.000013 −0.000000 1.620082 −0.000001 2.000001 2. .589914 2.000069 3.00 29.000009 3.800 2.i) u anal(it.000 2.000029 2.400 2.3: (Continued) 1.600 2.000000 2.200 2.i) 2.200 2. Kawahara Equation 215 Table 12.00 27. .00 −29.585907 2.590046 −0.565257 −0.000004 2.000000 0. Chapter 12 .000001 2.000000 .599108 −0.574920 2.000 2.000113 3.00 −28.000029 2.00 30.00 5.000 2.000001 2.i) 3.800 2. .400 2.000003 2.00 −28.400 2.000001 2.000039 2.000107 .000009 2.000061 3.00 3.00 5.565150 2.000010 −0.00 −27.621197 2.

000009 3.00 29.i) u anal(it.00 6.200 2.800 2. a solution might be attempted with “small” (nonzero) a and b = 0.613723 2.000061 3.400 2. the code might fail. If this is successful.00 5.000 2.000000 3.621265 −0. and we know that solutions can be computed.621197 2.00 7. . Then.613835 −0.m With two Dirichlet BCs in pde 1 (from Table 12.590046 −0.000023 −0.585846 0.000023 ncall = 162 Table 12.00 28.000045 0.000010 3.600 2.00 7.000088 0. At some point along this incremental development.590046 −0.000001 2.611632 −0. value. then a might be increased (incrementally) to its final .200 2. (12. the solutions are not what we require (they are not for eq.800 2.589914 2. In other words.585846 0. (desired) value.000069 3. If success in computing a numerical solution continues.400 2.m (from Table 12.613722 2.00 27.00 6.611622 2.000061 3.000045 2.i) 3.000063 0.4: Comparison of the tabular output for n = 101.200 2.000 2.3) 3. but this is a start.000097 2.000113 3. with and without BCs in pde 1.800 2. we will know the latest change that produced the failure and therefore have some indication of the source of the problem (such as the last change that was made). but at least.585907 2.00 6.00 28. then b might be changed to a “small” (nonzero) value and increased (assuming continuing success) to its desired .000034 2.000113 3.2) 3.00 27. Of course.00 7.000130 2.400 2.000 2.000009 3.00 6.600 2.000122 0.216 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 12.611632 −0. this will be a small departure from the case of the nonlinear advection equation.00 7.000007 3.621265 −0.585907 2.3: (Continued) t x u(it.613835 −0.000133 thoroughly studied (as discussed in Chapter 2).000002 3.000 2.611622 2. .i) err(it.000032 0.000069 3.600 2.000008 3.000070 2.1)).00 30.621197 2.00 5.589914 2.000132 Without BCs in pde 1.

the following main program computes a third derivative of polynomials of various orders. end % % Compute FD approximation for up to and including the mth % derivative m=3. then add a second PDE. (12. equally spaced grid for i=1:9 x(i)=i-1. start with one PDE with a known solution (and use constant solutions for the other PDEs). A way to view this incremental approach is to consider it as a form of continuation in which the solution to the initial problem such as the nonlinear advection equation is con- tinued (or extended) to the solution of interest (for eq. Appendix 1 In the preceding discussion. third-.1)) by small parameter changes (slowly increasing a and b).m to the differentiation of polynomials. this process is not necessarily straightforward with a priori assurance of success. Chapter 12 .g.1).. we illustrate this process by differ- entiation of some polynomials. Clearly. starting with second-. For this purpose. Kawahara Equation 217 . but it is offered as a way to gain some insight into why a prototype MOL code fails and to suggest what alternative approaches might lead to a successful code development. e. clear all clc % % Default points.m and u5x11p. In the case of eq. and fourth-order polynomials. Experience has demonstrated that this form of continuation can often proceed from a starting problem to the final problem of interest (rather than attempting the final problem at the beginning). nd=ng. This idea can also be applied to systems of PDEs. (12. The preceding discussion of an incremental approach is general but admittedly also rather vague. Here. % % Compute weighting coefficients for finite differences % over ip points for ip=1:ng % . we briefly considered the application of u3x9p. etc. experience has indicated that the inclusion of higher-order spatial derivatives often increases the likelihood of a computational failure and therefore including the higher-order derivative incrementally (by increasing b) can reveal a sensitivity that must then somehow be remedied. % % Number of grid points ng=9. The chance of success of this approach is clearly going to depend on the problem.

end % size(C3) % % Display coefficients for derivative of order 3 % i=m+1. for irow=1:ng uxxx=0. term=0.. fprintf('\n %4d%11.5f%14. % fprintf('\n\n Numerical Derivative Order: %d'.icol..uxxxe).i-1). for i=1:ng x(i)=(i-1)*dx. xl=0.:.0/dxˆ3. % % Coefficients with m = 3..218 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS % Weighting coefficients in array C3 C3(ip. end p3(i)=term. for i=1:ng x(i)=(i-1)*dx. dx=(xu-xl)/(ng-1).4)*p2(icol). for ip=1:4 term=term+a(ip)*x(i)ˆ(ip-1).x(irow). dx=(xu-xl)/(ng-1). end fprintf('\n\n'). end % % Differentiate second order polynomial fprintf('\n Third derivative of second order polynomial\n'). % % Third order polynomial a=ones(1. ng = 9 % C3(:. for icol=1:ng uxxx=uxxx+rdx3*C3(irow.nd-1. % xu=2.x.3f%15.uxxx.5f%16. % fprintf('\n=============================\n'). irow. rdx3=1.:. end % % Differentiate third order polynomial . % % Second order polynomial a=ones(1.0/dxˆ3.4). end uxxxe=0.4) % % Grid in x xu=1.5f'. fprintf(' irow x(irow) p2(irow) uxxx(irow) uxxxe(irow)').p2(irow). for ip=1:3 term=term+a(ip)*x(i)ˆ(ip-1).3). xl=0. term=0. end p2(i)=term.m).:)=weights(x(ip). rdx3=1.ng-1.

end % % Differentiate fourth order polynomial fprintf('\n Third derivative of fourth order polynomial\n'). for i=1:ng x(i)=(i-1)*dx. Kawahara Equation 219 fprintf('\n Third derivative of third order polynomial\n').4)*p4(icol).uxxx. fprintf(' irow x(irow) p3(irow) uxxx(irow) uxxxe(irow)'). for ip=1:5 term=term+a(ip)*x(i)ˆ(ip-1). end uxxxe=3*2*1+4*3*2*x(irow). for irow=1:ng uxxx=0.uxxxe). % % Fourth order polynomial a=ones(1.m for the third-order derivative of polynomials of varying order. The input parameters to routine weights are defined numerically. a uniform grid of nine points is defined. irow. % % Compute FD approximation for up to and including the mth ..5f'.x(irow).3f%15.5).x(irow)..5f%16.uxxxe).5f%14. We can note the following points about u3x poly.p3(irow). for irow=1:ng uxxx=0.. Chapter 12 . term=0. equally spaced grid for i=1:9 x(i)=i-1.6: Main program u3x poly.icol. for icol=1:ng uxxx=uxxx+rdx3*C3(irow. end fprintf('\n\n'). fprintf('\n %4d%11. for icol=1:ng uxxx=uxxx+rdx3*C3(irow.4)*p3(icol). end fprintf('\n\n').. After clearing files. LISTING 12. clear all clc % % Default points.. end uxxxe=3*2*1. end .m: .uxxx.5f%16.5f%14.3f%15. fprintf('\n %4d%11.5f'. end p4(i)=term..p4(irow). irow.icol. fprintf(' irow x(irow) p4(irow) uxxx(irow) uxxxe(irow)').

220 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS

% derivative

m=3;

%

% Number of grid points

ng=9;

nd=ng;

**. The FD weighting coefficients are computed by weights. Note that the output
**

statements for C3 are deactivated (commented) to conserve space in the output. If

they are activated (uncommented), they will display the 9 × 9 array of FD coefficients.

%

% Compute weighting coefficients for finite differences

% over ip points

for ip=1:ng

%

% Weighting coefficients in array C3

C3(ip,:,:)=weights(x(ip),x,ng-1,nd-1,m);

end

% size(C3)

%

% Display coefficients for derivative of order 3

% i=m+1;

% fprintf('\n\n Numerical Derivative Order: %d',i-1);

% fprintf('\n=============================\n');

%

% Coefficients with m = 3, ng = 9

% C3(:,:,4)

. A second-order polynomial, p2 (x),

p2 (x) = a0 + a1 x + a2 x2 (12.3)

**is defined (p2(i)). Note that Matlab does not permit a zero subscript for use in the first
**

polynomial coefficient, a0 . Also, the three polynomial coefficients are set to one with

the Matlab ones utility, but the conclusions to follow apply to any second-order

polynomial.

%

% Grid in x

xu=1; xl=0; dx=(xu-xl)/(ng-1); rdx3=1.0/dxˆ3;

% xu=2; xl=0; dx=(xu-xl)/(ng-1); rdx3=1.0/dxˆ3;

%

% Second order polynomial

a=ones(1,3);

for i=1:ng

x(i)=(i-1)*dx;

term=0;

for ip=1:3

term=term+a(ip)*x(i)ˆ(ip-1);

end

p2(i)=term;

end

Chapter 12 . Kawahara Equation 221

**. The second-order polynomial is then differentiated by multiplication by the matrix of
**

FD weighting coefficients, C3 (to produce the third-order derivative uxxx).

%

% Differentiate second order polynomial

fprintf('\n Third derivative of second order polynomial\n');

fprintf(' irow x(irow) p2(irow) uxxx(irow) uxxxe(irow)');

for irow=1:ng

uxxx=0;

for icol=1:ng

uxxx=uxxx+rdx3*C3(irow,icol,4)*p2(icol);

end

uxxxe=0;

fprintf('\n %4d%11.3f%15.5f%16.5f%14.5f',...

irow,x(irow),p2(irow),uxxx,uxxxe);

end

fprintf('\n\n');

**The exact third-order derivative, uxxxe, is also set (the third-order derivative of a
**

second-order polynomial is zero). The exact and numerical third derivatives are then

displayed for comparison. The output follows.

Third derivative of second order polynomial

irow x(irow) p2(irow) uxxx(irow) uxxxe(irow)

1 0.000 1.00000 0.00000 0.00000

2 0.125 1.14063 0.00000 0.00000

3 0.250 1.31250 0.00000 0.00000

4 0.375 1.51563 0.00000 0.00000

5 0.500 1.75000 -0.00000 0.00000

6 0.625 2.01563 -0.00000 0.00000

7 0.750 2.31250 0.00000 0.00000

8 0.875 2.64063 -0.00000 0.00000

9 1.000 3.00000 -0.00000 0.00000

**. The exact and numerical third-order derivatives are in agreement.
**

The third derivative of a third-order polynomial, p3(i), is then programmed in the

same way as for a second-order polynomial.

%

% Third order polynomial

a=ones(1,4);

for i=1:ng

x(i)=(i-1)*dx;

term=0;

for ip=1:4

term=term+a(ip)*x(i)ˆ(ip-1);

end

p3(i)=term;

end

%

% Differentiate third order polynomial

fprintf('\n Third derivative of third order polynomial\n');

fprintf(' irow x(irow) p3(irow) uxxx(irow) uxxxe(irow)');

for irow=1:ng

uxxx=0;

222 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS

for icol=1:ng

uxxx=uxxx+rdx3*C3(irow,icol,4)*p3(icol);

end

uxxxe=3*2*1;

fprintf('\n %4d%11.3f%15.5f%16.5f%14.5f',...

irow,x(irow),p3(irow),uxxx,uxxxe);

end

fprintf('\n\n');

**The output from this code is
**

Third derivative of third order polynomial

irow x(irow) p3(irow) uxxx(irow) uxxxe(irow)

1 0.000 1.00000 6.00000 6.00000

2 0.125 1.14258 6.00000 6.00000

3 0.250 1.32813 6.00000 6.00000

4 0.375 1.56836 6.00000 6.00000

5 0.500 1.87500 6.00000 6.00000

6 0.625 2.25977 6.00000 6.00000

7 0.750 2.73438 6.00000 6.00000

8 0.875 3.31055 6.00000 6.00000

9 1.000 4.00000 6.00000 6.00000

**As expected, the numerical and exact derivatives agree (the third derivative of a
**

third-order polynomial is (3)(2)(1)a3 and in this case, a3 = 1).

. The third derivative of a fourth-order polynomial, p4(i), is then programmed in the

same way as for the second- and third-order polynomials.

%

% Fourth order polynomial

a=ones(1,5);

for i=1:ng

x(i)=(i-1)*dx;

term=0;

for ip=1:5

term=term+a(ip)*x(i)ˆ(ip-1);

end

p4(i)=term;

end

%

% Differentiate fourth order polynomial

fprintf('\n Third derivative of fourth order polynomial\n');

fprintf(' irow x(irow) p4(irow) uxxx(irow) uxxxe(irow)');

for irow=1:ng

uxxx=0;

for icol=1:ng

uxxx=uxxx+rdx3*C3(irow,icol,4)*p4(icol);

end

uxxxe=3*2*1+4*3*2*x(irow);

fprintf('\n %4d%11.3f%15.5f%16.5f%14.5f',...

irow,x(irow),p4(irow),uxxx,uxxxe);

end

fprintf('\n\n');

Chapter 12 . Kawahara Equation 223

The output from this code is

**Third derivative of fourth order polynomial
**

irow x(irow) p4(irow) uxxx(irow) uxxxe(irow)

1 0.000 1.00000 6.00000 6.00000

2 0.125 1.14282 9.00000 9.00000

3 0.250 1.33203 12.00000 12.00000

4 0.375 1.58813 15.00000 15.00000

5 0.500 1.93750 18.00000 18.00000

6 0.625 2.41235 21.00000 21.00000

7 0.750 3.05078 24.00000 24.00000

8 0.875 3.89673 27.00000 27.00000

9 1.000 5.00000 30.00000 30.00000

**The numerical and exact derivatives agree (the third derivative of a fourth-order
**

polynomial is a linear function in x, that is, (3)(2)(1)a3 + (4)(3)(2)a4 x and in this case,

a4 = 1, a4 = 1).

The preceding results imply that the numerical third derivative is exact for polyno-

mials up to fourth order. In fact, it is exact for polynomials up to eighth order. This is

demonstrated by the following extensions to the preceding code. The third derivative of

a seventh-order polynomial, p7(i), is computed as

%

% Seventh order polynomial

a=ones(1,8);

for i=1:ng

x(i)=(i-1)*dx;

term=0;

for ip=1:8

term=term+a(ip)*x(i)ˆ(ip-1);

end

p7(i)=term;

end

%

% Differentiate seventh order polynomial

fprintf('\n Third order derivative of seventh order polynomial\n');

fprintf(' irow x(irow) p7(irow) uxxx(irow) uxxxe(irow)');

for irow=1:ng

uxxx=0;

for icol=1:ng

uxxx=uxxx+rdx3*C3(irow,icol,4)*p7(icol);

end

uxxxe=3*2*1+4*3*2*x(irow) +5*4*3*x(irow)ˆ2 ...

+6*5*4*x(irow)ˆ3+7*6*5*x(irow)ˆ4;

fprintf('\n %4d%11.3f%15.5f%16.5f%14.5f',...

irow,x(irow),p7(irow),uxxx,uxxxe);

end

fprintf('\n\n');

224 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS

**The output from this code is
**

Third order derivative of seventh order polynomial

irow x(irow) p7(irow) uxxx(irow) uxxxe(irow)

1 0.000 1.00000 6.00000 6.00000

2 0.125 1.14286 10.22314 10.22314

3 0.250 1.33331 18.44531 18.44531

4 0.375 1.59937 33.91846 33.91846

5 0.500 1.99219 61.12500 61.12500

6 0.625 2.60458 105.77783 105.77783

7 0.750 3.59955 174.82031 174.82031

8 0.875 5.25113 276.42627 276.42627

9 1.000 8.00000 420.00000 420.00000

**so that the numerical and exact derivatives agree.
**

The third derivative of an eighth-order polynomial, p8(i), is computed as

%

% Eighth order polynomial

a=ones(1,9);

for i=1:ng

x(i)=(i-1)*dx;

term=0;

for ip=1:9

term=term+a(ip)*x(i)ˆ(ip-1);

end

p8(i)=term;

end

%

% Differentiate eighth order polynomial

fprintf('\n Third order derivative of eighth order polynomial\n');

fprintf(' irow x(irow) p8(irow) uxxx(irow) uxxxe(irow)');

for irow=1:ng

uxxx=0;

for icol=1:ng

uxxx=uxxx+rdx3*C3(irow,icol,4)*p8(icol);

end

uxxxe=3*2*1+4*3*2*x(irow) +5*4*3*x(irow)ˆ2 ...

+6*5*4*x(irow)ˆ3+7*6*5*x(irow)ˆ4 ...

+8*7*6*x(irow)ˆ5;

fprintf('\n %4d%11.3f%15.5f%16.5f%14.5f',...

irow,x(irow),p8(irow),uxxx,uxxxe);

end

fprintf('\n\n');

**The output from this code is
**

Third order derivative of eighth order polynomial

irow x(irow) p8(irow) uxxx(irow) uxxxe(irow)

1 0.000 1.00000 6.00000 6.00000

2 0.125 1.14286 10.23340 10.23340

3 0.250 1.33333 18.77344 18.77344

4 0.375 1.59977 36.41016 36.41016

5 0.500 1.99609 71.62500 71.62500

Chapter 12 . Kawahara Equation 225

**6 0.625 2.62786 137.82129 137.82129
**

7 0.750 3.69966 254.55469 254.55469

8 0.875 5.59474 448.76367 448.76367

9 1.000 9.00000 756.00000 756.00000

**so that the numerical and exact derivatives agree.
**

Finally, the third derivative of a ninth-order polynomial, p9(i), is computed as

%

% Ninth order polynomial

a=ones(1,10);

for i=1:ng

x(i)=(i-1)*dx;

term=0;

for ip=1:10

term=term+a(ip)*x(i)ˆ(ip-1);

end

p9(i)=term;

end

%

% Differentiate ninth order polynomial

fprintf('\n Third order derivative of ninth order polynomial\n');

fprintf(' irow x(irow) p9(irow) uxxx(irow) uxxxe(irow)');

for irow=1:ng

uxxx=0;

for icol=1:ng

uxxx=uxxx+rdx3*C3(irow,icol,4)*p9(icol);

end

uxxxe=3*2*1+4*3*2*x(irow) +5*4*3*x(irow)ˆ2 ...

+6*5*4*x(irow)ˆ3+7*6*5*x(irow)ˆ4 ...

+8*7*6*x(irow)ˆ5+9*8*7*x(irow)ˆ6;

fprintf('\n %4d%11.3f%15.5f%16.5f%14.5f',...

irow,x(irow),p9(irow),uxxx,uxxxe);

end

fprintf('\n\n');

**The output from this code is
**

Third order derivative of ninth order polynomial

irow x(irow) p9(irow) uxxx(irow) uxxxe(irow)

1 0.000 1.00000 3.29636 6.00000

2 0.125 1.14286 10.23679 10.23532

3 0.250 1.33333 18.92679 18.89648

4 0.375 1.59991 37.79013 37.81174

5 0.500 1.99805 79.51877 79.50000

6 0.625 2.64241 167.84042 167.86203

7 0.750 3.77475 344.28616 344.25586

8 0.875 5.89540 674.95798 674.95651

9 1.000 10.00000 1257.29636 1260.00000

**so that the numerical and exact derivatives do not agree. The preceding results imply
**

that the third-order FD differentiation is exact for polynomials up to and including eighth

order.

226 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS

**Before we go on to consider some additional cases, we first consider the operation of
**

the nested for loops that perform the numerical differentiation through the use of C3. For

example, the third-order differentiation of a third-order polynomial was programmed as

%

% Differentiate third order polynomial

fprintf('\n Third derivative of third order polynomial\n');

fprintf(' irow x(irow) p3(irow) uxxx(irow) uxxxe(irow)');

for irow=1:ng

uxxx=0;

for icol=1:ng

uxxx=uxxx+rdx3*C3(irow,icol,4)*p3(icol);

end

uxxxe=3*2*1;

fprintf('\n %4d%11.3f%15.5f%16.5f%14.5f',...

irow,x(irow),p3(irow),uxxx,uxxxe);

end

fprintf('\n\n');

**Basically, the inner for loop on icol produces one row from a matrix multiplication
**

between the vector p3(icol) and the matrix C3(irow,icol,4). The outer for loop on

irow then produces the nine rows (ng=9) of the matrix–vector product. In other words, the

two nested for loops produce the following matrix equation (for nine points).

d3 p3 (x0 )

dx3

C3 (1, 1, 4)p3 (x0 ) + C3 (1, 2, 4)p3 (x1 ) ··· + C3 (1, 9, 4)p3 (x8 )

d3 p (x )

3 1

3

C3 (2, 1, 4)p3 (x0 ) + C3 (2, 2, 4)p3 (x1 ) ··· + C3 (2, 9, 4)p3 (x8 )

dx

.. ..

.

=

.

(12.4)

d p3 (x7 ) C3 (8, 1, 4)p3 (x0 ) + C3 (8, 2, 4)p3 (x1 )

3

+ C3 (8, 9, 4)p3 (x8 )

···

dx3

C3 (9, 1, 4)p3 (x0 ) + C3 (9, 2, 4)p3 (x1 ) + C3 (9, 9, 4)p3 (x8 )

d3 p3 (x8 ) ···

dx3

**Note that the use of the third index as 4 in C3(irow,jcol,4) corresponds to the third
**

derivative, since the index 1 corresponds to the function p3 (x), and the indices 2, 3, and 4

correspond to the first-, second-, and third-order derivatives, respectively, as explained

previously.

Also, we can easily look at the FD weighting coefficients (by activating the line C3(:,:,4)

in the preceding code). The result is the 9 × 9 matrix, which is listed below.

-10.0125 58.1667 -152.9417 239.1000 -242.8333 163.0333 -70.1250 17.5667 -1.9542

-1.9542 7.5750 -12.1833 11.2083 -7.1250 3.3917 -1.1167 0.2250 -0.0208

-0.0208 -1.7667 6.8250 -10.4333 8.5833 -4.5000 1.6417 -0.3667 0.0375

0.0375 -0.3583 -0.4167 3.6750 -5.7083 3.8583 -1.3500 0.2917 -0.0292

-0.0292 0.3000 -1.4083 2.0333 -0.0000 -2.0333 1.4083 -0.3000 0.0292

Chapter 12 . Kawahara Equation 227

**0.0292 -0.2917 1.3500 -3.8583 5.7083 -3.6750 0.4167 0.3583 -0.0375
**

-0.0375 0.3667 -1.6417 4.5000 -8.5833 10.4333 -6.8250 1.7667 0.0208

0.0208 -0.2250 1.1167 -3.3917 7.1250 -11.2083 12.1833 -7.5750 1.9542

1.9542 -17.5667 70.1250 -163.0333 242.8333 -239.1000 152.9417 -58.1667 10.0125

**The fifth row is used in function u3xp9.m of Listing 12.4 through the code
**

uxxx(i)=rdx3*...

(C3(5,1,4)*u(i-4)...

+C3(5,2,4)*u(i-3)...

+C3(5,3,4)*u(i-2)...

+C3(5,4,4)*u(i-1)...

+C3(5,5,4)*u(i )...

+C3(5,6,4)*u(i+1)...

+C3(5,7,4)*u(i+2)...

+C3(5,8,4)*u(i+3)...

+C3(5,9,4)*u(i+4));

**so that, for example, C3(5,1,4) = -0.0292, C3(5,5,4) = 0, C3(5,9,4) = 0.0292.
**

The first to fourth rows and sixth to ninth are not used in u3x9p.m, as explained previously

(the derivative uxxx is set to zero).

The above 9 × 9 matrix used in the matrix–vector multiplication to produce the nine-

point FD approximations is an example of a differentiation matrix. The elements of a

differentiation matrix can be selected to produce FD approximations of varying orders for

derivatives of varying orders, including approximations for boundary conditions [4, 10].

The FD approximations over nine points are actually eighth-order correct, so they will

compute the numerical eighth-order derivative of an eighth-order polynomial exactly (and

we demonstrated previously that they compute a third-order derivative of an eighth-order

polynomial exactly). We can demonstrate this conclusion (the FDs are eighth-order cor-

rect) by executing the preceding code for the eighth-order derivative of a seventh-, eighth-,

and ninth-order polynomial. This requires an easy modification of the preceding code.

clear all

clc

%

% Default points, equally spaced grid

for i=1:9

x(i)=i-1;

end

%

% Compute FD approximation for up to and including the mth

% derivative

m=8;

%

% Number of grid points

ng=9;

nd=ng;

%

% Compute weighting coefficients for finite differences

% over ip points

dx=(xu-xl)/(ng-1). ng = 9 % C8(:.:)=weights(x(ip).m). for i=1:ng x(i)=(i-1)*dx. end % size(C8) % % Display coefficients for derivative of order 8 % i=m+1. % % Eighth order polynomial a=ones(1.3f%15.ng-1.p7(irow). rdx8=1.x.9)*p7(icol).:.i-1). end p8(i)=term. for icol=1:ng u8x=u8x+rdx8*C8(irow. fprintf('\n %4d%11. irow.nd-1.5f%14. % fprintf('\n\n Numerical Derivative Order: %d'.5f%16. end % % Differentiate seventh order polynomial fprintf('\n Eighth order derivative of seventh order polynomial\n').u8xe).5f'. % % Seventh order polynomial a=ones(1. for i=1:ng x(i)=(i-1)*dx. xl=0. end u8xe=0. fprintf(' irow x(irow) p7(irow) u8x(irow) u8xe(irow)'). term=0. for ip=1:8 term=term+a(ip)*x(i)ˆ(ip-1).9) % % Grid in x xu=1.9).:. end fprintf('\n\n'). % % Coefficients with m = 8. for ip=1:9 term=term+a(ip)*x(i)ˆ(ip-1).icol. end p7(i)=term.u8x. end % . % fprintf('\n=============================\n').228 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS for ip=1:ng % % Weighting coefficients in array C8 C8(ip.0/dxˆ8. for irow=1:ng u8x=0... term=0.8)..x(irow).

u8x. fprintf('\n %4d%11.625 2. for icol=1:ng u8x=u8x+rdx8*C8(irow.icol.00000 3 0.x(irow).14286 0.00000 9 1.00000 0.00000 7 0.icol. end u8xe=8*7*6*5*4*3*2*1+9*8*7*6*5*4*3*2*x(irow). for irow=1:ng u8x=0.. end p9(i)=term. % % Ninth order polynomial a=ones(1.p8(irow).00000 8 0..000 8.5f%16.3f%15.00000 2 0. Chapter 12 . for icol=1:ng u8x=u8x+rdx8*C8(irow. end u8xe=8*7*6*5*4*3*2*1.p9(irow). term=0.00000 6 0. for i=1:ng x(i)=(i-1)*dx..875 5.250 1. fprintf(' irow x(irow) p9(irow) u8x(irow) u8xe(irow)'). for irow=1:ng u8x=0..750 3.99219 0.00000 0.x(irow).9)*p8(icol).00000 4 0.33331 0. end fprintf('\n\n'). irow. for ip=1:10 term=term+a(ip)*x(i)ˆ(ip-1).59955 0.u8xe)..5f'.3f%15..u8xe).9)*p9(icol).00000 .00000 0.5f%14. irow.375 1. Kawahara Equation 229 % Differentiate eighth order polynomial fprintf('\n Eighth order derivative of eighth order polynomial\n').00000 5 0.5f%14.000 1. fprintf(' irow x(irow) p3(irow) u8x(irow) u8xe(irow)').00000 0.00000 0.59937 0.00000 0.00000 0.60458 0.5f%16.25113 0.00000 0.u8x. fprintf('\n %4d%11.00000 0. The numerical output from this code is Eighth order derivative of seventh order polynomial irow x(irow) p7(irow) u8x(irow) u8xe(irow) 1 0.500 1.00000 0.10). end fprintf('\n\n').125 1.00000 0.5f'. end % % Differentiate ninth order polynomial fprintf('\n Eighth order derivative of ninth order polynomial\n').

00000 This output implies the nine-point.000 9.00000 40320. FD third derivative of this function is programmed as follows.99609 40320.375 1.125 1.000 1.00000 3 0.00000 5 0. We could perform a similar analysis for the fifth-order FD differentiation in u5x11p.00000 312480.2)).00000 7 0.375 1.14286 40320.000 10.00000 403200. equally spaced grid for i=1:9 x(i)=i-1.33333 40320. exact for polynomials up to and including eighth order. Finally.33333 221760.00000 5 0. eighth-order FD differentiation is eighth-order correct. if we consider the function f (x) = ex (12.00000 40320.00000 7 0.500 1.750 3.00000 357840.250 1. and also.64241 221760.77475 221760. fifth-order differentiation is tenth order correct.00000 8 0.59977 40320.00000 2 0.000 1.00000 176400. (12.00000 6 0. clear all clc % % Default points.00000 4 0.00000 40320. PDEs in general do not have polynomials as solutions (consider eq. i. end the discussion with a brief consider- ation of the accuracy of FD differentiation when applied to nonpolynomial functions.00000 2 0.00000 131040.69966 40320.99805 221760.00000 40320. tenth-order FD differentiation is tenth-order correct.250 1.00000 40320.00000 6 0.00000 40320.875 5. the discussion to this point has been entirely about the order (accuracy) of FD differentiation applied to polynomials.00000 40320.125 1.62786 40320. However.59991 221760..00000 221760.00000 40320.00000 85680.59474 40320.00000 3 0. the 11-point.625 2.5) The nine-point.00000 9 1.500 1.875 5. We.00000 221760. end % % Compute FD approximation for up to and including the mth .00000 40320.230 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Eighth order derivative of eighth order polynomial irow x(irow) p3(irow) u8x(irow) u8xe(irow) 1 0.750 3. For example.e. therefore.00000 40320.e.m and would come to the conclusion that the 11-point.00000 8 0.00000 40320.. exact for polynomials up to and including tenth order.00000 221760.00000 4 0.89540 221760.14286 221760.625 2.00000 9 1.00000 40320.00000 267120. i.00000 Eighth order derivative of ninth order polynomial irow x(irow) p9(irow) u8x(irow) u8xe(irow) 1 0.

i-1). irow. fprintf(' irow x(irow) exp(irow) uxxx(irow) uxxxe(irow)').5f'.expx(irow). % % Compute weighting coefficients for finite differences % over ip points for ip=1:ng % % Weighting coefficients in array C3 C3(ip.m in Listing 12.4) % % Grid in x xu=1.:.6.nd-1. dx=(xu-xl)/(ng-1).4)*expx(icol).icol.:)=weights(x(ip). We can note the following details about this code: .ng-1. Chapter 12 . % fprintf('\n=============================\n').3f%16. ng = 9 % C3(:.. % % Exponential for i=1:ng x(i)=(i-1)*dx. fprintf('\n %4d%11. end % size(C3) % % Display coefficients for derivative of order 3 % i=m+1. for irow=1:ng uxxx=0. end % % Differentiate exponential fprintf('\n Exponential\n'). end uxxxe=expx(irow).uxxxe).7: Main program u3x exp. % % Number of grid points ng=9. expx(i)=exp(x(i)).x. rdx3=1. . end fprintf('\n\n'). LISTING 12.5f%16.m). The first part up to the call to weights to compute the FD coefficients is the same as in u3x poly.. for icol=1:ng uxxx=uxxx+rdx3*C3(irow.0/dxˆ3.x(irow).m for the third-order derivative of an exponential. % % Coefficients with m = 3. Kawahara Equation 231 % derivative m=3.5f%14. % fprintf('\n\n Numerical Derivative Order: %d'.uxxx.:. xl=0.. nd=ng.

expx(i)=exp(x(i)).86825 1.39888 2. for icol=1:ng uxxx=uxxx+rdx3*C3(irow. we could conclude that FD differentiation of the exponential function is not exact. This is not correct. fprintf('\n %4d%11.28403 1.00000 0.3f%16.45499 5 0.375 1.39888 9 1.5f%16.39888 2.86825 7 0. Rather.250 1. fprintf(' irow x(irow) exp(irow) uxxx(irow) uxxxe(irow)').5f'.86825 1.11700 8 0.5) has a small enough variation in x that the FD differentiation appears to be exact.x(irow). differences between the numerical (FD) and exact derivatives would be .125 1. The test function of eq..71827 2. for irow=1:ng uxxx=0.71828 .64872 6 0. These results could lead us to the conclusion that the FD differentiation is exact for exponential functions.71828 2.13315 1. One way to explore this point is to consider the exponential function to be a polynomial of infinite order through its Taylor series ex = 1 + x/1! + x2 /2! + · · · (12.expx(irow).13315 3 0. but if more figures were displayed.uxxxe).6) Since the preceding discussion indicated that FD differentiation is exact only up to a given polynomial of finite order.875 2.uxxx.5) is programmed and differentiated as % % Exponential for i=1:ng x(i)=(i-1)*dx.11700 2..5f%14.99999 1. however.64872 1.64872 1. the numerical output is explained by realizing the exponential function of eq. The output from this code is Exponential irow x(irow) exp(irow) uxxx(irow) uxxxe(irow) 1 0. end uxxxe=expx(irow).11700 2.750 2. end fprintf('\n\n'). irow.000 1.000 2. (12.625 1.00000 2 0.28403 1.4)*expx(icol). (12. even though the previous numerical output suggests otherwise.232 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS .13315 1.45499 1.45499 1. end % % Differentiate exponential fprintf('\n Exponential\n').28403 4 0..500 1.icol. This is a correct conclusion.

expx(i)=exp(a*x(i)).m in Listing 12. end % % Differentiate exponential fprintf('\n Exponential\n').x(irow).uxxxe).29287 4 0. x(irow)=1.. the numerical and exact derivatives do not agree. uxxxe=a3 *expx(irow).750 42. Now the exact derivative.41316 18273.49034 438. we take a=5 in the following code (at the end of the u3x exp. In the case of the routine weights. for icol=1:ng uxxx=uxxx+rdx3*C3(irow.17727 1522. Chapter 12 .icol.. we consider the exponential function f (x) = eax (12.000). Kawahara Equation 233 observed (note the difference in the numerical and exact derivatives for . end fprintf('\n\n').46213 5315.62459 18551..125 1.625 22.52108 5317.7) then select a to give the exponential function a greater variation in x.97994 9 1.10239 5 0.35065 2844. fprintf(' irow x(irow) exp(irow) uxxx(irow) uxxxe(irow)'). for i=1:ng x(i)=(i-1)*dx.36612 436. The output from this code is Exponential irow x(irow) exp(irow) uxxx(irow) uxxxe(irow) 1 0.expx(irow). fprintf('\n %4d%11.7) % % Exponential a=5.5f%16.43984 9931. irow.250 3. The fact that it is exact for polynomials of limited order is to be expected when we realize that the FD approximations are based on polynomials.18249 1524.59196 815. This result provides an example indicating that FD differentiation is generally not exact. a Lagrange interpolation polynomial was used by Fornberg [3].64489 Clearly.5f'.33615 9929.500 12.4)*expx(icol).03952 233.98689 7 0.43268 125.81175 6 0.375 6.00000 -25. For this purpose.5f%14. also has a larger variation in x than for a=1. To explore this possible explanation.53074 3 0.52082 813. for irow=1:ng uxxx=0.75990 2843.86825 233.00000 2 0.000 148.875 79.uxxx.13525 8 0. This suggests that an . end uxxxe=aˆ3*expx(irow).000 1.3f%16.

and water waves with surface tension [13]. e. approximations for derivatives do not have to be based on polynomials. One of the things we notice about eq. third derivative FDs in u3xp9.. which is relative to polynomials. In summary. We will illustrate these concepts by example and show how they relate to the Kawahara equation.m and the FD fifth-derivative approximations ∂ 3u ∂ 5u in u5x11p.m are eighth-order correct. some trial and error is required in the development of a PDE solution. the nine-point. we have considered the accuracy of the approximations in these two rou- tines in terms of their order.234 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS increase in the number of points on which the FD approximation is based will increase the order of the approximation (since a higher-order polynomial will be the basis for the FD approximation). and other approaches to derivative approximations such as spectral methods have been exten- sively developed and used. which we repeat below for convenience. Let us first consider a linearized form of the Korteweg-de Vries (KdV) equation ∂u ∂u ∂ 3 u + + =0 (12.8) is that it contains only odd derivatives. Typically. the intent of this discussion in Appendix 1 is to elaborate on the FD third-derivative approximations in u3xp9. (12.8) ∂t ∂x ∂x ∂x was derived in order to obtain higher-order dispersive equations as corrections to the KdV equation [7]. (12. a medium can be characterized as being dispersive or dissipative. ∂x3 ∂x5 Specifically. waves propagating in a system described by linear PDEs consisting entirely of odd derivatives.g. and we have presented one possible approach. Systems described by PDEs with both odd and even (with appropriate signs). and in eq. long waves under ice cover in liquids of finite depth [5].1). exhibit both dispersion and dissipation.m used to calculate the third and fifth derivatives. exhibit dispersion. and our intent within this context is to demonstrate how approximations of various orders (again. but not always.9) ∂t ∂x ∂x3 . However. It describes propagation of signals in electric transmission lines [1]. they differentiate eighth-order polynomials exactly. with at least one being a third or higher derivative. The degree of dispersion or dissipation is usually determined by the medium in which the wave propagates. Appendix 2 The Kawahara equation. Conse- quently. 12. relative to polynomials) for derivatives of various orders can be implemented within the MOL format. Thus. Usually.1. we have presented only one approach based on FDs. ∂u ∂u ∂ 3u ∂ 5u +u +a 3 −b 5 = 0 (12.order derivatives gen- erally. that is.

. However. i. we have cp = ω/k. which means that a wave packet or the wave envelope will move at a velocity different from the individual harmonic phase velocities from which it is com- posed. this results in higher- frequency components traveling at slower speeds than the lower-frequency components. (12. (12..9). cg = d< (ω) /dk.e. k = 2π/λ). t) = u kx − ct . we observe that the speed of propagation of a single harmonic wave varies according to the wavenumber k. Generally. Kawahara Equation 235 and assume that it has a pure harmonic solution u (x. or shock effects usually exhibit a changing profile over time. we have ∂u ∂u ∂ 2 u ∂ 3 u + + + 3 =0 (12.9) that cp = 1 − k2 . On substituting this solution into eq. cg = 1 − 3k2 . therefore.9).11) The term exp i kx − k − k3 t in eq.10) ∂t ∂x ∂x2 ∂x Then. Thus. ω represents frequency. but with wavenumbers clustered around k [12]. Wave energy and information signals propagate at group velocity. Therefore. which is known as the phase velocity and implies for eq. all frequency components travel at the same speed and therefore we have cg = cp . say second. the term exp −k2 t means that for real . the associated group velocity is given by the derivative of the real part of ω with respect to k. this defines the relationship between frequency and wavenumber. (12. (12. It is assumed that the packet is confined to a finite region of the spatial domain and that it may contain a superposition of many harmonic waves. Thus. our solution becomes u (x.e. For a nondispersive wave. i. In other words. For this example. discontinuity. t) = A exp i kx − (k − k3 )t − k2 t n h io = A exp i kx − (k − k3 )t exp(−k2 t) (12. For wave packets consisting of a group of harmonic waves. If we include an even spatial derivative in eq.11) is a dispersive termand means that the frequency depends upon wavenumber. waves of different frequencies propagate at different phase velocities in a dispersive medium. t) = A exp i kx − ωt . we know that traveling waves are defined by u (x. we obtain ω(k) = k − k3 which is known as the dispersion relation. its dispersion relation becomes ω(k) = k − k3 − ik2 and the harmonic solution is therefore n h i o u (x. Chapter 12 . A situation where waves of different frequencies move at different speeds without a change in amplitude is called dispersion. But. t) = A exp ik x − 1 − k2 t . is that solutions involving sharp gradient. where A represents amplitude. and k represents wavenumber (number of wave lengths λ. The effect of dispersion. from our discussion on traveling waves. where c represents the speed of propagation. in 2π .

Generally.e.e. t). eq. is called dissipation. then the system will also be nondispersive. 6. following the same approach as used above. This is one of the remarkable characteristics of nonlinear partial differential equations that admit soliton solutions.8) leads to ∂ û ∂ û ∂ 3 û ∂ 5 û + U0 +a 3 −b 5 = 0 (12. For a more in-depth discussion relating to dispersion and dissipation. i. 12].. say u (x. A Maple code that derives ω. See also Chapter 18 for some additional discussion on solitons. t) → 0 as t → ∞. we note that if cp = cg .2). i. . u(x.236 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS k 6= 0. a. we see that in addition to exhibiting zero dispersion. from the traveling wave solution to the nonlinear form.13) 2b and would imply ab < 0 for real k. But from the above discussion. Let us now consider a perturbed or small signal form of the Kawahara equation. i. The effect of dissipation. It can be modified easily to derive dispersion relations for other PDEs.. and cg for the Kawahara equation is given in List- ing 12. there is no dissipation. (12. This will be true only if r −a k=± (12. where waves are damped.. Note: odd derivatives in a PDE with real coefficients contribute to the real part of the dispersion relation ω(k).2) and the asso- ciated Fig. (12. readers are referred to [2. t) = U0 + û (x. where û is a small perturbation on a nominal steady-state solution U0 . This latter phenomenon. we set U0 = 0 and. therefore. whereas even derivatives contribute to the imaginary part of ω(k). is that sharp gradients. or shocks in the solution tend to be smoothed over time. Substituting this solution into eq. cp . we obtain ω = −ak3 − bk5 ↓ h i û = A exp ik x − ak2 + bk4 t cp = −k2 a + bk2 cg = −k2 3a + 5bk2 This means that for small amplitude waves and real k.8.e. higher-frequency components of a wave are damped more than lower-frequency components. Now. and b. such as the Kawahara equation. discontinuities. the solution u decays exponentially over time. it also exhibits zero dissipation. Solitons are the result of nonlinear terms in the PDE canceling the nonlinear dispersive effects of the medium in which the traveling waves propagate.12) ∂t ∂x ∂x ∂x Without loss of generality. (12. the small signal Kawahara equation is purely dispersive.

x)+alpha*diff(v. Schiesser. Marchenko.S.x)*u=0. W. References [1] L.x. but they are included with the downloadable software for this book. 40 (3) (1998) 685–691.x.lhs(pde3)). > # Derive small signal version of pde1 pde2:=expand(subs(v=(U[0]+u).G.x) -beta*diff(v.x.S. [3] B. Boston. Fluid Dyn. 1989. exp.t)): > # Define Kawahara equation pde1:=diff(v. or riccatiMethod() described in the main Appendix. 2 (7) (2007) 2859. Kawahara Equation 237 > # Find dispersion relation for Kawahara equation restart. Fornberg. [2] P. The tanh method finds 15 solutions. Calculation of weights in finite difference formulas.8: Maple code to derive the dispersion relation for the Kawahara equation. # number of operands pde3:=subsop(3=0. 2005. Drazin.x.V.E. and Riccati methods are not detailed here.size). SIAM Review. The Maple code implementations of the tanh. http://www. of Japan. Second ed. > # group velocity (wave packet) c_g:=diff(omega. 24–1 (1989) 73–79. > # Set up alias for u and v alias(u=u(x. expMethod().x)=0. . Griffiths. Method of Lines. Oscillatory solitary waves in dispersive media.org/article/method of lines. Johnson. Traveling wave solutions are obtained by straightforward application of any of the Maple procedures tanhMethod. # dispersion relation > eqn2:=isolate(eqn1.W. They all find solutions that match the original solution of eq.scholarpedia. Phys. Cambridge University Press. R. Nonlinear Partial Differential Equations for Scientists and Engineers. and the Riccati method finds 15 × 6 solutions. (12. Solitons: an Introduction. Scholarpedia..pde1)). > eqn1:=simplify(eval(subs(u=A*exp(I*(k*x-omega*t)). 1997. Cambridge University Press. # set 3rd operand to zero > # without loss of generality set U[0]=0 pde4:=subs(U[0]=0. Ilichev. Birkhauser.x. > # Solve for k (to be non-dispersive) solve({c_p=c_g}.k). Johnson.k).assign(eqn2). New York. A. [5] T. > # phase velocity c_p:=simplify(omega/k). second order magnitude nops(lhs(pde2)). New York. # set diff(u. A Modern Introduction to the Mathematical Theory of Water Waves. J. the exp method finds 12 solutions.t)):alias(v=v(x. G.pde4)). [6] R.omega). Propagation of long nonlinear waves in a ponderable fluid beneath an ice sheet. Chapter 12 .t)+v*diff(v. [4] S. [7] T. Debnath. 33 (1972) 260–264.x. Soc. lhs(pde2))=0. LISTING 12. Kawahara. Hamdi.2).

Comput. [12] G. Saucez.E. FL. 541. Atmospheric and Oceanic Fluid Dynamics: Fundamentals and Large-Scale Circulation.K. Handbook of Nonlinear Partial Differential Equations. 1997. . Cambridge University Press. Math.A. New York. J. Schiesser. Fluid Mech. Silebi. [9] P. 184 (1987) 183–206. V. W. 56 (2001) 171–185. [10] W. C. Zaitsev.A. Schiesser. Cambridge University Press. Upwinding in the method of lines. Polyanin. Simulat. Cambridge. Valis.238 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS [8] A. Griffiths.F. [11] W. 2002. 2009. Computational Transport Phenomena.E. vande Wouwer. 2004. G. A. UK. Boca Raton. Symmetry breaking in periodic and solitary gravity capillary waves on water of finite depth.W. Schiesser. Cambridge. 2006. Zufira. UK.E. 207–288. Cambridge University Press. [13] J. A Compendium of Partial Differential Equation Models.D. ibid. Chapman & Hall/ CRC.

6) f1 (t) = 3dsech2 k(xl − xo − νt) (13.1) in t (with = ut . xo = 0. t) = f1 (t) (13.5).1) is first order in t and second order in x (through the mixed partial). (13. p998): ! ∂u ∂u ∂u ∂ ∂2 + + εu −µ =0 (13.7) f2 (t) = 3dsech2 k(xu − xo − νt) (13. we consider the following 1D regularized long-wave equation (RLW) ([5].4) is ([5].9) ∂x2 1x2 .1. It therefore requires one initial condition (IC) and two boundary conditions (BCs).4) An analytical solution to eqns. ∂u ∂u The MOL approximation of eq. (13. . k = . 13 Regularized Long-Wave Equation To illustrate the numerical integration of a PDE with a mixed partial derivative.1) ∂t ∂x ∂x ∂t ∂x2 Equation (13. The initial condition is taken as u(x. t) = f2 (t) (13.2) and the two BCs as u(x = xl . t = 0) = g(x) (13. ε = µ = 1 ([5]. (13.8) The method of lines (MOL) solution is computed for d = 0. All rights reserved. we have the IC and BCs 2 µν g(x) = 3dsech2 k(x − xo ) (13.5) s 1 εd where ν = 1 + εd. p1002) ua (x. = ux ) is based on the ∂t ∂x following finite difference (FD) approximation for the second derivative in x: ∂ 2 u u(i + 1) − 2u(i) + u(i − 1) ≈ + O(1x2 ) (13.1016/B978-0-12-384652-5.00013-3 239 Copyright © 2012 Elsevier Inc. t) = 3dsech2 k(x − xo − νt) (13.3) u(x = xu . From eq. Traveling Wave Analysis of Partial Differential Equations DOI: 10.1)–(13. p1002).

. t) ut (21x. with grid spacing 1x = (so that the interior grid points correspond n+1 to x = i1x. t) 1 2 1 − 2− 1x2 1x µ . . 2.. t) . i = 0.. . n + 1 corresponding to i = 0 at x = xl and i = xu − xl n + 1 at x = xu . 1. ut ((n − 2)1x.1) gives 2 1 1 − 2− ut (1x. . t) − 2− ut (21x.. n).a (x = xu . . t) ut (n1x. i = 1. . t) µ µ x=1x 1x2 ε 1 = ux + uux µ µ x=21x . t) ut (n1x. ..240 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS where i is a grid index in x. t) µ µ x=n1x 1x2 or in matrix format 2 1 1 − − 1x2 µ 1x2 ut (1x. . . . .9) to eq. t) 1x2 1x µ 1x2 1 2 1 ut ((n − 1)1x. t) 1x µ 1x2 1 2 1 1 ut (1x. 2.a (x = xl . t) 1x2 1x µ 1x2 . 1 2 1 1 ut ((n − 2)1x. t) 1 2 1 1 − − 1x2 1x2 µ 1x2 ut ((n − 1)1x. Application of eq.10) ε 1 = ux + uux µ µ x=(n−1)1x ε 1 1 = ux + uux − ut. • . . .. . (13. . .. n. t) − 2− ut ((n − 1)1x. t) ut (21x. . . (13. t) − 2− ut (n1x) 1x2 1x µ ε 1 1 = ux + uux − ut. t) 1 2 1 1 − − 1x2 1x2 µ 1x2 ut (31x... . (13. . t) ut (31x.

ut ((n − 2)1x. t) 1 2 1 1 − − 1x2 1x µ 1x 2 2 ut ((n − 1)1x. . dss004.a (x = xu . . (13. (13.11) ε 1 ux + uux µ µ x=(n−1)1x ε 1 1 ux + uux − ut. t) 1 2 1 1 − − ut (31x... Regularized Long-Wave Equation 241 1 ε 1 ux + uux − ut. • .11) for the vector of derivatives in t −1 2 1 1 − − 1x2 µ 1x2 ut (1x.. t) 1 2 1 − 2− 1x2 1x µ 1 ε 1 ux + uux − ut. . = .a (x = xu .12) with u and ux such as ux + uux can be accom- µ µ x=1x modated by the usual MOL analysis with application of a library differentiator.a (x = xl . t) ut (n1x. t) µ µ x=n1x 1x2 We can then solve eq.. ...12) ε 1 ux + uux µ µ x=(n−1)1x ε 1 1 ux + uux − ut. = . t) µ µ x=n1x 1x2 ε 1 The RHS terms of eq.. . (13. . Chapter 13 . t) µ µ x=1x 1x2 ε 1 ux + uux µ µ x=21x . t) ut (21x. t) 1x2 1x 2 µ 1x 2 . e.g.a (x = xl . (13. . t) µ µ x=1x 1x2 ε 1 ux + uux µ µ x=21x .

t) such as − ut. LISTING 13. % % PDE for i=1:n urhs(i)=(1/mu)*(ux(i)+eps*u(i)*ux(i)). t) + µ dx (13. The ODE routine pde 1.13a) −∞ Z∞ " 2 # ∂u(x.13b) ∂x −∞ Z∞ h i c3 = u3 (x. which can be used to check the numerical solution ([5].*ux').n. this may essentially be avoided if the initial condition pulse of eq.a can be taken as zero. p1002) Z∞ c1 = u(x. t) + 3u2 (x.12) is implemented in the following Matlab routines. (13. function ut=pde_1(t. t) dx (13.m for eq. However. t) dx (13. (13.t).m follows first. u(n)=ua_1(x(n). end % urhs=(1/mu)*(ux'+eps*u'. t) 2 c2 = u (x. momentum.xu. Equation (13.242 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS 1 to compute ux. t) require differentiation of the analytical solution with respect to t. % % Increment calls to pde_1 ncall=ncall+1.u) % % Function pde_1 computes the t derivative vector of the RLW PDE % global xl xu x dx n ncall % % Model parameters global eps mu cm d k xo nu % % BCs u(1)=ua_1(x(1).t). % % ux ux=dss004(xl. ut=cm\urhs'.1) has three invariants representing conservation of mass.6) does not approach the boundaries so that the required derivative ut. The terms involving the analytical solution ua (x. .u). and energy.1: Function pde 1.13c) −∞ Equations (13.12).a (x = 1x2 xl .

In both cases.t). (13.xu. The function and global variables are defined. In the first approach. % % ux ux=dss004(xl.4). u(n)=ua_1(x(n).8) at x = xl . function u0=inital_1(t0) % % Function inital_1 sets the initial condition for the RLW PDE with . ut=cm\urhs'.12) is explicit over the grid i=1. xu (i=1. Two Dirichlet BCs are defined using the analytical solution in eqns.n.*ux').m: . (13. The ODEs of eq.. the programming of the RHS terms of eq. ux in the RHS of eq. the vector operations of Matlab are used (deactivated as a comment. In the second approach. . % % Increment calls to pde_1 ncall=ncall+1. Chapter 13 . which are also transposed to meet the requirements of the ODE integrator ode45. the RHS vector urhs and the coefficient matrix cm (set in the main program discussed subsequently) are used with the Matlab inverse matrix operator \ to compute the derivatives in t.u) % % Function pde_1 computes the t derivative vector of the RLW PDE % global xl xu x dx n ncall % % Model parameters global eps mu cm d k xo nu . Finally. .7). Regularized Long-Wave Equation 243 We can note the following points about pde 1. end % urhs=(1/mu)*(ux'+eps*u'..m is incremented before the return from this routine. function ut=pde_1(t. % % BCs u(1)=ua_1(x(1).12) are programmed in two ways. (13. (13. ut.t).u). the counter for the calls to pde 1. (13. and (13. where ’ is a transpose).3).6).. (13.2) and (13.m implements eqns.12) is computed by dss004.n).n in a for loop. % % PDE for i=1:n urhs(i)=(1/mu)*(ux(i)+eps*u(i)*ux(i)). (13. The initial condition function inital 1.

xu= 50. % % IC over the spatial grid xl=-50. mu=1. The function and some global variables are defined.1.x(i)).5. nu=1+eps*d.2: Function inital 1. % % Initial condition u0(i)=ua_1(0. eps=1.5.1. We can note the following points about inital 1. n=199. mu=1.244 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS % a mixed partial derivative % global xl xu x dx n ncall % % Model parameters global eps mu cm d k xo nu % d=0. .6).m: . for i=1:n % % Uniform grid x(i)=xl+i*dx.2) and (13. dx=(xu-xl)/(n+1). % % IC over the spatial grid xl=-50. k=0.m for IC from eqns. xu= 50. end LISTING 13. nu=1+eps*d. k=0. eps=1. n=199. (13. and the problem parameters are given numerical values. xo=0. The parameters for the spatial grid are defined. function u0=inital_1(t0) % % Function inital_1 sets the initial condition for the RLW PDE with % a mixed partial derivative % global xl xu x dx n ncall % % Model parameters global eps mu cm d k xo nu % d=0.5*(eps*d/(mu*nu))ˆ0.5*(eps*d/(mu*nu))ˆ0. . dx=(xu-xl)/(n+1). xo=0.

this condition is not required and BCs from eqns. (13.7) and (13. The grid in x and the associated IC (from function ua 1.m at t = 0) are set in a for loop. essentially finite values of x.x) % % Function ua_1 computes the analytical solution to the RLW PDE with % a mixed partial derivative % % Model parameters global eps mu cm d k xo nu % % Analytical solution uanal=3*d*sech(k*(x-xo-nu*t))ˆ2. xu as in previous cases). end Function ua 1.13) by Simpson’s rule. – The values xl=-50. (13. function uanal=ua_1(t. eq. (13. LISTING 13. (13.5). for i=1:n % % Uniform grid x(i)=xl+i*dx. and dx is computed by dividing by n+1 (rather than n-1 as in previous cases) since the end points of the grid for the 199-ODE system are at xl+dx and xu-dx (and not at xl. (13.5) and therefore ODEs at the end points are not actually required to compute the solution at the end points. (13. simp. is function uint=simp(xl. The routine for calculating the integrals of eqns.5). t) are set by the analytical solution of eq. t) and u(x = xu .x(i)).u) % % Function simp computes three integral invariants by Simpson's % rule % % Parameter in the integrand of the second integral global mu % % Step through the three integrals (invariants) for int=1:3 h=(xu-xl)/(n+1).n.m is a straightforward implementation of the analytical solution.12). however. and therefore the boundary values of the solution remain at their initial values (from eq. .xu.m for analytical solution (13.8) could be used at . Chapter 13 .3: Function ua 1. % % Initial condition u0(i)=ua_1(0. This variation from the usual procedure follows from eq. where u(x = xl .6)) as we shall observe in the numerical and plotted output. xu=50 were selected so that they are effectively at infinity. Regularized Long-Wave Equation 245 We can note the following points about these parameters: – 199 grid points are used.

end uint(3)=h/3. end uint(1)=h/3. % % Conservation of mass if(int==1) uint(1)=u(1)-u(n).0*uint(3).. +2. (13.0*(u(i )ˆ2+mu*ux(i )ˆ2).0*(u(i-1)ˆ2+mu*ux(i-1)ˆ2). simp has three parts corresponding to the integrals c1.0*(u(i )ˆ3+3*u(i )ˆ2).. (13..xu. end % % Next integral end LISTING 13.n. for i=3:2:n uint(2)=uint(2)+4. uint(2)=u(1)ˆ2+mu*ux(1)ˆ2-(u(n)ˆ2+mu*ux(n)ˆ2).xu.u). The coding for c1 is function uint=simp(xl..13). for i=3:2:n uint(1)=uint(1)+4.0*(u(i-1)ˆ3+3*u(i-1)ˆ2).0*uint(2).13).0*u(i).0*u(i-1)+2. +2. for i=3:2:n uint(3)=uint(3)+4. end % % Energy conservation if(int==3) uint(3)=u(1)ˆ3+3*u(1)ˆ2-(u(n)ˆ3+3*u(n)ˆ2). end % % Conservation of momentum if(int==2) ux=dss004(xl.u) % % Function simp computes three integral invariants by Simpson's % rule % % Parameter in the integrand of the second integral global mu % % Step through the three integrals (invariants) for int=1:3 h=(xu-xl)/(n+1). 1. .c2.n.246 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS % % Conservation of mass if(int==1) uint(1)=u(1)-u(n).c3 of eqns. end uint(2)=h/3.4: Numerical quadrature routine simp applied to eqns.0*uint(1).

where xl=-50. Similarly. end % % Next integral end The main program.13c) is % % Energy conservation if(int==3) uint(3)=u(1)ˆ3+3*u(1)ˆ2-(u(n)ˆ3+3*u(n)ˆ2).0*(u(i-1)ˆ2+mu*ux(i-1)ˆ2). (13.m. t) (the integrand in eq. xu=50 are the lower and upper limits of the integral (set in inital 1) and n=199. Also. is computed by dss004.u). ∂x 3. pde 1 main.. The for loop for c1 is an implementation of the weighted sum for Simpson’s rule applied to the function u(x. Chapter 13 . +2.0*u(i).14) 3 −∞ i=2 2. the coding for c2 of eq. for i=3:2:n uint(3)=uint(3)+4. .0*u(i-1)+2. (13. is structured in the same way as previous main programs..0*(u(i )ˆ2+mu*ux(i )ˆ2).0*(u(i )ˆ3+3*u(i )ˆ2). end which reflects the difference in the integrands of c1 and c2 of eqns. Regularized Long-Wave Equation 247 for i=3:2:n uint(1)=uint(1)+4. the integration interval h=(xu-xl)/(n+1) is computed. (13. (13.0*uint(3).0*(u(i-1)ˆ3+3*u(i-1)ˆ2). Finally.0*uint(1). +2. for i=3:2:n uint(2)=uint(2)+4. end uint(1)=h/3.xu.13a)). t)dx ≈ u1 + 4ui + 2ui+1 + u(n) (13. end uint(3)=h/3. end After defining the function. Z∞ " n−2 # h X u(x. the coding for c3 of eq. the derivative in c2 ..0*uint(2).13b).13b) is % % Conservation of momentum if(int==2) ux=dss004(xl.13a) and ∂u (13. % % Clear previous files clear all . end uint(2)=h/3. uint(2)=u(1)ˆ2+mu*ux(1)ˆ2-(u(n)ˆ2+mu*ux(n)ˆ2)..n.

end end % % Row n elseif(i==n) for j=1:n if(j==n)cm(n.reltol. ncall=0.j)=0.'AbsTol'. elseif(j==2)cm(1. % % Coefficient matrix % for i=1:n % % Row 1 if(i==1) for j=1:n if(j==1)cm(1. end end else for j=1:n if(i==j)cm(i.j)=1/dxˆ2.abstol). else cm(n.1)=(-2/dxˆ2-1/mu). options=odeset('RelTol'. nout=4. elseif(j==n-1)cm(n.2)=1/dxˆ2.j)=0.j)=(-2/dxˆ2-1/mu). elseif(abs(i-j)==1)cm(i. abstol=1. % . end end end % % Next i end % % Independent variable for ODE integration tf=18. % % ODE integration reltol=1. u0=inital_1(t0).0e-06.248 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS clc % global xl xu x dx n ncall % % Model parameters global eps mu cm d k xo nu % % Initial condition t0=0.n-1)=1/dxˆ2.n)=(-2/dxˆ2-1/mu). else cm(i.j)=0.0e-06. else cm(1. tout=[t0:6:tf]'.0.

t)').6f%12. LISTING 13.i).6f%12.1)=ua_1(t(it). uplot(it. zlabel('u(x. uaplot(it.2:n+1)=u(it.2:n+1)=u_anal(it.analytical') figure(2) surf(uplot) shading 'interp'..2f%8. o .i).:). . uaplot(it.2f'. for i=1:n xplot(i+1)=x(i).x(1)).m.i)=u(it.tout.x(i)).uaplot.x(n)). % % Plot numerical and analytical solutions xplot(1)=xl.t)') title('RLW equation.i)=ua_1(t(it). t(it).3f%12. solid . uint=simp(xl.4f Momentum conservation'. fprintf('\n I3 = %10. xplot(n+2)=xu.1)=ua_1(t(it).uint(2)).ncall).n.uplot.i)). fprintf('\n I2 = %10.options).x(1)). end for i=1:5:n fprintf('%6.uint(3)).. Regularized Long-Wave Equation 249 % Explicit (nonstiff) integration [t.'o'. end figure(1) plot(xplot.'-') xlabel('x') ylabel('u(x. end for it=1:nout uplot(it.t) err\n') fprintf(' num anal \n') for i=1:n u_anal(it.t(it)).u(it. end fprintf('\n ncall = %4d\n\n'. t = 0.4f Mass conservation' .x(n)).i). end % % Calculate and display three invariants ui=u(it. 6.x(i).u0.xplot.. Chapter 13 .t) u(x.xu.1:n). 12. title('RLW equation').uint(1)).err(it.u_anal(it.4f Energy invariant\n\n' .6f\n'. fprintf('\n Invariants at t = %5. uplot(it. ylabel('t'). 18. % % Analytical solution and difference between the numerical and % analytical solutions at selected points for it=1:nout fprintf('\n\n t x u(x.n+2)=ua_1(t(it).u]=ode45(@pde_1.1:n). axis 'tight' xlabel('x').ui).n+2)=ua_1(t(it).i)-u_anal(it. uaplot(it. fprintf('\n I1 = %10. err(it.numerical.5: Main program pde 1 main.

m.12) and illustrates that the first and 199th equations (i=1. The initial condition of eqns. (13. . Before the ODE integration (by ode45). end end % % Row n elseif(i==n) for j=1:n if(j==n)cm(n.. some global variables are defined. j is the column index used in each of the three for loops. else cm(n. .. all of the intervening equations (i=2..j)=(-2/dxˆ2-1/mu). % % Clear previous files clear all clc % global xl xu x dx n ncall % % Model parameters global eps mu cm d k xo nu .6) are then set by inital 1. elseif(abs(i-j)==1)cm(i. elseif(j==n-1)cm(n. This coding follows directly from eq.j)=0.2) and (13. % % Coefficient matrix % for i=1:n % % Row 1 if(i==1) for j=1:n if(j==1)cm(1.1)=(-2/dxˆ2-1/mu). (3. (3. elseif(j==2)cm(1.2)=1/dxˆ2.n)=(-2/dxˆ2-1/mu).j)=0.0.j)=1/dxˆ2.198) have the same structure and programming.250 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS We can note the following points about this main program: .12) is defined cm. % % Initial condition t0=0.n) are special cases. After previous files are cleared. else cm(1. end end else for j=1:n if(i==j)cm(i. else cm(i. u0=inital_1(t0).. the coefficient matrix of eq.n-1)=1/dxˆ2.j)=0.

The time scale is defined % % Independent variable for ODE integration tf=18. 12. performed the ODE integration very efficiently (as demonstrated in the subsequent output). % % Explicit (nonstiff) integration [t.abstol).u0. the enhanced stability of a stiff integrator has a cost.u]=ode45(@pde_1. eq. % % Analytical solution and difference between the numerical and % analytical solutions at selected points for it=1:nout fprintf('\n\n t x u(x. will require fewer calculations than a stiff integrator.0e-06. .i)=ua_1(t(it). the selection of a stiff integrator such as ode15s would be reasonable. After the ODE integration by ode45. An MOL solution of a PDE does not necessarily lead to stiff ODEs (a common misconception).i)). In other words.x(i)). if it performs satisfactorily. A nonstiff integrator should be considered first since it. (13. Chapter 13 . that is. .t) err\n') fprintf(' num anal \n') for i=1:n u_anal(it. 6. ncall=0. more calculations for each step along the solution than for a nonstiff integrator. and selected values of the two solutions and their difference (err(it.reltol.'AbsTol'.t) u(x. rkf45. options=odeset('RelTol'.tout. The nonstiff integrator. t = 0.0e-06. namely.i)) are displayed numerically. this example illustrates two ideas: 1. If the execution required a long computer run time (large value of ncall). . abstol=1. the analytical solution. tout=[t0:6:tf]'.5). Regularized Long-Wave Equation 251 end end end % % Next i end . is evaluated by function ua 1 for comparison with the numerical solution (in array u(it. 2. 18 with four output points. nout=4. The integration of the 199 ODEs is accomplished by rkf45.options). However. % % ODE integration reltol=1.

end % % Calculate and display three invariants ui=u(it. the three invariants of eqns. t = 0.i)-u_anal(it. zlabel('u(x. fprintf('\n I2 = %10. the analytical solution is included by using ua 1.uaplot.1:n).2f%8. title('RLW equation'). figure(1) plot(xplot.t(it)). uaplot(it.u_anal(it.i)=u(it.1:n).1)=ua_1(t(it).'o'.ncall). 6. the counter for calls to .n+2)=ua_1(t(it). uaplot(it.6f%12.xplot.4 and are displayed at each of the four output points in t.x(i). fprintf('\n Invariants at t = %5. fprintf('\n I1 = %10. end for it=1:nout uplot(it. end fprintf('\n ncall = %4d\n\n'. xplot(n+2)=xu. uaplot(it.x(1)).ui).6f\n'. uplot(it.t)') title('RLW equation.x(1)). Finally.m.:). ylabel('t').4f Momentum conservation'. 12.n.u(it. (13.i). o . for i=1:n xplot(i+1)=x(i).uint(3)). uplot(it.2f'.i)).4f Energy invariant\n\n' . t(it).x(n)).2:n+1)=u(it. .uplot. end for i=1:5:n fprintf('%6..t)'). pde 1.252 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS err(it.13) are evaluated by simp.xu.m of Listing 13.3f%12.t.uint(1)).n+2)=ua_1(t(it)..m is displayed as a measure of the overall computational effort..x(n)). uint=simp(xl. fprintf('\n I3 = %10.6f%12. solid .i). end .analytical') figure(2) surf(xplot. Also.uplot) xlabel('x').err(it. % % Plot numerical and analytical solutions xplot(1)=xl.uint(2)). 2D and 3D plots are produced by using plot and surf.'-') xlabel('x') ylabel('u(x.1)=ua_1(t(it). 18.2:n+1)=u_anal(it. Arrays for plotting are set up by including the end point values at x = xl and x = xu (the grid for plotting is expanded from 199 to 201 points).i).numerical.4f Mass conservation' .

6.1 and 13. eq. Also.2 u (x.5). . 12. PDEs with mixed partial derivatives that have only boundary value independent variables such as ∂ 2u in Cartesian coordinates. (13.5) does not reach the boundaries at x = −50.1 0.7).05 0 −0.35 0. t = 0. Figure 13. The tabular analytical and numerical solutions given in Table 13.1) (lines) with the analytical solution.2 is a 3D plot of the numerical solution. Chapter 13 .1 also reflect the good agreement between these two solutions. in principle. the computational effort of rkf45 reflected in ncall = 145 is quite modest. in particular.05 −50 −40 −30 −20 −10 0 10 20 30 40 50 x FIGURE 13.1 indicates good agreement between the analytical and numerical solutions. 18 0. In summary. and Table 13. but this may not be the case depending on the boundary values of x and the elapsed time t.1: Numerical solution to eq. (13. (13. (13. and (13. (13. The three invariants remained constant through- out the solution.15 0. Figure 13. Regularized Long-Wave Equation 253 RLW equation.1. that the sech pulse of eq.4). This class of problems is addressed in a forthcoming publication.8) do not have an effect. (13.3). 50 so that BCs (13.1) is straightforward if the mixed partial derivative includes differentiation with respect to an initial value variable. superimposed (circles).2. such as t in the preceding example. The output from the preceding code appears in Figs. can also be accommodated within the MOL ∂x∂y framework. the numerical solution of a PDE with a mixed partial derivative such as eq.25 0. Note. 13. t) 0.3 0.

1).5 50 1 FIGURE 13. (13. This poses very diffi- cult problems from both a theoretical and a numerical standpoint.2: 3D plot of the numerical solution to eq.5 150 t 2 100 x 1.25 0. Brief Background Information To describe water waves rigorously.254 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS RLW equation 0. It is an alternative model to the well-known Korteweg–de .3 0. it is useful to construct simpler mathematical models that are able to capture the essential details of water waves under a variety of operating conditions.15 0. in a mathematical and physical sense. Therefore.05 4 3. To this end.2 u (x. Appendix We conclude this chapter by including a little background information for the regular- ized long-wave equation (RLWE) and outlining some traveling wave solutions that can be obtained using the procedures detailed in the main Appendix.5 200 3 2. t) 0. requires that the Navier–Stokes equations be solved with free boundary condition(s). By experimenting with dif- ferent values for the order of approximations. which can reveal interesting behavior when examined by means of an animation. the regularized long-wave equation (RLW) or Benjamin–Bona–Mahony equation (BBM) [1] was derived as a model to describe gravity water waves. it becomes immediately apparent that there are many nontrivial traveling wave solutions to the RLWE.8) in the main Appendix). Higher values of M tend to produce more complex traveling wave solutions. M (see eqn.1 0. (A.

000077 0.500 0.500 0.000 0.500 0.000000 0.00 −24.500 0.000000 0.500 0.000036 0.090587 0.030538 0.000000 0.00 10.00 28.011002 0.000000 0.000006 0.000036 0.000742 0.000 0.500 0.000000 0.00 5.014777 0.000000 0.000 0.000000 0.000000 0.00 −34.500 0.00 0.00 −7.00 33.000003 0.000 0.022900 0.000004 0.005228 0.000 0.000 0.003337 0.000122 0.00 −37.000349 0.000122 0.000013 0.000002 0.001575 0.001166 0.000 0.00 −17.000001 0.000008 0.298302 0.00 20.000165 0.000165 0.00 −27.00 13.000000 0.000000 0.00 −32.000000 0.000000 0.000000 0.00 18.000000 0.000 0.274299 0.000057 0.00 −4.061241 0.000017 0.500 0.000006 0.t) t x num anal err 0.000000 0. Chapter 13 .500 0.000017 0.000000 0.000259 0.000000 0.000000 0.000000 0.061241 0.00 −12.00 8.000000 0.00 35.000000 0.500 0.000000 0.161271 0.000000 0.046599 0.000000 0.000001 0.046599 0.005228 0.500 0.000000 0.000000 0.000027 0.000000 0.001575 0.000013 0.1: Abbreviated tabular numerical and analytical solutions for n = 199 u(x.000001 0.000000 0.002472 0.022900 0.00 −47.500 0.00 I1 = 3.00 −9.000000 0.00 −49.00 −2.500 0.000077 0.000003 0.000001 0.000002 0.000 0.014777 0.5790 Energy invariant (Continued ) .500 0.090587 0.000 0.000742 0.000 0.298302 0.500 0.500 0.115672 0.115672 0.000000 0.000000 0.000549 0.000000 0.00 23.00 −14.9799 Mass conservation I2 = 0.000 0.000008 0.000 0.000001 0.000349 0.t) u(x.00 −19.007047 0.000000 0.000 0.00 25.00 −44.500 0.000027 0.00 −29.000000 Invariants at t = 0.195401 0.00 45.00 43.000000 0.000 0.161271 0.000001 0.00 −22.500 0.00 3.030538 0.000000 0.00 −42.000 0.000000 0.500 0.000 0.001166 0.011002 0.002472 0.000259 0.195401 0.003337 0.00 40.00 15.500 0.246128 0.00 −39.00 30.000549 0.000000 0.000000 0.007047 0.000004 0.00 48.000057 0.000000 0.8102 Momentum conservation I3 = 2.000000 0.274299 0.000 0.00 38.246128 0.000 0. Regularized Long-Wave Equation 255 Table 13.000000 0.000 0.

00 −9.000000 −0.003543 0.000371 0.000019 0.016634 0.000000 0.006400 18.000000 18.000 0.00 18.000836 0.00 23.00 −2.000000 18.000175 0.000002 0.000000 0.006642 18.00 15.500 0.081826 0.500 0.000 0.000000 −0.000000 0.00 5.500 0.148335 0.000001 18.283111 0.000000 18.500 0.000009 0.006381 18. .00 −34.000 0.00 0. .00 −49.068203 0.000002 18.000 −0.000000 0.001673 0.002001 18.278950 0.000000 18.00 −27.239741 −0.000087 0.000000 18.034332 0.121227 0.00 −19.000 0.000393 0.500 −0.000001 0.000000 0. .000 0.00 −39.00 25.000000 18.500 0.00 10.000011 18. Solution for t = 6.000048 18.003590 18.000082 0.00 −37.000000 −0.000000 0.000 0.00 −24.001947 18.500 0.000018 0.1: (Continued) u(x.500 0. .00 −22.00 −47.500 0.500 0.000788 0.00 20.015671 0.500 0.000000 0.00 −17.000000 0.000001 18.000000 18.000 0.00 13.000000 0.000041 0.t) t x num anal err 18.000039 0.000416 18.000009 0.500 0.000 0.005562 18.500 0.00 −44.00 −29.00 −42.007895 0.000004 0.086113 −0.296684 −0.00 −7.000000 18.003746 0.000000 18.064613 0.000963 18.000000 18.126790 0.000 0.000001 0.000000 −0.00 −4.007479 0.209005 0.000203 18.000000 18.000000 0.t) t x num anal err .500 0.000000 18.001779 0.000106 18.000004 0.00 −14. u(x.294737 0.000022 18.004161 18.00 28.000000 0.256 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 13.202362 0.000 −0.032331 0.00 8.t) u(x.000 0.00 −12.000005 18.000 0.000 0.233341 0.t) u(x.000000 0.500 0.000 0.154717 −0.000000 0.00 −32.004287 .000 0.000185 0.00 3. 12 deleted .500 0.000002 0.000000 −0.

the parameters α.9799 Mass conservation I2 = 0.00 48.000 0.1: (Continued) 18.500 0.16a) ∂t ∂x ∂x ∂x ∂t ∂x2 ! ∂u ∂η ∂u ∂ 3η ∂ ∂ 2u + +u +γ 3 −δ =0 (13.500 0. u (x.16b) ∂t ∂x ∂x ∂x ∂t ∂x2 The dimensionless pvariables η (x.000133 18.000 0.00 38.002328 −0.000030 18.021609 −0. and the dimensionless horizontal surface wave velocity at a height θh0 (where 0 ≤ θ ≤ 1) above the bottom of the channel is represented by u (x. The nondimensionless wave height above the equilibrium water level is represented by η. and x are scaled by the length scale h0 .500 0. where h0 represents the undisturbed water depth and g repre- sents gravitational acceleration.041696 0.001098 −0.002195 0.00 40.000517 −0.8102 Momentum conservation I3 = 2. Chapter 13 . and the time scale by h0 /g. when it is required to analyze bidirectional waves with wave interactions.15) ∂t ∂x ∂x ∂t ∂x2 This is eq.00 I1 = 3. Regularized Long-Wave Equation 257 Table 13.5790 Energy invariant ncall = 145 Vries equation (KdV) and describes some of the more exotic dynamic behavior of water waves and. the RLW equation represents a unidirectional propagation model. γ .002385 18.000488 0.00 30.000 0. ! ∂u ∂u ∂u ∂ ∂ 2u + +u − =0 (13.00 45.000281 18.001035 0. t).00 35.020397 0. t).000243 0.004644 0.00 43.009780 0.044081 −0.500 0.000 0.1) with = 1 and µ = 1. However. t). the following system of coupled equations can be used [2].00 33.000008 Invariants at t = 18.000590 18. For a physical system.001211 18.010369 −0.000063 18. (13. ! ∂η ∂u ∂ ∂ 3u ∂ ∂ 2η + + (uη) + α 3 − β =0 (13.000251 0. and δ represent dispersion constants and are subject to the following constraints: 1 2 1 1 α+β = θ − γ +δ = 1 − θ2 ≥ 0 and 2 3 2 . in particular. In the following dimensionless form. β.004925 −0. the solitary wave phenomena [4].

γ . δ ≥ 0. (13.18) is the same solution as eq. the application codes will not be included here.16b) is linearly well posed and will generally give rise to smooth solutions if the constants α. Analytical Traveling Wave Solutions for Single RLW Equation We will now outine some additional traveling wave solutions to eq. In order to save space.5) used in the main body of this chapter for 4µk2 the numerical simulation. as is likely to occur in laboratory-scale exper- iments or in the field. where d = . Solution Using tanh Method Application of the Maple procedure tanhMethod() enables us to derive three trivial solutions and the following two nontrivial traveling wave solutions " !# 12µk2 k 4xµk2 − x + t u= −1 + tanh2 4µk2 − 1 4µk2 − 1 ! −12µk2 k 4xµk2 − x + t = sech2 (13. and δ satisfy the following conditions: β ≥ 0. the model and its numerical results should correspond well with experimental results. δ ≥ 0. but they are included in the downloadable Maple software available for this book. α ≤ 0 γ ≤ 0 or β ≥ 0. and riccatiMethod() procedures detailed in the main Appendix. Further. the reader is referred to [2–4] and the references therein.258 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS It has been shown[3] that a physically relevant system based on eqns.18) 4µk2 + 1 4µk2 + 1 Equation (13.16a) and (13. For more details. (13. (13. when damping due to viscosity effects is comparable with the effects of nonlinearity and/or dispersion. α = γ > 0 It has also been shown that the above systems are able to model the main characteristics of flow in an ideal fluid. (1 − 4µk2 ) . expMethod().17) 4µk2 − 1 4µk2 − 1 and " !# 2 −4µk2 2 k 4xµk + x − t u= −1 + 3tanh 4µk2 + 1 4µk2 + 1 " !# −4µk2 k 4xµk2 + x − t = 2 − 3sech2 (13.1) that can be obtained by using Maple tanhMethod(). β.

i. Application of the Maple procedure tanhMethod2() enables us to derive two trivial solutions and 10 nontrivial traveling wave solutions.. i.20a) 96 8 20 √ √ ! 11 + 9 401 2 11 − 401 u=− + tanh x + t (13. used in the main body of this chapter for the numerical simulation.3 which shows the initial condition (at t = 0) for an animation.e. is not included here but is available with the downloads for this book. β = 1/6.20b) 120 20 A plot of this solution is given in Fig. Chapter 13 . including the following. which then moves left to right when activated. One is the same as the solution. applicable to very small amplitude waves) is: α = −1/3. Solution Using Riccati Method Application of the Maple procedure riccatiMethod() enables us to derive 18 trivial solu- tions and 12 nontrivial traveling wave solutions. eqns.e. and δ in eqns. we have set the wavenumber equal to unity.20a) and (13. including the following: " ! 96k2 µb0 2k 4xµk2 − x + t u (x. Analytical Traveling Wave Solution for Coupled RLW Equations One set of values for constants α. (13. k = 1. 13..16a) and (13. Regularized Long-Wave Equation 259 Solution Using exp Method Application of the Maple procedure expMethod() enables us to derive two trivial solutions and three nontrivial traveling wave solutions.5). t) = − b20 exp − + 4b0 4µk2 − 1 4µk2 − 1 !#−1 2k 4xµk2 − x + t +4 exp (13. where for simplicity.16b) that satisfies the above constraints for surface waves (where θ ≈ 0. √ √ √ ! 699 − 35 401 9 + 401 2 11 − 401 η= − tanh x + t (13. (13. These solutions will not be detailed here as they can be obtained by simply running the downloadable Maple code. and δ = 5/6. . some of which are duplicates.19) 4µk2 − 1 where b0 denotes an arbitrary constant. γ . β. γ = −1/3. eq.20b). (13. The other two traveling wave solutions will not be detailed here as they are more complex and can be obtained by simply running the downloadable Maple code. The Maple code that derives the solution.

eqns. . (13. A.16a and b). Bona. [3] J.pdf. M.260 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS 1 0. 12 (2002) 283–318. J. S. 17 (2004) 925–952. Applied. J. [2] J. [4] M. A meshfree method for the numerical solution of the RLW equation. Boussinesq equations and other systems for small-amplitude long waves in nonlinear dispersive media I: Derivation and the linear theory. Mahony.-C. References [1] T. The top wave η represents wave height. Islam. η (x) 0 −0. Trans. 223 (2009) 997–1012.B. Saut. Available on- line at http://arxiv.J.3: Plot of traveling wave solution. Haq. at t = 0 for coupled regularized long-wave equations. Accessed: 24 March. Chen. J. J. 2006. Bona.5 −1 −1. Chen. Comp. Benjamin. eqns. Nonlinearity.20a and b).L.org/PS cache/math/pdf/0607/0607708v1. Goubet. J.L. J. Roy.5 −10 0 10 20 30 40 50 x FIGURE 13. Philos. Soc. M. 2010. Saut.5 u (x). Boussinesq equations and other systems for small-amplitude long waves in nonlinear dispersive media II: Nonlinear theory. and the bottom wave u represents wave velocity. London Ser. A 272 (1972) 47–78.-C. Ali. Model equations for long waves in nonlinear dispersive systems. [5] S-u. Chen. Long-time asymptotic behavior of dissipative Boussinesq system. Bona.L. O. Nonlinear Sci. Math. (13.

1) dξ and we impose the auxiliary conditions U(ξ = −∞) = 1. To illustrate the method. U(ξ = ∞) = 0. Here.1) that satisfies the auxiliary conditions is 1 U(ξ ) = (14. (14.3) −bU 2 −b(1 + ebξ/θ0 )−2 0 0 If U(ξ ) in eq. . we start with an ODE. basically going from an Eulerian coordinate system to a Lagrangian coordinate system by assuming a traveling wave solution. it can be related to a Eulerian (fixed frame) variable u through dU ∂ξ dU ∂u = (−c) = dξ ∂t dξ ∂t dU ∂u = −(1/c) dξ ∂t (14.00014-5 261 Copyright © 2012 Elsevier Inc.2) (1 + ebξ/θ0 ) We can verify this solution by direct substitution.1016/B978-0-12-384652-5. we demonstrate how this procedure can be reversed. Traveling Wave Analysis of Partial Differential Equations DOI: 10. which is a special case of the Bernoulli equation [1.4) dU ∂ξ ∂u = dξ ∂x ∂x dU ∂u = dξ ∂x . All rights reserved. 14 Extended Bernoulli Equation Chapter 1 includes a discussion of how a PDE can be reduced to an ODE through a change of variable. An analytical solution to eq.1) is considered a Lagrangian (traveling wave) solution (with ξ = x − ct). (14. 2] dU θ0 + bU(1 − U) = 0 (14. dU θ0 −θ0 (1 + ebξ/θ0 )−2 (ebξ/θ0 )(b/θ0 ) dξ +bU b(1 + ebξ/θ0 )−1 = b(1 + ebξ/θ0 )−2 (1 + ebξ/θ0 ) (14.

(14.262 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS If the second and fourth equations are added. To verify eq.6) 2 ∂x ∂t The solution to eq. we can directly extend the ODE solution (e. if an analytical solution to the ODE is readily available as a starting point to derive a PDE solution. of eq. eq. In particular. u(x.1) to obtain an equivalent PDE dξ θ0 ∂u ∂u − (1/c) + bu(1 − u) = 0 (14.8) +bu b(1 + eb(x−ct)/θ0 )−1 = b(1 + eb(x−ct)/θ0 )−2 (1 + eb(x−ct)/θ0 ) −bu2 −b(1 + eb(x−ct)/θ0 )−2 0 0 In summary. as x approaches the limiting values ±∞ for finite t. t) approaches the limiting values 1.6)) that can be generalized to other examples.5) can be substituted into eq. (14. (14.. (14.2). from eq.2)) to a solution to the PDE (eq. particularly. (14.7) is the starting point for the calculation of a numerical PDE/MOL solution using the following Matlab routines. eq.7) as the solution to eq. (14.6) is. 1 u(x. function ut=pde_1(t.m. we have θ0 ∂u θ0 − (1 + eb(x−ct)/θ0 )−2 (eb(x−ct)/θ0 )(b/θ0 ) 2 ∂x 2 θ0 ∂u θ0 (−1/c) (1/c) (1 + eb(x−ct)/θ0 )−2 (eb(x−ct)/θ0 )(−bc/θ0 ) 2 ∂t 2 (14. (14.7) (1 + eb(x−ct)/θ0 ) which satisfies the conditions u(x − ct = −∞) = 1. We consider first the ODE routine pde 1. (14. Specifically. t) = (14. This procedure is useful for generating exact PDE solutions that can be used to test numerical procedures such as the method of lines (MOL). 0. (14. (14.5) dξ ∂x ∂t dU Then. u(x − ct = ∞) = 0. we have illustrated a procedure for going from an ODE (eq.g. dU ∂u ∂u 2 = − (1/c) (14.1)) to a PDE (eq.6). (14. Also.7)).u) % % Function pde_1 computes the t derivative vector for the extended % Bernoulli equation % global xl xu x n ncall % .

eq. Here.u). (14. the boundary values do not have an effect on the solution for t > 0. (14.7) at the boundary values of x (the reader might try this to extend the numerical solution to finite boundary values for x). end ut=ut'.u) % % Function pde_1 computes the t derivative vector for the extended % Bernoulli equation % global xl xu x n ncall % global th0 c b .1). Extended Bernoulli Equation 263 global th0 c b % % ux ux=dss004(xl.6). only one BC is required since eq. The function and some global variables are defined.u). % % Increment calls to pde_1 ncall=ncall+1. % % ux ux=dss004(xl. (14.xu.m for eq. The derivative ∂u ∂x in eq. LISTING 14. . we have elected not to use BCs since the solution from the exp of IC (14. % % PDE for i=1:n ut(i)=c*ux(i)+(2*b*c/th0)*u(i)*(1-u(i)).xu. function ut=pde_1(t.7) does not depart from the initial values u(x = −∞. t = 0) = 1.n.n. ut. (14. The PDE. % % PDE for i=1:n ut(i)=c*ux(i)+(2*b*c/th0)*u(i)*(1-u(i)). .6) is first order in x. Also. end ut=ut'. (14. We can note the following points about pde 1. If this was not the case. in other words.1: ODE routine pde 1. t = 0) = 0.m: . is programmed as a set of ODE derivatives in t. we could program BCs at this point by using eq.6) is computed by dss004. u(x = ∞. % % Increment calls to pde_1 ncall=ncall+1. Chapter 14 .

264 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS

**ut is transposed to meet the requirement of the ODE integrator, ode15s, used in the
**

main program. Also, the counter for the calls to pde 1.m is incremented at the end of

pde 1.m.

**The IC function is listed next.
**

function u0=inital_1(t0)

%

% Function inital_1 sets the initial condition for the extended

% Bernoulli equation

%

global xl xu x n

%

% Spatial domain and initial condition

xl=-10;

xu= 15;

n=101;

dx=(xu-xl)/(n-1);

%

% IC from analytical solution

for i=1:n

x(i)=xl+(i-1)*dx;

u0(i)=ua_1(x(i),0.0);

end

LISTING 14.2: IC routine inital 1.m from eq. (14.7) with t = 0.

**We can note the following details about inital 1.m:
**

. After definition of the function and some global variables, the x domain is defined as

−10 ≤ x ≤ 15 with 101 points. This range in x is large enough that the boundaries at

**. x = −10, 15 are effectively at ±∞.
**

The IC, eq. (14.7) with t = 0, is defined numerically by ua 1 (discussed subsequently).

Function ua 1.m below is a straightforward implementation of eq. (14.7).

function uanal=ua_1(x,t)

%

% Function uanal computes the exact solution of the extended

% Bernoulli equation for comparison with the numerical solution

global th0 c b

%

% Analytical solution

uanal=1/(1+exp(b*(x-c*t)/th0));

LISTING 14.3: Analytical solution, eq. (14.7), for eq. (14.6).

**The main program pde 1 main.m is similar to previous main programs. However, we
**

list it here so the details are clear, particularly, since this is the last example of a PDE

application first order in t.

%

% Clear previous files

clear all

clc

Chapter 14 . Extended Bernoulli Equation 265

%

% Parameters shared with other routines

global xl xu x n ncall

%

global th0 c b

th0=1; c=1; b=1;

%

% Initial condition

t0=0.0;

u0=inital_1(t0);

%

% Independent variable for ODE integration

tf=4;

tout=[t0:2:tf]';

nout=3;

ncall=0;

%

% ODE integration

mf=2;

reltol=1.0e-06; abstol=1.0e-06;

options=odeset('RelTol',reltol,'AbsTol',abstol);

%

% Explicit (nonstiff) integration

if(mf==1)[t,u]=ode45(@pde_1,tout,u0,options); end

%

% Implicit (sparse stiff) integration

if(mf==2)

S=jpattern_num_1;

% pause

options=odeset(options,'JPattern',S)

[t,u]=ode15s(@pde_1,tout,u0,options);

end

%

% Store analytical solution, errors in numerical solution

for it=1:nout

for i=1:n

u_anal(it,i)=ua_1(x(i),t(it));

err(it,i)=u(it,i)-u_anal(it,i);

end

end

%

% Display selected output

for it=1:nout

fprintf('\n t x u(it,i) u_anal(it,i)

err(it,i)\n');

for i=1:10:n

fprintf('%6.2f%8.3f%15.6f%15.6f%15.6f\n',...

t(it),x(i),u(it,i),u_anal(it,i),err(it,i));

end

end

fprintf(' ncall = %4d\n\n',ncall);

%

% Plot numerical and analytical solutions

figure(2)

266 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS

plot(x,u,'-',x,u_anal,'o')

xlabel('x')

ylabel('u(x,t)')

title('Extended Bernoulli equation; t = 0, 2, 4; solid - numerical;

o - analytical')

figure(3)

surf(x,t,u)

shading 'interp', axis 'tight'

view(21,24);

xlabel('x'); ylabel('t'); zlabel('u(x,t)');

title('Extended Bernoulli equation');

LISTING 14.4: Main program pde 1 main.m for eq. (14.6).

**We can note the following details about pde 1 main.m:
**

. After previous files are cleared, some global variables are defined.

%

% Clear previous files

clear all

clc

%

% Parameters shared with other routines

global xl xu x n ncall

%

global th0 c b

th0=1; c=1; b=1;

**. The IC, eq. (14.7) with t = 0, is set by inital 1.m, and the t scale is defined as 0 ≤ t ≤ 4
**

with outputs at t = 0, 2, 4.

%

% Initial condition

t0=0.0;

u0=inital_1(t0);

%

% Independent variable for ODE integration

tf=4;

tout=[t0:2:tf]';

nout=3;

ncall=0;

**. The 101 ODEs are integrated by the sparse matrix option of ode15s (mf=2).
**

%

% ODE integration

mf=2;

reltol=1.0e-06; abstol=1.0e-06;

options=odeset('RelTol',reltol,'AbsTol',abstol);

%

% Explicit (nonstiff) integration

if(mf==1)[t,u]=ode45(@pde_1,tout,u0,options); end

%

Chapter 14 . Extended Bernoulli Equation 267

**% Implicit (sparse stiff) integration
**

if(mf==2)

S=jpattern_num_1;

% pause

options=odeset(options,'JPattern',S)

[t,u]=ode15s(@pde_1,tout,u0,options);

end

**. The analytical solution of eq. (14.7) is computed (u anal), and the difference between
**

the analytical solutions is put into an array err for subsequent plotting.

%

% Store analytical solution, errors in numerical solution

for it=1:nout

for i=1:n

u_anal(it,i)=ua_1(x(i),t(it));

err(it,i)=u(it,i)-u_anal(it,i);

end

end

%

% Display selected output

for it=1:nout

fprintf('\n t x u(it,i) u_anal(it,i)

err(it,i)\n');

for i=1:10:n

fprintf('%6.2f%8.3f%15.6f%15.6f%15.6f\n',...

t(it),x(i),u(it,i),u_anal(it,i),err(it,i));

end

end

fprintf(' ncall = %4d\n\n',ncall);

**. Selected numerical output is then displayed.
**

A 2D plot with the numerical and analytical solutions is produced by plot, and a 3D

plot of the numerical solution is produced by surf.

%

% Plot numerical and analytical solutions

figure(2)

plot(x,u,'-',x,u_anal,'o')

xlabel('x')

ylabel('u(x,t)')

title('Extended Bernoulli equation; t = 0, 2, 4; solid - numerical;

o - analytical')

figure(3)

surf(x,t,u)

xlabel('x'); ylabel('t'); zlabel('u(x,t)');

title('Extended Bernoulli equation');

**jpattern num 1.m for the sparse matrix integration of the 101 ODEs called by the ODE
**

integrator, ode15s, is similar to earlier versions of this routine and therefore is not listed

here. Also, the ODE Jacobian map is not reproduced since it has the expected banded

structure for a single PDE first order in t.

268 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS

**Table 14.1: Selected numerical output from the main program
**

pde 1 main.m of Listing 14.4

t x u(it,i) u anal(it,i) err(it,i)

**0.00 −10.000 0.999955 0.999955 0.000000
**

0.00 −7.500 0.999447 0.999447 0.000000

0.00 −5.000 0.993307 0.993307 0.000000

0.00 −2.500 0.924142 0.924142 0.000000

0.00 0.000 0.500000 0.500000 0.000000

0.00 2.500 0.075858 0.075858 0.000000

0.00 5.000 0.006693 0.006693 0.000000

0.00 7.500 0.000553 0.000553 0.000000

0.00 10.000 0.000045 0.000045 0.000000

0.00 12.500 0.000004 0.000004 0.000000

0.00 15.000 0.000000 0.000000 0.000000

t x u(it,i) u anal(it,i) err(it,i)

**2.00 −10.000 0.999994 0.999994 0.000000
**

2.00 −7.500 0.999925 0.999925 0.000000

2.00 −5.000 0.999089 0.999089 0.000000

2.00 −2.500 0.989013 0.989013 −0.000001

2.00 0.000 0.880796 0.880797 −0.000001

2.00 2.500 0.377544 0.377541 0.000003

2.00 5.000 0.047437 0.047426 0.000011

2.00 7.500 0.004071 0.004070 0.000001

2.00 10.000 0.000335 0.000335 0.000000

2.00 12.500 0.000028 0.000028 0.000000

2.00 15.000 0.000014 0.000002 0.000012

t x u(it,i) u anal(it,i) err(it,i)

**4.00 −10.000 0.999999 0.999999 0.000000
**

4.00 −7.500 0.999990 0.999990 0.000000

4.00 −5.000 0.999877 0.999877 0.000000

4.00 −2.500 0.998499 0.998499 0.000000

4.00 0.000 0.982014 0.982014 −0.000000

4.00 2.500 0.817600 0.817574 0.000026

4.00 5.000 0.268998 0.268941 0.000057

4.00 7.500 0.029328 0.029312 0.000015

4.00 10.000 0.002474 0.002473 0.000001

4.00 12.500 0.000427 0.000203 0.000224

4.00 15.000 0.010740 0.000017 0.010724

ncall = 186

**A portion of the numerical output is listed in Table 14.1.
**

We can note the following points about this output:

. Generally, the agreement between the numerical and analytical solutions is to four

figures or better.

Chapter 14 . Extended Bernoulli Equation 269

**. The exception is at t = 4 near the right boundary at x = 15.
**

4.00 12.500 0.000427 0.000203 0.000224

4.00 15.000 0.010740 0.000017 0.010724

**This output suggests that as the solution travels from left to right, it comes close
**

enough to the right boundary that a boundary effect appears to be developing

numerically (note the increase in the difference between the numerical and

analytical solutions). Thus, if the numerical solution is computed for t > 4, the right

boundary might be extended beyond x = 15, or a boundary condition might be

**. imposed using eq. (14.7) in pde 1.m.
**

The computational effort is quite modest, with ncall = 186.

The plotted output follows. Figure 14.1 demonstrates that the solution is a traveling wave,

which follows from eq. (14.7) and the argument x − ct. The traveling wave solution of

eq. (14.6) is also clear in Fig. 14.2.

Another way to elucidate the traveling wave solution of eq. (14.7) is to consider the

argument x − ct. With c = 1 (set in pde 1 main.m), the numerical solution of Fig. 14.1

should be moving left to right with unit velocity. This is confirmed in the following output

(given in Table 14.2) produced by displaying the solution at x = t rather than every 10th

value as in Table 14.1.

**Extended Bernoulli equation; t = 0, 2, 4; lines – numerical; o – analytical
**

1

0.9

0.8

0.7

0.6

u (x, t)

0.5

0.4

0.3

0.2

0.1

0

−10 −5 0 5 10 15

x

FIGURE 14.1: 2D plot comparing the numerical and analytical solutions of eq. (14.6).

270 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS

Extended Bernoulli equation

0.9

0.8

0.7

0.6

u (x, t)

0.5

0.4

0.3

0.2 4

0.1 3

2

t

−10 1

−5

0

5 0

x 10

15

FIGURE 14.2: 3D plot of the numerical solution of eq. (14.6).

**Note, in particular, the values of the numerical solution u(x = 0, t = 0) = 0.500000,
**

u(x = 2, t = 2) = 0.500004, u(x = 4, t = 4) = 0.500065. In other words, as t increases by 2,

x also increases by 2 for the solution value ≈ 0.5 corresponding to c = 1. Also, there is

an increase in the departure from 0.5 due to accumulating numerical error with increas-

ing t, i.e., 0.000004 and 0.000065 for t = 2 and 4, respectively. If this accumulating error

became excessive, it could be reduced by using more grid points (n > 101), generally

termed h refinement, or a higher-order approximation of the derivative in x in eq. (14.1)

(higher-order than in dss004) could be used, generally termed p refinement.

Also, this accumulating error may originate in the integration with respect to t by the

ODE routine ode15s in which case the error tolerances for this integrator could be tightened

(they are set in pde 1 main.m as abstol,reltol in Listing 14.4). This discussion illustrates

an important conclusion: the total error in a numerical solution is determined by both the

spatial (in x) and the temporal (in t) errors. In other words, it is essential to balance the

spatial and the temporal errors to achieve a numerical solution of acceptable accuracy.

In summary, we have observed the following:

.. The conversion of an ODE (eq. (14.1)) into an associated PDE (eq. (14.6)).

The derivation of an exact solution to the PDE (eq. (14.7)) from the analytical solution

. of the ODE (eq. (14.2)).

The straightforward MOL solution of the PDE for an essentially infinite domain in x.

Chapter 14 . Extended Bernoulli Equation 271

**Table 14.2: Selected numerical output from the main program
**

pde 1 main.m of Listing 14.4

t x u(it,i) u anal(it,i) err(it,i)

. .

. .

. .

0.00 −0.250 0.562177 0.562177 0.000000

0.00 0.000 0.500000 0.500000 0.000000

0.00 0.250 0.437823 0.437823 0.000000

. .

. .

. .

2.00 1.750 0.562182 0.562177 0.000005

2.00 2.000 0.500004 0.500000 0.000004

2.00 2.250 0.437827 0.437823 0.000003

. .

. .

. .

4.00 3.750 0.562240 0.562177 0.000063

4.00 4.000 0.500065 0.500000 0.000065

4.00 4.250 0.437887 0.437823 0.000064

. .

. .

. .

Appendix

At the beginning of this chapter, it was demonstrated that the partial differential equation

(renumbered here from (14.6) to (14.9) to facilitate the subsequent discussion)

θ0 ∂u 1 ∂u

− + bu (1 − u) = 0, u = u(x, t), t > 0 (14.6, 14.9)

2 ∂x c ∂t

**can be derived from the original ordinary differential equation (14.1). In this appendix, by
**

application of the tanh method, we provide simple confirmation that the traveling wave

solution of this equation is the same as the original solution given in eq. (14.7).

We begin by using the transformation u(x, t) = U(ξ ) where ξ = k(x − ct), which reduces

the PDE of eq. (14.9) to the ODE

dU

θ0 + bU (1 − U) = 0 (14.1, 14.10)

dξ

12) 1 + eb(x−ct)/θ0 This solution can also be found using the exp and/or the Riccati methods. >read("tanhMethod. but the Maple listings are not included here in order to save space.t)): ># Define problem PDE pde1:=(theta[0]/2)*(diff(u. with(PDEtools): with(PolynomialTools): with(plots): >alias(u=u(x. ># Create 3D plot plot3d(zz.30.axesfont=[TIMES...pde1.7.intFlg..infoLevOut).HORIZONTAL. ># Extended Bernoulli Equation # Attempt at Malfliet's tanh solution restart. reduces 2 2 to the original solution used for the numerical simulation in the main body of this chapter. ># NOTE: Following transformation x0:=0. labels=["x". c:=1.20. ROMAN.grid=[100.59].t)"]. .11) 2 2 2 θ0 1 X which.100]. axes=framed. numpoints=100. ># Plot results # ============ theta[0]:=1.txt"). exp)).t))+b*u*(1-u)=0.5 results in the traveling wave solution 1 b (x + x0 − ct) 1 1 u= − tanh (14. ROMAN.x=-10. 16]. orientation=[-72. # Set order of approximation infoLevOut:=0.20. ROMAN. # Create animation animate(zz.axes='framed'.30.272 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS as expected. u2:=simplify(convert(zz. 16])."u"].title="Extended Bernoulli Equation". thickness=3. style=patchnogrid. 1 u= (14. ROMAN.labels=["x".VERTICAL].."t".frames=50.x)-(1/c)*diff(u. 14. titlefont=[TIMES.t=0.. ># Choose solution 4 zz:=rhs(sol[4]). i. Application of the tanh method using the Maple script shown in Listing 14.axesfont=[TIMES.t=0. labeldirections=[HORIZONTAL. # Minimum level of output tanhMethod(M. using the relationship 1 − tanh = (1 + exp X )−1 and setting x0 = 0. the associated files are included with the downloads provided for this book. However.x=-10."u(x. b:=1. labelfont=[TIMES. 16].e. >intFlg:=0: # integration of U(xi) not needed! M:=1. 16].

. Herrero. References [1] A. Barrett. Fasano. (14. L. Advanced Engineering Mathematics. 42–44. [2] C.A. 220 (2009) 45–56. Rodrigo. Math. M.5: Maple code to obtain the traveling wave solution for eq. Sixth ed. Biosci. ROMAN. Extended Bernoulli Equation 273 labelfont=[TIMES. Slow and fast invasion waves in a model of acid-mediated tumour growth. Wylie. ROMAN.R.C. 16]). . shading=Z. titlefont=[TIMES.. New York. 16]. M. McGraw-Hill Inc. Chapter 14 . LISTING 14.R.9). 1995. pp.title="Extended Bernoulli Equation".

Traveling Wave Analysis of Partial Differential Equations DOI: 10.4a) u(x = xu .u) % % Function pde_1 computes the t derivative vector for the hyperbolic . p213) with an exponential nonlinearity is ∂ 2u ∂ 2u = a2 2 + beβu (15. (15. (15. we have considered PDEs first order in the initial value variable generally designated as t. and C are arbitrary constants. (15. t) (15.1) ∂t 2 ∂x where a. (15. B.2) with respect to t. t) = ua (x = xu .2) with t = 0. A second IC is available by differentiating eq. All rights reserved.4) constitute the problem programmed in the following Matlab routines. 15 Hyperbolic Liouville Equation To this point. To start.3) ∂t β 2(a2 A2 − B2 ) bβ cosh3 (Ax + Bt + C) and setting t = 0.1016/B978-0-12-384652-5. b. (15.4b) Equations (15. t). t) = ln (15. One initial condition (IC) for eq. Since eq. . An analytical solution is ([3]. " #" # ∂ua (x.1) is eq. BCs for eq.2) β bβ cosh2 (Ax + Bt + C) where A. the hyperbolic Liouville equation ([3]. Note that eq. PDEs of this form are quite common in applications and therefore an approach to their numerical solution is of practical importance. p213) " # 1 2(a2 A2 − B2 ) ua (x.1) is programmed in function pde 1. (15. We now consider a series of PDEs second order in the initial value variable.1)–(15. Equation (15. it requires two ICs. (15. t) 1 bβ cosh2 (Ax + Bt + C) 2(a2 A2 − B2 ) = (−2) sinh(Ax + Bt + C)(B) (15.1) are taken as u(x = xl . t) = ua (x = xl .00015-7 275 Copyright © 2012 Elsevier Inc. and β are arbitrary. function ut=pde_1(t.2) is a traveling wave solution through the combination Ax + Bt + C.1) is second order in t.m listed first.

(15. u1xx=dss044(xl.276 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS % Liouville equation equation % global xl xu x n ncall % % Model parameters global a b beta A B C nu % % One vector to two vectors for i=1:n u1(i)=u(i).xu. end u1t(1)=0.u1x. function ut=pde_1(t. u1(n)=ua_1(x(n). end ut=ut'.1 u1(1)=ua_1(x(1). u1t(n)=0.m for eq. LISTING 15.u1. nu=1.1: Function pde 1. end % % BCs at x = 0. u2t(n)=0. u2(i)=u(i+n).t). u2t(i)=a*u1xx(i)+b*exp(beta*u1(i)).n. ut(i+n)=u2t(i). % % PDE for i=2:n-1 u1t(i)=u2(i). u1x(1)=0.t). % % Increment calls to pde_1 ncall=ncall+1.1).nu).u) % % Function pde_1 computes the t derivative vector for the hyperbolic % Liouville equation % global xl xu x n ncall % % Model parameters global a b beta A B C nu .nl.m: . We can note the following details about pde 1. u2t(1)=0. % % u1xx nl=1. % % Two vectors to one vector for i=1:n ut(i) =u1t(i). The function and some global variables are first defined.

to facilitate the numerical solution of eq.t).n) are zeroed to ensure that the boundary values remain at the values prescribed by eqns. u2t(n)=0. u2(i)=u(i+n). The net effect is to write the second-order PDE in t as two first-order PDEs in t.4a. must be defined numerically. u1.5b)). general in the sense that it can usually be applied to any second-order PDE of interest.nl. (15. u1x(1)=0. The 1D ODE-dependent variable vector of length 2n.u1. % % One vector to two vectors for i=1:n u1(i)=u(i). u. u1xx=dss044(xl. nu=1.5a) ∂t ∂u2 ∂ 2 u1 = a2 + beβu1 (15. Also. (15. Hyperbolic Liouville Equation 277 . (15.1) (or eq. u1xx.5b) are then programmed in a for loop. each of length n. % % u1xx nl=1. u2t(i)=a*u1xx(i)+b*exp(beta*u1(i)). Chapter 15 . can then be used in the programming of eq. In the case of eq.1 u1(1)=ua_1(x(1). is transferred to two 1D arrays. . % % PDE for i=2:n-1 u1t(i)=u2(i).n. (15. the procedure is quite . is not actually used with the Dirichlet BCs but is included only to satisfy the Matlab requirement that all of the input (RHS) arguments of a function. (15. nu=1. u2t(1)=0.5b) ∂t ∂x2 This procedure of working with two first-order PDEs in t permits the use of library integrators for first-order ODEs such as ode45 and ode15s. Note also that the derivatives in t of the ODEs at the boundaries (i=1.1). The BCs (15.1).5a.1).u2. The second derivative .4b). end u1t(1)=0. (15. Also.4) are designated as Dirichlet through nl=1. such as u1x in dss044.u1x. from dss044. end This use of two 1D arrays is a standard procedure for accommodating a PDE second order in t such as eq. Note that BCs (15. u1t(n)=0.4) are programmed as % % BCs at x = 0. this gives ∂u1 = u2 (15. u1x(1)=0.xu. Equations (15. u1(n)=ua_1(x(n).t). the first derivative in x.nu).

t0). pde 1. ut(i+n)=u2t(i). the initial val- ues of u1 for eq.m is incremented.2: IC function inital 1. Also. In summary.t0).m (which has the programming for eq. The two derivative vectors.m defines a grid in x of 51 points for −1 ≤ x ≤ 1.278 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS .m discussed subsequently.m through the vector u0 to the main program pde 1 main.u2t. (15. n=51. function u0=inital_1(t0) % % Function inital_1 sets the initial condition for the hyperbolic % Liouville equation % % Parameters shared with other routines global xl xu x n ncall % % Spatial domain and initial condition xl=-1. are then returned to a single derivative vector ut to be returned from pde 1. .5a.m receives the dependent variable vector u as an input (along with the independent variable t) and returns the derivative vector ut. xu= 1. (15.m. (15. (15.m with a transpose included to meet the requirement of ode15s.3) with t = 0. the counter for pde 1. u0(i+n)=u2(i).m from eqns. inital 1. (15. end ut=ut'. end LISTING 15. defines initial values for u1 and u2 in eqns. In the for loop.m (which has the programming for eq.5a) are provided by the function ua 1. the initial values of u2 for eq. dx=(xu-xl)/(n-1). All 2n initial condition values are returned from inital 1. (15. % % Two vectors to one vector for i=1:n ut(i) =u1t(i). u1t.3)).2) and (15. % % ICs from analytical solution for i=1:n x(i)=xl+(i-1)*dx. u0(i) =u1(i). u2(i)=uat_1(x(i).2). (15.5b). The IC function.2)). u1(i)= ua_1(x(i).5b) are provided by the function uat 1. Function ua 1.m is a straightforward implementation of eq. inital 1. % % Increment calls to pde_1 ncall=ncall+1.

uanal=(1/beta)*(b*beta*cosh(xi)ˆ2/nc)*(-2*nc/(b*beta*cosh(xi)ˆ3)). B=-1. LISTING 15. Chapter 15 . (15. nc=2*(aˆ2*Aˆ2-Bˆ2). uanal=(1/beta)*log(nc/(b*beta*cosh(xi)ˆ2)). (15.m is a straightforward implementation of eq.m for the analytical solution of eq.3: Function ua 1.9. . b=1.2). u0=inital_1(t0). Function uat 1. tout=[t0:0.m is listed next. % % Initial condition t0=0. A=2. Hyperbolic Liouville Equation 279 function uanal=ua_1(x.3). LISTING 15. (15.3).m for the analytical solution of eq.t) % % Function uanal computes the time derivative of the exact solution % of the hyperbolic Liouville equation % % Model parameters global a b beta A B C nc % % Analytical solution derivative xi=A*x+B*t+C.4: Function uat 1..t) % % Function uanal computes the exact solution of the hyperbolic Liouville % equation for comparison with the numerical solution % % Model parameters global a b beta A B C nc % % Analytical solution xi=A*x+B*t+C.3:tf]'.0.. % % Clear previous files clear all clc % % Parameters shared with other routines global xl xu x n ncall % % Model parameters global a b beta A B C nc % % Model parameters a=1. C=0. % % Independent variable for ODE integration tf=0. *sinh(xi)*B. function uanal=uat_1(x. The main program pde 1 main. beta=1.

% % Plot numerical and analytical solutions figure(2) plot(x.t)') title('hyperbolic Liouville equation.u]=ode45(@pde_1.6f\n'.anal') .x. errors in numerical solution for it=1:nout u1(it.2f%8.i)=u(it.i)).u1.280 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS nout=4.err(it..6f%15.'AbsTol'. o .. abstol=1. u2(it. u1(it.1)=ua_1(x(1).i)=u(it.u1(it.tout. solid .i+n).i) err(it. 0.0e-06. options=odeset('RelTol'. 0.i)-u1_anal(it. end % % Implicit (sparse stiff) integration if(mf==2) S=jpattern_num_1.u0.i).u0.'-'.t(it)).'JPattern'..options).ncall).6f%15.t(it)). end end % % Store analytical solution.i)\n').abstol).i).n)=ua_1(x(n). err(it.0e-06.'o') xlabel('x') ylabel('u1(x.u1_anal(it. end end % % Display selected output for it=1:nout fprintf('\n t x u1(it. options=odeset(options. end end fprintf(' ncall = %4d\n\n'.i)=u1(it.6.3.reltol. for i=1:n u1_anal(it.i). t = 0.tout. ncall=0.u1_anal.3f%15.i)=ua_1(x(i).9.u]=ode15s(@pde_1.num.i).S). % % Explicit (nonstiff) integration if(mf==1)[t. end % % One vector to two vectors for it=1:nout for i=1:n u1(it. t(it). [t. reltol=1. for i=1:1:n fprintf('%6.options).x(i).i) u1_anal(it. 0.t(it)). % % ODE integration mf=2.

reltol.9 with displayed values at t = 0. . Previous files are cleared.5a. (15. tout=[t0:0. % % Explicit (nonstiff) integration if(mf==1)[t.5) are set numerically by inital 1.0e-06. 0. options=odeset('RelTol'. % % Independent variable for ODE integration tf=0. u0=inital_1(t0).options). beta=1. .t)').9.9. The ICs for eqns. LISTING 15.3:tf]'. ylabel('t'). b=1.5b)). (15. Chapter 15 . title('hyperbolic Liouville equation').u1) xlabel('x'). zlabel('u1(x. (15. % % Initial condition t0=0. 0. 0. We can note the following details about pde 1 main.u]=ode45(@pde_1. % % Clear previous files clear all clc % % Parameters shared with other routines global xl xu x n ncall % % Model parameters global a b beta A B C nc % % Model parameters a=1.'AbsTol'. C=0.m. nout=4. The ODE integration is by ode15s (mf=2). reltol=1.m: .5: Main program for the solution of eq. and the problem parameters are defined as global and numerically.0e-06. nc=2*(aˆ2*Aˆ2-Bˆ2). B=-1.t. % % ODE integration mf=2.0. ncall=0.abstol).1) (eqns. end % % Implicit (sparse stiff) integration if(mf==2) S=jpattern_num_1. . Hyperbolic Liouville Equation 281 figure(3) surf(x.6. and the interval in t is defined as 0 ≤ t ≤ 0. abstol=1.3. A=2.u0.tout.

computational effort required to produce the numerical solution.u1_anal(it. end end .t(it)).2f%8.u2. the analytical solution is put in array u1 anal and the difference between the numerical and analytical solutions is put in array err.u]=ode15s(@pde_1. end end fprintf(' ncall = %4d\n\n'.u1(it. (15.t(it)). is placed in two arrays. corresponding to eq. u1.5) to facilitate displaying the solution. err(it.i). The numerical solution at the boundaries (i=1. and a 3D plot of the numerical solution is produced by surf.options).n) is set by the analytical solution from ua 1. % % Store analytical solution.'o') xlabel('x') ylabel('u1(x.i)-u1_anal(it. for i=1:n u1_anal(it. end end % % Display selected output for it=1:nout fprintf('\n t x u1(it.i).n)=ua_1(x(n). u1(it. Then.282 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS options=odeset(options. end . The solution vector from ode15s. Numerical output is displayed by two nested for loops (in t and x). for i=1:1:n fprintf('%6.6f\n'.u1_anal.i).i)=u(it. the counter for the number of calls to pde 1. A 2D plot with the numerical and analytical solutions is produced by plots.1)=ua_1(x(1).m.i)\n').'-'.6f%15.x(i).ncall)..x.i+n).i) u1_anal(it.S).t)') .i)=u1(it.tout.i).. and finally. [t.'JPattern'. t(it). u.6f%15. % % Plot numerical and analytical solutions figure(2) plot(x. u2(it.i)=ua_1(x(i).t(it)).i)=u(it.m is displayed as an indication of the .i)).i) err(it.err(it. errors in numerical solution for it=1:nout u1(it.3f%15. % % One vector to two vectors for it=1:nout for i=1:n u1(it.u1..u0.

(15. fac=[]. Figure 15. the traveling wave solution produced by eq. zlabel('u1(x. The plotted solutions follow.6: Statements in jpattern num 1.ytbase.ybase.5a. In summary. vectorized='on'.ybase). % % Sparsity pattern of the Jacobian matrix based on a % numerical evaluation % % Set independent. A portion of the numerical output from pde 1 main. to identify the maximum of the solution at t = 0. Chapter 15 . 1 vary with t according to eqns. Also.m.m for the sparse matrix integration of the ODEs is not listed here. thresh=1e-16. end ybase=ybase'. The ODE Jacobian map from jpattern num 1.2) with the argument Ax + Bt is clear. solid . figures or better. the refor- mulation of an nth-order PDE as n PDEs first order in an initial value independent variable . 0. (15. we have discussed the numerical solution of a PDE second order in t (eq.2 demonstrates that the boundary values at x = −1.5.fac]=numjac(@pde_1. 0. 0. t = 0. Figure 15.t. 0.3. the agreement between the numerical and analytical solutions is to five .5. Hyperbolic Liouville Equation 283 title('hyperbolic Liouville equation. although the estimation of the wave velocity B/A (from A(x + B/At)) using the numerical solution (as in Chapter 12) would require greater resolution in x in the numer- ical solution. title('hyperbolic Liouville equation'). 15. (15.4) and as programmed in pde 1.m. ylabel('t').fac. Rather just the statements for the 2n = 2(51) ODEs and the use of pde 1.9. dependent variables for the calculation % of the sparsity pattern tbase=0.t)').1. Generally.6. LISTING 15. ybase(i+n)=0.m is listed in Table 15. .m indicates two bands for PDEs (15. for example. The computational effort is quite modest.tbase.anal') figure(3) surf(x.6. o . [Jac.2) and (15.3 is produced by the call to surf in the main program of Listing 15. jpattern num 1. % % Compute the corresponding derivative vector ytbase=pde_1(tbase.1.1)) by restating the PDE as two PDEs first order in t (eq.3.m are listed. 0. 0. (15.5b) in Figure 15.5.5)). with ncall = 183. for i=1:n ybase(i)=0.m for 2n ODEs and the use of pde 1.num.9.thresh.u1) xlabel('x'). We can note the following points about this output: Generally.vectorized).

m indicating two bands for eqns.5). which facilitates the calculation). k represents wavenumber.807%) 0 10 20 30 Semidiscrete equations 40 50 60 70 80 90 100 0 10 20 30 40 50 60 70 80 90 100 Dependent variables FIGURE 15. The first method is very straightforward and leads to a variable separable solu- tion. t) = U(ξ )/β. that can be integrated . 2] using two methods. and c represents wave velocity (Note the division of U(ξ ) by β.1: ODE Jacobian map from jpattern num 1. We then have an equation that can be split into separate terms. one a function of U and the other of ξ . We have also applied this idea of reformulating a higher-order PDE in a boundary value variable as a system of lower-order PDEs in the boundary value variable. (t) is straightforward and permits the use of an integrator such as ode15s for first-order ODEs. Appendix We conclude this chapter by analyzing the hyperbolic Liouville equation [1.284 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Jacobian sparsity pattern – nonzeros 292 (2. (15. where ξ = k(x − ct). but we will not discuss this type of problem here. We start by applying the traveling wave transformation u(x.

00 0.734704 0.691061 1.800 −0.785366 0.840 −0.00 0.400286 0.90 −0.120 1.200 1.000000 0.469039 0.120 1. .310267 −0.00 0.858246 0.00 0.000000 0. .000 −2. .00 −0.000000 0.00 0.000 1.000000 0.920 −0. 0. .000000 0.880 −0.6 removed .766268 1.000001 0.00 0.000000 0.000000 0.785366 1.080 1. .000000 0.400286 0.766268 1.840 −0.691061 1.00 −0.704478 −0.000000 0.880 −2.000000 0.101853 0.800 −1.160 1.00 −0.151708 −0. 0.00 −0.551766 −0. .691061 0.000000 0.000000 0.000000 0.000001 (Continued ) .785366 0.00 0.704478 0.800 −0.00 1.880 −0.151709 −2. . .000 −0.101853 −0.00 −0.920 −2.704478 −0.635852 1.691061 0.400286 −0.627992 −2. .00 −0.250237 −0.040 1.704478 0. .000002 0. .791759 0.250237 0. .000000 0.1: Selected numerical output from the main program pde 1 main. .00 −0.766268 0.250237 0.469039 −2.734704 1.90 −0.993398 −1.835378 −1. .i) err(it.310268 −2.90 −0.i) 0.635852 0.000000 .i) u1 anal(it.080 1.000000 0.000000 0.90 −1.00 −0.250237 −0.000000 0.000000 0.858246 0.635852 0.160 1.734704 0.040 1.840 −1.551766 −0.993397 −0.551766 0.400286 −0.000000 . .627992 0.00 0.766268 0.00 −1.00 −0. .835377 −0.00 −0.960 −0.000000 0.791759 1.960 −2.000000 0.000001 0.000000 0.551766 0. .785366 1.00 0.101853 0.90 −0.000000 0. Chapter 15 .5 t x u1(it.920 −0.000000 .00 0.200 1. output for t = 0. Hyperbolic Liouville Equation 285 Table 15. .858246 −0. 0.734704 1.635852 1.000 −0.m of Listing 15.101853 −0.90 −0.00 0.i) u1 anal(it.3.i) 0.i) err(it.858246 −0. t x u1(it. . .960 −0.

800 1.i) u1 anal(it.400 1.788161 1.893568 −0.000001 0.440 1.759533 1.337217 1. the calculation sequence is ∂ 2u ∂ 2u − a2 2 = beβu (15.90 0.620314 −0.000000 0.90 0.000 0.000001 0.90 0.893568 0.767887 0.236588 −0. t). .280 1.791360 1.000001 0.90 0.759533 0.90 0.1: (Continued ) t x u1(it.703077 1.90 0.791359 0.000001 0.551529 1.i) .772224 1.014029 1. .703078 −0.320 1.788162 −0.000000 0.724908 −0.i) err(it.337219 −0.1.000002 0.600 1. 0.90 1.781776 0. A solution for u is obtained by the inverse transformation U(ξ ) = βu(x. .286 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 15.678320 −0.920 1.90 0.480 1.000001 0. (15.880 1.000001 0.90 0.551530 −0.840 1.000000 0.360 1.014030 −0.90 0. .000000 0.781777 1.90 0.724907 1.772223 0.000000 ncall = 183 directly.90 0.000001 0.128607 1.9) β bβ (x + x0 − ct)2 .90 0.90 0.128608 −0.240 1.200 1.236587 1.000001 0.90 0.560 1.960 0. 0.743746 1.90 0.8) c 2 k 2 − a2 k 2 2 ⇓ inverse transformation ! 1 2 c 2 − a2 u = ln . .000000 0. 15.520 1. . .678320 1. .6) ∂t 2 ∂x ⇓ transformation d2 U bβeU 2 = 2 2 (15. Thus.000000 0.767887 0.743745 0.7) dξ c k − a2 k 2 ⇓ integration bβξ 2 e−U = (15.000001 . . .90 0.620313 1.

(15.6 −0.t.5 0 u1 (x.9) is given in Listing 15.U)-b*beta/(cˆ2*kˆ2-aˆ2*kˆ2)*int(1. (15.5 1 0.2) (Note this solution becomes singular when x + x0 − ct = 0). o – analytical 2 1. 0.3. it is not the solution we seek.x.U). (15. (15.xi.xi)=0. i.6.5 −2 −2.8 −0. >ode2:=collect(ode1.pde1.4 0.9. xi=k*(x-c*t). ># Isolate U eqn2:=isolate(eqn1.9) is a valid rational solution to eq.2: 2D plot comparing the numerical and analytical solutions of eq.6).u=U(xi)/beta}.2 0. However.[xi.t)):alias(u=u(x.{diff(U(xi).4 −0. tr1:={x=(xi/k+c*tau). Hyperbolic Liouville Equation 287 Hyperbolic Liouville equation. (5. although eq..2 0 0.t)): >pde1:=diff(u. t) −0. 0.eqn2).U. (15. Chapter 15 .xi)ˆ2. ># Separate variables and integrate eqn1:=int(exp(-U).6 0.xi.5 −1 −1. ># Inverse transformation xi=k*(x-c*t).xi=k*(x+x0-c*t)}.u).U(xi)]).1) (eqns. 0. U(xi)=u*beta pdeSol1:=isolate(subs({U=u*beta.5b)) moving left to right in x for t = 0.5a. . eq.x)-b*exp(beta*u)=0. The Maple code that generates the solution of eq.xi)}).7.t=tau.5 −3 −1 −0. lines – numerical. ># Assume a travelling wave solution of the form # u=U(xi)/beta.e. the solution used in the main body of this chapter as the basis for the numerical solution. with(PDEtools): with(PolynomialTools): >alias(v=v(x.8 1 x FIGURE 15.diff(U(xi). ode1:=dchange(tr1.tau. ># Hyperbolic Liouville Equation restart.t)-aˆ2*diff(u.

we apply the transformation u = ln(u)/β (15. We now apply the Riccati method to this modified equation. else print("Solution: passes pdetest() !").2 x −0. For the second method.11) ∂t 2 ∂x2 ∂t ∂x While this is a more complex expression than eq. which is slightly more involved.5 0. (15.5 0 −1 FIGURE 15. t) −1 −2 −3 1 0.10) to eq.7: Maple code used to derive the solution of eq. which greatly simplifies the solution process. (15. (5. (15.1) (eqns.5b)). ># Check solution pdeCHK:=pdetest(pdeSol1.288 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Hyperbolic Liouville equation 2 1 0 u1 (x.8 1 0.6). LISTING 15.5a.3: 3D plot of the numerical solution of eq.9). the exponential term has been elim- inated. # '0' if true if pdeCHK <> 0 then print("Solution: does not pass pdetest() !").pde1). end if.4 0 t 0. which yields ! ∂u 2 2 ∂ 2u 2∂ u 2 2 ∂u u − a − + a − bu3 = 0 (15. (15.6 0.1). which generates six trivial solutions and the following six .

and x0 = C/k. k = −2. we arrive at eq.16) bβ −8k2 a2 − c2 1 + tan2 2k(x + x0 − ct) u6 = (15. on closer inspection. this solution takes the form of a triangular-shaped traveling wave with a curved apex—see Figs. which we convert from tanh form to cosh form to give 2k2 a2 − c2 u3 = (15.14) bβ −2k a2 − c2 2 1 + tan2 k(x + x0 − ct) u4 = (15.e.15) bβ 8k a2 − c2 2 1 − tanh2 2k(x + x0 − ct) u5 = (15. Setting t = 0 and x = 0.5. i. 15. Note: while at large scale the traveling wave appears to be a peakon.17) bβ We choose solution u3 . If we use the param- eter values a = 1. 15. the solution used in the main body of this chapter as the basis for the numerical simulation.. see Fig. (15. Hyperbolic Liouville Equation 289 nontrivial solutions: k 2 a2 − c 2 1 − tanh2 k(x + x0 − ct)/2 u1 = (15.18) bβ cosh2 k (−x − x0 + ct) The final solution is obtained by applying the inverse transformation.79. . we see that this is not the case as the spatial derivative does not have a (finite) discontinuity at the peak—unlike the solution for the sine-Gordon equation discussed in Chapter 16.6.19) β bβ cosh2 k (−x − x0 + ct) On letting k = −A.2). on plotting the spatial derivative. c = B/k. ! 2k2 a2 − c2 1 u = ln (15. which gives the traveling wave slopes. and β = 1.6. c = 1/2. 15. We can check if this is the case by taking the limit of du/dx as |x| → ∞.e. b = 1. u = ln(u3 ) /β.4 and 15. we see that the peak value is given by u = ln(6) = 1. Chapter 15 . i.13) 2bβ 2k a2 − c2 2 1 − tanh2 k(x + x0 − ct) u3 = (15. x0 = 0. In addi- tion.12) 2bβ −k2 a2 − c2 1 + tan2 k(x + x0 − ct)/2 u2 = (15.. we observe that the slopes on either side of zero appear to rapidly take on constant values—see Fig.

du .

.

20) dx . lim −4 sinh(2x) = = ∓4 (15.

x=±∞ x → ±∞ cosh(2x) which confirms our visual impression. The Maple code that generates this solution and the associated plots is given in Listing 15.8. .

5: 3D plot of solution to hyperbolic Liouville equation.pde0.t)-alphaˆ2*diff(v. ># Apply a transformation tr0:={v=ln(u)/beta}.x)-b*exp(beta*v)=0.t)):alias(v=v(x. >pde1 := numer(lhs(pde1))*denom(rhs(pde1)) = numer(rhs(pde1))*denom(lhs(pde1)). t) −30 5 −40 4 3 −10 2 t −5 0 1 x 5 10 FIGURE 15. which then moves left to right when activated.290 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS 0 −10 −20 u −30 −40 −10 −5 0 5 10 x FIGURE 15.txt").[u]). 0 −10 −20 u (x. >read("riccatiMethod. with(PDEtools): with(PolynomialTools): with(plots): >alias(u=u(x. pde1:=simplify(dchange(tr0.x.t)): ># Define pde pde0:=diff(v. ># Hyperbolic Liouville Equation # Attempt at Riccati solution restart.4: The initial condition (at t = 0) for a 2D animation of the solution to the hyperbolic Liouville equation.symbolic).t. >intFlg:=0: # integration not needed! .

4–15. (15. ROMAN. ># Test that the solution solves the original pde testSol:=simplify(pdetest(sol1. 16].x=-2.k:=A. labelfont=[TIMES. η). ># Standard solution constants zz:=rhs(sol1). t) = U (ξ .2."u"].HORIZONTAL.1. ROMAN.infoLevOut).. beta:=1. Chapter 15 ..6: Plot illustrating how du/dx → ±4 as x → ∓∞. ROMAN.. shading=Z. orientation=[64.frames=50.axes='framed'.19) and Figs. thickness=3.100]. using the transformation u(x. style=patchnogrid.. 16]). . ROMAN. C:=0. # Set order of approximation infoLevOut:=0.labels=["x".axesfont=[TIMES.pde0). Hyperbolic Liouville Equation 291 3 2 1 du/dx 0 −1 −2 −3 −2 −1 0 1 2 x FIGURE 15.VERTICAL].pde1. (5. labelfont=[TIMES.x=-2.6) is also referred to in the literature as the modified Liouville equation and that it can be converted.8: Maple code used to derive the solution of eq.6. else print("Solution passes pdetest()").title="Hyperbolic Liouville Equation".axesfont=[TIMES. titlefont=[TIMES. Finally. t=0. 16]).t)"]. ROMAN. alpha:=a. B:=-1.c:=-B/k. M:=2. numpoints=100.48]. ># Apply the inverse transform v=ln(u) sol1:=v=ln(rhs(soln[2. axes=framed. t=0. labels=["x". ># Create animation animate(zz. if testSol<> 0 then print("Solution: does not pass pdetest() !"). 16].2. a:=1. titlefont=[TIMES.1. 15.title="Hyperbolic Liouville Equation".3]))/beta. labeldirections=[HORIZONTAL. riccatiMethod(M."u(x. 16].grid=[100. A:=2. LISTING 15.x0:=C/k.symbolic). b:=1.intFlg. 16]. ># Generate a 3D surface plot plot3d(zz. ROMAN."t". end if. we mention that eq.

Liouville. in: L. Pure et Appliquée. 18 (1) (1853) 71–72. [3] A.292 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS where x = a (ξ − η). η) = beβU(ξ .D. World Scientific Publishing Company. Gu. V. Frontiers in Mathematical Analysis and Numerical Methods: In Memory of Jacques-Louis Lions. t = (ξ + η). Chapman & Hall/ CRC. References [1] C.H. de Math.21) ∂ξ ∂η known simply as the Liouville equation.η) (15. Handbook of Nonlinear Partial Differential Equations. Tatsien (Ed). J.F. On the Classification of Initial Data for Nonlinear Wave Equations. Singapore. Zaitsev. [2] J. 143–148. Sur l’équation aux différences partielles ∂ 2 log λ/∂u∂v ± λ/ 2a2 = 0. pp. Boca Raton. to the equivalent alternative form ∂ 2 U (ξ . . FL. 2004. 2004. Polyanin.

All rights reserved. One IC for eq. p227) ( " #) 4 bλ(kx + µt + θ0 ua (x.1) ∂t 2 ∂x Since the sine-Gordon equation is second order in t. t) = tan−1 exp p (16. t) 4 1 bλ(kx + µt + θ0 ) = #2 exp p (bλµ) ∂t λ bλ(µ2 − ak2 ) " bλ(kx + µt + θ0 ) 1 + exp p bλ(µ2 − ak2 ) " # bλ kx + µt + θ0 Dividing numerator and denominator by exp p gives bλ(µ2 − ak2 ) ∂ua (x. its solution closely parallels that of the hyperbolic Liouville equation of Chapter 15. (16. Note that eq.1) is second order in t. (16.1) is eq.1016/B978-0-12-384652-5. µ. . Since eq. it requires two ICs.00016-9 293 Copyright © 2012 Elsevier Inc.2) with t = 0. Traveling Wave Analysis of Partial Differential Equations DOI: 10.2) λ bλ(µ2 − ak2 ) if bλ(µ2 − ak2 ) > 0 and where k. t) 1 = 2bµ ∂t " # bλ kx + µt + θ0 cosh p bλ(µ2 − ak2 ) . An analytical solution is ([1]. p227) is ∂ 2u ∂ 2u = a2 2 + b sin(λu) (16. (16. and θ0 are arbitrary. t) 4 1 ∂t = λ " #−1 " # (bλµ) bλ kx + µt + θ0 bλ kx + µt + θ0 exp p + exp p bλ(µ2 − ak2 ) bλ(µ2 − ak2 ) which simplifies to ∂ua (x. we use d −1 1 tan x = dx 1 + x2 " # ∂ua (x. (16. A second IC is available by differentiating eq. (16. 16 Sine-Gordon Equation The sine-Gordon equation ([1]. Here.2) defines a traveling wave solution through the combination kx + µt + θ0 .2) with respect to t.

m listed first. u1x(1)=0. ut(i+n)=u2t(i).30 u1(1)=ua_1(x(1).1) is programmed in function pde 1.u1x.nu).n. u1t(n)=0. u1xx=dss044(xl.t). nu=1. u2t(i)=a*u1xx(i)+b*sin(lambda*u(i)). 4b) Equations (16. end % % BCs at x = 0.xu. % % u1xx nl=1.294 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS or ∂ua (x. . t).u) % % Function pde_1 computes the t derivative vector for the sine- % Gordon equation % global xl xu x n ncall % % Model parameters global a b lambda k mu the0 den % % One vector to two vectors for i=1:n u1(i)=u(i). t) = ua (x = xu . u2t(n)=0. (16. t) = ua (x = xl . u2t(1)=0.1) are taken as u(x = xl . Equation (16.4) constitute the problem programmed in the following Matlab routines. t) bλ kx + µt + θ0 = 2bµ sech q (16.nl. end u1t(1)=0.1)–(16.3) ∂t bλ µ2 − ak2 The required IC then comes from eq.u1. % % PDE for i=2:n-1 u1t(i)=u2(i). u2(i)=u(i+n). function ut=pde_1(t. t) (16.4a. % % Two vectors to one vector for i=1:n ut(i) =u1t(i). (16.3) with t = 0 BCs for eq. u(x = xu . u1(n)=ua_1(x(n).t).

1).5a) ∂t ∂u2 ∂u1 = a2 2 + b sin(λu1 ) (16.m: . In the case of eq.u) % % Function pde_1 computes the t derivative vector for the sine- % Gordon equation % global xl xu x n ncall % % Model parameters global a b lambda k mu the0 den . (16. this procedure of working with two first-order PDEs in t permits the use of library integrators for first-order ODEs such as ode45 and ode15s.30 u1(1)=ua_1(x(1).1). (16. u2(i)=u(i+n). the use of two 1D arrays is a standard procedure for accommodating a PDE second order in t such as eq. Sine-Gordon Equation 295 end ut=ut'.m for eq. We can note the following details about pde 1. The 1D ODE dependent variable vector of length 2n. % % u1xx . u1(n)=ua_1(x(n). (16. (16. is transferred to two 1D arrays. % % Increment calls to pde_1 ncall=ncall+1. to facilitate the numerical solution of eq. Chapter 16 . The function and some global variables are first defined. each of length n. LISTING 16.5b) ∂t ∂x As indicated in Chapter 15. as for the case of the hyperbolic-Liouville equation of Chapter 15.t).t).1).1: Function pde 1. this gives ∂u1 = u2 (16. function ut=pde_1(t.u2. second-order PDE of interest. % % One vector to two vectors for i=1:n u1(i)=u(i). The BCs (16. u1.4) are programmed as % % BCs at x = 0. the procedure is quite general in the sense that it can usually be applied to any . u.1). Also. end Again.

Note that BCs (16. u2t(i)=a*u1xx(i)+b*sin(lambda*u(i)). must be defined numerically. .5). are then returned to a single-derivative vector ut to be returned from pde 1.nu).u2t.4) are designated as Dirichlet through nl=1. ut(i+n)=u2t(i). nu=1. such as u1x in dss044. % % Increment calls to pde_1 ncall=ncall+1. function u0=inital_1(t0) % % Function inital_1 sets the initial condition for the sine- % Gordon equation % % Parameters shared with other routines global xl xu x n ncall % % Spatial domain and initial condition xl=0. u1x(1)=0. Note also that the derivatives in t of the ODEs at the boundaries (i=1.5). with a transpose included to meet the requirement of ode15s. the counter for pde 1.4). u1xx=dss044(xl. (16. (16.n. end u1t(1)=0. Equations (16.nl. The second derivative .5) are then programmed in a for loop. nu=1. end ut=ut'.m is incremented. can then be used in the programming of eq.296 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS nl=1. In summary. is not actually used with the Dirichlet BCs but is included only to satisfy the Matlab requirement that all of the input (RHS) arguments of a function.n) are zeroed to .xu. % % PDE for i=2:n-1 u1t(i)=u2(i). ensure the boundary values remain at the values prescribed by eq. u1xx. xu=30. u1t. u2t(n)=0. u1x(1)=0.u1x. pde 1. The two derivative vectors. u2t(1)=0. (16. Also.1) (or eqs.u1. u1t(n)=0. the first derivative in x. from dss044.m. (16.m defines initial values for u1 and u2 in eqs.m receives the dependent variable vector u as an input (along with the independent variable t) and returns the derivative vector ut. Also. % % Two vectors to one vector for i=1:n ut(i) =u1t(i). The IC function inital 1.

5a) are provided by the function ua 1. function uanal=ua_1(x. u0(i+n)=u2(i).5b) are provided by the function uat 1.3: Function ua 1.3). Chapter 16 .m for eqns.m (which has the programming for eq.3) with t = 0. Function ua 1. (16. function uanal=uat_1(x.t) % % Function uanal computes the exact solution of the sine-Gordon % equation for comparison with the numerical solution % % Model parameters global a b lambda k mu the0 den % % Analytical solution xi=k*x+mu*t+the0. Sine-Gordon Equation 297 n=121.m is a straightforward implementation of eq.4: Function uat 1. (16. (16. In the for loop. uanal=2*b*mu/cosh(b*lambda*xi/den). dx=(xu-xl)/(n-1). u2(i)=uat_1(x(i).3).m through the vector u0 to the main program pde 1 main.m discussed subsequently. uanal=(4/lambda)*atan(exp(b*lambda*xi/den)). (16. Function ua1 1.m for the analytical solution of eq.3)). (16.2: IC function inital 1. LISTING 16.t) % % Function uanal computes the time derivative of the exact solution % of the sine-Gordon equation % % Model parameters global a b lambda k mu the0 den % % Analytical solution derivative xi=k*x+mu*t+the0. (16. LISTING 16. u0(i) =u1(i).2).2)). (16. All 2n initial condition values are returned from inital 1.2) and (16. (16. the initial values of u2 for eq. end LISTING 16.m is a straightforward implementation of eq. % % ICs from analytical solution for i=1:n x(i)=xl+(i-1)*dx. the initial val- ues of u1 for eq.m defines a grid in x of 121 points for 0 ≤ x ≤ 30.t0). .m (which has the programming for eq.m for the analytical solution of eq. u1(i)= ua_1(x(i). (16.2). inital 1.t0).

298 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS The main program pde 1 main is essentially the same as pde 1 main of Chapter 15 (for PDEs second order in t) and therefore is not listed here. ylabel('t')..i). and θ0 = 0. but the difference between the two solutions increases with increasing t.6f%15. 3.i)\n'). as indicated in Fig. 16.m for the sparse matrix integration of the ODEs is not listed here since it is the same as for Chapter 15. .u1(it. The numerical and analytical solutions agree at t = 0 as expected. (16. t = 0. We can note the following points about this output: . axis 'tight' xlabel('x'). zlabel('u1(x.2) is computed as err(it. jpattern num 1.ncall).. den=sqrt(b*lambda*(muˆ2-a*kˆ2)). % % Model parameters a=1.t)') title('sine-Gordon equation.u1. k was selected to obtain a significant variation .i) and displayed numerically in the output. t(it). % % Display selected output for it=1:nout fprintf('\n t x u1(it. (16.analytical') figure(3) surf(u1) shading 'interp'.m is listed in Table 16. 6. solid .x(i).i).'o') xlabel('x') ylabel('u1(x. 9.1. (16. k = 4.1) and (16. mu=-5.5). and a 3D plot of the numerical solution is produced by surf. title('sine-Gordon equation').5)) and the analytical solution of eq.1) (u1 of eqs.err(it.3f%15.1. (16. the0=0.u1_anal(it.t)'). The ODE Jacobian map from jpattern num 1. lambda=1.numerical. The numerical and analytical solutions are then superimposed in a 2D plot from Matlab routine plot.. k=4. A portion of the numerical output from pde 1 main. The error in the numerical .6f%15. % % Plot numerical and analytical solutions figure(2) plot(x.i)). end end fprintf(' ncall = %4d\n\n'.i) err(it. In particular. in the solution with x.2f%8.m indicates two bands for PDEs (16. b=0. µ = −5. o . The parameters in eqns.i) u1_anal(it.1.2) are defined numerically.'-'. for i=1:5:n fprintf('%6.u1_anal.x.6f\n'. A few details are as follows. The difference between the numerical solution of eq.

1) a comparison of the accuracy and computational effort of the solutions in Chapters 15 and 16 (better accuracy and less computational effort in Chapter 15) suggests that the numerical solution of nonlinear PDEs can be very sensitive to the details of the equations.. Sine-Gordon Equation 299 Jacobian sparsity pattern – nonzeros 712 (1. with ncall = 530. the computational effort is still modest. (16.1: ODE Jacobian map from jpattern num 1.5). 201 as comments indicating some experimentation with the number of grid points to investigate the . (15. Our experience has indicated that this . changes in the problem parameters can have unexpectedly large effects in the accuracy and required computational effort. Even for a given PDE. solution could be reduced by using more grid points (n > 121).216%) 0 50 Semidiscrete equations 100 150 200 0 50 100 150 200 Dependent variables FIGURE 16. Since the difference between the hyperbolic Liouville equation of Chapter 15 and the sine-Gordon equation of this chapter is rather small.1) and b sin(λu) from eq. but this results in a greater computational effort (note in inital 1. mainly in the nonlinear terms. For the present conditions. accuracy of the numerical solution). Chapter 16 .m the values n = 51. (16.m indicating two bands for eq. beβu from eq.

00 21.278954 6.00 0.000 3.00 25.113969 0.000000 0.996866 5.750 5.300 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 16.00 30.283123 6.00 20.00 11.i) err(it.099935 -0.141593 3.250 4.500 6.00 12.000 6.250 5.000 5.282315 0.250 6.i) u1 anal(it.000000 0.283172 0.224181 0.250 0.000000 0.941803 4.000000 0. .283148 6.034834 0. .00 0.000000 0.059546 9.000000 0.000697 9.00 6.840301 0.000000 0.282882 0.00 10.248351 0.000000 0.283172 6.282882 6.00 17.262621 0. .500 6.00 5.282315 6. .00 26.00 8.00 23.750 1.034834 0.400928 1.000 0.250 6.000 0.280688 6.283006 0.248351 6.799721 0.000000 0.099238 0.061002 .811637 0. .750 6.00 5.133163 0.278954 0.150022 0.000 6.750 6.011177 9.271045 6.000000 0.059004 -0.494642 0.283080 0.000000 0.224181 6.000 6.194166 2.m t x u1(it.281711 0.113969 6.250 0.483465 0.286319 0.000000 0.028664 9.250 6. .00 10.000000 0.000000 0.283006 6.283164 0.750 6.171749 0. .271045 0.183251 0.00 3.000000 9.000000 0.282671 0.500 6.000000 0.00 16.750 6.00 2.471548 5.000 6.00 2.00 22. .750 0.00 3.1: Selected numerical output from the main program pde 1 main. .283164 6.002533 9.141593 0.000000 0.00 15.276018 6.i) err(it.005079 9.000000 0.283148 0.169216 0. t x u1(it.00 1.i) u1 anal(it.000000 0.000 6.000000 .000000 0.283123 0. output for t = 3.262621 6.250 6.00 18.183251 6.941803 0.00 27.500 6.471548 0.500 6.000000 0.341382 0.291398 0.00 7.00 28.150022 4.i) 0.058084 0.280688 0.000920 9.000000 0.i) 9.996866 0.000 2.500 0.799721 5.000000 0.00 7.000000 0.500 4.281711 6.276018 0. 6 removed .00 1.283080 6.00 6.500 0.282671 6.750 6.00 13.00 8. .

00 15. Figure 16. (16.224181 0. Chapter 16 .5)).500 4.000096 9.000526 9.941803 0.281711 6.000000 ncall = 530 unexpected sensitivity generally precludes any statement a priori about the expected accuracy or required computation of a solution to a PDE system.00 30.812024 5. (16.996866 0.00 13.280688 0.002563 9.262621 0.276018 0.00 25.000 6.250 6.012303 9. and other areas of physics and engineering.281711 0.3.500 6.00 27.491899 5.000308 9.032318 9. As noted in Chapter 15.000042 9. we have again discussed the numerical solution of a PDE second order in t (eq.020351 9.4) and as pro- grammed in pde 1.113969 0.000 5. In other words.471548 0.2) with the argument kx + µt + θ0 is clear. In summary.250 6. in the study of fiber optics. each PDE problem should be treated as “new” and experimental. (16. quantum mechanics field theory.118307 6.000893 9.271045 0.m. the traveling wave solution produced by eq.000177 9.1: (Continued) 9.750 4.974121 4.183251 0.750 6. It occurs in the study of geometrical surfaces of constant Gaussian curvature. 30 vary with t according to eqns. Appendix The sine-Gordon equation is so-called as a result of a wordplay on the similar Klein–Gordon equation.280730 6.263146 6.249244 6.141593 0.007325 9.00 21.1)) by restating the PDE as two PDEs first order in t (eq. (16.750 6.185814 6.278954 0.004191 5.057126 9. the reformulation of an nth-order PDE as n PDEs first order in an initial value independent variable (t) is straightforward and permits the use of an integrator such as ode15s for first-order ODEs.276195 6.799721 0. It has been found to be particularly useful in applications that give rise to solitons.00 17.00 23. The plotted solutions follow in figs 16.00 12. . Also.150022 0.001514 9.248351 0.500 6.004337 9.750 6.046656 9.000 6.2 demonstrates that the boundary values at x = 0.00 16.00 20.00 11.250 3.2) and (16.2 and 16.279050 6.500 6. Sine-Gordon Equation 301 Table 16.00 26.225695 6.00 18. for example.00 22.198719 3.250 5.00 28.271353 6.196678 4.000 6.

t = η+ξ (16.6) can be transformed to an alternative form by changing the variables. (16.7) After some algebraic manipulation.6) ∂t 2 ∂x This is a simplified form of eq. .302 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Sine-Gordon equation. Following Drazon and Johnson [2]. 3. o – analytical 7 6 5 4 u1(x. top to bottom for t = 0.1). eq. 6. 9).2: 2D plot comparing the numerical and analytical solutions of eq. where we have set λ = 1. (16.1) (eqs.5). (16. lines – numerical. There are two common forms used in studies of relativity. 2 A light cone is formed by all past and future events that can be connected by light rays.8) ∂ξ ∂η 1 Laboratory coordinates apply where the observer is located within an inertial laboratory. we arrive at the second form in light-cone coordinates 2 ∂ 2u = β sin (u) (16. (16. x = α(η − ξ ). The first form is defined in laboratory coordinates1 by ∂ 2u ∂ 2u − α 2 2 = β sin (u) (16. t) 3 2 1 0 0 5 10 15 20 25 30 x FIGURE 16.

we obtain z = − 1. t) 3 2 1 0 10 8 30 6 25 20 t 4 15 2 10 x 5 0 0 FIGURE 16.11).13) ∂ξ ∂η ∂η . (16. (16.1) (eqs.12) 1 ∂ 2w On rearranging eq. (16. which we use to eliminate z from w ∂ξ ∂η eq. Chapter 16 . (16.11) ∂ξ ∂η ∂ξ ∂ξ ∂ξ ∂w 2 2z + z2 + − β 2 + 1 = 2 [β cos (u) − 1] + [β cos (u) − 1]2 ∂η + β 2 sin2 (u) − β 2 + 1 = 0 (16.12) and obtain the following new equation in w.9) ∂ξ z = β cos (u) − 1 (16. We now seek an analytical solution (adapted from [3]) and start by introducing the following new variables ∂u w= (16. !2 2 ∂ 2w ∂w + w2 − β 2 w2 = 0 (16. Sine-Gordon Equation 303 Sine-Gordon equation 7 6 5 4 u1(x.3: 3D plot of the numerical solution of eq.5)).10) from which we note that ∂ 2w ∂ ∂u ∂u − w − wz = [β sin (u)] − − [β cos (u) − 1] = 0 (16.

while this equation may seem more complex than the above equations.11)..e. " ! # 2 (−x/α + t) k2 + β (x/α + t) u = arccos 2 tanh −1 . to eq. η = (x/α + t) /2 to obtain the desired result. we obtain v ! 2 ξ k + βη 2 u u w = 2k 1 − tanh t (16.20) 2k Equation (16. (16. (16. (16.20) is a soliton traveling wave solution to the sine-Gordon eq. i. i.8). which gives 2 2 ! ∂v ∂v ∂v ∂v ∂ 2v −4 v ∂η ∂ξ ∂η ∂ξ ∂η∂ξ !2 2 ∂ 2v ∂v +4 v2 + 4 v3 − 16β 2 v4 = 0. we use the inverse transformation ξ = (−x/α + t) /2.6) in labora- tory coordinates—see Fig.e. .17) k Applying the inverse transformation u = arccos [(z + 1) /β] . it does readily yield the following traveling wave solution by application of the tanh method.304 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS We now make a further transformation by letting v = w2 .16) k 1 ∂ 2w and.15) k k where k is an arbitrary constant. we obtain w ∂ξ ∂η ! 2 ξ k2 + βη z = 2β tanh −β −1 (16..4 where we have used the following parameter values: α = 1.18) we obtain " ! # 2 ξ k2 + βη u = arccos 2 tanh −1 (16. (16. " !# ! 2 2 ξ k2 + βη 2ξ k2 + βη v = 4k 1 − tanh = 4k sech . √ By applying the inverse transformation w = v. (16.19) k This is a traveling wave solution to the sine-Gordon equation in light cone coordinates. (16. Finally.14) ∂η∂ξ ∂η Now. (16. 16. We continue with the tanh form as it leads to a more compact final solution. again using z = − 1 from eq.

5 30 20 t 10 25 20 15 10 5 x 0 −5 0 FIGURE 16. A peakon (peaked soliton) is a special type of soliton which has a discontinuity in the first derivative at its peak—see Fig.5 2 u (x. not the only solution as there are an infinity of traveling wave solutions to this famous equation. Drazin and Johnson. t) 1.5. with(PDEtools): with(PolynomialTools): with(plots): >alias(u=u(x. A Maple code that performs the above calculations and generates animated and 3D plots is given in Listing 16. of course.5 1 0. the wave peak value is umax = π.t)): alias(v=v(x. However. ># Sine-Gordon Equation # Attempt at Malfliet's tanh solution # See: Solitons: An Introduction. Peakons with a negative peak are sometimes referred to as antipeakons. it is a peakon.4: 3D plot of solution to sine-Gordon equation. 16.5. Note.t)): ># Sine-Gordon equation in laboratory coordinates . Chapter 16 . β = 1. 2 1 du/dx 0 −1 −2 −10 −5 0 5 10 x FIGURE 16. Sine-Gordon Equation 305 3 2.5: Plot illustrating the discontinuous first derivative at the peak of the peakon solution to the sine-Gordon equation. or hump-type soliton.t)): alias(w=w(x. it is not the familiar kink. p110-112 restart. It is.t)): alias(z=z(x. and k = 2.

x0=0}.x)-beta*sin(v)=0. >read("tanhMethod.t=(xi+eta)}.symbolic).142 (pi) sol2a:=subs({alpha=1. ># Apply a transformation to convert to 'light cone' co-ordinates tr0:={v=W(xi.x=-5. ># Test solution in 'light cone' co-ordinates simplify(pdetest(sol1.t)-w-w*z=0).k=2. ># Apply a transformation to facilitate use of tanh method tr3:={w=uˆ(1/2)}.symbolic).symbolic). 16]).t=(t+x/alpha)/2}.x.symbolic).pde.eta).. title="Sine-Gordon Equation\n Light cone Co-ordinates".z).30.pde1. . pde0:=simplify(dchange(tr1.xi.x. animate(sol1a. eqn2:=2*z+zˆ2+diff(w.eta).[v. axes=framed. ># Calculate solution for transformed problem intFlag:=0: # No integration of U(xi) needed! M:=2.symbolic).rhs(sol1)). ROMAN.intFlag.25. ># Animate the final solution # NOTE: u(max)=3. pde1:=simplify(dchange(tr3. titlefont=[TIMES.[u]). pde0:=simplify(dchange(tr0. t=0.t)ˆ2-betaˆ2+1=0. w:=diff(v.x. numpoints=300.pde0.142 (pi) sol1a:=subs({beta=1.symbolic).t]).frames=50. t=0. tanhMethod(M.txt").pde1. ROMAN. # Set order of approximation infoLevOut:=0.t. ># Apply the inverse transform to obtain # solution in 'light cone' co-ordinates sol1:=v=arccos((z+1)/beta).pde0).k=2.. numpoints=300. ># Transform solution back to original co-ordinates sol2:=v=subs({x=(t-x/alpha)/2. ># Test final solution in original pde simplify(subs(sol2.x. ># Now apply a change of variables: z:=beta*cos(v)-1. ROMAN.frames=50. axes=framed. 16]..306 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS pde:=diff(v. z and pde0 we obtain eqn1:=simplify(diff(w.symbolic). ># Apply solZ and cross multiply eqn2 # to eliminate denominators z:=solZ.t)/w-1. ># From w.25. ># solve for z using eqn1 solZ:=solve(eqn1.thickness=3.eta=t}.eta]).t)-alphaˆ2*diff(v.x). ># Apply inverse transformation: w=sqrt(u) w:=simplify(rhs(sol[3])ˆ(1/2).infoLevOut).rhs(sol2)). 16]."u"].x=-5. animate(sol2a.[W(xi.beta=1.xi=x.axesfont=[TIMES.80. pde1:=numer(lhs(eqn2))*denom(rhs(eqn2))=0.pde).eta)=v.x=alpha*(-xi+eta). ># Animate the final solution # NOTE: u(max)=3. labelfont=[TIMES..x0=0}. unassign('w'. ># Calculate z z:=simplify(diff(w.rhs(sol1)). labels=["x".'z'). ># Revert back to original variables tr1:={W(xi.

[3] W. UK. ROMAN. 16].F. .HORIZONTAL. 16]). Exact Solutions of Nonlinear Partial Differential Equations: The Tanh/Sech Method. November. axes=framed. title="Sine-Gordon Equation . R."t". Solitons: An Introduction.First Derivative Laboratory Co-ordinates". Wolfram Research.x=-10."u"]. Drazin. 16]).30. FL. Champaign.5: Maple listing to derive traveling wave solutions to the sine-Gordon equation using the tanhMethod() procedure.S. Cambridge.t)"]. Polyanin. labels=["x".thickness=3. t=0. style=patchnogrid. Inc.axesfont=[TIMES. Zaitsev. [2] P.x=-5. However. ROMAN. 16]. Boca Raton. References [1] A.axesfont=[TIMES. Chapter 16 . ROMAN. 16]). title="Sine-Gordon Equation\n Laboratory Co-ordinates". titlefont=[TIMES.100].beta=1."du/dx"]. ROMAN. ># Generate a 3D surface plot plot3d(sol2a.. Cambridge University Press. 2004. the associated files are included with the downloads provided for this book.10. labelfont=[TIMES. Chapman & Hall/ CRC. ROMAN. ROMAN. orientation=[-114.VERTICAL]. V.grid=[100.. labeldirections=[HORIZONTAL.axesfont=[TIMES.VERTICAL]. 2000. diffSol2:=subs({alpha=1. ROMAN.G.k=2. LISTING 16. Sine-Gordon Equation 307 labels=["x". which is a solitary wave with # discontinuous first derivative diffSol2:=diff(rhs(sol2)."u(x.thickness=3. Handbook of Nonlinear Partial Differential Equations. 16]. notes from invited lecture. 16].52]. ROMAN. 1992.x0=0. plot(diffSol2.. numpoints=200. title="Sine-Gordon Equation\n Laboratory Co-ordinates". labelfont=[TIMES. Illinois. # a peaked soliton.shading=Z.labels=["x". Johnson. Hereman.x).t=0}.diffSol2). labeldirections=[HORIZONTAL. 16]. ROMAN. titlefont=[TIMES.25.. but the Maple listings are not included here in order to save space. 16]. titlefont=[TIMES. labelfont=[TIMES.axes='framed'.D. Traveling wave solutions can also be found to the sine-Gordon equation using the exp and/or the Riccati methods. ># Now show that the solution is actually a 'Peakon'.

t) = sin(x) cos(ct) = [sin(x + ct) + sin(x − ct)] .3) 2 Note that eq. All rights reserved.4b) ∂t . we consider the analytical solution 1 ua (x. α = −c2 . we use eq.3) ∂ 2u −c2 sin(x) cos(ct) ∂t 2 ∂ 2u −c2 2 c2 sin(x) cos(ct) ∂x Sum of terms Sum of terms 0 0 For the ICs of eq. Traveling Wave Analysis of Partial Differential Equations DOI: 10.2) Term from eq. (17.1016/B978-0-12-384652-5. 17 Mth-Order Klein–Gordon Equation We start with a PDE which we term the mth-order Klein–Gordon equation. (17. (17. The verification of this solution follows directly from substitution in eq.3) is a superposition of two traveling waves moving left and right with velocity c. t) = 0.1) for three cases: Case 1: Linear PDE (α = −c2 .3) is therefore a special case of the d’Alembert solution to the wave equation [2].1) reduces to the linear wave equation ∂ 2u 2∂ u 2 = c (17. t) (17. t ≥ 0 (17.2) Term in eq. .2). β = γ = f (x. (17. t) = 0) For Case 1. (17.3) at t = 0 ∂u(x. (17.1) is a generalization of the quadratic Klein–Gordon equation with m = 2 and the cubic Klein–Gordon equation with m = 3 ([3]). (17.2) ∂t 2 ∂x2 In the subsequent programming. and eq. t = 0) = sin(x). =0 (17. t = 0) u(x. We will consider the method of lines (MOL) numerical solution of eq. Equation (17.4a. β = γ = f (x. ∂ 2u ∂ 2u + α 2 + βu + γ um = f (x.1) ∂t 2 ∂x Equation (17. (17.00017-0 309 Copyright © 2012 Elsevier Inc.

end if(ncase==3) u1(1)=ua_3(x(1). u1x(1)=0. The ODE routine for eqns.2 .t).5) is as follows.3) in x and t (the second form of this solution. function ut=pde_1(t. u2(i)=u(i+n). u1(n)=ua_2(x(n). and Case 1.1 illustrates the oscillatory properties of eq. Case 1. end % % BCs if(ncase==11) u1(1)=ua_11(x(1). xu and fb1 .expanded scale in x defined as −3π ≤ x ≤ 4π .u) % % Function pde_1 computes the t derivative vector for the Klein- % Gordon equation % global xl xu x n ncall ncase % % Model parameters global c c2 m r a b g % % One vector to two vectors for i=1:n u1(i)=u(i). end % % u1xx nl=1. . fb2 (two BC functions) are specified for three cases. (17. u1(n)=ua_3(x(n).3) in x and t (the first form of this solution. Case 1. sin(x) cos(ct)).t).t).1)–(17. 12 [sin(x + ct) + sin(x − ct)]).basic scale in x defined as 0 ≤ x ≤ 2π and (2) Case 1. The details of these two subcases will be apparent from the Matlab code and the associated numerical and plotted output. end if(ncase==12) u1(1)=ua_12(x(1).t). we consider two subcases: (1) Case 1. u(x = xl . end if(ncase==2) u1(1)=ua_2(x(1).t).5b) where xl . u1(n)=ua_11(x(n). t) = fb1 (t).t).310 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS and the Dirichlet BCs. In the Matlab routines that follow.t). (17.2 illustrates the traveling wave properties of eq. t) = fb2 (t) (17. nu=1.2 is selected by using ncase=12.1 is selected by using ncase=11. u(x = xu .1 . (17. In Case 1. Case 1.5a.t). u1(n)=ua_12(x(n).

ut(i+n)=u2t(i).12. % % One vector to two vectors for i=1:n u1(i)=u(i).1: Function pde 1. % % PDE if(ncase==11)|(ncase==12) for i=2:n-1 u1t(i)=u2(i).u) % % Function pde_1 computes the t derivative vector for the Klein- % Gordon equation % global xl xu x n ncall ncase % % Model parameters global c c2 m r a b g . % % Two vectors to one vector for i=1:n ut(i) =u1t(i). if(ncase==2)f=f_2(x(i). (17.1) and (17.1) (ncase=11.t).end u2t(i)=-a*u1xx(i)-b*u1(i)-g*u1(i)ˆm+f. (17.3).1) and the special case.2. function ut=pde_1(t. Chapter 17 . u1t(n)=0. end end if(ncase==2)|(ncase==3) for i=2:n-1 u1t(i)=u2(i). Since eq. u1. the 1D ODE dependent variable vector of length 2n.xu. u. LISTING 17.m: . end end u1t(1)=0.u1. is transferred to two 1D arrays each of length n. We can note the following details about pde 1. % % Increment calls to pde_1 ncall=ncall+1.u1x. u2t(1)=0. are second order in t. The function and some global variables are first defined.nu). end ut=ut'. eq. Mth-Order Klein–Gordon Equation 311 u1xx=dss044(xl.2). u2t(i)=c2*u1xx(i).n.u2 to facilitate the numerical solution of eqns. end .end if(ncase==3)f=0.2).m for eq. (17. (17. u2(i)=u(i+n). u2t(n)=0.nl.

the procedure is quite general that it can usually be applied to any .m.m (discussed . second-order PDE of interest. this gives ∂u1 = u2 (17. (17.ua 12. Also. is not actually used with the Dirichlet BCs but is included . nu=1. u1(n)=ua_3(x(n). one at a time.t).m. % % u1xx nl=1.6a) ∂t ∂u2 ∂ 2 u1 = −α 2 − βu1 − γ um 1 + f (x.u1. this procedure of working with two first-order PDEs in t permits the use of library integrators for first-order ODEs such as ode45 and ode15s. In the case of eq. end if(ncase==12) u1(1)=ua_12(x(1).n.xu. (17.5b)) are specified since the corresponding analytical solutions are used to define the BCs. u1xx=dss044(xl.t). the use of two 1D arrays is a standard procedure for accommodating a PDE second order in t such as eqns.6b) ∂t ∂x As indicated in Chapters 15 and 16. the analytical solutions in functions ua 11. (17. end if(ncase==3) u1(1)=ua_3(x(1). u1(n)=ua_2(x(n). as for the case of the hyperbolic Liouville equation of Chapter 15 and the sine-Gordon equation of Chapter 16. we consider ncase=11. In all of the cases. To start.t).t). end Each of these cases will be considered. u1x(1)=0.t). Four sets of BCs are programmed for ncase=11. u1(n)=ua_12(x(n).5a.nu). Note that the Dirichlet BCs are designated through nl=1. u1x(1)=0.t).nl.1) and (17.312 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Again.t).2.12.t).3 (ncase is set in the main program discussed subsequently). % % BCs if(ncase==11) u1(1)=ua_11(x(1).ua 3. the first derivative in x.ua 2.u1x. subsequently) are used to set the BCs. Also. nu=1.m. u1(n)=ua_11(x(n). t) (17.2). Dirichlet boundary conditions (eqns. end if(ncase==2) u1(1)=ua_2(x(1).1). Also.

u2t(i)=c2*u1xx(i). the counter for pde 1. end end if(ncase==2)|(ncase==3) for i=2:n-1 u1t(i)=u2(i).5b)) and (17.1) (or eqns. Note also that the derivatives in t of the ODEs at the boundaries (i=1. .5a. % % PDE if(ncase==11)|(ncase==12) for i=2:n-1 u1t(i)=u2(i). u2t(i)=c2*u1xx(i). end ut=ut'.2)) or ncase=2. such as u1x in dss044. The two derivative vectors.m receives the dependent variable vector u as an input (along with the independent variable t) and returns the derivative vector ut.2). (17. pde 1. Mth-Order Klein–Gordon Equation 313 only to satisfy the Matlab requirement that all of the input (RHS) arguments of a function. u1xx.m with a transpose included to meet the requirement of ode15s.u2t. if(ncase==2)f=f_2(x(i). u2t(1)=0. Equations (17. where c2 = c2 (c is set in the main program and passed to pde 1. Chapter 17 . are then returned to a single derivative vector ut to be returned from pde 1. Also.6a. (17. u1t. In summary. (17. The code is selected according to ncase=11. . can then be used in the programming of eqns. u1t(n)=0.1)). % % Increment calls to pde_1 ncall=ncall+1.t).m as a global variable).m is incremented. the coding of eqns.6b) is u1t(i)=u2(i). u2t(n)=0. ut(i+n)=u2t(i).12 (for eq. end end u1t(1)=0. The second derivative from dss044.end if(ncase==3)f=0.2) are then programmed in a for loop.n) are zeroed to ensure the boundary values remain at the values prescribed by the analytical solutions.1) and (17. . Specifically. % % Two vectors to one vector for i=1:n ut(i) =u1t(i).3 (for eq. (17. must be defined numerically.end u2t(i)=-a*u1xx(i)-b*u1(i)-g*u1(i)ˆm+f. (17.

6a.t0). n=101. end if(ncase==2) xl=0.t0).3.314 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS We now consider the other routines for ncase=11. xu=1. u2(i)=uat_2(x(i). xu=1. function u0=inital_1(t0) % % Function inital_1 sets the initial condition for the Klein- % Gordon equation % % Parameters shared with other routines global xl xu x n ncall ncase % % Spatial domain and initial condition if(ncase==11) xl=0. we continue the discussion for ncase=12. % % ICs from analytical solution for i=1:n x(i)=xl+(i-1)*dx. inital 1. end dx=(xu-xl)/(n-1). end if(ncase==3) u1(i)= ua_3(x(i). n=51. xu= 4*pi.t0). if(ncase==11) u1(i)= ua_11(x(i). u2(i)=uat_3(x(i). (17.t0). defines initial values for u1 and u2 in eqns. u2(i)=uat_11(x(i). n=151.m.t0).2. After looking at the output for this case. end if(ncase==12) xl=-3*pi.t0).6b).t0). The IC function. end . end if(ncase==3) xl=0. end if(ncase==12) u1(i)= ua_12(x(i).t0). end if(ncase==2) u1(i)= ua_2(x(i). n=51. u2(i)=uat_12(x(i). xu=2*pi.

m defines a grid in x of 101 points for 0 ≤ x ≤ 2π .m (which has the programming for the derivative of eq.3). n=101. All 2n initial condition values are returned from inital 1. the initial values of u1 for eq.t) % % Function uanal computes the exact solution of the Klein-Gordon .m discussed subsequently. sin(x) cos(ct)).3). % % ICs from analytical solution for i=1:n x(i)=xl+(i-1)*dx. % % Spatial domain and initial condition if(ncase==11) xl=0.2) with t = 0 (for ncase=11. We can note the following points about inital 1. if(ncase==11) u1(i)= ua_11(x(i). (17. u0(i+n)=u2(i).6a) are provided by the function ua 11.3)).1) and (17. function uanal=ua_11(x. end .12.2: IC function inital 1.m (which has the programming for the first form of the solution in eq. end Function ua 11. the initial values of u2 for eq.m for eqns. end LISTING 17.t0). xu=2*pi. (17. end .t0). inital 1.m: . function u0=inital_1(t0) % % Function inital_1 sets the initial condition for the Klein- % Gordon equation % % Parameters shared with other routines global xl xu x n ncall ncase .6b) are provided by the function uat 11. Chapter 17 . (17.m is a straightforward implementation of the first form of the solution of eq.3).2. (17. u0(i+n)=u2(i). (17. The function and some global variables are defined. Considering first ncase=11. u0(i) =u1(i). Mth-Order Klein–Gordon Equation 315 u0(i) =u1(i). sin(x) cos(ct). (17.m through the vector u0 to the main program pde 1 main. In the for loop. u2(i)=uat_11(x(i).

c=0.b=0.end if(ncase==2)m=2.12.r=3.4 for eqns. (17.a=-2. % % Model parameters global c c2 m r a b g B K % % Select case ncase=11.5.m of Chapter 15 and therefore only a few features are discussed here.a=-1. LISTING 17.b=1. The range in t varies for ncase=11.3: Function ua 11.4.t) % % Function uanal computes the time derivative of the exact solution % of the Klein-Gordon equation % % Model parameters global c % % Analytical solution derivative uanal=-c*sin(x)*sin(c*t).end . end if(ncase==12) .1) and (17. % ncase=3.3. function uanal=uat_11(x.5. The parameters are set for ncase=11. B=(b/g)ˆ0.5.12. Function uat 11.g=1. (17.3). % ncase=12.3).K=(-b/(2*(a+cˆ2)))ˆ0. sin(x) cos(ct).m accommodates the cases ncase=11. % % Independent variable for ODE integration if(ncase==11) tf=pi.4: Function uat 11.316 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS % equation for comparison with the numerical solution % % Model parameters global c % % Analytical solution uanal=sin(x)*cos(c*t).c2=cˆ2.g=1. This main program closely parallels pde 1 main. tout=[t0:pi/3:tf]'.5. ncall=0.12. LISTING 17.4.end if(ncase==3)m=3.3.5.m for the analytical solution of eq.2). Main program pde 1 main. (17.m for the derivative of the analytical solution of eq. (17. % ncase=2. nout=4.3).3. .m is a straightforward implementation of the derivative (in t) of the first form of the solution of eq. % % Model parameters if(ncase==11)|(ncase==12)c=1.

zlabel('u1(x.u1(it.t. % % Display selected output for it=1:nout fprintf('\n t x u1(it. ncall=0. ncase = 11.analytical') end figure(3) surf(x.x(i). for i=1:5:n fprintf('%6. ncase = 12. solid . nout=5. solid . ncase = 3. . nout=3.u1) xlabel('x').i)\n').m is listed in Table 17. ncall=0. Chapter 17 . end end fprintf(' ncall = %4d\n\n'.6f%15..u1_anal. o . The ODE Jacobian map from jpattern num 1.25:tf]'..u1.m indicates two bands for PDEs (17.err(it.i) and displayed. o .'-'. solid .x. t(it).6f%15.1.i).3f%15.t)') if(ncase==11) title('Klein-Gordon equation.i) err(it.numerical. solid .numerical. ncall=0. title('Klein-Gordon equation'). The difference in the numerical and analytical solutions is computed as err(it.analytical') elseif(ncase==2) title('Klein-Gordon equation. % % Plot numerical and analytical solutions figure(2) plot(x.analytical') elseif(ncase==3) title('Klein-Gordon equation. ylabel('t'). tout=[t0:0. end .m for the sparse matrix integration of the ODEs is not listed here since it is the same as for Chapters 15 and 16..6) as expected. Mth-Order Klein–Gordon Equation 317 tf=2*pi.i)).ncall). tout=[t0:pi:tf]'.6f\n'. ncase = 2.numerical. end if(ncase==3) tf=4. A portion of the numerical output from pde 1 main. tout=[t0:1:tf]'. o . jpattern num 1.numerical.i) u1_anal(it.i).'o') xlabel('x') ylabel('u1(x. end if(ncase==2) tf=1. These solutions are then plotted in 2D by plot and the numerical solution is plotted in 3D by surf. and the map is therefore not included in the discussion of the output that follows.u1_anal(it. o . nout=5.t)').analytical') elseif(ncase==12) title('Klein-Gordon equation.2f%8.

000000 −0.309017 0.00 1.951057 0.951057 0.513 0. t x u1(it.809017 −0.000000 0. .809017 0.00 0.309016 −0.809015 −0.000000 0.000000 0.587785 0.199 −0.000000 0.809017 0.809014 −0.14 2.00 1.14 3.000000 0.587783 −0.999997 −1.i) 3.969 −0.000000 .1: Selected numerical output from the main program pde 1 main.000000 0.309016 −0.942 0.951057 0.00 2. .827 0.084 −0.00 5.942 −0.14 0.587785 0. .00 3.142 −0. 2. .i) err(it.000000 0.309017 −0.000001 3.00 0.885 −0.571 −0.000001 3.00 1.14 1.309017 −0.309017 0.00 5.000002 3.587785 0.309017 0.000000 0.000000 0.951057 −0. .318 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 17.i) u1 anal(it.000000 0.00 4.14 1.309017 0.000000 −1.309017 0.142 −0.456 0.587785 0.00 3.00 2.571 1.000001 .14 0.000000 0.000000 0.587785 −0.309017 0.09 removed .951054 −0.257 −0.000000 0.000000 0.00 3. .000000 0.00 2.628 −0.14 3.000000 0.m for ncase=11 t x u1(it.587785 −0.587785 0.000000 3.000003 3.283 0.05.309017 −0.14 1.000 0.809017 0.770 0.000 0.809017 0.000000 3.00 0.000003 3.14 0.513 −0.951057 0.027 −0.000000 0.456 −0.00 0.885 0.000000 0.587785 0.309017 0.341 −0.000000 0.712 −1.951057 0.809017 0.00 4.000002 3.i) 0.314 −0.309016 0.257 0.809017 0.628 0.770 −0.587785 0.000002 3.951057 −0.i) err(it.199 0.000000 0.398 −0.000000 1.000000 0.000002 3. output for t = 1.314 0.14 0.i) u1 anal(it.655 −0. .587785 −0.14 2.809017 0.14 3.951057 0.000000 0.000000 0. .000000 0.951057 0.587784 0.14 2.000000 0.000001 3.000000 0.951057 0.809017 −0.951055 −0.000000 0.309017 0.000000 0.00 6.809017 0.000000 0.00 4.000000 −0.00 5. . .00 5.000000 0.000000 0.587784 −0.827 −0.000001 3.587785 0.

the negative portion of the sin(x) could easily be included through a minor modification of ua 12.000003 3. that is. Here we reproduce only the code for ncase=12 indicated in Listings 17.12 (since the PDE is the same).809015 0.m to 0 ≤ x ≤ 2π .m are provided by ua 12. initially. Also.951054 0. t = 3. 12 [sin(x + ct) + sin(x − ct)].000002 3.3) (starting from t = 0) according to sin(x) cos(ct).000002 3.000000 −0.14 5.14 4. with ncall = 341.712 0.14 4. but with the x domain extended to −3π ≤ x ≤ 4π in order to demonstrate the traveling wave solution of eq. which then separates into two sine functions.14 4. We now consider ncase=12.309017 −0. Figures 17.m and uat 12.951055 0.809014 0.000000 −0.1 and 17. the linear wave equation (17.309016 0.000000 0.14 is better than five figures.027 0. The numerical and analytical solutions agree at t = 0 as expected (since both solutions are produced by ua 11.2) over the domain 0 ≤ x ≤ 2π. Chapter 17 .951057 −0.t).2 demonstrate that the solution is simply a standing sin wave in x from eq. % % PDE if(ncase==11)|(ncase==12) for i=2:n-1 .084 0.1 and 17. The computational effort is modest.341 0.2.1: (Continued) 3.14 5. u1(n)=ua_12(x(n).809017 −0. if(ncase==12) u1(1)=ua_12(x(1).283 −0. The plotted solutions follow.t).587783 0.14 5.2) in pde 1. (17.m). end The programming of eq. (17.3).655 0. 21 sin(x + ct) traveling right to left with velocity c and 12 sin(x − ct) traveling left to right with velocity c (c > 0).398 0. (17.m with t = 0). which is again for eq.1 for the complete listing of pde 1.m is the same for ncase=11.14 5. only the positive portion of sin(x) is used (0 ≤ x ≤ π ) in order to simplify the plotted output.m (refer to Listing 17. This solution indicates the IC (t = 0) is sin(x). (17.999997 1.000000 ncall=341 We can note the following points about this output: .951057 −0.809017 −0.2). Mth-Order Klein–Gordon Equation 319 Table 17.000001 3. and the difference between the two solutions at . The BCs for ncase=12 in pde 1.587785 −0.000002 3.000003 3.14 6.000002 3. The preceding discussion was for ncase=11.969 0.

t0).m are then used to set the ICs (with t0=0 from pde 1 main. 3π/3).2) (for t = 0. end end In inital 1. o – analytical 1 0. 2π/3.320 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Klein–Gordon equation. .m).2 for the complete listing of inital 1.2 u1(x. t) 0 −0.6 0. ua 12. u1t(i)=u2(i). if(ncase==12) xl=-3*pi.2 −0.8 0. lines – numerical. ncase = 11. (17.6 −0.m for ncase=12. if(ncase==12) u1(i)= ua_12(x(i). π/3.m). xu= 4*pi.4 −0. end The increase in the number of grid points (n = 101 for ncase=11 to n = 151 for ncase=12) was determined by trial and error to gain an improved spatial resolution of the numerical solution.m and uat 12. we use −3π ≤ x ≤ 4π on 151 points (refer to Listing 17. n=151.1: 2D plot comparing the numerical and analytical solutions of eq. u2t(i)=c2*u1xx(i).4 0.8 −1 0 1 2 3 4 5 6 7 x FIGURE 17.

else sin1=0.t) % % Function uanal computes the exact solution of the Klein-Gordon % equation for comparison with the numerical solution % % Model parameters global c % % Analytical solution if((x-c*t>0)&(x-c*t)<=pi) sin1=sin(x-c*t). 12 [sin(x + ct) + sin(x − ct)]. Chapter 17 .2).3). else . (17.2: 3D plot of the numerical solution of eq. end if((x+c*t>0)&(x+c*t)<=pi) sin2=sin(x+c*t). t) 0 −0.m is a straightforward implementation of the second form of the solution of eq. u2(i)=uat_12(x(i). end Function ua 12. function uanal=ua_12(x.5 −1 4 3 7 6 2 5 4 t 3 1 2 x 1 0 0 FIGURE 17. (17. Mth-Order Klein–Gordon Equation 321 Klein–Gordon equation 1 0.5 u1 (x.t0).

m (for a comparison of the numerical and analytical solutions). 12 [sin(x + ct) + sin(x − ct)].t) % % Function uanal computes the derivative of the exact solution of the % Klein-Gordon equation % % Model parameters global c % % Analytical solution if((x-c*t>0)&(x-c*t)<=pi) cos1=-c*cos(x-c*t).6: Function uat 12. (17. end The analytical solution is included in the output by using ua 12.3). else cos2=0. ncall=0.5*(cos1+cos2). % % Model parameters if(ncase==11)|(ncase==12)c=1. The additional coding in the main program pde 1 main. (17. if(ncase==12) u1(it. function uanal=uat_12(x. tout=[t0:pi:tf]'. (17.12. this restriction is imposed only to simplify the plotted solution. 2π . (17. Function ua 12.3).1)=ua_12(x(1). LISTING 17.m is a straightforward implementation of the derivative (in t) of the second form of the solution of eq.t(it)).m for the derivative of the analytical solution of eq.c2=cˆ2.5*(sin1+sin2). 0 ≤ x ≤ π for t = 0.end t is defined over the interval 0 ≤ t ≤ 2π for three outputs in the numerical and plotted output at t = 0. The velocity c in eq. if(ncase==12) tf=2*pi.g. else cos1=0.3). . end uanal=0. nout=3. Note that here we use only the positive portion of the sin(x) function.322 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS sin2=0.m follows. end if((x+c*t>0)&(x+c*t)<=pi) cos2=c*cos(x+c*t). LISTING 17.5: Function ua 12.2) is the same for ncase=11. end uanal=0. e. π .m for the analytical solution of eq..

elseif(ncase==12) title('Klein-Gordon equation.i)=u1(it. we could assume a solution to the PDE that will in general not be correct (it was correct in the case of eq. We also developed two ICs from eq. We can note the following points about this output: . i. x > π (ncase=12).e. t) = xn t n . 17.2.2) is quite straightforward. m = 2. (17. err(it. Also.t(it)). The numerical and analytical solutions agree at t = 0 as expected.3). which satisfies eq.2). xu = 4π with ua (x. β = 0.7) . xu = 2π (ncase=11) or xl = −3π .numerical.2). (17. γ = 1 (which is nonlinear for m 6= 1). β = 0.i). and the agreement . solid . (17. To summarize.3) by setting xl = 0. t) 6= 0) We now consider ncase=2 for eq. Mth-Order Klein–Gordon Equation 323 u1(it. o . t) = 0). (17. we assumed eq. Chapter 17 . x < 0. for i=1:n u1_anal(it.i)-u1_anal(it.3) by setting t = 0 and two BCs from eq. The advantage of this approach as we shall demonstrate with the next case (ncase=2) is that it can in principle be applied to any PDE (linear and nonlinear) to obtain an analytical solution to a related PDE.t(it)). To extend this procedure.1) ua (x.4. The computational effort is modest. α = −1.3 and 17.i)=ua_12(x(i). (17.1) with m = 2. 0 ≤ x ≤ 1. this method of residual functions can also be applied to systems of PDEs. we start with an assumed solution to eq. 21 sin(x + ct) traveling right to left with velocity c and 12 sin(x − ct) traveling left to right with velocity c.3) as a solution to eq.28 is about three figures. (17. α = −1.analytical') A portion of the numerical output from pde 1 main. If we substitute the assumed solution into the PDE. (17. To apply the method of assumed solutions or residual functions. (17.m is listed in Table 17. t ≥ 0 (17. then demonstrated that it satisfies eq. f (x. the required ICs and BCs can then be obtained from the assumed solution. γ = 1. but this was possible mainly because eq. r = 3. Case 2: Nonlinear PDE (ncase=2. which then separates into two sine functions. r = 3. with ncall = 840.2) by direct substitution. (17. ncase = 12. a residual function will result that can then be included in the PDE to make the assumed solution exact. t = 0) = 0. end end The plot of the numerical and analytical solutions includes a label for the ncase=12.3 demonstrates that the solution for the IC (t = 0) is sin(x).n)=ua_12(x(n). between the two solutions at t = 6. The plotted solutions follow in Figs. (17. it is linear with constant coefficients and f (x. Figure 17.

000000 0.000000 0.000000 0.294 0.000000 0.000000 0.000000 0.000000 0.692 0.000793 .i) 0.000000 6.i) err(it.00 0.000000 0.00 −6.000000 0.00 4.571 1.00 8.000000 0.566 0.000000 0.00 −2.28 −7.000000 0.000000 0.104528 0.00 11.000000 0.503 0.000000 0. .000000 0.000000 0.00 6.000000 0.361 0.000000 0.00 −3.00 3. .000000 0.000000 0.000000 0.425 0.702 0.743145 0.000000 0.000017 0.00 7.28 −6.000000 0.00 11.324 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 17.000000 0.28 −8.037 0.493 −0.i) err(it.000000 0.00 −5.000000 0.000000 .00 8.000000 0.000000 0.00 3.425 0.000000 0.493 0.000000 0.901 0.833 0.000017 6.000000 6.000000 0.000000 0.000000 0.104528 0.000000 0.692 0.000000 0. .000000 0.000000 0.226 0.28 −9.000000 0.000000 0.000000 0.000000 0.00 −0.i) u1 anal(it.000000 0.000793 0.000000 0.827 0.m for ncase=12 t x u1(it.00 12. .959 0.000000 0.000000 0. . .000000 0.838 0.634 0.000000 0.00 −4. . .000000 0.000000 0.00 1.000000 0.000000 0.000000 0.000000 0.435 0.560 0.000000 0.000000 0.000000 0.367 0.304 0.000000 −0.226 0.000000 0.000000 0.000000 0.00 −8.628 0.000000 6.00 −5.000000 0.00 10.000000 0.100 0.000000 0.000000 0.00 5.00 0.00 9.2: Selected numerical output from the main program pde 1 main. .000000 0.000000 0.743145 0.000000 0.000000 0.000000 0.000000 0.000000 0.00 −2.969 0.094 0.760 0.14 removed .770 0.105 0.027 0.000000 0.000000 0.000000 0. . t x u1(it.000000 0.i) u1 anal(it.104528 0.000000 0.00 −7.000000 0.000000 0.959 0.000000 0.000000 1.i) 6.743145 0.236 0.000000 0. output for t = 3.104528 0.000000 0.000000 0.000000 0.000000 0.28 −7.743145 0.000000 0.000000 0.00 −9.000000 0.000000 0.00 5.000000 0.00 −7.000000 0.168 0.00 2.00 −1.

Chapter 17 . Mth-Order Klein–Gordon Equation 325

Table 17.2: (Continued)

t x u1(it,i) u1 anal(it,i) err(it,i)

**6.28 −5.760 0.258354 0.250000 0.008354
**

6.28 −5.027 0.474751 0.475528 −0.000777

6.28 −4.294 0.458250 0.456773 0.001477

6.28 −3.560 0.200618 0.203368 −0.002750

6.28 −2.827 −0.009532 0.000000 −0.009532

6.28 −2.094 0.001694 0.000000 0.001694

6.28 −1.361 −0.000967 0.000000 −0.000967

6.28 −0.628 0.002879 0.000000 0.002879

6.28 0.105 0.000210 0.000000 0.000210

6.28 0.838 0.000868 0.000000 0.000868

6.28 1.571 0.002498 0.000000 0.002498

6.28 2.304 0.000868 0.000000 0.000868

6.28 3.037 0.000210 0.000000 0.000210

6.28 3.770 0.002879 0.000000 0.002879

6.28 4.503 −0.000967 0.000000 −0.000967

6.28 5.236 0.001694 0.000000 0.001694

6.28 5.969 −0.009532 0.000000 −0.009532

6.28 6.702 0.200618 0.203368 −0.002750

6.28 7.435 0.458250 0.456773 0.001477

6.28 8.168 0.474751 0.475528 −0.000777

6.28 8.901 0.258354 0.250000 0.008354

6.28 9.634 −0.000793 0.000000 −0.000793

6.28 10.367 0.000017 0.000000 0.000017

6.28 11.100 0.000000 0.000000 0.000000

6.28 11.833 0.000000 0.000000 0.000000

6.28 12.566 0.000000 0.000000 0.000000

ncall = 840

**The choice of eq. (17.7) is motivated primarily by the ease of computing analytically the
**

partial derivatives in eq. (17.1). Note that this choice is not motivated by a physical appli-

cation although this may be a possibility. In other words, here we assume a solution for

ease of use in deriving an analytical solution. Also, we take n > 2 so that the second-

order partial derivatives in eq. (17.1) evaluated according to eq. (17.7) are not constant

(or zero) and therefore provides a relatively rigorous test of the numerical calculation of

these second-order derivatives.

Substitution of eq. (17.7) in eq. (17.1) gives

Term in eq. (17.1) Term from eq. (17.7)

∂ 2u

n(n − 1)xn t n−2

∂t 2

∂ 2u

+α 2 +αn(n − 1)xn−2 t n

∂x

+βu +βxn t n

326 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS

**Klein–Gordon equation; ncase = 12; lines – numerical; o – analytical
**

1.2

1

0.8

0.6

u1(x, t)

0.4

0.2

0

−0.2

−10 −5 0 5 10 15

x

FIGURE 17.3: 2D plot comparing the numerical and analytical solutions of eq. (17.2) (eq. (17.3) for t = 0, π, 2π).

+γ um +γ xnm t nm

= f (x, t) = n(n − 1)xn t n−2

+αn(n − 1)xn−2 t n

+βxn t n + γ xnm t nm

**Thus, the residual function (also termed an inhomogeneous function or nonhomogeneous
**

function), defined for eq. (17.1) so that eq. (17.7) is an exact solution, becomes

f (x, t) = n(n − 1)xn t n−2 + αn(n − 1)xn−2 t n + βxn t n + γ xnm t nm (17.8)

**We now consider an MOL solution to eqns. (17.1) and (17.8), with ICs and BCs provided
**

by eq. (17.7). Again, we reproduce only the code for ncase=2 indicated in Listings 17.1 and

17.2. The BCs for ncase=2 in pde 1.m are provided by ua 2.m (refer to Listing 17.1 for the

complete listing of pde 1.m).

if(ncase==2)

u1(1)=ua_2(x(1),t);

u1(n)=ua_2(x(n),t);

end

Chapter 17 . Mth-Order Klein–Gordon Equation 327

Klein–Gordon equation

1

0.8

u1 (x, t)

0.6

0.4

0.2

0

0

1

2 −5

3

t 0

4

5 x

5

6 10

FIGURE 17.4: 3D plot of the numerical solution of eq. (17.2).

**The programming of eq. (17.1) in pde 1.m is
**

if(ncase==2)|(ncase==3)

for i=2:n-1

u1t(i)=u2(i);

if(ncase==2)f=f_2(x(i),t);end

if(ncase==3)f=0;end

u2t(i)=-a*u1xx(i)-b*u1(i)-g*u1(i)ˆm+f;

end

end

**Since eq. (17.1) is also integrated for ncase=3, the coding for ncase=2 and ncase=3 is the
**

same (and follows directly from eq. (17.1)).

Function f 2.m for the residual function of eq. (17.8) called in pde 1.m (for ncase=2) is

straightforward (note that n in eq. (17.7) is programmed as r since n is the number of grid

points).

function rhs=f_2(x,t)

%

% Function rhs computes the inhomogenenous RHS function of

% the mth order Klein-Gordon equation

%

% Model parameters

328 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS

global c c2 m r a b g

%

% Residual function

rhs=r*(r-1)*xˆr*tˆ(r-2)...

+a*r*(r-1)*xˆ(r-2)*tˆr...

+b*xˆr*tˆr+g*xˆ(r*m)*tˆ(r*m);

LISTING 17.7: Function f 2.m for the residual function of eq. (17.8).

**In inital 1.m for ncase=2, we use 0 ≤ x ≤ 1 on 51 points (refer to Listing 17.2 for the
**

complete listing of inital 1.m).

if(ncase==2)

xl=0;

xu=1;

n=51;

end

**Because the solution to eq. (17.1) for ncase=2 is relatively smooth, only n = 51 grid points
**

were required to achieve a numerical solution of acceptable accuracy. ua 2.m and uat 2.m

are then used to set the ICs (with t0=0 from pde 1 main.m).

if(ncase==2)

u1(i)= ua_2(x(i),t0);

u2(i)=uat_2(x(i),t0);

end

ua 2.m is a straightforward implementation of eq. (17.7).

function uanal=ua_2(x,t)

%

% Function uanal computes the exact solution of the mth order

% Klein-Gordon equation for comparison with the numerical solution

%

% Model parameters

global c c2 m r

%

% Analytical solution

uanal=xˆr*tˆr;

LISTING 17.8: Function ua 2.m for the analytical solution of eq. (17.7).

**Function uat 2.m is a straightforward implementation of the derivative of the solution
**

(in t) of eq. (17.7).

function uanal=uat_2(x,t)

%

% Function uanal computes the derivative of the exact solution of the

% mth order Klein-Gordon equation

%

% Model parameters

global c c2 m r

%

% Derivative of the analytical solution

uanal=xˆr*r*tˆ(r-1);

LISTING 17.9: Function uat 2.m for the derivative of the analytical solution of eq. (17.7).

Chapter 17 . Mth-Order Klein–Gordon Equation 329

The additional coding in the main program pde 1 main.m follows.

%

% Model parameters

if(ncase==2)m=2;r=3;a=-1;b=0;g=1;end

**t is defined over the interval 0 ≤ t ≤ 1 for five outputs in the numerical and plotted output
**

at t = 0, 0.25, 0.5, 0.75, 1.

if(ncase==2)

tf=1; tout=[t0:0.25:tf]'; nout=5; ncall=0;

end

**The analytical solution is included in the output by using ua 2.m (for a comparison of the
**

numerical and analytical solutions).

if(ncase==2)

u1(it,1)=ua_2(x(1),t(it));

u1(it,n)=ua_2(x(n),t(it));

for i=1:n

u1_anal(it,i)=ua_2(x(i),t(it));

err(it,i)=u1(it,i)-u1_anal(it,i);

end

end

**The plot of the numerical and analytical solutions includes a label for ncase=2.
**

elseif(ncase==2)

title('Klein-Gordon equation; ncase = 2; solid - numerical; o - analytical')

**A portion of the numerical output from pde 1 main.m is listed in Table 17.3.
**

We can note the following points about this output:

. The numerical and analytical solutions agree at t = 0 as expected, and the agreement

**. between the two solutions at t = 1 is about five figures.
**

The computational effort is modest, with ncall = 285.

The plotted solutions follow in Figs. 17.5 and 17.6. Figure (17.5) indicates the close

agreement between the numerical and analytical solutions of Table 17.3, which is due in

part to the smooth assumed solution of eq. (17.7). The use of an assumed solution (such as

eq. (17.7)) demonstrates that if a residual function, such as f (x, t) in eq. (17.1), is included

in the PDE, then the derivation of an exact solution based on the assumed solution is

straightforward, even for nonlinear PDEs (such as eq. (17.1) with m 6= 1).

**Case 3: Nonlinear PDE (ncase=3, m = 3, α = −2.5, β = 1, γ = 1.5, c = 0.5,
**

f (x, t) = 0)

Finally, we proceed to ncase=3 with m = 3, α = −2.5, β = 1, γ = 1.5, c = 0.5, using an analyt-

ical solution to eq. (17.1) with f (x, t) = 0 ([1]). This is an example of the cubic Klein–Gordon

330 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS

**Table 17.3: Selected numerical output from the main program
**

pde 1 main.m for ncase=2

t x u1(it,i) u1 anal(it,i) err(it,i)

**0.00 0.000 0.000000 0.000000 0.000000
**

0.00 0.100 0.000000 0.000000 0.000000

0.00 0.200 0.000000 0.000000 0.000000

0.00 0.300 0.000000 0.000000 0.000000

0.00 0.400 0.000000 0.000000 0.000000

0.00 0.500 0.000000 0.000000 0.000000

0.00 0.600 0.000000 0.000000 0.000000

0.00 0.700 0.000000 0.000000 0.000000

0.00 0.800 0.000000 0.000000 0.000000

0.00 0.900 0.000000 0.000000 0.000000

0.00 1.000 0.000000 0.000000 0.000000

. .

. .

. .

output for t=0.25, 0.5, 0.75 removed

. .

. .

. .

t x u1(it,i) u1 anal(it,i) err(it,i)

**1.00 0.000 0.000000 0.000000 0.000000
**

1.00 0.100 0.000999 0.001000 −0.000001

1.00 0.200 0.008000 0.008000 −0.000000

1.00 0.300 0.027000 0.027000 0.000000

1.00 0.400 0.063998 0.064000 −0.000002

1.00 0.500 0.125000 0.125000 −0.000000

1.00 0.600 0.216000 0.216000 0.000000

1.00 0.700 0.342999 0.343000 −0.000001

1.00 0.800 0.512000 0.512000 −0.000000

1.00 0.900 0.729000 0.729000 0.000000

1.00 1.000 1.000000 1.000000 0.000000

ncall = 285

equation (with m = 3 in eq. (17.1)).

∂ 2u ∂ 2u

+ α 2 + βu + γ u3 = f (x, t) (17.9)

∂t 2 ∂x

An analytical solution ([1]) is

ua (x, t) = B tan[K (x + ct)], 0≤x≤1 (17.10)

β

q q

−β

for the particular values α = −2.5, β = 1, γ = 1.5, c = 0.5 with B = γ ,K = 2(α+c2 )

Chapter 17 . Mth-Order Klein–Gordon Equation 331

**Klein–Gordon equation; ncase = 2; lines – numerical; o – analytical
**

1

0.9

0.8

0.7

0.6

u1 (x, t)

0.5

0.4

0.3

0.2

0.1

0

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

x

**FIGURE 17.5: 2D plot comparing the numerical and analytical solutions of eq. (17.1) for t = 0, 0.25, 0.5, 0.75, 1
**

(bottom to top).

**We now consider an MOL solution to eq. (17.9) with ICs and BCs provided by eq. (17.10).
**

Again, we reproduce only the code for ncase=3 indicated in Listings 17.1 and 17.2. The BCs

for ncase=3 in pde 1.m are provided by ua 3.m (refer to Listing 17.1 for the complete listing

of pde 1.m).

if(ncase==3)

u1(1)=ua_3(x(1),t);

u1(n)=ua_3(x(n),t);

end

**The programming of eq. (17.9) in pde 1.m is
**

if(ncase==2)|(ncase==3)

for i=2:n-1

u1t(i)=u2(i);

if(ncase==2)f=f_2(x(i),t);end

if(ncase==3)f=0;end

u2t(i)=-a*u1xx(i)-b*u1(i)-g*u1(i)ˆm+f;

end

end

332 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS

Klein–Gordon equation

1

0.8

0.6

u1 (x, t)

0.4

0.2

0

1

0.8 1

0.6 0.8

0.4 0.6

t 0.4

0.2 x

0.2

0 0

FIGURE 17.6: 3D plot of the numerical solution of eq. (17.1).

**Since eq. (17.1) is also integrated for ncase=3, the coding for ncase=2 ( f (x, t) from
**

eq. (17.8)) and ncase=3 ( f (x, t) = 0) is the same (and follows directly from eqns. (17.1) and

(17.9)).

In inital 1.m for ncase=3, we use 0 ≤ x ≤ 1 on 51 points (refer to Listing 17.2 for the

complete listing of inital 1.m).

if(ncase==3)

xl=0;

xu=1;

n=51;

end

**Because the solution, eq. (17.10), for ncase=3 is relatively smooth, only n = 51 grid points
**

were required to achieve a numerical solution of acceptable accuracy. ua 3.m and uat 3.m

are then used to set the ICs (with t0=0 from pde 1 main.m).

if(ncase==3)

u1(i)= ua_3(x(i),t0);

u2(i)=uat_3(x(i),t0);

end

ua 3.m is a straightforward implementation of eq. (17.10).

g=1.m (for a com- parison of the numerical and analytical solutions). if(ncase==3) u1(it.m for the derivative of the analytical solution of eq. 3. eq. LISTING 17. err(it.1)=ua_3(x(1). Function uat 3. B=(b/g)ˆ0. (17.end t is defined over the interval 0 ≤ t ≤ 4 for five outputs in the numerical and plotted output at t = 0.b=1.t(it)).t) % % Function uanal computes the time derivative of the exact solution % of the cubic Klein-Gordon equation % % Model parameters global c c2 m r a b g B K % % Analytical solution derivative uanal=B*sec(K*(x+c*t))ˆ2*(K*c). end The analytical solution.10).i). 2. ncall=0. (17. tout=[t0:1:tf]'.10).m for the analytical solution of eq.m follows. LISTING 17.i)=ua_3(x(i).n)=ua_3(x(n).a=-2. 1. if(ncase==3) tf=4. u1(it.5. Mth-Order Klein–Gordon Equation 333 function uanal=ua_3(x.t(it)). end end The plot of the numerical and analytical solutions includes a label for ncase=3.t(it)).5. Chapter 17 .5. for i=1:n u1_anal(it.m is a straightforward implementation of the derivative of the solution (in t) of eq.5. nout=5.10).5. function uanal=uat_3(x. (17. is included in the output by using ua 3.11: Function uat 3. (17. % % Model parameters if(ncase==3)m=3.10: Function ua 2.c=0.K=(-b/(2*(a+cˆ2)))ˆ0.i)=u1(it. The additional coding in the main program pde 1 main.t) % % Function uanal computes the exact solution of the cubic % Klein-Gordon equation for comparison with the numerical solution % % Model parameters global a b g B K c % % Analytical solution uanal=B*tan(K*(x+c*t)).10). .i)-u1_anal(it. 4.

000004 4.00 0. .analytical') end A portion of the numerical output from pde 1 main.000000 4.000000 0.000002 4.368809 0.00 0.270974 2.000000 ncall = 1581 .658292 2.00 0.279655 0.00 0.196095 0.243940 1.323399 0. .000000 0.00 0.736935 −0. .00 0.000002 4.800 3.000000 0.270974 −0.243940 −0.000000 0.000 0.952267 3.400 0.000000 0.077209 0.300 0.4.658293 −0.973506 1.124594 0.973508 −0.077209 0.000000 0.543516 1.155811 0. . 2. 3 removed .600 0.i) u1 anal(it.00 0. . The numerical and analytical solutions agree at t = 0 as expected.600 2.000000 0.numerical.186174 3.000000 . output for t = 1.800 0.00 1.952272 −0.000000 0.00 0.200 1. o .171787 5. solid .100 0.736934 1.300 1.00 0.416196 0.237302 0.038519 0.000001 4.00 0.000000 0.416196 0.m is listed in Table 17. t x u1(it.000000 0.381770 1. .000 0.m for ncase=3 t x u1(it.00 0.200 0.500 0. .368809 0. We can note the following points about this output: .100 1.000 1.900 0.116246 0.000005 4.543515 0.400 1.700 2.i) u1 anal(it.00 0.116246 0.500 1.186178 −0.171787 0.323399 0.00 0. and the agreement between the two solutions at t = 4 is about five figures.038519 0.900 3.00 0.000 5.00 0. Table 17.000000 0.i) 4. .334 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS elseif(ncase==3) title('Klein-Gordon equation. .000000 4.i) 0.000000 4.000000 0.700 0.00 0.00 1.00 0.4: Selected numerical output from the main program pde 1 main.155811 0.00 0.279655 0.i) err(it.196095 0.237302 0. .00 0.124594 1.00 0.000000 4.381769 0.000001 4.i) err(it. ncase = 3.

7) indicates the close agreement between the numerical and analytical solutions of Table 17. for ncase = 2.8 0. which is due in part to the smooth solution of eq. (17. Mth-Order Klein–Gordon Equation 335 .3. and the ICs and BCs were different.1)). t) 3 2 1 0 0 0. ncall = 1581.10). Klein–Gordon equation. 17. As noted in Chapters 15 and 16. 4 (bottom to top).7 and 17. and only m changed (from m = 2 to m = 3). o – analytical 6 5 4 u1 (x. .9 1 x FIGURE 17.8. 1. The computational effort is above previous values (but still modest). (17. Generally. the reformulation of an nth-order PDE as n PDEs first order in an initial value independent variable (t) is straightforward and permits the use of an integrator such as ode15s for first-order ODEs. The plotted solutions follow in Figs.1 0. (17.2 0.6 0.7: 2D plot comparing the numerical and analytical solutions of eq. the expected computational effort for a particular PDE is essentially unpredictable. The variation in ncall from 285 (ncase = 2) to 1581 (ncase = 3) indicates that the computational effort can vary substantially. we have again discussed the numerical solution of a PDE second order in t (eq.3 0.7 0. Figure (17. ncase = 3.4 0.1)) by restating the PDE as two PDEs first order in t (eq. with . (17. 2. even within apparently minor variations in the same problem.9) for t = 0. In summary. Chapter 17 . lines – numerical. (17.3.6)). thus. 3. the PDE is the same (eq.5 0.

Thus. reduces the PDE of eq. and therefore will not be detailed here. The conditions for Case 2 are such that (intention- ally) we do not know how to obtain an analytical solution. (17.11) ∂t 2 ∂x where we have set f (x) = 0 and m = 3. The conditions for Case 1 reduce the problem to that of a linear wave. where ξ = k(x − ct).4 x 0.11) to the ODE d2 c2 k2 + αk2 U + βU + γ U 3 = 0 (17. (17. (17.8: 3D plot of the numerical solution of eq.8 2 0. the solution of which is well known. which reduce the problem to ∂ 2u ∂ 2u + α 2 + βu + γ u3 = 0 (17.2 0 0 FIGURE 17. we are left with Case 3 conditions. we see that application of the transformation u(x. or γ . Appendix We conclude this chapter with a traveling wave analysis of eq.6 t 1 0. β. By inspection. t) = U(ξ ). t) 3 2 1 0 4 3 1 0.1).9). but have not set values for α.336 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Klein–Gordon equation 6 5 4 u1 (x.12) dξ 2 .

use of the built-in Maple function dsolve finds the solution q c2 + α (γ + 2β)ξ s −2β U(ξ ) = C2 JacobiSN √ + C1 −γ − 2β + γ C22 2 c2 + α k s # −2β C2γ . in principle. but more details can be found from the Maple help system and.13) βU + γ U 3 c k + αk2 we obtain U ln β + γ U 2 γU ξ2 1 U ln(U) + arctan √ √ − = + Kξ. Instead.15) γ p 2 α + c2 which on conversion to the tan function and rearranging becomes s s ! β β u= tan i (x + x0 − ct) .10). (17. 1 ZZ ZZ −dUdU = 2 2 dξ dξ . We will not discuss this solution here. set x0 = 0 and define c = −c. i.e.√ . (17. The Maple code that derives solution eq. Chapter 17 . we call tanhMethod and set the information level variable infoLevOut equal to 2 in order to provide some additional information at certain steps in the calculation. three of which are trivial. also.16) matches the Case 3 solution. We choose the following solution √ √ ! 2 β (x + x0 − ct) 1 u = i β tanh p √ . m). After setting up the problem in Maple. However. . (17.. eq. However. be solved by the separation of variables method. so we abandon this analytical approach.16) γ 2 α + c2 If we bring i under the square-root sign. and JacobiSN represents the elliptic function sn(z. (17.16) and generates an animation and 3D plot is included under Listing 17. we will obtain a traveling wave solution using our Maple procedure tanhMethod. While eq. with 0 < m < 1 being the elliptic modulus.12. eq. if we separate the variables and integrate twice. The tanh method is successful and finds seven solutions. (17. (17. −γ − 2β + γ C22 − (γ + 2β) γ where C1 and C2 are arbitrary constants. (17.14) can be simplified slightly. Mth-Order Klein–Gordon Equation 337 which can. (17.14) 2β βγ βγ β 2 c k − αk2 2 2 where K is an arbitrary constant. it cannot be readily solved for U. some additional dis- cussion on this form of solution can be found in [4].

titlefont=[TIMES. FL. New exact traveling wave solutions for the nonlinear Klein-Gordon equation.txt").J.16).100].1. the code is not included here.x=0.t)"].10 and 17. Math. 2004.frames=50. an animation and 3D plot. 16]. > pde1:=subs({m=3. > pde1:=diff(u. > zz:=convert(rhs(sol[7]). > plot3d(zz.5. V. orientation=[-132. A. # Set order of approximation infoLevOut:=2. References [1] M.F. 32 (2008) 235–240.numpoints=100. labelfont=[TIMES. Boca Raton. axesfont=[TIMES. > animate(zz.5."u(x. but it is included with the downloads for this book..12: Maple code used to generate analytical solutions to the the Klein–Gordon equation (Case 3).1. J.t)):unprotect(gamma).x.tan). > x0:=0.338 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS > # Klein-Gordon Equation # Attempt at Malfliet's tanh solution restart. title="Klein-Gordon Equation").. Shokri. with(PDEtools): with(PolynomialTools): with(plots): > alias(u=u(x. intFlag:=0: # No integration of U(xi) needed ! M:=2.f(x. [2] S. [3] A. Numerical solution of the nonlinear Klein-Gordon equation using radial basis functions.pde1. > read("tanhMethod.c:=-0. ROMAN. style=patchnogrid.intFlag.axes=framed. t=0. including eqns. 1993 (Chapter 17). Phys. Farlow. ROMAN. ROMAN. ROMAN. Dover Publications.t=0.gamma:=1. tanhMethod(M. thickness=3.titlefont=[TIMES. axesfont=[TIMES. Turk. Chapman & Hall/ CRC.t)=0}. 16]. 16]. 16].4. Polyanin.pde1).x=0. New York.. Zaitsev.title="Klein-Gordon Equation") LISTING 17. Dehghan.x)+beta*u+gamma*uˆm=f(x. App. 230 (2009) 400–410. labeldirections=[HORIZONTAL. However. ROMAN. labelfont=[TIMES.alpha:=-2.t). .t. ROMAN.t)+alpha*diff(u.D..axes='framed'.4. Comp. Application of the Maple riccatiMethod procedure finds 7 × 6 traveling wave solu- tions (recall that the Riccati method finds 6 different forms for each solution).beta:=1. Zhang. Handbook of Nonlinear Partial Differential Equations. (17. [4] Z. 16].grid=[100.77]. infoLevOut). 16].VERTICAL]. shading=Z."t". labels=["x".5.HORIZONTAL. J. Partial Differential Equations for Scientists and Engineers.

which follows from the derivative (in t) of eq.00018-2 339 Copyright © 2012 Elsevier Inc. An initial condition (IC) follows directly from eq. t) 1 − c2 1 − c2 = (3/2)c(1 − c2 )3/2 sinh (x − ct) cosh−3 (x − ct) (18.4) constitute the problem of interest and a method of lines (MOL) numerical solution is produced with the following Matlab routines. 6] ∂ 2u ∂ 2u ∂ 4u ∂ 2 2 = − − u (18.1) ∂t 2 ∂x2 ∂x4 ∂x2 with the reported analytical solution [8] "p # 1 − c2 ua (x. We note that eq. Since eq. Traveling Wave Analysis of Partial Differential Equations DOI: 10. t) ∂ 2 u(x = xu . All rights reserved.4) is as follows. and the four required boundary conditions (BCs) are taken as u(x = xl .2) is a traveling wave solution from the argument x − ct. t) = =0 (18. Here we consider the particular equation [3.2) with t = 0. t) = u(x = xu .4a.u) % % Function pde_1 computes the t derivative vector for the Boussinesq % equation % .4d) ∂x2 ∂x2 Equations (18.4c.1016/B978-0-12-384652-5.2) 2 where c is an arbitrary constant. 18 Boussinesq Equation Several variants of the Boussinesq equation have been reported and discussed in the literature.1)–(18. (18.1) is fourth order in x.1) to (18. t) = (3/2)(1 − c2 )sech2 (x − ct) 2 "p # 2 −2 1 − c2 = (3/2)(1 − c )cosh (x − ct) (18.4b) ∂ 2 u(x = xl .2). . function ut=pde_1(t.1) is second order in t. we require a second IC. t) = 0 (18. (18.3) ∂t 2 2 Equation (18. (18. "p # "p # ∂ua (x. The ODE routine for eqs. (18. (18.

m (for ncase=1) to pde 1d.u). ncase is set to one of the values 1.m.u). ∂ 4u Case 1: Direct Calculation of via u4x11p ∂x4 function ut=pde_1a(t.1) (ncase=1. pde 1 main. discussed subsequently and passed as a global variable. To select a particular case.u).u).1: Function pde 1.u).end if(ncase==4)ut=pde_1d(t.4).u) % % Function pde_1 computes the t derivative vector for the Boussinesq % equation % global xl xu x n ncall % % Model parameters global c ncase .m for eq. including all of the cases in pde 1. To start. one at a time.end if(ncase==3)ut=pde_1c(t.u).2.end LISTING 18.end Then we can discuss the individual cases by examining the four routines pde 1a. these cases are programmed as a series of self-contained routines.2.u) % % Function pde_1a computes the t derivative vector for the Boussinesq % equation % .u). we consider pde 1a.1). The function and some global variables are first defined.end if(ncase==4)ut=pde_1d(t.u).m as in Listing 17.340 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS global xl xu x n ncall % % Model parameters global c ncase % if(ncase==1)ut=pde_1a(t. This arrangement is offered as a way to investigate various mathematical and MOL formulations in a separated and clearly defined format (rather than.m (for ncase=4).end if(ncase==2)ut=pde_1b(t. Each of the four cases will be considered. for example.end if(ncase==3)ut=pde_1c(t.4 in the main program.3. We can note the following details about pde 1.m for ncase=1. function ut=pde_1(t.3. (18. % if(ncase==1)ut=pde_1a(t.m: . Since four cases will be considered in the subsequent discussion.end if(ncase==2)ut=pde_1b(t.

u1sx. % % (u1ˆ2)xx u1s=u1.u) % % Function pde_1a computes the t derivative vector for the Boussinesq % equation % global xl xu x n ncall .u1. nl=1.xu.n. (18. end % % BCs at x = -15. nu=1. u1(n)=0.nu). The function and some global variables are defined. u2t=u1xx-u1xxxx-u1sxx. u2(i)=u(i+n).1) (ncase=1).ˆ2. % % PDE u1t=u2.25 (not required by u4x11p) % u1xx(1)=0.nl. We can note the following details about pde 1a. LISTING 18.m: .u1x.nu).nl. % % u1xx nl=1.n. Boussinesq Equation 341 global xl xu x n ncall % % One vector to two vectors for i=1:n u1(i)=u(i). u1sxx=dss044(xl. u1sx(1)=0. ut(i+n)=u2t(i). % % Two vectors to one vector for i=1:n ut(i) =u1t(i).25 u1(1)=0.m for eq. % % BCs at x = -15.1a: Function pde 1a. function ut=pde_1a(t. nu=1.u1s. u1x(1)=0. % % u1xxxx u1xxxx=u4x11p(xl.n.xu.u1). Chapter 18 . % u1xx(n)=0. u1xx=dss044(xl. % % Increment calls to pde_1a ncall=ncall+1.xu. end ut=ut'.

nu). % % One vector to two vectors for i=1:n u1(i)=u(i). u1xx=dss044(xl.25 u1(1)=0. then taking its second derivative with dss044 (note that u1 is the RHS dependent variable u of eq. nu=1. so a library ODE integrator such as ode45 or ode15s can be used to move the equations through t. 16 and 17) for PDEs second order in t.m (the origin of this routine is discussed in Chapter 12 and in further detail next). BCs (18. BCs (18.1) is computed by first squaring the solution ∂x (u2 = u1s). . % % (u1ˆ2)xx u1s=u1. % u1xx(n)=0.n.4d) are not used (note the comments) since they are not required by u4x11p.342 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS .u1.u2 are dependent variables first order in t.u1).4c) and (18. u1x(1)=0 is not actually used in the calculations in dss044 but rather is programmed to meet the Matlab requirement that input arguments to functions must be given a value.4b) are programmed and the second derivative ∂ 2u ∂x2 is computed with dss044 (with Dirichlet BCs designated by nl=1.u1x. nl=1.nl. the solution vector u is placed in two arrays u1.. As in the preceding chapters (e. .4a) and (18.g. .xu. nu=1. (18.nu=1). end u1. % % BCs at x = -15. u1(n)=0.xu.u2. u2(i)=u(i+n).25 (not required by u4x11p) % u1xx(1)=0. u1x(1)=0. ∂2 The nonlinear term 2 u2 in eq.m. ∂ 4u ∂x4 is computed by u4x11p.ˆ2. % % BCs at x = -15.n. . (18. % % u1xx nl=1.1)). % % u1xxxx u1xxxx=u4x11p(xl.

The number of calls to pde 1a. ∂2 u2 . % % Two vectors to one vector for i=1:n ut(i) =u1t(i). is placed in array u1sxx.m for the calculation of based on an 11-point FD approximation follows.u1sx.n.xu.u2t are placed in a single derivative vector ut to be returned from pde 1a. a transpose is required by these integrators (so that ut is a column vector). end % . % % Increment calls to pde_1a ncall=ncall+1.m and integrated by ode45 or ode15s in the main program pde 1 main.u1s. (18. ∂ 4u u4x11p. ∂x4 function uxxxx=u4x11p(xl.1). Boussinesq Equation 343 u1sx(1)=0. end ut=ut'. u1t. % % PDE u1t=u2. . The two derivative vectors.nu).u) % % Function u4x11p computes the derivative uxxxx based on 11 points global ncall CC % % For the first call to u4x11p (ncall = 0). In summary. u2t=u1xx-u1xxxx-u1sxx.xu. equally spaced grid for i=1:11 x(i)=i-1. compute the FD weighting % coefficients % if(ncall==0) % % Default points.n. The nonlinear term of eq. ut(i+n)=u2t(i).m is incremented for display at the end of the solution in the main program pde 1 main.m. ∂x 2 Equation (18. . pde 1a.m receives the dependent variable vector u as an input (along with the independent variable t) and returns the derivative vector ut.m (note that ncall is a global variable). Chapter 18 . u1sxx=dss044(xl.1) is programmed as two first-order PDEs in t.nl.

6.ng-1. nd=ng. end % % Display coefficients for derivatives of orders 0. +CC(6... fprintf('\n\n Numerical Derivative Order: %d'. 1.:.7.0/dxˆ4. +CC(6.i)*8 % end % % Calculation of FD weights complete end % % uxxx % Spatial increment dx=(xu-xl)/(n-1)..:)=weights(x(ip)..5)*u(i-5)... +CC(6.5)*u(i-4).:.5)*u(i+1).1... rdx4=1.. ..5)*u(i ).0. % % Compute weighting coefficients for finite differences % over ip points for ip=1:ng % % Weighting coefficients in array CC CC(ip. (CC(6. fprintf('\n=============================\n'). for i=1:n % % At the left end.m with m = 4.i-1).344 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS % Compute FD approximation for up to and including the mth % derivative m=4.3. uxxxx = 0 elseif(i>(n-5))uxxxx(i)=0. % % Number of grid points ng=11.. +CC(6. % % At the right end. 4 % for i=1:m+1 % % Display coefficients for derivative of order 4 i=m+1.5)*u(i-1).x.m).. % % Interior points else uxxxx(i)=rdx4*. 2. ng = 11 % CC(:. % % Coefficients in u5x11p.2.5)*u(i-2).0.5)*u(i-3)...i)*8 CC(6.:.5. uxxxx = 0 if(i<6)uxxxx(i)=0. +CC(6..4.. +CC(6. 3.nd-1.

. the 11-point FD computational grid is defined during the first call to u4x11p. end end ∂4u LISTING 18.n. end % % Compute FD approximation for up to and including the mth % derivative m=4. end . % % uxxx % Spatial increment dx=(xu-xl)/(n-1)..m). +CC(6. . uxxxx.ng-1.x.10. equally spaced grid for i=1:11 x(i)=i-1. Chapter 18 .5)*u(i+3). .nd-1.0/dxˆ4.m for in eq..5)*u(i+4).5)*u(i+5)). After the function is defined. +CC(6.2: Function u4x11p.1).m is discussed in some detail in Chapter 12. Here we note just a few details ∂ 4u specific to the calculation of 4 on 11-points.11. .8.. compute the FD weighting % coefficients % if(ncall==0) % % Default points. is computed over n grid points (n is an input parameter to u4x11p). ∂x4 The origin of routines for the calculation of higher order derivatives in x based on func- tion weights... for ip=1:ng % % Weighting coefficients in array CC CC(ip.u) . The finite difference (FD) weighting coefficients are computed by weights over the 11-point grid (ng=11). ∂x . Boussinesq Equation 345 +CC(6.xu. rdx4=1. function uxxxx=u4x11p(xl.:)=weights(x(ip). % % For the first call to u4x11p (ncall = 0).5)*u(i+2).:. A fourth-order derivative is then specified. . The fourth derivative. +CC(6. (18.9.

4.3a: IC function inital 1.. and inital 1d. and the derivatives in x of the solution are effectively zero.10.. this requires that the solution at the end points does not move away from its IC values for t > 0.4). uxxxx is set to zero.0.5)*u(i+3).5)*u(i+2).3..5. These conditions are satisfied by the solution of eq.m..5)*u(i+1).5)*u(i ). uxxxx = 0 elseif(i>(n-5))uxxxx(i)=0. After looking at the output for this case.5)*u(i-3)..n-2.5)*u(i-5).m is used. +CC(6. and 4.2) as will be observed in the computed output.. (18. Generally..2. +CC(6.3. +CC(6.4.m.end LISTING 18.. inital 1a. +CC(6. function inital 1a. .. we continue the discussion for ncase=2.346 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS for i=1:n % % At the left end. (CC(6.m from eq.11...xu.5)*u(i-1).m.. function u0=inital_1(t0) % % Function inital_1 sets the initial condition for the Boussinesq % equation % % Parameters shared with other routines global ncase % if(ncase==1)u0=inital_1a(t0).5 and i=n-4.. This was done to minimize any spurious end effects at x=xl..2. We now consider the other routines for the case ncase=1..3. +CC(6. respectively.6.8. but this also means u4x11p can be used only when the solution satisfies this condition. +CC(6.end if(ncase==3)u0=inital_1c(t0). end Note that for the grid points i=1.n-3. inital 1b.5)*u(i-4). +CC(6. For ncase=1.3..n-1.9.2) with t = 0 (for ncase=1.3..2.5)*u(i-2).m uses one of four initial condition routines.. % % Interior points else uxxxx(i)=rdx4*.m for ncase = 1.5)*u(i+4). +CC(6.7.end if(ncase==4)u0=inital_1d(t0).. uxxxx = 0 if(i<6)uxxxx(i)=0.. inital 1c.2.4.end if(ncase==2)u0=inital_1b(t0). +CC(6. (18..n..5)*u(i+5)). The IC function inital 1. +CC(6.0. % % At the right end.1.

u0(i) =u1(i). (18. The function and some global variables are defined. % % ICs from analytical solution for i=1:n x(i)=xl+(i-1)*dx. In the for loop. . n=101. Chapter 18 .3)). % % Spatial domain and initial condition xl=-15. dx=(xu-xl)/(n-1).1) are provided by the function ua 1a. end LISTING 18. (18.3b: IC function inital 1a. (18. u1(i)= ua_1a(x(i). eq.m: . . xu= 25.2) with t = 0 (for ncase=1). xu= 25.m from eq. dx=(xu-xl)/(n-1). the initial values of u1 for eq. Boussinesq Equation 347 function u0=inital_1a(t0) % % Function inital_1a sets the initial condition for the Boussinesq % equation % % Parameters shared with other routines global xl xu x n ncall % % Spatial domain and initial condition xl=-15. n=101.m (which has the programming for the derivative of eq.m (which has the programming of eq.t0). (18. function u0=inital_1a(t0) % % Function inital_1a sets the initial condition for the Boussinesq % equation % % Parameters shared with other routines global xl xu x n ncall . % % ICs from analytical solution for i=1:n x(i)=xl+(i-1)*dx. We can note the following details about inital 1a.2) with respect to t.2) with t = 0). u2(i)=uat_1a(x(i). the initial values of u2 are provided by the function uat 1a. u0(i+n)=u2(i).t0). A grid in x of 101 points is defined for −15 ≤ x ≤ 25. (18.

m in Listing 18.5)/2*(x-c*t).m.4b. u0(i) =u1(i).m called by inital 1b. respectively.m in Listing 18. The repetition of these IC routines is done in order to make the coding for each case (ncase=1. Function ua 1a. (18.4a: Function ua 1a.3). are identical to ua 1. uanal=(3/2)*(1-cˆ2)*(cosh(xi))ˆ(-2).2). inital 1c. LISTING 18.m. Three other IC functions inital 1b.4b: Function uat 1a.m for the derivative of the analytical solution. are identical to uat 1a. this can easily be included in the four IC routines.m. three other IC functions ua 1b. and inital 1d.2). and ua 1d.m called by inital 1b. Function uat 1a. u2(i)=uat_1a(x(i).m. inital 1c. and three functions uat 1b. (18.m. uanal=(3/2)*c*(1-cˆ2)ˆ(3/2)*sinh(xi)*(cosh(xi))ˆ(-3). if the ICs change from case to case. and uat 1d.m is a straightforward implementation of eq.3b and are therefore not listed in the subsequent discussion.2. respectively. ua 1c.t0).m. and inital 1d.m in Listing 18.3a are the same as inital 1a. The repetition of . eq.3.348 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS u1(i)= ua_1a(x(i).5)/2*(x-c*t).t) % % Function uanal computes the time derivative of the exact solution % of the Boussinesq equation % % Model parameters global c % % Analytical solution derivative xi=(1-cˆ2)ˆ(0.t) % % Function uanal computes the exact solution of the Boussinesq equation % for comparison with the numerical solution % % Model parameters global c % % Analytical solution xi=(1-cˆ2)ˆ(0.m for the analytical solution of eq. LISTING 18. Again.m. function uanal=uat_1a(x.m.m in Listing 18.m discussed subsequently.m. (18. uat 1c.m. inital 1c.3). Of course.m.m called by ini- tal 1.4) self-contained as explained previously. and inital 1d.m through the vector u0 to the main program pde 1 main. u0(i+n)=u2(i). end All 2n initial condition values are returned from inital 1a.t0).m is a straightforward implementation of the derivative (in t) of eq.4a. function uanal=ua_1a(x.m. (18.

Boussinesq Equation 349 these IC routines is also done in order to make the coding for each case (ncase=1.ncall=0. end if(ncase==2) tf=9.4.nout=4. . % % Display selected output for it=1:nout fprintf('\n t x u1(it.nout=4. % % Model parameters if(ncase==1)c=0.1)– (18.i) and displayed.nout=4.9.2.m of Chapter 15 and therefore only a few features are discussed here.i)\n').ncall=0.tout=[t0:3:tf]'. % ncase=3. and the numerical solution is plotted in 3D by surf. end if(ncase==3) tf=9. Chapter 18 .i) err(it.nout=4.3.4 for eqs.end . If the analytical solution changes from case to case.4) self-contained as explained previously.9. end . end if(ncase==4) tf=9. These solutions are then plotted in 2D by plot. but the range could easily be changed from case to case.end if(ncase==2)c=0.3.3.tout=[t0:3:tf]'. The difference in the numerical and analytical solutions is computed as err(it.2. This main program closely parallels pde 1 main.2. % % Independent variable for ODE integration if(ncase==1) tf=9. The parameters are set for ncase=1. % % Model parameters global c ncase % % Select case % ncase=1.end if(ncase==3)c=0.3.tout=[t0:3:tf]'. (18.2.end if(ncase==4)c=0. this can easily be included in the four analytical solution routines and the four derivative routines. .i) u1_anal(it.tout=[t0:3:tf]'.ncall=0. % ncase=2.m accommodates the cases ncase=1.9. ncase=4. Main program pde 1 main.ncall=0.4. The range in t is the same for ncase=1.4).9.

Also.1a for ncase=1. o . ncase = 2.num.t)').'-'. o .2f%8. 9.x. end end fprintf(' ncall = %4d\n\n'. .u1) xlabel('x'). 4. solid .i). these are the coefficients only for the center point in the spatial grid.m).6f%15.num. t = 0.u1.anal') end figure(3) surf(x. the center coefficients are used throughout the grid with more than 11 points. Another way to visualize the FD weighting coefficients is to note that the coefficients are symmetric about the n = 6 value 101. 5 and i = 7.. solid . 2.9333.anal') end if(ncase==3) title('Boussinesq equation. 9.m for i = 1. 6.'o') xlabel('x') ylabel('u1(x. t = 0.x(i). 9. t = 0.350 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS for i=1:5:n fprintf('%6. solid . ylabel('t'). 6. 8. 9. 3.t)') if(ncase==1) title('Boussinesq equation. 3.u1(it. 3.. solid .num. We can note the following points about this output: . o .u1_anal(it. The FD weighting coefficients produced by weights. title('Boussinesq equation'). such as n = 101 in the preceding example for ncase=1.3f%15.err(it.. and the map is therefore not included in the discussion of the output that follows.. A portion of the numerical output from pde 1 main. except at these 10 . which is to be expected for a FD approximation of a derivative of even order (in this case. 3.anal') end if(ncase==4) title('Boussinesq equation. 3. t(it). ncase = 1. % % Plot numerical and analytical solutions figure(2) plot(x. fourth order). grid point 6 in the total of 11 points (recall that uxxxx is set to zero in u4x11p.m are displayed first (these can easily be suppressed by a small change in u4x11p. jpattern num 1. 6.t.u1_anal.anal') end if(ncase==2) title('Boussinesq equation. 11 in the basic grid. 6. ncase = 4. ncase = 3. zlabel('u1(x. 10. t = 0. end values that are zeroed).6f\n'.i)).1) as expected. 9. i.6f%15.m is listed in Table 18.m indi- cates two bands for PDE (18. also. The ODE Jacobian map from jpattern num 1. o .e.num.m for the sparse matrix integration of the ODEs is not listed here since it is the same as for Chapters 15–17.ncall).i).

049162 0.000000 0.271880 0.000048 0.1778 27.00 −11.009277 0.00 21.049162 0.00 −9.003917 0.00 −15.021685 0.000 0.001575 −0.000 0. . .000000 0. .001645 0.m for ncase=1 Numerical Derivative Order: 4 ============================= ans = Columns 1 through 9 −0.000 −0.000 0.1524 Columns 10 through 11 0.000565 0.003917 0.000000 0.00 −9.049162 0.000000 0.6672 −5.00 17.000000 0.271880 0.000000 0.i) u1 anal(it.000050 0.000 0.191019 0.001645 0.000050 0.000121 0.003917 0.191019 0.104066 0.i) u1 anal(it.00 23.9333 −74.00 −15.000689 0.000021 0.000289 9.021685 0.000 0.000000 0. .000 0.000 0.000000 0.000 0.00 5.001035 0.00 −3.009277 0.00 −1.0434 0.00 7.1a: Selected numerical output from the main program pde 1 main.000540 (Continued ) .1524 27.000000 0.00 −7.000000 0.104066 0.000000 0.104066 0.7397 −5.000000 0.021685 0.000048 0.000 0.000 0.000 −0.000000 0. t x u1(it.271880 0.i) 0.000000 9. .000000 0.000121 0.000 0. .191019 0.000 0.i) 9.000000 0.i) err(it. Chapter 18 .00 −11.000 0.000 0.000365 9.000115 −0.00 25.000 0.049162 0.1778 101.000021 0.00 13. output for t = 3.00 −5.00 −7.003917 0. Boussinesq Equation 351 Table 18. 6 removed .000 0.001645 0.000288 0.000678 9.7397 −74.i) err(it.191019 0.000 0. . .000 0.000000 0. .000000 0.000 0.00 15.00 9.000 0.6672 −0.00 1.104066 0.000000 0.000 0.271880 0.00 −13.000689 0.00 3.000660 −0.000249 0.00 11.000276 0.001645 0.009277 0.00 −13.000288 0.000000 0.000 0.009277 0.0434 t x u1(it.000 0.000019 0.000000 .021685 0.00 19.000000 0.000 0. .

000 0.1b Figure 18.000 0. x = xu = 25. (18. The numerical and analytical solutions agree at t = 0 as expected. and the agreement .m set the boundary values equal to the analytical solution .000 0.000000 ncall = 963 .000895 9.000928 9. The computational effort is modest. The agreement of the numerical and analytical solutions as reflected in Table 18.000 0.187166 0.i) 9.00 23. which results from setting the two solutions equal at the boundaries in the main program.1d Figure 18.00 19.051146 0.000090 9.001318 9.000 0.009739 0. pde 1 main.009683 0.186238 0.000218 9.000720 0.000264 9.020794 0.275694 0.1a: (Continued) t x u1(it.100497 −0.269227 −0.003283 0.267848 0. between the two solutions at t = 9 is about three figures.000682 9.1a Figure 18.000 0. The numerical and analytical solutions agree exactly at the boundaries x = xl = −15.274310 0.022371 0.2) (starting from t = 0) from the argument of x − ct in eq.051283 0.000468 9.m.000056 9.000 0.100279 0.000302 9. (18.003751 −0.022112 0.00 17.i) u1 anal(it.2a 2 b Figure 18.00 3.1a is .00 −5.00 25. Note plots are organized as follows: Letter Case designation 2D plot 3D plot 1 a Figure 18.008887 −0.001379 9.00 5.107725 0. The plotted solutions follow in Figs.2).00 11.022612 −0.001718 −0.000563 9.00 1. with ncall = 963.1a demonstrates that the solution is a traveling wave in x from eq.000 0.000 0.000 0.000 0.2a.195798 −0.00 −1.000720 0.00 15.1a: .001454 0.2d Figure 18.352 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 18.046565 0.1a and 18.000 0.001384 9.000240 9.00 9.2b 3 c none none 4 d Figure 18.00 7.i) err(it. 18.000 0.000 0. evident. We can note the following details about Fig.004090 −0.00 −3.00 21.00 13.000 0.008324 0.047247 −0.000136 9.004000 0.108027 0.194903 0. 18.000 0. This is done because although the Dirichlet BCs in pde 1.

x = xu is small (effectively zero) because the nonzero portion of the solution traveling left to right at velocity c = 0.m of Listing 18. associated ODE programmed in the ODE routine. Boussinesq Equation 353 Boussinesq equation. including the fourth derivative. o – analytical 0.2 as discussed previously. 3.. that is.1 units in x while the right boundary is at xu = 25).3 0. This is taken as justification for setting uxxxx=0 in u4x11p. this value is not returned by ode15s.2) and for BCs (18.9 does not reach the right boundary at t = 9 (ct = (0.1a: 2D plot comparing the numerical and analytical solutions of eq. but do not actually work). which is a characteristic of the Matlab ODE integrators. (by using ua 1a.1 0. 6.m).1a. The preceding discussion was for ncase=1. The slope of the solution at the boundaries x = xl .15 u1 (x.9)(9) = 8. in other words.05 −15 −10 −5 0 5 10 15 20 25 x FIGURE 18. the derivatives in x of the solution at xu = 25. .2 0.4). rather an ODE dependent variable can only be computed from its .3.1) for t = 0.9 in eq. (18. ncase = 1. not all of which are success- ful (we report the negative results as well as the positive to provide some experience with approaches that seem reasonable. Chapter 18 . In other words. these boundary values are not returned to the main program (from ode15s).1) with c = 0. lines – numerical. 9 (left to right).g.25 0. t) 0. (18. with the MOL calculations in pde 1a. (18.05 0 −0.m of Listing 18. if a dependent variable is set in the ODE routine (e. which basically reflect variations in the MOL coding in the ODE routine to illustrate alternate approaches. remain essentially at zero for t ≤ 9. a boundary value).4. eq. We now con- sider the other three cases ncase=2.

1 0.25 0.u) % % Function pde_1b computes the t derivative vector for the Boussinesq % equation % global xl xu x n ncall % % Model parameters global c ncase % % One vector to two vectors for i=1:n u1(i)=u(i).2a: 3D plot of the numerical solution of eq. ∂ 4u ∂ 2u Case 2: Calculation of via two-stage Differentiation of ∂x4 ∂x2 We start with the case ncase=2 in pde 1b.m.15 u1 (x.05 0 8 25 6 20 15 t 4 10 5 0 2 −5 x −10 0 −15 FIGURE 18. end % % BCs at x = -15. t) 0.354 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Boussinesq equation 0. function ut=pde_1b(t.25 u1(1)=0. u2(i)=u(i+n).2 0.1). % % u1xx . u1(n)=0. (18.

m for eq.m of Listing 18. % % u1xxxx u1xxx(1)=0. u1xx=dss044(xl.xu. u2(i)=u(i+n). u2t=u1xx-u1xxxx-u1sxx. (18. nl=1.xu.u1. u1xx(n)=0. Chapter 18 .u1x.nl. nu=1.u1s. The initial coding is the same as in pde 1a.1) (ncase=2).nu). u1xxxx=dss044(xl. % % (u1ˆ2)xx u1s=u1.n. u1x(1)=0.u1xxx.u1xx.nu).25 (used by dss044) u1xx(1)=0.xu. % % Increment calls to pde_1b ncall=ncall+1.nu). % % PDE u1t=u2. % % BCs at x = -15. ut(i+n)=u2t(i). % % Two vectors to one vector for i=1:n ut(i) =u1t(i). u1sx(1)=0.u2 of length n. nu=1. LISTING 18. Boussinesq Equation 355 nl=1. end ut=ut'. function ut=pde_1b(t.m: . end .u1sx.ˆ2.nl.u) % % Function pde_1b computes the t derivative vector for the Boussinesq % equation % global xl xu x n ncall % % Model parameters global c ncase % % One vector to two vectors for i=1:n u1(i)=u(i).1a to define the function and some global variables and to place the single dependent variable vector u of length 2n in two vectors u1.nl.n.1b: Function pde 1b. We can note the following details about pde 1b. u1sxx=dss044(xl.n.

u1xx(n)=0. % % BCs at x = -15.1b for ncase=2. % % u1xx nl=1.m. A portion of the numerical output from pde 1 main.xu.m. u1(n)=0. and uat 1b. Dirichlet BCs (18. The remainder of pde 1b is the same as pde 1a. . u1xx=dss044(xl. and uat 1a. this arrangement of a complete set of subordinate routines for each case provides for max- imum flexibility and clarity. ut(i+n)=u2t(i).n. and the second derivative ∂ 2u ∂x2 is computed by dss044.m.xu. and the fourth derivative ∂ 4u ∂x4 is computed by a second application of dss044 to the second derivative. u1xxxx=dss044(xl.4d) are Dirichlet for the fourth derivative (nl=nu=1 in . respectively. ua 1b.m. % % Two vectors to one vector for i=1:n ut(i) =u1t(i). u2t=u1xx-u1xxxx-u1sxx. BCs (18. ua 1a. are the same as inital 1a. that is.u1.4a) and (18.u1xx.25 (used by dss044) u1xx(1)=0. using dss044 the second time). the coding in the main program pde 1 main.4c) and (18. nu=1. % % BCs at x = -15. Finally.25 u1(1)=0. inital 1b. . % % u1xxxx u1xxx(1)=0. Note that BCs (18.u1xxx.4d) are set.356 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS .nu). u1x(1)=0.u1x.nu).m. % % Increment calls to pde_1b The other routines for ncase=2 are the same as for ncase=1.4b) are set.m for ncase=2 directly parallels that for ncase=1 and therefore it will not be discussed.nl.4c) and (18.m. end ut=ut'.n. % % PDE u1t=u2.m is listed in Table 18. so-called stagewise differentiaion.nl.

000225 9.00 −13. Boussinesq Equation 357 Table 18.000000 0.000000 .000660 −0.195772 0.000 0.000 0.000160 9.00 7.269227 0.00 11.000000 0.000000 0.191019 0.000400 9.003917 0.274310 −0. .009277 0. .049162 0.000048 0.000298 0.000000 0.00 −7. t x u1(it.000 0.049162 0.1b: Selected numerical output from the main program pde 1 main.00 −11.000000 0.001575 −0.00 17. .000 0.271880 0.00 11.000689 0.00 23.00 −3.000 0.00 13.00 15.000000 0.000015 0.000000 0.00 −5.000 0.049162 0.195798 −0.000 0.000 0.00 −11.021685 0. Chapter 18 .000083 9.003917 0. output for t = 3.000021 0.100497 −0.000 0.000000 0.000276 −0. .008681 0.186238 0.000000 0.047473 0.049162 0.000000 0.008887 −0.271880 0.000 0.000000 0. .000 0.003751 −0.000 0.021685 0.000115 −0.000288 9.00 1.003917 0.000255 9.000 0.000000 9.000026 (Continued ) .00 −7.009277 0.269387 0.000121 0.000000 0.000000 0.000288 0.274227 0.m for ncase=2 t x u1(it.000079 0.000 0.021685 0. .003215 0.000121 0.00 9.00 19.i) 0.000689 0.i) u1 anal(it.000532 9.000 0.000 0.000000 0.100097 0.104066 0.000021 0.000000 0.00 −5.000 0.271880 0.00 −9.000 0.191019 0.000197 9.003917 0.000288 0.00 −13.000 0.000000 0.104066 0.000 0.104066 0.000 0.000050 0.000050 0.000 0.000 0.00 7.000207 9.000 0.191019 0.000000 0. .00 21.000 0.00 −15.00 −1.000000 0.000361 9.00 3.000536 9. .00 5.00 −3.00 1.271880 0.000000 0.000000 0. 6 removed .i) 9.021082 0.009277 0.00 −15.i) err(it.00 3.047247 0.000101 9.00 −9.191019 0.000 0. .001645 0.00 9.001645 0.009277 0.00 −1.000 0.001043 0.020794 0.i) err(it.000 0.i) u1 anal(it.021685 0.104066 0.00 5.000 0.000 0. .001645 0.000 0.000 0.001645 0.000 0.000 0.000048 0.000 0.00 25.186493 0.

i) 9. and the agreement . 18. The plotted solutions are included in Figs.00 23.2) (starting from t = 0) from the argument of x − ct in eq. ncase = 2.00 15.000117 9. The numerical and analytical solutions agree at t = 0 as expected.00 19.1a.001718 −0.000720 0. We can note the following points about this output: .1) for t = 0.022524 0.000720 0. lines – numerical.15 u1 (x.2). The computational effort is modest.1b again demon- strates that the solution is a traveling wave in x from eq. (18.000 0.2 0.107275 0. between the two solutions at t = 9 is about three figures.00 13.004207 0.000 0.1 0. t) 0. o – analytical 0.000 0.05 −15 −10 −5 0 5 10 15 20 25 x FIGURE 18.000338 9.000 0.1b: 2D plot comparing the numerical and analytical solutions of eq.05 0 −0. with ncall = 1004.051146 0.i) err(it.3 0.000 0.00 25.022612 −0. 9 (left to right).i) u1 anal(it.001272 0.004090 0.2b.000087 9.358 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 18.000 0. Figure 18.051484 0.1b: (Continued) t x u1(it.009683 −0.009621 0. 3.000 0. (18.000000 ncall = 1004 Boussinesq equation.1b and 18.000062 9. this plot is very similar to Fig. . 18.107725 −0.00 21. 6.00 17.000450 9. (18.000445 9.25 0.

05 0 8 25 6 20 15 4 10 t 5 2 0 −5 x −10 0 −15 FIGURE 18. (18. The discussion of Fig. we now use four successive (stage- wise) derivative calculations to arrive at the fourth derivative in eq.1) using the first derivative routine dss004. function ut=pde_1c(t. We can note the following details about Fig.m listed below.2a.1b: .2 u1(x.1a applies also to Fig. t) 0. x = xu = 25 is essentially zero. In particular. ∂ 4u ∂u Case 3: Calculation of 4 via Four-Stage Differentiation of ∂x ∂x As a third approach to a numerical solution (ncase=3). The agreement of the numerical and analytical solutions as reflected in Table 18. the slope of the solution at the end points x = xl = −15. evident. All of the preceding routines remain unchanged.2b: 3D plot of the numerical solution of eq. This plot is very similar to Fig.15 0. which is pde 1c. 18.1b.u) % % Function pde_1c computes the t derivative vector for the Boussinesq % equation % global xl xu x n ncall . 18. except the ODE derivative routine. 18.25 0.1b is . 18. Chapter 18 . (18.1 0.1). Boussinesq Equation 359 Boussinesq equation 0.

nu=1.n.25 u1xx(1)=0. (18. u2t=u1xx-u1xxxx-u1sxx.u1xxx). LISTING 18.25 u1(1)=0.u1sx. u1xx(n)=0.u1x). nl=1. % % u1xxx u1xxx=dss004(xl. ut(i+n)=u2t(i).nu).u1xx). % % Two vectors to one vector for i=1:n ut(i) =u1t(i). end ut=ut'.360 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS % % Model parameters global c ncase % % One vector to two vectors for i=1:n u1(i)=u(i). u2(i)=u(i+n).1) (ncase=3). u1sxx=dss044(xl.n. .xu. % % Increment calls to pde_1c ncall=ncall+1.xu.1c: Function pde 1c.n. % % PDE u1t=u2. % % u1xxxx u1xxxx=dss004(xl.m for eq. % % u1x u1x=dss004(xl.n.nl. % % (u1ˆ2)xx u1s=u1.u1s. % % u1xx u1xx=dss004(xl.xu.n.xu.u1). u1(n)=0.ˆ2.xu. end % % BCs at x = -15. % % BCs at x = -15. u1sx(1)=0.

4b) are set and the second derivative ∂ 2u ∂x2 is computed by using dss004 twice. % % BCs at x = -15.m of Listing 18.m: .4c) and (18. % % u1xxxx u1xxxx=dss004(xl.25 u1xx(1)=0.25 u1(1)=0. % % u1xx u1xx=dss004(xl. u1xx(n)=0. function ut=pde_1c(t.xu. end . % % u1xxx u1xxx=dss004(xl. u1(n)=0.4a).1a to define the function and some global variables and to place the single dependent variable vector u of length 2n in two vectors u1.u) % % Function pde_1c computes the t derivative vector for the Boussinesq % equation % global xl xu x n ncall % % Model parameters global c ncase % % One vector to two vectors for i=1:n u1(i)=u(i). % % BCs at x = -15. .xu.u1). The initial coding is the same as in pde 1a. u2(i)=u(i+n). Chapter 18 .n.u1x).xu.u1xxx). Boussinesq Equation 361 We can note the following details about pde 1c.n.4d) are set and the fourth derivative ∂ 4u ∂x4 is computed by two additional applications of dss004 differentiation.n.n. Dirichlet BCs (18.u1xx). BCs (18. .xu. % % u1x u1x=dss004(xl.u2 of length n. (18.

This example illustrates some generalizations we have experienced in the analysis of PDE systems: . % % PDE u1t=u2. ut(i+n)=u2t(i). the MOL is not a mechanical procedure that is guaranteed in advance to produce a numerical solution to a new problem. % % Two vectors to one vector for i=1:n ut(i) =u1t(i). inital 1c. In other words.1) seems logical (at least mathematically). % % Increment calls to pde_1c ncall=ncall+1. failed in the same way. for example. at least within the MOL context. uxx(1) and uxx(n). uxxx. Some experimentation with various numerical approaches may be required before a successful method is developed.4d) reset the boundary values of the second derivative. four-stage differentiation failed.m. . the coding in the main pro- gram pde 1 main. the numerical solution developed an oscillation (that apparently grew in magnitude to cause an integration failure for t > 6). (18.m. the numerical integration in t using ode15s failed when t was between 6 and 9 (an error message was reported by ode15s that the error tolerances specified in the main program.m.4c) and (18.2 and therefore will not be discussed. derivative. Thus we concluded that although the use of stagewise differentiation four times to arrive at the fourth derivative of eq. The remainder of pde 1c is the same as pde 1a and pde 1b. we cannot offer an explanation for why the . When the routines were executed with a final time 6. a successful outcome cannot be assured in advance.m.m. Numerical methods (algorithms) that seem logical may in fact not work for reasons that are not apparent. it failed.m. and uat 1c. and uat 1a. ua 1a. pde 1 main. before dss004 is applied a third time to compute the third .362 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Note that BCs (18. in fact. rather each new problem must be approached numerically as an experiment that may fail. u2t=u1xx-u1xxxx-u1sxx. in which case an alternative approach must be developed. as mentioned previously. ua 1c.2. In the present case.m could not be satisfied when the integration step t was reduced to the minimum allow- able value).m for ncase=3 directly parallels that for ncase=1. respectively. end ut=ut'. Various attempts to overcome the integration error. The other routines for ncase=3 are the same as for ncase=1. Finally. In other words. are the same as inital 1a. When the routines for ncase=3 (with the designation “c”) were executed. such as reducing the error tol- erances for ode15s.m. this arrangement of a complete set of subordinate routines for each case provides for maximum flexibility and clarity.

specifically. such as ode15s. Case 4: Preceding Problem with Second Derivative BCs Replaced by (First Derivative) Neumann BCs To conclude this discussion. (18.4d) replaced with the homogeneous Neumann BCs ∂u(x = xl . PDEs with higher derivatives.4c) and (18.n. which is pde 1d. All of the pre- ceding routines remain unchanged except the ODE derivative routine.2.4e. end % % BCs at x = -15.u) % % Function pde_1d computes the t derivative vector for the Boussinesq % equation % global xl xu x n ncall % % Model parameters global c ncase % % One vector to two vectors for i=1:n u1(i)=u(i).1) with the fourth-order derivative in x. (18. u1(n)=0. we consider one more case (ncase=4) for eq. % % u1x u1x=dss004(xl. (18. our experience has indicated that MOL analysis can be applied . u2(i)=u(i+n). Chapter 18 . Boussinesq Equation 363 On the other hand.3). such as eq.1) with the homogeneous second derivative BCs of eqs. t) = =0 (18.25 u1(1)=0.u1).m listed next (only the ODE routine for ncase=4 is different than the preceding routines for ncase=1.xu. function ut=pde_1d(t. t) ∂u(x = xu . are increasingly challenging as the order is increased. increases the chances of a successful outcome. to demonstrate the ease in programming this modification as an indication of the flexibility of the MOL approach. . at least within the MOL framework based on finite differences.4f) ∂x ∂x The intention in using this modified problem is essentially to demonstrate another application of MOL analysis and. The use of established quality routines. and computational difficulties that might not occur to a less experienced analyst. successfully to a broad spectrum of PDE problems. This conclusion follows from the careful coding and testing of library routines by experts who anticipate and try to circumvent algorithm limitations .

m: .xu.n.u1x). function ut=pde_1d(t. ut(i+n)=u2t(i).u1x.u1. % % (u1ˆ2)xx u1s=u1.1d: Function pde 1d. u1sx(1)=0. end ut=ut'. The initial coding is the same as in pde 1a.xu.25 u1x(1)=0. u2(i)=u(i+n). % % Increment calls to pde_1d ncall=ncall+1.nu).u2 of length n.u) % % Function pde_1d computes the t derivative vector for the Boussinesq % equation % global xl xu x n ncall % % Model parameters global c ncase % % One vector to two vectors for i=1:n u1(i)=u(i). end . % % PDE u1t=u2.m for eq.xu. u1sxx=dss044(xl.n.364 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS % % BCs at x = -15.nl. % % u1xxxx u1xxxx=uxxx7c(xl.nl.u1sx.n. We can note the following details about pde 1d.m of Listing 18. (18. u1x(n)=0. nu=1. u1xx=dss044(xl.ˆ2.1a to define the function and some global variables and to place the single dependent variable vector u of length 2n in two vectors u1. % % Two vectors to one vector for i=1:n ut(i) =u1t(i). nl=1.u1s.1) (ncase=4). % % u1xx nl=2. nu=2. LISTING 18. u2t=u1xx-u1xxxx-u1sxx.nu).

and it is listed subsequently. u1sx(1)=0. % % u1x u1x=dss004(xl. this routine for a third derivative based on seven-point centered ∂x finite differences was used previously in the MOL analysis of the third-order Korteweg-de Vries (KdV) equation [7].n. note the specification of Neumann BCs (nl=nu=2 for BCs (18. Boussinesq Equation 365 .u1).m. Chapter 18 .nu). is then computed by taking the third derivative ∂x ∂u of with uxxx7c.xu. Neumann BCs (18.u1x.ˆ2.4a) and (18. % % BCs at x = -15. % % u1xxxx u1xxxx=uxxx7c(xl. pde 1b.1).u1sx. ∂u Dirichlet BCs (18.4b) are set. u1(n)=0. u1x(n)=0. % % PDE u1t=u2.4e) and (18. and pde 1c.u1s.4e) and (18. % .25 u1(1)=0.n. u2t=u1xx-u1xxxx-u1sxx. % % Two vectors to one vector for i=1:n ut(i) =u1t(i). The remainder of pde 1d is the same as pde 1a. . nl=1.xu.n. ut(i+n)=u2t(i). nu=1.u1x).4f ) are then set.m. % % (u1ˆ2)xx u1s=u1. % % BCs at x = -15. and the first derivative ∂x is computed by ∂ 2u dss004.n. and the second derivative ∂x2 is computed by dss044.xu. 4 .nl.nl.25 u1x(1)=0. % % u1xx nl=2. nu=2. u1xx=dss044(xl.nu).xu. ∂ 4u The fourth derivative in eq.u1. u1sxx=dss044(xl. For the latter.4f ). (18. end ut=ut'. .

function uxxx=uxxx7c(xl.m..2.1d and 18.u) % % Function uxxx7c computes the derivative uxxx % % Spatial increment dx=(xu-xl)/(n-1). +13.0*u(i-2)..0*u(i ).m of Listing 18. 18..1d.2.0*u(i ) since the third derivative is odd order (for even-order derivatives. ... ua 1d. Execution of the routines for ncase=4 (with the designation “d”) produced the following numerical and plotted output in Table 18. The other routines for ncase=4 are the same as for ncase=1.m for ncase=4 directly parallels that for ncase=1. the weighting coefficient are symmetric)..m.m.. Function uxxx7c.0*u(i+2).0. uxxx7c is structured in the same way as u4x11p. +0.5: uxxx7c for the calculation of the third derivative uxxx. ( 1. +8. ua 1a. as mentioned previously.m. this arrangement of a complete set of subordinate routines for each case provides for maximum flexibility and clarity. % % At the right end...m is listed below.0*(dxˆ3)). ini- tal 1d. uxxx = 0 if(i<4)uxxx(i)=0.m are the same as inital 1a. end end LISTING 18.2.0*u(i+1). -8...0/(8.3 and therefore will not be discussed here. % % Interior points else uxxx(i)=r8dx3*.xu. r8dx3=1. % % uxxx for i=1:n % % At the left end.0.0*u(i-1).3.366 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS % Increment calls to pde_1d ncall=ncall+1. respectively. and uat 1d. and uat 1a.n. -1. the coding in the main program pde 1 main.2d.m... Finally.. uxxx = 0 elseif(i>(n-3))uxxx(i)=0. and Figs. -13. for example.0*u(i+3)). Note in particular that the weighting coefficients are antisymmetric (opposite in sign) around the center term +0.0*u(i-3).

000314 9.000000 0.000 0.000 0.00 −11.000 0.000 0.271880 0.000 0.00 −1.000046 9.000 0.i) err(it.000 0.001645 0.000048 0.000 0.i) 9.104066 0.000689 0. .000 0.00 −1.00 3.000000 0.000660 9.000 0.000000 0.000 0.i) err(it.000 0.00 7.020794 0.000048 0.000000 0.100035 0.000 0. t x u1(it.000000 . . .100497 −0.00 25.000000 0.104066 0.003917 0.000742 9.000000 0.000000 0.001645 0. .00 −13.00 −9.021796 0.009277 0.000 0.000718 0.000 0.00 13. Boussinesq Equation 367 Table 18.000 0.268486 0.274310 0.000000 0.i) u1 anal(it.000121 0.000 0.00 23.000021 0.000000 0.000 0.000000 9.000462 9.00 5.009277 0. .00 1.000050 0.000 0.i) 0.021685 0.000161 0.195798 −0.000207 9.271880 0.00 21.191019 0.000053 9.000276 −0.000756 (Continued ) .271880 0.000706 9.000753 9.000 0.000 0.000000 0.003751 −0.00 17.00 −15.049162 0.000 0. .000336 9.00 5.271880 0. .000058 9.191019 0.000288 0.00 −15.000 0.000000 0.000 0.00 −9.003697 0. Chapter 18 .000000 0.191019 0.000 0.186944 0.008551 0.049162 0.000000 0.000050 0.00 −13. .104066 0.000000 0.000660 0.000000 0.001645 0.003917 0.049162 0.00 −7.021685 0.186238 0. output for t = 3.047247 −0.m for ncase=4 t x u1(it.000121 0.000000 0.021685 0.001575 −0.00 15.195041 0.000000 0.009277 0.00 19. .049162 0.003917 0.000288 0.i) u1 anal(it.269227 −0.000021 0.000689 0.00 7.00 −5.003917 0. .000000 0.000915 0.104066 0.00 1.000000 0.000 0.275063 0.1d: Selected numerical output from the main program pde 1 main.000 0.046933 0.191019 0.00 −5.001645 0.00 −11.000 0.00 −7.000069 0. 6 removed .00 −3.000 0.000 0.000 0.00 11.009277 0.001002 9.00 9.021685 0.000 0.00 3.000 0.000 0.000 0.000000 0.008887 −0.00 9.00 −3.000115 0.00 11.

We can note the following points about this output: .108345 0.050767 0.1 0. 18. this plot is very similar to Figs.009687 0.2d. Figure 18.107725 0.25 0. lines – numerical.00 19. 6.15 u1 (x.000 0.000 0. between the two solutions at t = 9 is about four figures.1) for t = 0.000 0.00 15.000000 ncall = 554 Boussinesq equation.000 0.1d again demon- strates that the solution is a traveling wave in x from eq.000379 9.00 13.000 0.009683 0.022612 0.i) err(it.000620 9. 9 (left to right).1d and 18.000720 0.1d: (Continued) t x u1(it.05 0 −0.000044 9. The computational effort is modest.i) u1 anal(it.000720 0.00 17.2) (starting from t = 0) from the argument of x − ct in eq.3 0. The plotted solutions are included in Figs.000 0.001762 0.000004 9.051146 −0.00 23. The numerical and analytical solutions agree at t = 0 as expected. t) 0.1a and 18.000 0. 3.00 21.2 0.004091 0.368 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 18. with ncall = 554.i) 9.2).000209 9. (18.022820 0.000001 9.001718 0. (18.1b. o – analytical 0.05 −15 −10 −5 0 5 10 15 20 25 x FIGURE 18. (18. 18.004090 0.00 25.1d: 2D plot comparing the numerical and analytical solutions of eq. . and the agreement . ncase = 4.

in fact.4e) and (18.1). . dss044. the reformulation of an nth order PDE as n PDEs first order in an initial value independent variable (t) is straightforward and permits the use of an integrator such as ode15s for first-order ODEs. 18. 18.4d).25 0.1d is . (18. 18. u4x11p.1)) by restating the PDE as two PDEs first order in t (for dependent variables u1 and u2).1a and 18.2 0.1).4c) and (18. In particular.4f ) rather than (18. dss004. (18. not execute and therefore some experimentation with alternate formulations may be required to arrive at a workable MOL code.2a and 18.g.1 0. 18. and more generally it demonstrates the flexibility of the numerical approach when a set of library routines is used (e.1d. evident.05 0 8 25 6 20 15 4 10 t 5 2 0 −5 x −10 0 −15 FIGURE 18. This plot is very similar to Figs. Boussinesq Equation 369 Boussinesq equation 0.m uxxx7c. t) 0. ods15s. We can note the following details about Fig. (18. the fourth-order derivative of eq. In summary. we have again discussed the numerical solution of a PDE second order in t (eq. The discussion of Figs..1) based on BCs (18.2d: 3D plot of the numerical solution of eq.15 u1 (x. This last case ncase=4 illustrates an alternative MOL solution of eq.2b. The agreement of the numerical and analytical solutions as reflected in Table 18. x = xu = 25 is essentially zero. Chapter 18 .1d: .1b applies also to Fig. As noted in Chapters 15–17.m) for both linear and nonlinear PDEs. the slope of the solution at the end points x = xl = −15. We have also considered four alternative approaches to a higher–order derivative. in this case. (18. We observed in ncase=3 that an MOL formulation that seems logical (at least mathematically) may.

He taught there until 1886 when he was appointed as Professor of Physical and Experimental Mechanics at the Sorbonne. Boussinesq 1 in a series of papers [2–4] during the years 1871–1872. the term h+ in the above 4 6 h ∂ξ 2 1 Joseph Valentin Boussinesq was born in 1842 in Southern France and died in 1929 in Paris. followed by some analysis. One of the many equations used to describe the propagation of surface long waves on water is the Boussinesq equation. time. .5) ∂t 2 ∂x2 ∂x2 2H 3 ∂x2 One of the advantages over the related Korteweg–de Vries equation for representing waves is that the Boussinesq equation admits solutions with waves traveling in opposite directions. respectively. t) = h(ξ ) and ξ = x − ct . Boussinesq retained the second-order term in the Taylor expansion to obtain his well-known equation ! ∂ 2h ∂ 2h ∂2 3h2 H 2 ∂ 2 h = gH + gH + (18. and gravitational acceleration. and λ represents wave- length. H represents still water depth. In 1873 he was appointed as Professor of Differential and Integral Calculus at the Faculty of Science in Lille. The standard 1D form of shallow water wave equation is derived by truncating a Taylor series approximation of wave height after the first derivative to give the classical wave equation ∂ 2h ∂ 2h = gH 2 ∂t 2 ∂x where x. He remained in this post for 10 years and then held the prestigious chair in Mathematical Physics and Theory of Probabilities at the same institution until he retired in 1918. Shallow water models usually make the following assumptions h/H 1 and hλ2 /H 3 1 where h represents wave amplitude. which was first published by J. we arrive at the Boussinesq improved expression for wave velocity ! p p 3 1 H 3 ∂ 2h c = gH + gH h+ 4 6 h ∂ξ 2 Now. In order to obtain a more accurate model for c.370 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Appendix We conclude this chapter by first providing some background to the Boussinesq equation based on de Jager’s essay On the Origin of the Korteweg–de Vries Equation [5] and then deriving traveling wave solutions using direct integration and the Riccati-based method. dispersive wave propagation. t. After assuming a traveling wave solution with h(x. Boussinesq was also interested in solitary wave solutions and observed ! that for 3 1H ∂ h 3 2 a wave shape to remain constant over time. and g represent distance. The term gH = c2 represents the square of wave velocity. It assumes shallow water conditions and is gen- erally considered to be the first model to describe nonlinear.

x.x. LISTING 18. Therefore. (18. ># Define sech solution Sol:=h=(cˆ2/g-H)*sech(sqrt((cˆ2/g-H)*3/(4*Hˆ3))*(x-c*t))ˆ2.6) g 4H 3 g The Maple code given in Listing 18. (18.t)): ># Define the Boussinesq PDE pde1:=diff(h. we have p 1p c= gH + gHh1 2 where the constant ! factor of a half has been taken outside the brackets.6: Maple code used to verify analytical solutions to the original Boussinesq equation. Boussinesq Equation 371 equation must be constant.x)-g*H*diff((3*hˆ2/(2*H)+(Hˆ2/3) *diff(h. We also have 2 3 h ∂ξ 2 ∂ 2h 3h = 2h1 − 3h ∂ξ 2 2H 3 ∂h which on multiplying by and integrating leads to the solution ∂ξ r !2 3h1 h = h1 sech ξ 4H 3 The variable h1 represent ! the wave amplitude. we have ξ = x − ct. Chapter 18 . else print("Solution passes pdetest()").x.x)=0.t. .x)).t)-g*H*diff(h. ># Test of solution to original Boussinesq equation restart. and h1 = 3 1 H 3 ∂ 2h h+ is an unknown constant to be determined. # = 0 if correct! if testSol<> 0 then print("Solution: does not pass pdetest() !").5). therefore. with(PDEtools): >alias(h=h(x. and further analysis leads to the relation- c2 − gH ship h1 = . ># Use PDE test function to confirm solution is correct testSol:=pdetest(Sol. the g final solution becomes ! v ! 2 c2 − gH c2 − gH u u 3 h= sech t (x − ct) (18.6) is actually a solution to the original Boussinesq eq.pde1).6 demonstrates that eq. from the above discussion. end if. Also.

Assume a traveling wave solution of the form u(x.7) ∂t 2 ∂x2 ∂x2 ∂x4 We seek a closed-form single soliton solution to eq.8) 2 2 p 3 2 2 1 u (x. t) = 1 − c2 sech2 1 − c2 (x − ct) + x0 . . t) = f (ξ ).7). Therefore. t) = 0 (18.372 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Analytical Solution Using the Direct Integration Method The Boussinesq equation in its canonical form is written as ∂2 ∂2 ∂2 2 ∂4 u (x. on back substi- tuting f (ξ ) = u (x. However. and k represents wavenumber. t) + u (x. t) and ξ = k (x − ct). c < 1 (18.7) using direct integration as fol- lows. (18. t) + u (x. Then on substituting f (ξ ) into eq. we obtain the required traveling wave solutions p 3 1 u (x. t) = 1 − c sec c − 1 (x − ct) + x0 . (18. the code is not listed here but is included with the downloads for the book. c > 1 2 (18. t) − u (x.8) and (18.9) 2 2 where x0 is an arbitrary constant. (18. c represents wave speed. where ξ = k (x − ct). the PDE is transformed into the following ODE. d2 f (ξ ) 2 2 df (ξ ) d2 f (ξ ) 4 d f (ξ ) 4 2 2 2 k c −1 + 2k + 2k f (ξ ) + k =0 dξ 2 dξ dξ 2 dξ 4 Now we integrate again with respect to ξ to obtain 2 df (ξ ) 3k4 + 3k2 c2 − 1 f 2 (ξ ) + 2k2 f (ξ )3 = 0 dξ This leads to the following integral 3k Z Z dξ = df (ξ ) f (ξ ) 9 − 9c2 − 6f (ξ ) p which we integrate to obtain vu2 u f (ξ ) −2k t 3 u ξ=√ arctan − 1 c2 − 1 1 − c2 ↓ 3 1 p 2 2 2 f (ξ ) = 1−c 1 + tan c − 1ξ 2 2k Recall that tan2 (X ) = − tanh2 (iX ) and sec2 (X ) = sech2 (iX ).9) can easily be performed in Maple. The derivation of eqs.

thickness=3. Chapter 18 ..grid=[100. titlefont=[TIMES. >read("riccatiMethod.VERTICAL].t.x=-10.x. orientation=[-107.100].HORIZONTAL. labels=["x".axes='framed'. riccatiMethod(M. style=patchnogrid. ># Set constants zz:=rhs(soln[3..axesfont=[TIMES. 18.x. labels=["x". titlefont=[TIMES."u(x.t)"].7: Maple code used to derive an analytical solution to the Boussinesq equation using the riccatiMethod() procedure.frames=50.30.20."t".4. ROMAN.7) and obtain a number of traveling wave solutions.7. Figure 18.txt"). ># Boussinesq Equation # Attempt at Riccati equation based solution method restart. 16]).x. LISTING 18. 16].c:=0."u"]. 16]. beta:= 1. with(PDEtools): with(PolynomialTools): with(plots): >alias(u=u(x. axes=framed.8) and (18.shading=Z. ROMAN. ROMAN.3 and 18. ># Animate solution animate(zz..axesfont=[TIMES.t)-diff(u. alpha:=1. # Set order of approximation infoLevOut:=0. ROMAN. ># Generate a 3D surface plot plot3d(zz.infoLevOut).x=-10. labelfont=[TIMES.3]).40]. Figure 18.x)=0. (18.4 is a 3D plot that demonstrates the movement of the solution through x and t.t)): ># Define pde pde1:=diff(u. Boussinesq Equation 373 Analytical Solution Using the Riccati-Based Method We now apply the Maple routine riccatiMethod() (see Listing 18. 16]).x)+beta*diff(uˆ2.intFlg. which then moves left to right when the animation (see Listing 18. 2D and 3D plots of this solution for c = 0.3 is the initial condition (at t = 0). >intFlg:=0: # integration of U(xi) needed! M:=2. t=0. 16].x)+alpha*diff(u. 18.4 is given in List- ing 18. t) = 1 − k2 + c2 + k2 1 − tanh2 (x − ct) 2 2 2 √ On letting the wavenumber k = 1 − c2 . t=0.pde1.30.x.9. 16]. title="Boussinesq Equation". ROMAN. labelfont=[TIMES.3 and 18.7) is activated. title="Boussinesq Equation".x.9) derived using direct integration.x0:=0..20. we obtain the same solutions as given by eqs. one of which is 1h i 3 k u (x. labeldirections=[HORIZONTAL. . A Maple code that performs the calculations for Figs.9 are given in Figs. numpoints=300. ROMAN. k:=sqrt(1-cˆ2).

Boussinesq. se propageant dans un canal rectangulaire. J. Paris. Simulat.2 0 −0. R. Math. 17. [2] J. C. Théorie générale des mouvements. C. The codes are not listed here but are included with the downloads for the book. en communiquant au liquide continu dans ce canal des vitesses sensiblement pareilles de la surface au fond. Ranasinghe.4 0.3: 2D plot of the solution to Boussinesq equation at t = 0. .4: 3D plot of the solution to Boussinesq equation. [3] J. Commun. 73 (1871) 256–260. Paris. Acad. Boussinesq. 72 (1871) 755–759.374 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS 0. 14 (2009) 3738–3742.2 0 20 15 10 t 5 30 20 10 0 0 −10 x FIGURE 18. [4] J.8 0. Théorie de l’intumescence liquide appelée “onde solitaire” ou “de translation”. (1872) 55–108. Théorie des ondes et des remous qui se propagent le long d’un canal rectangulaire hor- izontal. D. Pures Appl. Acad. Solitary waves of Boussinesq equation in a power law media. qui sont propagés dans un canal rectangulaire horizontal. Biswas. References [1] A.6 u (x.4 u 0.2 −10 0 10 20 30 x FIGURE 18.6 0. Boussinesq. t) 0. Traveling wave solutions can also be found using the tanhMethod and expMethod Maple procedures. R.8 0. Sci. Sci. Nonlinear Sci. A. Milovic. Numer. 0.

28 (10–12) (1994) 147–154. [6] A. Boca Raton. V. Polyanin. . Comput.M. Chapman & Hall/ CRC. [8] A. Schiesser. vande Wouwer. FL.E. Method of Lines Solution of the Korteweg-de Vries Equation. Belgium. 2002. Applic. Zaitsev. available on-line at arXiv:math/ 0602661v1 [math. On the origin of the Korteweg-de Vries equation. de Jager. Handbook of Nonlinear Partial Differential Equations.F. Math. 2004. [7] W. Chapter 18 . Boussinesq Equation 375 [5] E. private communication.HO] 28 Feb 2006. Polytechnique Mons.D.

(19.2) which satisfies the BCs U(ξ = −∞) = −1. The result was a PDE first order in t.6) . .3a.3b) The significance of BCs (19.3) is discussed subsequently.4) dξ 2 2 ∂x 2 c ∂t The PDE corresponding to eq. d2 U To extend this solution to a PDE. therefore.1) ! d2 U 1 ∂ 2u 1 ∂ 2u = + 2 2 (19.1) is. (19. Therefore. second-order. from eq.1016/B978-0-12-384652-5.5) is from eq. (19. d2 U + 2U − 2U 3 = 0 (19.4) ! 1 ∂ 2u 1 ∂ 2u + + 2u − 2u3 = 0 (19. All rights reserved. (19.1) dξ 2 An analytical solution of eq.2) u(x. (19. We start with the following ODE that can be considered a Lagrangian (traveling wave) form of a PDE in an Eulerian (fixed) coordinate system.00019-4 377 Copyright © 2012 Elsevier Inc. U(ξ = ∞) = 1 (19. t) = tanh(x − ct) (19. which we term the modified wave equa- tion. the second derivative is (from the addition of the final two dξ 2 equations in Table 19. linear wave equation).1) is [1] U(ξ ) = tanh(ξ ) (19. we first consider the second derivative with dξ 2 d2 U ξ = x − ct. The solution to eq. 19 Modified Wave Equation In Chapter 14. (19.5) 2 ∂x2 c2 ∂t 2 We term eq. we considered the conversion of an ODE to a PDE using the concept of a traveling wave equation.5) the modified wave equation (since it bears a resemblance to the classical. Traveling Wave Analysis of Partial Differential Equations DOI: 10. We now consider the same procedure that leads to a PDE second order in t.

eq. t ∂2u ∂ (∂u/∂x) ∂ dU/dξ (∂ξ/∂x) d dU/dξ (∂ξ/∂x) = = = (∂ξ/∂x) ∂x2 ∂x ∂x dξ d2 U d2 U (∂ξ/∂x)2 = = (1)2 dξ 2 dξ 2 ∂2u ∂ (∂u/∂t) ∂ dU/dξ (∂ξ/∂t) d dU/dξ (∂ξ/∂t) = = = (∂ξ/∂t) ∂t 2 ∂t ∂t dξ d2 U d2 U = 2 (∂ξ/∂t)2 = (−c)2 dξ dξ 2 Table 19.5) PDE.2) We now consider the MOL solution of eq. (19.6) ∂u (first) sech2 (x − ct)(1) ∂x 1 ∂2u (second) sech(x − ct)[ −sech(x − ct)tanh(x − ct)](1) 2 ∂x2 ∂u (first) sech2 (x − ct)(−c) ∂t 1 ∂2u 1 (second) sech(x − ct)[ −sech(x − ct)tanh(x − ct)](−c)2 2c2 ∂t 2 c2 +2u +2tanh(x − ct) −2u3 −2tanh3 (x − ct) = −2[1 − sech2 (x − ct)]tanh(x − ct) Sum of terms Sum of terms 0 0 To verify this solution.6) as the solution to eq. (19. The ODE routine. pde 1.m. we substitute eq.378 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 19. (19. is listed first. (19.5) with the analytical solution (19.6) into eq.u) % % Function pde_1 computes the t derivative vector for the modified % wave equation % global xl xu x n ncall % % Model parameters global c cs % % One vector to two vectors . (19. eq. (19. function ut=pde_1(t.6) used to evaluate the numerical solution.1: Derivatives for the Lagrangian variable ξ and Eulerian variables x.5) Solution. (19.5) (see Table 19.2: Verification of eq.

Chapter 19 . As in the preceding chapters (i. end ut=ut'.n. u1(n)=ua_1(x(n). u2t(i)=-cs*u1xx(i)-4*cs*(u1(i)-u1(i)ˆ3).m: .xu. end % % Two vectors to one vector for i=1:n ut(i) =u1t(i). nu=1.u1x.1: Function pde 1.xu u1(1)=ua_1(x(1). Modified Wave Equation 379 for i=1:n u1(i)=u(i). The function and some global variables are first defined. % % PDE for i=1:n u1t(i)=u2(i).5). LISTING 19.e. % % u1xx nl=1.u) % % Function pde_1 computes the t derivative vector for the modified % wave equation % global xl xu x n ncall % % Model parameters global c cs . end % % BCs at x = xl.t).t). (19.. u1x(1)=0. ut(i+n)=u2t(i). u1xx=dss044(xl.nu). 15–18) for PDEs second order in t.u2. % % One vector to two vectors for i=1:n u1(i)=u(i). u2(i)=u(i+n). We can note the following details about pde 1. u2(i)=u(i+n).nl.m for eq.u1. % % Increment calls to pde_1 ncall=ncall+1. end . function ut=pde_1(t. the solution vector u is placed in two arrays u1.

m.m.u2 are dependent variables first order in t. The number of calls to pde 1.8 which are effectively x = ±∞ for the solution of eq.nu). a transpose is required by these integrators (so that ut is a column vector).380 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS u1. note that array x is a global variable and is therefore available from inital 1.xu u1(1)=ua_1(x(1).t). u1x(1)=0 is not actually used in the calculations in dss044 but rather is programmed to meet the Matlab requirement that input arguments to functions must be given a value.u2t are placed in a single derivative vector ut to be returned from pde 1.u1. . u1(n)=ua_1(x(n).m is incremented for display at the end of the solution in the main program pde 1 main.m (note that ncall is a global variable). % % Two vectors to one vector for i=1:n ut(i) =u1t(i). % % Increment calls to pde_1 ncall=ncall+1. u2t(i)=-cs*u1xx(i)-4*cs*(u1(i)-u1(i)ˆ3).m (discussed subsequently) to −8. . Dirichlet BCs are specified with nl=nu=1.6). end .u1x.nl. % % BCs at x = xl. The values of xl=x(1).m and integrated by ode45 or ode15s in the main program pde 1 main.3b) are programmed and the second derivative ∂ 2u ∂x2 is computed with dss044 (with Dirichlet BCs designated by nl=1. % % PDE for i=1:n u1t(i)=u2(i). (19.n. % % u1xx nl=1.xu=x(n) are set in IC routine inital 1. . Since the boundary values at x = xl .nu=1). The two derivative vectors u1t. (19. end ut=ut'.3a) and (19. BCs (19. u1xx=dss044(xl. nu=1.5) is programmed as two first-order PDEs in t. eq. The function ua 1. ut(i+n)=u2t(i).xu.t). so a library ODE integrator such as ode45 or ode15s can be used to move the equations through t.m has the analytical solution. u1x(1)=0. x = xu are defined. Equation (19.5) (this will be demonstrated in the numerical and plotted solutions).

xu= 8.m is listed next. % % ICs from analytical solution . (19. n=101. end LISTING 19.6) with t = 0. dx=(xu-xl)/(n-1). We can note the following details about inital 1a. % % Spatial domain and initial condition xl=-8. xu= 8. The IC routine inital 1. (19.m: . Modified Wave Equation 381 In summary. % % ICs from analytical solution for i=1:n x(i)=xl+(i-1)*dx. The function and