Note
Go to the end to download the full example code.
Generating a Random 2D Vector Field
As a first example we are going to generate a 2d vector field with a Gaussian covariance model on a structured grid:

Let us have a look at the influence of the covariance model. Choosing the exponential model and keeping all other parameters the same

and we see, that the wiggles are much “rougher” than the smooth Gaussian ones.
Applications
One great advantage of the Kraichnan method is, that after some initializations, one can compute the velocity field at arbitrary points, online, with hardly any overhead. This means, that for a Lagrangian transport simulation for example, the velocity can be evaluated at each particle position very efficiently and without any interpolation. These field interpolations are a common problem for Lagrangian methods.
Total running time of the script: (0 minutes 1.252 seconds)