# 2nd order Upwind Scheme (FDM)

 Register Blogs Members List Search Today's Posts Mark Forums Read

March 20, 2019, 05:47
2nd order Upwind Scheme (FDM)
#1
New Member

Jayabrata Dhar
Join Date: Nov 2018
Posts: 9
Rep Power: 6
It is a peculiar thing I noticed that the 1st order FDM scheme gives a realistic result than a 2nd order one-sided FDM scheme for approximating first-order derivatives. See the image below for the one-sided approximation.

I am using a one-sided approximation for a simple 2nd order upwind scheme wherein my velocity is positive at i=3 (I want to avoid a 1st order scheme for numerical diffusivity issues). Now, because of this anomaly, my code is predicting a negative concentration in spite of concentration at the boundary is 1 (u1) and all other points are zero (u2, u3 and so on) at the initial time. Please note, I have written a 3D geometric multigrid code but given the example of a 1D situation for easier explanation. Since in the first time I am encountering a negative u, the later times are therefore giving all wrong results. It would be really kind of any of the members to let me know is there any simpler scheme to get rid of this issue without sacrificing the 2nd-order accuracy. Thank you in advance.
Attached Images
 CFD_online.jpg (39.6 KB, 21 views)

 March 20, 2019, 07:04 #2 Senior Member   Filippo Maria Denaro Join Date: Jul 2010 Posts: 6,386 Rep Power: 67 To understand clearly the effect of the second order upwind formula I suggest to see the modified wavenumber (real and imaginary parts), you will discover a strange behavior. Of course you have to take into account the global effect when a time discretization is in effect, too.

 March 20, 2019, 11:02 #3 Senior Member     - Join Date: Jul 2012 Location: Germany Posts: 175 Rep Power: 12 Your example is ill posed, because 1. You want to compare gradient approximations with non-smooth functions, the result is meaningless. 2. Higher order methods does not mean immediately more accuracy. It tells you something about the decay of the error if you increase your DOFs. __________________ Check out my side project: A multiphysics discontinuous Galerkin framework: Youtube, Gitlab.

March 20, 2019, 11:44
#4
New Member

Jayabrata Dhar
Join Date: Nov 2018
Posts: 9
Rep Power: 6
Quote:
 Originally Posted by Eifoehn4 2. Higher order methods does not mean immediately more accuracy. It tells you something about the decay of the error if you increase your DOFs.
So what is the way out in this situation if one wants a 2nd order accuracy?
Whatever you said is true but the strange fact is that it gives an answer worse than 1st order, which was bothering me. I found that no linear 2nd order accurate upwind schemes are safe from generating local or global extremum (minimum or maximum), only the first-order upwind scheme is safer in this sense (with a loss in the accounting of numerical diffusivity). So, I have to shift to non-linear upwind schemes (like TVD). Nevertheless, I was curious if there is still a way to get around the above issue for such a simple boundary condition of the wall having a Dirichlet value while all other points are zero.
PS: Thanks for all the above replies

March 20, 2019, 11:48
#5
Senior Member

Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,386
Rep Power: 67
Quote:
 Originally Posted by jd87 So what is the way out in this situation if one wants a 2nd order accuracy? Whatever you said is true but the strange fact is that it gives an answer worse than 1st order, which was bothering me. I found that no linear 2nd order accurate upwind schemes are safe from generating local or global extremum (minimum or maximum), only the first-order upwind scheme is safer in this sense (with a loss in the accounting of numerical diffusivity). So, I have to shift to non-linear upwind schemes (like TVD). Nevertheless, I was curious if there is still a way to get around the above issue for such a simple boundary condition of the wall having a Dirichlet value while all other points are zero. PS: Thanks for all the above replies

What you are discovering is the basic knowledge of CFD. The first thing to know is the concept of monotonic scheme and the consequence of the Godunov theorem.
Then, any accuracy order evaluation can be done only on regular smooth functions.

 March 20, 2019, 12:01 #6 Senior Member   Join Date: Jul 2009 Posts: 337 Rep Power: 17 Another way to think about is that when you choose a 2nd order approximation to the derivative, you are making an underlying assumption that your data can be approximated by a quadratic function. Your example is better approximated by a piecewise linear function, which is the underlying functional representation for a 1st order derivative approximation. So it is not surprising that your results show what you see. Numerical schemes have formal orders of accuracy, and practical orders of accuracy. Applying a formally second order accurate algorithm to a problem requires attention to the details of your problem to ensure that you get 2nd order accuracy at the end. jd87 likes this.

 Tags boundary condition error, fdm, second-order upwind