glwagner / EadyTurbulence

Scripts for the numerical simulation of baroclinic equilibration in the "Eady" configuration
2 stars 0 forks source link

Grid-noise appears in simple_eady example #3

Closed navidcy closed 3 years ago

navidcy commented 4 years ago

If you run simple_eady.jl up some grid-scale noise appears at around 6hrs and then disappears...

This can be seen, e.g., by changing https://github.com/glwagner/EadyTurbulence/blob/95a5da1682bb7cc7d543c1573c9e5ba6d275bd02/simple_eady.jl#L34 to

end_time = 6hour # Simulation end time

Is this physical? I doubt... But how come the model continues and resolves itself from this situation...?

ali-ramadhan commented 4 years ago

Out of curiousity what resolution or grid spacing are you using?

I'm wondering if the second-order advection scheme is just being inaccurate at coarse resolutions.

navidcy commented 4 years ago

Same as the simple_eady.jl script.

ali-ramadhan commented 4 years ago

Hmmm, yeah I'll let @glwagner answer this but I'm not super surprised to see numerical artifacts at 64x64x32 grid points on a 1000x1000x4 km domain.

Oceananigans might need better numerical methods (better advection scheme?). Climbing on the priority of things to do...

navidcy commented 4 years ago

I'm actually not surprised to see numerical artifacts at this resolution. But I'm surprises they go away if you integrate for more... Usually when that happens NaNs are not far away.

ali-ramadhan commented 4 years ago

Ah interesting. I wonder if the Laplacian + biharmonic diffusivity are smoothing things out just in time, but not sure...

glwagner commented 4 years ago

@navidcy this is one of the dangerous aspects of a finite volume method. Grid noise can resolve itself.

There's no way to anticipate numerical artifacts from domain size and grid resolution alone. For example, a resting solution of u=0 is perfectly resolved at 64x64x32 whether the domain is 1 mm or 1 parsec wide. We need to know the spatial scales we expect to appear in the simulation. One of the challenges of this setup is predicting the spatial scales that appear. The Rossby radius of deformation is obviously one scale, but depending parameters, much smaller scales may arise, I think.

navidcy commented 4 years ago

Of course @glwagner, I agree....

But still, isn't it weird that artifacts appear and then go away?

glwagner commented 4 years ago

Yeah --- why would that be? Is it a time-stepping error?

navidcy commented 4 years ago

Well that's why I put up the issue in the first place! I find it rather strange. I've never seen it in any other turbulence simulation. Usually when grid-point noise appears then NaN values are eminent...

glwagner commented 4 years ago

Usually when grid-point noise appears then NaN values are eminent...

That's not my experience with finite volume methods! It is my experience with spectral methods (it also seems DG exhibits similar behavior).

But the question I thought you might be asking is: what process drives the generation of grid-scale noise at some specific time? For example, the physics might require scales below the grid scale. However, its surprising such physics would arise and then disappear later in the simulation.

glwagner commented 4 years ago

We use adaptive time-stepping, so a time stepper error is possible. Let's try lowering the CFL.

glwagner commented 4 years ago

@navidcy try changing this line:

https://github.com/glwagner/EadyTurbulence/blob/95a5da1682bb7cc7d543c1573c9e5ba6d275bd02/simple_eady.jl#L110

to

wizard = TimeStepWizard(cfl=0.02, Δt=20.0, max_change=1.1, max_Δt=2minute)

possibly its an error associated with the diffusion time-scale? 3 minute time step may be too long.

glwagner commented 4 years ago

I mean, that shouldn't be the case because the diffusive time-scale is fixed at a tenth of a day, so longer than an hour. But AB2 I think is actually particularly sensitive to diffusive CFL instabilities. Biharmonic is especially tricky. It's definitely worth understanding this problem thoroughly.

glwagner commented 4 years ago

Actually, I need to limit the time-step to 1 minute for stability.

navidcy commented 4 years ago

hm, after this discussion playing around a bit with TimeStepWizard input params I also tend to think that this is probably diffusive instability.

ali-ramadhan commented 4 years ago

If you suspect diffusivity instability it might be worth printing out the "diffusive CFL" number with something like

using Oceananigans.Diagnostics: AdvectiveCFL, DiffusiveCFL
...
dcfl = DiffusiveCFL(wizard)
print("Diffusive CFL: $dcfl")

but I think it might require PR https://github.com/climate-machine/Oceananigans.jl/pull/557 and it doesn't support multiple closures so might have to calculating it manually might be easiest for this issue.

Is the stability criterion for biharmonic diffusivty stricter than Laplacian diffusivity?

navidcy commented 3 years ago

Is this issue pertinent?

glwagner commented 3 years ago

doubtful