This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
docs:utils:randomfield [2009/04/01 08:27] gibson |
docs:utils:randomfield [2010/02/02 07:55] (current) |
||
---|---|---|---|
Line 25: | Line 25: | ||
<fieldname> (trailing arg 1) output file | <fieldname> (trailing arg 1) output file | ||
</code> | </code> | ||
- | |||
===== mathematics ===== | ===== mathematics ===== | ||
Line 31: | Line 30: | ||
<latex> | <latex> | ||
- | {\bf u}(x,y,z) = sum_{jklm} u_{jklm} T_l(y) exp(2 pi i (jx/Lx + kz/Lz)) {\bf e}_m | + | {\bf u}(x,y,z) = \sum_{jklm} u_{jklm} T_l(y) e^{2 \pi \, i (jx/Lx + kz/Lz)} {\bf e}_m |
</latex> | </latex> | ||
Line 37: | Line 36: | ||
<latex> | <latex> | ||
- | u_{jklm} = (\text{random # in }[-1, 1]) * \text{smoothness}^{|l| + |j| + |k|} | + | u_{jklm} = (\text{random # in }[-1, 1]) * \text{(1-smoothness)}^{|l| + |j| + |k|} |
</latex> | </latex> | ||
with corrections to meet boundary and divergence conditions and rescaling so that L2Norm(u) = magnitude. | 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. | ||