-
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
Smaller L in twodturb_stochasticforcing.jl does not work #19
Comments
It's not a bug, but a limitation in the example. The value of Let me know if that works for you. |
As a side note, |
ah I see, thanks. This is a bit suprising to me as I would expect a smaller domain to not need a smaller timestep, but perhaps it is related to the forcing somehow? Btw, is there some kind of scaling of the velocity fields vs.u and vs.v ? I'm trying to advect some particles by them but I'm getting very small velocity values which don't seem to be consistent with the movement of vortices in the vorticity field. |
@natschil, with a quick glance at your question let me say the following: Indeed @glwagner suggestion would "heal" your problem. But, as you mention, thinking of the CFL criterion it's very counterintuitive that you need to reduce I believe that the problem you are pointing out stems from a different numerical instability that has nothing to do with CFL. Instead, it seems you've hit a numerical instability that comes from the hyper viscous term There is a different numerical stability criterion (other than CLF) that has to be satisfied for the hyper viscous term. For a hyper-viscosity of
For the default values of the example:
When you change domain size to
so the value You can "heal" this by either reducing (Chris Bretherton has a brief discussion on the subject here: https://atmos.uw.edu/academics/classes/2012Q2/581/lect/lect21.pdf but if you come across a more detailed reference please let me know.) |
So it turns out in this case that it's not that "the viscous/diffusive terms being too small" (as @glwagner points out) but in fact that they were very big! Although my first reaction would be exactly what @glwagner suggested, I think there is a bit more to it. I agree that this is very counter-intuitive. |
@natschil: Regarding you question about scaling. No there is not any scaling imposed on velocities. Can you perhaps show me what you are trying to do and point out where the problem is through an example script? I'll try to dig into it. |
@natschil: A way around these numerical instabilities related to hyper viscosity is to use semi-implicit time stepper See:
or some notes I've written up (which explain how we implement this time stepper in |
@navidcy thanks for the detailed response! I will try using ETDRK4, I didn't try it before as most of the examples seemed to use some form of RK4. Actually I'm trying to solve Navier-Stokes for the case without hyperviscosity, am I correct that I get this by specifying nnu=1 and not specifying mu and nmu? For some context as to what I am trying to do: I would like to have a turbulent 2d flow in which has different vortices at various times in order to test some methods for computing Lagrangian coherent structures (cf https://coherentstructures.github.io/CoherentStructures.jl/latest/). For this I need a velocity field with which I advect particles, what I do is that I save the velocity field at various points and then interpolate and solve an ode to get trajectories (there are of course better ways to do this). If I do this I get something like: https://gist.github.com/natschil/2b4713b4b0d821c5bc84d07f20aeb07d Here I get maximum(abs.(all_us)) = 0.0134 (and similar for v), but a the vortices seem to move quite a bit than that. So I was thinking that maybe u and v are somehow scaled, but if this is not the case maybe I'm doing something else wrong. PS: What kind of dealiasing do you use ? |
I believe this is where your problems stem from. Let me know if that works.
Let me know if these clear out your issues and if there is anything else you want. |
@navidcy @natschil it would also be possible to "use dealiasing" by adding https://gist.github.com/natschil/2b4713b4b0d821c5bc84d07f20aeb07d This is more correct because you dealias between substeps (which could matter for multistep schemes like RK4). Note that the dealiasing functions are part of It would be pretty interesting to write a new module for |
@navidcy :
Yes, with normal viscosity. Thanks for the comment about removing drag, I was doing it wrong until now. Maybe the additional drag is why my particles move too slowly -- I'm guessing that in Navier-Stokes+drag the vorticity no longer obeys an advection-diffusion equation like it does in the ordinary Navier-Stokes equation, so I shouldn't expect the vorticity to be advected-diffused by the flow. Since I want the vortices to be as Lagrangian as possible, it probably makes sense to just bite the bullet and run things for a long time until they are more or less statistically stable (unless the stochastic forcing part is what makes it slow, and there is an implementation of deterministic forcing I can use somewhere and this is faster). Note that if you have any better suggestions as to how to get Lagrangian vortices of reasonable size with e.g. hyper/o-viscosity I'm all ears :)
Thanks! I will try this tomorrow. @glwagner: Though if I understood correctly you are actually specifically interested in interpolating the velocity fields (in a fancy way?) to find tracer trajectories, because that is actually the topic you are researching? No, but I need to seed particles (or more accurately a finite-difference stencil of particles) at different points of space and time, and the easiest way to do this is to save the velocity fields and interpolate. |
@natschil, I have thoughts on how you could get a mature equilibrated 2D turbulent flow. I don't really understand why you object to linear drag and want to have an advection-diffusion equation. But if that's what you need then yes, plain viscosity is the way to go. I think though that this discussion starts drifting away from being an issue of the package. I am more than happy to resume the discussion over email (I'm sure @glwagner would be happy to join). What do you think? Before doing that though let's sort out the issue. Let me know if what I suggested regarding (i) hyper viscosity coefficient value or using ETDRK4 and (ii) calling |
Yes, that seems to have fixed it! Thanks for the help! |
Setting L = 1\pi in twodturb_stochasticforcing.jl gives a NaN solution, is this a bug somewhere?
The text was updated successfully, but these errors were encountered: