-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dealias sol
before computing nonlinear terms
#246
Conversation
Are there any docstrings that are updated? This changes default behavior and makes it so that filters can't be used without setting |
|
I think the exponential filters we have defined assume that the flow is not dealiased or won't work as expected with dealiasing. We could get rid of these? |
Agree -- I think we should remove the |
I still feel that there is a disconnect in communication. I am trying to say that regardless of filtering, hyper viscosity, and what not, dealiasing should be -- in principle -- done. Not doing dealiasing brings errors from aliasing. Oftentimes we can get away with thous with filtering or viscosity. But even in cases where filtering/viscosity seems to work "OK", I can't see why doing dealiasing on top of everything else shouldn't be done. In fact, I'm trying to argue that this is the proper way. If we forget about examples, code changes, and technicalities that should come along with such a change, do you agree with the above statement? |
I believe that the papers which introduce filtering do not dealias. I agree that aliasing errors are real, however. I wouldn't try to enter an argument about whether or not a numerical computation without dealiasing is "improper" or "incorrect". Not dealiasing is essentially a performance optimization which seems to rely on an assumption that power in high wavenumbers is negligible due to explicit dissipation. It's a common approximation in many spectral calculations --- proper or not. I'd be fine with making dealiasing default and even getting rid of all the examples that use filtering. It's a bit of work to get there and does reduce available features, so there's some cause to pause and consider. |
No, I don't agree that dealiasing "should" be done in all circumstances. I think dealiasing is necessary to eliminate aliasing errors. Aliasing errors often compromise solutions with significant power at high wave numbers. This often occurs in marginally resolved simulations whose resolution is close to being as low as necessary to resolve the dynamics of a particular flow. |
Oh, I hope the disagreement was not due the use of "proper" in the PR title... I can happily take that back! It's not about being proper or not. My main point was that there always exists some aliasing error and if users decide to ignore it because it doesn't seem to be important in the particular calculation or because they want the code to run faster then fair enough -- they can do it. |
sol
before computing nonlinear terms
OK, I see this point. Now I'm skeptical about this whole PR... |
It's probably a positive change. Users looking for a speed up can set dealias=0 and interpret their resolution as the full resolution. Most people perform computations at marginal resolution. Filtering seems like an alright alternative to dealiasing, but hard to interpret. The conservative approach is to dealias so its a good default. I think dealiasing by default is clearer though using the 3/2 rule, because people won't get confused about the resolution their running at. |
Yes, but that requires padding, etc... Also, I never understood how FFTs are optimised then because e.g. I know some argue for double padding, e.g. |
An alternative to this PR would be to demonstrate dealiasing in an example. So that could, e.g., dealias!(sol, grid)
stepforward!(prob) But question that arises (in my head at least) is: Is this enough for multi-step time-stepping? E.g., RK4 involves 4 calls of |
These days FFTs are optimized for grids that are products of many possible small numbers like 2, 3, 5, 7, and possibly more. |
I don't think it's enough. To completely eliminate aliasing errors we have to dealias after every nonlinear product I think. |
Then the example could demonstrate how the user can import import GeophysicalFlows.TwoDNavierStokes.calcN!
function calcN!(N, sol, t, clock, vars, params, grid)
dealias!(sol, grid)
TwoDNavierStokes.calcN_advection!(N, sol, t, clock, vars, params, grid)
TwoDNavierStokes.addforcing!(N, sol, t, clock, vars, params, grid)
return nothing
end Or this gets to much into the nitty-gritty of the code? |
You could set the default |
Let's first wait for FourierFlows/FourierFlows.jl#285 first. |
This PR ensures that before any calculation of quadratic nonlinear terms the state vector
sol
is properly dealiased.Closes #247.