3 ms·
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 di
by btrettel 9y ago
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.
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.