c19-1 (779616), страница 3

Файл №779616 c19-1 (Numerical Recipes in C) 3 страницаc19-1 (779616) страница 32017-12-27СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 3)

In some fluid problems, however, shock formation is not merely an annoyance,but an actual physical behavior of the fluid whose detailed study is a goal. Then,numerical viscosity alone may not be adequate or sufficiently controllable. This is acomplicated subject which we discuss further in the subsection on fluid dynamics,below.For wave equations, propagation errors (amplitude or phase) are usually mostworrisome. For advective equations, on the other hand, transport errors are usuallyof greater concern. In the Lax scheme, equation (19.1.15), a disturbance in theadvected quantity u at mesh point j propagates to mesh points j + 1 and j − 1 atthe next timestep. In reality, however, if the velocity v is positive then only meshpoint j + 1 should be affected.Sample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5)Copyright (C) 1988-1992 by Cambridge University Press.Programs Copyright (C) 1988-1992 by Numerical Recipes Software.Permission is granted for internet users to make one paper copy for their own personal use.

Further reproduction, or any copying of machinereadable files (including this one) to any servercomputer, is strictly prohibited. To order Numerical Recipes books,diskettes, or CDROMsvisit website http://www.nr.com or call 1-800-872-7423 (North America only),or send email to trade@cup.cam.ac.uk (outside North America).Thus far we have been concerned with amplitude error, because of its intimateconnection with the stability or instability of a differencing scheme. Other varietiesof error are relevant when we shift our concern to accuracy, rather than stability.Finite-difference schemes for hyperbolic equations can exhibit dispersion, orphase errors. For example, equation (19.1.16) can be rewritten as19.1 Flux-Conservative Initial Value Problems841vt or nvx or jFigure 19.1.4.

Representation of upwind differencing schemes. The upper scheme is stable when theadvection constant v is negative, as shown; the lower scheme is stable when the advection constant v ispositive, also as shown. The Courant condition must, of course, also be satisfied.The simplest way to model the transport properties “better” is to use upwinddifferencing (see Figure 19.1.4): nuj − unj−1n+1,nuj − uj∆x= −vjn un − un∆tj+1j,∆xvjn > 0(19.1.27)vjn < 0Note that this scheme is only first-order, not second-order, accurate in thecalculation of the spatial derivatives. How can it be “better”? The answer isone that annoys the mathematicians: The goal of numerical simulations is notalways “accuracy” in a strictly mathematical sense, but sometimes “fidelity” to theunderlying physics in a sense that is looser and more pragmatic.

In such contexts,some kinds of error are much more tolerable than others. Upwind differencinggenerally adds fidelity to problems where the advected variables are liable to undergosudden changes of state, e.g., as they pass through shocks or other discontinuities.You will have to be guided by the specific nature of your own problem.For the differencing scheme (19.1.27), the amplification factor (for constant v) is v∆t (1 − cos k∆x) − i v∆t sin k∆xξ =1−∆x ∆xv∆t v∆t 1 − (1 − cos k∆x)|ξ|2 = 1 − 2 ∆x ∆x (19.1.28)(19.1.29)So the stability criterion |ξ|2 ≤ 1 is (again) simply the Courant condition (19.1.17).There are various ways of improving the accuracy of first-order upwinddifferencing.

In the continuum equation, material originally a distance v∆t awaySample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5)Copyright (C) 1988-1992 by Cambridge University Press.Programs Copyright (C) 1988-1992 by Numerical Recipes Software.Permission is granted for internet users to make one paper copy for their own personal use. Further reproduction, or any copying of machinereadable files (including this one) to any servercomputer, is strictly prohibited. To order Numerical Recipes books,diskettes, or CDROMsvisit website http://www.nr.com or call 1-800-872-7423 (North America only),or send email to trade@cup.cam.ac.uk (outside North America).upwind842Chapter 19.Partial Differential Equationsstaggeredleapfrogx or jFigure 19.1.5.

Representation of the staggered leapfrog differencing scheme. Note that informationfrom two previous time slices is used in obtaining the desired point. This scheme is second-orderaccurate in both space and time.arrives at a given point after a time interval ∆t. In the first-order method, thematerial always arrives from ∆x away. If v∆t ∆x (to insure accuracy), this cancause a large error.

One way of reducing this error is to interpolate u between j − 1and j before transporting it. This gives effectively a second-order method. Variousschemes for second-order upwind differencing are discussed and compared in [2-3].Second-Order Accuracy in TimeWhen using a method that is first-order accurate in time but second-orderaccurate in space, one generally has to take v∆t significantly smaller than ∆x toachieve desired accuracy, say, by at least a factor of 5.

Thus the Courant conditionis not actually the limiting factor with such schemes in practice. However, there areschemes that are second-order accurate in both space and time, and these can often bepushed right to their stability limit, with correspondingly smaller computation times.For example, the staggered leapfrog method for the conservation equation(19.1.1) is defined as follows (Figure 19.1.5): Using the values of un at time tn ,compute the fluxes Fjn .

Then compute new values un+1 using the time-centeredvalues of the fluxes:− un−1=−un+1jj∆t nn(F− Fj−1)∆x j+1(19.1.30)The name comes from the fact that the time levels in the time derivative term“leapfrog” over the time levels in the space derivative term. The method requiresthat un−1 and un be stored to compute un+1 .For our simple model equation (19.1.6), staggered leapfrog takes the formun+1− un−1=−jjv∆t n(u− unj−1 )∆x j+1(19.1.31)The von Neumann stability analysis now gives a quadratic equation for ξ, rather thana linear one, because of the occurrence of three consecutive powers of ξ when theSample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5)Copyright (C) 1988-1992 by Cambridge University Press.Programs Copyright (C) 1988-1992 by Numerical Recipes Software.Permission is granted for internet users to make one paper copy for their own personal use.

Further reproduction, or any copying of machinereadable files (including this one) to any servercomputer, is strictly prohibited. To order Numerical Recipes books,diskettes, or CDROMsvisit website http://www.nr.com or call 1-800-872-7423 (North America only),or send email to trade@cup.cam.ac.uk (outside North America).t or n19.1 Flux-Conservative Initial Value Problems843form (19.1.12) for an eigenmode is substituted into equation (19.1.31),ξ 2 − 1 = −2iξv∆tsin k∆x∆x(19.1.32)whose solution is1−v∆tsin k∆x∆x2(19.1.33)Thus the Courant condition is again required for stability.

In fact, in equation(19.1.33), |ξ|2 = 1 for any v∆t ≤ ∆x. This is the great advantage of the staggeredleapfrog method: There is no amplitude dissipation.Staggered leapfrog differencing of equations like (19.1.20) is most transparentif the variables are centered on appropriate half-mesh points:nrj+1/2n+1/2sjnunj+1 − unj∂u ≡v=v∂x j+1/2∆xn+1/2n+1uj − unj∂u ≡=∂t j∆t(19.1.34)This is purely a notational convenience: we can think of the mesh on which r ands are defined as being twice as fine as the mesh on which the original variable u isdefined.

The leapfrog differencing of equation (19.1.20) isn+1n− rj+1/2rj+1/2n+1/2sjn+1/2=∆tn−1/2− sj=v∆tn+1/2− sj∆xnnrj+1/2− rj−1/2sj+1(19.1.35)∆xIf you substitute equation (19.1.22) in equation (19.1.35), you will find that onceagain the Courant condition is required for stability, and that there is no amplitudedissipation when it is satisfied.If we substitute equation (19.1.34) in equation (19.1.35), we find that equation(19.1.35) is equivalent to− 2unj + un−1un+1un − 2unj + unj−1jj2 j+1=v(∆t)2(∆x)2(19.1.36)This is just the “usual” second-order differencing of the wave equation (19.1.2). Wesee that it is a two-level scheme, requiring both un and un−1 to obtain un+1 .

Inequation (19.1.35) this shows up as both sn−1/2 and r n being needed to advancethe solution.For equations more complicated than our simple model equation, especiallynonlinear equations, the leapfrog method usually becomes unstable when the gradients get large. The instability is related to the fact that odd and even mesh points arecompletely decoupled, like the black and white squares of a chess board, as shownSample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5)Copyright (C) 1988-1992 by Cambridge University Press.Programs Copyright (C) 1988-1992 by Numerical Recipes Software.Permission is granted for internet users to make one paper copy for their own personal use.

Характеристики

Тип файла
PDF-файл
Размер
170,54 Kb
Материал
Тип материала
Высшее учебное заведение

Список файлов книги

Свежие статьи
Популярно сейчас
Как Вы думаете, сколько людей до Вас делали точно такое же задание? 99% студентов выполняют точно такие же задания, как и их предшественники год назад. Найдите нужный учебный материал на СтудИзбе!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
7021
Авторов
на СтудИзбе
261
Средний доход
с одного платного файла
Обучение Подробнее