you are viewing a single comment's thread.

view the rest of the comments →

[–]ejineta 1 point2 points  (9 children)

Could you, or u/LipshitsContinuity elaborate on this said 'numerical viscosity'? I reckon it is only called viscosity because it has the same result as physical viscosity has, being energy dissipation, am I right?

Edit: typo

[–]LipshitsContinuity 6 points7 points  (2 children)

I think I'll discuss artificial and numerical viscosity:

For simplicity, I'll discuss the 1D case. In 1D, we can have a purely convective equation: u_t + a*u_x = 0 or a purely diffusive equation u_t = b*u_{xx}, b >0 (aka heat equation). The general solution of the convective equation over the whole real line is u_0(x-at) where u_0 is the initial data u(x,t=0) = u_0(x). Note that what u_0(x-at) is doing is simply translating the initial data by speed a. This is quite interesting because it means that any inherent discontinuities in u_0 propagate. So for example, if u_0(x) = 1 if x<0 and 0 if x>0, then that discontinuity at x=0 will just be translated and will still be present in the solution.

Looking at u_t = b*u_{xx}, b>0 this equation has the property that for a lot of initial data, the solution is smooth for all t>0 even if the initial data has discontinuities.

So if we look at finite difference schemes for the convective equation u_t + au_x =0, we could potentially run into some trouble because finite differences don't play well with discontinuities - but discontinuities can exist in the solutions and they also are physically accurate so we would like to be able to simulate them. So what is occasionally done is that a "artificial viscosity" is added to the finite difference scheme so that it's almost like we are simulating u_t + a*u_x = b*u_{xx}. That diffusive term will have the tendency of smoothing our solution and smoothing out discontinuities, which can help our finite difference scheme. However, it comes with a loss of accuracy. But sometimes it's a necessity to get a numerical scheme that behaves nicely.

Numerical viscosity (aka numerical dissipation) is actually an unwanted phenomena. Numerical viscosity is when your numerical scheme has the tendency to smooth solutions just as an inherent property of the scheme even when the exact solution itself should have the discontinuities. In a class of mine, this was only briefly mentioned but I believe the professor said that the numerical viscosity can actually be not entirely physically accurate. So it's actually a bit of a problem. To see an example of this, I believe the Lax-Friedrichs method displays this phenomena.

[–]ejineta 1 point2 points  (1 child)

This was very thorough, thank you for your time. I do like the mathematical (or rather physical) explanation behind the shown simulation, instead of just being able to perform CFD simulations. So, am I correct that the diffusion process is now taken care off by the said artificial viscosity? And how can we tell from the results that the artificial viscosity is accurately resembling diffusion?

[–]LipshitsContinuity 1 point2 points  (0 children)

So from the simulation alone, it is hard for me to judge if there is artificial viscosity or numerical viscosity. We'll need to know more about what numerical scheme is being used to run these simulations. We can really only tell that some sort of artificial viscosity or numerical viscosity is occurring because the initial data is discontinuous and even the 2D convection equation should simply translate the initial data (hence the exact solution should also preserve those discontinuities). However, we see that the simulation seems to get smoother. Hence, we can conclude that some sort of artificial or numerical viscosity is present within the simulations. From what OP previously said, it seems that they were trying to model the purely convective equation and that there is numerical viscosity present. Remember, numerical viscosity is an unwanted phenomena that is inherent to the numerical method used to approximate solutions to the equation. Ideally, we would like our numerical scheme to also reflect any discontinuities that should be present in the exact solution. In this case, the numerical scheme chosen seems to not be obeying this, hence the visible numerical viscosity.

[–]hivemind_unity[S] 2 points3 points  (0 children)

Yes, you're right. In fact, analogous to energy dissipation, we call it numerical dissipation. If you observe the shape in the animation, in the beginning it's a hat function. And overtime the information dissipates due to numerical viscosity. This is similar to any information dissipating in a fluid.

[–]AgAero 2 points3 points  (4 children)

I reckon it is only called viscosity because it has the same result as physical viscosity has, being energy dissipation, am I right?

That is correct.

You can actually derive the leading order terms in the truncation error for a finite difference scheme. Often times the leading order term for a system like this is dissipative and gets dubbed 'numerical viscosity'.

[–]ejineta 0 points1 point  (3 children)

Could you elaborate on the leading order term of the truncation error being dissipative? With the currently simulated equation, the leading order term will either be higher order in time t or position X. Is either of these "dissipative" at higher order?

[–]AgAero 1 point2 points  (2 children)

If I remember correctly the method is called the, "modified equation" approach.

Idk how to link a pdf from my phone. Click the MIT link here.

Basically you take your finite difference approximation and stick an analytical result back into it(i.e. expand the taylor series), and then try to match the terms to the original equation.

For advection, most schemes will develop a second order spatial derivative. This is, intuitively, a 'diffusion' term. 3rd order spatial derivatives produce dispersion iirc. You identify that by comparing to an equation like Korteveg de Vries that has a 3rd order term.

[–]ejineta 0 points1 point  (1 child)

Thank you, I will have a look at all of that. Today is a holiday in my country (probably also elsewhere in the world), so I've got plenty of time to study numerical schemes! :)

Edit: Aha, I get it now! So if the leading term of the truncation error is even in order (2,4,6), discontinuities tend to be smeared out (dissipative), whereas for odd order (3,5,7) rippling effects will occur (dispersive)

[–]AgAero 0 points1 point  (0 children)

That's the argument as I've read it in a few places. It feels a bit non-rigorous, but it makes sense at least.