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

Smaller time step results in less accuracy!!

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

Like Tree4Likes
  • 2 Post By FMDenaro
  • 1 Post By FMDenaro
  • 1 Post By cfdnewbie

Reply
 
LinkBack Thread Tools Display Modes
Old   April 26, 2013, 12:02
Unhappy Smaller time step results in less accuracy!!
  #1
New Member
 
Feri
Join Date: Jun 2011
Posts: 11
Rep Power: 6
farshadn12 is on a distinguished road
Hi guys,

I'm writing a code in Fortran that solves a 2D Taylor-Green 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.)

2-Smaller time steps result in less accuracy.

To check my code, I ran a Lid-driven 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.
farshadn12 is offline   Reply With Quote

Old   April 26, 2013, 12:26
Default
  #2
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 1,577
Rep Power: 20
FMDenaro will become famous soon enough
Quote:
Originally Posted by farshadn12 View Post
Hi guys,

I'm writing a code in Fortran that solves a 2D Taylor-Green 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.)

2-Smaller time steps result in less accuracy.

To check my code, I ran a Lid-driven 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.
Hi,
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?
FMDenaro is offline   Reply With Quote

Old   April 26, 2013, 14:21
Default
  #3
New Member
 
Feri
Join Date: Jun 2011
Posts: 11
Rep Power: 6
farshadn12 is on a distinguished road
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 x-velocity 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)
farshadn12 is offline   Reply With Quote

Old   April 26, 2013, 14:35
Default
  #4
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 1,577
Rep Power: 20
FMDenaro will become famous soon enough
Quote:
Originally Posted by farshadn12 View Post
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 x-velocity 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)

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
Far and RodriguezFatz like this.
FMDenaro is offline   Reply With Quote

Old   April 29, 2013, 07:42
Default
  #5
Senior Member
 
RodriguezFatz's Avatar
 
Philipp
Join Date: Jun 2011
Location: Germany
Posts: 1,097
Rep Power: 16
RodriguezFatz will become famous soon enough
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.
RodriguezFatz is offline   Reply With Quote

Old   April 30, 2013, 03:27
Default
  #6
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 1,577
Rep Power: 20
FMDenaro will become famous soon enough
Quote:
Originally Posted by RodriguezFatz View Post
If I may add something: it would be really nice, to post all these pictures here in the forum!
I analyzed these problems in some papers published some years ago on IJNMF. You can find many figures about the accuracy analysis
FMDenaro is offline   Reply With Quote

Old   April 30, 2013, 04:02
Default
  #7
Senior Member
 
RodriguezFatz's Avatar
 
Philipp
Join Date: Jun 2011
Location: Germany
Posts: 1,097
Rep Power: 16
RodriguezFatz will become famous soon enough
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.
RodriguezFatz is offline   Reply With Quote

Old   April 30, 2013, 04:16
Default
  #8
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 1,577
Rep Power: 20
FMDenaro will become famous soon enough
Quote:
Originally Posted by RodriguezFatz View Post
Thank you for the direction!
I found this:
http://onlinelibrary.wiley.com/doi/1...d.520/abstract
Any more?
yes, this one can be complementary

http://onlinelibrary.wiley.com/doi/1...d.598/abstract
RodriguezFatz likes this.
FMDenaro is offline   Reply With Quote

Old   May 3, 2013, 09:54
Default
  #9
New Member
 
Feri
Join Date: Jun 2011
Posts: 11
Rep Power: 6
farshadn12 is on a distinguished road
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.
farshadn12 is offline   Reply With Quote

Old   May 3, 2013, 14:46
Default
  #10
Senior Member
 
cfdnewbie
Join Date: Mar 2010
Posts: 551
Rep Power: 11
cfdnewbie is on a distinguished road
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.
farshadn12 likes this.
cfdnewbie is offline   Reply With Quote

Old   May 3, 2013, 15:09
Default
  #11
New Member
 
Feri
Join Date: Jun 2011
Posts: 11
Rep Power: 6
farshadn12 is on a distinguished road
Quote:
Originally Posted by cfdnewbie View Post
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.
That's exactly what I wasn't doing. Everything is fine now. Thanks for your response.
farshadn12 is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 04:18.