c17-5 (779605)
Текст из файла
78317.5 Automated Allocation of Mesh Points17.5 Automated Allocation of Mesh Pointsdy=gdx(17.5.1)becomesdydx=gdqdqIn terms of q, equation (17.5.2) as an FDE might be written"!!dxdx1yk − yk−1 − 2g+ gdqdqk(17.5.2)#=0(17.5.3)k−1or some related version.
Note that dx/dq should accompany g. The transformation betweenx and q depends only on the Jacobian dx/dq. Its reciprocal dq/dx is proportional to thedensity of mesh points.Now, given the function y(x), or its approximation at the current stage of relaxation,we are supposed to have some idea of how we want to specify the density of mesh points.For example, we might want dq/dx to be larger where y is changing rapidly, or near to theboundaries, or both. In fact, we can probably make up a formula for what we would likedq/dx to be proportional to. The problem is that we do not know the proportionality constant.That is, the formula that we might invent would not have the correct integral over the wholerange of x so as to make q vary from 1 to M , according to its definition. To solve this problemwe introduce a second reparametrization Q(q), where Q is a new independent variable.
Therelation between Q and q is taken to be linear, so that a mesh spacing formula for dQ/dxdiffers only in its unknown proportionality constant. A linear relation impliesd2 Q=0dq2or, expressed in the usual manner as coupled first-order equations,(17.5.4)dQ(x)dψ=ψ=0(17.5.5)dqdqwhere ψ is a new intermediate variable. We add these two equations to the set of ODEsbeing solved.Completing the prescription, we add a third ODE that is just our desired mesh-densityfunction, namelyφ(x) =dQdQ dq=dxdq dx(17.5.6)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).In relaxation problems, you have to choose values for the independent variable at themesh points. This is called allocating the grid or mesh.
The usual procedure is to picka plausible set of values and, if it works, to be content. If it doesn’t work, increasing thenumber of points usually cures the problem.If we know ahead of time where our solutions will be rapidly varying, we can put moregrid points there and less elsewhere. Alternatively, we can solve the problem first on a uniformmesh and then examine the solution to see where we should add more points. We then repeatthe solution with the improved grid. The object of the exercise is to allocate points in sucha way as to represent the solution accurately.It is also possible to automate the allocation of mesh points, so that it is done“dynamically” during the relaxation process.
This powerful technique not only improvesthe accuracy of the relaxation method, but also (as we will see in the next section) allowsinternal singularities to be handled in quite a neat way. Here we learn how to accomplishthe automatic allocation.We want to focus attention on the independent variable x, and consider two alternativereparametrizations of it. The first, we term q; this is just the coordinate corresponding to themesh points themselves, so that q = 1 at k = 1, q = 2 at k = 2, and so on.
Between any twomesh points we have ∆q = 1. In the change of independent variable in the ODEs from x to q,784Chapter 17.Two Point Boundary Value Problemswhere φ(x) is chosen by us. Written in terms of the mesh variable q, this equation isdxψ=dqφ(x)(17.5.7)dx|d ln y|+∆δ dy/dx dQ1φ(x) ==+ dx∆yδ dQ =or(17.5.8)(17.5.9)where ∆ and δ are constants that we choose. The first term would give a uniform spacingin x if it alone were present.
The second term forces more grid points to be used where y ischanging rapidly. The constants act to make every logarithmic change in y of an amount δabout as “attractive” to a grid point as a change in x of amount ∆. You adjust the constantsaccording to taste. Other strategies are possible, such as a logarithmic spacing in x, replacingdx in the first term with d ln x.CITED REFERENCES AND FURTHER READING:Eggleton, P.
P. 1971, Monthly Notices of the Royal Astronomical Society, vol. 151, pp. 351–364.Kippenhan, R., Weigert, A., and Hofmeister, E. 1968, in Methods in Computational Physics,vol. 7 (New York: Academic Press), pp. 129ff.17.6 Handling Internal Boundary Conditionsor Singular PointsSingularities can occur in the interiors of two point boundary value problems. Typically,there is a point xs at which a derivative must be evaluated by an expression of the formS(xs ) =N (xs , y)D(xs , y)(17.6.1)where the denominator D(xs , y) = 0.
In physical problems with finite answers, singularpoints usually come with their own cure: Where D → 0, there the physical solution y mustbe such as to make N → 0 simultaneously, in such a way that the ratio takes on a meaningfulvalue. This constraint on the solution y is often called a regularity condition. The conditionthat D(xs , y) satisfy some special constraint at xs is entirely analogous to an extra boundarycondition, an algebraic relation among the dependent variables that must hold at a point.We discussed a related situation earlier, in §17.2, when we described the “fitting pointmethod” to handle the task of integrating equations with singular behavior at the boundaries.In those problems you are unable to integrate from one side of the domain to the other.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).Notice that φ(x) should be chosen to be positive definite, so that the density of mesh points iseverywhere positive. Otherwise (17.5.7) can have a zero in its denominator.To use automated mesh spacing, you add the three ODEs (17.5.5) and (17.5.7) to yourset of equations, i.e., to the array y[j][k]. Now x becomes a dependent variable! Q and ψalso become new dependent variables. Normally, evaluating φ requires little extra work sinceit will be composed from pieces of the g’s that exist anyway.
The automated procedure allowsone to investigate quickly how the numerical results might be affected by various strategiesfor mesh spacing. (A special case occurs if the desired mesh spacing function Q can be foundanalytically, i.e., dQ/dx is directly integrable. Then, you need to add only two equations,those in 17.5.5, and two new variables x, ψ.)As an example of a typical strategy for implementing this scheme, consider a systemwith one dependent variable y(x). We could set.
Характеристики
Тип файла PDF
PDF-формат наиболее широко используется для просмотра любого типа файлов на любом устройстве. В него можно сохранить документ, таблицы, презентацию, текст, чертежи, вычисления, графики и всё остальное, что можно показать на экране любого устройства. Именно его лучше всего использовать для печати.
Например, если Вам нужно распечатать чертёж из автокада, Вы сохраните чертёж на флешку, но будет ли автокад в пункте печати? А если будет, то нужная версия с нужными библиотеками? Именно для этого и нужен формат PDF - в нём точно будет показано верно вне зависимости от того, в какой программе создали PDF-файл и есть ли нужная программа для его просмотра.















