Open navidcy opened 3 years ago
Okay, I've got this notebook, which has periodic boundary conditions, and it has a sine curve, instead of a gaussian curve, and it moves a distance with a constant velocity a. I've plotted both the numerical and analytical solution using a backward, forward(not shown in the notebook since the case I'm taking has a positive advection speed, and forward difference is unstable) and central difference schemes.
I've also plotted a convergence scheme, and while the stability of backward difference increases with the number of points, the central difference stability doesn't show such a straightforward curve. It shows a second order stability up to a certain number of points, but if we increase the number of points further, the error increases. I've seen this happen often due to roundoff error increasing, but we don't have so much points such that roundoff errors can play any significant part (or so I think). Do you have any suggestions?
I’ll look tomorrow!
But is forward scheme always unstable? Do you know how to do stability analysis a la von Neumann? If not we can chat about it when we talk next.
Why you didn’t like my gaussian suggestion? You seem to imply that you can’t have periodic bcs with gaussian initial condition. Am I interpreting the hidden messages correctly? :)
@dhruvbhagtani2105 I had a look and have lots of questions. The notebook is not self-explanatory. Shall we talk perhaps or shall I write my comments here?
But before addressing the notebook I'd like to discuss
1) why you think that gaussian won't work? did you try it? (I have tried it.)
2) forward in time, backwards in space scheme is not unstable necessarily, why do you say that? That is, if we denote φ(x_j, t_n) = φⱼⁿ
then why do you claim that (φⱼⁿ⁺¹ - φⱼⁿ) / dt = -U (φⱼⁿ-φⱼ₋₁ⁿ) / dx
is unstable?
Yes, I know how to do von Neumann stability analysis, and the forward (backward) Euler explicit scheme is unstable for negative (positive) advection velocity. Did these doubts go away after our chat yesterday?
Yes, just wanted to be sure you know how to do that. Great!
Do you have a feeling intuitively why forward scheme for space won't work when you have a positive advecting velocity?
Let's start with the advection equation in 1D
where
u = constant
andφ(x, t)
a tracer concentration.[ ] Start with a gaussian and advect it for time
t
such that it moves distanceu*t
. Don't maket
too big so that it hits the boundaries or gets outside of the domain.[ ] Write down the analytic solution and plot them together. Or plot also the difference between the numerical and the analytical solutions.
[ ] Try a forward-time 1st order scheme and backwards-space for computing the partial derivatives. How does the analytical and the numerical compare?
[ ] Can you explain why is that?
[ ] Then use a centred-time, centred-space scheme. Now what's the difference from before.
[ ] Can you explain why?
(I hope this is not boring...)