Interpolation onto an arbitrary mesh can be achieved using interface routines to the PSPLINE library developed by D. McCune.
For a set of one-dimensional arrays (S, F) of sizes N that need to be interpolated using cubic splines onto a grid SI of size NI, the interpolation call is:
CALL jsoInterp1d(N, S, F, NI, SI, FI)where FI is the output set of interpolated data at the SIs. Similarly there is a two-dimensional interpolation routine,
CALL jsoInterp2d(NT, NS, T, S, F, NTI, NSI, TI, SI, FI)to interpolate an NT times NS array F -- a function of NT poloidal grid points T and NS radial surface indexed by S -- onto a new grid (SI, TI) of size NTI times NSI. The routine returns FI, an NTI times NSI matrix. Periodic boundary conditions are assumed in T with neighboring poloidal points contiguous in memory.
Figure:
Interpolation of 65 times 64 arrays X and Z onto a 65 times 5 grid using the jsoInterp2d routine.