# Which Finite Difference Scheme to use?

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

 March 21, 2007, 15:43 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

 March 21, 2007, 17:37 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?

 March 21, 2007, 18:34 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.

 March 22, 2007, 08:24 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.

 March 23, 2007, 17:46 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

 March 26, 2007, 11:53 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

 March 28, 2007, 11:03 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

 March 28, 2007, 11:22 Re: Update #8 Guillermo Marraco Guest   Posts: n/a I wanted to write: "If your speed is v=1, try At

 March 28, 2007, 11:28 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"

 Thread Tools Display Modes Linear Mode

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

 Similar Threads Thread Thread Starter Forum Replies Last Post Francisco Saldarriaga Main CFD Forum 23 December 17, 2014 09:21 ps Main CFD Forum 2 June 23, 2008 02:02 DSS Main CFD Forum 3 January 15, 2007 04:47 Mahendra Singh Mehra FLUENT 3 December 23, 2005 00:49 Linfeng BI Main CFD Forum 1 October 10, 2002 12:17

All times are GMT -4. The time now is 20:31.