Synthetic Isotropic Turbulence based on a Specified Energy Spectrum¶
Author: | Tony Saad |
---|
Formulation¶
We start with a generalized Fourier series for a real valued scalar function
For simplicity, we set \(k_{m}\equiv\frac{2\pi m}{L}\) as the \(m^{\mbox{th}}\) wave number. Also, if the mean of \(f\) is known, we have
Hence, for a turbulent velocity field with zero mean (in space), we can set \(a_{0}=0\). At the outset, we have
We now introduce the following changes
then
so that
The extension to 3D follows
where \(\mathbf{k}_{m}\equiv(k_{x,m},k_{y,m},k_{z,m})\) is the position vector in wave space and \(\mathbf{x}\equiv(x,y,z)\) is the position vector in physical space. Therefore, \(\mathbf{k}_{m}\cdot\mathbf{x}_{m}=k_{x,m}x+k_{y,m}y+k_{z,m}z\). A condensed form is
where \(\hat{\mathbf{u}}_{m}\equiv(\hat{u}_{m},\hat{v}_{m},\hat{w}_{m})\). Continuity dictates that
This gives
or
This equation can be enforced by setting
wave space. We therefore write the Fourier coefficients as
where \(\boldsymbol{\sigma}_{m}\) is a unit vector computed such that \(\mathbf{k}_{m}\cdot\boldsymbol{\sigma}_{m}=0\) at any point \(\mathbf{x}\). Note that this is the original formulation presented in :raw-latex:`\cite{davidson2008hybrid}`. While is true in the continuous sense, it becomes invalid when discretized leading to a diverging velocity field. I will show you how to fix this in the next paragraph.
The velocity vector at point \(\mathbf{x}\) is now at hand
The last step is to link \(q_{m}\) to the energy spectrum. This can be computed from
Enforcing Continuity¶
Given an analytic vector field \(\mathbf{u}\) such that \(\nabla\cdot\mathbf{u}=0\), we show here that this does not hold for the discrete continuity equation. Since different codes use different discretization schemes for the dilatation term (staggered vs collocated), one must first write the divergence formula in the desired discrete form and then infer the condition that enforces discrete divergence. A classic example is the Taylor-Green vortex initialization. This velocity field is given by
It is true that, for this velocity field, \(\nabla\cdot\mathbf{u}=0\) because
However, when used to initialize a discrete grid, the resulting discrete continuity equation does not always hold true. Take for instance the Taylor-Green vortex and initialize a staggered grid. Continuity, to second order in space on a staggered grid implies
Then, using the formula for \(u\) and \(\varv\), e.g. \(u(x+\tfrac{\Delta x}{2},y)=\sin(x+\tfrac{\Delta x}{2})\cos y\), etc…, one recovers
which is guaranteed to be zero when \(\Delta x=\Delta y\). A nonuniform grid spacing will always result in a diverging initial condition. The overall less that I’d like to convey here is that it is generally preferable to operate with the discrete form of equations since those usually bring up hidden issues that can be easily missed in the continuous sense.
Back to our isotropic velocity field, recall that
staggered grid, we have
Here, for example,
are rendered begnin when using mathematica, bless Stephen Wolfram), we recover the following
or, written in a more convenient form
where
A sufficient condition for the discrete continuity equation given in to be zero is to make
This means that instead of selecting \(\boldsymbol{\sigma}_{m}\) such that it is perpendicular to \(\mathbf{k}_{m}\)(\(\boldsymbol{\sigma}_{m}\cdot\mathbf{k}_{m}=0\)), we instead choose \(\boldsymbol{\sigma}_{m}\)to be perpendicular to \(\tilde{\mathbf{k}}_{m}\). Interestingly, in the limit as the grid spacing approaches zero, \(\tilde{\mathbf{k}}_{m}\) will approach \(\mathbf{k}_{m}\). This is so cool!
In Practice¶
Specify the number of modes \(M\). This will determine the Fourier representation of the velocity field at every point in the spatial domain
Compute or set a minimum wave number \(k_{0}\)
Compute a maximum wave number \(k_{\text{max }}=\frac{\pi}{\Delta x}\). For multiple dimensions, use \(k_{\text{max}}=\max(\frac{\pi}{\Delta x},\frac{\pi}{\Delta y},\frac{\pi}{\Delta z})\)
Generate a list of \(M\) modes: \(k_{m}\equiv k(m)=k_{0}+\frac{k_{\text{max}}-k_{\text{0}}}{M}(m-1)\). Those will correspond to the magnitude of the vector \(\mathbf{k}_{m}\). In other words, \(k_{m}\) is the radius of a sphere.
Generate four arrays of random numbers, each of which is of size M (those will be needed next). Those will correspond to the angles: \(\theta_{m}\), \(\varphi_{m}\), \(\psi_{m}\), and \(\alpha_{m}\).
- Compute the wave vectors. To generate as much randomness as possible, we write the wave vector as a function of two angles in 3D space. This means\[k_{x,m}=\sin(\theta_{m})\cos(\varphi_{m})k_{m}\]\[k_{y,m}=\sin(\theta_{m})\sin(\varphi_{m})k_{m}\]\[k_{x,m}=\cos(\theta_{m})k_{m}\]
- Compute the unit vector \(\boldsymbol{\sigma}_{m}\). Note that \(\boldsymbol{\sigma}_{m}\) lies in a plane perpendicular to the vector \(\mathbf{k}_{m}\). We choose the following\[\sigma_{x,m}=\cos(\theta_{m})\cos(\varphi_{m})\cos(\alpha_{m})-\sin(\varphi_{m})\sin(\alpha_{m})\]\[\sigma_{y,m}=\cos(\theta_{m})\sin(\varphi_{m})\cos(\alpha_{m})+\cos(\varphi_{m})\sin(\alpha_{m})\]\[\sigma_{z,m}=-\sin(\theta_{m})\cos(\alpha_{m})\]
To enforce continuity, compute vector \(\tilde{\mathbf{k}}_{m}\) and make \(\boldsymbol{\sigma}_{m}\) perpendicular to \(\tilde{\mathbf{k}}_{m}\).
Once those quantities are computed, loop over the mesh. For every point on the mesh, loop over all M modes. For every mode, compute \(q_{m}=2\sqrt{E(k_{m})\Delta k}\) and \(\beta_{m}=\mathbf{k}_{m}\cdot\mathbf{x}-\psi_{m}\). Finally, construct the following summations (at every point \((x,y,z)\) you will have a summation of \(M\)-modes)