I was trying to approximate 1st derivative of a function $\phi$ on a non uniform grids: basically my aim is to do this on a uniform grid on the same domain, so I can calculate it on the "new" grid. For example:

I have $x_k$ a non uniform grid, and $\xi_k$ a uniform grid, both in $[0,1]$ and with the same length.

Now what I have is:

1- $\phi_k=\phi(x_k)$

2- $\{x_k\}, \{\xi_k\}$

and I want to know $\phi_x(x_k)$ with an High order approx.

Tried to do:

a) calculate an "high order approximation" using $\phi(x_k)$ and uniform grid formula (with central finite difference) --> call it $\phi^u_{x_k}$

b) do $\phi_x=\phi^u_{x_k}*\frac{d\xi}{dx}$

but no good.

Any idea?

  • 2
    $\begingroup$ can you state more clearly your problem? i have hard time to follow your description.. $\endgroup$
    – Chip
    Commented Aug 22, 2016 at 2:34
  • $\begingroup$ Is your problem 1D? If so, you can just interpolate the values of your derivatives from one mesh to the other. $\endgroup$
    – nicoguaro
    Commented Aug 22, 2016 at 18:47

1 Answer 1


So not quite sure what you're missing, but here's how you go about doing this sort of thing.

So first, I am assuming this is 1D due to your description. Second, I'm assuming you know the relationship between points in the physical domain, $x$, and the computational domain, $\xi$, something along the lines of $x=x(\xi)$. Given you have this relationship, you can do the following for some function $\phi(\cdot)$:

$$\begin{align} \frac{\partial \phi}{\partial x} &= \frac{\partial \phi}{\partial \xi} \frac{\partial \xi}{\partial x}\\ \frac{\partial \phi}{\partial x} &= \frac{\partial \phi}{\partial \xi} \left(\frac{\partial x}{\partial \xi}\right)^{-1}\\ \end{align}$$

With this representation, since you know $x(\xi)$, you can produce the second term exactly in the multiplication. So now you just need to approximate the first term, $\frac{\partial \phi}{\partial \xi}$. This term can be approximated using normal finite difference schemes. Using a central difference, for example, you could get the following:

$$\frac{\partial \phi}{\partial x} = \left(\frac{\phi_{i+1}-\phi_{i-1}}{2\Delta \xi}\right) \left(\frac{\partial x}{\partial \xi}\right)^{-1}$$

In this case, $\phi_{i}$ is associated to both $x_i$ and $\xi_i$, where $\phi_i = \phi(x_i)$, and where, in addition, $\phi_i = \phi(x(\xi_i))$. This should help you understand how to compute the necessary quantity you're after.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.