-Once you are happy that `KH.jl` is capturing the most unstable mode, you can verify that the perturbation growth rate is comparable to the value that you got in `linstab.jl`. An easy way to do this is to plot the logarithm of the vertical velocity variance, $w^2$, as a function of time. Since the basic state has $w=0$, the vertical velocity does not have a contribution from the basic state and the amplitude of $w^2$ should grow like $e^{2\sigma t}$. You will need to add a line of code to calculate and then save the vertical velocity variance. You can do this either in `KH.jl` and save the vertical velocity variance to a file, or do the calculation in `plot_KH.jl` (the latter approach is probably easier). You might also like to plot the evolution of the perturbation kinetic energy (including both $u$ and $w$), where the perturbation is the departure from an x-average. Since $u$ has a non-zero $x$-average, we will need to remove the x-average of $u$ to get the perturbation, $u'$. To calculate an x-average of an array (say `u_xz`), install and use the Statistics package (`] add Statistics` followed by `using Statistics`), and then use `mean(u_xz, dims = 1)` which averages the array `u_xz` over its first dimension (in this case x). Plot a timeseries of the vertical velocity variance or the perturbation kinetic energy and overlay a line or curve indicating the growth rate from `linstab.jl`.
0 commit comments