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

Which Finite Difference Scheme to use?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 21, 2007, 15:43
Default Which Finite Difference Scheme to use?
  #1
Frank
Guest
 
Posts: n/a
Hello Folks, I'm currently trying to write a code to solve the one-way wave equation (1st order wave-equation):

u_x + u_t =0

with boundary condition: u(0,t)=sin(t) and initial condition: u(x,0)= sinx

I have to solve this on a very large domain (x=0 -> 500) with a small timestep (dt approx 0.001). I have a stretched grid with very small values of dx near the x=0 end of the domain and very large step sizes towards the x=500 end.

Could someone please suggest a scheme that would be capable of dealing with this problem? I've tried a couple of schemes but have found instabilities when I try to adapt them to work on a stretched grid. To clarify, my grid is cartesian and the x-spacing is linearly stretched such that dx(I+1)=k*dx(I) where K is approximately 1.05.

If anyone could advise then I'd be very grateful, F
  Reply With Quote

Old   March 21, 2007, 17:37
Default Re: Which Finite Difference Scheme to use?
  #2
Lost in CFD
Guest
 
Posts: n/a
Well first, check to to see what your largest delta x value is at the outflow boundary. Make sure that if you are solving the equation explicitly, that your CFL number is within the range that you expect.

Also, obviously make sure that you are not using a forward differencing scheme, this will cause instabilities instantly.

If for some reason, you have growing waves or anything like that, you could use a backward difference scheme: [F(i) - F(i-1)] / deltax will help the solution damp itself.

Other than that, exactly what type of instabilities are you getting?
  Reply With Quote

Old   March 21, 2007, 18:34
Default Re: Which Finite Difference Scheme to use?
  #3
Harish
Guest
 
Posts: n/a
Have a look at ICASE/LaRC workshop.It is available on NASA server.Many different numerical schemes have been discussed for application to the wave equation.
  Reply With Quote

Old   March 22, 2007, 08:24
Default Re: Which Finite Difference Scheme to use?
  #4
Paolo Lampitella
Guest
 
Posts: n/a
Could you write the schemes used? This may help more than a series of question.
  Reply With Quote

Old   March 23, 2007, 17:46
Default Re: Which Finite Difference Scheme to use?
  #5
Guillermo Marraco
Guest
 
Posts: n/a
As I understand, you want to solve a one_space-dimentional equation:

au/ax+au/at=0 (a means partial derivative)

this equation have a very simply analitical solution:

Any function moving with unitary speed.

Take any function u(x), and make it move in time composing with the function x-t:

Solution=u(x-t).

Since your initial condition is u(x-0)=sin(x), make this sin(x) function move: u(x,t)=sin(x-t).

You are in bad luck u(x=0,t)=sin(-t)=-sin(t). It does not match your boundary conditions. But because the information flows from left to right, it does not matter. take this function=

u=sin(-x-t) (for x<=0, t=0) u=sin(x-t) (for x=>0, t=0)

and move it to left with speed dx/dt=1
  Reply With Quote

Old   March 26, 2007, 12:53
Default Update
  #6
Frank
Guest
 
Posts: n/a
Hello folks, I appreciate the comments that people have left - it's a big help having a forum like this where we can discuss such things. I've not had computer access for the past few days so this is my first chance to reply to your posts.

I realise that there is an analytical solution to the problem that I posed in my original post. The problem I presented, however, is merely a model problem I'm trying to solve numerically with the upstream boundary condition u(0,t) = sin(-t). My hope is that as this solver will also work when the upstream is not prescribed but varies in a similar way to the sine curve. Guillermo was correct in stating that the upstream BC i stated previously should have been "u(0,t)=-sin(t)"; forgetting to include the -ve sign that was a typo on my part.

I have tried an explicit scheme (which blew up because of the large dx spacing downstream made everything unstable); a first order implicit scheme (backwards time, backwards space) as well as the crank nicolson scheme.

Plotting my numerical curves against the analytical solutions I find that near the upstream edge where the mesh is fine I have good agreement but as the mesh spacing increases downstream the numerical solution is not a very good match.

Does anyone know of a good scheme to solve this problem on a stretched cartesian grid or perhaps a way that I could adapt an existing scheme to make it suitable for this grid-stretching?

Many thanks, F
  Reply With Quote

Old   March 28, 2007, 12:03
Default Re: Update
  #7
Guillermo Marraco
Guest
 
Posts: n/a
Do you want to do it as an exercise in finite difference, or really need to solve this problem, as part of some other problem?

Explicit schemes generally fail when the timestep At is bigger enough to allow the fluid to travel more distance than the space-step Ax (A meaning uppercase greek delta letter).

If your speed is v=1, try At<Ax.

If you need an efficient solver, on a constant Ax grid, for any boundary condition, I have developped an efficient discrete solver using the fast fourier transform, for the Muskingham method, that is very similar.

I have writted it in spanish, and plan to traslate it to english, and to wikipedia. Today is a ms word document (and an excel worksheet example).

If you are interested, just tell.

I want to generalize it to a Saint Vennant solver, but can't manage the nasty avē/ax term...
  Reply With Quote

Old   March 28, 2007, 12:22
Default Re: Update
  #8
Guillermo Marraco
Guest
 
Posts: n/a
I wanted to write:

"If your speed is v=1, try At<Ax"

Also, you need to differentiate betwen "schemes with point values" (that need to be interpolated betwen points), and "averaged over each discrete step". They are similar algorithms, but need subtle adaptations.
  Reply With Quote

Old   March 28, 2007, 12:28
Default Re: Update
  #9
Guillermo Marraco
Guest
 
Posts: n/a
I wanted to write:

"If your speed is v=1, try At less than Ax"

It looks like a wiki-bug does not accept the character "less than"
  Reply With Quote

Reply


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
Finite element vs. finite difference Francisco Saldarriaga Main CFD Forum 23 December 17, 2014 09:21
quick scheme in finite difference method ps Main CFD Forum 2 June 23, 2008 03:02
Finite Volume WENO Scheme DSS Main CFD Forum 3 January 15, 2007 04:47
Fininte difference and Finite element Technique Mahendra Singh Mehra FLUENT 3 December 23, 2005 00:49
Conservative finite difference scheme? Linfeng BI Main CFD Forum 1 October 10, 2002 13:17


All times are GMT -4. The time now is 10:52.