====== randomfield ====== Create a velocity field with * random spectral coefficients that decay exponentially * zero divergence * Dirichlet boundary conditions at the walls ===== options ===== -Nx --Nx # x gridpoints -Ny --Ny # y gridpoints -Nz --Nz # z gridpoints -a --alpha default == 0 Lx = 2 pi/alpha -g --gamma default == 0 Lz = 2 pi/gamma -lx --lx Lx = 2 pi lx -lz --lz Lz = 2 pi lz -sd --seed default == 1 seed for random number generator -s --smoothnes default == 0.4 smoothness of field, 0 < s < 1 -m --magnitude default == 0.2 magnitude of field, 0 < m < 1 -mf --meanflow perturb the mean -s1 --s1-symmetry satisfy s1 symmetry -s2 --s2-symmetry satisfy s2 symmetry -s3 --s3-symmetry satisfy s3 symmetry (trailing arg 1) output file ===== mathematics ===== The field takes the form {\bf u}(x,y,z) = \sum_{jklm} u_{jklm} T_l(y) e^{2 \pi \, i (jx/Lx + kz/Lz)} {\bf e}_m where the spectral coefficients are assigned according to u_{jklm} = (\text{random # in }[-1, 1]) * \text{(1-smoothness)}^{|l| + |j| + |k|} with corrections to meet boundary and divergence conditions and rescaling so that L2Norm(u) = magnitude. The form of spectral decay chosen is crude, but normally what is needed in a random field is that it meets the BCs and zero-div, is controllably smooth, and excites modes with all symmetries. It would probably be better to work the length scales Lx,Ly,Lz into the exponent of ''(1-smoothness)'', so that the variations in the random field are roughly spatially isotropic.