c19-4 (779619), страница 2

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

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

Inhomogeneous terms∇u = g can be again included by adding a suitable solution of the homogeneousequation, or more simply by taking boundary terms over to the right-hand side.For example, the conditionbecomesat x = 0u1,l − u−1,l= gl2∆(19.4.23)(19.4.24)where gl ≡ g(y = l∆). Once again we write the solution in the form (19.4.16),where now ∇u0 = 0 on the boundary. This time ∇uB takes on the prescribed valueon the boundary, but uB vanishes everywhere except just outside the boundary.Thus equation (19.4.24) givesuB−1,l = −2∆gl(19.4.25)All the uB terms in equation (19.4.19) vanish except when j = 0:u01,l + u0−1,l + u00,l+1 + u00,l−1 − 4u00,l = 2∆gl + ∆2 ρ0,l(19.4.26)Thus u0 is the solution of a zero-gradient problem, with the source term modifiedby the replacement∆2 ρ0,l → ∆2 ρ0,l + 2∆gl(19.4.27)Sometimes Neumann boundary conditions are handled by using a staggeredgrid, with the u’s defined midway between zone boundaries so that first derivativesare centered on the mesh points.

You can solve such problems using similartechniques to those described above if you use the alternative form of the cosinetransform, equation (12.3.23).Cyclic ReductionEvidently the FFT method works only when the original PDE has constantcoefficients, and boundaries that coincide with the coordinate lines. An alternativealgorithm, which can be used on somewhat more general equations, is called cyclicreduction (CR).We illustrate cyclic reduction on the equation∂u∂2u ∂2u+ c(y)u = g(x, y)+ 2 + b(y)2∂x∂y∂y(19.4.28)This form arises very often in practice from the Helmholtz or Poisson equations inpolar, cylindrical, or spherical coordinate systems. More general separable equationsare treated in [1].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).∂u= g(y)∂x862Chapter 19.Partial Differential EquationsThe finite-difference form of equation (19.4.28) can be written as a set ofvector equationsuj−1 + T · uj + uj+1 = gj ∆2(19.4.29)T = B − 21(19.4.30)where the 21 comes from the x-differencing and the matrix B from the y-differencing.The matrix B, and hence T, is tridiagonal with variable coefficients.The CR method is derived by writing down three successive equations like(19.4.29):uj−2 + T · uj−1 + uj = gj−1 ∆2uj−1 + T · uj + uj+1 = gj ∆2uj + T · uj+1 + uj+2 = gj+1 ∆(19.4.31)2Matrix-multiplying the middle equation by −T and then adding the three equations,we get(1)uj−2 + T(1) · uj + uj+2 = gj ∆2(19.4.32)This is an equation of the same form as (19.4.29), withT(1) = 21 − T2(1)gj= ∆2 (gj−1 − T · gj + gj+1 )(19.4.33)After one level of CR, we have reduced the number of equations by a factor oftwo.

Since the resulting equations are of the same form as the original equation, wecan repeat the process. Taking the number of mesh points to be a power of 2 forsimplicity, we finally end up with a single equation for the central line of variables:(f)T(f) · uJ/2 = ∆2 gJ/2 − u0 − uJ(19.4.34)Here we have moved u0 and uJ to the right-hand side because they are knownboundary values.

Equation (19.4.34) can be solved for uJ/2 by the standardtridiagonal algorithm. The two equations at level f − 1 involve uJ/4 and u3J/4 . Theequation for uJ/4 involves u0 and uJ/2 , both of which are known, and hence can besolved by the usual tridiagonal routine. A similar result holds true at every stage,so we end up solving J − 1 tridiagonal systems.In practice, equations (19.4.33) should be rewritten to avoid numerical instability. For these and other practical details, refer to [2].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).Here the index j comes from differencing in the x-direction, while the y-differencing(denoted by the index l previously) has been left in vector form. The matrix Thas the form19.5 Relaxation Methods for Boundary Value Problems863FACR Method(r)(r)kbkj + ubkj+2r = ∆2 gjubkj−2r + λk u(19.4.35)(r)Here λk is the eigenvalue of T(r) corresponding to the kth Fourier mode.

For(r)the equation (19.0.3), equation (19.4.5) shows that λk will involve terms likecos(2πk/L) − 2 raised to a power. Solve the tridiagonal systems for ubkj at the levelsrrrrj = 2 , 2 × 2 , 4 × 2 , ..., J − 2 . Fourier synthesize to get the y-values on thesex-lines. Then fill in the intermediate x-lines as in the original CR algorithm.The trick is to choose the number of levels of CR so as to minimize the totalnumber of arithmetic operations.

One can show that for a typical case of a 128×128mesh, the optimal level is r = 2; asymptotically, r → log2 (log2 J).A rough estimate of running times for these algorithms for equation (19.0.3)is as follows: The FFT method (in both x and y) and the CR method are roughlycomparable. FACR with r = 0 (that is, FFT in one dimension and solve thetridiagonal equations by the usual algorithm in the other dimension) gives about afactor of two gain in speed. The optimal FACR with r = 2 gives another factorof two gain in speed.CITED REFERENCES AND FURTHER READING:Swartzrauber, P.N. 1977, SIAM Review, vol.

19, pp. 490–501. [1]Buzbee, B.L, Golub, G.H., and Nielson, C.W. 1970, SIAM Journal on Numerical Analysis, vol. 7,pp. 627–656; see also op. cit. vol. 11, pp. 753–763. [2]Hockney, R.W. 1965, Journal of the Association for Computing Machinery, vol. 12, pp. 95–113.

[3]Hockney, R.W. 1970, in Methods of Computational Physics, vol. 9 (New York: Academic Press),pp. 135–211. [4]Hockney, R.W., and Eastwood, J.W. 1981, Computer Simulation Using Particles (New York:McGraw-Hill), Chapter 6. [5]Temperton, C. 1980, Journal of Computational Physics, vol. 34, pp. 314–329. [6]19.5 Relaxation Methods for Boundary ValueProblemsAs we mentioned in §19.0, relaxation methods involve splitting the sparsematrix that arises from finite differencing and then iterating until a solution is found.There is another way of thinking about relaxation methods that is somewhatmore physical. Suppose we wish to solve the elliptic equationLu = ρ(19.5.1)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).The best way to solve equations of the form (19.4.28), including the constantcoefficient problem (19.0.3), is a combination of Fourier analysis and cyclic reduction,the FACR method [3-6].

If at the rth stage of CR we Fourier analyze the equations ofthe form (19.4.32) along y, that is, with respect to the suppressed vector index, wewill have a tridiagonal system in the x-direction for each y-Fourier mode:.

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

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

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

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