I recall that there are algorithms for generating divergence-free random fields, but I'm not particularly familiar with them. In another code I worked with more when I was younger, I recall discussing with a much more senior researcher than myself this issue, and if I recall correctly he said to not worry about the initial condition not satisfying the divergence constraint (the divergence was non-zero but known), as the numerical method will enforce the divergence constraint for all future time steps. Presumably one could modify the algorithm (this was a "pressure projection scheme") to take an arbitrary velocity field along with the desired divergence field and correct the initial velocity field to be divergence free. This may not preserve the desired statistical properties of the noise, however.
Re:GPU Fluid
by btrettel on Wednesday January 10, 2018 @05:54PM
(#16119920)
Fluid dynamicist here. If a simulation is too symmetric, one can insert random noise into the initial conditions. I've done this in the past, and it's fine, even physically justified as reality is rarely so perfect. There are measures of the noise that one can match.
[ Parent
| on HN ]
How do you ensure the initial conditions are divergence-free after introducing the noise?
Great question. I don't recall precisely what the research code I used then did. The velocity fields for constant mass density incompressible flow need to be divergence-free. But other variables and other situations do not have the same restrictions (though they might need to satisfy some other conditions). The code might have introduced noise in the the temperature field.
Small perturbations in the velocity field are totally fine even if they are not divergence-free. Most fluid dynamics codes used a discrete Poison equation to enforce the conservation of mass (i.e. divergence-free velocity field). Here is some background: https://en.wikipedia.org/wiki/Discrete_Poisson_equation#Appl...
Re:GPU Fluid
by adrianratnapala on Wednesday January 10, 2018 @10:32PM
(#16121236)
One trick would be to generate a random field and then take its curl. Perhaps there are better ways though.