Geometric Grid Spacing for Boundary-Sensitive Numerical Models
Summary
The document presents a way to create a nonuniform numerical grid on the unit interval when a solution changes rapidly near both endpoints. It assumes a finite-difference problem, where grid density near sensitive boundaries can matter for accuracy. The proposed construction generates points over the first half of the interval with geometrically increasing spacing, then reflects those points around the midpoint to cover the second half symmetrically.
Two parameters control the construction: the number of intervals and a positive stretching factor. Increasing the stretching factor concentrates points more tightly near the boundaries. The response also mentions exponential stretching and numerical grid generation as broader approaches. It does not compare methods, quantify accuracy, or demonstrate the grid on a particular differential equation, so the parameter choice must be assessed for the specific problem.
Key ideas
- A nonuniform grid can allocate more points where a numerical solution is most sensitive.
- The proposed method makes spacing increase geometrically across half of the interval.
- Reflecting the first half around the midpoint creates a symmetric full grid.
- The interval count and positive stretching factor control the point spacing.
- Grid nonuniformity affects accuracy, and the suggested method is not benchmarked against alternatives.
Tags
Full text
# how to make a nonlinear gird where grid points are not equally spaced?
# how to make a nonlinear gird where grid points are not equally spaced?
I need to make a grid [0,1] with points that are concentrated close to the edges (close to 0 and 1) while the remaining points in the middle can be equally spaced. The reason for doing this is that I know the solution is very sensitive at the edges. Any ideas on how I can do this?
## Answer by RRL (score 2)
https://quant.stackexchange.com/a/16438
Presumably you are trying to use a finite difference method to solve a differential equation. The non-uniformity of the grid has an impact on accuracy. Hence, it is useful to include a parameter in the grid-generation algorithm that controls the rate at which the spacing increases away from the boundary.
There are many approaches for generating non-uniform grids (eg., exponential stretching, etc.) Searching on "numerical grid generation" should provide you with more information.
Here is a simple approach where the grid spacing increases geometrically. For the interval $[0,1/2]$ generate grid points using $x_0 = 0$ and for $k = 1,2,\ldots,n$,
$$x_k = \frac{\alpha\sum_{j=1}^k(1 + \alpha)^{j-1}}{2[(1 + \alpha)^n-1]}.$$
Simply reflect the points across $x = 1/2$ to generate the grid over $[1/2,1].$
Control the spacing and the difference $x_1-x_0$ by choosing appropriate values for the parameters $\alpha >0$ and $n$. Larger values for $\alpha$ will produce finer grids near the boundary.Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.