CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

2nd order Upwind Scheme (FDM)

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By agd

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 20, 2019, 06:47
Post 2nd order Upwind Scheme (FDM)
  #1
New Member
 
Jayabrata Dhar
Join Date: Nov 2018
Posts: 17
Rep Power: 8
jd87 is on a distinguished road
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.

[IMG]https://doc-0c-2s-docs.googleusercontent.com/docs/securesc/ha0ro937gcuc7l7deffksulhg5h7mbp1/jtrqejfqmdige42m1bjdhnpue7r3o5t9/1553076000000/02266267703806582586/*/1WrAE_vC_RLNlIgQPHusJ2AOmB2HPjG3A[/IMG]

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
File Type: jpg CFD_online.jpg (39.6 KB, 25 views)
jd87 is offline   Reply With Quote

Old   March 20, 2019, 08:04
Default
  #2
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,882
Rep Power: 73
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
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.
FMDenaro is offline   Reply With Quote

Old   March 20, 2019, 12:02
Default
  #3
Senior Member
 
Eifoehn4's Avatar
 
-
Join Date: Jul 2012
Location: Germany
Posts: 184
Rep Power: 14
Eifoehn4 is on a distinguished road
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.
Eifoehn4 is offline   Reply With Quote

Old   March 20, 2019, 12:44
Default
  #4
New Member
 
Jayabrata Dhar
Join Date: Nov 2018
Posts: 17
Rep Power: 8
jd87 is on a distinguished road
Quote:
Originally Posted by Eifoehn4 View Post
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
jd87 is offline   Reply With Quote

Old   March 20, 2019, 12:48
Default
  #5
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,882
Rep Power: 73
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Quote:
Originally Posted by jd87 View Post
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.
FMDenaro is offline   Reply With Quote

Old   March 20, 2019, 13:01
Default
  #6
agd
Senior Member
 
Join Date: Jul 2009
Posts: 358
Rep Power: 19
agd is on a distinguished road
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.
agd is offline   Reply With Quote

Reply

Tags
boundary condition error, fdm, second-order upwind


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Third order MUSCL Scheme 94bb494nd41f FLUENT 4 January 25, 2024 13:23
Implementation of 2nd order upwind scheme jaason OpenFOAM Running, Solving & CFD 4 February 6, 2015 18:40
grid independence and first order upwind scheme yhy20081016 Main CFD Forum 4 February 24, 2014 00:09
IS calc. with 2nd order discret. always necessary? Azman FLUENT 2 March 14, 2013 05:28
second order FD upwind scheme Heinz Wilkening Main CFD Forum 2 November 3, 1998 15:33


All times are GMT -4. The time now is 12:47.