53 views

Uploaded by Adriano Henrique

Traveling Wave Analysis

save

- CV
- Backlund Transformation
- 25_3_soln_sep_vars.pdf
- Computational Inverse Techniques in Nondestructive Evaluation__G. R. Liu_X. Han_ch01
- 11 3 Higher Derivatives
- Scaling of Differential Equations
- PDE Solutions
- Crowd Dynamics on a Moving Platform
- Partial Differential
- Abouhamze, Aghdam, Alijani - 2007 - Bending Analysis of Symmetrically Laminated Cylindrical Panels Using the Extended Kantorovich Method
- Tancet syllabus M.Tech
- BE _Hons_cs
- cdc02
- TANCET
- m 651 Course Notes
- MATH 2930 - Worksheet 2 Solutions
- 19 Noraini Jamaludin(1)
- Modified Variational Iteration Method of Solution the Fractional Partial Differential Equation Model
- Analysis and Simplification of a Mathematical Model
- cv.pdf
- EE Proposed 2nd Year Syllabus-15.12.11
- Materias FIEC
- Hypergeometric Function Lectures
- Meshing.pdf
- CopasiUserguide-20100803
- H3Laplace
- DifferentialEquations-ExercisesPublic
- introd_APC_SPC.pdf
- Pde Lecture 5
- syllbmtechcse18_260710.pdf
- Rela Fisica 2.docx
- Modelo Formatação de Trabalho Acadêmico
- Douglas M. Ruthven-Principles of Adsorption and Adsorption Processes-Wiley-Interscience (1984).pdf
- Interpretação - A Importância Da Comunicação Oral Na Engenharia
- adsorção
- Apostila
- Gne 147 - Projeto de Aterro Sanitario - Aula 09- Sistema de Tratamento Dos Percolados
- Heat Transfer in Packed Beds
- Lagoas+de+Estabilizaçao
- Jiang, Jianwen-Metal-Organic Frameworks_ Materials Modeling Towards Engineering Applications-Pan Stanford Pub (2015)
- Tipos de Isotermas
- Aula 3 - Reatores Não Ideais (1)
- Lang Muir
- 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
- FlowThroughPackedandFluidizedBeds.pdf
- Segunda Lista de Exercícios
- Lista 3 - Funções Aplicações
- Modelo Formatação de Trabalho Acadêmico
- Lista 2 - Classificação
- Lista 6 - Derivada
- ANEXO 4
- Lista de Cdi
- DBO-OXITOP AULA PRÁTICA
- Questionário - Relatório 1
- Shreve - Cap 16
- APS 01 - QM35E -
- Relatório 6
- relatorio de fisica 2 (dilatação linear)
- Lista 5 - Limites

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

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

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

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

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

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

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

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

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

u0=inital_1(t0). u(x. Chapter 2 . % % Initial condition t0=0. % % Independent variable for ODE integration tf=4.2) that produced the output in Figs. tout=[t0:2:tf]'. Linear Advection Equation 9 Linear advection equation 1 0. The Matlab routines for the numerical method of lines (MOL) integration of eqns. 2.0.1).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.1 and 2. (2. and the tabulated output in Table 2. t). pde 1 main. ncall=0. nout=3. starting with the main program. % .6 0.2: Numerical solution to eq. lambda=1.2 0 0 1 2 −5 t 3 0 5 x 4 10 FIGURE 2.2. (2.1 are considered next.4 0.8 u (x. as a function of x and t using four-point FD approximations in dss004. t ) 0.1) and (2.

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

750 0.000 0.000000 0.939459 0.250 0.000000 0.00 3.000000 0.000000 0.000520 0.250 0.046771 0.000000 0.500 0.000518 0.500 0.000000 0.018316 0.00 1.250 0.000000 2.00 9.000000 0.000026 0.00 1.000 0.367879 0.i) u anal(it.000000 −0.000000 0.000000 0.000002 2.209640 0.000000 0.1: Tabular numerical and analytical solutions t x u(it.000000 0.00 7.000000 0.000000 0.00 4.250 0.00 −4.000000 −0.001934 0.00 −0.00 −5.00 −0.000004 2.00 3.250 0.750 0.000000 0.046756 0.000000 0.00 −2.778736 0.000000 0.00 10.000 0.000000 0.00 7.367879 0.000000 0.00 4.750 0.00 0.00 4.000026 0.250 0.500 0.000 0.500 0. Chapter 2 .00 −5.250 0.000000 −0.778801 0.000000 0.000000 −0.939413 0.000014 2.000000 0.500 0.000000 0.000000 0.000000 0.00 −3.00 −3.00 −2.00 1. Linear Advection Equation 11 Table 2.000000 0.000000 2.000000 0.000005 0.209611 0.500 0.001930 0.00 0.000000 0.i) 0.000000 0.000000 2.000028 2.00 5.i) 2.000000 0.500 0.750 0.000000 0.001930 0.500 0.750 0.000000 0.000000 2.000000 2.000026 0.00 10.750 0.000 0.000005 0.000046 2.367881 0.000000 0.00 9.209611 0.778801 0.000000 0.000000 0.000520 −0.046771 −0.000000 0.00 4.i) err(it.i) u anal(it.00 2.000064 2.018316 0.000000 0.001930 0.000000 0.778801 −0.00 −2.000000 −0.000000 0.000005 −0.000000 2.00 7.000001 2.00 7.000000 0.00 5.250 0.000026 0.000000 0.000000 0.000005 0.018316 0.000 0.00 −1.00 6.000000 2.000000 0.000000 0.000000 2.000002 2.000 0.250 0.00 8.000000 0.367879 0.000 0.000000 2.000000 0.500 0.000 0.000000 0.000000 0.750 0.i) err(it.000000 0.250 0.000000 0.018316 0.000000 0.000000 t x u(it.000000 0.750 0.250 0.00 −4.500 0.000000 0.000000 2.000000 2.000000 −0.000 0.000000 0.000000 2.00 1.000000 0.000000 0.000520 0.00 −2.00 8.00 2.00 −1.000 0.046771 0.000000 0.939413 0.000000 (Continued ) .000000 0.250 0.939413 0.000000 0.00 6.209611 0.000000 0.000 0.

250 0.000058 4. Two model parameters.000001 0.00 −0.000002 4.00 1.000001 0. .000007 4.000000 0.750 0.00 5.000000 4.000000 4.500 0.00 9. this function basically uses the IC function of eq.4).2) is set numerically through a call to function inital 1(t0) (to be discussed subsequently).0. .006330 −0.4).750 0.000053 4.000022 4.006323 0.00 −2.000 0.000000 4.12 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 2. The IC of eq. c in eq.000000 0.250 0. (2.569783 0.000004 0.000001 −0.00 3.250 0.006330 0.00 7.1: (Continued) t x u(it.000000 0.00 7.000086 4.00 −4.000 0. (2. % global c lambda c=1.i) 4.569783 −0.000000 −0.000 0.750 0.000000 0.000002 4.000000 4.000000 0.000000 0.00 −2.006336 0.000000 −0. (2.000047 4.000000 4.105399 −0.000001 4.000001 0.000000 4.000000 0.000000 0.00 1.105447 0.000122 0.000000 0.500 0.000001 0.00 4.500 0.569725 0.i) u anal(it.000002 0.00 2.105399 0.000123 −0.000000 4.000000 −0. lambda=1.000 0.000000 0.250 0.00 0.000000 4.500 0.750 0.00 8.000004 4.00 −5.000000 0.00 10.500 0. % % Initial condition t0=0.000000 −0.105346 0.250 0.000006 4.000 0. (2.000000 0.000000 0.00 6.00 −3.000000 % % Linear advection equation % % Clear previous files clear all clc % % Parameters shared with other routines global xl xu x n ncall .000000 0.000126 0.250 0.000123 0.000 0.00 4.000002 4. are assigned numerical values.00 −1.i) err(it.999978 1.1) and λ in eq.569869 0.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Generally. defined in eq.8)). five-point centered FDs (in dss004). A step as defined in eq.8) occurs more frequently in applications than the pulse of eq. 2pu. 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. . Chapter 2 . 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.7: (Continued) where it would be impractical to plot the entire spatial domain. we just repeat three methods we considered previously.m or super. x>1 Equations (2.1) and (2. This type of solution is often termed a moving front. (2. that long simulation times (where c × t > xmax ) result in the solution propagating around the spatial domain. (2. (2. thus.8) 1. (2.3) indicates. We now consider a second IC function with a discontinuity. and an extensive literature is available for computing solutions to moving front problems. x<0 f (x) = (2. the Heaviside (unit) step function. Here. there- fore.8) again define a Riemann problem (because of the discontin- uous IC of eq. It should also be noted that for some applications the superbee limiter can result in unrealistic sharpening of the solution. and the superbee flux limiter.6). As eq.8) ( 0. (2. we have found superbee to be a good compromise between accuracy and computational efficiency. we observe that the computational effort can vary widely for different limi- ters without a major improvement in the accuracy of the numerical solution.m). It will be clear. the analytical solution is a unit step that propagates from left to right with velocity c > 0. Note: Periodic BCs can occur naturally in problems described in cylindrical coordinates.

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

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

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

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

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

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

Chapter 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. . 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.13: Limiter functions overlaid onto second-order TVD region.

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

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

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

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

1). u(n)=0. Chapter 3 . ut(n)=0. The function and some global parameters are first defined. function ut=pde_1(t.m). u(1)=exp(D*t). uxx.1: Function pde 1.9) specified (nl=1. Since Dirichlet BCs are used.ux.m for eq. uxx=dss044(xl. % % Increment calls to pde_1 ncall=ncall+1.nl.xu.8) and (3. ut=ut'. ux is not actually used in dss044 for Dirichlet . ut(n)=0. Note that ux(1)=0 is used only to satisfy the calling requirements of dss044 (in Matlab. LISTING 3. % % uxx nl=1.u.m: .1) is then programmed % % PDE for i=1:n ut(i)=D*uxx(i). ut=ut'. Linear Diffusion Equation 49 ut(1)=0. ux(1)=0. nu=1. (3. (3. is then computed using the function dss044 with Dirichlet BCs (3. We can note the following points about pde 1. The second derivative in eq. nu=1) at grid points 1 corresponding to x = 0 and n (= 51) corresponding to x = ∞ (subsequently set in function inital 1. BCs.1). Equation (3. % % Increment calls to pde_1 ncall=ncall+1. A transpose is included to meet the requirements of the ODE . all input arguments must have a value).u) % % Function pde_1 computes the t derivative vector for the linear % diffusion equation % global xl xu x n ncall % global D .n.nu). end ut(1)=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 ua 1 (listed next) is called (for t = 0) to define IC (3.7) is programmed in inital 1. Finally. xu=10.0). the counter for the number of calls to pde 1. % % IC from analytical solution for i=1:n x(i)=xl+(i-1)*dx. u0(i)=ua_1(x(i). The grid in x is then defined over the interval 0 ≤ x ≤ 10 for 51 points. xu=10. n=51. end As the grid in x is defined in the for loop.m for IC (3. % % IC from analytical solution for i=1:n x(i)=xl+(i-1)*dx.7). dx=(xu-xl)/(n-1).0.50 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS integrator ode15s.m: .0). u0(i)=ua_1(x(i). function u0=inital_1(t0) % % Function inital_1 sets the initial condition for the linear % advection equation % global xl xu x n . We can note the following points about inital 1.m listed next. 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. . end LISTING 3.0. The IC of eq.m is incremented. The function and some global parameters are first defined.7). % % Spatial domain and initial condition xl= 0. n=51. dx=(xu-xl)/(n-1). (3.2: Function inital 1.

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

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

3: Jacobian matrix map of the MOL ODEs for n = 51.1) becomes ∂u ∂ 2u = D 2 + u2 (3. if the problem included a second-order chemical reaction so that eq. In other words. Chapter 3 . However. because we have followed a numerical approach. the comparison of the numerical and analy- tical solutions becomes much more difficult because the analytical solution is not readily available. . Linear Diffusion Equation 53 Jacobian sparsity pattern – nonzeros 243 (9.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. extensions of the prob- lem are straightforward. although we generally discuss PDE problems in the subsequent chapters for which analytical solutions are available to evaluate the numerical solutions.11) ∂t ∂x the preceding coding of pde 1 in Listing 3. (3. For example.1 would be simply changed to ut(i)=D*uxx(i)+u(i)ˆ2. Although the change in the coding is trivial.

000912 0.000000 0.000 0.000123 0.135335 0.00 5.000 0. i) 4.000 0.000 20.367879 0.00 1.000295 0. .00 4.000123 4.00 0.000010 1. i) u anal (it.718282 -0.000 0.000000 1.000001 1.018316 -0. .000000 .002479 0.999971 1. output for t=2.367853 0.000 7.018316 -0.135335 -0.00 9.006738 0.00 6.000335 0.000 0.000000 1.000 0.718282 2.006738 0.000123 0. 3 removed . .00 4.54 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 3.000 2.000 0.00 5.000912 -0.000000 t x u (it.367878 0.000002 1.000000 1.389056 -0.000000 0.000000 0. i) u anal (it.000045 0.002479 0.000123 0. .000029 4. .017981 0.00 7.018316 0.085537 -0.000 0.018316 0.000 0. i) u anal (it.000 0.000 1.049787 0.000000 -0.049787 0.000 0.000000 0.00 4.718282 0.00 8.006738 0.006738 -0.000335 -0.135287 0.00 10. i) 0.000911 4.002477 0.000000 -0.135335 0.000000 1.002479 -0.000334 4.367879 0.000 0.00 6.000000 0.000 0.00 7.000 0.000335 0.000040 1. .000000 ncall=150 .002479 0.049787 -0.00 2.000001 1.005827 0.000 0.018315 0. .000000 0.00 6. t x u (it.00 9.000901 0.1: Tabular numerical and analytical solutions t x u (it.000 0.000 0.000048 4.000 0. .388982 7.000 0.000000 4.00 2.00 0.000000 0.000000 0.718233 2.00 7.006738 -0.000000 1.598150 54.000912 0.00 2.000 0. i) err (it.000 0.135335 -0.000000 0.000 0.000048 4.00 10.00 8.000 0. i) 1.000000 1.000 1.00 10.000026 4.00 8. .000123 0.000074 4. .00 1.00 3.00 3.00 5.085485 20. i) err (it.049664 0.000045 0.000000 1.000000 0.000 2. i) err (it.002479 0.000 0.000 0.049787 -0.135335 0.00 0.00 3.000000 0.367879 -0.367879 -0.598150 0.000052 4.000 54.00 1.049787 0.000 0.00 9.

Cambridge University Press. . UK. 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. G. Griffiths. Chapter 3 . 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.W. A Compendium of Partial Differential Equation Models. Schiesser. Reference [1] W. In fact. 2009.E.

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

(4. (4. t) = exp − k(x − x 0 − ct) (4. . (4.1) Terms from eq. (4.7) Dk2 u(x → ∞. and BCs.9). (4. t) = 0 (4. (4.7) and (4.6) Dk2 so C− = 1. follow directly from eq. (4. (4. dξ we take r rc u(x. we have: Terms in PDE eq. ξ → ∞ and C+ = 0. (4. eqns. t = 0) = exp − k(x − x 0 ) (4. dU If we impose the conditions U(ξ ) = = 0. t) = exp − k(−x0 − 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.1).5) is Dk2 r r rc rc U(ξ ) = C+ exp ξ + C − exp − ξ Dk2 Dk2 where C+ and C− are constants to be determined.1) is therefore r rc u(x. eq.6).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. and the BCs are r rc u(x = 0. For the IC for eq.5) gives Dk2 B2 − rc = 0 r rc Thus.8) The solution to eq. B = ± so that the solution to eq.9) Dk2 To verify this solution.58 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Substitution in eq.8).

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

xu. nu=1. ux is not actually used in dss044 for Dirichlet . ux(1)=0.n. (4.nl. ut(n)=0.nu=1) again at grid points 1 corresponding to x = 0 and n (= 51) corresponding to x = ∞. ux=dss004(xl.nu). is computed using the function dss044 with Dirichlet BCs (4.u. uxx. xu=10.60 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS u(1)=exp(-sr*k*(-x0-c*t)). The IC of eq. .u).8) specified (nl=1. 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 second derivative in eq.1) is then programmed: % % PDE for i=1:n ut(i)=-c*ux(i)+D*uxx(i)-rc*u(i).m. 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. Equation (4. end ut(1)=0. (4. % % Increment calls to pde_1 ncall=ncall+1.7) and (4. A transpose is included to meet the requirements of the ODE integrator ode15s. % % uxx nl=1.m is incremented. (subsequently set in function to inital 1. Since Dirichlet BCs are used. ut=ut'.ux. Finally. Note that ux(1)=0 is used only to satisfy the calling requirements of dss044 (in Matlab.m). all input arguments must have a value). u(n)=0. n=51.6) is programmed in inital 1. BCs. uxx=dss044(xl.1). . the counter for the number of calls to pde 1.n.

In other words. n=51. since with k = 1.m: . end LISTING 4. % % IC from analytical solution for i=1:n x(i)=xl+(i-1)*dx.9). we have essentially implemented BC (4. function uanal=ua_1(x. (4.2: Function inital 1.0). The function and some global parameters are first defined. eq. u0(i)=ua_1(x(i). dx=(xu-xl)/(n-1). function ua 1 (listed next) is called (for t = 0) .6). The grid in x is then defined over the interval 0 ≤ x ≤ 10 for 51 points. to define IC (4. % % IC from analytical solution for i=1:n x(i)=xl+(i-1)*dx.0). We can note the following points about inital 1. (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). xu=10. Chapter 4 .m for IC (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 . % % Spatial domain and initial condition xl= 0. end As the grid in x is defined in the for loop. DK 2 u(x = 10.6). eq. Function ua 1. x0 = 0.m is a straightforward implementation of the analytical solution.9) . u0(i)=ua_1(x(i). A Linear Convection Diffusion Reaction Equation 61 dx=(xu-xl)/(n-1).0.0. This can be inferred from the analytical rc solution.t) % . x = 10 effectively defines a boundary r at x = ∞.

m for analytical solution eq.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)). Linear CDR equation 25 20 15 u (x. The problem parameters are set in the statements.3: Function ua 1. The main program.1) (lines) with the analytical solution superimposed (circles) using five-point FD approximations in dss004 and dss044 [1] for t = 0.1 and therefore is not listed here. 1. . which are now reviewed.m is the same as jpattern num 1.5.6). Also. c=1. (4. sr=(rc/(D*kˆ2))ˆ0. LISTING 4.m in Chapters 2 and 3 and is therefore not reproduced here. pde 1 main.1: Numerical solution to eq. k=1. the Jacobian matrix routine jpattern num 1. global D rc k x0 c sr D=1. (4. The main program produces the same three figures and tabulated output as in Chap- ters 2 and 3. 3 (bottom to top). 2. rc=1. t) 10 5 0 0 1 2 3 4 5 6 7 8 9 10 x FIGURE 4. is essentially the same as pde 1 main of Listing 2. x0=0.

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

3: Jacobian matrix map of the MOL ODEs for n = 51. 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.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. the preceding coding of pde 1 in Listing 4. the comparison of the numerical and analyti- cal 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 4. Although the change in the coding is trivial. .5). As we commented previously. In fact. the intent is to demonstrate numerical procedures that can readily be extended to cases for which analytical solutions are not available. although we generally discuss PDE problems in the subsequent chapters for which analytical solutions are available to evaluate the numerical solutions.

135335 −0.000 0.006738 −0.085537 20.000124 3.000014 3. 2 removed .00 6.018316 0.00 2.00 3.00 9.000123 0.000000 0.000000 0.E.000 0.00 3.00 10.000000 −0.000030 3. .000 0. A Linear Convection Diffusion Reaction Equation 65 Table 4.000 0.085537 0.718184 2.000000 0.006720 0. Chapter 4 . i) 3.000 0.000000 0. .000000 0.000000 1.018316 −0.006738 0.000000 0. i) u anal (it.000912 0.00 9.367879 −0. Schiesser.000098 3.000 0.000912 0. .000000 0.000045 0.000335 0.000 0.000 0.000 0.00 2.000 0.000000 0.00 8.000005 3.006738 0.00 5.000000 0. . t x u (it. i) err (it.367849 0.367879 0.00 7.718282 −0.018311 0. .000 0.1: Tabular numerical and analytical solutions t x u (it. A Compendium of Partial Differential Equation Models. .135335 0.000 2.00 0.999941 1. output for t=1.000 7.000 0.00 4.000000 0.002479 0. .00 1.002355 0. i) u anal (it.00 6.002479 0. 2009.00 10. UK.000000 .389056 −0.000 0.00 7. . .000007 3. G.000045 0.135321 0. Cambridge University Press.00 4.000098 3.018316 0.367879 0.049787 0.049787 0.002479 −0.000 1.000912 0.W.00 0.00 5.000912 0.000000 ncall=140 Reference [1] W.000 0.000 20.000 0.000000 0.000 0.000335 0.049781 0.049787 −0.000059 3.000 0. i) err (it.00 1.00 8. .i) 0. Griffiths.000018 3.388959 7.000123 0.000 0.000000 3.135335 0. .

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

u(n)=0. ux=dss004(xl. end % % Analytical Neumann BCs if(nbc==5) ux(1)=(pi/xu)*cos(pi*x(1)/xu)*exp(-a*(pi/xu)ˆ2*t).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. ux(n)=0.t).t).u). ux(n)=(pi/xu)*cos(pi*x(n)/xu)*exp(-a*(pi/xu)ˆ2*t).xu.n.u).u). end % % Third type BCs if(nbc==3) ux(1)=-(1/a)*(1-u(1)). end % % uxx uxx=dss004(xl. . end % % Nonlinear case if(ncase==2) % % ux ux=dss004(xl.xu.xu.xu.n.n. ux(n)=(1/a)*(1-u(n)).ux). end % % Nonlinear Neumann BCs if(nbc==4) ux(1)=-(1/a)*(1-u(1)ˆ4). end % % Neumann BCs if(nbc==2) ux(1)=0. % % Dirichlet BCs if(nbc==1) u(1)=0. ux(n)=(1/a)*(1-u(n)ˆ4).n. u(n)=ua_1(x(n). % % Dirichlet BCs if(nbc==1) u(1)=ua_1(x(1).

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

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

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

m serves both cases. u0(i)=ua_1(x(i).2) for ncase=2. end As the grid in x is defined in the for loop. inital 1. 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.3) with t = 0 for ncase=1 or the IC from eq.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 . (5.2. n=26. ua 1. function uanal=ua_1(x. (5. .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). % % Spatial domain and initial condition xl=0. The grid in x is then defined over the interval 0 ≤ x ≤ 1 for 26 points.2) and (5.m.0. (5. since ncase is a global variable that is passed to the routine for the analytical solutions.0).2) and (5.3). (5. eqns. for eqns. dx=(xu-xl)/(n-1).m for analytical solution (5.5*x+1). end % % Nonlinear case if(ncase==2) uanal=1/(c*t+(b/(2*a))ˆ0. end LISTING 5. ncase=1.3). xu=1.3: Function ua 1.m is a straightforward implementation of the analytical solutions. Function ua 1.2) and (5.3).

9. c=1.nonlinear ncase=1.Nonlinear third type. end % % Nonlinear case if(ncase==2) a=1.0e-06. reltol=1.Third type.abstol). % 5 . 4 .Neumann. Diffusion Equation with Nonlinear Source Terms 73 The main program.linear. options=odeset('RelTol'. 3 . 2 . but since it contains the coding for the 10 cases.reltol. tout=[t0:0. c=0. nout=4. b=1. ncall=0. % % ODE integration mf=2. % % Linear case if(ncase==1) a=0. 2 . Chapter 5 .0.'AbsTol'. is essentially the same as pde 1 main of previous chap- ters. pde 1 main. u0=inital_1(t0). % % Initial condition t0=0.0e-06. % % Independent variable for ODE integration tf=0.1. % % Explicit (nonstiff) integration . abstol=1. it is listed here along with some discussion.Dirichlet.Analytical Neumann nbc=1.3:tf]'. b=0. end % % Select BCs % % 1 . % % 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 .

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

Analytical Neumann nbc=1. end . Diffusion Equation with Nonlinear Source Terms 75 view(az.Nonlinear third type. Previous files are cleared and the problem parameters are declared as global and defined numerically.Dirichlet. . and the interval in t is defined as 0 ≤ t ≤ 0. b=0.9 with four outputs at t = 0. 4 .9. (5. The case is selected.m for eq. 2 . c in eq.6. zlabel('u(x. 3 .m: . which includes setting the values of a. The IC from inital 1.nonlinear ncase=1.1). Chapter 5 . % % Linear case if(ncase==1) a=0. c=1. % % Select BCs % % 1 .Third type.3. LISTING 5. b=1.t)'). % % Select case % % 1 . c=0.m is set. (5. we specify nbc=1 corresponding to the homogeneous Dirichlet BCs used in .1. Here. 0.Neumann.m of Listing 5.linear. 0. b. 0. title('Diffusion equation with nonlinear source terms').1). % 5 . pde 1. % % 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 . We can note the following points about pde 1 main.el) xlabel('x').1. ylabel('t').4: Main program pde 1 main. end % % Nonlinear case if(ncase==2) a=1. 2 . One of the five BCs is then selected.

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

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

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

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

080 0.368125 0.000000 .000000 0.90 0.000000 0.960 0.00 0.000000 0.90 0.040 0.000000 0.051559 0.125333 0. .000001 0.102303 0.102304 0.481754 0.000000 0. .198179 0.6 removed .000000 0.i) u anal(it.481754 0.051558 0.000 0.241799 0.00 0. . .000001 0.000000 0.000 0.198180 0.248690 0.125333 0.248690 0.151435 0.151436 0.nbc=1 t x u(it.i) 0.800 0. .125333 0. .120 0.368125 0.00 0.i) 0. . .920 0.80 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 5.000000 0. 0.160 0. 0.102303 0.00 0.000001 0. .040 0.90 0.102304 0. . .3.000000 0.368125 0.368125 0.840 0. .000001 0.151435 0.90 0.481754 0.1: Abbreviated tabular numerical and analytical solutions for ncase=1.125333 0.241797 0. .200 0.i) err(it.920 0. .000000 0.90 0. .000000 0.000000 0.000002 .120 0.00 1.241799 0.000 0.i) err(it.000000 0. t x u(it. .000000 ncall=95 . .000000 0.00 0.160 0.90 0.000000 0.840 0.198180 0.000002 0.051558 0.00 0.248690 0.000000 0.000 0.00 0.90 0.000000 0. .90 0. .248690 0. .241797 0.90 1.000000 0.00 0. .000000 0.90 0.i) u anal(it. % % Linear case if(ncase==1) .198179 0.000000 0.000000 0. .90 0.960 0.080 0. 0. Output for t=0.880 0.000000 .00 0.051559 0.481754 0.90 0.151436 0.880 0.

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

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

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

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

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

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

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

5 0.3.1) with ncase=1.2 0. The coding for the analytical Neumann BCs (nbc=5) follows directly from eq. (5. 5. nbc=5.n. Recall again that the numerical and plotted output from pde 1 main in Listing 5.ux).11 is the 3D plot of the numerical solution. (5. (5. (5. applies since Neumann BCs based on this solution were used (in eqns. ∂x ∂x which includes the numerical (lines) and analytical (circles) solutions.8) with ∂u(xl . The agreement between the numerical and analytical solutions is quite satisfactory.4 (Figs. a portion of the two solutions at t = 0.m for eq. Table 5.8 0. We now essentially repeat the preceding discussion for the five BC cases Diffusion equation with nonlinear source terms 1 0.9 is listed in Table 5.1 0 0 0.4 0. t) ∂u(xu . The computational effort reflected in ncall = 71 is modest. 0. 0.1 0. ncase=1). t) = ux(1) and = ux(n).2 0.9 for ncase=1.9 0.10: Numerical (lines) and analytical (circles) solutions to eq.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.3 0.6 0.8 0.nbc=5 (top to bottom). The plotted numerical solution is in Fig.9 1 x FIGURE 5. again eq.8: Programming from pde 1.7 0. . the latter.5.10.88 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS uxx=dss004(xl. The map of the ODE Jacobian matrix is basically the same as in Fig. (5.7) and (5.5 0.8)).1) using five-point FD approximations in dss004 t = 0. 0. This completes the discussion of the five BC cases for the linear PDE (b = c = 0.2. 5. 5.3).5).6.7 0.2) is produced by the code for nbc=1.xu.10.6 u (x. end LISTING 5.4 0.3 0. Figure 5. t ) 0.11. 5.

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

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

.3.440976 0.9 0.12. 0.nbc=1 t x u(it.440 0.430244 0. .000000 0.4 0. Chapter 5 .13.446546 0. t ) 0. .12: Numerical (lines) and analytical (circles) solutions to eq.90 0.6 0.6.i) . 0. .480 0.nbc=1 (top to bottom).600 0. 0.4 0 0.458118 0.440976 0.000000 0. Diffusion Equation with Nonlinear Source Terms 91 Table 5. Table 5. .90 0. . Recall again that the numerical and plotted output from pde 1 main in Listing 5.7 0.2 0.3) is produced by the code for ncase=2. (5.446546 0. .90 0.000000 .9 1 x FIGURE 5.435544 0.8 0.6 0.000000 0.000000 0. nbc=1.5 0. .560 0.452258 0.452258 0.90 0.520 0.13 is the 3D plot of the numerical solution.458118 0.1) using five-point FD approximations in dss004 t = 0.435544 0.4 (Figs.90 0.3 0. ncall=87 Diffusion equation with nonlinear source terms 1 0.400 0.3: Abbreviated tabular numerical and analytical solutions for ncase=2.000000 0. .i) err(it.9 for ncase=2. 5.7 u (x.1 0. 0.i) u anal(it.5. Figure 5. 5.90 0.8 0. . .5 0.430244 0.

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

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

6 0.1) using five-point FD approximations in dss004 t = 0.8 0. application of mass conservation as explained in Appendix 1 at the end of this chapter.9 0.94 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Diffusion equation with nonlinear source terms 1 0. nbc=2.4) is produced by the code for ncase=2.6.nbc=2 (top to bottom).8 0.m of Listing 5.7 0. % % Nonlinear case if(ncase==2) % % ux ux=dss004(xl.14: Numerical solution to eq.5) (ncase=2.1 is . % % Third type BCs if(nbc==3) .2 0.5 0. (5.636620 for the linear case.4 (Figs. Recall again that the numerical and plotted output from pde 1 main in Listing 5.4 0. Third-type BCs (ncase=2.1 0.3. . nbc=3). 0.15. 0.14.n. a=b=c=1) For the third-type BCs of eq. note that it is different than the value 2/π = 0. . Table 5.7 u (x. the relevant coding in pde 1.9 1 x FIGURE 5.15 is the 3D plot of the numerical solution. . . 0.5 0.3 0. t ) 0.xu.6 0. (5. Figure 5. 5.4 0 0.u).9 for ncase=2. Case 8: Nonlinear PDE. . nbc=3.4.3. 5.

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

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

nbc=3 t x u(it.17: 3D plot of the numerical solution to eq. 0.560 0.608456 0.606608 0. . t ) 0.5: Abbreviated tabular numerical and analytical solutions for ncase=2.6 0.2 1 0 FIGURE 5.8 0.90 0.4 t 0.8 u (x.90 0.i) . Chapter 5 .7 0.605685 0.2 1 0.520 0.4 0.605685 0.440 0.90 0.480 0.400 0.6 x 0.5 0 0.606608 0. ncall=183 Diffusion equation with nonlinear source terms 1 0.608456 .1). (5.90 0. .90 0.600 0.90 0. .9 0. . Diffusion Equation with Nonlinear Source Terms 97 Table 5.6 0. .8 0.

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

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

2 1 0.7 0.100 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Diffusion equation with nonlinear source terms 1 0.nbc=4 (top to bottom).3 0.8 0. t ) 0.9 for ncase=2.95 0.19: 3D plot of the numerical solution to eq.65 0.18: Numerical solution to eq. 0.5 0 0. .8 u (x.9 1 x FIGURE 5.6 0.4 t 0.8 u (x.6 0.1).9 0. Diffusion equation with nonlinear source terms 1 0.6 0.8 0.8 0.6.75 0. (5.4 0.9 0.7 0.6 0.3.55 0 0.2 1 0 FIGURE 5.1 0.4 0.7 0.2 0.85 0. 0. t ) 0.5 0. 0.1) using five-point FD approximations in dss004 t = 0.6 x 0. (5.

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

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

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

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

062791 0.100 0.00 0.187381 0. .187381 0.480 0. .125333 0. 1.998027 0.998027 0.540 0.636610 2.500 0.460 0. .i) 0.00 0. .636610 2.992115 .920 0. .00 0. t x u(it.70 0.000000 . .00 0.00 0. .636630 2.636611 2. 2. . 0.00 0.00 0.040 0. .000 0.636611 2. .040 0.125333 0. .248690 0.70 0.020 0.060 0.000 0. . .080 0.000 0.00 0.636612 .980 0.309017 .000000 0.480 0. .062791 0.520 0.000000 0.00 0.636610 2.70 0.00 0.70 0.900 0. .00 0.00 0.00 0.70 0. . .i) 2.020 0. output for t=0.00 0.70 0. 0.8 removed .060 0.00 1.309017 0.992115 0.00 0. .500 1.00 0.636630 2.080 0. . .940 0.636630 (Continued ) . .70 0. Diffusion Equation with Nonlinear Source Terms 105 Table 5.9.70 0.960 0. .70 0.7 t x u(it.8: Abbreviated tabular numerical and analytical solutions for 0≤t≤2. .Chapter 5 .100 0. .460 0.248690 0. .

αk αk2 .8: (Continued) t x u(it.920 0.13) ∂t ∂x If we assume a traveling wave solution of the form u (x. 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). and k = wavenumber.70 0.000 0. .636611 2.70 0. (5. 2.520 0. (5.70 1. the integral constraint can be applied at any t > 0 (it does not apply at just t → ∞).14) dx dx c −1 2 where g = and F(U) = U (δ + βU). With either method (analytical or numerical).70 0.540 0.636610 2. . c = velocity.70 0.70 0. u = u(x. t) = U (ξ ). where ξ = k (x − ct).70 0. .636610 2.900 0. constraint is commonplace.13) reduces to the traveling wave ODE d2 U dU 2 +g + F(U) = 0 (5.636630 .636611 2.106 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 5. In fact.980 0.1) below for convenience. its total mass or energy will remain the same and should therefore be independent (invariant) with respect to t.636610 ncall=226 analytical integration. the use of numerical integration in applying an integral .i) 2. a check that the integral does not change with t confirms the conservation principle for any t > 0. eq. .70 0.960 0.636630 2. In other words. as we will be using different constant names in our analysis ∂u ∂ 2u − α 2 + βu3 + δu2 = 0. We repeat the problem eq.636612 2.940 0. . Although the shape of the solution will change with t. t). t > 0 (5.

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

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

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

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

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

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

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). 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.2). function u0=inital_1(t0) % % Function inital_1 sets the initial condition for the Burgers- % Huxley equation % global xl xu x n .m is incremented. u0(i)=ua_1(x(i). Chapter 6 . u0(i)=ua_1(x(i). (6. (6. . n=51. (6. The function and some global parameters are first defined.0.2). dx=(xu-xl)/(n-1). the counter for the number of calls to pde 1. end As the grid in x is defined in the for loop.m. Finally.2: Function inital 1. We can note the following points about inital 1. Burgers–Huxley Equation 113 integrator ode15s. n=51.m for IC from eq. end LISTING 6.0. xu= 10. % % IC from analytical solution for i=1:n x(i)=xl+(i-1)*dx. % % Spatial domain and initial condition xl=-15. function ua 1 (listed next) is called (for t = 0) to define the IC from eq. dx=(xu-xl)/(n-1). The IC of eq. xu= 10.m: . % % IC from analytical solution for i=1:n x(i)=xl+(i-1)*dx.2) is programmed in inital 1.0).0).

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

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

x = −2. for t = 5.5)(0.5.3: Jacobian matrix map of the MOL ODEs for n = 51. The numerical solution of Table 6. For example.5 for t = 0 and t = 5. linear interpolation to determine x for u(x.3168 − (−1.3333 1t 5−0 which compares with the analytical value of c = −3/9 = −0.6503 Similarly.477017) = −3.456737)/(0.1 at t = 0.5 + 2.5) is 1x −3.3333 (as discussed previously). the estimated velocity (of the value u(x. t = 5) = 0.3168 Thus.539758 − 0.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. t) = 0. t = 0) = 0.5 − 0. 6. .477017)/(0.456737) = −1.0 + (−1.5 − 0. the value of x can be estimated by linear interpolation within the solution values of Table 6.0 + 3.6503) c= = = −0.518596 − 0.1. For u(x. we can determine the distance (in x) between the two solution values u(x.5 gives x = −3.0)(0. t) = 0.116 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Jacobian sparsity pattern – nonzeros 423 (16.5 + (−3.1 can be used to estimate the velocity of the travel- ing wave of Fig.

539705 0.000041 5.997595 0. .000 0.022868 0.417475 −0.1: Tabular numerical and analytical solutions t x u (it. . 5.00 0. . i) err (it.998763 0.011108 0.000 0.016387 −0.00 −14. .998275 0. .539758 −0.456737 0.707107 0.00 −13.500 0.000 0.500 0.998763 0.666818 0.000000 .000000 0.00 −13. 0.00 9.417432 0.009403 0.398584 0.999592 0.456737 0.000 0.998275 0. .00 −2.000000 0.000000 .000000 0. .000000 5.500 0.999708 0.013123 0.00 −14. .999207 0.011108 0. 5.013123 0. .000000 0.999593 0.00 −13. .00 10.006738 0.646088 0.707107 0.019358 0.006738 0.000 0.646088 0. .00 −14. Chapter 6 . .000 0. 15 removed .000 0.000000 0.603761 0.500 0.000 0.999206 0.500 0.500 0. . .011743 0.000000 0.000053 5.00 −0.500 0.476965 0.00 10. i) u anal (it. . Burgers–Huxley Equation 117 Table 6.000 0.999113 0. i) 5.000000 5. .00 −2.011743 0.00 −2.00 8.999708 0.000000 0.013872 0.013872 0. . .500 0. .666837 −0.00 8.500 0.00 −14. .00 8.00 −13.999791 0.00 −1.00 8. .500 0. .000000 0.00 −3.000 0.000000 0.000000 5.000000 5.000000 0.999364 0.007960 0. i) u anal (it.000 0.00 −4.000000 t x u (it. .000000 0.00 −3.000000 5. .00 −15.019358 0.00 9.00 −15.000043 5.022867 0.007960 0.500 0.000 0. ncall=129 . .518596 0.000000 . . .000000 5.997595 0.000053 5.000000 5.582446 0.999431 0.000000 0.000000 .000000 5.000000 0. .999431 0. . output for t=10.000 0. .00 9.582446 0.009403 0.00 −2.500 0.500 0. i) 0.000 0.398584 0.000 0.518596 0.000019 .477017 −0.00 −1.999113 0.00 9. 0.999791 0.000 0.999364 0.016387 0.000 0.603802 −0.000 0. i) err (it.

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

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

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

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

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

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

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

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

1 indicates good agreement between the analytical and numerical solutions.1) (lines) with the analytical solution superimposed (circles) using five-point FD approximations in dss004 for t = 0.2 0. 1.4 0. 3. .t) 0. (7.m in Chapters 2–6 and is therefore not reproduced here. 4 (left to right).2). Also. the solution does not appear to be exactly a traveling wave as specified by eq. LISTING 7.8 0. uanal=((1/2)*(1-(expp-expm)/(expp+expm)))ˆ0.7 0.2) in the sense that the successive curves should be displaced by a constant distance in t. 2.3: Function ua 1.5 0. The main program produces the same three figures and tabu- lated output as in Chapters 2–6.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 0 −10 −8 −6 −4 −2 0 2 4 6 8 10 x FIGURE 7. Also. (7.3 0.9 0.1: Numerical solution to eq. the Jacobian matrix routine jpattern num 1.m for analytical solution (7.1 and therefore is not listed here. is essentially the same as pde 1 main of Listing 2.5.6 u (x. expm=exp(-(1/3)*x+(10/9)*t). pde 1 main. However. The main program. Figure 7. this apparent discrepancy is due to the termination of the plot on the right at Burgers–Fisher equation 1 0.m is the same as jpattern num 1. which are now reviewed.

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

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

00 −2.918737 0.00 2.806677 0. .400 0.00 9.000000 0.999170 0.000000 1.000000 0.949857 0.000 0.000000 0.00 −8.000000 0.000000 0.897604 0.999931 0.00 1.000 0.600 0.200 0.060698 0. .000 0.722636 0.000000 1.000 0.986015 0.00 −8.999882 0.999170 0.989237 −0.986016 −0.800 0.000000 0.766788 −0.976507 0.00 −10.976508 −0.400 0.998156 0.999739 0.998156 0.000002 1.00 −10.000000 .00 −9. . i) 0.1: Tabular numerical and analytical solutions t x u (it.999739 0.035651 0.000001 1.000001 1.400 0.00 −9.200 0.000001 1.000000 0.000006 1.00 −2.600 0.999800 0. i) 1.00 8.000003 1.400 0.00 8. 1.00 0.960916 −0.00 −8.981857 0.00 −9.00 1.625038 0.722639 −0.00 −0.960916 0.00 4. . .625046 −0.800 0.000001 1.000000 0.00 −8.999931 0.800 0.999847 0.000004 1.069316 0.935976 0.522813 −0.00 0.000001 1.060698 0. i) u anal (it.046526 0.200 0.522808 0.000000 1.800 0.000000 1.200 0.000000 t x u (it.981858 −0.00 2.949857 0. .040728 0.998587 0.000001 1.573893 −0.806675 0.00 −8. . i) err (it.000007 1.872084 0.573886 0.000 0.200 0.00 8.000000 .053144 0.00 9.600 0.00 −1.000 0.766788 0.841820 0.991725 −0.200 0.00 0.800 0.999910 0.000004 1.969652 0.600 0.969653 −0.675035 −0. i) u anal (it.000 0.040728 0.000 0.999910 0. Burgers–Fisher Equation 129 Table 7.999364 0.800 0.000001 1.000000 0. .000000 1.800 0.600 0.035651 0.000002 1.400 0.00 −9.00 3.400 0.00 2.000000 1.800 0.999800 0.999364 0.000007 1.000004 (Continued ) .997595 0.998917 0. 0.00 −8.00 −0.000000 1.999882 0.999847 0.00 4.897600 0.998917 0.872080 0. i) err (it.00 −2.935977 0.069316 0. .841824 0.400 0.000000 0.989236 0.991724 0.00 4.000 0.053144 0. .00 −1.600 0. Chapter 7 .00 3.998587 0.000001 1.675029 0.00 10.400 0.997595 0.918740 0.000 0.046526 0.000004 1.

600 0.181651 0. . .800 0.206522 0. dividing by the common factor u1/s .00 7.425177 0.00 6. .338548 0.000001 1. .472931 −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.122886 0. .00 8. 3.000 0.380234 0.800 0.400 0.600 0.000006 1.000005 1. .472929 0. Eliminating the denominators by cross- multiplication.122887 0.380238 0. output for t = 2.000000 .600 0.200 0.206526 0. ncall=190 We start by introducing the following new variable v(x.159596 0. t).300345 0. i) err (it.000001 1.00 6.107737 0. " # 1 1 s −xp − xps + tp2 + tqs2 + tq + 2tqs u = + tanh 2 2 2 (1 + s)2 . .234455 0. . i) u anal (it.107737 0.425175 0.1: (Continued ) t x u (it. we have written u for u(x. .000004 1.00 8.000004 1.400 0.234460 0.000002 1.300350 0. 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.00 10.140092 0.00 6.000003 1.265679 0. 4 removed .200 0.000005 1. for brevity.181655 0.130 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 7.000 0. i) 1.200 0. t) = u(x.000002 1.00 5.000002 1.265673 0.000 0.00 7.00 5.338553 0.00 8.00 9.00 9.140091 0. which yields the following traveling wave solution.159594 0. .000005 1.

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

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

10 (2) (2009) 589–600. R. F. World Appl.and Riccati-based methods are included with the downloads for this book. . Molabahrami. Reference [1] A. Nonlinear Anal. 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. Chapter 7 . Khani.

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

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

Finally. 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. Fisher–Kolmogorov Equation 137 ut(i)=uxx(i)+u(i)*(1-u(i)ˆq).m for IC from eq.2). 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 . xu=10. The function and some global parameters are first defined. Since Dirichlet BCs are used. ut(n)=0. the counter for the number of calls to pde 1.0).2: Function inital 1.m. We can note the following points about inital 1. dx=(xu-xl)/(n-1). ut=ut'. % % IC from analytical solution for i=1:n x(i)=xl+(i-1)*dx. end LISTING 8. (8. 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). n=51. u0(i)=ua_1(x(i). (8. The IC from eq.0.m: . Chapter 8 .2) is programmed in inital 1.m is incremented. % % Increment calls to pde_1 ncall=ncall+1. A transpose is included to meet the requirements of the ODE integrator ode15s. end ut(1)=0.

% % Model parameters global a b c s q % q=1.1 and therefore we list only a few selected parts of it. u0(i)=ua_1(x(i). . n=51. . s=2/q. .138 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS . . a=2ˆ(1/2)-1. % % IC from analytical solution for i=1:n x(i)=xl+(i-1)*dx. .m for analytical solution (8.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. b=q/(2*(q+2))ˆ(1/2).3: Function ua 1. (8. is similar to pde 1 main of Listing 2. eq. xu=10. Function ua 1. The main program. function uanal=ua_1(x. function ua 1 (listed next) is called (for t = 0) to define the IC from eq. . c=(q+4)/(2*(q+2))ˆ(1/2).2). pde 1 main. end As the grid in x is defined in the for loop.2). dx=(xu-xl)/(n-1).m is a straightforward implementation of the analytical solution. (8. . LISTING 8. % % Spatial domain and initial condition xl=-5. uanal=1/(1+a*exp(b*z))ˆs.0. 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).2).0).

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

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

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

If we assume a traveling wave solution of the form u (x. where ξ = k (x − ct). (8. c = velocity.142 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Jacobian sparsity pattern – nonzeros 423 (16. (8. t) = U (ξ ). and k = wavenumber.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. k k We factor the polynomial function of eq.3: Jacobian matrix map of the MOL ODEs for n = 51. eq.7) reduces to the traveling wave ODE d2 U dU +γ + F(U) = 0 (8.8) (the third term) as F(U) 1 = f1 f2 = 2 1 − U q/2 1 + U q/2 U k .8) dx2 dx c 1 where γ = and F(U) = 2 U(1 − U q ).

000000 0.000000 .002445 0. Fisher–Kolmogorov Equation 143 Table 8.41.001531 0. .000000 0.200 0. .942839 −0.00 8.100 0. i) 1.949175 −0. .888652 0.888652 0.800 0. .927842 −0.000000 .558806 0.00 9.379608 0.00 −4. Chapter 8 . . a=0.516824 0.900 0.415572 0.1: Tabular numerical and analytical solutions q=1. .700 0.000000 1. i) err (it.00 9.552017 0.875527 0.600 0.000000 1.000000 . .00 0. i) u anal (it.000000 1.00 8.00 −4. i) 0. . . i) err (it.00 0.523780 0.000000 0. .451830 0.400 0.00 1.00 −4.003883 0.100 0.500 0.000000 0.700 0. c=2.800 0.014201 0.000000 1. . . 0.000 0.516824 −0.000000 .949175 0.444722 0.935754 −0.480950 0.00 −3.00 t x u (it.014202 0.586240 0.000003 1.379608 0.000000 0.800 0.00 9.000000 1.000 0.000002 (Continued ) .00 −5.00 1.021717 0.001531 0. i) u anal (it. .000002 1. 0.586240 −0.444723 −0. .00 1.451830 0.000 0. .488015 0. b=0.00 −0.415572 0.100 0.800 0. .00 −5.00 −4.002445 0. .000000 1.00.845091 0.000000 0.000000 t x u (it.619243 −0.00 2.100 0.942839 0.000 0. .000000 0.845091 0.41.00 10.021720 0.875527 0.954833 0.300 0.700 0.003883 0.488015 0.861038 0.00 9.003084 0.00 1.900512 0.00 −0.003084 0. 1.00 −4.000000 1.04 s=2.700 0.000000 0.400 0.00 −3.480950 −0.558806 0. .500 0.000000 0.500 0.935754 0.00 −4.001936 0. 1.400 0.001936 0.400 0.927842 0.017594 0.523780 0.000000 0.000000 1.861038 0.00 1.619243 0.000000 0.017591 0.000000 1.000000 0.954833 0.000000 0.100 0.00 0.200 0. .552018 −0.00 8.00 2.000 0.900512 0.

(A.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. 3. .00 9. adopting the grouping of Cornejo-Perez [2]. (A.000001 1. ..400 0. . . eq.000000 . i. α 6= 0 (8. From eqns. 5 removed . i) err (it. . becomes α h 1 i D± 1 + U q/2 D∓ 1 − U q/2 U = 0 (8.009170 0. f2 = 1 + U q/2 .e..144 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 8. it follows that d2 U α + α −1 dU ∓ + f1 f2 U = 0 (8. Thus.007338 0. (A. i) u anal (it.11) dξ 2 k dξ 2 D − f2 (U) D − f1 (U) U = 0. on setting U = 0.9).011427 0.000 0. . as γ is a con- 2 q+2 2(q+2) α+α −1 stant and independent of the value of U. i. output for t = 2. 4.00 9.e.41) and (8. the corresponding factorization eq.9) k αk where we have also introduced the constant α.10) is equal to a constant) gives α = ± q 2 and c = √ .011428 0. ncall=150 and choose α 1 f1 = 1 − U q/2 . i) 1. .007338 0.700 0. (8. Also.00 10. .12) αk k .40b). .39). . we find that γ = − k .000001 1. we obtain the following ODE df1 q α α U + f1 + f2 = − U q/2 + 1 − U q/2 dU 2 k k (8.1: (Continued) t x u (it. Therefore.009169 0.

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

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

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

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

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

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

0e-06.u]=ode45(@pde_1. Chapter 9 . for it=1:nout u(it.S) [t. errors in numerical solution iplot=0.abstol).u0.reltol.u0. D=1.u]=ode15s(@pde_1. % % Initial condition u0=inital_1(t0). options=odeset('RelTol'. % pause options=odeset(options. 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=[t0:2:tf]'. ncase=1. end if(ncase==2)a=1.0e-06. % % Moving front % ncase=2. D=0. end % % Store analytical solution. u(it.options). nout=31.n)=ua_1(x(n).t(it)). % % ODE integration mf=2.1. end % % Implicit (sparse stiff) integration if(mf==2) S=jpattern_num_1. if((it-1)*(it-11)*(it-21)*(it-31)==0) .'AbsTol'. end % % Independent variable for ODE integration t0=0. tf=60.tout. if(ncase==1)a=1.tout.1)=ua_1(x(1). % % Explicit (nonstiff) integration if(mf==1)[t.options). ncall=0.t(it)). reltol=1.'JPattern'. abstol=1.

6f%15. zlabel('u(x. solid . n = 101 from inital 1.u_anal.i).uplot(iplot.t(it)).i).m).i)=uplot(iplot. fprintf('\n t x u(it. o .uplot. axis tight shading interp colormap cool LISTING 9.20).'-'.i) u_anal(it.'o') xlabel('x') ylabel('u(x. err(iplot. end end end fprintf(' ncall = %4d\n\n'.2f%8.numerical. % % Moving front % ncase=2.t)').i)\n'). 60..6f\n'.4: Main program pde 1 main.i) err(it.ncall). tplot(iplot).t. for i=1:n tplot(iplot)=t(it). The model parameters are declared as global..i)).i). fprintf('%6. 40. uplot(iplot. title('Fitzhugh-Nagumo equation').i)=ua_1(x(i).analytical') figure(3) surf(x.i). .i)=u(it.u_anal(iplot. t = 0.u) xlabel('x'). We can note the following points about Listing 9. u_anal(iplot. two cases are programmed (for −60 ≤ x ≤ 20.x.err(iplot. Then. % % Plot numerical and analytical solutions figure(2) plot(x. view(47. % % 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.i)-u_anal(iplot.4: . ylabel('t'). 20.152 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS iplot=iplot+1.3f%15.6f%15..t)') title('Fitzhugh-Nagumo equation.x(i).

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

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

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

000000 0.055807 0.000000 0.000000 0.000002 0.989287 0.018710 0.8 0.944193 0.000000 0.00 −58.000057 .018710 0.000000 0.00 −2.845150 0.00 2.2 1.032480 0.000001 0.154850 0.0 0.4 0. .156 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 9.00 −1.6 0.00 −57.4 0.00 −56.6 1.000002 0.055807 0.8 0.243908 0.6 0.000000 1.094256 0.0 1.1: Portion of the numerical and analytical solutions for ncase=1 t x u(it.i) err(it.0 1.000000 0.2 0. 20.4 0.637767 0.0 0.00 4.000000 0.000000 20.00 1.000000 0. . .8 1.000000 0.000000 1.000000 1.000000 −0.000007 0.000001 0. .000000 1.000000 0.000000 0.000000 0.362233 0.243908 0. .i) u anal(it.00 −60.967520 0.000000 20.972730 0. .00 −3.00 5.000000 20. 0.00 −6.0 0.00 18.500000 0.000007 0.000004 0.6 0.00 −0.i) 20.i) err(it.00 −60.000000 0.4 0.0 0.000000 .637767 0.00 −4.00 −19.000000 1. .010713 0. .i) u anal(it.000000 0.000000 1.010713 0.000000 .00 17.00 −5.6 0.000000 0.000000 1.981290 0.000000 0.00 6.362233 0.972786 −0.i) 0. .2 1.756092 0.00 4.2 0.00 −20.00 20. .4 0.000000 0.000004 0.845150 0.000000 0.000000 0.00 −59.094256 0.000000 0.154850 0.00 16.8 0.000000 0.981290 0.00 −57.000000 1.944193 0.2 0.000000 0.00 −56.00 19.000000 0.500000 0.00 −4.905744 0.000000 0.967520 0.000000 0.00 3. .984345 0.984360 −0. .00 −58.000014 20.905744 0.000000 1.000000 0.756092 0.8 0.8 1.000000 1.00 0.000000 t x u(it. 0. .000001 0.000000 0.4 1.0 0.000000 0.000001 0.000000 20.000000 .6 1.00 0.6 0. .2 0. .000000 0.032480 0.989287 0.8 0.000000 0.000000 0.000000 0.000000 0.00 −59.4 1.

0 0.00 18.000000 −0.000000 1.012829 0.319111 0.000508 (Continued ) .952968 0.000317 20.8 0.6 0.8 0. Chapter 9 .6 1.000758 40.001917 40.000060 40.000000 40.001938 20.00 −33.000055 40.000000 40.001434 20.8 1.00 −17.000619 40.4 0. .111505 0.887128 0.2 0.00 −12.000000 20.920176 0.4 0.000025 20.131366 0.00 −56.000489 20.8 0.00 −14.046621 0.00 −8.0 0.i) 40.0 0.405320 0.i) u anal(it.00 −32.6 0.000000 1.000000 −0. .001038 40. .2 1.000564 20.1: (Continued ) 20.960662 0.00 −16.000000 0.818447 0.0 0.00 −24.00 −9.000000 0.000000 1.000000 −0.452776 0.719760 0.066230 0.0 1.000000 0.180804 0.717148 0.000000 0.000000 −0.789200 0.066618 0.000000 0.000158 20.4 1.6 0.000091 20. .00 −59. .547600 0.406753 0.920201 −0.6 0.00 −12.6 0.00 −58.000388 20.4 0.022369 0.00 −16.4 0.953058 −0.2 0.680686 0.000000 .986932 0.00 −30. .00 −57.000000 t x u(it.00 −32.960574 0.00 20.130327 0.593474 0.6 0.000000 1.00 −26.2 0.986987 0.038988 0.000220 40. Fitzhugh–Nagumo Equation 157 Table 9.000000 0. .00 −60.000000 20. .8 0.000000 0.2 0.210123 0.8 0.0 0.867859 0.6 0.000000 0.208766 0.590172 0.000000 20.816984 0.00 −24.00 −13.000000 20.000089 40.977219 0.977279 0.00 19.2 0.00 −29.078439 0.000000 0.279836 0.678748 0.038725 0.079197 0.00 17.00 −15.046114 0.279079 0.000756 20. . 20.00 −25.002611 40.4 0.001067 20.932825 0.00 −8.00 −11.449916 0.788133 0.8 0.4 0.001463 40.00 −31.867541 0.8 0.000000 40.00 −27.000000 1.0 0.887747 0.4 0.000087 .000000 40.00 −10.00 −28.00 −18.002142 20.317194 0.012916 0.002860 40.932605 0.545459 0.0 0.180241 0.i) err(it.000263 20.00 −28.000000 0.001357 40.003302 40.022527 0.000000 0.00 16. .00 −34. 40.111016 0.

0 0.00 −42.242814 0.00 −60.000297 60.499598 0.0 0.000000 0.4 0.00 −38.00 −40.000000 0.00 −57.0 0.004249 60.999993 0.032407 0.943201 0.8 0.6 0.00 16.018667 0.000000 −0.00 −48.966928 0. . .2 0.00 −36.000000 40.00 19.000825 60.000000 0.752632 0. .2 0.00 −58.i) err(it.904138 0.003261 60.00 −46.000000 40.00 −43.980944 0.i) u anal(it.6 0.000103 60. .001730 60.361191 0.00 −44.989190 0.4 0.000000 −0.637691 0.2 0.2 0.000166 .00 17.00 −44.4 0. .004266 60.00 −59.2 0.6 0.999979 0.989087 0.2 0.00 18.031898 0.4 0.00 −22.003086 60.8 0.000000 60.8 0.999996 0.i) 40.i) 60.000000 60.093908 0.026724 0.000000 0.000000 −0.8 0.000000 60.000000 0.6 0.001738 60. 40.00 18. . .002333 60.000000 0. .000000 t x u(it.000000 60.904979 0.844429 0.152422 0.000000 0.000402 60.00 −48.015355 0. .000509 60.000000 −0.027032 0. 60.000000 ncall=536 .4 0.0 0.00 −37.054831 0.00 −40. .8 0.000002 .000219 60.999993 0.055656 0.943602 0.i) err(it.4 0.000001 60. .999961 0.000000 40.8 0.000001 60.001234 60.000841 60.8 0.755718 0.00 20.000000 60.981087 0. .1: (Continued ) t x u(it.015532 0.00 −41.00 19.00 16.00 −39.154152 0.000000 60. .0 0.092674 0.0 0.000309 40.00 −45.6 0.018370 0.999978 0.000177 .357930 0.000000 0.240481 0.00 −23.000000 0.158 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 9.000000 −0.4 0.00 −56.00 −47. .495332 0.00 20.999996 0.999988 0. 60.000000 40.010683 0.2 0.842690 0.000000 −0.999963 0.00 −36.000000 0.000000 0.i) u anal(it.999988 0.633442 0.000000 0.6 0.00 17.967147 0.010517 0.000000 −0.000000 0.000143 60.0 0. .

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

more points in x might be required.4: . value of D). 9. .3: Jacobian matrix map of the MOL ODEs for n = 101 for ncase=1. AMR.160 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Jacobian sparsity pattern – nonzeros 873 (8. Although AMR methods are well developed [14]. the maximum error along the moving front is increasing with t. The solution is changing rapidly (is strongly vertical at the moving front) so that the . termed adaptive mesh refinement. 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. Thus. The sharp front is marginally resolved with n = 101 so that for D < 0.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. they are inherently more complicated than fixed grid methods (such as . which implies that the numerical solution might fail for t > 60.1 (steeper front). grid is dependent on the particular PDE problem conditions (in this case. 40. In other words. An alternative is to use an adaptive grid. the adequacy of a particular spatial . as reflected in the three successive plots for t = 20. 60. However. We can note the following points about Fig. in which the number of points is adjusted by the numerical algorithm to adequately resolve the solution.

Chapter 9 .4 0. (9.2 0 −0.4 0. 40.6 u (x.3 0. t) 0. 20.6 u (x.8 0.5 0.7 0.1) (lines) with the analytical solution superimposed (circles) using five-point FD approximations in dss004 for ncase=2.2 0.2 −60 −50 −40 −30 −20 −10 0 10 20 x FIGURE 9.5: 3D plot of the numerical solution to eq.2 1 0. (9. t) 0.4: Numerical solution to eq.1 0 −60 60 −40 50 40 −20 30 x 0 20 t 10 20 0 FIGURE 9. 60 1.1) for ncase=2.8 0. Fitzhugh–Nagumo Equation 161 Fitzhugh−Nagumo equation. . t = 0.9 0. Fitzhugh–Nagumo equation 1 0.

.972820 0.258127 0.4 0.8 0.004648 0.000000 −0.143213 0. .928172 0.000000 0.000000 0. .972820 0.8 0.000000 1.000000 0. .054962 0.00 −56. 20.00 −59.00 −58.6 0.000000 0.000000 1.0 1.0 0.000000 0.060646 0. .00 −5.2: Abbreviated tabular numerical and analytical solutions for ncase=2 t x u(it.00 −2.00 −59.00 −2.4 0.000000 0. 0.4 0.000000 0.000000 1.000000 0. . .000000 0.000000 1.00 17.000000 0. .000000 20. .000000 0.00 18.2 0.2 1.00 −4.000000 20.000000 0.0 1. . . 20.000000 0.000000 20.000000 0.00 18.000000 0.925668 0.004648 0.143213 0.077505 20. .000000 0.00 −4.00 0.6 −0.00 20.000000 20.000000 0.00 −57.009878 .00 0.8 1.000000 0.000000 .856787 0.500000 0.i) 20.856787 0.002290 20.000000 20.000000 0.009628 0.981269 0.000052 0.000000 .000000 0. .675491 0.00 −56.000000 0.6 1.722641 0.000000 0.i) u anal(it.0 0.995352 0. 0.8 0.000000 0.162 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 9.000000 0.00 −58.000000 0. .000000 0.00 −60.000000 0.000000 0.000000 20.00 16.i) err(it.000000 1.000000 t x u(it.8 0.i) u anal(it.000000 0.986755 −0.6 0.000000 20. . .000000 0. .6 0.027180 0.2 1.000000 1.00 2.6 1.8 1.005684 20.995352 0.000000 20.997761 0.005487 20.6 0.00 −57.000000 0.0 0.8 0.4 0.500000 0.000000 −0.00 19.00 19.019506 0.000000 1.4 0.4 1.00 20.027180 0. .000000 0.047150 20.002504 20. .000000 0.000000 . .4 0.000000 1.000000 1.00 −6.00 1.000000 0.0 0.2 1.00 −60.000000 0.000000 0.000000 .00 16.00 −3.00 −1.4 1.000000 0.2 0.000000 0.00 17.000000 0.i) 0.000000 0.00 −7.000000 1.335632 0.000000 0.i) err(it.2 −0.00 −0.000000 0.

000000 0.995499 0.00 −16.4 0.4 0.990736 0.000000 60. .812487 0.8 0.000000 0.988144 0.135746 60.00 −12.2 −0. .107988 0.00 −9.008924 .201277 0.900194 0.i) u anal(it.000000 1.000000 1.000000 0.2 −0.000000 0.006339 60.00 18.6 0.2: (Continued ) t x u(it.023463 40. .001413 60.4 0. .000000 0.00 −6.981805 0.00 −15.005843 40.00 20.2 0.00 −60.000000 0.000000 0. . .00 −10.0 0. .000000 0.910405 0. 40.2 1.8 0.000000 1.00 −11.i) 40.285822 0.00 −59.6 0.000000 60.000000 40.016706 40.000000 40.4 1.420042 0.968699 0.000000 40.000000 0.4 1.022625 60. .000000 0.000000 −0.00 20.000000 0. .000000 0.004377 0.000000 60.003371 0.962856 0.4 0.00 −58.000000 40.006992 0.565642 0.124694 0.063044 0.000000 t x u(it.000000 40.000000 0. .6 1.00 19.000000 ncall=727 .000000 1.000000 0.2 0.000000 1.i) 60. 60.015916 0.000000 0.000000 . . .6 −0.000000 .000000 1.000000 0. 40.00 −12.000000 40.00 17.000000 1.0 0.996912 −0.000000 1.00 −57. .000000 40.000000 0.000000 1.00 −14.145600 40.000000 0.0 0.000000 60.000000 60.0 0.00 19.000000 −0.000000 0. .010212 60.6 −0.000000 40.00 16.000000 0.000000 0. .00 17.2 0.0 1.00 −13.016479 40.00 −60.00 −56.8 0.2 1.000000 0.00 −56.i) err(it.00 −59.00 −8. .00 −7.019834 0.0 0.601214 0.001006 .00 16.i) err(it.00 −11.00 18.002857 40.000000 0.000000 0.084545 60.i) u anal(it.8 1.000000 0.000000 −0.00 −58.00 −8. 60. . .000000 60.00 −57.2 0.000000 60.8 1. .6 1.4 0. Fitzhugh–Nagumo Equation 163 Table 9.040419 0.993593 −0.736960 0.8 0.036314 0.835951 0.000000 0. Chapter 9 .0 1. .000000 −0.000000 1.000000 60.

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

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

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

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

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

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

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

"u"]. titlefont=[TIMES. ROMAN. shading=Z. in fact. 16]. labeldirections=[HORIZONTAL. 16]. 16].numpoints=100.axes='framed'. Also.labelfont=[TIMES.4) and (9.33].. ROMAN. Chapter 9 .t=0. 16]). labels=["x".grid=[100. Fitzhugh–Nagumo Equation 171 thickness=3.1. style=patchnogrid.33]. labelfont=[TIMES.HORIZONTAL.t=0. 16]. animate(zz.5) x 1 1 + exp √ + α − t 2d 2 which is the traveling wave solution we used in the above numerical simulation (eq. plot3d(zz.2)).10. title="Fitzhugh-Nagumo Equation".100]. we obtain. 16]). ROMAN. labels=["x". ROMAN. Animations and 3D plots are also produced for cases 1 and 2.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. title="Fitzhugh-Nagumo Equation". (9. 16]. ROMAN. titlefont=[TIMES.x=-20. thickness=3. On letting b−1 = 1.5) are. plot3d(zz.t)"]. LISTING 9. a:=1. style=patchnogrid. shading=Z. 16].axes='framed'. equivalent.10.labels=["x".frames=50. labelfont=[TIMES."u(x. ROMAN.. title="Fitzhugh-Nagumo Equation".. titlefont=[TIMES. axesfont=[TIMES.. 1 u= (9.axesfont=[TIMES. 16].axes=framed.VERTICAL].100]. ># Plot Case 2: # =========== D:=0. 16]). orientation=[-31. 16]. after simplification.VERTICAL]. which produces 33 traveling wave solutions.. ROMAN. . ROMAN. ROMAN.x=-20.HORIZONTAL. orientation=[-31.axesfont=[TIMES.10."t".axesfont=[TIMES. 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.. labeldirections=[HORIZONTAL. we note that the tanh and exp solutions of eqns."t".frames=50.labelfont=[TIMES.grid=[100. 16].60. Finally.numpoints=100.t=0. ROMAN. ROMAN. 16]).axesfont=[TIMES. axesfont=[TIMES.60. titlefont=[TIMES. (9.60. ROMAN. ROMAN."u(x. 16]. ROMAN.6: Maple code to find traveling wave solutions of the Fitzhugh–Nagumo equation using the exp method.x=-55. using the hyperbolic identity tanh(θ ) = 1 − 2/(1 + exp(2θ )).

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

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

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

The IC of eq. end ut(1)=0.2) (with t = 0) is programmed in inital 1. Equation (10.m: . % % IC from analytical solution for i=1:n x(i)=xl+(i-1)*dx. We can note the following points about inital 1. (10.m is incremented. u0(i)=ua_1(x(i). Kolmogorov–Petrovskii–Piskunov Equation 175 . (10. ut=ut'. A transpose is included to meet the requirements of the ODE integrator ode15s. The function and some global parameters are first defined. 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).2) with t = 0.0). % % Increment calls to pde_1 ncall=ncall+1.m for IC from eq. Since Dirichlet BCs are used.2: Function inital 1. end LISTING 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 .1) is then programmed. 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 . the counter for the number of calls to pde 1. Chapter 10 .m. Finally. ut(n)=0.0. % % PDE for i=2:n-1 ut(i)=D*uxx(i)+a*u(i)+b*u(i)ˆ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).

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

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

The numerical solution of Table 10. t) = 0.444285 − 0.5. the value of x can be estimated by linear interpolation within the solution values of Table 10.1 8 6 −10 4 t −5 0 2 x 5 0 10 FIGURE 10.7 0.1).80 + (−0. even with only 101 grid points.8 0.543844)/(0.2 0.2: 3D plot of the numerical solution to eq.3 0. For u(x. analytical and numerical solutions of approximately five figures is quite acceptable.60 + 0.6835 Similarly.20 + (1. t) = 0.4 0. x = −0.468560 − 0. (10.80)(0.2533 − (−0.6456 1t 3−0 .5 − 0. For example.9 0.520241)/(0.5 0.20)(0.40 − 1.6 u (x.543844) = −0.178 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS KPP equation 0. t = 0) = 0. 10.1 at t = 0.1 can be used to estimate the velocity of the travel- ing wave of Fig.2533 Thus.520241) = 1. we can determine the distance (in x) between the two solution values u(x. for t = 3. linear interpolation to determine x for u(x.5 gives x = 1.6835) c= = = 0. t) 0.1.5 for t = 0 and t = 3.5 − 0. t = 3) = 0. the estimated velocity (of the value u(x.5) is 1x 1.

µ = 0.4082.1) is straightforward.1) c = −(D0.3) and (10. as we use .2) (with xl = −10. Kolmogorov–Petrovskii–Piskunov Equation 179 Jacobian sparsity pattern—nonzeros 873 (8.10. variations in the PDE can easily be made for cases for which an analytical solution might not be available. the solution of eq.3: Jacobian matrix map of the MOL ODEs for n = 101.2) (with t = 0) and two Dirichlet BCs from eq. eq. (10. Conse- quently.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. In summary.m (Listing 10.4). which compares with the analytical value (with λ = −0.6455 (λ and µ were computed according to eqns. D = 0.4).8333. as programmed in Listing 10. Also. The equation is repeated below for convenience. yet the programming in pde 1.4082)(−0. xu = 10) is straightforward.5 /µ)λ = −(0. (10.5 /0. (10. Chapter 10 . (10.1) subject to the IC from eq. (10. Appendix We conclude this chapter by solving the KPP equation using the factorization method as outlined in the main Appendix.8333) = 0.1) is nonlinear.

999999 0.000000 0.00 −0.200 0.000000 0.000000 0.00 9.000000 3. .999992 0.000000 3.00 −0.00 9.368359 −0. ncall=260 . 3.000000 3.615151 0.600 0.000000 −0.543844 0.i) err(it.999999 0.800 0.600 0.999986 0.000000 3.00 −9. .800 0.00 1.00 −9.200 0.800 0.200 0.000000 0.00 10. .i) 0. output for t = 6. 9 removed .00 −9. .600 0.00 −0.999994 0.600 0. .999995 0. .999999 0.000000 0.400 0.999992 0.000007 3.000000 .00 9.00 −0.000000 0.000000 .00 −9.000000 0.000000 0.000000 0. .999986 0.000000 0.318314 0.600 0.00 −1.000 0.Table 10.520241 −0.000000 0.000000 −0.593090 0.999989 0.000000 0.000000 .368354 0.660371 0.00 −9.392258 0.000000 0.000000 0. 0. .468560 0.468560 0.00 1. .000000 0.999999 0.200 0.543844 0. .000000 3. 0. .800 0.000000 0. .000000 0. . .00 9.000000 3.000000 0.999995 0.000000 −0.000000 0.000 0.00 1. 3. .800 0.600 0. . .00 10.318314 0.000 1.000000 0. .999999 0. .000 0.000005 . .00 1.000 0.200 0.000000 3.00 9.000000 0.00 0.000000 0. .400 0.000000 .00 −9.000000 0.999999 0. .000000 0.615151 0.444285 −0.000000 0. .444278 0.000000 −0.999989 0.000000 3. .00 −10.1: Tabular numerical and analytical solutions t x u(it.00 −9.00 −9.800 0.i) 3. .000001 3.000000 0.000 0.999994 0.000000 1.00 9.i) u anal(it. .000003 3.000000 t x u(it.00 9. .i) u anal(it. . .660375 0.400 0.999999 0.520238 0.392258 0.000000 0.000000 0.00 9.999999 0.400 0.000000 0.00 −10.200 0.400 0.400 0.i) err(it.593089 0. .000004 3.

where ξ = k (x − ct). i. the corresponding factorization eq. Kolmogorov–Petrovskii–Piskunov Equation 181 slightly different notation than in eq. 2(m + 1) 2(m + 1) as√ γ is a constant and is independent of the value of U.40b).6) ∂t ∂x If we assume a traveling wave solution of the form u (x. on setting U = 0. Thus.e. f2 = 1+ − U . k it follows that √ d2 U a/δ α + α −1 dU ∓ + f1 f2 U = 0 (10.9) is equal to a constant) gives α = ± √ and c = − aδ √ .6) reduces to the traveling wave ODE d2 U dU +γ + F(U) = 0 (10. we find that γ = a/δ α + α −1 − .41) and (10. kδ k δ We factor the polynomial function of eq. and k = wavenumber.39). (A. t) = U (ξ ).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 .11) αk δ a k δ a . (10.e.10) dξ 2 k dξ 2 D − f2 (U) D − f1 (U) U = 0. From eqns. adopting the grouping of Cornejo-Perez [2]. c = velocity. Also. 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. (A. (A. (10.8).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.1). (10. eq. Chapter 10 .7) dx2 dx c 1 where γ = and F(U) = 2 aU + bU m .. eq. (10. i. ∂u ∂ 2u − δ 2 − au − bum = 0 (10. 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.. α 6= 0 (10. Therefore.8) δ a k δ a αk where we have also introduced the constant α.

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

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

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

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

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

ut=ut'. Since Dirichlet BCs are used. .xu. % % uxxxx uxxxx=dss004(xl. Chapter 11 . (11. . 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). so-called stagewise differentiation. xu= 20.uxx). The second. 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. and uxxxx.m (the IC is programmed in ua 1. Kuramoto–Sivashinsky Equation 187 % % BCs at x = 0. uxxx. end ut(1)=0. and fourth derivatives in eq. the counter for the number of calls to pde 1.n. (11. third.n. uxx.ux). A transpose is included to meet the requirements of the ODE integrator ode15s.1).1 ux(1)=uax_1(x(1). % % uxxx uxxx=dss004(xl. n=201. % % Increment calls to pde_1 ncall=ncall+1. % .t). dx=(xu-xl)/(n-1).uxxx).2) with t = 0 is programmed in inital 1.xu. Finally. ux(n)=uax_1(x(n). The IC from eq. are computed with successive calls to dss004. ut(n)=0.m is incremented.t).m with t = 0). % % PDE for i=2:n-1 ut(i)=-u(i)*ux(i)-alpha*uxx(i)-beta*uxxx(i)-gamma*uxxxx(i).n.1) is then programmed. % % uxx uxx=dss004(xl. Equation (11.xu.

(11. % % IC from analytical solution for i=1:n x(i)=xl+(i-1)*dx.188 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS % IC from analytical solution for i=1:n x(i)=xl+(i-1)*dx. end LISTING 11. eq. % % Spatial domain and initial condition xl=-10. The function and some global parameters are first defined.m is a straightforward implementation of the analytical solution. (11. u0(i)=ua_1(x(i).m for the IC from eq.0). Two more (Neumann) BCs .m for analytical solution (11. function uanal=ua_1(x. LISTING 11. eq.1) is fourth order in x and therefore requires four BCs.2) with t = 0. 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 .2).2) at x = −10. dx=(xu-xl)/(n-1).2) with t = 0.0). xu= 20.0. u0(i)=ua_1(x(i). end As the grid in x is defined in the for loop. n=201. (11. 20. We can note the following points about inital 1. (11.m: .3: Function ua 1. Two Dirichlet BCs are available by applying eq.5*k*x-(15/19)*kˆ2*t).2). uanal=(15/19)*k*(11*Hˆ3-9*H+2). function ua 1 (listed next) is called (for t = 0) to define the IC from eq. As noted previously.2: Function inital 1. (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. Function ua 1.0. The grid in x is then defined over the interval −10 ≤ x ≤ 20 for 201 points.

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

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

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

β = 0. which is usually pre- sented in a normalized form.3: Jacobian matrix map of the MOL ODEs for n = 201. Both Gregory Sivashinsky. 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. (11.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. 2 x .192 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Jacobian sparsity pattern – nonzeros 3313 (8. whilst studying diffusion-induced chaos [4]. whilst studying laminar flame fronts [7]. It has been used to study various reaction-diffusion problems and. and Yoshiki Kuramoto. it is used to model the thermal mechanism of flame propagation or com- bustion waves. The eq. Appendix The Kuramoto–Sivashinsky equation describes one of the simplest nonlinear systems that exhibit turbulence.1) with constants α = 1. discovered independently the equation now known as the Kuramoto–Sivashinsky equation. γ = 1 reduces to the form 1 2 ut = − u − uxx − uxxxx . in particular.

.078424 0.025224 0.00 18.000000 0.250 2.025224 0.000000 ncall=564 which can be simulated using periodic boundary conditions.250 0.000063 .000045 10. t x u(it.00 18. For example. 11.337154 0. .000000 0. 10.014276 0.00 −10.00 20. The results at later times are extremely sensitive to small changes in initial conditions.750 2.000 0. x ∈ [0.000178 10.000000 0.000003 0.000003 −0.00 20.000002 0.00 17.000000 .000000 0. .078424 0. .500 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.00 −10.00 −7. .014276 0.750 0.402775 0. .402728 0.200996 −0.500 2. 0.000015 −0.750 −0.137674 0.250 −0.8 removed . .805714 1. L].337154 2.000 0.00 −8. .000006 10.000000 0.i) err(it.402775 2.i) 10. .i) u anal(it.402791 2.500 −0. .00 17.000 −0.500 2.00 17.287410 −0. However.402785 2. Output for t = 2.00 −8. .4.00 −7.00 −9.805901 −0.000002 0.000 2.4.6.402791 0. .000000 10.000000 0.000131 10. .000000 0.000008 −0.000018 0.250 2. .402758 0.00 −7. .i) err(it.000048 0.402785 0.00 19.000 2.137674 0.402728 2.000050 10.750 2.053003 −0. to give rich exam- ples of chaotic behavior. .402758 2.00 19.287359 2. .1: Tabular numerical and analytical solutions t x u(it.i) u anal(it. .000000 0.00 −9.000023 10. . and the transition from a smooth solution to chaos makes modeling in the time domain very difficult for extended simulated time periods.044520 0.044520 0.00 −7.000005 −0. Chapter 11 .000036 0.052825 2.000 0.000187 10.000 1.00 17.200865 2. see Fig.000 2.000000 . .i) 0. Kuramoto–Sivashinsky Equation 193 Table 11. .

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

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

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

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

1: Function pde 1. i. we will specify only the dependent variable at the boundaries.m The first derivative. (12. % % BCs ut(1)=0. . pde 1.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.1). uxxx. The origin of u3x9p is discussed later. We can note the following points about pde 1. In fact.m in which no BCs are programmed. For the first case. (12.n.2).xu. % % uxxx uxxx=u3x9p(xl. we use Dirichlet BCs from eq. u(n)=ua_1(x(n). 30 and n = 101 as subsequently defined in inital 1.e. ut(n)=0. we will consider a small variation in pde 1.u). is then computed by dss004. % % Increment calls to pde_1 ncall=ncall+1.1). 9p = nine points used in the FD approximation for uxxx. The function and some global parameters are first defined. However. ux. % % ux ux=dss004(xl. LISTING 12.198 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS ut=ut'. is computed by routine u3x9p. Dirichlet BCs. The notation signifies 3x = third derivative. where ua 1.xu.1) is fifth-order in x.m and passed as global variables to . (12.1). function ut=pde_1(t. since the solution and its derivatives are essentially zero at the boundaries in x.u). The third derivative in eq.t). (12. % % BCs u(1)=ua_1(x(1). This second case will be discussed later.t)..m for eq. Since eq. x(1) and x(n) correspond to x = −30.n.m: . it generally requires five BCs. and we will find that the numerical solution is still accurate. .m is the code for 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).2: Function inital 1. end LISTING 12. A transpose is included to meet the requirements of the ODE integrator ode15s. % % BCs ut(1)=0.m for IC from eq. n=101. Equation (12.2) with t = 0 is programmed in inital 1. the fifth derivative in eq.1) is then programmed. 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. end ut=ut'. u0(i)=ua_1(x(i). is computed by routine u5x11p. The notation signifies 5x = fifth derivative. % % PDE % For loop for i=1:n ut(i)=-u(i)*ux(i)-a*uxxx(i)+b*uxxxxx(i). % % Spatial grid for i=1:n x(i)=xl+(i-1)*dx. ut(n)=0. dx=(xu-xl)/(n-1). (12. Since Dirichlet BCs are used. (12. for uxxxxx. the counter for the number of calls to pde 1. Similarly.m.1). 11p = 11 points used in the FD approximation .0).0. % % Increment calls to pde_1 ncall=ncall+1. The IC from eq. Kawahara Equation 199 . (12. Finally. The origin of u5x11p is discussed later. uxxxxx. xu= 30.2) with t = 0.m is incremented. . Chapter 12 .

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

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

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

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

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

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

found in % c(1:n+1.0. end c(j+1.nd.m follows without any further explanation.1:m+1) % c1 = 1.1) = c4*c(j+1. A listing of function weights.m for the FD approximation of derivatives.k))/c3. for j=0:i-1 c3 = x(i+1)-x(j+1). . for k=0:m for j=0:n c(j+1. c4 = x(i+1)-z.k+1)-k*c(j+1.0.k+1) = 0. end c1 = c2.n. function [c]=weights(z. c5 = c4. c4 = x(1)-z.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. c2 = c2*c3. end LISTING 12.1)/c2.0:m) weights at grid locations x(1:n+1) for % derivatives of order 0:m.m). if (j==i-1) for k=mn:-1:1 c(i+1.5: Function weights.k)-c5*c(i.k+1) = (c4*c(j+1.206 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS The Fornberg algorithm is the centerpiece of much of the reported FD PDE solutions.0. end end c(1.1) = 1.1) = -c1*c5*c(i. c2 = 1.0.x.k+1) = c1*(k*c(i. for i=1:n mn = min(i.1)/c3. The details of the algorithm can be found in the publications by Fornberg [3]. end for k=mn:-1:1 c(j+1.k+1))/c2. end c(i+1.

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

We can note.1 and the following selected numerical output from Table 12. end of this chapter. the maximum error is -0. The agreement between the analytical and numerical solution of approximately four figures is acceptable for most applications. at t = 3.1: Numerical solution to eq. 1. 3. 12.9 −30 −20 −10 0 10 20 30 x FIGURE 12.613723 2.621265 -0. which is approximately twice the error at the maximum of the solution (at x=6. 2.621197 2. (12.000069 3.589914 2.000132.6 2. the error is acceptable (as reflected in Fig.800 2.and 11-point approximations in u3x9p.2).590046 -0.1) (lines) with the analytical solution.600).5 2.000113 3.000132 For these three points.1).200 2.4 u (x.m and u5x11p. and it could be reduced by increasing the number .1) (where the solution changes most rapidly in x) is accurately preserved as demonstrated in Fig.3 2. eq.00 7.00 6. however. 3 2. the peak value of the solution of eq.1. approximation is exact for polynomials up to and including tenth order. However. superimposed (circles) using 9.m. For example. (12.1. t = 0. we have from Table 12.2 2.208 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Fifth-order Kawahara equation. generally. 12.7 2. These order conditions can be studied numerically using the programs listed in Appendix 1 at the . t) 2. (12. from Table 12.1 2 1.600 2.00 7.1 that the maximum error in the numerical solu- tion does not occur at the maximum point in the solution.613835 -0. In particular.

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

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. 11]. yet the programming in pde 1.1) is nonlinear. (12.4. variations in the PDE can easily be made for cases for which an analytical solution might not be available.1) subject to the IC from eq. which require additional refinement of the MOL algorithm and programming in the ODE derivative routine (pde 1.3: Jacobian matrix map of the MOL ODEs for n = 101.2. (12. (12. third derivative uxxx would be calculated at points i=1.n-1.n-3.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. than set to zero as in Listing 12. We should also point out that the development of an MOL code for a new PDE problem is not necessarily straightforward.m). In summary.4. 30) is straightforward. Also. unexpected boundary effects might be observed.3.2) (with t = 0) and without or with two Dirichlet BCs from eq.m is straightforward. (12. Even with the derivative calculated at all the grid points.210 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Jacobian sparsity pattern-nonzeros 946 (9. Consequently. .n-2. the solution of eq. eq.n rather . Specifically.2) (with x = −30.

000 2. .000001 2.i) 1.000001 2.00 −28.00 27.000001 2.612768 0.i) u anal(it.000000 1.000000 .i) 0.200 2.000003 2.2667 −0.621302 2.000000 0.i) err(it.2333 2.8333 −52.000001 0.000000 0.000 2.m) ============================= ans = −0.m) ============================= ans = −0.000000 t x u(it.000000 1.200 2. .4000 −11.00 30.00 27.587976 0.00 −27.00 −27.000002 0.000 b = 1.000003 0. .000000 0. . 0.612768 2.000000 .000000 0.00 −28. . (Continued ) .000001 2.000 2. .1: Abbreviated tabular numerical and analytical solutions for n = 101 Numerical Derivative Order: 3 (from u3x9p.00 −28.000000 0.8333 −0.00 −28.000000 0.00 −27.400 2. Kawahara Equation 211 Table 12.000001 2.000002 2.000001 0.000 2.000000 0.2667 11.600 2.000003 2.00 −29.2222 −21.00 0.612768 2. .200 2.600 2.000002 2.587976 2.000001 2.000 2.000000 0.000000 0. . .400 2.800 2.2222 0.00 28.000001 0.800 2.000001 −0.000000 1.i) err(it. .0000 −16.2667 16.0000 53.400 2. .000000 1.00 −0.000001 0.000000 0.000 2.00 28. .i) u anal(it.00 −30.2333 Numerical Derivative Order: 5 (from u5x11p.3611 4.00 0.2667 −2.000001 2.000001 2.600 2.7500 52.000000 0.00 −27. .000002 0.000000 0.200 2.000000 0.612768 0.0000 21.000001 2.00 1.000 2.000001 0.000001 0.00 −29.000000 0.000000 1. Chapter 12 .000003 0.200 2.000000 0.000001 2.600 2.600 2.000001 2.4000 0.000002 2.00 −1.00 29. .621302 0.000000 0.3611 a = 1.0000 −53.000000 2.800 2.00 −30. 0.000001 0.000000 .000000 0.000 t x u(it.587976 2.000002 2. .000000 0.587976 0.7500 −4.000002 0.000002 0.

597367 2.617241 2.00 −28.800 2.00 29.000005 −0.200 2.000002 −0.000 2.000108 .00 4. .000003 2.617241 0.800 2.00 1.574920 2.000029 2.000 2.000007 2.00 28.000026 −0. .00 −28.000008 2. 2.212 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 12.00 −30.000001 2. .00 −28.00 27.577252 −0.000067 .00 −30.000000 0. .000 2.00 1.00 3.620436 2.000001 2.000000 0.600 2.000001 2.i) u anal(it.000000 2.000021 2.00 27.000000 2.00 29.000006 3. .400 2.800 2.000 2.200 2.00 2.000004 2.000005 2. .000000 0.000001 3.605243 0.400 2.000001 2.200 2.000017 2.000099 2.617898 2.000001 2.00 4.620053 2.i) 3.200 2.000071 2.000000 1. .000001 2.000006 t x u(it. .000001 2.00 −29.00 6.577185 2. .00 −27.000000 0. 1.00 30.00 5.606705 −0.00 28. .000 2.606650 2.600 2.000033 1.00 27.400 2.000 2.000004 −0.00 27.000001 2.000 2.i) err(it.i) 2.000000 1.800 2.000031 1.600 2.000006 2.617970 −0.000000 1. .000038 2.000001 2.000 2.000072 2.000019 −0.00 30.000012 2.000000 0. .565150 2.000000 1.i) 1.i) err(it.000036 0.605264 2.000001 2.574849 0.00 −27.000001 2.000000 −0.00 28.000007 −0.599108 −0.000000 0.00 3. .00 −29.400 2.000000 0.600 2.000000 1.000 2.000001 t x u(it.000001 2.565257 −0.1: (Continued) t x u(it.000 2.800 2.000008 −0.800 2.000055 1.000010 −0.400 2. . 2.597334 0.000002 2.000000 .000001 2.000003 −0.000025 2.i) u anal(it.620467 −0.i) u anal(it.000001 2.400 2.000001 2.000011 2.000000 1.000003 2.620082 −0.00 3.00 3.200 2.00 28.000001 2.000000 0.i) err(it.000013 −0. .000011 0.599010 2.000003 .600 2.

600 2. there can be a series of such terms of varying complexity.400 2.00 4. Unfortunately. The question then is what caused the failed execution.590046 −0.000 2.621197 2.400 2.00 7. .00 6.000122 0.000010 3. .000003 3. in the case of eq.000003 2. .600 2. However.000 2.00 0.000069 .600 2. .200 2.00 6.000000 1.613835 −0.000000 2. .1).611622 2.200 2.621302 2.00 −27. this .000 2.00 29.000 2.00 −27.00 28.1: (Continued) 3.000028 2.800 2.1) (from Table 12.620082 −0.1) peak value peak value t x (numerical) (analytical) error 0. It is quite natural in developing a MOL code to include all of the PDE derivatives.200 2.000023 −0. Typically. Chapter 12 .00 28. (12. we suggest an incremental approach to code development.000061 3.000032 −0. and associated ICs and BCs.621265 −0. To progress past this unsatisfactory result.2: Peak values of the solution of eq.00 27.00 27. For example.621197 2.600 2.585907 2.000029 3.000000 3.000045 −0.621265 −0.000081 2.000002 3.000039 2.200 2.000124 2.000031 2. .000006 3.800 2.000000 0.000132 .000008 3.589914 2.611632 −0.000 2.000005 3. even after reviewing the code to correct any programming errors.000113 3.00 6.000063 −0.620467 −0.00 −28.621302 0. . we have just the nonlinear advection equation.000000 0.000000 0.00 5.613723 2.620436 2. This PDE has been .000007 3.620053 2.00 7.000055 2.00 2. .000088 −0.000001 2. .000004 2.000004 . initial execution of the code might not proceed as expected. we might start with a = b = 0 in which case. in most cases. .000069 3. (12.000023 ncall = 166 Table 12. 3.400 2. Kawahara Equation 213 Table 12.585846 0. 3.00 30. is not obvious.

000000 1. .000002 2.000000 0.000000 .000001 1.000008 0.000000 .00 2.000000 0.400 2.00 −30.000000 0.577252 −0.000000 .587976 2.00 −27.00 −28.i) err(it.000011 2.621302 2.00 29.000031 1.000001 2.597334 0. .000001 2.000000 0.00 30. 0. .000001 2.i) 0.600 2.400 2.000000 1.000001 2.000000 0.00 3. .000000 0.00 −30.000003 2.200 2. . .600 2.000002 0.214 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 12.000008 2.000002 2.800 2.000002 2.597367 2. .00 −28.400 2.612768 0.200 2.000000 1.000001 1. .000000 1.000001 2. .000000 0.000 2.000000 0. no BCs t x u(it.200 2.800 2.00 28.000002 0.200 2.000000 0.000033 1.000000 0.612768 2.000011 0.612768 2.587976 0.000000 0.000 2.000002 2.00 −1.612768 0.i) u anal(it.000000 t x u(it.600 2.00 −29.000001 0.00 1.00 1.800 2.000 2.000 2.00 −28.800 2.000003 0.000000 1.000001 2.600 2.200 2.000 2.3: Abbreviated tabular numerical and analytical solutions for n = 101.00 −29.621302 0.617241 2.000001 0.577185 2.587976 2. .617241 0.000005 −0.606650 2.000001 2.400 2.000000 0.000067 .000005 2.000000 0.000055 1.000001 0.000001 2.000000 .00 27.000001 −0. 0.000 2.000 2.i) 1.00 −0.600 2.000001 2.000002 0.i) err(it.000003 0.00 −27. . .00 28.000001 2.000000 0.000 2.00 1.587976 0.620436 2.i) u anal(it.00 27.000001 2.00 27.000000 0. .000001 2.620467 −0.000001 0.00 0.600 2.000000 1. .00 −28. .00 3. .606705 −0.000001 0. .000002 0.600 2. 1.00 −27.000001 0.200 2.00 −27.00 0.000000 0.00 28.000000 0.000 2. . .000001 0.000003 2.000000 0. . 1.200 2.00 27.

000004 2.i) 2.00 −28.000071 2.000107 .000061 3.000004 3.613835 −0.i) err(it.000007 3.000003 2. 2.00 28.00 29.000000 0.400 2.599108 −0.000 2.605243 0. . . .000000 2.000000 0.00 30.000021 2.00 5.000003 3.000001 2.00 27.00 28.400 2.00 30.000000 0. .000000 0. .000021 2. .00 6.600 2.611622 2.i) 3.00 7. (Continued ) .000001 2. .000039 2.000 2. .00 −28. .000001 2.000000 .800 2.00 6.000099 2.00 6.000000 0.000000 2. .574849 0.565150 2.000006 t x u(it.400 2.000 2.i) u anal(it.000029 2.000000 0.617970 −0. .000004 .00 −30. .000004 2. .589914 2.000000 2.000133 .600 2.00 4. Chapter 12 .565257 −0.585907 2.599010 2.000001 2.000000 0.i) u anal(it.000001 2.00 −28.000003 2.000003 2.000009 3.00 27.00 −28.620082 −0.000000 0.000029 2.400 2. . 2.600 2.200 2.00 29. .00 4.00 3.000007 2.590046 −0.000026 0.617898 2.000036 0.200 2.00 28. .000001 2.000007 −0.000001 2.000001 2. .000 2.00 −27.00 −29.200 2.000000 0.200 2.00 5.400 2.605264 2. 3.000001 3.000 2.000113 3.600 2.000019 0.000001 2.000000 0.000069 3. . Kawahara Equation 215 Table 12.585846 0.000003 2.000004 −0.000013 2.000001 2.600 2.00 −27.000000 1.621197 2.000 2.800 2.000003 −0.800 2.00 −27.800 2.000013 −0.000001 2.00 −29.613722 2.621265 −0.00 −30.000002 −0.000010 −0.000001 3.000009 2.000 2.000072 2. .000 2.3: (Continued) 1.000001 2.000000 1.620053 2.000 2.000003 2.574920 2.00 3.611632 −0.800 2.000001 t x u(it.00 7.000000 0.400 2.i) err(it. .800 2.200 2.000002 2.

200 2. but this is a start.611632 −0. the code might fail.800 2.m With two Dirichlet BCs in pde 1 (from Table 12.621197 2.000113 3.00 6.00 28.000034 2.600 2.000032 0.589914 2.i) err(it.00 5.000061 3.590046 −0.589914 2.600 2.590046 −0.600 2. At some point along this incremental development.000009 3.00 7. the solutions are not what we require (they are not for eq.611622 2. . (12. value.800 2.00 6. 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).000009 3.000 2.00 28.000023 ncall = 162 Table 12.613835 −0.613835 −0.000008 3.00 7.000088 0.000007 3.000133 thoroughly studied (as discussed in Chapter 2).621197 2. Of course.000070 2.m (from Table 12. Then.000113 3.000097 2.000023 −0. but at least.000 2.4: Comparison of the tabular output for n = 101.585907 2.00 27.000130 2.585907 2.000132 Without BCs in pde 1.00 30.3: (Continued) t x u(it.000069 3.216 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 12. then a might be increased (incrementally) to its final . If success in computing a numerical solution continues.621265 −0.00 27.400 2.611632 −0.3) 3.000010 3.000002 3.800 2. .i) 3.00 6. this will be a small departure from the case of the nonlinear advection equation.000063 0.400 2.200 2.000069 3.00 5.613723 2.1)).585846 0. then b might be changed to a “small” (nonzero) value and increased (assuming continuing success) to its desired .000045 0. and we know that solutions can be computed.i) u anal(it. (desired) value. with and without BCs in pde 1.000000 3. If this is successful.585846 0.000 2. a solution might be attempted with “small” (nonzero) a and b = 0.621265 −0.2) 3.611622 2.000122 0.00 29.00 7.000061 3.200 2.000045 2. In other words.000 2.00 7.400 2.000001 2.00 6.613722 2.

% % Number of grid points ng=9. this process is not necessarily straightforward with a priori assurance of success. Kawahara Equation 217 . For this purpose. The preceding discussion of an incremental approach is general but admittedly also rather vague. The chance of success of this approach is clearly going to depend on the problem. start with one PDE with a known solution (and use constant solutions for the other PDEs). % % Compute weighting coefficients for finite differences % over ip points for ip=1:ng % . we illustrate this process by differ- entiation of some polynomials. third-. 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). the following main program computes a third derivative of polynomials of various orders.m and u5x11p. 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. (12. In the case of eq. nd=ng.g.1)) by small parameter changes (slowly increasing a and b). then add a second PDE. Here. (12. clear all clc % % Default points.1). equally spaced grid for i=1:9 x(i)=i-1. This idea can also be applied to systems of PDEs. etc. Clearly. Chapter 12 . Appendix 1 In the preceding discussion.m to the differentiation of polynomials.. e. 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. end % % Compute FD approximation for up to and including the mth % derivative m=3. 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. we briefly considered the application of u3x9p. and fourth-order polynomials. starting with second-.

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

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

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

u8x.5f'.250 1.750 3.33331 0.3f%15. for ip=1:10 term=term+a(ip)*x(i)ˆ(ip-1).00000 0.000 8. for irow=1:ng u8x=0. fprintf('\n %4d%11.00000 7 0. for irow=1:ng u8x=0.00000 0.5f%14.3f%15.25113 0.00000 0. for icol=1:ng u8x=u8x+rdx8*C8(irow.125 1.9)*p8(icol). end fprintf('\n\n'). % % Ninth order polynomial a=ones(1.p8(irow).59955 0. for icol=1:ng u8x=u8x+rdx8*C8(irow.5f%16.. Chapter 12 .10).99219 0.00000 0.00000 0..00000 4 0.5f'.x(irow).u8xe).60458 0.icol.icol. end u8xe=8*7*6*5*4*3*2*1. end fprintf('\n\n'). irow. end u8xe=8*7*6*5*4*3*2*1+9*8*7*6*5*4*3*2*x(irow).00000 8 0.00000 . irow.00000 0.14286 0. end p9(i)=term. fprintf(' irow x(irow) p9(irow) u8x(irow) u8xe(irow)').00000 3 0.5f%16.00000 0.u8x. for i=1:ng x(i)=(i-1)*dx. fprintf(' irow x(irow) p3(irow) u8x(irow) u8xe(irow)')..625 2..00000 0.875 5. 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.000 1.00000 5 0.p9(irow).59937 0.9)*p9(icol).00000 0..00000 9 1.. end % % Differentiate ninth order polynomial fprintf('\n Eighth order derivative of ninth order polynomial\n').00000 2 0.500 1.x(irow).00000 0. Kawahara Equation 229 % Differentiate eighth order polynomial fprintf('\n Eighth order derivative of eighth order polynomial\n'). fprintf('\n %4d%11. term=0.00000 6 0.5f%14.u8xe).00000 0.375 1.

125 1.000 10.00000 403200. We.00000 40320.14286 221760.00000 176400.2)).00000 40320.750 3. tenth-order FD differentiation is tenth-order correct.77475 221760.00000 4 0.125 1.625 2.250 1.64241 221760. if we consider the function f (x) = ex (12.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.14286 40320.59977 40320.00000 6 0.00000 2 0. We could perform a similar analysis for the fifth-order FD differentiation in u5x11p.e. exact for polynomials up to and including tenth order.62786 40320. the 11-point. end the discussion with a brief consider- ation of the accuracy of FD differentiation when applied to nonpolynomial functions.000 1.00000 7 0.00000 4 0.00000 5 0.000 1.00000 This output implies the nine-point.69966 40320.875 5. PDEs in general do not have polynomials as solutions (consider eq. exact for polynomials up to and including eighth order.00000 40320. clear all clc % % Default points. fifth-order differentiation is tenth order correct.00000 40320.375 1.00000 8 0.00000 7 0.00000 Eighth order derivative of ninth order polynomial irow x(irow) p9(irow) u8x(irow) u8xe(irow) 1 0.00000 9 1.00000 40320.m and would come to the conclusion that the 11-point.00000 3 0.00000 5 0.00000 40320.00000 221760.00000 6 0.00000 40320.89540 221760. For example.000 9. equally spaced grid for i=1:9 x(i)=i-1.00000 40320.00000 131040. i.e.99609 40320.00000 8 0.00000 267120..750 3. and also.00000 85680.00000 9 1. FD third derivative of this function is programmed as follows.00000 40320.500 1.00000 221760.00000 40320.5) The nine-point.00000 40320.250 1. eighth-order FD differentiation is eighth-order correct. end % % Compute FD approximation for up to and including the mth .00000 312480.875 5. However. the discussion to this point has been entirely about the order (accuracy) of FD differentiation applied to polynomials. (12. Finally.33333 40320..375 1.625 2.00000 3 0.00000 221760.33333 221760.59991 221760.99805 221760.59474 40320.500 1.00000 357840.00000 2 0. therefore. i.

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

39888 9 1.00000 0.5f'. (12.64872 6 0.875 2.86825 1..11700 2.5f%14.86825 1. but if more figures were displayed.71827 2.86825 7 0.4)*expx(icol).28403 1.28403 1.99999 1.500 1. expx(i)=exp(x(i)). fprintf('\n %4d%11.45499 5 0.64872 1. differences between the numerical (FD) and exact derivatives would be .39888 2. even though the previous numerical output suggests otherwise.45499 1. The output from this code is Exponential irow x(irow) exp(irow) uxxx(irow) uxxxe(irow) 1 0.5f%16.6) Since the preceding discussion indicated that FD differentiation is exact only up to a given polynomial of finite order.. 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. irow.13315 1. These results could lead us to the conclusion that the FD differentiation is exact for exponential functions.000 2.11700 8 0. (12. This is a correct conclusion.13315 3 0. however.uxxxe).625 1.39888 2.13315 1.71828 .x(irow).250 1. This is not correct. end uxxxe=expx(irow). we could conclude that FD differentiation of the exponential function is not exact.5) has a small enough variation in x that the FD differentiation appears to be exact. end fprintf('\n\n'). Rather.icol. fprintf(' irow x(irow) exp(irow) uxxx(irow) uxxxe(irow)').28403 4 0.expx(irow).. The test function of eq.45499 1. end % % Differentiate exponential fprintf('\n Exponential\n'). for irow=1:ng uxxx=0.uxxx.00000 2 0.5) is programmed and differentiated as % % Exponential for i=1:ng x(i)=(i-1)*dx.3f%16.11700 2. the numerical output is explained by realizing the exponential function of eq.64872 1.375 1. for icol=1:ng uxxx=uxxx+rdx3*C3(irow.71828 2.000 1.232 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS .125 1.750 2.

we consider the exponential function f (x) = eax (12.46213 5315.43268 125.00000 2 0. In the case of the routine weights.35065 2844.75990 2843. 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. for i=1:ng x(i)=(i-1)*dx. The output from this code is Exponential irow x(irow) exp(irow) uxxx(irow) uxxxe(irow) 1 0.7) then select a to give the exponential function a greater variation in x.03952 233.625 22.43984 9931.875 79.icol.750 42. fprintf('\n %4d%11.98689 7 0.64489 Clearly.97994 9 1. expx(i)=exp(a*x(i)).13525 8 0.5f%14.62459 18551.41316 18273. This suggests that an . Chapter 12 .59196 815. the numerical and exact derivatives do not agree.000 148.uxxxe). For this purpose..125 1. for icol=1:ng uxxx=uxxx+rdx3*C3(irow.500 12.53074 3 0.x(irow). irow. To explore this possible explanation. for irow=1:ng uxxx=0. fprintf(' irow x(irow) exp(irow) uxxx(irow) uxxxe(irow)'). Kawahara Equation 233 observed (note the difference in the numerical and exact derivatives for .33615 9929.49034 438.86825 233.29287 4 0.52082 813.10239 5 0.expx(irow). we take a=5 in the following code (at the end of the u3x exp. Now the exact derivative.7) % % Exponential a=5. a Lagrange interpolation polynomial was used by Fornberg [3].17727 1522.18249 1524. This result provides an example indicating that FD differentiation is generally not exact.4)*expx(icol). uxxxe=a3 *expx(irow).000 1.5f'. x(irow)=1.00000 -25.81175 6 0. end uxxxe=aˆ3*expx(irow).5f%16. end fprintf('\n\n').m in Listing 12.250 3. also has a larger variation in x than for a=1.000).uxxx..375 6.36612 436.. end % % Differentiate exponential fprintf('\n Exponential\n').52108 5317.3f%16.

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

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

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

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

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

.8) The method of lines (MOL) solution is computed for d = 0. t = 0) = g(x) (13. xo = 0. All rights reserved.1) ∂t ∂x ∂x ∂t ∂x2 Equation (13.4) is ([5]. p1002). t) = 3dsech2 k(x − xo − νt) (13.6) f1 (t) = 3dsech2 k(xl − xo − νt) (13. The initial condition is taken as u(x. ε = µ = 1 ([5]. t) = f1 (t) (13.3) u(x = xu .1)–(13. we consider the following 1D regularized long-wave equation (RLW) ([5].7) f2 (t) = 3dsech2 k(xu − xo − νt) (13. (13. ∂u ∂u The MOL approximation of eq. k = . we have the IC and BCs 2 µν g(x) = 3dsech2 k(x − xo ) (13. It therefore requires one initial condition (IC) and two boundary conditions (BCs).00013-3 239 Copyright © 2012 Elsevier Inc. p1002) ua (x.4) An analytical solution to eqns.1.1) is first order in t and second order in x (through the mixed partial).5). p998): ! ∂u ∂u ∂u ∂ ∂2 + + εu −µ =0 (13.9) ∂x2 1x2 .1) in t (with = ut . From eq.1016/B978-0-12-384652-5. (13.5) s 1 εd where ν = 1 + εd. 13 Regularized Long-Wave Equation To illustrate the numerical integration of a PDE with a mixed partial derivative. = 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.2) and the two BCs as u(x = xl . (13. Traveling Wave Analysis of Partial Differential Equations DOI: 10. t) = f2 (t) (13.

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

. (13. (13. . . Chapter 13 . (13.a (x = xl . t) µ µ x=1x 1x2 ε 1 ux + uux µ µ x=21x . t) µ µ x=n1x 1x2 We can then solve eq. e. = .. .a (x = xu .. t) ut (21x. ut ((n − 2)1x.. Regularized Long-Wave Equation 241 1 ε 1 ux + uux − ut..g. t) 1 2 1 1 − − ut (31x. = .11) ε 1 ux + uux µ µ x=(n−1)1x ε 1 1 ux + uux − ut. . t) µ µ x=n1x 1x2 ε 1 The RHS terms of eq. dss004...11) for the vector of derivatives in t −1 2 1 1 − − 1x2 µ 1x2 ut (1x.a (x = xl .a (x = xu . t) 1 2 1 1 − − 1x2 1x µ 1x 2 2 ut ((n − 1)1x. t) 1 2 1 − 2− 1x2 1x µ 1 ε 1 ux + uux − ut. • . .. t) µ µ x=1x 1x2 ε 1 ux + uux µ µ x=21x . t) 1x2 1x 2 µ 1x 2 . . t) ut (n1x.12) ε 1 ux + uux µ µ x=(n−1)1x ε 1 1 ux + uux − ut.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. (13.

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

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

m for IC from eqns. n=199. mu=1.x(i)). eps=1. xo=0. xo=0. and the problem parameters are given numerical values. end LISTING 13. n=199. . xu= 50. nu=1+eps*d.5*(eps*d/(mu*nu))ˆ0. eps=1. The function and some global variables are defined.1. (13. % % Initial condition u0(i)=ua_1(0.6). % % IC over the spatial grid xl=-50. k=0. nu=1+eps*d.5. We can note the following points about inital 1. % % IC over the spatial grid xl=-50. 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.2: Function inital 1.5*(eps*d/(mu*nu))ˆ0.5.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. xu= 50. . mu=1. dx=(xu-xl)/(n+1).m: . for i=1:n % % Uniform grid x(i)=xl+i*dx. The parameters for the spatial grid are defined. k=0. dx=(xu-xl)/(n+1).2) and (13.

t) and u(x = xu . .5) and therefore ODEs at the end points are not actually required to compute the solution at the end points. however.6)) as we shall observe in the numerical and plotted output. xu=50 were selected so that they are effectively at infinity. (13. where u(x = xl . simp. Regularized Long-Wave Equation 245 We can note the following points about these parameters: – 199 grid points are used. 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. eq.m is a straightforward implementation of the analytical solution.5). (13.n. t) are set by the analytical solution of eq. The routine for calculating the integrals of eqns. is function uint=simp(xl. % % Initial condition u0(i)=ua_1(0.8) could be used at . Chapter 13 . The grid in x and the associated IC (from function ua 1.5). – The values xl=-50. LISTING 13. end Function ua 1.xu. (13. this condition is not required and BCs from eqns. (13. function uanal=ua_1(t.m for analytical solution (13. xu as in previous cases).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.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).13) by Simpson’s rule.12). for i=1:n % % Uniform grid x(i)=xl+i*dx. This variation from the usual procedure follows from eq. essentially finite values of x.3: Function ua 1.x(i)). and therefore the boundary values of the solution remain at their initial values (from eq. (13. (13.m at t = 0) are set in a for loop.7) and (13.

.n. end uint(3)=h/3.13).0*(u(i-1)ˆ3+3*u(i-1)ˆ2).4: Numerical quadrature routine simp applied to eqns. 1..0*uint(1).0*u(i).0*uint(3). The coding for c1 is function uint=simp(xl. uint(2)=u(1)ˆ2+mu*ux(1)ˆ2-(u(n)ˆ2+mu*ux(n)ˆ2).n.xu. +2. % % Conservation of mass if(int==1) uint(1)=u(1)-u(n).c3 of eqns. end % % Energy conservation if(int==3) uint(3)=u(1)ˆ3+3*u(1)ˆ2-(u(n)ˆ3+3*u(n)ˆ2).0*(u(i )ˆ2+mu*ux(i )ˆ2). for i=3:2:n uint(3)=uint(3)+4.246 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS % % Conservation of mass if(int==1) uint(1)=u(1)-u(n).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).u).xu.0*u(i-1)+2.. for i=3:2:n uint(1)=uint(1)+4. (13.0*(u(i )ˆ3+3*u(i )ˆ2). end uint(2)=h/3.0*uint(2).. . end % % Conservation of momentum if(int==2) ux=dss004(xl.c2. for i=3:2:n uint(2)=uint(2)+4. +2. end uint(1)=h/3.0*(u(i-1)ˆ2+mu*ux(i-1)ˆ2).13). (13. simp has three parts corresponding to the integrals c1. end % % Next integral end LISTING 13.

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

'AbsTol'.n-1)=1/dxˆ2.j)=1/dxˆ2. ncall=0.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. options=odeset('RelTol'.j)=0. end end end % % Next i end % % Independent variable for ODE integration tf=18.reltol. % % ODE integration reltol=1. % % Coefficient matrix % for i=1:n % % Row 1 if(i==1) for j=1:n if(j==1)cm(1.0. elseif(abs(i-j)==1)cm(i. tout=[t0:6:tf]'. end end else for j=1:n if(i==j)cm(i. else cm(1. elseif(j==n-1)cm(n. nout=4.1)=(-2/dxˆ2-1/mu). u0=inital_1(t0). abstol=1. % .0e-06. else cm(i. end end % % Row n elseif(i==n) for j=1:n if(j==n)cm(n.n)=(-2/dxˆ2-1/mu).2)=1/dxˆ2.j)=0.j)=(-2/dxˆ2-1/mu). elseif(j==2)cm(1.j)=0.abstol).0e-06. else cm(n.

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

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

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

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

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

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. the regularized long-wave equation (RLW) or Benjamin–Bona–Mahony equation (BBM) [1] was derived as a model to describe gravity water waves.5 50 1 FIGURE 13. (A. To this end. By experimenting with dif- ferent values for the order of approximations.15 0. which can reveal interesting behavior when examined by means of an animation. t) 0. (13. Therefore.05 4 3. It is an alternative model to the well-known Korteweg–de . in a mathematical and physical sense.1 0.8) in the main Appendix).2: 3D plot of the numerical solution to eq.254 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS RLW equation 0.3 0. requires that the Navier–Stokes equations be solved with free boundary condition(s).25 0.1). Higher values of M tend to produce more complex traveling wave solutions.5 200 3 2. This poses very diffi- cult problems from both a theoretical and a numerical standpoint. 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.5 150 t 2 100 x 1. Brief Background Information To describe water waves rigorously. M (see eqn. it becomes immediately apparent that there are many nontrivial traveling wave solutions to the RLWE.

000000 0.002472 0.000000 0.000000 0.000742 0.00 30.000000 0.000013 0.000000 0.500 0.030538 0.000 0.000008 0.000003 0.000027 0.000 0.00 I1 = 3.000017 0.000 0.000259 0.000000 0.000000 0.00 −19.000000 0.115672 0.000259 0.000013 0.000003 0.500 0.000122 0.000036 0.000006 0.00 45.046599 0.298302 0.00 48.000000 0.00 40.500 0.115672 0.00 −44.000000 0.061241 0.014777 0.00 15.500 0.000 0.000 0.000077 0.5790 Energy invariant (Continued ) .000000 0.030538 0.000 0.000 0.000000 0.000004 0.500 0.00 −29.000122 0.500 0.001575 0.00 28.000057 0.00 18.000000 0.00 −49.500 0.500 0.011002 0.000 0.000000 0.000000 0.000165 0.000549 0.000000 0.000000 0.000000 Invariants at t = 0.00 −22.298302 0.161271 0.246128 0.000000 0.00 0.8102 Momentum conservation I3 = 2.001166 0.000006 0.000 0.000000 0.000000 0.022900 0.00 13.000001 0.000 0.00 −2.000549 0.000001 0.t) t x num anal err 0.500 0.00 3.000000 0.000000 0.000 0.000004 0. Chapter 13 .000001 0.000008 0.500 0.000000 0.000000 0.000000 0.000000 0.00 5.000000 0.500 0.000 0.000 0.000002 0.000349 0.000 0.000002 0.500 0.000 0.00 25.000001 0.005228 0.00 −47.000 0.007047 0.00 33.00 −39.000077 0.00 35.000000 0.000001 0.00 23.00 −37.000036 0.000000 0.000000 0.001575 0.090587 0.005228 0.000742 0.00 −12.00 −42.014777 0.000000 0.00 −17.000057 0.00 −32.00 −4.003337 0.090587 0.00 43.000000 0.161271 0.00 −9.195401 0.1: Abbreviated tabular numerical and analytical solutions for n = 199 u(x.9799 Mass conservation I2 = 0.500 0.046599 0.000 0.002472 0.500 0.000000 0.000 0.000000 0.00 38.001166 0.00 20.000000 0.195401 0.500 0.022900 0.00 −34.061241 0.t) u(x.000000 0.500 0. Regularized Long-Wave Equation 255 Table 13.00 10.000000 0.000165 0.00 −24.500 0.00 8.000000 0.000349 0.00 −14.246128 0.000001 0.000000 0.00 −27.000000 0.00 −7.000 0.500 0.000017 0.000027 0.500 0.000 0.500 0.000000 0.274299 0.007047 0.011002 0.274299 0.003337 0.

000011 18.007479 0.000000 18.000002 18.000004 0.126790 0.006400 18.00 −12.081826 0.000203 18.00 −47.000000 18. .000106 18.000 0.1: (Continued) u(x.004287 .00 20.034332 0.294737 0.086113 −0.296684 −0.283111 0.007895 0.000000 18.032331 0.00 −27.00 −19.500 0.00 −39.500 0.t) u(x.121227 0.000 0.00 −14.006642 18.001673 0.000000 0.000000 −0.000393 0.000000 18.500 0.000 −0. .000963 18.000175 0.00 −34.000 0.016634 0.00 −32.000371 0.500 0.000836 0.000 −0.00 −24.500 0.256 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 13.000001 18.000041 0.000002 0. .00 −7.000019 0.000 0.000000 18.000 0.000000 18.00 −42.00 28.00 10.000 0.000009 0.000022 18.00 −2.500 0.004161 18.000 0.500 0.000 0.006381 18.00 −44.000000 0.00 −22.00 5.015671 0.000000 18.064613 0.002001 18.000004 0.000000 0.000 0.000000 −0. Solution for t = 6.00 −17.000005 18.00 25.500 0.000009 0.00 13.000000 0.000082 0.00 3.000000 0.00 0.000000 −0.000002 0.000 0.000018 0.500 −0.154717 −0.00 8.000 0.00 −4.t) t x num anal err 18.000000 0.278950 0.000000 18.000000 −0.500 0.500 0.000000 0.000000 0.000048 18.00 −9. 12 deleted .000000 0.239741 −0.00 −37.500 0.001779 0.500 0.000000 18.202362 0.000087 0.000000 0.00 23.209005 0.000039 0.005562 18.000000 −0.t) t x num anal err .068203 0.000 0.500 0.003543 0.000 0. .t) u(x.000000 0.001947 18.003590 18.000001 18.000001 0.000000 0. u(x.000000 18.00 18.00 15.000185 0.003746 0.000000 18.233341 0.500 0.000001 0.000000 0.000000 18.000 0.000788 0.00 −29.500 0.148335 0.000416 18.00 −49.

15) ∂t ∂x ∂x ∂t ∂x2 This is eq. β.00 33.000590 18.000 0.00 35. Chapter 13 . the parameters α.16b) ∂t ∂x ∂x ∂x ∂t ∂x2 The dimensionless pvariables η (x. (13. where h0 represents the undisturbed water depth and g repre- sents gravitational acceleration.9799 Mass conservation I2 = 0. The nondimensionless wave height above the equilibrium water level is represented by η. Regularized Long-Wave Equation 257 Table 13. For a physical system.009780 0.1) with = 1 and µ = 1. ! ∂u ∂u ∂u ∂ ∂ 2u + +u − =0 (13.000008 Invariants at t = 18.500 0.500 0. t).001035 0.002328 −0.000063 18. In the following dimensionless form.000 0.500 0.000488 0.00 38.00 43.00 45. the RLW equation represents a unidirectional propagation model.00 30. and δ represent dispersion constants and are subject to the following constraints: 1 2 1 1 α+β = θ − γ +δ = 1 − θ2 ≥ 0 and 2 3 2 .000281 18. and x are scaled by the length scale h0 .8102 Momentum conservation I3 = 2. the following system of coupled equations can be used [2].000517 −0.00 48. ! ∂η ∂u ∂ ∂ 3u ∂ ∂ 2η + + (uη) + α 3 − β =0 (13.500 0. and the time scale by h0 /g. 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.010369 −0.000251 0. in particular. However.001098 −0. t).001211 18.041696 0.000133 18. t).000 0.000243 0.000 0.00 40.00 I1 = 3.004925 −0.020397 0. γ .002195 0.044081 −0. the solitary wave phenomena [4].5790 Energy invariant ncall = 145 Vries equation (KdV) and describes some of the more exotic dynamic behavior of water waves and.021609 −0. when it is required to analyze bidirectional waves with wave interactions.004644 0.1: (Continued) 18.000030 18.16a) ∂t ∂x ∂x ∂x ∂t ∂x2 ! ∂u ∂η ∂u ∂ 3η ∂ ∂ 2u + +u +γ 3 −δ =0 (13. u (x.002385 18.

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

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

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

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

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

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

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ξ

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

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

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

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 . We can note the following details about pde 1. u1xx=dss044(xl.u1x.1 u1(1)=ua_1(x(1). % % PDE for i=2:n-1 u1t(i)=u2(i). u2t(i)=a*u1xx(i)+b*exp(beta*u1(i)).t). function ut=pde_1(t. u1t(n)=0. end ut=ut'. end % % BCs at x = 0. (15. end u1t(1)=0.nl. LISTING 15. u1x(1)=0.1: Function pde 1.nu).m for eq. u2t(n)=0. % % u1xx nl=1.n.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).t).1).m: .xu.u1. u2t(1)=0. The function and some global variables are first defined. % % Two vectors to one vector for i=1:n ut(i) =u1t(i). nu=1. u1(n)=ua_1(x(n). ut(i+n)=u2t(i). % % Increment calls to pde_1 ncall=ncall+1. u2(i)=u(i+n).

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

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

% % 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. Chapter 15 .3:tf]'.2).0. (15. C=0. nc=2*(aˆ2*Aˆ2-Bˆ2).3: Function ua 1.m is a straightforward implementation of eq. (15. A=2. LISTING 15.. *sinh(xi)*B.m for the analytical solution of eq. LISTING 15. u0=inital_1(t0). % % Initial condition t0=0. % % Independent variable for ODE integration tf=0.3). beta=1. tout=[t0:0. B=-1. . uanal=(1/beta)*(b*beta*cosh(xi)ˆ2/nc)*(-2*nc/(b*beta*cosh(xi)ˆ3)).. b=1.9.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.m is listed next. (15. The main program pde 1 main. Function uat 1. Hyperbolic Liouville Equation 279 function uanal=ua_1(x.3).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. uanal=(1/beta)*log(nc/(b*beta*cosh(xi)ˆ2)).m for the analytical solution of eq. function uanal=uat_1(x.

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

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

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

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

m indicating two bands for eqns. and c represents wave velocity (Note the division of U(ξ ) by β. We then have an equation that can be split into separate terms.5). t) = U(ξ )/β. The first method is very straightforward and leads to a variable separable solu- tion. 2] using two methods. one a function of U and the other of ξ .1: ODE Jacobian map from jpattern num 1. which facilitates the calculation). that can be integrated . where ξ = k(x − ct). (15. 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.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. k represents wavenumber. We start by applying the traveling wave transformation u(x.284 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Jacobian sparsity pattern – nonzeros 292 (2. but we will not discuss this type of problem here. (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.

551766 −0.880 −0.250237 0.734704 1.791759 0.00 −0.000000 0. output for t = 0.000000 0.000000 0.785366 1. .101853 0.766268 0.i) err(it. 0.00 −0.400286 −0. .734704 1. . .766268 1.400286 0.627992 0.000000 0.200 1.734704 0. .101853 0.00 −1.000000 0.310268 −2.000000 0.120 1.000000 .000000 0.635852 1.858246 −0.00 −0.i) 0.90 −0.704478 0.000000 0.000000 0.000000 0.00 0.6 removed .00 0. .000000 0.858246 0.551766 0.101853 −0.000 1.960 −2.835378 −1.00 0.160 1.785366 1.551766 −0.691061 0.310267 −0. .840 −0.551766 0.920 −0.i) 0. . .635852 0.469039 0.120 1.040 1. .i) err(it.151708 −0.3.000 −0.00 −0. .840 −0.i) u1 anal(it.000000 0.993398 −1.960 −0.90 −0. 0.785366 0.000000 0.800 −1.766268 0.00 0.250237 −0.00 −0.000002 0.000001 (Continued ) .5 t x u1(it.080 1.469039 −2.835377 −0. . .791759 1.250237 0.200 1.400286 −0.920 −2.00 1.858246 −0.000001 0.1: Selected numerical output from the main program pde 1 main.000000 0.000000 0.00 0. . .00 −0. .691061 1.00 0.90 −0.627992 −2.00 0.00 0.000000 0.040 1.00 −0.858246 0.704478 −0.151709 −2.704478 0.00 0.960 −0. Hyperbolic Liouville Equation 285 Table 15.i) u1 anal(it. .90 −0.90 −1.635852 0. .90 −0. Chapter 15 .101853 −0.000000 0.160 1.00 0.000000 0.000000 0.080 1.000000 0.766268 1.691061 1.00 0.000000 .840 −1.704478 −0.785366 0.00 −0.250237 −0.000000 .635852 1.920 −0. .734704 0.993397 −0.00 −0.000 −0.000000 0.800 −0.000001 0. 0.691061 0.00 −0. .400286 0.000000 0. t x u1(it.m of Listing 15.880 −0.880 −2.800 −0.000 −2.

014030 −0.880 1.743745 0. .767887 0.014029 1.703077 1.360 1.840 1.772224 1.90 0.678320 1.90 0.767887 0.893568 0.90 0.i) .90 0.703078 −0.90 0.236587 1. t).90 0.000001 0.000 0.7) dξ c k − a2 k 2 ⇓ integration bβξ 2 e−U = (15.724908 −0.000000 0.128607 1.678320 −0.337217 1.400 1. .893568 −0.i) u1 anal(it.788162 −0.000001 .90 0.620314 −0.000002 0.000000 0.000000 0.960 0. .1: (Continued ) t x u1(it. .000000 ncall = 183 directly.90 0.337219 −0.90 0.280 1.480 1.440 1.600 1.772223 0. .i) err(it.90 0. (15.286 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 15.520 1.759533 0.800 1.551530 −0.000001 0.000001 0.90 0.200 1. .90 0.9) β bβ (x + x0 − ct)2 .90 0.743746 1. 15.000001 0.759533 1.000000 0. . 0. .920 1.320 1.791360 1. Thus. .000001 0.240 1.236588 −0. .6) ∂t 2 ∂x ⇓ transformation d2 U bβeU 2 = 2 2 (15.791359 0.000001 0.90 1.000000 0.551529 1. the calculation sequence is ∂ 2u ∂ 2u − a2 2 = beβu (15.788161 1.000001 0.8) c 2 k 2 − a2 k 2 2 ⇓ inverse transformation ! 1 2 c 2 − a2 u = ln .000000 0.128608 −0.781777 1. A solution for u is obtained by the inverse transformation U(ξ ) = βu(x. 0.90 0.000001 0.724907 1.90 0.781776 0.90 0.560 1.1.620313 1.

0. i.9) is a valid rational solution to eq.8 1 x FIGURE 15. eq.xi)}).2: 2D plot comparing the numerical and analytical solutions of eq. ># Inverse transformation xi=k*(x-c*t). 0..2 0 0. .e. ># Separate variables and integrate eqn1:=int(exp(-U). (15. (15. (5. t) −0.5a.diff(U(xi).u=U(xi)/beta}.5 −1 −1.x.2) (Note this solution becomes singular when x + x0 − ct = 0).t)): >pde1:=diff(u.U)-b*beta/(cˆ2*kˆ2-aˆ2*kˆ2)*int(1.2 0.5 −3 −1 −0.6). o – analytical 2 1. ># Hyperbolic Liouville Equation restart. 0. The Maple code that generates the solution of eq.{diff(U(xi).9.xi=k*(x+x0-c*t)}.x)-b*exp(beta*u)=0.t=tau. xi=k*(x-c*t). >ode2:=collect(ode1.t)-aˆ2*diff(u.1) (eqns.[xi.t. the solution used in the main body of this chapter as the basis for the numerical solution.xi)ˆ2.4 0. with(PDEtools): with(PolynomialTools): >alias(v=v(x.8 −0.9) is given in Listing 15.6 −0. although eq. Chapter 15 . U(xi)=u*beta pdeSol1:=isolate(subs({U=u*beta. (15.eqn2). ># Assume a travelling wave solution of the form # u=U(xi)/beta.pde1. lines – numerical. Hyperbolic Liouville Equation 287 Hyperbolic Liouville equation.5 −2 −2. ode1:=dchange(tr1. ># Isolate U eqn2:=isolate(eqn1.xi.5 0 u1 (x.3.7. However.6 0. (15.U(xi)]).tau.xi)=0.5b)) moving left to right in x for t = 0.5 1 0.6.U.t)):alias(u=u(x. tr1:={x=(xi/k+c*tau). (15. it is not the solution we seek.u).xi.U).4 −0.

288 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Hyperbolic Liouville equation 2 1 0 u1 (x. We now apply the Riccati method to this modified equation. which greatly simplifies the solution process.11) ∂t 2 ∂x2 ∂t ∂x While this is a more complex expression than eq.1) (eqns.6 0.pde1).3: 3D plot of the numerical solution of eq. For the second method.5 0 −1 FIGURE 15.1). LISTING 15. t) −1 −2 −3 1 0. ># Check solution pdeCHK:=pdetest(pdeSol1. (15. (15. we apply the transformation u = ln(u)/β (15.5 0.7: Maple code used to derive the solution of eq. (15. end if. which generates six trivial solutions and the following six . the exponential term has been elim- inated.9). which is slightly more involved.5a.2 x −0. (5.10) to eq.5b)).8 1 0. else print("Solution: passes pdetest() !"). which yields ! ∂u 2 2 ∂ 2u 2∂ u 2 2 ∂u u − a − + a − bu3 = 0 (15.4 0 t 0.6). (15. # '0' if true if pdeCHK <> 0 then print("Solution: does not pass pdetest() !").

k = −2.19) β bβ cosh2 k (−x − x0 + ct) On letting k = −A.6.6. Setting t = 0 and x = 0. and β = 1. which we convert from tanh form to cosh form to give 2k2 a2 − c2 u3 = (15. c = B/k. ! 2k2 a2 − c2 1 u = ln (15.16) bβ −8k2 a2 − c2 1 + tan2 2k(x + x0 − ct) u6 = (15. b = 1.13) 2bβ 2k a2 − c2 2 1 − tanh2 k(x + x0 − ct) u3 = (15. this solution takes the form of a triangular-shaped traveling wave with a curved apex—see Figs. 15. on plotting the spatial derivative. i.5. Note: while at large scale the traveling wave appears to be a peakon. Hyperbolic Liouville Equation 289 nontrivial solutions: k 2 a2 − c 2 1 − tanh2 k(x + x0 − ct)/2 u1 = (15.. c = 1/2. see Fig. . (15. Chapter 15 . 15. we arrive at eq.e. We can check if this is the case by taking the limit of du/dx as |x| → ∞. In addi- tion.18) bβ cosh2 k (−x − x0 + ct) The final solution is obtained by applying the inverse transformation. which gives the traveling wave slopes. x0 = 0..12) 2bβ −k2 a2 − c2 1 + tan2 k(x + x0 − ct)/2 u2 = (15.79.14) bβ −2k a2 − c2 2 1 + tan2 k(x + x0 − ct) u4 = (15. i. and x0 = C/k. the solution used in the main body of this chapter as the basis for the numerical simulation. 15. 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. u = ln(u3 ) /β. we see that the peak value is given by u = ln(6) = 1.15) bβ 8k a2 − c2 2 1 − tanh2 2k(x + x0 − ct) u5 = (15.e.4 and 15. If we use the param- eter values a = 1. on closer inspection. we observe that the slopes on either side of zero appear to rapidly take on constant values—see Fig.2).17) bβ We choose solution u3 .

du .

.

lim −4 sinh(2x) = = ∓4 (15.20) dx .

. The Maple code that generates this solution and the associated plots is given in Listing 15.8.x=±∞ x → ±∞ cosh(2x) which confirms our visual impression.

t)): ># Define pde pde0:=diff(v. which then moves left to right when activated.symbolic).290 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS 0 −10 −20 u −30 −40 −10 −5 0 5 10 x FIGURE 15.x)-b*exp(beta*v)=0. pde1:=simplify(dchange(tr0. 0 −10 −20 u (x. with(PDEtools): with(PolynomialTools): with(plots): >alias(u=u(x.[u]). >pde1 := numer(lhs(pde1))*denom(rhs(pde1)) = numer(rhs(pde1))*denom(lhs(pde1)).5: 3D plot of solution to hyperbolic Liouville equation.t)):alias(v=v(x. ># Apply a transformation tr0:={v=ln(u)/beta}.pde0. >read("riccatiMethod.t. ># Hyperbolic Liouville Equation # Attempt at Riccati solution restart.x.txt"). t) −30 5 −40 4 3 −10 2 t −5 0 1 x 5 10 FIGURE 15. >intFlg:=0: # integration not needed! .t)-alphaˆ2*diff(v.4: The initial condition (at t = 0) for a 2D animation of the solution to the hyperbolic Liouville equation.

a:=1.grid=[100. alpha:=a. titlefont=[TIMES. ># Generate a 3D surface plot plot3d(zz. ROMAN. using the transformation u(x. numpoints=100. 15.4–15."t".pde0). labeldirections=[HORIZONTAL. C:=0. titlefont=[TIMES.2. shading=Z. t=0. 16].8: Maple code used to derive the solution of eq. . labelfont=[TIMES. t=0. ># Standard solution constants zz:=rhs(sol1).title="Hyperbolic Liouville Equation". labelfont=[TIMES.title="Hyperbolic Liouville Equation". ROMAN. we mention that eq. M:=2. Finally.6) is also referred to in the literature as the modified Liouville equation and that it can be converted.. ># Create animation animate(zz."u(x.6.3]))/beta.c:=-B/k.48]. orientation=[64. ROMAN.2.x=-2.1. ROMAN.HORIZONTAL. b:=1.axesfont=[TIMES. thickness=3.t)"].intFlg.symbolic). ROMAN. ROMAN. else print("Solution passes pdetest()"). 16]).6: Plot illustrating how du/dx → ±4 as x → ∓∞. if testSol<> 0 then print("Solution: does not pass pdetest() !").. η).axes='framed'.100].infoLevOut). 16]. riccatiMethod(M. beta:=1. # Set order of approximation infoLevOut:=0.x0:=C/k. t) = U (ξ ."u"].VERTICAL]. labels=["x". Hyperbolic Liouville Equation 291 3 2 1 du/dx 0 −1 −2 −3 −2 −1 0 1 2 x FIGURE 15.k:=A. 16]. ># Test that the solution solves the original pde testSol:=simplify(pdetest(sol1.19) and Figs. 16].. Chapter 15 . ># Apply the inverse transform v=ln(u) sol1:=v=ln(rhs(soln[2. axes=framed.frames=50. style=patchnogrid. (5.labels=["x".. 16]).axesfont=[TIMES. B:=-1.1. end if.x=-2.pde1. LISTING 15. A:=2. (15.

Handbook of Nonlinear Partial Differential Equations. J.D. Frontiers in Mathematical Analysis and Numerical Methods: In Memory of Jacques-Louis Lions.η) (15. Gu. Zaitsev.292 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS where x = a (ξ − η).H. Chapman & Hall/ CRC. Boca Raton. 2004. 143–148.21) ∂ξ ∂η known simply as the Liouville equation. . World Scientific Publishing Company. de Math. η) = beβU(ξ . to the equivalent alternative form ∂ 2 U (ξ . Sur l’équation aux différences partielles ∂ 2 log λ/∂u∂v ± λ/ 2a2 = 0. FL. Liouville.F. [2] J. 18 (1) (1853) 71–72. Pure et Appliquée. V. pp. in: L. Polyanin. 2004. [3] A. t = (ξ + η). Singapore. References [1] C. Tatsien (Ed). On the Classification of Initial Data for Nonlinear Wave Equations.

(16. One IC for eq. (16. .2) with respect to t.1) is eq.1) is second order in t. we use d −1 1 tan x = dx 1 + x2 " # ∂ua (x. µ. 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. Here.2) defines a traveling wave solution through the combination kx + µt + θ0 .1) ∂t 2 ∂x Since the sine-Gordon equation is second order in t. and θ0 are arbitrary. A second IC is available by differentiating eq. Since eq. t) = tan−1 exp p (16. p227) ( " #) 4 bλ(kx + µt + θ0 ua (x. (16. (16. Traveling Wave Analysis of Partial Differential Equations DOI: 10.2) λ bλ(µ2 − ak2 ) if bλ(µ2 − ak2 ) > 0 and where k. 16 Sine-Gordon Equation The sine-Gordon equation ([1]. its solution closely parallels that of the hyperbolic Liouville equation of Chapter 15. Note that eq. 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. p227) is ∂ 2u ∂ 2u = a2 2 + b sin(λu) (16. t) 1 = 2bµ ∂t " # bλ kx + µt + θ0 cosh p bλ(µ2 − ak2 ) .1016/B978-0-12-384652-5.00016-9 293 Copyright © 2012 Elsevier Inc. An analytical solution is ([1].2) with t = 0. All rights reserved. (16. it requires two ICs.

u1. t) (16. u2(i)=u(i+n). t). u1xx=dss044(xl.3) ∂t bλ µ2 − ak2 The required IC then comes from eq.t). u2t(n)=0. u1x(1)=0. u1(n)=ua_1(x(n).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). % % u1xx nl=1.m listed first. t) bλ kx + µt + θ0 = 2bµ sech q (16.3) with t = 0 BCs for eq. function ut=pde_1(t. u1t(n)=0. % % Two vectors to one vector for i=1:n ut(i) =u1t(i). end % % BCs at x = 0.t).n.1)–(16. (16.4) constitute the problem programmed in the following Matlab routines.nl. % % PDE for i=2:n-1 u1t(i)=u2(i).1) are taken as u(x = xl . u(x = xu . Equation (16.294 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS or ∂ua (x. (16. nu=1. t) = ua (x = xu .u1x. end u1t(1)=0. 4b) Equations (16. . ut(i+n)=u2t(i). t) = ua (x = xl . u2t(1)=0.xu.nu).1) is programmed in function pde 1. u2t(i)=a*u1xx(i)+b*sin(lambda*u(i)).4a.30 u1(1)=ua_1(x(1).

(16. (16. % % u1xx . % % Increment calls to pde_1 ncall=ncall+1. u. to facilitate the numerical solution of eq. Also.1). Sine-Gordon Equation 295 end ut=ut'. function ut=pde_1(t. In the case of eq. the use of two 1D arrays is a standard procedure for accommodating a PDE second order in t such as eq. this gives ∂u1 = u2 (16. (16.u2.5b) ∂t ∂x As indicated in Chapter 15. The function and some global variables are first defined. the procedure is quite general in the sense that it can usually be applied to any . second-order PDE of interest. % % One vector to two vectors for i=1:n u1(i)=u(i). We can note the following details about pde 1. u1(n)=ua_1(x(n). (16. LISTING 16. each of length n.t).1). u1.5a) ∂t ∂u2 ∂u1 = a2 2 + b sin(λu1 ) (16. as for the case of the hyperbolic-Liouville equation of Chapter 15.m for eq. The BCs (16.4) are programmed as % % BCs at x = 0. 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. end Again. The 1D ODE dependent variable vector of length 2n.t). Chapter 16 .1).m: .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 .1: Function pde 1.30 u1(1)=ua_1(x(1). u2(i)=u(i+n). is transferred to two 1D arrays.1).

n) are zeroed to . .u1x. u1xx=dss044(xl. end ut=ut'. Note that BCs (16. are then returned to a single-derivative vector ut to be returned from pde 1.m is incremented. the first derivative in x. 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.u2t. end u1t(1)=0. u2t(i)=a*u1xx(i)+b*sin(lambda*u(i)). % % PDE for i=2:n-1 u1t(i)=u2(i). % % Increment calls to pde_1 ncall=ncall+1. (16.1) (or eqs. Also. (16. Note also that the derivatives in t of the ODEs at the boundaries (i=1. the counter for pde 1. from dss044. u1x(1)=0. xu=30.nl. ut(i+n)=u2t(i).xu. with a transpose included to meet the requirement of ode15s. In summary.4) are designated as Dirichlet through nl=1. The two derivative vectors. (16. can then be used in the programming of eq. u1x(1)=0. u1t. pde 1.5) are then programmed in a for loop.m receives the dependent variable vector u as an input (along with the independent variable t) and returns the derivative vector ut. nu=1. The second derivative . such as u1x in dss044.296 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS nl=1.5).4).n. Equations (16. u2t(n)=0. must be defined numerically. Also. ensure the boundary values remain at the values prescribed by eq. 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. % % Two vectors to one vector for i=1:n ut(i) =u1t(i). u2t(1)=0.m.5).u1.nu). (16. u1t(n)=0. u1xx. The IC function inital 1.m defines initial values for u1 and u2 in eqs. nu=1.

m discussed subsequently.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.5a) are provided by the function ua 1. Function ua 1. Sine-Gordon Equation 297 n=121. the initial values of u2 for eq. LISTING 16. inital 1. u0(i) =u1(i).2).t0).3) with t = 0.m for eqns.4: Function uat 1.3: Function ua 1.3). u1(i)= ua_1(x(i). (16. (16. In the for loop. All 2n initial condition values are returned from inital 1. (16. uanal=(4/lambda)*atan(exp(b*lambda*xi/den)).m is a straightforward implementation of eq.m (which has the programming for eq.m defines a grid in x of 121 points for 0 ≤ x ≤ 30.m through the vector u0 to the main program pde 1 main.m (which has the programming for eq.3)). Function ua1 1. % % ICs from analytical solution for i=1:n x(i)=xl+(i-1)*dx. . LISTING 16.2) and (16. the initial val- ues of u1 for eq.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. (16. uanal=2*b*mu/cosh(b*lambda*xi/den). (16.2). (16.m for the analytical solution of eq.m for the analytical solution of eq. dx=(xu-xl)/(n-1).t0).m is a straightforward implementation of eq. end LISTING 16. u0(i+n)=u2(i). Chapter 16 .2)). u2(i)=uat_1(x(i).3). (16. function uanal=ua_1(x.2: IC function inital 1. function uanal=uat_1(x. (16.5b) are provided by the function uat 1. (16.

in the solution with x.u1(it. 6.1) (u1 of eqs. for i=1:5:n fprintf('%6. and a 3D plot of the numerical solution is produced by surf. . lambda=1.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. The numerical and analytical solutions are then superimposed in a 2D plot from Matlab routine plot.i) and displayed numerically in the output. The error in the numerical . µ = −5.i)\n').6f\n'. A few details are as follows. b=0.'-'.err(it.6f%15. the0=0..numerical.m for the sparse matrix integration of the ODEs is not listed here since it is the same as for Chapter 15. mu=-5. % % Plot numerical and analytical solutions figure(2) plot(x.1) and (16. (16.i). A portion of the numerical output from pde 1 main. The ODE Jacobian map from jpattern num 1.t)') title('sine-Gordon equation. ylabel('t').analytical') figure(3) surf(u1) shading 'interp'.. title('sine-Gordon equation').ncall).2) is computed as err(it. t = 0.i).m is listed in Table 16. and θ0 = 0. den=sqrt(b*lambda*(muˆ2-a*kˆ2)).i) u1_anal(it.u1.i) err(it.2) are defined numerically. o .x.t)').2f%8.1. solid . The parameters in eqns. The difference between the numerical solution of eq.6f%15. % % Model parameters a=1.i)). but the difference between the two solutions increases with increasing t.x(i). end end fprintf(' ncall = %4d\n\n'. k was selected to obtain a significant variation . t(it).m indicates two bands for PDEs (16. k=4. jpattern num 1. In particular.u1_anal(it.1. We can note the following points about this output: .1. The numerical and analytical solutions agree at t = 0 as expected. (16.u1_anal.3f%15.'o') xlabel('x') ylabel('u1(x.5)) and the analytical solution of eq. as indicated in Fig.5). 3. 9. % % Display selected output for it=1:nout fprintf('\n t x u1(it. 16. zlabel('u1(x. axis 'tight' xlabel('x'). (16. k = 4. (16..

mainly in the nonlinear terms. Chapter 16 . Since the difference between the hyperbolic Liouville equation of Chapter 15 and the sine-Gordon equation of this chapter is rather small. (15. accuracy of the numerical solution).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. but this results in a greater computational effort (note in inital 1. with ncall = 530. the computational effort is still modest. 201 as comments indicating some experimentation with the number of grid points to investigate the .1) and b sin(λu) from eq.216%) 0 50 Semidiscrete equations 100 150 200 0 50 100 150 200 Dependent variables FIGURE 16. (16.5). (16.1: ODE Jacobian map from jpattern num 1. changes in the problem parameters can have unexpectedly large effects in the accuracy and required computational effort. beβu from eq..m the values n = 51. Sine-Gordon Equation 299 Jacobian sparsity pattern – nonzeros 712 (1. Even for a given PDE. Our experience has indicated that this . For the present conditions. solution could be reduced by using more grid points (n > 121).m indicating two bands for eq.

283148 0.000 0.000 3.000000 0.00 18.00 7.00 2.00 10.058084 0.248351 6.250 5. .282882 6.00 23.000000 0.280688 6.00 0.278954 0.250 0.300 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 16.1: Selected numerical output from the main program pde 1 main.000 6.i) u1 anal(it.000000 9.400928 1.000000 0.194166 2.283164 0.750 6.750 6.000000 0.i) 9.500 6.171749 0.00 25.00 7.471548 5.183251 0.283123 6.000920 9.00 17.500 4.494642 0.099238 0.262621 6.059004 -0.00 20.282315 6.00 6.i) err(it.00 22.000000 0.283080 0.282882 0.000 2.00 3.276018 0.000000 0.282671 0.00 8.000000 0.000000 0.000000 0.283006 6.028664 9.169216 0.000000 0.281711 6.000 5.00 6.00 1.250 6.500 6.00 10.00 16.m t x u1(it.799721 0.500 6.283164 6.00 2.000000 0.281711 0.276018 6.00 5.00 27.113969 0. . .283172 0. output for t = 3.280688 0.291398 0. .250 6.000000 0.941803 0.000000 0.248351 0.061002 .000000 0.500 0.282671 6.250 6.000000 0.000000 0.00 1.150022 4. .059546 9. .750 6.271045 6.00 11.996866 0.283172 6.286319 0.840301 0.500 0.283123 0.002533 9.000000 0.000000 0.000000 0.000 0. .000000 0.250 0.000697 9.750 6.283006 0.471548 0.i) u1 anal(it.283080 6.00 0.034834 0.799721 5.282315 0. .00 21.000000 0.000 6.941803 4.00 3.133163 0.250 6.483465 0.005079 9.00 30.000000 0.283148 6.000000 0.500 6.750 0. .034834 0.000 6.341382 0.262621 0.750 6.i) err(it.500 6.250 4.224181 6.141593 3.271045 0.750 1. t x u1(it.996866 5.278954 6.099935 -0.141593 0.224181 0.00 28.750 5.00 8.811637 0. 6 removed .00 26.00 12.i) 0.00 5.183251 6.113969 6. .000 6.011177 9.00 15.000 6.000000 0.150022 0.00 13.000000 .

750 6.00 17.000 6. quantum mechanics field theory.001514 9.250 3.271353 6.00 16.250 6.280688 0. It has been found to be particularly useful in applications that give rise to solitons. The plotted solutions follow in figs 16. Sine-Gordon Equation 301 Table 16.198719 3.2 and 16.491899 5.500 4.281711 0.750 6.00 28.141593 0.113969 0.000096 9. . and other areas of physics and engineering.020351 9. It occurs in the study of geometrical surfaces of constant Gaussian curvature.279050 6.248351 0.996866 0.250 6.750 4. for example.00 20. 30 vary with t according to eqns.185814 6.00 26.471548 0.2 demonstrates that the boundary values at x = 0.000 5.007325 9.276195 6. (16.000308 9.249244 6.012303 9.4) and as pro- grammed in pde 1. Chapter 16 .004337 9. In summary.00 15. In other words.2) and (16.500 6. Figure 16.004191 5.812024 5.262621 0. we have again discussed the numerical solution of a PDE second order in t (eq.750 6.046656 9.00 22.500 6. (16. As noted in Chapter 15.974121 4.500 6.3.000893 9.5)).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.118307 6.225695 6. (16.000177 9.280730 6.00 11. 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.278954 0. Appendix The sine-Gordon equation is so-called as a result of a wordplay on the similar Klein–Gordon equation.032318 9.196678 4.000 6.000526 9.00 18.224181 0.00 23.150022 0.276018 0.002563 9.2) with the argument kx + µt + θ0 is clear.183251 0.941803 0.250 5.000042 9.00 21. the traveling wave solution produced by eq.1: (Continued) 9.1)) by restating the PDE as two PDEs first order in t (eq.00 13. Also. (16.00 27. each PDE problem should be treated as “new” and experimental.m.00 12.281711 6.263146 6.271045 0.000 6.057126 9. in the study of fiber optics.00 25.799721 0.

7) After some algebraic manipulation. .6) can be transformed to an alternative form by changing the variables. There are two common forms used in studies of relativity. top to bottom for t = 0.1) (eqs.302 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Sine-Gordon equation. where we have set λ = 1. eq. t = η+ξ (16. lines – numerical.2: 2D plot comparing the numerical and analytical solutions of eq. (16. 6.8) ∂ξ ∂η 1 Laboratory coordinates apply where the observer is located within an inertial laboratory. (16.6) ∂t 2 ∂x This is a simplified form of eq. Following Drazon and Johnson [2]. 9). (16. we arrive at the second form in light-cone coordinates 2 ∂ 2u = β sin (u) (16. x = α(η − ξ ). (16.1). t) 3 2 1 0 0 5 10 15 20 25 30 x FIGURE 16. 3. o – analytical 7 6 5 4 u1(x. The first form is defined in laboratory coordinates1 by ∂ 2u ∂ 2u − α 2 2 = β sin (u) (16.5). 2 A light cone is formed by all past and future events that can be connected by light rays.

9) ∂ξ z = β cos (u) − 1 (16. Chapter 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. we obtain z = − 1. We now seek an analytical solution (adapted from [3]) and start by introducing the following new variables ∂u w= (16.13) ∂ξ ∂η ∂η .11).3: 3D plot of the numerical solution of eq.5)). (16. (16. (16.12) 1 ∂ 2w On rearranging eq.10) from which we note that ∂ 2w ∂ ∂u ∂u − w − wz = [β sin (u)] − − [β cos (u) − 1] = 0 (16. (16. which we use to eliminate z from w ∂ξ ∂η eq. !2 2 ∂ 2w ∂w + w2 − β 2 w2 = 0 (16. t) 3 2 1 0 10 8 30 6 25 20 t 4 15 2 10 x 5 0 0 FIGURE 16.1) (eqs. Sine-Gordon Equation 303 Sine-Gordon equation 7 6 5 4 u1(x.

.e. again using z = − 1 from eq.16) k 1 ∂ 2w and.e. . (16. (16. η = (x/α + t) /2 to obtain the desired result. √ By applying the inverse transformation w = v.20) 2k Equation (16. to eq.14) ∂η∂ξ ∂η Now.15) k k where k is an arbitrary constant. we use the inverse transformation ξ = (−x/α + t) /2. (16. i.11). we obtain v ! 2 ξ k + βη 2 u u w = 2k 1 − tanh t (16.19) k This is a traveling wave solution to the sine-Gordon equation in light cone coordinates.20) is a soliton traveling wave solution to the sine-Gordon eq.. 16. while this equation may seem more complex than the above equations.4 where we have used the following parameter values: α = 1. Finally. We continue with the tanh form as it leads to a more compact final solution. (16.6) in labora- tory coordinates—see Fig.304 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS We now make a further transformation by letting v = w2 . it does readily yield the following traveling wave solution by application of the tanh method. (16. " ! # 2 (−x/α + t) k2 + β (x/α + t) u = arccos 2 tanh −1 . (16. (16.18) we obtain " ! # 2 ξ k2 + βη u = arccos 2 tanh −1 (16.17) k Applying the inverse transformation u = arccos [(z + 1) /β] . we obtain w ∂ξ ∂η ! 2 ξ k2 + βη z = 2β tanh −β −1 (16. " !# ! 2 2 ξ k2 + βη 2ξ k2 + βη v = 4k 1 − tanh = 4k sech .8). i. which gives 2 2 ! ∂v ∂v ∂v ∂v ∂ 2v −4 v ∂η ∂ξ ∂η ∂ξ ∂η∂ξ !2 2 ∂ 2v ∂v +4 v2 + 4 v3 − 16β 2 v4 = 0.

it is not the familiar kink.5 30 20 t 10 25 20 15 10 5 x 0 −5 0 FIGURE 16.5.5: Plot illustrating the discontinuous first derivative at the peak of the peakon solution to the sine-Gordon equation. p110-112 restart. it is a peakon. 2 1 du/dx 0 −1 −2 −10 −5 0 5 10 x FIGURE 16. β = 1.5 2 u (x. It is. A peakon (peaked soliton) is a special type of soliton which has a discontinuity in the first derivative at its peak—see Fig. Drazin and Johnson.5 1 0.4: 3D plot of solution to sine-Gordon equation.5. of course. Sine-Gordon Equation 305 3 2. A Maple code that performs the above calculations and generates animated and 3D plots is given in Listing 16. Peakons with a negative peak are sometimes referred to as antipeakons. the wave peak value is umax = π. t) 1.t)): alias(w=w(x. and k = 2. Chapter 16 . However.t)): ># Sine-Gordon equation in laboratory coordinates . or hump-type soliton. ># Sine-Gordon Equation # Attempt at Malfliet's tanh solution # See: Solitons: An Introduction. Note. 16. not the only solution as there are an infinity of traveling wave solutions to this famous equation.t)): alias(z=z(x.t)): alias(v=v(x. with(PDEtools): with(PolynomialTools): with(plots): >alias(u=u(x.

x.pde..k=2.'z'). ># From w. pde0:=simplify(dchange(tr0.t)-alphaˆ2*diff(v. ># Apply solZ and cross multiply eqn2 # to eliminate denominators z:=solZ.x.pde0. unassign('w'. ># Test solution in 'light cone' co-ordinates simplify(pdetest(sol1.80. 16]). ># Now apply a change of variables: z:=beta*cos(v)-1. ROMAN. ># Transform solution back to original co-ordinates sol2:=v=subs({x=(t-x/alpha)/2..t]). labelfont=[TIMES.thickness=3.rhs(sol1)).306 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS pde:=diff(v.xi. ># Test final solution in original pde simplify(subs(sol2.eta).t)/w-1.[u]).142 (pi) sol2a:=subs({alpha=1. 16]. titlefont=[TIMES. numpoints=300.t.30.txt").pde0). title="Sine-Gordon Equation\n Light cone Co-ordinates"."u"]. axes=framed.symbolic).t)ˆ2-betaˆ2+1=0..x0=0}. animate(sol1a. ># Animate the final solution # NOTE: u(max)=3.infoLevOut).pde1.xi=x.x0=0}.x).rhs(sol1)).pde).k=2.z). numpoints=300. axes=framed. # Set order of approximation infoLevOut:=0. t=0. ># Apply the inverse transform to obtain # solution in 'light cone' co-ordinates sol1:=v=arccos((z+1)/beta).beta=1.x=-5. ># Calculate solution for transformed problem intFlag:=0: # No integration of U(xi) needed! M:=2.25.eta=t}. z and pde0 we obtain eqn1:=simplify(diff(w.x=alpha*(-xi+eta).intFlag.rhs(sol2)).142 (pi) sol1a:=subs({beta=1.t)-w-w*z=0). ROMAN.[v.t=(t+x/alpha)/2}.t=(xi+eta)}.x)-beta*sin(v)=0. .25. labels=["x".pde1. animate(sol2a. ># Apply a transformation to convert to 'light cone' co-ordinates tr0:={v=W(xi. pde0:=simplify(dchange(tr1.eta)=v. ># Animate the final solution # NOTE: u(max)=3.x. ># Calculate z z:=simplify(diff(w. ># solve for z using eqn1 solZ:=solve(eqn1. 16].frames=50.frames=50.eta).[W(xi. ># Revert back to original variables tr1:={W(xi. w:=diff(v.x=-5. ># Apply inverse transformation: w=sqrt(u) w:=simplify(rhs(sol[3])ˆ(1/2).x. t=0.symbolic). >read("tanhMethod.symbolic).symbolic).axesfont=[TIMES.symbolic).. ># Apply a transformation to facilitate use of tanh method tr3:={w=uˆ(1/2)}.symbolic). ROMAN. eqn2:=2*z+zˆ2+diff(w. pde1:=simplify(dchange(tr3.eta]).symbolic). pde1:=numer(lhs(eqn2))*denom(rhs(eqn2))=0. tanhMethod(M.

thickness=3.VERTICAL].shading=Z. 16]. ROMAN. title="Sine-Gordon Equation\n Laboratory Co-ordinates".axes='framed'. numpoints=200.HORIZONTAL. [2] P.axesfont=[TIMES.25.S. notes from invited lecture.x=-5.axesfont=[TIMES. labelfont=[TIMES. 16]). 16]). ROMAN.x).10. However. Hereman.x=-10. ROMAN. # a peaked soliton. style=patchnogrid. Drazin. 2000. Chapter 16 .. labels=["x". labeldirections=[HORIZONTAL. 16].30.thickness=3. [3] W. the associated files are included with the downloads provided for this book. titlefont=[TIMES. titlefont=[TIMES. which is a solitary wave with # discontinuous first derivative diffSol2:=diff(rhs(sol2).k=2. .D. diffSol2:=subs({alpha=1. UK. labelfont=[TIMES. Cambridge University Press. ROMAN. but the Maple listings are not included here in order to save space. ># Generate a 3D surface plot plot3d(sol2a. labelfont=[TIMES..F."u(x.52].G. Johnson.diffSol2). Champaign. ROMAN. ROMAN. title="Sine-Gordon Equation ."du/dx"]. References [1] A. 1992. Chapman & Hall/ CRC.beta=1. ROMAN. 16].grid=[100.axesfont=[TIMES..x0=0.VERTICAL]. V. axes=framed. Handbook of Nonlinear Partial Differential Equations. t=0.5: Maple listing to derive traveling wave solutions to the sine-Gordon equation using the tanhMethod() procedure. Cambridge. labeldirections=[HORIZONTAL. FL. Traveling wave solutions can also be found to the sine-Gordon equation using the exp and/or the Riccati methods."t". ROMAN.First Derivative Laboratory Co-ordinates". Exact Solutions of Nonlinear Partial Differential Equations: The Tanh/Sech Method. Illinois.t=0}.. R. November. title="Sine-Gordon Equation\n Laboratory Co-ordinates". Inc. ROMAN.t)"].100]. LISTING 16. Polyanin. Wolfram Research. Sine-Gordon Equation 307 labels=["x". ># Now show that the solution is actually a 'Peakon'. plot(diffSol2. 16]. Solitons: An Introduction.labels=["x". orientation=[-114. Zaitsev. 16]. Boca Raton. 2004. 16]). 16]."u"]. titlefont=[TIMES.

2) Term from eq. We will consider the method of lines (MOL) numerical solution of eq.1) is a generalization of the quadratic Klein–Gordon equation with m = 2 and the cubic Klein–Gordon equation with m = 3 ([3]). α = −c2 . β = γ = f (x.00017-0 309 Copyright © 2012 Elsevier Inc. Traveling Wave Analysis of Partial Differential Equations DOI: 10.1) for three cases: Case 1: Linear PDE (α = −c2 . .3) at t = 0 ∂u(x. β = γ = f (x. The verification of this solution follows directly from substitution in eq.2).4a.4b) ∂t .1016/B978-0-12-384652-5. and eq. we consider the analytical solution 1 ua (x.1) ∂t 2 ∂x Equation (17. t) = 0) For Case 1. we use eq.2) ∂t 2 ∂x2 In the subsequent programming.2) Term in eq.1) reduces to the linear wave equation ∂ 2u 2∂ u 2 = c (17. (17. (17. =0 (17. All rights reserved. t ≥ 0 (17. t) = 0.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. (17. ∂ 2u ∂ 2u + α 2 + βu + γ um = f (x.3) is a superposition of two traveling waves moving left and right with velocity c. (17. (17. (17. (17.3) is therefore a special case of the d’Alembert solution to the wave equation [2]. 17 Mth-Order Klein–Gordon Equation We start with a PDE which we term the mth-order Klein–Gordon equation.3) 2 Note that eq. t = 0) = sin(x). Equation (17. t) = sin(x) cos(ct) = [sin(x + ct) + sin(x − ct)] . t) (17. t = 0) u(x. (17.

310 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS and the Dirichlet BCs. xu and fb1 . Case 1.2 illustrates the traveling wave properties of eq.5a.1 is selected by using ncase=11. u1(n)=ua_3(x(n). nu=1.1)–(17. u(x = xl . u1(n)=ua_11(x(n). sin(x) cos(ct)). end if(ncase==12) u1(1)=ua_12(x(1).t). t) = fb1 (t). .t).t).t). Case 1. u1x(1)=0. u1(n)=ua_12(x(n).t). In Case 1.t). and Case 1.1 .3) in x and t (the first form of this solution. fb2 (two BC functions) are specified for three cases.3) in x and t (the second form of this solution. The details of these two subcases will be apparent from the Matlab code and the associated numerical and plotted output. end % % u1xx nl=1. end % % BCs if(ncase==11) u1(1)=ua_11(x(1).2 is selected by using ncase=12. (17.1 illustrates the oscillatory properties of eq. t) = fb2 (t) (17.basic scale in x defined as 0 ≤ x ≤ 2π and (2) Case 1. end if(ncase==2) u1(1)=ua_2(x(1).t).2 . u1(n)=ua_2(x(n). end if(ncase==3) u1(1)=ua_3(x(1).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). The ODE routine for eqns. (17. 12 [sin(x + ct) + sin(x − ct)]).expanded scale in x defined as −3π ≤ x ≤ 4π . Case 1.t).5) is as follows. function ut=pde_1(t. we consider two subcases: (1) Case 1. In the Matlab routines that follow.5b) where xl . (17. u2(i)=u(i+n). u(x = xu .

1: Function pde 1. LISTING 17.xu. end end if(ncase==2)|(ncase==3) for i=2:n-1 u1t(i)=u2(i).12.2). end end u1t(1)=0.n. u2t(n)=0. The function and some global variables are first defined.u1. % % PDE if(ncase==11)|(ncase==12) for i=2:n-1 u1t(i)=u2(i). Mth-Order Klein–Gordon Equation 311 u1xx=dss044(xl. (17. u2t(i)=c2*u1xx(i). if(ncase==2)f=f_2(x(i). Chapter 17 . u1t(n)=0. function ut=pde_1(t.m: . end ut=ut'. is transferred to two 1D arrays each of length n. (17.u2 to facilitate the numerical solution of eqns. are second order in t. (17. % % Increment calls to pde_1 ncall=ncall+1. % % Two vectors to one vector for i=1:n ut(i) =u1t(i). the 1D ODE dependent variable vector of length 2n.nu). ut(i+n)=u2t(i). eq. u2(i)=u(i+n).end u2t(i)=-a*u1xx(i)-b*u1(i)-g*u1(i)ˆm+f.1) and (17.1) and the special case.nl. We can note the following details about pde 1. u.2).2.1) (ncase=11. (17.t).3). % % One vector to two vectors for i=1:n u1(i)=u(i). end .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 . u2t(1)=0. Since eq. u1.u1x.end if(ncase==3)f=0.m for eq.

ua 2.2).312 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Again. % % BCs if(ncase==11) u1(1)=ua_11(x(1). Also.t).ua 12.t). Four sets of BCs are programmed for ncase=11. In the case of eq. nu=1.ua 3.1).m. we consider ncase=11. the first derivative in x. To start.t). Dirichlet boundary conditions (eqns. nu=1. end if(ncase==12) u1(1)=ua_12(x(1). the analytical solutions in functions ua 11.m. second-order PDE of interest.n. Also.t). end if(ncase==2) u1(1)=ua_2(x(1). u1(n)=ua_3(x(n).5a. is not actually used with the Dirichlet BCs but is included . 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. u1xx=dss044(xl.3 (ncase is set in the main program discussed subsequently).6b) ∂t ∂x As indicated in Chapters 15 and 16. Also.nl. the procedure is quite general that it can usually be applied to any .t). % % u1xx nl=1. u1x(1)=0.t).t).5b)) are specified since the corresponding analytical solutions are used to define the BCs.u1x. end Each of these cases will be considered. (17.12.m.xu. Note that the Dirichlet BCs are designated through nl=1. u1(n)=ua_12(x(n). (17.t). one at a time. the use of two 1D arrays is a standard procedure for accommodating a PDE second order in t such as eqns. u1(n)=ua_2(x(n).2.1) and (17. this gives ∂u1 = u2 (17. (17.6a) ∂t ∂u2 ∂ 2 u1 = −α 2 − βu1 − γ um 1 + f (x. u1x(1)=0. t) (17.u1. subsequently) are used to set the BCs. end if(ncase==3) u1(1)=ua_3(x(1). as for the case of the hyperbolic Liouville equation of Chapter 15 and the sine-Gordon equation of Chapter 16. u1(n)=ua_11(x(n).m (discussed .nu). In all of the cases.

end if(ncase==3)f=0. The second derivative from dss044.5a. must be defined numerically.2)) or ncase=2. pde 1. u2t(i)=c2*u1xx(i). end end u1t(1)=0. (17. end ut=ut'. The two derivative vectors. end end if(ncase==2)|(ncase==3) for i=2:n-1 u1t(i)=u2(i).3 (for eq.2) are then programmed in a for loop. u2t(n)=0. u1xx. (17. the coding of eqns. u1t.m as a global variable).n) are zeroed to ensure the boundary values remain at the values prescribed by the analytical solutions. u1t(n)=0.t).m receives the dependent variable vector u as an input (along with the independent variable t) and returns the derivative vector ut. % % Two vectors to one vector for i=1:n ut(i) =u1t(i). (17.end u2t(i)=-a*u1xx(i)-b*u1(i)-g*u1(i)ˆm+f. u2t(i)=c2*u1xx(i). (17. the counter for pde 1. % % Increment calls to pde_1 ncall=ncall+1. The code is selected according to ncase=11.1)). where c2 = c2 (c is set in the main program and passed to pde 1. (17. can then be used in the programming of eqns.2). Specifically.1) and (17. Mth-Order Klein–Gordon Equation 313 only to satisfy the Matlab requirement that all of the input (RHS) arguments of a function. % % PDE if(ncase==11)|(ncase==12) for i=2:n-1 u1t(i)=u2(i). are then returned to a single derivative vector ut to be returned from pde 1. Equations (17.6b) is u1t(i)=u2(i).u2t. .1) (or eqns. Also. In summary. if(ncase==2)f=f_2(x(i). Chapter 17 . Note also that the derivatives in t of the ODEs at the boundaries (i=1.m with a transpose included to meet the requirement of ode15s.5b)) and (17. u2t(1)=0. such as u1x in dss044.6a.12 (for eq. ut(i+n)=u2t(i). .m is incremented. .

u2(i)=uat_2(x(i). end if(ncase==3) xl=0.3. end if(ncase==12) xl=-3*pi.314 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS We now consider the other routines for ncase=11. u2(i)=uat_3(x(i). 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. xu=2*pi. u2(i)=uat_11(x(i). end if(ncase==12) u1(i)= ua_12(x(i). end if(ncase==3) u1(i)= ua_3(x(i). n=101. xu= 4*pi. we continue the discussion for ncase=12. xu=1.t0). The IC function. if(ncase==11) u1(i)= ua_11(x(i). end dx=(xu-xl)/(n-1). end if(ncase==2) xl=0. inital 1. % % ICs from analytical solution for i=1:n x(i)=xl+(i-1)*dx.t0).6b). xu=1. n=151. defines initial values for u1 and u2 in eqns.t0).6a.t0). n=51. n=51.t0).t0). u2(i)=uat_12(x(i).t0). After looking at the output for this case. end . (17.t0).m.2. end if(ncase==2) u1(i)= ua_2(x(i).

3). u0(i+n)=u2(i).m (which has the programming for the derivative of eq. u2(i)=uat_11(x(i).t) % % Function uanal computes the exact solution of the Klein-Gordon .2: IC function inital 1. All 2n initial condition values are returned from inital 1.12. n=101. (17.m (which has the programming for the first form of the solution in eq. % % Spatial domain and initial condition if(ncase==11) xl=0. sin(x) cos(ct)). u0(i) =u1(i).m discussed subsequently.6b) are provided by the function uat 11. u0(i+n)=u2(i).3).3)). (17. the initial values of u1 for eq.6a) are provided by the function ua 11. The function and some global variables are defined. sin(x) cos(ct). if(ncase==11) u1(i)= ua_11(x(i). end Function ua 11.m is a straightforward implementation of the first form of the solution of eq. Mth-Order Klein–Gordon Equation 315 u0(i) =u1(i). inital 1.m: . end .t0).2. (17.t0).3). 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 .m defines a grid in x of 101 points for 0 ≤ x ≤ 2π . Chapter 17 . In the for loop. (17. end LISTING 17. the initial values of u2 for eq.1) and (17. % % ICs from analytical solution for i=1:n x(i)=xl+(i-1)*dx. end .2) with t = 0 (for ncase=11. (17. xu=2*pi.m through the vector u0 to the main program pde 1 main. function uanal=ua_11(x.m for eqns. (17. We can note the following points about inital 1. Considering first ncase=11.

function uanal=uat_11(x. LISTING 17. ncall=0.m for the analytical solution of eq. % ncase=2. (17.5.m is a straightforward implementation of the derivative (in t) of the first form of the solution of eq.g=1. nout=4.end if(ncase==2)m=2.3. tout=[t0:pi/3:tf]'.r=3.3).3. (17.4: Function uat 11.12. The range in t varies for ncase=11.end if(ncase==3)m=3. % % Model parameters global c c2 m r a b g B K % % Select case ncase=11.5.4. % % Independent variable for ODE integration if(ncase==11) tf=pi.end .2).5.a=-2.4.c=0.K=(-b/(2*(a+cˆ2)))ˆ0. (17.g=1.m of Chapter 15 and therefore only a few features are discussed here.b=1. % ncase=3.m accommodates the cases ncase=11. % % Model parameters if(ncase==11)|(ncase==12)c=1. end if(ncase==12) .4 for eqns.3.3).1) and (17. LISTING 17. % ncase=12.5.3).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).c2=cˆ2. .12. Main program pde 1 main. B=(b/g)ˆ0.b=0.3: Function ua 11.12.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). Function uat 11. (17.5.m for the derivative of the analytical solution of eq. sin(x) cos(ct). This main program closely parallels pde 1 main.a=-1. The parameters are set for ncase=11.

ncall=0. end if(ncase==3) tf=4.'-'. end if(ncase==2) tf=1.analytical') elseif(ncase==3) title('Klein-Gordon equation.m indicates two bands for PDEs (17. The difference in the numerical and analytical solutions is computed as err(it.i).6) as expected.t)').numerical. zlabel('u1(x.x.t)') if(ncase==11) title('Klein-Gordon equation. o . o .ncall)..i) err(it. o .i) and displayed. % % Plot numerical and analytical solutions figure(2) plot(x.u1_anal(it.u1(it. ncase = 12. solid .6f\n'. These solutions are then plotted in 2D by plot and the numerical solution is plotted in 3D by surf. jpattern num 1. nout=5..analytical') elseif(ncase==2) title('Klein-Gordon equation.. The ODE Jacobian map from jpattern num 1. tout=[t0:1:tf]'. % % Display selected output for it=1:nout fprintf('\n t x u1(it.u1) xlabel('x').t.6f%15.analytical') elseif(ncase==12) title('Klein-Gordon equation.m for the sparse matrix integration of the ODEs is not listed here since it is the same as for Chapters 15 and 16.i)\n'). title('Klein-Gordon equation'). Mth-Order Klein–Gordon Equation 317 tf=2*pi.u1_anal. A portion of the numerical output from pde 1 main.i)). solid .analytical') end figure(3) surf(x. ylabel('t').2f%8. o .6f%15.numerical. ncase = 11. solid .1. and the map is therefore not included in the discussion of the output that follows.u1. ncall=0. end .i). . nout=5. ncase = 3. nout=3. end end fprintf(' ncall = %4d\n\n'. t(it).x(i).3f%15.i) u1_anal(it. tout=[t0:pi:tf]'.25:tf]'. solid .m is listed in Table 17.numerical. ncase = 2. for i=1:5:n fprintf('%6. tout=[t0:0. ncall=0.'o') xlabel('x') ylabel('u1(x. Chapter 17 .numerical.err(it.

809017 0.314 0.942 −0.885 0. .m for ncase=11 t x u1(it.309017 0.000000 −0.942 0.827 0.309017 0.587784 −0.314 −0.969 −0.309017 −0.309017 0.00 5.951057 0.000000 0.587785 0.14 3.00 2.571 −0.00 1.00 0.000000 3.309016 0.000002 3.809014 −0.587785 −0.000000 0.000000 0.000000 0.951057 0.1: Selected numerical output from the main program pde 1 main.09 removed .513 −0.00 4.587785 0.14 0.628 −0.770 0.00 1.000 0.257 −0.000001 3.i) 0.587785 0.14 2. t x u1(it.00 3.951057 0.587785 0.00 3.587785 0.142 −0.809017 0.341 −0.000000 0.199 −0.309017 0.309017 0.14 3.i) err(it.199 0.712 −1.000000 1.14 0.14 3.i) err(it.000000 0.000000 .513 0.951054 −0.587785 0. .809017 0.283 0. 2.000003 3.951055 −0.00 5.000000 0.000003 3.05.000000 0. .000000 0.000000 0.951057 −0.655 −0.000002 3.587785 0.i) 3. .000000 0.587784 0.000000 0.000001 3.00 4.770 −0.000000 0.00 0.000000 0.084 −0.00 3.000001 .14 0.951057 −0.00 2.628 0. .000002 3.000000 0.14 0.000 0.809017 −0.00 6.456 −0.809015 −0.000000 0.309017 0.309017 0.309017 −0.00 1.00 2.000000 0.587783 −0.14 2.000000 −0.14 1.951057 0.951057 0.809017 0.809017 0.142 −0.456 0.809017 0.827 −0.587785 −0.000000 0. .951057 0.809017 −0.398 −0.i) u1 anal(it.999997 −1.809017 0.000000 0.000001 3.809017 0.00 5.587785 −0.14 1.587785 0.571 1. .000000 0.885 −0.000000 0.000000 −1.027 −0.000000 0.309017 0.00 5.000000 3.951057 0.318 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 17.000000 0.000002 3.000000 0.000000 0.000000 0. .000000 0. .000000 0.309016 −0.00 0. . output for t = 1.00 4.951057 0.309016 −0.14 2.000001 3.i) u1 anal(it.00 0.309017 −0.000000 0.000000 0.000000 0.14 1.257 0.

that is. but with the x domain extended to −3π ≤ x ≤ 4π in order to demonstrate the traveling wave solution of eq. and the difference between the two solutions at .809015 0.14 5.m (refer to Listing 17.t). The preceding discussion was for ncase=11.3).14 4.027 0. (17.587785 −0.000003 3.000000 ncall=341 We can note the following points about this output: .951057 −0. Figures 17. t = 3. 12 [sin(x + ct) + sin(x − ct)].000002 3.809017 −0.951057 −0.t).000002 3. The computational effort is modest.14 4.12 (since the PDE is the same).1 for the complete listing of pde 1.309017 −0. the linear wave equation (17.084 0. Mth-Order Klein–Gordon Equation 319 Table 17.809017 −0.2 demonstrate that the solution is simply a standing sin wave in x from eq.999997 1.000002 3.655 0.m with t = 0).809014 0.1 and 17.000003 3. if(ncase==12) u1(1)=ua_12(x(1).2) over the domain 0 ≤ x ≤ 2π.14 is better than five figures.m are provided by ua 12.m).14 5.000002 3.341 0.3) (starting from t = 0) according to sin(x) cos(ct). which is again for eq. initially. u1(n)=ua_12(x(n). We now consider ncase=12.14 6.2) in pde 1. The BCs for ncase=12 in pde 1. only the positive portion of sin(x) is used (0 ≤ x ≤ π ) in order to simplify the plotted output. The plotted solutions follow.m to 0 ≤ x ≤ 2π . (17. end The programming of eq. Here we reproduce only the code for ncase=12 indicated in Listings 17.2).398 0.000001 3. This solution indicates the IC (t = 0) is sin(x). which then separates into two sine functions. 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).309016 0.14 4.m is the same for ncase=11. Chapter 17 . Also.2. The numerical and analytical solutions agree at t = 0 as expected (since both solutions are produced by ua 11.951054 0.969 0.951055 0.712 0.283 −0.14 5. with ncall = 341. (17.587783 0.000000 0. (17.1: (Continued) 3. the negative portion of the sin(x) could easily be included through a minor modification of ua 12. % % PDE if(ncase==11)|(ncase==12) for i=2:n-1 .14 5.000000 −0.m and uat 12.000000 −0.1 and 17.

t) 0 −0.4 0.m and uat 12. π/3. . 3π/3). lines – numerical.6 −0. n=151.2 for the complete listing of inital 1.6 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.8 −1 0 1 2 3 4 5 6 7 x FIGURE 17. ua 12. xu= 4*pi. u2t(i)=c2*u1xx(i).m are then used to set the ICs (with t0=0 from pde 1 main.2 −0.m).8 0.t0). end end In inital 1.2 u1(x. ncase = 11.320 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Klein–Gordon equation. we use −3π ≤ x ≤ 4π on 151 points (refer to Listing 17.m).1: 2D plot comparing the numerical and analytical solutions of eq.m for ncase=12. (17. o – analytical 1 0. if(ncase==12) xl=-3*pi. 2π/3.2) (for t = 0. u1t(i)=u2(i). if(ncase==12) u1(i)= ua_12(x(i).4 −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).m is a straightforward implementation of the second form of the solution of eq.5 u1 (x. (17. else sin1=0. 12 [sin(x + ct) + sin(x − ct)]. (17. Mth-Order Klein–Gordon Equation 321 Klein–Gordon equation 1 0.2: 3D plot of the numerical solution of eq. function uanal=ua_12(x. Chapter 17 . end if((x+c*t>0)&(x+c*t)<=pi) sin2=sin(x+c*t). else .3). u2(i)=uat_12(x(i).2).t0). t) 0 −0.5 −1 4 3 7 6 2 5 4 t 3 1 2 x 1 0 0 FIGURE 17. end Function ua 12.

2) is the same for ncase=11. function uanal=uat_12(x. if(ncase==12) tf=2*pi. tout=[t0:pi:tf]'.m for the analytical solution of eq. e.m follows. (17. (17.1)=ua_12(x(1).m is a straightforward implementation of the derivative (in t) of the second form of the solution of eq. LISTING 17.m for the derivative of the analytical solution of eq.g. LISTING 17. end if((x+c*t>0)&(x+c*t)<=pi) cos2=c*cos(x+c*t).322 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS sin2=0.3). Note that here we use only the positive portion of the sin(x) function. nout=3. else cos1=0.5*(sin1+sin2).5*(cos1+cos2). The velocity c in eq. 12 [sin(x + ct) + sin(x − ct)]. (17.c2=cˆ2. The additional coding in the main program pde 1 main. 0 ≤ x ≤ π for t = 0.. end The analytical solution is included in the output by using ua 12. % % Model parameters if(ncase==11)|(ncase==12)c=1. . if(ncase==12) u1(it. end uanal=0.12. else cos2=0.3). 2π . end uanal=0.6: Function uat 12.5: Function ua 12.end t is defined over the interval 0 ≤ t ≤ 2π for three outputs in the numerical and plotted output at t = 0. this restriction is imposed only to simplify the plotted solution.t(it)). Function ua 12. (17. π .m (for a comparison of the numerical and analytical solutions).3). ncall=0.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).

then demonstrated that it satisfies eq.numerical.i)=ua_12(x(i). To apply the method of assumed solutions or residual functions. end end The plot of the numerical and analytical solutions includes a label for the ncase=12. it is linear with constant coefficients and f (x. α = −1. we assumed eq. the required ICs and BCs can then be obtained from the assumed solution.n)=ua_12(x(n). we could assume a solution to the PDE that will in general not be correct (it was correct in the case of eq. err(it. i. We also developed two ICs from eq. We can note the following points about this output: . γ = 1 (which is nonlinear for m 6= 1). (17. for i=1:n u1_anal(it.2). 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 = 0) = 0. β = 0. t) = xn t n . r = 3.t(it)). elseif(ncase==12) title('Klein-Gordon equation. γ = 1.m is listed in Table 17. The plotted solutions follow in Figs.2) is quite straightforward. 17.2) by direct substitution.1) ua (x.1) with m = 2. (17. x < 0.e. The computational effort is modest. Case 2: Nonlinear PDE (ncase=2. m = 2. t ≥ 0 (17. (17.3) as a solution to eq.t(it)). Mth-Order Klein–Gordon Equation 323 u1(it. xu = 2π (ncase=11) or xl = −3π . Figure 17. To extend this procedure.i)-u1_anal(it. solid . t) 6= 0) We now consider ncase=2 for eq. a residual function will result that can then be included in the PDE to make the assumed solution exact. x > π (ncase=12).3 and 17. r = 3. (17.3) by setting t = 0 and two BCs from eq.7) . (17.3). xu = 4π with ua (x. o . (17.i)=u1(it. α = −1. 21 sin(x + ct) traveling right to left with velocity c and 12 sin(x − ct) traveling left to right with velocity c. this method of residual functions can also be applied to systems of PDEs. f (x. (17.3 demonstrates that the solution for the IC (t = 0) is sin(x).i).analytical') A portion of the numerical output from pde 1 main. β = 0. (17. If we substitute the assumed solution into the PDE. To summarize.4. Chapter 17 . t) = 0). The numerical and analytical solutions agree at t = 0 as expected. we start with an assumed solution to eq.3) by setting xl = 0. which then separates into two sine functions. which satisfies eq.28 is about three figures.2. Also. (17. 0 ≤ x ≤ 1.2). (17. between the two solutions at t = 6. but this was possible mainly because eq. with ncall = 840. ncase = 12. and the agreement .

00 7.425 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.743145 0.000000 0.770 0.i) u1 anal(it.000000 6.000017 6.094 0.00 0.000000 0.00 −3.000000 0.000000 0.692 0.000000 0.000000 0.000000 0.000000 0.000000 0.00 5.702 0.000000 0.00 −4.833 0.000000 0.571 1.00 8.000000 0.000000 0.000000 0.000000 0.00 12.000000 0.000000 0.827 0.00 −7.304 0.000000 0. .000000 0.000000 0.00 11.000000 0.000000 0.027 0.000793 0.000000 0.000000 0. .000000 0.435 0.100 0.00 −0. t x u1(it.000000 0.00 8.000000 0.00 0.000000 0.000000 0.000000 0.628 0.000000 0.294 0.959 0.226 0.000000 0.000000 0.743145 0.000000 0.i) u1 anal(it.000000 0.760 0.324 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 17.000000 0.969 0.000000 0.037 0.000000 0. .000000 0.00 3.000000 0. .00 −1.28 −9.00 9.000000 0.000000 0.000000 0.i) 0.000000 6.493 0.634 0.m for ncase=12 t x u1(it.000000 0.28 −8.00 −5.000793 .000000 0.743145 0.00 −5.00 −2.000000 0.000000 0.000000 0.00 1.000000 0. output for t = 3.000000 0.00 −2. .493 −0.000000 0.503 0.000000 0.2: Selected numerical output from the main program pde 1 main.000000 0.i) err(it. .000000 0.959 0.566 0.901 0.105 0.000000 0.00 11.14 removed .00 10.000000 0.000000 0.00 4.000000 0.168 0.00 −7.104528 0.838 0.000000 −0.361 0.000000 0.00 5.000000 0.000000 6.000000 0. .104528 0.000000 0.000000 0.00 −9.000000 0.00 −8.000000 0. .560 0.i) 6.000000 0.000000 0.000017 0.00 −6.104528 0.000000 0. .28 −7.000000 0.28 −7.000000 0.000000 0.000000 1.000000 0.00 3.000000 0.226 0.000000 0.000000 .000000 0.692 0.000000 0.367 0.00 6.425 0.104528 0.000000 0.000000 0.236 0.i) err(it.000000 0.00 2.000000 0.28 −6.000000 0.000000 0.743145 0.000000 0. .000000 0.

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).

is included in the output by using ua 3.i)=u1(it. The additional coding in the main program pde 1 main.a=-2. nout=5.g=1.1)=ua_3(x(1). (17. B=(b/g)ˆ0. end The analytical solution.t(it)).b=1. tout=[t0:1:tf]'.n)=ua_3(x(n). end end The plot of the numerical and analytical solutions includes a label for ncase=3. eq. % % Model parameters if(ncase==3)m=3.10: Function ua 2.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). function uanal=uat_3(x.c=0. Chapter 17 . err(it. for i=1:n u1_anal(it. (17.10).10).5.end t is defined over the interval 0 ≤ t ≤ 4 for five outputs in the numerical and plotted output at t = 0.t(it)).t(it)). .i)-u1_anal(it.m follows. ncall=0.i)=ua_3(x(i). u1(it. Mth-Order Klein–Gordon Equation 333 function uanal=ua_3(x. 4.m for the derivative of the analytical solution of eq.m for the analytical solution of eq. (17.m is a straightforward implementation of the derivative of the solution (in t) of eq.10).K=(-b/(2*(a+cˆ2)))ˆ0. (17. if(ncase==3) u1(it.5. 3. LISTING 17.i).5.10).m (for a com- parison of the numerical and analytical solutions).11: Function uat 3.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)). LISTING 17.5. if(ncase==3) tf=4. Function uat 3. 1. 2.5.

00 1.300 0. Table 17.000000 0. .00 0.000000 0.000000 4.196095 0.400 0.124594 0.000000 ncall = 1581 .00 0.000000 0.973506 1.m is listed in Table 17. and the agreement between the two solutions at t = 4 is about five figures.00 0. solid .00 0.124594 1.00 0.4.00 0.500 1.analytical') end A portion of the numerical output from pde 1 main.658293 −0.400 1.952272 −0.i) u1 anal(it.100 0.237302 0.200 1.00 0.334 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS elseif(ncase==3) title('Klein-Gordon equation.077209 0.000002 4.00 0.416196 0.270974 −0.000000 4.600 2.381770 1.000 0. ncase = 3.171787 5.i) err(it. .00 0.196095 0. .416196 0.000000 0. .00 0.171787 0.323399 0.700 2.numerical.000000 0.543516 1.237302 0.973508 −0.000000 4.077209 0.100 1.952267 3. .300 1.700 0.00 0.000000 0.00 0.900 0.243940 1.000000 0. .186174 3.155811 0.000000 0. The numerical and analytical solutions agree at t = 0 as expected.270974 2.000002 4.323399 0.000000 0.155811 0.000000 4.i) u1 anal(it.00 1.000004 4.381769 0.736934 1.800 3.00 0.000001 4.279655 0.186178 −0. 3 removed .736935 −0.000 5. o .000000 0.658292 2. . t x u1(it.368809 0. 2.00 0.i) 0.900 3.038519 0.116246 0. .368809 0. We can note the following points about this output: .200 0.000005 4.600 0.00 0.i) err(it.000000 0.116246 0.000 1.000001 4.500 0.00 0.i) 4.000000 0.00 0.543515 0.4: Selected numerical output from the main program pde 1 main.038519 0. output for t = 1.000 0.00 0.00 0.800 0.00 0.m for ncase=3 t x u1(it.243940 −0. .279655 0.000000 . .

we have again discussed the numerical solution of a PDE second order in t (eq.3. with .5 0.6)). Chapter 17 .4 0.6 0.1 0. the expected computational effort for a particular PDE is essentially unpredictable. thus.9) for t = 0. Mth-Order Klein–Gordon Equation 335 . . (17. The plotted solutions follow in Figs. 1. ncall = 1581.10). 17.7) indicates the close agreement between the numerical and analytical solutions of Table 17. The computational effort is above previous values (but still modest). 2. and the ICs and BCs were different. 4 (bottom to top). (17. ncase = 3. which is due in part to the smooth solution of eq.9 1 x FIGURE 17. (17.1)). Figure (17.7: 2D plot comparing the numerical and analytical solutions of eq.7 and 17. t) 3 2 1 0 0 0. As noted in Chapters 15 and 16. 3.3. and only m changed (from m = 2 to m = 3). Klein–Gordon equation. for ncase = 2. (17. even within apparently minor variations in the same problem. o – analytical 6 5 4 u1 (x. 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.7 0.8 0. In summary. The variation in ncall from 285 (ncase = 2) to 1581 (ncase = 3) indicates that the computational effort can vary substantially.1)) by restating the PDE as two PDEs first order in t (eq. Generally. the PDE is the same (eq.8. lines – numerical.3 0.2 0. (17.

but have not set values for α.4 x 0. t) 3 2 1 0 4 3 1 0. we see that application of the transformation u(x. which reduce the problem to ∂ 2u ∂ 2u + α 2 + βu + γ u3 = 0 (17. t) = U(ξ ). (17. The conditions for Case 1 reduce the problem to that of a linear wave. By inspection. The conditions for Case 2 are such that (intention- ally) we do not know how to obtain an analytical solution. Appendix We conclude this chapter with a traveling wave analysis of eq. where ξ = k(x − ct).8 2 0.12) dξ 2 . (17. Thus.8: 3D plot of the numerical solution of eq. reduces the PDE of eq. or γ .6 t 1 0.2 0 0 FIGURE 17. (17. the solution of which is well known.9). β. and therefore will not be detailed here.11) to the ODE d2 c2 k2 + αk2 U + βU + γ U 3 = 0 (17. we are left with Case 3 conditions.336 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Klein–Gordon equation 6 5 4 u1 (x.1).11) ∂t 2 ∂x where we have set f (x) = 0 and m = 3.

eq. After setting up the problem in Maple. The Maple code that derives solution eq.√ . be solved by the separation of variables method. in principle. set x0 = 0 and define c = −c. . we will obtain a traveling wave solution using our Maple procedure tanhMethod. Chapter 17 . However.16) and generates an animation and 3D plot is included under Listing 17. it cannot be readily solved for U. We choose the following solution √ √ ! 2 β (x + x0 − ct) 1 u = i β tanh p √ . (17. 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γ . (17. The tanh method is successful and finds seven solutions.15) γ p 2 α + c2 which on conversion to the tan function and rearranging becomes s s ! β β u= tan i (x + x0 − ct) . i. (17. Mth-Order Klein–Gordon Equation 337 which can.14) can be simplified slightly. However. and JacobiSN represents the elliptic function sn(z. m).16) γ 2 α + c2 If we bring i under the square-root sign. if we separate the variables and integrate twice. (17. also. −γ − 2β + γ C22 − (γ + 2β) γ where C1 and C2 are arbitrary constants. (17. eq. (17. with 0 < m < 1 being the elliptic modulus. some additional dis- cussion on this form of solution can be found in [4]. (17. three of which are trivial.12. so we abandon this analytical approach. 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. 1 ZZ ZZ −dUdU = 2 2 dξ dξ .16) matches the Case 3 solution.e.10).14) 2β βγ βγ β 2 c k − αk2 2 2 where K is an arbitrary constant.. We will not discuss this solution here. While eq. but more details can be found from the Maple help system and. Instead. (17.13) βU + γ U 3 c k + αk2 we obtain U ln β + γ U 2 γU ξ2 1 U ln(U) + arctan √ √ − = + Kξ.

16]. Dehghan. Zaitsev."t". 16].D.gamma:=1.HORIZONTAL. 16]. > plot3d(zz. 2004.16).100]. > animate(zz. [3] A. 16]. including eqns. ROMAN. However. New exact traveling wave solutions for the nonlinear Klein-Gordon equation. but it is included with the downloads for this book. labels=["x".x=0. 16]. shading=Z. intFlag:=0: # No integration of U(xi) needed ! M:=2..F.intFlag.c:=-0. App. ROMAN. > pde1:=subs({m=3.J.t)=0}. V..t)+alpha*diff(u. Comp. .. (17. New York. ROMAN.x. Handbook of Nonlinear Partial Differential Equations. ROMAN. [2] S. the code is not included here.pde1). 16].VERTICAL]. Zhang.12: Maple code used to generate analytical solutions to the the Klein–Gordon equation (Case 3). orientation=[-132. Turk.t=0. labeldirections=[HORIZONTAL.titlefont=[TIMES.t)"]. 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).f(x. J. an animation and 3D plot. thickness=3. # Set order of approximation infoLevOut:=2. J.4. Partial Differential Equations for Scientists and Engineers.titlefont=[TIMES.x=0. 230 (2009) 400–410. infoLevOut).frames=50."u(x.title="Klein-Gordon Equation") LISTING 17. > read("tanhMethod. > x0:=0.axes='framed'. style=patchnogrid. A.numpoints=100. Chapman & Hall/ CRC.4.t).alpha:=-2. labelfont=[TIMES.t.1.1.grid=[100. labelfont=[TIMES. ROMAN. FL. title="Klein-Gordon Equation"). Numerical solution of the nonlinear Klein-Gordon equation using radial basis functions. Farlow.x)+beta*u+gamma*uˆm=f(x. axesfont=[TIMES.beta:=1.tan).. [4] Z. t=0.pde1.77].5. > zz:=convert(rhs(sol[7]).txt"). ROMAN. Math. with(PDEtools): with(PolynomialTools): with(plots): > alias(u=u(x.10 and 17. > pde1:=diff(u. Boca Raton. 32 (2008) 235–240. References [1] M. Polyanin.5. Phys. Shokri. tanhMethod(M.axes=framed.t)):unprotect(gamma).338 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS > # Klein-Gordon Equation # Attempt at Malfliet's tanh solution restart. 1993 (Chapter 17). Dover Publications.5. axesfont=[TIMES.

t) ∂ 2 u(x = xu . t) = (3/2)(1 − c2 )sech2 (x − ct) 2 "p # 2 −2 1 − c2 = (3/2)(1 − c )cosh (x − ct) (18. The ODE routine for eqs.1) to (18.2) with t = 0.2).3) ∂t 2 2 Equation (18.1)–(18.1) is fourth order in x. Here we consider the particular equation [3. (18. t) = 0 (18.4) constitute the problem of interest and a method of lines (MOL) numerical solution is produced with the following Matlab routines. t) = =0 (18. (18. which follows from the derivative (in t) of eq.2) is a traveling wave solution from the argument x − ct. we require a second IC. .00018-2 339 Copyright © 2012 Elsevier Inc. An initial condition (IC) follows directly from eq. and the four required boundary conditions (BCs) are taken as u(x = xl . function ut=pde_1(t.u) % % Function pde_1 computes the t derivative vector for the Boussinesq % equation % .2) 2 where c is an arbitrary constant.4) is as follows.4b) ∂ 2 u(x = xl . All rights reserved. Since eq.1) is second order in t. We note that eq. (18.4d) ∂x2 ∂x2 Equations (18. t) 1 − c2 1 − c2 = (3/2)c(1 − c2 )3/2 sinh (x − ct) cosh−3 (x − ct) (18. 6] ∂ 2u ∂ 2u ∂ 4u ∂ 2 2 = − − u (18.1016/B978-0-12-384652-5.4a.1) ∂t 2 ∂x2 ∂x4 ∂x2 with the reported analytical solution [8] "p # 1 − c2 ua (x. (18. t) = u(x = xu . "p # "p # ∂ua (x. 18 Boussinesq Equation Several variants of the Boussinesq equation have been reported and discussed in the literature. (18. Traveling Wave Analysis of Partial Differential Equations DOI: 10.4c.

To select a particular case. % if(ncase==1)ut=pde_1a(t. discussed subsequently and passed as a global variable.u) % % Function pde_1 computes the t derivative vector for the Boussinesq % equation % global xl xu x n ncall % % Model parameters global c ncase . We can note the following details about pde 1. we consider pde 1a. for example. function ut=pde_1(t.end if(ncase==3)ut=pde_1c(t.m for eq.end if(ncase==4)ut=pde_1d(t.u).2.m: .end LISTING 18. these cases are programmed as a series of self-contained routines.3.m (for ncase=1) to pde 1d.1).u).m as in Listing 17.m for ncase=1. ∂ 4u Case 1: Direct Calculation of via u4x11p ∂x4 function ut=pde_1a(t. The function and some global variables are first defined.u).1) (ncase=1.end if(ncase==2)ut=pde_1b(t.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. (18.u).end if(ncase==2)ut=pde_1b(t.3.m (for ncase=4).1: Function pde 1. ncase is set to one of the values 1.4 in the main program.end if(ncase==4)ut=pde_1d(t. including all of the cases in pde 1.u) % % Function pde_1a computes the t derivative vector for the Boussinesq % equation % .end if(ncase==3)ut=pde_1c(t. pde 1 main.u).2.u).u).u).4). To start. Since four cases will be considered in the subsequent discussion. one at a time.end Then we can discuss the individual cases by examining the four routines pde 1a. Each of the four cases will be considered.m.

u2t=u1xx-u1xxxx-u1sxx. % % PDE u1t=u2.n. (18.ˆ2. The function and some global variables are defined.u1s.1) (ncase=1). Chapter 18 .xu. nl=1.u1. u1sxx=dss044(xl. % % (u1ˆ2)xx u1s=u1. u1sx(1)=0. u1xx=dss044(xl.25 (not required by u4x11p) % u1xx(1)=0.m for eq. % % BCs at x = -15. % u1xx(n)=0.u1).xu. ut(i+n)=u2t(i). nu=1.nu).u1x.1a: Function pde 1a.nu).n.25 u1(1)=0.nl. u2(i)=u(i+n). LISTING 18. % % Two vectors to one vector for i=1:n ut(i) =u1t(i). u1x(1)=0. end % % BCs at x = -15. u1(n)=0.u1sx.m: . end ut=ut'.xu. % % u1xxxx u1xxxx=u4x11p(xl.nl. We can note the following details about pde 1a. % % Increment calls to pde_1a ncall=ncall+1. function ut=pde_1a(t.n. Boussinesq Equation 341 global xl xu x n ncall % % One vector to two vectors for i=1:n u1(i)=u(i). nu=1.u) % % Function pde_1a computes the t derivative vector for the Boussinesq % equation % global xl xu x n ncall . % % u1xx nl=1.

nu=1.4b) are programmed and the second derivative ∂ 2u ∂x2 is computed with dss044 (with Dirichlet BCs designated by nl=1.25 (not required by u4x11p) % u1xx(1)=0. ∂2 The nonlinear term 2 u2 in eq. u1xx=dss044(xl. nl=1. % % u1xx nl=1.g. % u1xx(n)=0.n.342 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS . As in the preceding chapters (e. .u2. % % One vector to two vectors for i=1:n u1(i)=u(i). ∂ 4u ∂x4 is computed by u4x11p.nu).u1).m (the origin of this routine is discussed in Chapter 12 and in further detail next).xu.u1.ˆ2. % % BCs at x = -15.nl. (18. then taking its second derivative with dss044 (note that u1 is the RHS dependent variable u of eq. BCs (18.4a) and (18.n. .1) is computed by first squaring the solution ∂x (u2 = u1s).m. so a library ODE integrator such as ode45 or ode15s can be used to move the equations through t.u2 are dependent variables first order in t. BCs (18. (18. u1(n)=0.xu. end u1. u1x(1)=0.. 16 and 17) for PDEs second order in t.nu=1).1)). the solution vector u is placed in two arrays u1. u2(i)=u(i+n). . nu=1.u1x. % % (u1ˆ2)xx u1s=u1.25 u1(1)=0. . % % u1xxxx u1xxxx=u4x11p(xl. % % BCs at x = -15. 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.4d) are not used (note the comments) since they are not required by u4x11p.4c) and (18.

m and integrated by ode45 or ode15s in the main program pde 1 main. (18. % % Increment calls to pde_1a ncall=ncall+1.xu. equally spaced grid for i=1:11 x(i)=i-1.n. ut(i+n)=u2t(i). end % . % % PDE u1t=u2.u1sx.xu.u) % % Function u4x11p computes the derivative uxxxx based on 11 points global ncall CC % % For the first call to u4x11p (ncall = 0).m for the calculation of based on an 11-point FD approximation follows. % % Two vectors to one vector for i=1:n ut(i) =u1t(i). ∂2 u2 . u1t. ∂x 2 Equation (18. . Boussinesq Equation 343 u1sx(1)=0. The two derivative vectors. The number of calls to pde 1a. ∂ 4u u4x11p.m receives the dependent variable vector u as an input (along with the independent variable t) and returns the derivative vector ut. pde 1a.1) is programmed as two first-order PDEs in t. is placed in array u1sxx. a transpose is required by these integrators (so that ut is a column vector). In summary.n.u2t are placed in a single derivative vector ut to be returned from pde 1a. compute the FD weighting % coefficients % if(ncall==0) % % Default points.nu).1). The nonlinear term of eq.m (note that ncall is a global variable). end ut=ut'. u1sxx=dss044(xl.nl. u2t=u1xx-u1xxxx-u1sxx. .m.m is incremented for display at the end of the solution in the main program pde 1 main. Chapter 18 .u1s. ∂x4 function uxxxx=u4x11p(xl.

% % Number of grid points ng=11. ng = 11 % CC(:.ng-1.x. (CC(6. +CC(6.5)*u(i-2).. % % Coefficients in u5x11p.5)*u(i-4).3.. +CC(6...6. 4 % for i=1:m+1 % % Display coefficients for derivative of order 4 i=m+1. +CC(6.4.5)*u(i-3).. nd=ng.5)*u(i+1). % % At the right end..i)*8 % end % % Calculation of FD weights complete end % % uxxx % Spatial increment dx=(xu-xl)/(n-1).0/dxˆ4.1.nd-1. 3. 2. uxxxx = 0 if(i<6)uxxxx(i)=0.5.. +CC(6.:.:.:. % % Interior points else uxxxx(i)=rdx4*..m with m = 4. end % % Display coefficients for derivatives of orders 0. uxxxx = 0 elseif(i>(n-5))uxxxx(i)=0.i-1). rdx4=1.2. +CC(6.7.5)*u(i-1). fprintf('\n\n Numerical Derivative Order: %d'. .0..0.5)*u(i ).. fprintf('\n=============================\n')..344 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS % Compute FD approximation for up to and including the mth % derivative m=4.i)*8 CC(6. for i=1:n % % At the left end.5)*u(i-5). 1. % % Compute weighting coefficients for finite differences % over ip points for ip=1:ng % % Weighting coefficients in array CC CC(ip.. +CC(6.m).....:)=weights(x(ip).

Boussinesq Equation 345 +CC(6.9. The finite difference (FD) weighting coefficients are computed by weights over the 11-point grid (ng=11).nd-1. is computed over n grid points (n is an input parameter to u4x11p).5)*u(i+3). (18. uxxxx. Chapter 18 . compute the FD weighting % coefficients % if(ncall==0) % % Default points.2: Function u4x11p. the 11-point FD computational grid is defined during the first call to u4x11p.n.x.5)*u(i+4). Here we note just a few details ∂ 4u specific to the calculation of 4 on 11-points. +CC(6.0/dxˆ4. +CC(6.8. function uxxxx=u4x11p(xl. After the function is defined.:.ng-1..m is discussed in some detail in Chapter 12. ∂x . rdx4=1. end . equally spaced grid for i=1:11 x(i)=i-1... A fourth-order derivative is then specified.u) . . end end ∂4u LISTING 18.11. . for ip=1:ng % % Weighting coefficients in array CC CC(ip. % % uxxx % Spatial increment dx=(xu-xl)/(n-1). . ∂x4 The origin of routines for the calculation of higher order derivatives in x based on func- tion weights. % % For the first call to u4x11p (ncall = 0).m for in eq.5)*u(i+5)).:)=weights(x(ip). end % % Compute FD approximation for up to and including the mth % derivative m=4..1).xu. .m). +CC(6.10.5)*u(i+2).. The fourth derivative..

. +CC(6..5)*u(i+3). +CC(6.3...4).2. uxxxx = 0 elseif(i>(n-5))uxxxx(i)=0..6.xu. inital 1c.m for ncase = 1.4.5)*u(i ).3a: IC function inital 1. These conditions are satisfied by the solution of eq.m from eq. +CC(6.5)*u(i+2). but this also means u4x11p can be used only when the solution satisfies this condition..8.end if(ncase==4)u0=inital_1d(t0). and inital 1d. This was done to minimize any spurious end effects at x=xl.. we continue the discussion for ncase=2.. % % At the right end.n-1.3. +CC(6. inital 1b. +CC(6.3..5)*u(i-4). +CC(6.m.2...5)*u(i-2). +CC(6.3.2) with t = 0 (for ncase=1.1..m uses one of four initial condition routines.. (18. this requires that the solution at the end points does not move away from its IC values for t > 0. +CC(6..2. uxxxx = 0 if(i<6)uxxxx(i)=0..n-2. end Note that for the grid points i=1. After looking at the output for this case. For ncase=1.end if(ncase==3)u0=inital_1c(t0). 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).0.n.0.3..7. and 4.. and the derivatives in x of the solution are effectively zero. (18.. function inital 1a.5)*u(i+1).5 and i=n-4.5)*u(i-1)..346 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS for i=1:n % % At the left end. .9..end if(ncase==2)u0=inital_1b(t0). +CC(6.5)*u(i+4).11. uxxxx is set to zero.5. (CC(6. +CC(6.m is used. Generally..end LISTING 18. We now consider the other routines for the case ncase=1.2) as will be observed in the computed output. respectively.4.n-3.m. inital 1a.5)*u(i-3).2.4. % % Interior points else uxxxx(i)=rdx4*.m..5)*u(i-5).10.5)*u(i+5)). The IC function inital 1.

We can note the following details about inital 1a. The function and some global variables are defined. eq. the initial values of u1 for eq. n=101. u0(i+n)=u2(i). A grid in x of 101 points is defined for −15 ≤ x ≤ 25. xu= 25.3)). dx=(xu-xl)/(n-1). xu= 25.t0).m from eq.2) with respect to t.m (which has the programming for the derivative of eq.3b: IC function inital 1a. n=101.m: . Chapter 18 . . (18. % % ICs from analytical solution for i=1:n x(i)=xl+(i-1)*dx. In the for loop. (18. the initial values of u2 are provided by the function uat 1a.t0).1) are provided by the function ua 1a. % % Spatial domain and initial condition xl=-15. (18. u2(i)=uat_1a(x(i). u0(i) =u1(i). u1(i)= ua_1a(x(i).2) with t = 0 (for ncase=1). 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. . 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. dx=(xu-xl)/(n-1). (18. end LISTING 18.m (which has the programming of eq. (18.2) with t = 0).

m.4b: Function uat 1a. u0(i) =u1(i). are identical to uat 1a.m. are identical to ua 1.m for the analytical solution of eq. uanal=(3/2)*c*(1-cˆ2)ˆ(3/2)*sinh(xi)*(cosh(xi))ˆ(-3). function uanal=uat_1a(x.m discussed subsequently. if the ICs change from case to case.t0).3a are the same as inital 1a. and inital 1d. Three other IC functions inital 1b.m. and uat 1d.m is a straightforward implementation of the derivative (in t) of eq.m called by inital 1b. LISTING 18.348 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS u1(i)= ua_1a(x(i).m. and three functions uat 1b. and inital 1d. inital 1c.m in Listing 18.m called by ini- tal 1. and inital 1d.m.5)/2*(x-c*t). function uanal=ua_1a(x. u2(i)=uat_1a(x(i). inital 1c. inital 1c. this can easily be included in the four IC routines.m in Listing 18.m. three other IC functions ua 1b. Function ua 1a.m.m in Listing 18. uanal=(3/2)*(1-cˆ2)*(cosh(xi))ˆ(-2). and ua 1d.5)/2*(x-c*t).3).3). eq.4a: Function ua 1a. end All 2n initial condition values are returned from inital 1a.4a. Of course.m called by inital 1b.m is a straightforward implementation of eq.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. respectively.4b. (18. The repetition of .4) self-contained as explained previously. Function uat 1a.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.3. Again. u0(i+n)=u2(i).m. LISTING 18. respectively. (18.m.m through the vector u0 to the main program pde 1 main. The repetition of these IC routines is done in order to make the coding for each case (ncase=1.m. (18.2). ua 1c.m in Listing 18.m.t0). uat 1c.3b and are therefore not listed in the subsequent discussion.2.m. (18.m for the derivative of the analytical solution.2).

2.i) err(it.nout=4. (18.nout=4.i)\n').tout=[t0:3:tf]'. and the numerical solution is plotted in 3D by surf. end if(ncase==2) tf=9. % ncase=2. % ncase=3. end if(ncase==4) tf=9.nout=4.3. If the analytical solution changes from case to case.m accommodates the cases ncase=1.i) u1_anal(it. The range in t is the same for ncase=1. % % Model parameters global c ncase % % Select case % ncase=1. Chapter 18 . % % Independent variable for ODE integration if(ncase==1) tf=9. .end if(ncase==4)c=0. . The parameters are set for ncase=1.ncall=0.9. The difference in the numerical and analytical solutions is computed as err(it. end .1)– (18.9.4.3. This main program closely parallels pde 1 main.4) self-contained as explained previously. Boussinesq Equation 349 these IC routines is also done in order to make the coding for each case (ncase=1.9. but the range could easily be changed from case to case. end if(ncase==3) tf=9.4 for eqs. These solutions are then plotted in 2D by plot.ncall=0.tout=[t0:3:tf]'. % % Model parameters if(ncase==1)c=0.i) and displayed.2. ncase=4.2.m of Chapter 15 and therefore only a few features are discussed here.ncall=0.ncall=0.9.3.tout=[t0:3:tf]'.nout=4.2.4.end if(ncase==3)c=0.end . % % Display selected output for it=1:nout fprintf('\n t x u1(it. Main program pde 1 main.end if(ncase==2)c=0.4).3.tout=[t0:3:tf]'. this can easily be included in the four analytical solution routines and the four derivative routines.

num. t = 0. 3..u1(it.anal') end if(ncase==2) title('Boussinesq equation. Another way to visualize the FD weighting coefficients is to note that the coefficients are symmetric about the n = 6 value 101. end end fprintf(' ncall = %4d\n\n'.i).350 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS for i=1:5:n fprintf('%6.6f%15. ncase = 2.3f%15.. % % Plot numerical and analytical solutions figure(2) plot(x. o . A portion of the numerical output from pde 1 main. t = 0.'o') xlabel('x') ylabel('u1(x. except at these 10 .anal') end figure(3) surf(x.u1_anal(it.i). 5 and i = 7. o ..num. 4. 3.ncall). solid . which is to be expected for a FD approximation of a derivative of even order (in this case. 9. 11 in the basic grid. solid . ylabel('t').anal') end if(ncase==3) title('Boussinesq equation. 6. 9. 9.m indi- cates two bands for PDE (18. grid point 6 in the total of 11 points (recall that uxxxx is set to zero in u4x11p. 6.t.u1) xlabel('x'). Also. 9..m for i = 1. 3. o . t = 0. also.m for the sparse matrix integration of the ODEs is not listed here since it is the same as for Chapters 15–17.9333. solid . The FD weighting coefficients produced by weights. zlabel('u1(x. ncase = 3.num.1) as expected. We can note the following points about this output: . t(it).x(i).2f%8. these are the coefficients only for the center point in the spatial grid.err(it. 6. t = 0. and the map is therefore not included in the discussion of the output that follows.x.m are displayed first (these can easily be suppressed by a small change in u4x11p. .anal') end if(ncase==4) title('Boussinesq equation. i. 2. fourth order). o .6f\n'.u1. ncase = 4.m is listed in Table 18.u1_anal.6f%15.'-'. the center coefficients are used throughout the grid with more than 11 points. solid .t)').num. The ODE Jacobian map from jpattern num 1. jpattern num 1.1a for ncase=1.t)') if(ncase==1) title('Boussinesq equation. 6.e. such as n = 101 in the preceding example for ncase=1. 3. 3.m). 9. ncase = 1.i)). title('Boussinesq equation'). 8. end values that are zeroed). 10.

000000 0. .049162 0.001645 0.000288 0.1778 27.000 0.00 −7.009277 0.00 −7.000021 0.000 0.000249 0.0434 0.i) u1 anal(it.000 0.000289 9.00 −11.00 13.000000 0.000 0.049162 0.271880 0.00 21.9333 −74.000000 0.000 0.1524 Columns 10 through 11 0.271880 0. 6 removed .000365 9.009277 0.000050 0.000 0.000 −0.001645 0.00 −15.000000 0.00 1.000689 0. .271880 0.000660 −0.00 −5. .003917 0.021685 0.7397 −5.000 0.001575 −0.000048 0.000000 0.003917 0.000000 0.000048 0.191019 0.000678 9. t x u1(it.000 0.003917 0.021685 0.i) 0.00 3.000121 0.000000 0.0434 t x u1(it.7397 −74.00 15. .000050 0.i) err(it.000689 0.000115 −0.000000 0.1524 27.271880 0.000000 0.000 0.001645 0.000000 0.000 0.i) u1 anal(it.00 −9.i) err(it.104066 0.009277 0.000 −0.000 0.6672 −5. output for t = 3.021685 0.000000 .000 0.000 0.00 17.00 −13.104066 0.000540 (Continued ) .6672 −0.000021 0.021685 0.00 −11.000 0. Chapter 18 .000000 0.1a: Selected numerical output from the main program pde 1 main.001035 0.104066 0.000019 0.00 5.00 −3.000000 9.00 25.191019 0.104066 0.000 0.000 0.009277 0.000276 0.00 11.191019 0.i) 9.001645 0.000000 0.000 0.000565 0.00 −9.000000 0.000 0. . .000000 0.000 0.000288 0.000000 0. . . .m for ncase=1 Numerical Derivative Order: 4 ============================= ans = Columns 1 through 9 −0.00 7.000121 0.000000 0.000 0.000 0.00 −15.00 −1.00 23.00 −13.049162 0.000000 0.000 0. Boussinesq Equation 351 Table 18.049162 0.000 0.003917 0.00 9.191019 0.1778 101.000000 0.000 0.00 19. .000000 0.000000 0.

000 0.047247 −0.022371 0.000 0.000 0.000 0.051146 0.1d Figure 18.004090 −0.008887 −0.00 5. between the two solutions at t = 9 is about three figures.000090 9.000218 9.003283 0.1a: .00 −3.004000 0.2) (starting from t = 0) from the argument of x − ct in eq.051283 0.000 0.2a 2 b Figure 18. 18.275694 0.022612 −0.003751 −0.022112 0.00 9.2a.i) err(it. The plotted solutions follow in Figs.00 3.00 19. The computational effort is modest.1a demonstrates that the solution is a traveling wave in x from eq.00 −1.000928 9.000 0.020794 0.008324 0.m.m set the boundary values equal to the analytical solution .00 21.000 0. with ncall = 963.000468 9.000000 ncall = 963 . (18.000720 0.000720 0.000 0.001454 0.187166 0. The numerical and analytical solutions agree at t = 0 as expected.2).00 23.000 0.i) u1 anal(it.00 1.100279 0.2b 3 c none none 4 d Figure 18.2d Figure 18.00 −5.1a: (Continued) t x u1(it.274310 0.000682 9.00 25.1b Figure 18.107725 0.000563 9. and the agreement .046565 0. 18.00 15. The agreement of the numerical and analytical solutions as reflected in Table 18.000240 9.000 0.00 11.i) 9.000 0.001718 −0.001318 9.000895 9.00 7.000056 9.000 0.001384 9.000 0.1a and 18.1a Figure 18. (18.009739 0.000 0.352 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 18.267848 0.000 0.009683 0.00 13. The numerical and analytical solutions agree exactly at the boundaries x = xl = −15.001379 9.194903 0.000136 9. This is done because although the Dirichlet BCs in pde 1.269227 −0.108027 0.100497 −0. which results from setting the two solutions equal at the boundaries in the main program. x = xu = 25. Note plots are organized as follows: Letter Case designation 2D plot 3D plot 1 a Figure 18. We can note the following details about Fig. pde 1 main.000302 9. evident.195798 −0.1a is .000 0.00 17.186238 0.000264 9.

a boundary value). 6. (18. including the fourth derivative. In other words.05 0 −0. (by using ua 1a.1 units in x while the right boundary is at xu = 25). 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.1) for t = 0. 9 (left to right). that is. (18. This is taken as justification for setting uxxxx=0 in u4x11p. x = xu is small (effectively zero) because the nonzero portion of the solution traveling left to right at velocity c = 0.3 0. lines – numerical.m of Listing 18. in other words.4. 3. The slope of the solution at the boundaries x = xl . this value is not returned by ode15s. which is a characteristic of the Matlab ODE integrators. ncase = 1.2 as discussed previously.3.25 0. We now con- sider the other three cases ncase=2.4). but do not actually work). o – analytical 0.m of Listing 18. .2) and for BCs (18. if a dependent variable is set in the ODE routine (e.9 in eq. remain essentially at zero for t ≤ 9. which basically reflect variations in the MOL coding in the ODE routine to illustrate alternate approaches. rather an ODE dependent variable can only be computed from its ..1a.9 does not reach the right boundary at t = 9 (ct = (0. associated ODE programmed in the ODE routine.m).1) with c = 0.2 0.g. the derivatives in x of the solution at xu = 25. The preceding discussion was for ncase=1. these boundary values are not returned to the main program (from ode15s). eq.05 −15 −10 −5 0 5 10 15 20 25 x FIGURE 18. t) 0.1 0. Chapter 18 . with the MOL calculations in pde 1a.9)(9) = 8. Boussinesq Equation 353 Boussinesq equation. (18.15 u1 (x.1a: 2D plot comparing the numerical and analytical solutions of eq.

u2(i)=u(i+n).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).25 0.05 0 8 25 6 20 15 t 4 10 5 0 2 −5 x −10 0 −15 FIGURE 18. ∂ 4u ∂ 2u Case 2: Calculation of via two-stage Differentiation of ∂x4 ∂x2 We start with the case ncase=2 in pde 1b. (18.1 0.2 0. % % u1xx . function ut=pde_1b(t. u1(n)=0. end % % BCs at x = -15.15 u1 (x.354 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Boussinesq equation 0.2a: 3D plot of the numerical solution of eq.m.25 u1(1)=0.1). t) 0.

u1xx(n)=0.ˆ2. u1xxxx=dss044(xl.nu). u1xx=dss044(xl.u1s. % % u1xxxx u1xxx(1)=0. % % BCs at x = -15. % % Increment calls to pde_1b ncall=ncall+1. The initial coding is the same as in pde 1a.n. We can note the following details about pde 1b.nl. % % (u1ˆ2)xx u1s=u1. % % Two vectors to one vector for i=1:n ut(i) =u1t(i).nu). % % PDE u1t=u2.u1sx. ut(i+n)=u2t(i).u1x.xu.1b: Function pde 1b.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). u2(i)=u(i+n). u2t=u1xx-u1xxxx-u1sxx. end . nu=1. nl=1.n.u1.1) (ncase=2).xu. u1sx(1)=0.nl.25 (used by dss044) u1xx(1)=0.u2 of length n. end ut=ut'.u1xx. Chapter 18 . LISTING 18. nu=1. (18. function ut=pde_1b(t. u1sxx=dss044(xl.xu.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.m for eq.m of Listing 18.u1xxx.nu). u1x(1)=0.n.m: . Boussinesq Equation 355 nl=1.nl.

4d) are set. u1x(1)=0.m. Finally.m. .u1xx. the coding in the main program pde 1 main. and the second derivative ∂ 2u ∂x2 is computed by dss044.4b) are set.nu).4d) are Dirichlet for the fourth derivative (nl=nu=1 in .4c) and (18. A portion of the numerical output from pde 1 main. The remainder of pde 1b is the same as pde 1a.u1. u1(n)=0. ut(i+n)=u2t(i).m for ncase=2 directly parallels that for ncase=1 and therefore it will not be discussed. end ut=ut'. inital 1b.m.m is listed in Table 18. that is.nl. u2t=u1xx-u1xxxx-u1sxx. % % BCs at x = -15. respectively.356 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS . this arrangement of a complete set of subordinate routines for each case provides for max- imum flexibility and clarity.n. Dirichlet BCs (18. u1xx(n)=0. % % PDE u1t=u2. ua 1a.4a) and (18.m. u1xx=dss044(xl. % % BCs at x = -15. using dss044 the second time).nu).25 (used by dss044) u1xx(1)=0. and the fourth derivative ∂ 4u ∂x4 is computed by a second application of dss044 to the second derivative.u1x. and uat 1b. % % u1xx nl=1.nl.25 u1(1)=0. nu=1. so-called stagewise differentiaion.4c) and (18. % % u1xxxx u1xxx(1)=0.xu.n. . ua 1b. are the same as inital 1a. and uat 1a.u1xxx.xu. % % Two vectors to one vector for i=1:n ut(i) =u1t(i). BCs (18. Note that BCs (18.1b for ncase=2. u1xxxx=dss044(xl.m. % % Increment calls to pde_1b The other routines for ncase=2 are the same as for ncase=1.m.

00 11.008887 −0.000 0.000197 9.000298 0.003917 0.104066 0.000115 −0.008681 0.000 0.000000 0.195798 −0.00 5.000 0. .049162 0.000000 0.000 0.021082 0. .021685 0.000255 9.000000 0.000 0. .000 0.000000 0.021685 0.00 1.00 11.00 −15.000288 9.000000 0.000 0.000050 0. . output for t = 3.003917 0.000 0.000050 0.00 −5.00 −3.000 0.00 −9.003215 0.191019 0.000121 0. .009277 0.000 0.001645 0.000400 9.009277 0.000 0.047473 0.104066 0.274227 0.104066 0.00 25.000015 0.00 17.049162 0.00 1.00 7.000079 0.049162 0.000 0.000000 0.00 9.000021 0.195772 0.191019 0. Chapter 18 .100097 0.003917 0.009277 0.00 −15.000000 0.191019 0. t x u1(it. .00 3.i) u1 anal(it.i) err(it. .274310 −0.001575 −0.i) u1 anal(it.000660 −0.000 0.000000 0.000 0.000 0.00 −9.021685 0.269387 0.000000 0.00 −11.271880 0.000000 . 6 removed .003751 −0.000 0.000021 0.000000 0.000121 0.186238 0.049162 0.000 0.000689 0.191019 0.000160 9.020794 0.00 −13.271880 0.000 0.000288 0.i) 0.00 3.000 0.001645 0.000 0. .000361 9.000288 0.00 15.000 0.000000 0.00 5.000532 9. .00 21.000 0.000000 0.1b: Selected numerical output from the main program pde 1 main.000536 9.000000 0.000000 0.000276 −0.00 23.003917 0.00 −11.00 −3.000 0.00 −7.000 0.000 0.00 −5.00 −7.m for ncase=2 t x u1(it. .00 −1.000 0.000000 0.000 0.000 0.100497 −0.00 −1.000 0.000 0.000000 0.001043 0.009277 0.104066 0. Boussinesq Equation 357 Table 18.000689 0.i) err(it.i) 9.000048 0.000225 9.186493 0.00 −13.000000 9.001645 0.000 0.000 0.000000 0.271880 0.000000 0.00 7.000207 9.000 0.000 0.021685 0.000101 9.00 19.000000 0.271880 0.001645 0.000000 0.000026 (Continued ) .269227 0.00 13.000083 9.000048 0.00 9.047247 0.000 0.

004207 0. and the agreement .107725 −0.i) 9.000087 9. with ncall = 1004.1a.15 u1 (x.000117 9.358 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 18. (18.2) (starting from t = 0) from the argument of x − ct in eq. 18.05 −15 −10 −5 0 5 10 15 20 25 x FIGURE 18. Figure 18. (18.001718 −0.00 21. o – analytical 0.009621 0.000450 9.00 13. t) 0.00 19.000 0.000 0.05 0 −0.000 0. ncase = 2. .1b: 2D plot comparing the numerical and analytical solutions of eq.1b and 18.001272 0.000062 9.00 25.000 0.1) for t = 0.1b: (Continued) t x u1(it. The plotted solutions are included in Figs.000 0.2).1b again demon- strates that the solution is a traveling wave in x from eq.i) u1 anal(it.022612 −0. The computational effort is modest. between the two solutions at t = 9 is about three figures.1 0.i) err(it.051146 0.3 0.009683 −0.004090 0. We can note the following points about this output: .107275 0. this plot is very similar to Fig. 18.00 23.000000 ncall = 1004 Boussinesq equation. (18.000720 0.00 15.2 0.000338 9. lines – numerical.25 0.000 0. 6.00 17.000 0.022524 0.000720 0. 9 (left to right).2b.051484 0. 3. The numerical and analytical solutions agree at t = 0 as expected.000445 9.

18.1b: . 18.1 0.1). The discussion of Fig. The agreement of the numerical and analytical solutions as reflected in Table 18. t) 0.1b.2 u1(x.2a.15 0. ∂ 4u ∂u Case 3: Calculation of 4 via Four-Stage Differentiation of ∂x ∂x As a third approach to a numerical solution (ncase=3). (18. evident. Boussinesq Equation 359 Boussinesq equation 0.u) % % Function pde_1c computes the t derivative vector for the Boussinesq % equation % global xl xu x n ncall . (18.05 0 8 25 6 20 15 4 10 t 5 2 0 −5 x −10 0 −15 FIGURE 18.2b: 3D plot of the numerical solution of eq. We can note the following details about Fig.1) using the first derivative routine dss004. In particular.25 0. This plot is very similar to Fig. 18. function ut=pde_1c(t. Chapter 18 .1a applies also to Fig. we now use four successive (stage- wise) derivative calculations to arrive at the fourth derivative in eq.m listed below. which is pde 1c. x = xu = 25 is essentially zero.1b is . 18. except the ODE derivative routine. the slope of the solution at the end points x = xl = −15. All of the preceding routines remain unchanged.

m for eq. nl=1. LISTING 18. u1xx(n)=0.xu. end % % BCs at x = -15. u1(n)=0. u2t=u1xx-u1xxxx-u1sxx. nu=1.1) (ncase=3).n. u1sxx=dss044(xl.n.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).u1xx).n. % % PDE u1t=u2. % % u1xxxx u1xxxx=dss004(xl. % % Two vectors to one vector for i=1:n ut(i) =u1t(i).xu. % % BCs at x = -15. % % u1xxx u1xxx=dss004(xl.xu.xu.u1).25 u1(1)=0.ˆ2. (18.xu.u1sx. ut(i+n)=u2t(i). % % (u1ˆ2)xx u1s=u1. % % u1xx u1xx=dss004(xl. u2(i)=u(i+n).u1xxx).nu).u1s. % % Increment calls to pde_1c ncall=ncall+1.nl. end ut=ut'. % % u1x u1x=dss004(xl.1c: Function pde 1c. .n. u1sx(1)=0.u1x).25 u1xx(1)=0.n.

xu.4a).n. % % u1xx u1xx=dss004(xl.u1). % % u1x u1x=dss004(xl.n. Chapter 18 .m of Listing 18.25 u1xx(1)=0. . BCs (18. The initial coding is the same as in pde 1a. u1(n)=0.u1xx).4b) are set and the second derivative ∂ 2u ∂x2 is computed by using dss004 twice.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. end . (18.n.xu.xu.4d) are set and the fourth derivative ∂ 4u ∂x4 is computed by two additional applications of dss004 differentiation. % % BCs at x = -15.n. Dirichlet BCs (18. % % u1xxxx u1xxxx=dss004(xl.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).25 u1(1)=0. % % BCs at x = -15.u1x). u1xx(n)=0. % % u1xxx u1xxx=dss004(xl. Boussinesq Equation 361 We can note the following details about pde 1c.4c) and (18.m: . . u2(i)=u(i+n). function ut=pde_1c(t.xu.u1xxx).u2 of length n.

m. before dss004 is applied a third time to compute the third . When the routines were executed with a final time 6. This example illustrates some generalizations we have experienced in the analysis of PDE systems: .m. four-stage differentiation failed.m. ua 1a. Various attempts to overcome the integration error. Thus we concluded that although the use of stagewise differentiation four times to arrive at the fourth derivative of eq.4d) reset the boundary values of the second derivative.m. as mentioned previously. for example. pde 1 main. % % Increment calls to pde_1c ncall=ncall+1. derivative. uxxx. Finally. the MOL is not a mechanical procedure that is guaranteed in advance to produce a numerical solution to a new problem. such as reducing the error tol- erances for ode15s. % % Two vectors to one vector for i=1:n ut(i) =u1t(i). the numerical solution developed an oscillation (that apparently grew in magnitude to cause an integration failure for t > 6). . When the routines for ncase=3 (with the designation “c”) were executed.4c) and (18.2. The other routines for ncase=3 are the same as for ncase=1. Some experimentation with various numerical approaches may be required before a successful method is developed. Numerical methods (algorithms) that seem logical may in fact not work for reasons that are not apparent. end ut=ut'. % % PDE u1t=u2. in fact. at least within the MOL context. respectively.2 and therefore will not be discussed.m. rather each new problem must be approached numerically as an experiment that may fail. (18. and uat 1a. in which case an alternative approach must be developed.m for ncase=3 directly parallels that for ncase=1. this arrangement of a complete set of subordinate routines for each case provides for maximum flexibility and clarity.1) seems logical (at least mathematically). ua 1c. u2t=u1xx-u1xxxx-u1sxx. ut(i+n)=u2t(i). uxx(1) and uxx(n). In the present case. the coding in the main pro- gram pde 1 main. In other words. failed in the same way.362 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Note that BCs (18. and uat 1c.m. The remainder of pde 1c is the same as pde 1a and pde 1b. inital 1c.m could not be satisfied when the integration step t was reduced to the minimum allow- able value). are the same as inital 1a.m. In other words. it failed. 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. we cannot offer an explanation for why the . a successful outcome cannot be assured in advance.

m listed next (only the ODE routine for ncase=4 is different than the preceding routines for ncase=1. The use of established quality routines. to demonstrate the ease in programming this modification as an indication of the flexibility of the MOL approach. . are increasingly challenging as the order is increased. such as ode15s. Boussinesq Equation 363 On the other hand. Case 4: Preceding Problem with Second Derivative BCs Replaced by (First Derivative) Neumann BCs To conclude this discussion. our experience has indicated that MOL analysis can be applied .2. (18. t) ∂u(x = xu . u2(i)=u(i+n). which is pde 1d.1) with the homogeneous second derivative BCs of eqs. specifically. increases the chances of a successful outcome. All of the pre- ceding routines remain unchanged except the ODE derivative routine. and computational difficulties that might not occur to a less experienced analyst. This conclusion follows from the careful coding and testing of library routines by experts who anticipate and try to circumvent algorithm limitations . t) = =0 (18. u1(n)=0. end % % BCs at x = -15. function ut=pde_1d(t. (18.xu.25 u1(1)=0. Chapter 18 .n. (18. % % u1x u1x=dss004(xl. such as eq.4c) and (18. PDEs with higher derivatives. we consider one more case (ncase=4) for eq.1) with the fourth-order derivative in x. at least within the MOL framework based on finite differences. successfully to a broad spectrum of PDE problems.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).u1).3).4e.4d) replaced with the homogeneous Neumann BCs ∂u(x = xl .4f) ∂x ∂x The intention in using this modified problem is essentially to demonstrate another application of MOL analysis and.

nu). % % Two vectors to one vector for i=1:n ut(i) =u1t(i).ˆ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. % % Increment calls to pde_1d ncall=ncall+1. u1sx(1)=0.m for eq. nu=2.nl.u1.xu. % % u1xx nl=2. % % (u1ˆ2)xx u1s=u1.n. function ut=pde_1d(t.u1x).25 u1x(1)=0. We can note the following details about pde 1d. nl=1.nu).n.n.1d: Function pde 1d.m: . (18. The initial coding is the same as in pde 1a.nl. end .xu. u1xx=dss044(xl.364 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS % % 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). u1x(n)=0.u1x.u1s. end ut=ut'.m of Listing 18. % % u1xxxx u1xxxx=uxxx7c(xl.xu. u2t=u1xx-u1xxxx-u1sxx.u2 of length n.u1sx. u1sxx=dss044(xl.1) (ncase=4). ut(i+n)=u2t(i). nu=1. % % PDE u1t=u2. LISTING 18. u2(i)=u(i+n).

end ut=ut'. u1x(n)=0. nu=2.4b) are set. % % BCs at x = -15. u1xx=dss044(xl.nl. nu=1. u1(n)=0. The remainder of pde 1d is the same as pde 1a. % .xu. % % u1xxxx u1xxxx=uxxx7c(xl.m. 4 . nl=1. and the first derivative ∂x is computed by ∂ 2u dss004. % % PDE u1t=u2. and pde 1c. For the latter.nu).ˆ2.u1). ∂u Dirichlet BCs (18.25 u1(1)=0.xu. % % (u1ˆ2)xx u1s=u1.m. % % u1xx nl=2. is then computed by taking the third derivative ∂x ∂u of with uxxx7c.4e) and (18. (18. u2t=u1xx-u1xxxx-u1sxx. and the second derivative ∂x2 is computed by dss044.xu.u1x.25 u1x(1)=0.nl.u1s. % % BCs at x = -15.u1.n.n.nu). u1sx(1)=0. and it is listed subsequently. % % Two vectors to one vector for i=1:n ut(i) =u1t(i). Boussinesq Equation 365 .1). . note the specification of Neumann BCs (nl=nu=2 for BCs (18. Chapter 18 . u1sxx=dss044(xl. % % u1x u1x=dss004(xl.4e) and (18. 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]. Neumann BCs (18.4f ) are then set.xu. ∂ 4u The fourth derivative in eq.n.4a) and (18.u1x).n. pde 1b.4f ). .u1sx. ut(i+n)=u2t(i).

( 1.1d and 18.0*u(i-2).m are the same as inital 1a. The other routines for ncase=4 are the same as for ncase=1.. ua 1d. % % Interior points else uxxx(i)=r8dx3*. and uat 1d.3.. -1.2.m.0/(8.366 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS % Increment calls to pde_1d ncall=ncall+1.. Function uxxx7c. and uat 1a. % % At the right end.m.m. respectively. uxxx = 0 if(i<4)uxxx(i)=0..2.. the weighting coefficient are symmetric)..0*(dxˆ3)). % % uxxx for i=1:n % % At the left end. -13.3 and therefore will not be discussed here.n..m.m is listed below. +13..2. function uxxx=uxxx7c(xl.m of Listing 18. . Finally.0*u(i+2)..2d. Note in particular that the weighting coefficients are antisymmetric (opposite in sign) around the center term +0... uxxx7c is structured in the same way as u4x11p.u) % % Function uxxx7c computes the derivative uxxx % % Spatial increment dx=(xu-xl)/(n-1). as mentioned previously.0*u(i+3)). ua 1a. this arrangement of a complete set of subordinate routines for each case provides for maximum flexibility and clarity. end end LISTING 18.. and Figs. 18.0.0*u(i-3).0*u(i ) since the third derivative is odd order (for even-order derivatives. +8. -8..5: uxxx7c for the calculation of the third derivative uxxx. r8dx3=1.m.xu. for example.0. Execution of the routines for ncase=4 (with the designation “d”) produced the following numerical and plotted output in Table 18.0*u(i-1). +0. ini- tal 1d.m for ncase=4 directly parallels that for ncase=1.. uxxx = 0 elseif(i>(n-3))uxxx(i)=0.0*u(i ).1d. the coding in the main program pde 1 main.0*u(i+1).

000689 0.003917 0.271880 0.271880 0.000000 .000 0.000048 0.i) 9.003697 0. .00 11.000000 0.00 −1.00 17.000 0.00 1.i) err(it.i) u1 anal(it.195798 −0.186944 0.001645 0. .186238 0.000050 0.000 0.008551 0.001645 0. .000000 0.00 −1.000 0.000000 0.000 0.000048 0.049162 0.000 0.000 0.00 −15.020794 0.00 9.000000 0.00 −9.000753 9.000 0.00 7.009277 0.1d: Selected numerical output from the main program pde 1 main. Boussinesq Equation 367 Table 18.000050 0.000000 0.00 −3.00 −13.003917 0.000276 −0.104066 0.00 3.000 0.021685 0.000 0.00 −13.003751 −0.000 0.271880 0.000 0.000336 9.000 0. . . .000742 9.047247 −0.00 −5.000 0.021796 0.009277 0. .021685 0.000000 0.000161 0.021685 0.00 −11.000660 9.000660 0.000000 0.021685 0.00 25.000046 9.00 5.000000 0.274310 0.000 0.001575 −0.000115 0.000 0.000706 9.000000 0.000207 9.195041 0.000 0.000 0.191019 0.271880 0.046933 0.i) 0.000314 9. 6 removed .275063 0.104066 0.00 21.191019 0.000 0.00 15. .000000 0.009277 0.00 7.000053 9.000021 0.000069 0.000000 0.049162 0.000 0.269227 −0.000021 0.000 0.m for ncase=4 t x u1(it.191019 0.009277 0.000000 0.000 0.00 9.00 1.000000 0.049162 0. Chapter 18 .i) err(it. .00 23.00 −7.00 −3.00 −11.100497 −0.000 0.000756 (Continued ) .000 0.008887 −0.000 0.000000 0.001002 9.00 11.000689 0.000000 0.003917 0.000 0.000000 0.00 −15. t x u1(it.000462 9. .00 −9.000 0.000 0.000058 9.000000 0.100035 0.00 13.00 3.104066 0.001645 0.000121 0.00 −7.000 0.000 0.001645 0.000 0.000000 0.049162 0.00 19.000 0.000718 0.00 −5.000000 0.000288 0.000 0.000000 0.268486 0.000121 0.00 5.000288 0.000915 0.003917 0.000000 9. output for t = 3.000 0.104066 0.i) u1 anal(it.191019 0.000 0.

022612 0. Figure 18.15 u1 (x.000720 0.1d and 18.00 15.00 21. 9 (left to right). between the two solutions at t = 9 is about four figures.1) for t = 0.000209 9.000044 9.009687 0.000 0.050767 0.3 0. 3.1d: (Continued) t x u1(it.00 13.i) 9.1 0.107725 0.022820 0. ncase = 4. (18.00 23.000 0.000 0.000000 ncall = 554 Boussinesq equation.108345 0.00 25. lines – numerical. and the agreement .000001 9.000 0.000 0.000720 0.1d again demon- strates that the solution is a traveling wave in x from eq.001762 0.000 0.2 0.004091 0.001718 0.004090 0.25 0. with ncall = 554. this plot is very similar to Figs. o – analytical 0.i) u1 anal(it. 18.051146 −0.000004 9. (18.i) err(it. t) 0.1a and 18.000379 9.009683 0.2).2d.000 0. The plotted solutions are included in Figs. 18.1b.368 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 18.05 −15 −10 −5 0 5 10 15 20 25 x FIGURE 18.00 19. 6.05 0 −0.1d: 2D plot comparing the numerical and analytical solutions of eq. The computational effort is modest. We can note the following points about this output: .00 17. . The numerical and analytical solutions agree at t = 0 as expected.2) (starting from t = 0) from the argument of x − ct in eq.000620 9. (18.

1d: . In particular.m uxxx7c. ods15s. As noted in Chapters 15–17.2a and 18.4c) and (18. We have also considered four alternative approaches to a higher–order derivative. This plot is very similar to Figs. and more generally it demonstrates the flexibility of the numerical approach when a set of library routines is used (e.1b applies also to Fig.1d is . t) 0.2d: 3D plot of the numerical solution of eq.1 0. The agreement of the numerical and analytical solutions as reflected in Table 18. This last case ncase=4 illustrates an alternative MOL solution of eq.4f ) rather than (18. dss044.4e) and (18. (18. u4x11p.2 0. x = xu = 25 is essentially zero. the slope of the solution at the end points x = xl = −15. 18.m) for both linear and nonlinear PDEs.1).1d. In summary. 18. We observed in ncase=3 that an MOL formulation that seems logical (at least mathematically) may.05 0 8 25 6 20 15 4 10 t 5 2 0 −5 x −10 0 −15 FIGURE 18.1) based on BCs (18.1).4d). 18. Chapter 18 . in this case. dss004. the fourth-order derivative of eq. 18. (18. Boussinesq Equation 369 Boussinesq equation 0. (18. 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. in fact.1)) by restating the PDE as two PDEs first order in t (for dependent variables u1 and u2).1a and 18.. The discussion of Figs.g.2b. evident.15 u1 (x.25 0. we have again discussed the numerical solution of a PDE second order in t (eq. We can note the following details about Fig. not execute and therefore some experimentation with alternate formulations may be required to arrive at a workable MOL code.

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. t. In order to obtain a more accurate model for c. which was first published by J. followed by some analysis. In 1873 he was appointed as Professor of Differential and Integral Calculus at the Faculty of Science in Lille. dispersive wave propagation. . and g represent distance. After assuming a traveling wave solution with h(x. It assumes shallow water conditions and is gen- erally considered to be the first model to describe nonlinear. H represents still water depth. 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. and gravitational acceleration. He taught there until 1886 when he was appointed as Professor of Physical and Experimental Mechanics at the Sorbonne. 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. 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. t) = h(ξ ) and ξ = x − ct . and λ represents wave- length.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. Boussinesq 1 in a series of papers [2–4] during the years 1871–1872. respectively. 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. Shallow water models usually make the following assumptions h/H 1 and hλ2 /H 3 1 where h represents wave amplitude. The term gH = c2 represents the square of wave velocity. 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. 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. One of the many equations used to describe the propagation of surface long waves on water is the Boussinesq equation.

t)-g*H*diff(h. Chapter 18 . ># Define sech solution Sol:=h=(cˆ2/g-H)*sech(sqrt((cˆ2/g-H)*3/(4*Hˆ3))*(x-c*t))ˆ2. # = 0 if correct! if testSol<> 0 then print("Solution: does not pass pdetest() !"). .6) g 4H 3 g The Maple code given in Listing 18. (18. else print("Solution passes pdetest()"). (18. the g final solution becomes ! v ! 2 c2 − gH c2 − gH u u 3 h= sech t (x − ct) (18.x)-g*H*diff((3*hˆ2/(2*H)+(Hˆ2/3) *diff(h.6) is actually a solution to the original Boussinesq eq. ># Test of solution to original Boussinesq equation restart. therefore.x.6: Maple code used to verify analytical solutions to the original Boussinesq equation. and h1 = 3 1 H 3 ∂ 2h h+ is an unknown constant to be determined. from the above discussion. 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. Also.x. we have p 1p c= gH + gHh1 2 where the constant ! factor of a half has been taken outside the brackets. and further analysis leads to the relation- c2 − gH ship h1 = .x)=0.x. LISTING 18. Therefore. ># Use PDE test function to confirm solution is correct testSol:=pdetest(Sol. we have ξ = x − ct.pde1). with(PDEtools): >alias(h=h(x. Boussinesq Equation 371 equation must be constant.x)).5).6 demonstrates that eq.t. end if.t)): ># Define the Boussinesq PDE pde1:=diff(h.

c represents wave speed. c > 1 2 (18. t) + u (x. The derivation of eqs.9) can easily be performed in Maple.7) ∂t 2 ∂x2 ∂x2 ∂x4 We seek a closed-form single soliton solution to eq. (18. t) = 0 (18. t) = 1 − c2 sech2 1 − c2 (x − ct) + x0 . we obtain the required traveling wave solutions p 3 1 u (x. (18. t) = f (ξ ). .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. t) + u (x. 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 ).8) and (18.7). t) = 1 − c sec c − 1 (x − ct) + x0 .7) using direct integration as fol- lows. However. t) − u (x. on back substi- tuting f (ξ ) = u (x.9) 2 2 where x0 is an arbitrary constant. t) and ξ = k (x − ct). Then on substituting f (ξ ) into eq. (18. Assume a traveling wave solution of the form u(x. the PDE is transformed into the following ODE. where ξ = k (x − ct). the code is not listed here but is included with the downloads for the book. Therefore.8) 2 2 p 3 2 2 1 u (x. and k represents wavenumber. c < 1 (18.

4 is a 3D plot that demonstrates the movement of the solution through x and t. >intFlg:=0: # integration of U(xi) needed! M:=2. ROMAN. we obtain the same solutions as given by eqs.c:=0. . Figure 18.x. numpoints=300. # Set order of approximation infoLevOut:=0. t=0. Boussinesq Equation 373 Analytical Solution Using the Riccati-Based Method We now apply the Maple routine riccatiMethod() (see Listing 18.20.t)"].7: Maple code used to derive an analytical solution to the Boussinesq equation using the riccatiMethod() procedure.intFlg. title="Boussinesq Equation". 16]. labels=["x". labeldirections=[HORIZONTAL.t)): ># Define pde pde1:=diff(u. t=0. >read("riccatiMethod.x=-10. labels=["x". alpha:=1."u"]. ROMAN.30.x. style=patchnogrid.axesfont=[TIMES.9 are given in Figs. 18. A Maple code that performs the calculations for Figs. ROMAN. (18. t) = 1 − k2 + c2 + k2 1 − tanh2 (x − ct) 2 2 2 √ On letting the wavenumber k = 1 − c2 .4 is given in List- ing 18..x)+alpha*diff(u. labelfont=[TIMES.8) and (18."t".shading=Z.4. ROMAN. 2D and 3D plots of this solution for c = 0. ROMAN. LISTING 18. k:=sqrt(1-cˆ2).9.3 and 18.100].x0:=0.x)=0.40].axesfont=[TIMES..20. one of which is 1h i 3 k u (x.t.frames=50. ># Generate a 3D surface plot plot3d(zz."u(x. ># Set constants zz:=rhs(soln[3. orientation=[-107. axes=framed.3 is the initial condition (at t = 0).pde1. ># Boussinesq Equation # Attempt at Riccati equation based solution method restart. titlefont=[TIMES. titlefont=[TIMES.txt"). 16]). Figure 18.7.9) derived using direct integration.infoLevOut).3]).x. 18.axes='framed'.x=-10.x.7) and obtain a number of traveling wave solutions. which then moves left to right when the animation (see Listing 18.30. ># Animate solution animate(zz.HORIZONTAL. Chapter 18 . with(PDEtools): with(PolynomialTools): with(plots): >alias(u=u(x. labelfont=[TIMES.t)-diff(u. 16]).7) is activated. riccatiMethod(M. beta:= 1.VERTICAL].3 and 18.x)+beta*diff(uˆ2.grid=[100...x. 16]. ROMAN.thickness=3. 16]. title="Boussinesq Equation". 16].

Boussinesq. R.374 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS 0. Nonlinear Sci. Acad. 14 (2009) 3738–3742. Théorie générale des mouvements. Boussinesq.8 0. qui sont propagés dans un canal rectangulaire horizontal. Milovic. Simulat. Paris.3: 2D plot of the solution to Boussinesq equation at t = 0.8 0.2 −10 0 10 20 30 x FIGURE 18. Théorie de l’intumescence liquide appelée “onde solitaire” ou “de translation”. 0. .6 u (x. Pures Appl. Sci. se propageant dans un canal rectangulaire. Ranasinghe. R.6 0.4 0. D. 17. Traveling wave solutions can also be found using the tanhMethod and expMethod Maple procedures.4: 3D plot of the solution to Boussinesq equation. en communiquant au liquide continu dans ce canal des vitesses sensiblement pareilles de la surface au fond. (1872) 55–108.2 0 −0. The codes are not listed here but are included with the downloads for the book. t) 0. Théorie des ondes et des remous qui se propagent le long d’un canal rectangulaire hor- izontal. C. [3] J. Boussinesq. 72 (1871) 755–759. Numer. Acad. Biswas. Commun. 73 (1871) 256–260. C. J. Solitary waves of Boussinesq equation in a power law media.2 0 20 15 10 t 5 30 20 10 0 0 −10 x FIGURE 18. A. References [1] A.4 u 0. Math. Sci. [2] J. Paris. [4] J.

Zaitsev.D. Boussinesq Equation 375 [5] E.E.F.HO] 28 Feb 2006. 28 (10–12) (1994) 147–154. Belgium. available on-line at arXiv:math/ 0602661v1 [math. de Jager. private communication.M. Polytechnique Mons. 2002. Boca Raton. Handbook of Nonlinear Partial Differential Equations. FL. [7] W. [6] A. . Chapman & Hall/ CRC. Chapter 18 . V. On the origin of the Korteweg-de Vries equation. Math. vande Wouwer. Applic. [8] A. Method of Lines Solution of the Korteweg-de Vries Equation. 2004. Schiesser. Polyanin. Comput.

(19.3) is discussed subsequently. second-order. (19. the second derivative is (from the addition of the final two dξ 2 equations in Table 19.1) is.5) is from eq. d2 U + 2U − 2U 3 = 0 (19. (19.6) .5) the modified wave equation (since it bears a resemblance to the classical. Traveling Wave Analysis of Partial Differential Equations DOI: 10. All rights reserved. (19.5) 2 ∂x2 c2 ∂t 2 We term eq.2) which satisfies the BCs U(ξ = −∞) = −1. d2 U To extend this solution to a PDE.1016/B978-0-12-384652-5. We now consider the same procedure that leads to a PDE second order in t.3b) The significance of BCs (19.1) ! d2 U 1 ∂ 2u 1 ∂ 2u = + 2 2 (19. we first consider the second derivative with dξ 2 d2 U ξ = x − ct. we considered the conversion of an ODE to a PDE using the concept of a traveling wave equation. The solution to eq.4) dξ 2 2 ∂x 2 c ∂t The PDE corresponding to eq. Therefore.2) u(x.1) is [1] U(ξ ) = tanh(ξ ) (19. t) = tanh(x − ct) (19. (19. (19. linear wave equation). which we term the modified wave equa- tion. We start with the following ODE that can be considered a Lagrangian (traveling wave) form of a PDE in an Eulerian (fixed) coordinate system. 19 Modified Wave Equation In Chapter 14.4) ! 1 ∂ 2u 1 ∂ 2u + + 2u − 2u3 = 0 (19. .1) dξ 2 An analytical solution of eq. The result was a PDE first order in t. U(ξ = ∞) = 1 (19. from eq.00019-4 377 Copyright © 2012 Elsevier Inc. therefore.3a.

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. (19. we substitute eq. is listed first. (19. eq.m.5) Solution.5) with the analytical solution (19.1: Derivatives for the Lagrangian variable ξ and Eulerian variables x. (19. function ut=pde_1(t. (19.6) used to evaluate the numerical solution. The ODE routine. (19. eq.2) We now consider the MOL solution of eq.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.5) (see Table 19. pde 1.6) into eq.2: Verification of eq.5) PDE.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 .6) as the solution to eq. (19.378 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 19. (19.

15–18) for PDEs second order in t.xu u1(1)=ua_1(x(1). the solution vector u is placed in two arrays u1.u1x.e. end % % BCs at x = xl. u2t(i)=-cs*u1xx(i)-4*cs*(u1(i)-u1(i)ˆ3).u2. Modified Wave Equation 379 for i=1:n u1(i)=u(i)..t).nu).xu.n.5). u1xx=dss044(xl.t). function ut=pde_1(t. nu=1.u1. % % u1xx nl=1. % % PDE for i=1:n u1t(i)=u2(i). We can note the following details about pde 1. end . end % % Two vectors to one vector for i=1:n ut(i) =u1t(i). LISTING 19. As in the preceding chapters (i.m: . % % One vector to two vectors for i=1:n u1(i)=u(i). % % Increment calls to pde_1 ncall=ncall+1. The function and some global variables are first defined.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 . u2(i)=u(i+n). ut(i+n)=u2t(i). u2(i)=u(i+n). Chapter 19 . end ut=ut'.1: Function pde 1. (19.m for eq.nl. u1(n)=ua_1(x(n). u1x(1)=0.

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.nl.t). u1x(1)=0. end ut=ut'.xu. The number of calls to pde 1.u1. Since the boundary values at x = xl . a transpose is required by these integrators (so that ut is a column vector). The two derivative vectors u1t. BCs (19. The values of xl=x(1). ut(i+n)=u2t(i).xu u1(1)=ua_1(x(1). The function ua 1. eq.nu). x = xu are defined. % % BCs at x = xl.m and integrated by ode45 or ode15s in the main program pde 1 main. % % Increment calls to pde_1 ncall=ncall+1. u1xx=dss044(xl.m has the analytical solution. .380 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS u1. (19. u1(n)=ua_1(x(n). % % Two vectors to one vector for i=1:n ut(i) =u1t(i). Dirichlet BCs are specified with nl=nu=1.m.6). .m (note that ncall is a global variable).m.u2 are dependent variables first order in t.5) is programmed as two first-order PDEs in t.u1x.u2t are placed in a single derivative vector ut to be returned from pde 1.xu=x(n) are set in IC routine inital 1.t). % % u1xx nl=1.m (discussed subsequently) to −8.8 which are effectively x = ±∞ for the solution of eq.nu=1).5) (this will be demonstrated in the numerical and plotted solutions). Equation (19.n. (19. nu=1. end .3a) and (19.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). note that array x is a global variable and is therefore available from inital 1.m is incremented for display at the end of the solution in the main program pde 1 main. u2t(i)=-cs*u1xx(i)-4*cs*(u1(i)-u1(i)ˆ3). so a library ODE integrator such as ode45 or ode15s can be used to move the equations through t. .

xu= 8. dx=(xu-xl)/(n-1). u0(i+n)=u2(i). A grid in x of 101 points is defined for −8 ≤ x ≤ 8. function u0=inital_1(t0) % % Function inital_1 sets the initial condition for the modified % wave equation % % Parameters shared with other routines global xl xu x n ncall . u1(i)= ua_1(x(i). (19. dx=(xu-xl)/(n-1). (19. n=101.t0). Modified Wave Equation 381 In summary. We can note the following details about inital 1a. u2(i)=uat_1(x(i).m (which has the programming of eq. the initial values of u1 for eq. % % ICs from analytical solution .6) with t = 0.t0).m: . pde 1. n=101.m is listed next. .5) are provided by the function ua 1. xu= 8. the initial values of u2 are provided by the function uat 1. function u0=inital_1(t0) % % Function inital_1 sets the initial condition for the modified % wave equation % % Parameters shared with other routines global xl xu x n ncall % % Spatial domain and initial condition xl=-8. u0(i) =u1(i). (19.6) with t = 0).6) with respect to t).m from eq.m (which has the programming for the derivative of eq. end LISTING 19. % % Spatial domain and initial condition xl=-8. The function and some global variables are defined. The IC routine inital 1. In the for loop. % % ICs from analytical solution for i=1:n x(i)=xl+(i-1)*dx.2: IC function inital 1. (19.m receives the dependent variable vector u as an input (along with the independent variable t) and returns the derivative vector ut. Chapter 19 .

u0(i) =u1(i). Function uat 1.3b: Function uat 1.t0).6).m is a straightforward implementation of eq. function uanal=uat_1(x.m closely parallels pde 1 main. function uanal=ua_1(x.m is a straightforward implementation of the derivative (in t) of eq.6). (19.382 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS for i=1:n x(i)=xl+(i-1)*dx. LISTING 19. end All 2n initial condition values are returned from inital 1.t0). The problem parameters are set.3a: Function ua 1.6). u1(i)= ua_1(x(i). u0(i+n)=u2(i). (19.m through the vector u0 to the main program pde 1 main. . % % Model parameters global c cs % % Model parameters c=1. (19. u2(i)=uat_1(x(i). Function ua 1. Main program pde 1 main. cs=cˆ2.m of Chapter 15 and therefore only a few features are discussed here.m for the derivative of the analytical solution of eq.t) % % Function uanal computes the exact solution of the modified % wave equation for comparison with the numerical solution % % Model parameters global c cs % % Analytical solution uanal=tanh(x-c*t).t) % % Function uanal computes the time derivative of the exact solution % of the modified wave equation % % Model parameters global c cs % % Analytical solution derivative uanal=(-c)*sech(x-c*t)ˆ2.6). (19. LISTING 19.m discussed subsequently.m for the analytical solution of eq. .

an ODE dependent variable can only be computed from its . % % Display selected output for it=1:nout fprintf('\n t x u1(it.. for i=1:5:n fprintf('%6. The ODE Jacobian map from jpattern num 1.3. and the numerical solution is plotted in 3D by surf. rather.t)') title('Modified wave equation. pde 1 main. .m.'-'. Chapter 19 .m set the boundary values equal to the analytical solution (by using ua 1. % % Plot numerical and analytical solutions figure(2) plot(x. and the agreement . t(it).u1. end end fprintf(' ncall = %4d\n\n'.5) as expected.'o') axis([-4 4 -1 1]).u1(it.m).6f%15. The numerical and analytical solutions agree at t = 0 as expected. These solutions are then plotted in 2D by plot.. 0. jpattern num 1.i) and displayed. The numerical and analytical solutions agree exactly at the boundaries x = xl = −8.err(it. We can note the following points about this output: .3f%15.numerical.5 1.i)\n').2f%8. zlabel('u1(x. associated ODE programmed in the ODE routine. t = 0. if a dependent variable is set in the ODE routine (e. In other words.u1_anal(it.u1) shading 'interp'. this value is not returned by ode15s.i) err(it.t)'). Modified Wave Equation 383 .. which results from setting the two solutions equal at the boundaries in the main program.i). with ncall = 267. x = xu = 8. a boundary value)..analytical') figure(3) surf(x.x(i).i).6f\n'. xlabel('x') ylabel('u1(x.i)).i) u1_anal(it.g.m indi- cates two bands for PDEs (19. ylabel('t').u1_anal.ncall). The computational effort is modest. which is a characteristic of the Matlab ODE integrators.t. axis 'tight' xlabel('x'). This is done because although the Dirichlet BCs in pde 1. The difference in the numerical and analytical solutions is computed as err(it. these boundary values are not returned to the main program (from ode15s).m is listed in Table 19.6f%15. solid . between the two solutions at t = 1 is about four figures.x. o .m for the sparse matrix integration of the ODEs is not listed here since it is the same as for Chapters 15–18. title('Modified wave equation'). 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.

00 −7.000000 −1.537071 0.400 −0.000000 .800 −0.00 −8.00 −4.00 2.760778 −0.999329 −0.600 0.00 0. .999996 0.983675 −0.999999 −0.000000 0.800 −0.00 −4.i) 0.664037 0.000000 0.200 0.921669 −0.537050 0.i) u1 anal(it.000000 1.000004 .000816 1.000000 0. .m t x u1(it.i) err(it.999999 0.996682 0.999973 0.983675 0.000 1.000000 0.000000 0.00 0.00 −7.999973 0.000000 −0.999865 0.00 1.000000 1.200 −0.00 −3.400 0.761594 0.664037 −0.i) u1 anal(it.00 0.000000 −1.00 −6.885352 −0.999999 0.999994 0. t x u1(it.999865 0.000050 1.996682 0.00 −4.999982 −0. .000000 0.946983 −0.999329 0.00 −2.000000 0.000000 0.i) err(it.00 6.999550 −0.00 8.000 −0.00 2.999550 0.000 −1. .999982 0.00 4.000000 1.197375 0.600 0.000000 0.00 7.921669 0.000000 0.000 −0.i) 1.000000 0.00 −1.800 −0.000000 −1.000003 1.00 −8.000000 0.600 −0.000001 1.885348 0.996682 0.999909 0.00 5.664037 0.999999 0.00 1.000000 1.999994 0.000000 0.200 −0.997772 −0.800 −0.999865 0.197325 −0.000 0.5 removed . .000008 1.000177 1.600 −0.921669 0.000000 0.999973 −0.00 −1.000 −1.996682 −0.00 0.800 −0.000000 0.999909 −0.999329 0.946806 −0.00 4.997775 0.000000 0.600 0.00 −2. output for t = 0.000022 1.000000 1.999973 0.00 −3.00 −0.00 −5.000000 0.921669 0.400 0.200 −1.999996 −0.400 0.000000 0.000000 0.00 3.000000 0.00 −6.400 −0.999994 −0.999994 0.384 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Table 19. . .600 −0.200 −0.999999 0.400 −0.000000 0.989027 0.983675 0.000000 0. .600 −0.664037 0.800 0.00 −5.3: Selected numerical output from the main program pde 1 main.999329 0. .999865 −0.000000 1.000 0.00 −4.000000 0.000000 0.00 −0. .200 0.999999 −0.000000 1.000000 0.983675 0.800 0.989019 −0.000 −0.400 −0.

We can note the following details about Fig.000000 1.00 4. (19.5) for t = 0.800 0.4 0. 1 (left to right).995054 0.999959 0.000000 1. 19.6 −0.8 0.975741 0.1 demonstrates that the solution is a traveling wave in x from eq.000 0. o – analytical 1 0.999992 0.00 3.000000 1.5. (19.999798 −0.998999 0. Chapter 19 .2 u1 (x.6 0.00 7. The agreement of the numerical and analytical solutions as reflected in Table 19.600 0. lines – numerical.3: (Continued) 1. 0.000002 1.000000 1.000000 ncall = 267 Modified wave equation.999798 0.200 0.4 −0.6).999998 0.999000 −0.00 6.00 8.400 0.1: .000000 1.1 is .00 4. 19. evident.999998 0.000 0.1 and 19. x = xu is small (effectively zero) because the nonzero portion of the solution traveling left to right at velocity c = 1 does .995055 −0.975743 −0. (19.8 −1 −4 −3 −2 −1 0 1 2 3 4 x FIGURE 19.200 0.1: 2D plot comparing the numerical and analytical solutions of eq. Modified Wave Equation 385 Table 19. t) 0 −0.00 5.2.6) (starting from t = 0) from the argument of x − ct in eq.2 −0. The slope of the solution at the boundaries x = xl .999992 0.999959 −0. The plotted solutions follow in Figs. Figure 19.

2 −4 x −6 0 −8 FIGURE 19. This is taken as justification for assuming that −8 ≤ x ≤ 8 is essentially −∞ ≤ x ≤ ∞ if t ≤ 1. The requirement for an assumed solution with finite values for BCs at ξ = ±∞ provides for the possible use of a variety of functions. t and x are .2). – It can be differentiated so that the solution can be (a) verified as a solution to the ODE as illustrated in Table 19.1. tanhm (ξ ) and sechm (ξ ). in other words.8 −1 1 0. t) 0 −0. functions such as sin(ξ ) and cos(ξ ) are precluded since they are undefined at ξ = ±∞.6 −0. However. We can start with a solution to the ODE (U(ξ )).386 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS Modified wave equation 0. a change of variable through ξ = x − ct and substitution for the ODE derivatives gives an associated PDE as was done in the preceding example through the equations of Table 19.1)). Once the ODE and its solution have been formulated.2 or (b) used to construct an associated ODE (such as . (19.2 −0. possibly including a residual function as illustrated in Chapter 17.8 8 0.4 0. (19.4 2 0 t −2 0.6 6 4 0. We can summarize the procedure for using traveling wave analysis (using ξ = x − ct) to produce a PDE from an ODE (with independent variable ξ ): . such as. (19. which should have the following properties: – It has finite limiting values as BCs at ξ = ±∞ such as the tanh function of eq.2: 3D plot of the numerical solution of eq. not reach the right boundary at t = 1 (ct = (1)(1) = 1 units in x. By requiring these boundary values. the resulting PDE test problem will be valid for 0 ≤ t ≤ ∞ and −∞ ≤ x ≤ ∞ corresponding to ξ = ±∞.5). eq.4 −0. for example.8 0. whereas the right boundary is at xu = 8).6 0.2 u1 (x.

we have the opportunity for almost unlimited numerical investigations of linear and nonlinear PDEs.m of Listing 19. Set the order of approximation to M = 1. as new PDE applications are developed).txt which contains Maple procedure riccatiMethod(). and Riccati methods. as well as linear PDEs. Chapter 19 . the latter case can be used to evaluate numerical methods for PDEs (such as the MOL). (19.4 and the major computational steps are as follows: 1. 2. which generates 7 × 6 = 42 traveling wave solutions: 18 trivial and 24 nontrivial.6). Appendix We conclude this chapter by illustrating that a traveling wave solution to the modified wave equation. exp. Once a numerical method has been tested with an exact solution. Check each of the derived solutions against the standard traveling wave solution of eq.5). (19. which is called within the procedure riccatiMethod(). However. which was derived from the original ODE eq. This step utilizes the very useful Maple function testeq() to perform the comparison. Thus..1). the coding for eq. and associated numerical methods. (19. such as eq. Display animation and 3D plot of the solution. Also.6). the method can be applied to nonlinear PDEs. Read file riccatiMethod. An exact match is found! 6. (19. All solutions are verified as satisfying eq. 3. Set integration flag to zero (no integration needed) and call riccatiMethod(). which corresponds to the original solution given in eq. Modified Wave Equation 387 unbounded in the use of the PDE and its exact solution. that will be used to obtain traveling wave solutions. For example. can be found using the tanh. 4. the PDEs that result from this approach will not necessarily have a physical interpretation (although this possibility is not ruled out. through this approach of developing a PDE test problem starting with an ODE. (19. the numerical solution of the PDE can be viewed in the Lagrangian sense (as a function of ξ ) or the Eulerian sense (as a function of x and t). Of the 24 nontrivial solutions. (19. In summary.5) could be extended to include nonlinear terms such as um and f (u) by including these terms in the MOL routine. 5. eq. The Maple code to use the Riccati method to obtain a solution is shown in Listing 19.5). ># Modified Wave Equation # Attempt at Riccati equation based solution method . (19. the traveling wave analysis provides a way for developing PDEs and asso- ciated exact solutions that can be used as test problems for PDE numerical methods. most are duplicates. the PDE can easily be modified to investigate the (numerical) solution of other PDEs (although the exact solu- tion will not apply) by relatively straightforward changes in the MOL ODE routine (such as pde 1.1). Also.e. i.5) by application of the Maple function pdetest(). Specify the PDE equation.

style=patchnogrid. with(PDEtools): with(PolynomialTools): with(plots): >alias(u=u(x.x=-5. 16]. 16]. ROMAN. >read("riccatiMethod.thickness=3."u(x.t)/cˆ2+diff(u. labelfont=[TIMES.. ROMAN.j]).t)): >pde1:=(diff(u. t=0.jj]). ROMAN. riccatiMethod(M. title="Modified Wave Equation". if testFlg=1 then break.intFlg. 16].pde1.20.axesfont=[TIMES.. print("soln:". break. ># Generate a 3D surface plot plot3d(zz.. LISTING 19. numpoints=300. labeldirections=[HORIZONTAL.25. 16]).txt").axes='framed'. labels=["x". ># Check for standard solution match u1:=tanh(x+x0-c*t): testFlag:=0: for i from 1 to N do for j from 1 to 6 do u2:=rhs(soln[i. 16]).t)"].. titlefont=[TIMES. del:= testeq(u1=u2): if del=true then ii:=i.x.42]. end if.frames=50. testFlg:=1. ROMAN. ROMAN.. x0:=0. >intFlg:=0: # integration of U(xi) not needed! M:=1.jj. MATCH FOUND!").ii. 16]. t=0. jj:=j. labelfont=[TIMES.VERTICAL].shading=Z.20. labels=["x".x=-5." . end if.25. end do. c:=1.. . ># Animate solution animate(zz."t". if testFlg=0 then print("NO MATCH FOUND!"). else zz:=u1.HORIZONTAL.388 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS restart.axesfont=[TIMES. title="Modified Wave Equation". end do. titlefont=[TIMES.# Set order of approximation infoLevOut:=0. >#Set solution for display if testFlg=1 then zz:=rhs(soln[ii.100]."u"]. orientation=[122.grid=[100.x))/2+2*u-2*uˆ3=0. axes=framed. ROMAN. end if.t.4: Maple code to derive traveling wave solutions to the modified wave equation by implementation of the Riccati method. end if.infoLevOut).

Wylie. . (19.R. p. eq. Reference [1] C.6). McGraw-Hill.C. listings of the Maple code implementations of the tanh and exp methods will not be included here. New York. Sixth edition. 46. L. Chapter 19 .7) and the exp method finds the solution e−x+ct − ex−ct u=− (19.8) e−x+ct + ex−ct which. In order to save space. The tanh method finds the exact solution u = tanh (x − ct) (19. Modified Wave Equation 389 It is equally straightforward to find traveling wave solutions by application of either the Maple procedure tanhMethod() or expMethod() described in the main Appendix. (19. Barrett. Advanced Engineering Mathematics. of course.6). These two methods each find solutions that match the original solution eq. 1995. but they are available in the downloadable software. transforms exactly to the original solution.

and Riccati-based sections also include a computer implemen- tation based on procedures programmed for Maple. and Riccati-based procedures are not intended to rival the Maple built-in procedure TWSolutions—see Section A. In addition. and Riccati- based methods. Consider the following evolutionary equation for which we wish to find traveling wave solutions ψ (u. utx . exp-. it will be shown that the arguments extend naturally to coupled equations and also to problems defined in terms of two or more spatial dimensions. They all benefit greatly from being implemented in a computer algebra system (CAS) such as Maple. Traveling Wave Analysis of Partial Differential Equations DOI: 10. A Analytical Solution Methods for Traveling Wave Problems A. we outline the factorization method and illustrate how solutions may be obtained by direct integration. ut .9. ξ = k (x − ct) (A.2) . Subsequently. These include three fairly new developments. plus time. uxx . All the methods are intuitively easy to understand and straightforward to apply. They will not be able to solve all problems. Although these procedures solve many problems and demonstrate the way the methods work. plus the time dimension t. we discuss some analytical methods for deriving traveling wave solutions to PDEs.1 Introduction In this appendix.2 Tanh Method We will first discuss the method applied to a problem defined in terms of a single equation having one spatial dimension x. All rights reserved.) = 0 (A. We start by introducing the transformation u (x. . t) → U (ξ ) . ux . In addition. We mention that the tanh-. exp-. A. they should be viewed as educational/research tools. The methods are first described in detail and then illustrated by an example.00020-0 391 Copyright © 2012 Elsevier Inc. . . . exp-. utt . namely tanh-.1016/B978-0-12-384652-5. the tanh-.1) The tanh method is simple to implement.

k .. typically. = 0 (A. we are able to define a set of differential operators L. . for a given function F (Y ).1) is transformed to the following ordinary differ- ential equation ! dU dU 2 2 d2 U 2 d2 U 3 2 3d U 3 3d U 9 U. k .7) dY dY 2 . transformed to the following equivalent ordinary differentiation operations ∂ d → −kc (A.3b) ∂x dξ Thus.5) from which we note that dY = sech2 (ξ ) = 1 − tanh2 (ξ ) = 1 − Y 2 (A. Partial differentiation operations with respect to t and x are. −k c . We now apply Malfliet’s tanh method [13] and introduce the new function Y = tanh (ξ ) (A.392 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS where U has yet to be defined and. with respect to ξ . .. we have dF (Y ) dF (Y ) dY dF (Y ) = = 1−Y2 dξ dY dξ dY Thus. etc.6) dξ It therefore follows from the chain rule for differentiation that.. L2 . therefore. partial differential equation (A. k > 0 represents wavenumber and c represents wave velocity. −kc . as follows d d = L = 1−Y2 dξ dY d 2 d d = = L2 dξ 2 dξ dξ d d = 1−Y2 1−Y2 dY dY d 2 d 2 = −2 1 − Y 2 Y + 1−Y2 (A. . +k ··· =0 dξ dξ dξ 2 dξ 2 dξ 3 dξ 3 or in canonical form ! dU d2 U d3 U 9 U. .3a) ∂t dξ ∂ d →k (A. by repeating this process.4) dξ dξ 2 dξ 3 where c and k are subsumed into 9. .k c . . L3 .

It is readily seen that there is a simple discernible pattern for higher-order differentials. A. 29] defines the summation from −M to M.9) ∂t ∂x ∂x3 . We therefore use the method of Lagrange (undetermined) multipliers to solve the resulting set of equations for the required unknowns ai . Appendix A . k.. as follows. Thus we have found a set of algebraic functions to represent various orders of deriva- tives. Consequently. Substituting eqns. and c. we are now able to convert the ODE of equation (A. and M is a positive integer found by balancing (equating) the largest exponent of Y in the highest order linear term with the largest exponent of Y in the highest order nonlinear term. However the extended tanh method [28. i. as above. For additional information. Now. The final solution then becomes the polynomial.2. In fact. ∂u ∂u ∂ 3 u + 6u + =0 (A. and c. For anything other than trivial or simple problems. the reader is referred to [13–15].7) and (A. The idea of balancing is explained in more detail in the following example. for the problem to be consistent for all values of Y . We start by setting U = F(Y ) and introduce the following ansatz (informed guess) M X F (Y ) = ai Y i (A. Malfleit originally specified the tanh method summation from 0 to M.8) i=0 where coefficients ai are real constants to be determined.4) gives a poly- nomial in Y for which we have to solve for the unknown parameters. whose coefficients are now known. for many problems. (A.8) into the ordinary differential eq. The associated coefficient for each power of Y in the polynomial is represented by an expression con- sisting of parameters ai . the process of solving for the unknown coefficients is a tedious process and usually requires the use of a computer alge- bra system if the solution is to be found in a reasonable time.e. k. it is totally impractical to attempt a manual solution.1 Example . Analytical Solution Methods for Traveling Wave Problems 393 ! d3 d d2 = = L3 dξ 3 dξ dξ 2 d d d = 1−Y2 1−Y2 1−Y2 dY dY dY d 2 d 2 3 d3 = 1 − Y 2 6Y 2 − 2 −6 1−Y2 Y 2 + 1−Y2 dY dY dY 3 etc. (A. the coefficient expressions must each equate to zero.KdV Equation We will apply the above solution method to the canonical form of the KdV equation.4) to an equivalent algebraic equation. where tanh k (x − ct) has been substituted for Y .

This equation now bears their name. Research into this phenomenon waned until 1965 when it was proven that the KdV equation also admitted soliton solutions. (A. . (A. This breakthrough was reported in the seminal paper by Kruskal and Zabusky [31].394 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS for which we have the well-known traveling wave single soliton solution. (A. Korteweg and de Vries published a paper that explained these rare events and detailed the first mathematical equation to exhibit solitary wave behavior [10].9) to obtain dU (ξ ) dU (ξ ) dU 3 (ξ ) −kc + 6kU (ξ ) + k3 =0 (A. 2. Substitute U = F (Y ) into eq. John Scott- Russell reported observing their physical occurrence on the Union Canal near Edinburgh [24]. Apply the tanh approximation.10) This is a problem with historical significance because it admits solitary wave1 solutions. which detailed the results of their numerical solutions and heralded in an era of intense research into this interesting phenomenon.2) to eq. Solitary waves first came to the attention of the scientific world when. The following five steps summarize the preceding method when applied to solve the KdV equation: 1. in 1844. Then in 1895. the online encyclopedia [19]. Apply the traveling wave transformation.11) dξ dξ dξ 3 which can be integrated once directly with respect to U (ξ ) to give dU 2 (ξ ) −kcU (ξ ) + 3kU (ξ )2 + k3 =0 (A. u = 2k2 sech k (x − ct) .7).12) dξ 2 Note: For this method. A very read- able overview relating to the subject of solitons is available at Scholarpedia. It was also in this paper that the term soliton was first coined. The only difference after they emerge from a collision is that each exhibits a small phase shift (displacement or translation in time). A soliton is a solitary wave with the additional property that other solitons can pass through it with- out changing its shape. we obtain −kcF (Y ) + 3kF (Y )2 + k3 1 − Y 2 (A.12). c = 4k2 (A. we set the constant of integration to zero.13) " # dF (Y ) 2 d2 F (Y ) × −2Y + 1−Y =0 dY dY 2 1 The term solitary wave was first coined by Scottish engineer John Scott-Russell (1808-82). and using eq. Apply the transformation of eq. (A.

e.14) results in the following polynomial in Y : 3ka22 + 6k3 a2 Y 4 + 2k3 a1 + 6ka1 a2 Y 3 + −kca2 + 3ka12 + 6ka0 a2 − 8k3 a2 Y 2 (A. M. which is identically equal to zero.8) to give. the third term. Analytical Solution Methods for Traveling Wave Problems 395 We can now substitute into eq.14) 1 − Y 2 × 2a2 + 6a3 Y + · · · + M (M − 1) aM Y M−2 = 0 3. Determine the polynomial approximation order. Y 0 : − kca0 + 3ka02 + 2k3 a2 =0 Y 1 : − kca1 + 6ka0 a1 − 2k3 a1 =0 Y 2 : − kca2 + 3ka12 + 6ka0 a2 − 8k3 a2 = 0 (A. it follows that the coefficients for each power of Y must also be identically equal to zero. . (A. and is equal to 4 + (M − 2). i.16) + −kca1 + 6ka0 a1 − 2k3 a1 Y − kca0 + 3ka02 + 2k3 a2 = 0 We now have a fourth degree polynomial in Y . Appendix A . P P 2 M i M i + k2 1 − Y 2 × −c i=0 ai Y +3 i=0 ai Y −2Y × a1 + 2a2 Y + 3a3 Y 2 + · · · + MaM Y M−1 + (A. Therefore on balancing these exponents. and for this to be true. Equate coefficients to zero and solve for unknown parameters. The largest exponent of Y in the highest order linear term occurs in the highest derivative term. we have 2M = 4 + (M − 2) → M = 2 (A. Equating the coefficients to zero results in five simultaneous equations. The largest exponent of Y in the highest order nonlinear term occurs in the second term and is equal to 2M.15) 4. eq.17) Y 3 : 2k3 a1 + 6ka1 a2 =0 Y 4 : 3ka22 + 6k3 a2 = 0.13) the summation of eq. we have to balance the largest exponent of Y in the highest order nonlinear term with the largest exponent of Y in the highest order linear term. (A. (A. For eq. On rearranging. after division by k..14). (A.

11) through by α 1 − Y 2 .10). c = 3a0 . Make back substitutions to obtain final solutions. k = k : real solution a0 = (2/3)k2 . c = c : trivial solution a0 = 0. a1 = 0. c = 4k2 . a2 = −2k2 . Aside: For most problems. (A. (A. we can take a short cut and set F (Y ) = α 1 − Y 2 On dividing equation (A.9): u1 = a0 u2 = 0 u3 = a0 (A. The following five parameter solution sets are produced by Maple: a0 = a0 . the above procedure is best performed using a computer algebra sys- tem such as Maple.18) a0 = 2k2 . a2 = 0. we obtain ! d 1−Y2 2 2 2 d 1−Y 2 2 −c + 3α 1 − Y +k −2Y + 1−Y =0 dY dY 2 .17) and then setting Y = tanh k [x − ct] in eq.7). (A. Therefore. a2 = 0. a1 = a1 .396 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS which we solve using Maple. k = 0. k = k : trivial solution (A. (A. as ithappens for this particular problem. k = k : trivial solution a0 = a0 . a2 = a2 . a1 = 0.19) n o 2 u4 = 2k2 1 − tanh k x − 4k2 t = 2k2 sech2 k x − 4k2 t 2 2n o k 1 − 3 tanh2 k x + 4k2 t u5 = 3 Where constants a0 or k appear in the above solutions. Note that u4 is the same solution as given in eq. c = c. a2 = −2k2 . The final results are therefore found by substituting the parameter solution sets (A. (A. they may take arbitrary values. a1 = 0. However.11) includes a derivative - refer to eqns. we note that F(Y ) should be proportional to 1 − Y 2 because each term of eq. which yields the following five solutions to eq. c = −4k2 .16). a1 = 0.18) into eq. k = k : real solution 5. (A.

xi=k*(x-c*t). we obtain two equations with three unknowns. sol. ode1. testFlag. The remaining parameters are found to be α = 2k2 and c = 4k2 Recalling from eqns. i.. in many cases.intFlag. .u=U(xi)}. This greatly reduces the effort required and. print('ode1='. The Maple procedure below generates a solution automatically. 3α − 2k2 − c = 0 6k2 − 3α = 0 and choose k to be a free parameter. (A.20) which is eq. it is not guaranteed to find all traveling wave solutions and may fail altogether to find solutions to some problems.2 A Maple tanh Method Procedure We now illustrate the use of a computer algebra system to solve problems that require the use of the tanh method. (A. F4. str. c. A. However we must stress that this procedure will not solve all problems and is only provided to show what can be done with Maple using a fairly short section of code.pde. tanhMethod:=proc(M. we also found the additional nontrivial solution 2 n o u = k2 1 − 3 tanh2 k x + 4k2 t . F1. t) = U (ξ ) = F(Y ).infoLev) local F. using Maple.[xi. global _a. N. is the only practical way of arriving at a solution using this type of approach. Appendix A .5) and (A. and we will demon- strate its use by an application example.U(xi)]).6) that Y = tanh (ξ ) = tanh k (x − ct) and that u(x. # Assume a travelling wave solution of the form # U(xi).10). F5. F3. ode1:=dchange(tr1. vars. F2. i. testSol. FF.2. tr2. t) = 2k2 1 + tanh2 k x − 4k2 t = 2k2 sech2 k x − 4k2 t (A. ode1). we can now write the final solution as n h io h i u (x.tau. unprotect(_a). j.pde. tr1:={x=(xi/k+c*tau). k. 3 It must be stressed that although the tanh method can be used successfully on many problems to find traveling wave solutions.e. However.t=tau. tr1. Analytical Solution Methods for Traveling Wave Problems 397 which reduces to h i −c + 3α 1 − Y 2 + k2 4Y 2 − 2 1 − Y 2 = 0 Thus on equating coefficients of Y 0 and Y 2 to zero.

. end do.symbolic)). print('F(Y) = '.[Y. if infoLev>1 then print('Coefficient List ='.F2). vars) end if.xi)=0. #print('F5='.F3).398 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS if intFlag > 0 then for i from 1 to intFlag do ode1:=int(lhs(ode1). print('After integration. end if.F(Y)]).U(xi)=F(Y)}.Y): F4:=convert(F4. # Note: Polynomial coefficients for each power of Y must = 0 F5:=[solve(F4. str:=sprintf("Solution %2d:\n===========".vars)]: # This line needed to eliminate 'RootOf' terms # from the solve() answer F5:=map(allvalues.FF[i]). # This line included incase there are quotient terms F3 := numer(lhs(F3))*denom(rhs(F3)) = numer(rhs(F3))*denom(lhs(F3)): #print('F3='.F5).'c'}. # Define variables to be solved for vars:={seq(_a[r].ode1. ode1). i): printf(str). if infoLev > 0 then print("About to run pdetest!").{Y}): #print('F3='. ode1= '. # Test Solutions!! testFlag:=0. #print('F1='.F1). tr2:={xi=arctanh(Y).F5).F4) end if. # Unassign F(Y) coefficients for j from 0 to M do #print(j). if infoLev>0 then print('Unknowns ='. F3:=collect(expand(F2).M ). unassign('_a[j]').'c').F3).set): #print('F4='. end do. end if.M). N:=nops(F5): # No of solution sets found by solve() print(' Number of solution sets found = '. if infoLev>1 then print(F5) end if. F1:=dchange(tr2.r=0. F(Y):=add( _a[i]*Yˆi. unassign('k'.. F2:=eval(F1).'k'. # Get coeff's of Yˆm terms F4:=CoefficientList(lhs(F3). #print('F2='. print(sol[i]).F4). i=0. F(Y)).. end do. N). for i from 1 to N do assign(F5[i]): FF[i]:=F(Y): # print(FF[i]). sol[i]:=u=eval(simplify(subs(Y=tanh(k*(x+x0-c*t)).

1: Maple procedure tanhMethod(). testSol[i]:=timelimit(20. Also.pdetest(sol[i]. pde1. > # KdV Equation # Attempt at Malfliet's tanh solution restart. as mentioned above. Note the use of ai rather than ai . The first three solutions found are trivial. end if. i):print(str). # Final check to see if all solutions found solve 'pde' if testFlag = 0 then print("All solutions pass pdetest() !"). # '0' if true if testSol[i] <> 0 then str:=sprintf(" Solution: %2d does not pass pdetest() !".9). eq. Analytical Solution Methods for Traveling Wave Problems 399 for i from 1 to N do if infoLev > 0 then print("About to run pdetest() on solution: ". testFlag:=1.x)+diff(u.txt"). tanhMethod introduces the arbitrary constant x0 into the solution . > alias(u=u(x.9). This procedure is saved in the separate file tanhMethod. end proc: LISTING A. end if. Define an alias for u(x.x.pde) ). Initialize Maple and load required packages: PDEtools. t) to simplify writing code and then define the KdV problem PDE.x)=0.refer to Section A.txt so that it can be reused with any application. and infoLevOut. i).t)+6*u*diff(u.t)): pde1:=diff(u.x. All the solutions found satisfy the original PDE. . we now use a[i] rather than simply a[i] so that there is minimum likelihood of a name conflict with constants in the PDE. Note. intFlg. Read in the procedure tanhMethod so that it can be called as required. but the fourth and fifth are valid nontrivial solutions. in which we present code fragments followed by the associated Maple output. end if. We will now use procedure tanhMethod() to solve the Korteweg-de Vries (KdV) equation (A. . Appendix A . PolynomialTools and plots. (A. end do. > read("tanhMethod. Call the procedure tanhMethod with arguments M. because this procedure is general for use with any PDE. with(PDEtools): with(PolynomialTools): with(plots): . ∂ ∂ ∂3 pde1 := u + 6u u + 3u=0 ∂t ∂x ∂x . > intFlg:=1: # one integration of U(xi) needed! infoLevOut:=2: # set output information to level 2 .7 for an explanation.

F(Y ) := a0 + a1 Y + a2 Y 2 ! d3 d d 3 ode1 =. −ck U(ξ ) + 6U(ξ )k U(ξ ) + k U(ξ ) = 0 dξ dξ dξ 3 ! 2 3 d2 After integration. ode1 =. k = k 3 Solution 1: ======= u = a0 Solution 2: ======= u=0 Solution 3: ======= u = a0 Solution 4: ======= 2 2 k2 2 cosh k x + x0 + 4k2 t − 3 u=− 2 3 cosh k x + x0 + 4k2 t .400 TRAVELING WAVE ANALYSIS OF PARTIAL DIFFERENTIAL EQUATIONS M := 2: # Set order of approximation tanhMethod(M. −ckU(ξ ) + 3kU(ξ ) + k U(ξ ) = 0 dξ 2 Unknowns =. a2 = 0. a1 = 0.pde1. a2 = −2k2 . a1 = 0. a2 = −2k2 . a1 = 0. a0 . h k(3 a22 + 6k2 a2 ). c = −4k2 . a1 = a1 .intFlg). k = 0. a2 = 0. c = 3a0 a0 = 2k2 . k = k. c = c a0 = a0 . a2 } Coefficient list =. i k(−c a1 + 6 a0 a1 − 2k2 a1 ). k = k 2 a0 = k2 . c = c a0 = 0. {c. k(−c a2 + 3 a12 + 6 a0 a2 − 8k2 a2 ) ”Number of solution sets found = 5” a0 = a0 . a1 . k(−c a0 + 3 a02 + 2k2 a2 ). k(2k2 a1 + 6 a1 a2 ). c = 4k2 . a1 = 0. k = k. a2 = a2 . k.

> # Check derived solutions for match with 'standard' solution x0:=0: # Set arbitrary constant to zero! sol1:=u=2*kˆ2*sech(k*(x-4*kˆ2*t))ˆ2: # standard solution s1:=rhs(sol1): testFlg:=1: for i from 1 to N do s2:=rhs(sol[i]). 16]). print(sol[i]).i): print('str'). testFlg:=0. 5 ”All solutions pass pdetest() !”! . 3 ”About to run pdetest() on solution: ”.x=-10. 1 ”About to run pdetest() on soluti