|
[Sponsors] |
September 26, 2018, 15:01 |
|
#21 | |
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,896
Rep Power: 73 |
Quote:
You are using a wrong periodic condition! if you see the profile it does not repeat periodically |
||
September 26, 2018, 17:47 |
|
#22 |
Senior Member
|
||
September 26, 2018, 17:52 |
|
#23 | |
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,896
Rep Power: 73 |
Quote:
If you use periodic BC, the initial signal must be periodic, the function and all derivatives must be the same. Therefore, given L the lenght of periodicity you can choose a wavenumber k=1,2... and setting the sine at 2*pi*k/L. |
||
September 26, 2018, 18:24 |
|
#24 |
Senior Member
|
Ok, I fixed the problem. Now it gives 1st order convergence. But how does it relate to my original 4th-order scheme?
|
|
September 26, 2018, 18:38 |
|
#25 |
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,896
Rep Power: 73 |
||
September 26, 2018, 18:41 |
|
#26 |
Senior Member
|
Ok, I'll try this sine wave for my original scheme and see if it can give me 4th order convergence. And I'll get back to you.
|
|
September 27, 2018, 02:34 |
|
#27 | |
Senior Member
|
Quote:
As in the figure below (I use collocated mesh), I have N+1 interior points and the boundary points, 6 ghost points in total (3 on each sides). As can see, point 4 and N+1 are boundary points, points 1~3 and N+5~N+7 are ghost points. I only evaluate the derivative on the interior points 5 ~ N+3. As for the periodic BC, I do (assuming f is the original function I am solving) Code:
f(N+4 : N+7) = f(5 : 8); f(1 : 4) = f(N : N+3); Screen Shot 2018-09-26 at 10.28.01 PM.jpg |
||
September 27, 2018, 03:35 |
|
#28 |
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,896
Rep Power: 73 |
Assume that the periodicity lenght L goes from node i=1 at x=0 and i=N at x=L. Ath the boundaries, then you solve the equation only at the node i=1 (or i=N) and set the peridocity prescribing the same value at i=N. Of course you get
f(0)=f(N-1) f(-1)=f(N-2) .... f(N+1)=f(2) f((N+2)=f(3) the periodicity must work this way. Otherwise the bug is in your 4th order discretization. |
|
September 27, 2018, 03:42 |
|
#29 | ||
Senior Member
|
Quote:
Quote:
Code:
f(1) = f(N) Code:
f(N) = f(1) |
|||
September 27, 2018, 04:20 |
|
#30 | |
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,896
Rep Power: 73 |
Quote:
No. You need to solve the wave equation into the domain using the upwinding and that depends on the sign of the velocity in deciding the stencil for the derivative. That has nothing to do with the setting of periodic BC.s that is totally independent from the scheme that is adopted and does not depend on the velocity. Setting the correct periodicity means that if you solve the equation at i=1 and the velocity is, for example, positive, the derivative is (f(1)-f(0))/dx and the correct setting of the periodiciy make this exactly equal to (f(1)-f(N-1))/dx. Once computed the updated at i=1, just set the update at i=N without solving the equations. |
||
September 27, 2018, 04:34 |
|
#31 | |
Senior Member
|
Quote:
|
||
September 27, 2018, 18:01 |
|
#32 | |
Senior Member
|
Quote:
And I can get 4th order in space with fixed small time step. But for the temporal convergence, at the beginning, the error is already somewhere 1E-8 (with fixed small grid size). And getting smaller gives the same magnitude of error, i.e., the order is O(0). How can I fix this? |
||
September 28, 2018, 01:29 |
|
#33 | |
Senior Member
|
Quote:
I set grid size to a small value to avoid the error swamp the temporal error. However, since dt is bounded by CFL and dx. If set dx small, even with CFL=1, the error is already push to 1E-12. Lowering dt doesn't give a much better result. If I am getting 4th order convergence with lowering dt dx at the same time, is it safe to assume that my time integral is 4th order as well? Since it's not compromising the total order. |
||
September 28, 2018, 03:35 |
|
#34 | |
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,896
Rep Power: 73 |
Quote:
Consistence requires that the LTE vanishes as the time and space steps go to zero therefore you are assessing that there is no bug in the scheme. Start again the time accuracy check using the one-step error, this way you can use any CFL since there is no stability problem. You should be able to see the error slope. |
||
September 29, 2018, 18:12 |
|
#35 | |
Senior Member
|
Quote:
CFL = 1000, error_max ~ 1E-4; CFL = 100, error_max ~ 1E-8; CFL = 10, error_max ~ 1E-12. It does has 4th order in time now. It just feel wired that CFL went to 1000.... |
||
September 29, 2018, 18:17 |
|
#36 |
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,896
Rep Power: 73 |
||
September 29, 2018, 18:19 |
|
#37 |
Senior Member
|
||
September 30, 2018, 03:07 |
|
#38 |
Senior Member
|
||
September 30, 2018, 03:29 |
|
#39 |
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,896
Rep Power: 73 |
||
September 30, 2018, 03:30 |
|
#40 |
Senior Member
|
||
Tags |
convergence check, runge kutta method, time accurate |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Extrusion with OpenFoam problem No. Iterations 0 | Lord Kelvin | OpenFOAM Running, Solving & CFD | 8 | March 28, 2016 12:08 |
simpleFoam error - "Floating point exception" | mbcx4jc2 | OpenFOAM Running, Solving & CFD | 12 | August 4, 2015 03:20 |
PimpleFoam: check for convergence within time step | Begineer | OpenFOAM Running, Solving & CFD | 3 | April 21, 2014 18:42 |
How to write k and epsilon before the abnormal end | xiuying | OpenFOAM Running, Solving & CFD | 8 | August 27, 2013 16:33 |
critical error during installation of openfoam | Fabio88 | OpenFOAM Installation | 21 | June 2, 2010 04:01 |