正在加载图片...
19.1 Flux-Conservative Initial Value Problems 835 can be rewritten as a set of two first-order equations Or Os Ot Ox Os or (19.1.3) Ot where Ou T三U Ox Ou 8三 t (19.1.4) In this case r and s become the two components of u,and the flux is given by the linear matrix relation ICAL F(u) 0 (19.1.5) RECIPES (The physicist-reader may recognize equations(19.1.3)as analogous to Maxwell's equations for one-dimensional propagation of electromagnetic waves.) We will consider,in this section,a prototypical example of the general flux- conservative equation(19.1.1),namely the equation for a scalar u, du du Ot (19.1.6) dx es9&超 9 9 with v a constant.As it happens,we already know analytically that the general IENTIFIC( solution of this equation is a wave propagating in the positive -direction, 6 u=f(x-vt) (19.1.7) where f is an arbitrary function.However,the numerical strategies that we develop will be equally applicable to the more general equations represented by (19.1.1).In some contexts,equation (19.1.6)is called an advective equation,because the quantity u is transported by a "fluid flow"with a velocity v. Recipes Numerical 10621 How do we go about finite differencing equation(19.1.6)(or,analogously, 19.1.1)?The straightforward approach is to choose equally spaced points along both 431 the t-and z-axes.Thus denote Recipes x5=x0+j△x,j=0,1,.,J (19.1.8) tn=to+n△t, n=0,1,..,N Let u"denote u(tn,)We have several choices for representing the time derivative term.The obvious way is to set ou Ot g1-+0(△) (19.1.9) li.n △t This is called forward Euler differencing(cf.equation 16.1.1).While forward Euler is only first-order accurate in At,it has the advantage that one is able to calculate19.1 Flux-Conservative Initial Value Problems 835 Permission is granted for internet users to make one paper copy for their own personal use. Further reproduction, or any copyin Copyright (C) 1988-1992 by Cambridge University Press. Programs Copyright (C) 1988-1992 by Numerical Recipes Software. Sample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5) g of machine￾readable files (including this one) to any server computer, is strictly prohibited. To order Numerical Recipes books or CDROMs, visit website http://www.nr.com or call 1-800-872-7423 (North America only), or send email to directcustserv@cambridge.org (outside North America). can be rewritten as a set of two first-order equations ∂r ∂t = v ∂s ∂x ∂s ∂t = v ∂r ∂x (19.1.3) where r ≡ v ∂u ∂x s ≡ ∂u ∂t (19.1.4) In this case r and s become the two components of u, and the flux is given by the linear matrix relation F(u) =  0 −v −v 0 · u (19.1.5) (The physicist-reader may recognize equations (19.1.3) as analogous to Maxwell’s equations for one-dimensional propagation of electromagnetic waves.) We will consider, in this section, a prototypical example of the general flux￾conservative equation (19.1.1), namely the equation for a scalar u, ∂u ∂t = −v ∂u ∂x (19.1.6) with v a constant. As it happens, we already know analytically that the general solution of this equation is a wave propagating in the positive x-direction, u = f(x − vt) (19.1.7) where f is an arbitrary function. However, the numerical strategies that we develop will be equally applicable to the more general equations represented by (19.1.1). In some contexts, equation (19.1.6) is called an advective equation, because the quantity u is transported by a “fluid flow” with a velocity v. How do we go about finite differencing equation (19.1.6) (or, analogously, 19.1.1)? The straightforward approach is to choose equally spaced points along both the t- and x-axes. Thus denote xj = x0 + j∆x, j = 0, 1,...,J tn = t0 + n∆t, n = 0, 1,...,N (19.1.8) Let un j denote u(tn, xj ). We have several choices for representing the time derivative term. The obvious way is to set ∂u ∂t j,n = un+1 j − un j ∆t + O(∆t) (19.1.9) This is called forward Euler differencing (cf. equation 16.1.1). While forward Euler is only first-order accurate in ∆t, it has the advantage that one is able to calculate
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有