|
[Sponsors] |
Upwind scheme blows up when encountered a peak |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 6, 2018, 21:10 |
Upwind scheme blows up when encountered a peak
|
#1 |
Senior Member
|
Hello,
I am solving a nonlinear hyperbolic equation using simple upwind scheme with discontinuity in the solution. But when a peak occurred, the solution blows up, just as the one in the attached figure, the right-hand side peak keeps increasing until inf eventually. When I tried Lax-Friedrichs, it all went well: the peak reaches 100 and stop increasing, which is expected. Upwind is much more diffusive than LF, so I think this blow-up should not happened. But I really don't know why this is happening. Is it upwind invalid for this situation? Any thoughts? 1.jpg Thx. |
|
March 7, 2018, 04:45 |
|
#2 |
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,897
Rep Power: 73 |
Provided that you are fulfilling the stability constraint, You have for sure a bug in the code.
|
|
March 7, 2018, 17:58 |
|
#3 | ||
Senior Member
|
Quote:
On the other hand, I checked and checked my code, I don't see any bugs. The equation I am solving is , where, and c are constant, but varies with x. Anyway, denoting , than I write this code for upwind: where unew stands for the u for next time level, I don't know where it goes wrong. Codes for the upwind (for MATLAB): Quote:
|
|||
March 7, 2018, 18:12 |
|
#4 |
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,897
Rep Power: 73 |
The upwind criterion is applied considering the characteristic direction, therefore you have to consider both the signs of the advective velocity. Are you sure that your problem has always a positive advection component?
|
|
March 7, 2018, 19:12 |
|
#5 |
Senior Member
|
Yes, the convective velocity will always be positive.
|
|
March 7, 2018, 19:31 |
|
#6 | ||
Senior Member
|
Quote:
Quote:
|
|||
March 8, 2018, 05:15 |
|
#7 |
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,897
Rep Power: 73 |
Ok, let me some time, I never solved numerically this equation, I will have a look. However, I suggest to write the code in terms of the FV formulation, computing first the fluxes and then performing the update.
|
|
March 8, 2018, 12:41 |
|
#8 |
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,897
Rep Power: 73 |
I insert the plot into the code to see the evolution step-by-step. I see the left branch becoming a shock wave and the right branch becoming a rarefaction wave. The simulation run until a small wiggle is produced at the basis of the rarefaction wave, near the value u=0.
Therefore, I assume that your solution produces some very small negative value that will be amplified owing to the assumed positive upwind. That is a numerical instability. I suggest to translate the initial solution adding a positive constant (also simply 1) to avoid having small negative velocity. Otherwise, check the negative event and set the value to zero. I suggest also to replicate the case illustrated in the book of Leveque a page 206, you could also check for the source with the Godunov scheme. |
|
March 8, 2018, 18:11 |
|
#9 | |
Senior Member
|
Quote:
2.jpg1.jpg I highlighted the negative velocity and some wiggle(I suppose). Are these what you mentioned? |
||
March 8, 2018, 18:21 |
|
#10 | |
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,897
Rep Power: 73 |
Quote:
Just plot u at each time step and you will see creating a small wiggles at the expansion front (about x=30) that will be amplified. The shock is well resolved. Thus, check again your code for some bug. |
||
March 8, 2018, 18:26 |
|
#11 | |
Senior Member
|
Quote:
1.jpg2.jpg If you do mean this one, I think this is what expected to happen, since the wave is kind of "congested" in this section. |
||
March 8, 2018, 18:27 |
|
#12 |
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,897
Rep Power: 73 |
Yes, it is.
Are you sure about the way you set the periodic BC.s? |
|
March 8, 2018, 18:36 |
|
#14 | |
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,897
Rep Power: 73 |
Quote:
I don't know the physics of the problem but you should see a coalescence in the characteristic lines to generate a discontinuity |
||
March 8, 2018, 18:56 |
|
#15 | |
Senior Member
|
Quote:
1.jpg2.jpg3.jpg The peak (or as you said, wiggle) at the most-right will gets thicker and thicker, eventually entire wave will reform into a higher, thinner square wave, comparing to the initial solution. The maximum peak should stop at around u=100, which will never generate negative velocity. But with upwind, I don't see "congestion" at x=30, so for this peak, instead of getting thicker, it gets higher and higher. This is what I am wondering about. |
||
March 8, 2018, 19:17 |
|
#16 | |
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,897
Rep Power: 73 |
Quote:
Ok, the problem depends on the function v(x), it should be better described in the x,t plane by looking at the characteristic curves. As I wrote before, I never solved this specific problem that is slightly different from the example in the Leveque book. The rarefaction front should encounter a low or vanishing velocity in such a way to generate compression. However, I see that continuing the run, after some time the u plot shows negative values. Could you write me the initial condition u(x,0) and the function v(x)? |
||
March 8, 2018, 19:20 |
|
#17 | |
Senior Member
|
Quote:
|
||
March 8, 2018, 19:43 |
|
#18 | |
Senior Member
|
Quote:
|
||
March 9, 2018, 04:57 |
|
#19 |
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,897
Rep Power: 73 |
Well, I see that v0 produces a variation for x>=30 but the initial condition is upward. That makes me suppose that the starting of the compression region is downwind with respect to the used stencil [i-1,i]. Somehow, that does not respect the upwind criterion. I am not sure if this is the problem, just check the sign of the characteristic. This problem has differences from the standard non-linear Burgers equation. |
|
March 9, 2018, 14:52 |
|
#20 |
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,897
Rep Power: 73 |
I wrote few lines about your problem, I suggest to read 16.4.1 and 16.4.2 in the book of Leveque. You will see that the definition of the upwind criterion is quite more complex than you supposed.
|
|
Tags |
hyperbolic functions, lax-friedrichs, nonlinear equation, upwind schemes |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
bounded Gauss upwind Scheme | deepinheart | OpenFOAM Running, Solving & CFD | 1 | February 23, 2015 06:57 |
Implementation of 2nd order upwind scheme | jaason | OpenFOAM Running, Solving & CFD | 4 | February 6, 2015 18:40 |
2nd order upwind vs 2nd order upwind!!! | Far | Main CFD Forum | 7 | March 14, 2013 13:29 |
Use of upwind scheme for interpolation of u/v | quarkz | Main CFD Forum | 6 | August 30, 2011 05:10 |
2nd order upwind scheme (Fluent and CFX) | Far | FLUENT | 0 | May 22, 2011 02:50 |