I am interested in generating a 1D non-uniform grid on the interval
[0, L] with
N points, where a region of width $\sigma$ and centred at $\mu$ is at a higher density and where the transition from low and high densities of grid points occurs over a length $\ell$. This is for a finite-difference code, where particular attention is required to a region with large gradients.
In my current implementation I specify low and high grid spacings and interpolate between these using a pair of
tanh functions. However in this scheme the total number of points isn't known a priori. I can then iteratively adjust the low and high densities until the total number of points is
N but this is quite convoluted in practice.
My question then is: can anyone help by describing a scheme for generating such a grid in a simpler way, perhaps something analogous to the way you might generate Gauss-Lobato points
x(i) = cos(i PI / N) where
i is the grid index.