
[Sponsors] 
April 26, 2013, 12:02 
Smaller time step results in less accuracy!!

#1 
New Member
Feri
Join Date: Jun 2011
Posts: 11
Rep Power: 6 
Hi guys,
I'm writing a code in Fortran that solves a 2D TaylorGreen vortex problem. I'm implementing RK3 with central differences discretization in space and periodic boundary conditions everywhere. I plot the results and they look good. I also compare the results against the analytical solution and they seem close enough. But there are two issues: 1 The order of accuracy in space is 2.4!!!! (Theoretically it is be 2, so in reality it should be less.) 2Smaller time steps result in less accuracy. To check my code, I ran a Liddriven cavity problem and all looks fine. I'm comparing streamlines against those in published journal articles. Does anyone have any idea what might be wrong? My first thoughts went to boundary and initial conditions but I've checked them both and they seem to be fine. 

April 26, 2013, 12:26 

#2  
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 1,577
Rep Power: 20 
Quote:
first, could you give these details? 1) what about the formulation you use, is it a projection method? 2) how do you perform the accuracy analysis, do you take dt/h constant (and in the stability region) and check for the error in some norm? what about the chosen norm? 3) Are you performing the the test on the analytical Taylor solution as in http://www.sciencedirect.com/science...21999185901482 ? 4) when you say that for smaller dt the solution is less accurate, do you see a deviation in the slope of the error convergence? Did you take h fixed? 

April 26, 2013, 14:21 

#3 
New Member
Feri
Join Date: Jun 2011
Posts: 11
Rep Power: 6 
Yes I use a projection method, Runge Kutta 3rd order. Fully explicit.
Domain size is: 0 < x,y < 2*pi Uniform grid 32x32 dt is constant. I run the case for dt = 0.001 and 0.0001 sec Flow time is 2sec. As for the error analysis, I subtract the analytical and numerical values od say xvelocity and consider the largest error. I don't normalize. The analytical solutions are provided by the professor whose homework assignment this is, so I'm fairly sure they are correct: u = e^(2*t) * cos(x) * sin (y) v = e^(2*t) * sin(x) * cos(y) 

April 26, 2013, 14:35 

#4  
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 1,577
Rep Power: 20 
Quote:
Ok, follow these steps: 1) fix a uniform 128 x 128 grid 2) compute the maximum error for dt=0.1, 0.05, 0.01, 0.05, 0.001 3) plot the error versus the dt in a double logarithmic scale. 4) repeat the same procedure but now fixing a uniform 628 x 628 grid, you should see that the error slope is more extended than before. That depends on the local truncation error fixed by the spatial mesh measure. 5) Finally, perform the error analysis on a 32, 64, 128, 256, 628 mesh but by taking constant dt/h 

April 29, 2013, 07:42 

#5 
Senior Member
Philipp
Join Date: Jun 2011
Location: Germany
Posts: 1,097
Rep Power: 16 
If I may add something: it would be really nice, to post all these pictures here in the forum!
__________________
The skeleton ran out of shampoo in the shower. 

April 30, 2013, 03:27 

#6 
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 1,577
Rep Power: 20 

April 30, 2013, 04:02 

#7 
Senior Member
Philipp
Join Date: Jun 2011
Location: Germany
Posts: 1,097
Rep Power: 16 
Thank you for the direction!
I found this: http://onlinelibrary.wiley.com/doi/1...d.520/abstract Any more?
__________________
The skeleton ran out of shampoo in the shower. 

April 30, 2013, 04:16 

#8  
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 1,577
Rep Power: 20 
Quote:
http://onlinelibrary.wiley.com/doi/1...d.598/abstract 

May 3, 2013, 09:54 

#9 
New Member
Feri
Join Date: Jun 2011
Posts: 11
Rep Power: 6 
So I was able to fix the problem and now the spatial accuracy is second order. the temporal accuracy however is practically constant. It's zero order.


May 3, 2013, 14:46 

#10 
Senior Member
cfdnewbie
Join Date: Mar 2010
Posts: 551
Rep Power: 11 
How do you determine the temporal order? The usual way to do it is to choose the spatial discretization so fine that the spatial error is essentially zero, and then check the time order.


May 3, 2013, 15:09 

#11 
New Member
Feri
Join Date: Jun 2011
Posts: 11
Rep Power: 6 
That's exactly what I wasn't doing. Everything is fine now. Thanks for your response.


Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
High Courant Number @ icoFoam  Artex85  OpenFOAM Running, Solving & CFD  9  January 3, 2012 09:06 
Upgraded from Karmic Koala 9.10 to Lucid Lynx10.04.3  bookie56  OpenFOAM Installation  8  August 13, 2011 04:03 
Full pipe 3D using icoFoam  cyberbrain  OpenFOAM  4  March 16, 2011 10:20 
DPM UDF particle position using the macro P_POS(p)[i]  dm2747  FLUENT  0  April 17, 2009 01:29 
Could anybody help me see this error and give help  liugx212  OpenFOAM Running, Solving & CFD  3  January 4, 2006 19:07 